@perses-dev/plugin-system 0.0.0-snapshot-panel-extra-content-3-17f9c42 → 0.0.0-snapshot-scatterplot-fix-imports-95e1b59

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 (425) hide show
  1. package/dist/cjs/components/CalculationSelector/CalculationSelector.js +7 -5
  2. package/dist/cjs/components/CalculationSelector/index.js +10 -8
  3. package/dist/cjs/components/DatasourceEditorForm/DatasourceEditorForm.js +350 -0
  4. package/dist/cjs/components/DatasourceEditorForm/index.js +30 -0
  5. package/dist/cjs/components/DatasourceSelect.js +137 -25
  6. package/dist/cjs/components/LegendOptionsEditor/LegendOptionsEditor.js +19 -17
  7. package/dist/cjs/components/LegendOptionsEditor/index.js +10 -8
  8. package/dist/cjs/components/OptionsEditorRadios/OptionsEditorRadios.js +25 -30
  9. package/dist/cjs/components/OptionsEditorRadios/index.js +10 -8
  10. package/dist/cjs/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js +7 -5
  11. package/dist/cjs/components/OptionsEditorTabPanel/index.js +10 -8
  12. package/dist/cjs/components/OptionsEditorTabs/OptionsEditorTabs.js +13 -11
  13. package/dist/cjs/components/OptionsEditorTabs/index.js +10 -8
  14. package/dist/cjs/components/PanelSpecEditor/PanelSpecEditor.js +60 -19
  15. package/dist/cjs/components/PanelSpecEditor/index.js +10 -8
  16. package/dist/cjs/components/PluginEditor/PluginEditor.js +25 -32
  17. package/dist/cjs/components/PluginEditor/index.js +11 -9
  18. package/dist/cjs/components/PluginEditor/plugin-editor-api.js +8 -6
  19. package/dist/cjs/components/PluginKindSelect/PluginKindSelect.js +25 -14
  20. package/dist/cjs/components/PluginKindSelect/index.js +10 -8
  21. package/dist/cjs/components/PluginRegistry/PluginRegistry.js +11 -9
  22. package/dist/cjs/components/PluginRegistry/index.js +10 -8
  23. package/dist/cjs/components/PluginRegistry/plugin-indexes.js +7 -3
  24. package/dist/cjs/components/PluginSpecEditor/PluginSpecEditor.js +9 -7
  25. package/dist/cjs/components/PluginSpecEditor/index.js +10 -8
  26. package/dist/cjs/components/ProjectSelect.js +96 -0
  27. package/dist/cjs/components/TimeRangeControls/TimeRangeControls.js +192 -0
  28. package/dist/cjs/components/TimeRangeControls/index.js +30 -0
  29. package/dist/cjs/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.js +45 -49
  30. package/dist/cjs/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.js +23 -21
  31. package/dist/cjs/components/TimeSeriesQueryEditor/index.js +10 -8
  32. package/dist/cjs/components/TraceQueryEditor/TraceQueryEditor.js +143 -0
  33. package/dist/cjs/components/TraceQueryEditor/TraceQueryInput.js +96 -0
  34. package/dist/cjs/components/TraceQueryEditor/index.js +30 -0
  35. package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +445 -230
  36. package/dist/cjs/components/Variables/VariableEditorForm/VariablePreview.js +38 -32
  37. package/dist/cjs/components/Variables/VariableEditorForm/index.js +11 -9
  38. package/dist/cjs/components/Variables/VariableEditorForm/variable-editor-form-model.js +36 -37
  39. package/dist/cjs/components/Variables/index.js +11 -9
  40. package/dist/cjs/components/Variables/variable-model.js +24 -17
  41. package/dist/cjs/components/index.js +24 -19
  42. package/dist/cjs/constants/index.js +10 -8
  43. package/dist/cjs/constants/user-interface-text.js +7 -2
  44. package/dist/cjs/context/ProjectStoreProvider.js +78 -0
  45. package/dist/cjs/context/index.js +30 -0
  46. package/dist/cjs/context/query-params.js +49 -0
  47. package/dist/cjs/index.js +17 -13
  48. package/dist/cjs/model/index.js +18 -15
  49. package/dist/cjs/model/legend.js +32 -20
  50. package/dist/cjs/model/panels.js +2 -2
  51. package/dist/cjs/model/plugin-base.js +2 -2
  52. package/dist/cjs/model/plugin-loading.js +3 -1
  53. package/dist/cjs/model/trace-queries.js +16 -0
  54. package/dist/cjs/runtime/DataQueriesProvider/DataQueriesProvider.js +67 -35
  55. package/dist/cjs/runtime/DataQueriesProvider/index.js +11 -9
  56. package/dist/cjs/runtime/DataQueriesProvider/model.js +81 -0
  57. package/dist/cjs/runtime/TimeRangeProvider/TimeRangeProvider.js +55 -27
  58. package/dist/cjs/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.js +43 -0
  59. package/dist/cjs/runtime/TimeRangeProvider/index.js +12 -9
  60. package/dist/cjs/runtime/TimeRangeProvider/query-params.js +45 -59
  61. package/dist/cjs/runtime/TimeRangeProvider/refresh-interval.js +30 -0
  62. package/dist/cjs/runtime/builtin-variables.js +81 -0
  63. package/dist/cjs/runtime/datasources.js +31 -12
  64. package/dist/cjs/runtime/index.js +17 -13
  65. package/dist/cjs/runtime/plugin-registry.js +44 -14
  66. package/dist/cjs/runtime/template-variables.js +51 -13
  67. package/dist/cjs/runtime/time-series-queries.js +43 -31
  68. package/dist/cjs/runtime/trace-queries.js +76 -0
  69. package/dist/cjs/stories/shared-utils/decorators/WithDataQueries.js +7 -5
  70. package/dist/cjs/stories/shared-utils/decorators/WithPluginRegistry.js +21 -16
  71. package/dist/cjs/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.js +42 -0
  72. package/dist/cjs/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js +31 -13
  73. package/dist/cjs/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.js +6 -4
  74. package/dist/cjs/stories/shared-utils/decorators/WithTimeRange.js +9 -7
  75. package/dist/cjs/stories/shared-utils/decorators/index.js +15 -12
  76. package/dist/cjs/stories/shared-utils/index.js +10 -8
  77. package/dist/cjs/test/index.js +11 -8
  78. package/dist/cjs/test/mock-data.js +80 -0
  79. package/dist/cjs/test/render.js +13 -11
  80. package/dist/cjs/test/test-plugins/bert/index.js +16 -12
  81. package/dist/cjs/test/test-plugins/ernie/index.js +15 -11
  82. package/dist/cjs/test/test-plugins/index.js +14 -10
  83. package/dist/cjs/test-utils/index.js +10 -8
  84. package/dist/cjs/test-utils/mock-plugin-registry.js +9 -5
  85. package/dist/cjs/utils/action.js +43 -0
  86. package/dist/cjs/utils/index.js +11 -8
  87. package/dist/cjs/utils/variables.js +26 -8
  88. package/dist/cjs/validation/datasource.js +30 -0
  89. package/dist/cjs/validation/duration.js +25 -0
  90. package/dist/cjs/validation/index.js +34 -0
  91. package/dist/cjs/validation/resource.js +24 -0
  92. package/dist/cjs/validation/role.js +86 -0
  93. package/dist/cjs/validation/rolebinding.js +55 -0
  94. package/dist/cjs/validation/secret.js +176 -0
  95. package/dist/cjs/validation/user.js +46 -0
  96. package/dist/cjs/validation/variable.js +48 -0
  97. package/dist/components/CalculationSelector/CalculationSelector.d.ts +1 -2
  98. package/dist/components/CalculationSelector/CalculationSelector.d.ts.map +1 -1
  99. package/dist/components/CalculationSelector/CalculationSelector.js +1 -1
  100. package/dist/components/CalculationSelector/CalculationSelector.js.map +1 -1
  101. package/dist/components/CalculationSelector/index.js.map +1 -1
  102. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts +14 -0
  103. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts.map +1 -0
  104. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js +342 -0
  105. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js.map +1 -0
  106. package/dist/components/DatasourceEditorForm/index.d.ts +2 -0
  107. package/dist/components/DatasourceEditorForm/index.d.ts.map +1 -0
  108. package/dist/components/DatasourceEditorForm/index.js +15 -0
  109. package/dist/components/DatasourceEditorForm/index.js.map +1 -0
  110. package/dist/components/DatasourceSelect.d.ts +8 -3
  111. package/dist/components/DatasourceSelect.d.ts.map +1 -1
  112. package/dist/components/DatasourceSelect.js +120 -23
  113. package/dist/components/DatasourceSelect.js.map +1 -1
  114. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.d.ts +1 -2
  115. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.d.ts.map +1 -1
  116. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js +3 -3
  117. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js.map +1 -1
  118. package/dist/components/LegendOptionsEditor/index.js.map +1 -1
  119. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.d.ts +5 -5
  120. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.d.ts.map +1 -1
  121. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js +18 -25
  122. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js.map +1 -1
  123. package/dist/components/OptionsEditorRadios/index.js.map +1 -1
  124. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.d.ts +1 -1
  125. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.d.ts.map +1 -1
  126. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js +1 -1
  127. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js.map +1 -1
  128. package/dist/components/OptionsEditorTabPanel/index.js.map +1 -1
  129. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.d.ts +3 -3
  130. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.d.ts.map +1 -1
  131. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js +3 -3
  132. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js.map +1 -1
  133. package/dist/components/OptionsEditorTabs/index.js.map +1 -1
  134. package/dist/components/PanelSpecEditor/PanelSpecEditor.d.ts +2 -3
  135. package/dist/components/PanelSpecEditor/PanelSpecEditor.d.ts.map +1 -1
  136. package/dist/components/PanelSpecEditor/PanelSpecEditor.js +50 -11
  137. package/dist/components/PanelSpecEditor/PanelSpecEditor.js.map +1 -1
  138. package/dist/components/PanelSpecEditor/index.js.map +1 -1
  139. package/dist/components/PluginEditor/PluginEditor.d.ts +1 -2
  140. package/dist/components/PluginEditor/PluginEditor.d.ts.map +1 -1
  141. package/dist/components/PluginEditor/PluginEditor.js +17 -26
  142. package/dist/components/PluginEditor/PluginEditor.js.map +1 -1
  143. package/dist/components/PluginEditor/index.js.map +1 -1
  144. package/dist/components/PluginEditor/plugin-editor-api.d.ts +3 -3
  145. package/dist/components/PluginEditor/plugin-editor-api.d.ts.map +1 -1
  146. package/dist/components/PluginEditor/plugin-editor-api.js +5 -5
  147. package/dist/components/PluginEditor/plugin-editor-api.js.map +1 -1
  148. package/dist/components/PluginKindSelect/PluginKindSelect.d.ts +3 -3
  149. package/dist/components/PluginKindSelect/PluginKindSelect.d.ts.map +1 -1
  150. package/dist/components/PluginKindSelect/PluginKindSelect.js +23 -14
  151. package/dist/components/PluginKindSelect/PluginKindSelect.js.map +1 -1
  152. package/dist/components/PluginKindSelect/index.js.map +1 -1
  153. package/dist/components/PluginRegistry/PluginRegistry.d.ts +4 -4
  154. package/dist/components/PluginRegistry/PluginRegistry.d.ts.map +1 -1
  155. package/dist/components/PluginRegistry/PluginRegistry.js +3 -3
  156. package/dist/components/PluginRegistry/PluginRegistry.js.map +1 -1
  157. package/dist/components/PluginRegistry/index.js.map +1 -1
  158. package/dist/components/PluginRegistry/plugin-indexes.js +1 -1
  159. package/dist/components/PluginRegistry/plugin-indexes.js.map +1 -1
  160. package/dist/components/PluginSpecEditor/PluginSpecEditor.d.ts +2 -2
  161. package/dist/components/PluginSpecEditor/PluginSpecEditor.d.ts.map +1 -1
  162. package/dist/components/PluginSpecEditor/PluginSpecEditor.js +3 -3
  163. package/dist/components/PluginSpecEditor/PluginSpecEditor.js.map +1 -1
  164. package/dist/components/PluginSpecEditor/index.js.map +1 -1
  165. package/dist/components/ProjectSelect.d.ts +14 -0
  166. package/dist/components/ProjectSelect.d.ts.map +1 -0
  167. package/dist/components/ProjectSelect.js +91 -0
  168. package/dist/components/ProjectSelect.js.map +1 -0
  169. package/dist/components/TimeRangeControls/TimeRangeControls.d.ts +13 -0
  170. package/dist/components/TimeRangeControls/TimeRangeControls.d.ts.map +1 -0
  171. package/dist/components/TimeRangeControls/TimeRangeControls.js +168 -0
  172. package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -0
  173. package/dist/components/TimeRangeControls/index.d.ts +2 -0
  174. package/dist/components/TimeRangeControls/index.d.ts.map +1 -0
  175. package/dist/components/TimeRangeControls/index.js +15 -0
  176. package/dist/components/TimeRangeControls/index.js.map +1 -0
  177. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.d.ts +1 -2
  178. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.d.ts.map +1 -1
  179. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.js +38 -44
  180. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.js.map +1 -1
  181. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.d.ts +1 -2
  182. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.d.ts.map +1 -1
  183. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.js +3 -3
  184. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.js.map +1 -1
  185. package/dist/components/TimeSeriesQueryEditor/index.js.map +1 -1
  186. package/dist/components/TraceQueryEditor/TraceQueryEditor.d.ts +8 -0
  187. package/dist/components/TraceQueryEditor/TraceQueryEditor.d.ts.map +1 -0
  188. package/dist/components/TraceQueryEditor/TraceQueryEditor.js +130 -0
  189. package/dist/components/TraceQueryEditor/TraceQueryEditor.js.map +1 -0
  190. package/dist/components/TraceQueryEditor/TraceQueryInput.d.ts +12 -0
  191. package/dist/components/TraceQueryEditor/TraceQueryInput.d.ts.map +1 -0
  192. package/dist/components/TraceQueryEditor/TraceQueryInput.js +83 -0
  193. package/dist/components/TraceQueryEditor/TraceQueryInput.js.map +1 -0
  194. package/dist/components/TraceQueryEditor/index.d.ts +2 -0
  195. package/dist/components/TraceQueryEditor/index.d.ts.map +1 -0
  196. package/dist/components/TraceQueryEditor/index.js +15 -0
  197. package/dist/components/TraceQueryEditor/index.js.map +1 -0
  198. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts +10 -8
  199. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts.map +1 -1
  200. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +395 -184
  201. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -1
  202. package/dist/components/Variables/VariableEditorForm/VariablePreview.d.ts +2 -3
  203. package/dist/components/Variables/VariableEditorForm/VariablePreview.d.ts.map +1 -1
  204. package/dist/components/Variables/VariableEditorForm/VariablePreview.js +4 -4
  205. package/dist/components/Variables/VariableEditorForm/VariablePreview.js.map +1 -1
  206. package/dist/components/Variables/VariableEditorForm/index.js.map +1 -1
  207. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts +8 -19
  208. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts.map +1 -1
  209. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js +30 -35
  210. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js.map +1 -1
  211. package/dist/components/Variables/index.js.map +1 -1
  212. package/dist/components/Variables/variable-model.d.ts.map +1 -1
  213. package/dist/components/Variables/variable-model.js +9 -10
  214. package/dist/components/Variables/variable-model.js.map +1 -1
  215. package/dist/components/index.d.ts +3 -0
  216. package/dist/components/index.d.ts.map +1 -1
  217. package/dist/components/index.js +3 -0
  218. package/dist/components/index.js.map +1 -1
  219. package/dist/constants/index.js.map +1 -1
  220. package/dist/constants/user-interface-text.d.ts +2 -0
  221. package/dist/constants/user-interface-text.d.ts.map +1 -1
  222. package/dist/constants/user-interface-text.js +4 -1
  223. package/dist/constants/user-interface-text.js.map +1 -1
  224. package/dist/context/ProjectStoreProvider.d.ts +16 -0
  225. package/dist/context/ProjectStoreProvider.d.ts.map +1 -0
  226. package/dist/context/ProjectStoreProvider.js +56 -0
  227. package/dist/context/ProjectStoreProvider.js.map +1 -0
  228. package/dist/context/index.d.ts +2 -0
  229. package/dist/context/index.d.ts.map +1 -0
  230. package/dist/context/index.js +15 -0
  231. package/dist/context/index.js.map +1 -0
  232. package/dist/context/query-params.d.ts +5 -0
  233. package/dist/context/query-params.d.ts.map +1 -0
  234. package/dist/context/query-params.js +41 -0
  235. package/dist/context/query-params.js.map +1 -0
  236. package/dist/index.d.ts +2 -0
  237. package/dist/index.d.ts.map +1 -1
  238. package/dist/index.js +2 -0
  239. package/dist/index.js.map +1 -1
  240. package/dist/model/datasource.d.ts +2 -1
  241. package/dist/model/datasource.d.ts.map +1 -1
  242. package/dist/model/datasource.js +3 -1
  243. package/dist/model/datasource.js.map +1 -1
  244. package/dist/model/index.d.ts +1 -0
  245. package/dist/model/index.d.ts.map +1 -1
  246. package/dist/model/index.js +1 -0
  247. package/dist/model/index.js.map +1 -1
  248. package/dist/model/legend.d.ts +3 -3
  249. package/dist/model/legend.d.ts.map +1 -1
  250. package/dist/model/legend.js +14 -14
  251. package/dist/model/legend.js.map +1 -1
  252. package/dist/model/panels.d.ts +3 -2
  253. package/dist/model/panels.d.ts.map +1 -1
  254. package/dist/model/panels.js.map +1 -1
  255. package/dist/model/plugin-base.js.map +1 -1
  256. package/dist/model/plugin-loading.js.map +1 -1
  257. package/dist/model/plugins.d.ts +6 -4
  258. package/dist/model/plugins.d.ts.map +1 -1
  259. package/dist/model/plugins.js.map +1 -1
  260. package/dist/model/time-series-queries.d.ts +2 -2
  261. package/dist/model/time-series-queries.d.ts.map +1 -1
  262. package/dist/model/time-series-queries.js.map +1 -1
  263. package/dist/model/trace-queries.d.ts +19 -0
  264. package/dist/model/trace-queries.d.ts.map +1 -0
  265. package/dist/model/trace-queries.js +15 -0
  266. package/dist/model/trace-queries.js.map +1 -0
  267. package/dist/model/variables.d.ts +2 -2
  268. package/dist/model/variables.d.ts.map +1 -1
  269. package/dist/model/variables.js +3 -1
  270. package/dist/model/variables.js.map +1 -1
  271. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.d.ts +6 -6
  272. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.d.ts.map +1 -1
  273. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js +52 -28
  274. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js.map +1 -1
  275. package/dist/runtime/DataQueriesProvider/index.js.map +1 -1
  276. package/dist/runtime/DataQueriesProvider/model.d.ts +18 -13
  277. package/dist/runtime/DataQueriesProvider/model.d.ts.map +1 -1
  278. package/dist/runtime/DataQueriesProvider/model.js +67 -1
  279. package/dist/runtime/DataQueriesProvider/model.js.map +1 -1
  280. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.d.ts +9 -4
  281. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.d.ts.map +1 -1
  282. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js +37 -20
  283. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js.map +1 -1
  284. package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.d.ts +9 -0
  285. package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.d.ts.map +1 -0
  286. package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.js +30 -0
  287. package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.js.map +1 -0
  288. package/dist/runtime/TimeRangeProvider/index.d.ts +1 -0
  289. package/dist/runtime/TimeRangeProvider/index.d.ts.map +1 -1
  290. package/dist/runtime/TimeRangeProvider/index.js +1 -0
  291. package/dist/runtime/TimeRangeProvider/index.js.map +1 -1
  292. package/dist/runtime/TimeRangeProvider/query-params.d.ts +5 -5
  293. package/dist/runtime/TimeRangeProvider/query-params.d.ts.map +1 -1
  294. package/dist/runtime/TimeRangeProvider/query-params.js +13 -45
  295. package/dist/runtime/TimeRangeProvider/query-params.js.map +1 -1
  296. package/dist/runtime/TimeRangeProvider/refresh-interval.d.ts +7 -0
  297. package/dist/runtime/TimeRangeProvider/refresh-interval.d.ts.map +1 -0
  298. package/dist/runtime/TimeRangeProvider/refresh-interval.js +25 -0
  299. package/dist/runtime/TimeRangeProvider/refresh-interval.js.map +1 -0
  300. package/dist/runtime/builtin-variables.d.ts +11 -0
  301. package/dist/runtime/builtin-variables.d.ts.map +1 -0
  302. package/dist/runtime/builtin-variables.js +59 -0
  303. package/dist/runtime/builtin-variables.js.map +1 -0
  304. package/dist/runtime/datasources.d.ts +42 -7
  305. package/dist/runtime/datasources.d.ts.map +1 -1
  306. package/dist/runtime/datasources.js +15 -7
  307. package/dist/runtime/datasources.js.map +1 -1
  308. package/dist/runtime/index.d.ts +2 -0
  309. package/dist/runtime/index.d.ts.map +1 -1
  310. package/dist/runtime/index.js +2 -0
  311. package/dist/runtime/index.js.map +1 -1
  312. package/dist/runtime/plugin-registry.d.ts +5 -3
  313. package/dist/runtime/plugin-registry.d.ts.map +1 -1
  314. package/dist/runtime/plugin-registry.js +22 -5
  315. package/dist/runtime/plugin-registry.js.map +1 -1
  316. package/dist/runtime/template-variables.d.ts +6 -5
  317. package/dist/runtime/template-variables.d.ts.map +1 -1
  318. package/dist/runtime/template-variables.js +36 -9
  319. package/dist/runtime/template-variables.js.map +1 -1
  320. package/dist/runtime/time-series-queries.d.ts +3 -3
  321. package/dist/runtime/time-series-queries.d.ts.map +1 -1
  322. package/dist/runtime/time-series-queries.js +21 -19
  323. package/dist/runtime/time-series-queries.js.map +1 -1
  324. package/dist/runtime/trace-queries.d.ts +14 -0
  325. package/dist/runtime/trace-queries.d.ts.map +1 -0
  326. package/dist/runtime/trace-queries.js +61 -0
  327. package/dist/runtime/trace-queries.js.map +1 -0
  328. package/dist/stories/shared-utils/decorators/WithDataQueries.d.ts +2 -3
  329. package/dist/stories/shared-utils/decorators/WithDataQueries.d.ts.map +1 -1
  330. package/dist/stories/shared-utils/decorators/WithDataQueries.js.map +1 -1
  331. package/dist/stories/shared-utils/decorators/WithPluginRegistry.d.ts +1 -2
  332. package/dist/stories/shared-utils/decorators/WithPluginRegistry.d.ts.map +1 -1
  333. package/dist/stories/shared-utils/decorators/WithPluginRegistry.js +2 -1
  334. package/dist/stories/shared-utils/decorators/WithPluginRegistry.js.map +1 -1
  335. package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.d.ts +12 -0
  336. package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.d.ts.map +1 -0
  337. package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.js +39 -0
  338. package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.js.map +1 -0
  339. package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.d.ts +2 -3
  340. package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.d.ts.map +1 -1
  341. package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js +24 -8
  342. package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js.map +1 -1
  343. package/dist/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.d.ts +2 -3
  344. package/dist/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.d.ts.map +1 -1
  345. package/dist/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.js.map +1 -1
  346. package/dist/stories/shared-utils/decorators/WithTimeRange.d.ts +4 -5
  347. package/dist/stories/shared-utils/decorators/WithTimeRange.d.ts.map +1 -1
  348. package/dist/stories/shared-utils/decorators/WithTimeRange.js +2 -2
  349. package/dist/stories/shared-utils/decorators/WithTimeRange.js.map +1 -1
  350. package/dist/stories/shared-utils/decorators/index.d.ts +1 -0
  351. package/dist/stories/shared-utils/decorators/index.d.ts.map +1 -1
  352. package/dist/stories/shared-utils/decorators/index.js +1 -0
  353. package/dist/stories/shared-utils/decorators/index.js.map +1 -1
  354. package/dist/stories/shared-utils/index.js.map +1 -1
  355. package/dist/test/index.d.ts +1 -0
  356. package/dist/test/index.d.ts.map +1 -1
  357. package/dist/test/index.js +1 -0
  358. package/dist/test/index.js.map +1 -1
  359. package/dist/test/mock-data.d.ts +4 -0
  360. package/dist/test/mock-data.d.ts.map +1 -0
  361. package/dist/test/mock-data.js +64 -0
  362. package/dist/test/mock-data.js.map +1 -0
  363. package/dist/test/render.d.ts +1 -1
  364. package/dist/test/render.d.ts.map +1 -1
  365. package/dist/test/render.js +2 -2
  366. package/dist/test/render.js.map +1 -1
  367. package/dist/test/setup-tests.js.map +1 -1
  368. package/dist/test/test-plugins/bert/index.js +2 -2
  369. package/dist/test/test-plugins/bert/index.js.map +1 -1
  370. package/dist/test/test-plugins/ernie/index.js +2 -2
  371. package/dist/test/test-plugins/ernie/index.js.map +1 -1
  372. package/dist/test/test-plugins/index.js.map +1 -1
  373. package/dist/test-utils/index.js.map +1 -1
  374. package/dist/test-utils/mock-plugin-registry.d.ts +1 -1
  375. package/dist/test-utils/mock-plugin-registry.d.ts.map +1 -1
  376. package/dist/test-utils/mock-plugin-registry.js +3 -3
  377. package/dist/test-utils/mock-plugin-registry.js.map +1 -1
  378. package/dist/utils/action.d.ts +4 -0
  379. package/dist/utils/action.d.ts.map +1 -0
  380. package/dist/utils/action.js +27 -0
  381. package/dist/utils/action.js.map +1 -0
  382. package/dist/utils/index.d.ts +1 -0
  383. package/dist/utils/index.d.ts.map +1 -1
  384. package/dist/utils/index.js +1 -0
  385. package/dist/utils/index.js.map +1 -1
  386. package/dist/utils/variables.d.ts.map +1 -1
  387. package/dist/utils/variables.js +17 -5
  388. package/dist/utils/variables.js.map +1 -1
  389. package/dist/validation/datasource.d.ts +19 -0
  390. package/dist/validation/datasource.d.ts.map +1 -0
  391. package/dist/validation/datasource.js +22 -0
  392. package/dist/validation/datasource.js.map +1 -0
  393. package/dist/validation/duration.d.ts +3 -0
  394. package/dist/validation/duration.d.ts.map +1 -0
  395. package/dist/validation/duration.js +17 -0
  396. package/dist/validation/duration.js.map +1 -0
  397. package/dist/validation/index.d.ts +6 -0
  398. package/dist/validation/index.d.ts.map +1 -0
  399. package/dist/validation/index.js +19 -0
  400. package/dist/validation/index.js.map +1 -0
  401. package/dist/validation/resource.d.ts +3 -0
  402. package/dist/validation/resource.d.ts.map +1 -0
  403. package/dist/validation/resource.js +16 -0
  404. package/dist/validation/resource.js.map +1 -0
  405. package/dist/validation/role.d.ts +228 -0
  406. package/dist/validation/role.d.ts.map +1 -0
  407. package/dist/validation/role.js +67 -0
  408. package/dist/validation/role.js.map +1 -0
  409. package/dist/validation/rolebinding.d.ts +137 -0
  410. package/dist/validation/rolebinding.d.ts.map +1 -0
  411. package/dist/validation/rolebinding.js +47 -0
  412. package/dist/validation/rolebinding.js.map +1 -0
  413. package/dist/validation/secret.d.ts +964 -0
  414. package/dist/validation/secret.d.ts.map +1 -0
  415. package/dist/validation/secret.js +157 -0
  416. package/dist/validation/secret.js.map +1 -0
  417. package/dist/validation/user.d.ts +93 -0
  418. package/dist/validation/user.d.ts.map +1 -0
  419. package/dist/validation/user.js +38 -0
  420. package/dist/validation/user.js.map +1 -0
  421. package/dist/validation/variable.d.ts +96 -0
  422. package/dist/validation/variable.d.ts.map +1 -0
  423. package/dist/validation/variable.js +40 -0
  424. package/dist/validation/variable.js.map +1 -0
  425. package/package.json +9 -6
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/variables.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { VariableValue } from '@perses-dev/core';\nimport { VariableStateMap } from '@perses-dev/plugin-system';\n\nexport function replaceTemplateVariables(text: string, variableState: VariableStateMap): string {\n const variables = parseTemplateVariables(text);\n let finalText = text;\n variables.forEach((v) => {\n const variable = variableState[v];\n if (variable && variable?.value) {\n finalText = replaceTemplateVariable(finalText, v, variable?.value);\n }\n });\n\n return finalText;\n}\n\nexport function replaceTemplateVariable(text: string, varName: string, templateVariableValue: VariableValue) {\n const variableTemplate = '$' + varName;\n let replaceString = '';\n if (Array.isArray(templateVariableValue)) {\n replaceString = `(${templateVariableValue.join('|')})`; // regex style\n }\n if (typeof templateVariableValue === 'string') {\n replaceString = templateVariableValue;\n }\n\n return text.replaceAll(variableTemplate, replaceString);\n}\n\n// This regular expression is designed to identify variable references in a template string.\n// It supports two formats for referencing variables:\n// 1. $variableName - This is a simpler format, and the regular expression captures the variable name (\\w+ matches one or more word characters).\n// 2. [COMING SOON] ${variableName:value} - This is a more complex format that allows specifying a format function as well.\n// TODO: Fix this lint error\n// eslint-disable-next-line no-useless-escape\nconst TEMPLATE_VARIABLE_REGEX = /\\$(\\w+)|\\${(\\w+)(?:\\.([^:^\\}]+))?(?::([^\\}]+))?}/gm;\n\n/**\n * Returns a list of template variables\n */\nexport const parseTemplateVariables = (text: string) => {\n const regex = TEMPLATE_VARIABLE_REGEX;\n const matches = new Set<string>();\n let match;\n\n while ((match = regex.exec(text)) !== null) {\n if (match && match.length > 1 && match[1]) {\n matches.add(match[1]);\n }\n }\n // return unique matches\n return Array.from(matches.values());\n};\n"],"names":["replaceTemplateVariables","text","variableState","variables","parseTemplateVariables","finalText","forEach","v","variable","value","replaceTemplateVariable","varName","templateVariableValue","variableTemplate","replaceString","Array","isArray","join","replaceAll","TEMPLATE_VARIABLE_REGEX","regex","matches","Set","match","exec","length","add","from","values"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAKjC,OAAO,SAASA,wBAAwB,CAACC,IAAY,EAAEC,aAA+B,EAAU;IAC9F,MAAMC,SAAS,GAAGC,sBAAsB,CAACH,IAAI,CAAC,AAAC;IAC/C,IAAII,SAAS,GAAGJ,IAAI,AAAC;IACrBE,SAAS,CAACG,OAAO,CAAC,CAACC,CAAC,GAAK;QACvB,MAAMC,QAAQ,GAAGN,aAAa,CAACK,CAAC,CAAC,AAAC;QAClC,IAAIC,QAAQ,IAAIA,CAAAA,QAAQ,aAARA,QAAQ,WAAO,GAAfA,KAAAA,CAAe,GAAfA,QAAQ,CAAEC,KAAK,CAAA,EAAE;YAC/BJ,SAAS,GAAGK,uBAAuB,CAACL,SAAS,EAAEE,CAAC,EAAEC,QAAQ,aAARA,QAAQ,WAAO,GAAfA,KAAAA,CAAe,GAAfA,QAAQ,CAAEC,KAAK,CAAC,CAAC;QACrE,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAOJ,SAAS,CAAC;AACnB,CAAC;AAED,OAAO,SAASK,uBAAuB,CAACT,IAAY,EAAEU,OAAe,EAAEC,qBAAoC,EAAE;IAC3G,MAAMC,gBAAgB,GAAG,GAAG,GAAGF,OAAO,AAAC;IACvC,IAAIG,aAAa,GAAG,EAAE,AAAC;IACvB,IAAIC,KAAK,CAACC,OAAO,CAACJ,qBAAqB,CAAC,EAAE;QACxCE,aAAa,GAAG,CAAC,CAAC,EAAEF,qBAAqB,CAACK,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,cAAc;IACxE,CAAC;IACD,IAAI,OAAOL,qBAAqB,KAAK,QAAQ,EAAE;QAC7CE,aAAa,GAAGF,qBAAqB,CAAC;IACxC,CAAC;IAED,OAAOX,IAAI,CAACiB,UAAU,CAACL,gBAAgB,EAAEC,aAAa,CAAC,CAAC;AAC1D,CAAC;AAED,4FAA4F;AAC5F,qDAAqD;AACrD,gJAAgJ;AAChJ,2HAA2H;AAC3H,4BAA4B;AAC5B,6CAA6C;AAC7C,MAAMK,uBAAuB,uDAAuD,AAAC;AAErF;;CAEC,GACD,OAAO,MAAMf,sBAAsB,GAAG,CAACH,IAAY,GAAK;IACtD,MAAMmB,KAAK,GAAGD,uBAAuB,AAAC;IACtC,MAAME,OAAO,GAAG,IAAIC,GAAG,EAAU,AAAC;IAClC,IAAIC,KAAK,AAAC;IAEV,MAAO,AAACA,CAAAA,KAAK,GAAGH,KAAK,CAACI,IAAI,CAACvB,IAAI,CAAC,CAAA,KAAM,IAAI,CAAE;QAC1C,IAAIsB,KAAK,IAAIA,KAAK,CAACE,MAAM,GAAG,CAAC,IAAIF,KAAK,CAAC,CAAC,CAAC,EAAE;YACzCF,OAAO,CAACK,GAAG,CAACH,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QACxB,CAAC;IACH,CAAC;IACD,wBAAwB;IACxB,OAAOR,KAAK,CAACY,IAAI,CAACN,OAAO,CAACO,MAAM,EAAE,CAAC,CAAC;AACtC,CAAC,CAAC"}
1
+ {"version":3,"sources":["../../src/utils/variables.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { VariableValue } from '@perses-dev/core';\nimport { VariableStateMap } from '@perses-dev/plugin-system';\n\nexport function replaceTemplateVariables(text: string, variableState: VariableStateMap): string {\n const variables = parseTemplateVariables(text);\n let finalText = text;\n variables\n // Sorting variables by their length.\n // In order to not have a variable name have contained in another variable name.\n // i.e.: $__range replacing $__range_ms => '3600_ms' instead of '3600000'\n .sort((a, b) => b.length - a.length)\n .forEach((v) => {\n const variable = variableState[v];\n if (variable && variable?.value) {\n finalText = replaceTemplateVariable(finalText, v, variable?.value);\n }\n });\n\n return finalText;\n}\n\nexport function replaceTemplateVariable(text: string, varName: string, templateVariableValue: VariableValue) {\n const variableTemplate = '$' + varName;\n const bracketsVariableTemplate = '${' + varName + '}';\n\n let replaceString = '';\n if (Array.isArray(templateVariableValue)) {\n replaceString = `(${templateVariableValue.join('|')})`; // regex style\n }\n if (typeof templateVariableValue === 'string') {\n replaceString = templateVariableValue;\n }\n\n text = text.replaceAll(variableTemplate, replaceString);\n return text.replaceAll(bracketsVariableTemplate, replaceString);\n}\n\n// This regular expression is designed to identify variable references in a template string.\n// It supports two formats for referencing variables:\n// 1. $variableName - This is a simpler format, and the regular expression captures the variable name (\\w+ matches one or more word characters).\n// 2. ${variableName} - This is a more complex format and the regular expression captures the variable name (\\w+ matches one or more word characters) in the curly braces.\n// 3. [COMING SOON] ${variableName:value} - This is a more complex format that allows specifying a format function as well.\n// TODO: Fix this lint error\n// eslint-disable-next-line no-useless-escape\nconst TEMPLATE_VARIABLE_REGEX = /\\$(\\w+)|\\${(\\w+)(?:\\.([^:^\\}]+))?(?::([^\\}]+))?}/gm;\n\n/**\n * Returns a list of template variables\n */\nexport const parseTemplateVariables = (text: string) => {\n const regex = TEMPLATE_VARIABLE_REGEX;\n const matches = new Set<string>();\n let match;\n\n while ((match = regex.exec(text)) !== null) {\n if (match) {\n if (match[1]) {\n // \\$(\\w+)\\\n matches.add(match[1]);\n } else if (match[2]) {\n // \\${(\\w+)}\\\n matches.add(match[2]);\n }\n }\n }\n // return unique matches\n return Array.from(matches.values());\n};\n"],"names":["replaceTemplateVariables","text","variableState","variables","parseTemplateVariables","finalText","sort","a","b","length","forEach","v","variable","value","replaceTemplateVariable","varName","templateVariableValue","variableTemplate","bracketsVariableTemplate","replaceString","Array","isArray","join","replaceAll","TEMPLATE_VARIABLE_REGEX","regex","matches","Set","match","exec","add","from","values"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAKjC,OAAO,SAASA,yBAAyBC,IAAY,EAAEC,aAA+B;IACpF,MAAMC,YAAYC,uBAAuBH;IACzC,IAAII,YAAYJ;IAChBE,SACE,qCAAqC;IACrC,gFAAgF;IAChF,yEAAyE;KACxEG,IAAI,CAAC,CAACC,GAAGC,IAAMA,EAAEC,MAAM,GAAGF,EAAEE,MAAM,EAClCC,OAAO,CAAC,CAACC;QACR,MAAMC,WAAWV,aAAa,CAACS,EAAE;QACjC,IAAIC,aAAYA,qBAAAA,+BAAAA,SAAUC,KAAK,GAAE;YAC/BR,YAAYS,wBAAwBT,WAAWM,GAAGC,qBAAAA,+BAAAA,SAAUC,KAAK;QACnE;IACF;IAEF,OAAOR;AACT;AAEA,OAAO,SAASS,wBAAwBb,IAAY,EAAEc,OAAe,EAAEC,qBAAoC;IACzG,MAAMC,mBAAmB,MAAMF;IAC/B,MAAMG,2BAA2B,OAAOH,UAAU;IAElD,IAAII,gBAAgB;IACpB,IAAIC,MAAMC,OAAO,CAACL,wBAAwB;QACxCG,gBAAgB,CAAC,CAAC,EAAEH,sBAAsBM,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,cAAc;IACxE;IACA,IAAI,OAAON,0BAA0B,UAAU;QAC7CG,gBAAgBH;IAClB;IAEAf,OAAOA,KAAKsB,UAAU,CAACN,kBAAkBE;IACzC,OAAOlB,KAAKsB,UAAU,CAACL,0BAA0BC;AACnD;AAEA,4FAA4F;AAC5F,qDAAqD;AACrD,gJAAgJ;AAChJ,0KAA0K;AAC1K,2HAA2H;AAC3H,4BAA4B;AAC5B,6CAA6C;AAC7C,MAAMK,0BAA0B;AAEhC;;CAEC,GACD,OAAO,MAAMpB,yBAAyB,CAACH;IACrC,MAAMwB,QAAQD;IACd,MAAME,UAAU,IAAIC;IACpB,IAAIC;IAEJ,MAAO,AAACA,CAAAA,QAAQH,MAAMI,IAAI,CAAC5B,KAAI,MAAO,KAAM;QAC1C,IAAI2B,OAAO;YACT,IAAIA,KAAK,CAAC,EAAE,EAAE;gBACZ,WAAW;gBACXF,QAAQI,GAAG,CAACF,KAAK,CAAC,EAAE;YACtB,OAAO,IAAIA,KAAK,CAAC,EAAE,EAAE;gBACnB,aAAa;gBACbF,QAAQI,GAAG,CAACF,KAAK,CAAC,EAAE;YACtB;QACF;IACF;IACA,wBAAwB;IACxB,OAAOR,MAAMW,IAAI,CAACL,QAAQM,MAAM;AAClC,EAAE"}
@@ -0,0 +1,19 @@
1
+ import { z } from 'zod';
2
+ export declare const datasourceEditValidationSchema: z.ZodObject<{
3
+ name: z.ZodString;
4
+ title: z.ZodOptional<z.ZodString>;
5
+ description: z.ZodOptional<z.ZodString>;
6
+ default: z.ZodBoolean;
7
+ }, "strip", z.ZodTypeAny, {
8
+ name: string;
9
+ default: boolean;
10
+ title?: string | undefined;
11
+ description?: string | undefined;
12
+ }, {
13
+ name: string;
14
+ default: boolean;
15
+ title?: string | undefined;
16
+ description?: string | undefined;
17
+ }>;
18
+ export type DatasourceEditValidationType = z.infer<typeof datasourceEditValidationSchema>;
19
+ //# sourceMappingURL=datasource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"datasource.d.ts","sourceRoot":"","sources":["../../src/validation/datasource.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;EAKzC,CAAC;AAEH,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC"}
@@ -0,0 +1,22 @@
1
+ // Copyright 2023 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ import { z } from 'zod';
14
+ import { resourceIdValidationSchema } from './resource';
15
+ export const datasourceEditValidationSchema = z.object({
16
+ name: resourceIdValidationSchema,
17
+ title: z.string().optional(),
18
+ description: z.string().optional(),
19
+ default: z.boolean()
20
+ });
21
+
22
+ //# sourceMappingURL=datasource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/validation/datasource.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { z } from 'zod';\nimport { resourceIdValidationSchema } from './resource';\n\nexport const datasourceEditValidationSchema = z.object({\n name: resourceIdValidationSchema,\n title: z.string().optional(), // display name\n description: z.string().optional(),\n default: z.boolean(),\n});\n\nexport type DatasourceEditValidationType = z.infer<typeof datasourceEditValidationSchema>;\n"],"names":["z","resourceIdValidationSchema","datasourceEditValidationSchema","object","name","title","string","optional","description","default","boolean"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,CAAC,QAAQ,MAAM;AACxB,SAASC,0BAA0B,QAAQ,aAAa;AAExD,OAAO,MAAMC,iCAAiCF,EAAEG,MAAM,CAAC;IACrDC,MAAMH;IACNI,OAAOL,EAAEM,MAAM,GAAGC,QAAQ;IAC1BC,aAAaR,EAAEM,MAAM,GAAGC,QAAQ;IAChCE,SAAST,EAAEU,OAAO;AACpB,GAAG"}
@@ -0,0 +1,3 @@
1
+ import { z } from 'zod';
2
+ export declare const durationValidationSchema: z.ZodString;
3
+ //# sourceMappingURL=duration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"duration.d.ts","sourceRoot":"","sources":["../../src/validation/duration.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,wBAAwB,aAGsB,CAAC"}
@@ -0,0 +1,17 @@
1
+ // Copyright 2024 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ import { DURATION_REGEX } from '@perses-dev/core';
14
+ import { z } from 'zod';
15
+ export const durationValidationSchema = z.string().nonempty('Required').regex(DURATION_REGEX, 'Must be a valid duration string');
16
+
17
+ //# sourceMappingURL=duration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/validation/duration.ts"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { DURATION_REGEX } from '@perses-dev/core';\nimport { z } from 'zod';\n\nexport const durationValidationSchema = z\n .string()\n .nonempty('Required')\n .regex(DURATION_REGEX, 'Must be a valid duration string');\n"],"names":["DURATION_REGEX","z","durationValidationSchema","string","nonempty","regex"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,cAAc,QAAQ,mBAAmB;AAClD,SAASC,CAAC,QAAQ,MAAM;AAExB,OAAO,MAAMC,2BAA2BD,EACrCE,MAAM,GACNC,QAAQ,CAAC,YACTC,KAAK,CAACL,gBAAgB,mCAAmC"}
@@ -0,0 +1,6 @@
1
+ export * from './datasource';
2
+ export * from './duration';
3
+ export * from './resource';
4
+ export * from './secret';
5
+ export * from './variable';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/validation/index.ts"],"names":[],"mappings":"AAaA,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC"}
@@ -0,0 +1,19 @@
1
+ // Copyright 2023 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ export * from './datasource';
14
+ export * from './duration';
15
+ export * from './resource';
16
+ export * from './secret';
17
+ export * from './variable';
18
+
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/validation/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './datasource';\nexport * from './duration';\nexport * from './resource';\nexport * from './secret';\nexport * from './variable';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,eAAe;AAC7B,cAAc,aAAa;AAC3B,cAAc,aAAa;AAC3B,cAAc,WAAW;AACzB,cAAc,aAAa"}
@@ -0,0 +1,3 @@
1
+ import { z } from 'zod';
2
+ export declare const resourceIdValidationSchema: z.ZodString;
3
+ //# sourceMappingURL=resource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../../src/validation/resource.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,0BAA0B,aAImE,CAAC"}
@@ -0,0 +1,16 @@
1
+ // Copyright 2023 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ import { z } from 'zod';
14
+ export const resourceIdValidationSchema = z.string().min(1, 'Required').max(75, 'Must be 75 or fewer characters long').regex(/^[a-zA-Z0-9_.-]+$/, 'Must only contains alphanumerical characters and special characters _ . -');
15
+
16
+ //# sourceMappingURL=resource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/validation/resource.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { z } from 'zod';\n\nexport const resourceIdValidationSchema = z\n .string()\n .min(1, 'Required')\n .max(75, 'Must be 75 or fewer characters long')\n .regex(/^[a-zA-Z0-9_.-]+$/, 'Must only contains alphanumerical characters and special characters _ . -');\n"],"names":["z","resourceIdValidationSchema","string","min","max","regex"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,CAAC,QAAQ,MAAM;AAExB,OAAO,MAAMC,6BAA6BD,EACvCE,MAAM,GACNC,GAAG,CAAC,GAAG,YACPC,GAAG,CAAC,IAAI,uCACRC,KAAK,CAAC,qBAAqB,6EAA6E"}
@@ -0,0 +1,228 @@
1
+ import { z } from 'zod';
2
+ export declare const roleValidationSchema: z.ZodObject<{
3
+ kind: z.ZodLiteral<"Role">;
4
+ metadata: z.ZodObject<{
5
+ name: z.ZodString;
6
+ project: z.ZodString;
7
+ }, "strip", z.ZodTypeAny, {
8
+ name: string;
9
+ project: string;
10
+ }, {
11
+ name: string;
12
+ project: string;
13
+ }>;
14
+ spec: z.ZodObject<{
15
+ permissions: z.ZodArray<z.ZodObject<{
16
+ actions: z.ZodArray<z.ZodEnum<["*", "create", "read", "update", "delete"]>, "atleastone">;
17
+ scopes: z.ZodArray<z.ZodEnum<["*", "Dashboard", "Datasource", "EphemeralDashboard", "Folder", "GlobalDatasource", "GlobalRole", "GlobalRoleBinding", "GlobalSecret", "GlobalVariable", "Project", "Role", "RoleBinding", "Secret", "User", "Variable"]>, "atleastone">;
18
+ }, "strip", z.ZodTypeAny, {
19
+ actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
20
+ scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
21
+ }, {
22
+ actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
23
+ scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
24
+ }>, "many">;
25
+ }, "strip", z.ZodTypeAny, {
26
+ permissions: {
27
+ actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
28
+ scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
29
+ }[];
30
+ }, {
31
+ permissions: {
32
+ actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
33
+ scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
34
+ }[];
35
+ }>;
36
+ }, "strip", z.ZodTypeAny, {
37
+ kind: "Role";
38
+ spec: {
39
+ permissions: {
40
+ actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
41
+ scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
42
+ }[];
43
+ };
44
+ metadata: {
45
+ name: string;
46
+ project: string;
47
+ };
48
+ }, {
49
+ kind: "Role";
50
+ spec: {
51
+ permissions: {
52
+ actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
53
+ scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
54
+ }[];
55
+ };
56
+ metadata: {
57
+ name: string;
58
+ project: string;
59
+ };
60
+ }>;
61
+ export declare const globalRoleValidationSchema: z.ZodObject<{
62
+ kind: z.ZodLiteral<"GlobalRole">;
63
+ metadata: z.ZodObject<{
64
+ name: z.ZodString;
65
+ }, "strip", z.ZodTypeAny, {
66
+ name: string;
67
+ }, {
68
+ name: string;
69
+ }>;
70
+ spec: z.ZodObject<{
71
+ permissions: z.ZodArray<z.ZodObject<{
72
+ actions: z.ZodArray<z.ZodEnum<["*", "create", "read", "update", "delete"]>, "atleastone">;
73
+ scopes: z.ZodArray<z.ZodEnum<["*", "Dashboard", "Datasource", "EphemeralDashboard", "Folder", "GlobalDatasource", "GlobalRole", "GlobalRoleBinding", "GlobalSecret", "GlobalVariable", "Project", "Role", "RoleBinding", "Secret", "User", "Variable"]>, "atleastone">;
74
+ }, "strip", z.ZodTypeAny, {
75
+ actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
76
+ scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
77
+ }, {
78
+ actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
79
+ scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
80
+ }>, "many">;
81
+ }, "strip", z.ZodTypeAny, {
82
+ permissions: {
83
+ actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
84
+ scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
85
+ }[];
86
+ }, {
87
+ permissions: {
88
+ actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
89
+ scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
90
+ }[];
91
+ }>;
92
+ }, "strip", z.ZodTypeAny, {
93
+ kind: "GlobalRole";
94
+ spec: {
95
+ permissions: {
96
+ actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
97
+ scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
98
+ }[];
99
+ };
100
+ metadata: {
101
+ name: string;
102
+ };
103
+ }, {
104
+ kind: "GlobalRole";
105
+ spec: {
106
+ permissions: {
107
+ actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
108
+ scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
109
+ }[];
110
+ };
111
+ metadata: {
112
+ name: string;
113
+ };
114
+ }>;
115
+ export declare const rolesEditorValidationSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
116
+ kind: z.ZodLiteral<"Role">;
117
+ metadata: z.ZodObject<{
118
+ name: z.ZodString;
119
+ project: z.ZodString;
120
+ }, "strip", z.ZodTypeAny, {
121
+ name: string;
122
+ project: string;
123
+ }, {
124
+ name: string;
125
+ project: string;
126
+ }>;
127
+ spec: z.ZodObject<{
128
+ permissions: z.ZodArray<z.ZodObject<{
129
+ actions: z.ZodArray<z.ZodEnum<["*", "create", "read", "update", "delete"]>, "atleastone">;
130
+ scopes: z.ZodArray<z.ZodEnum<["*", "Dashboard", "Datasource", "EphemeralDashboard", "Folder", "GlobalDatasource", "GlobalRole", "GlobalRoleBinding", "GlobalSecret", "GlobalVariable", "Project", "Role", "RoleBinding", "Secret", "User", "Variable"]>, "atleastone">;
131
+ }, "strip", z.ZodTypeAny, {
132
+ actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
133
+ scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
134
+ }, {
135
+ actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
136
+ scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
137
+ }>, "many">;
138
+ }, "strip", z.ZodTypeAny, {
139
+ permissions: {
140
+ actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
141
+ scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
142
+ }[];
143
+ }, {
144
+ permissions: {
145
+ actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
146
+ scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
147
+ }[];
148
+ }>;
149
+ }, "strip", z.ZodTypeAny, {
150
+ kind: "Role";
151
+ spec: {
152
+ permissions: {
153
+ actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
154
+ scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
155
+ }[];
156
+ };
157
+ metadata: {
158
+ name: string;
159
+ project: string;
160
+ };
161
+ }, {
162
+ kind: "Role";
163
+ spec: {
164
+ permissions: {
165
+ actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
166
+ scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
167
+ }[];
168
+ };
169
+ metadata: {
170
+ name: string;
171
+ project: string;
172
+ };
173
+ }>, z.ZodObject<{
174
+ kind: z.ZodLiteral<"GlobalRole">;
175
+ metadata: z.ZodObject<{
176
+ name: z.ZodString;
177
+ }, "strip", z.ZodTypeAny, {
178
+ name: string;
179
+ }, {
180
+ name: string;
181
+ }>;
182
+ spec: z.ZodObject<{
183
+ permissions: z.ZodArray<z.ZodObject<{
184
+ actions: z.ZodArray<z.ZodEnum<["*", "create", "read", "update", "delete"]>, "atleastone">;
185
+ scopes: z.ZodArray<z.ZodEnum<["*", "Dashboard", "Datasource", "EphemeralDashboard", "Folder", "GlobalDatasource", "GlobalRole", "GlobalRoleBinding", "GlobalSecret", "GlobalVariable", "Project", "Role", "RoleBinding", "Secret", "User", "Variable"]>, "atleastone">;
186
+ }, "strip", z.ZodTypeAny, {
187
+ actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
188
+ scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
189
+ }, {
190
+ actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
191
+ scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
192
+ }>, "many">;
193
+ }, "strip", z.ZodTypeAny, {
194
+ permissions: {
195
+ actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
196
+ scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
197
+ }[];
198
+ }, {
199
+ permissions: {
200
+ actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
201
+ scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
202
+ }[];
203
+ }>;
204
+ }, "strip", z.ZodTypeAny, {
205
+ kind: "GlobalRole";
206
+ spec: {
207
+ permissions: {
208
+ actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
209
+ scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
210
+ }[];
211
+ };
212
+ metadata: {
213
+ name: string;
214
+ };
215
+ }, {
216
+ kind: "GlobalRole";
217
+ spec: {
218
+ permissions: {
219
+ actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
220
+ scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "EphemeralDashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
221
+ }[];
222
+ };
223
+ metadata: {
224
+ name: string;
225
+ };
226
+ }>]>;
227
+ export type RolesEditorValidationType = z.infer<typeof rolesEditorValidationSchema>;
228
+ //# sourceMappingURL=role.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"role.d.ts","sourceRoot":"","sources":["../../src/validation/role.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA8BxB,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAS/B,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQrC,CAAC;AAEH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAGtC,CAAC;AAEH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC"}
@@ -0,0 +1,67 @@
1
+ // Copyright 2023 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ import { z } from 'zod';
14
+ import { resourceIdValidationSchema } from './resource';
15
+ const permissionValidationSchema = z.object({
16
+ // TODO: use SCOPE & ACTIONS constants
17
+ actions: z.array(z.enum([
18
+ '*',
19
+ 'create',
20
+ 'read',
21
+ 'update',
22
+ 'delete'
23
+ ])).nonempty('Must contains at least 1 action'),
24
+ scopes: z.array(z.enum([
25
+ '*',
26
+ 'Dashboard',
27
+ 'Datasource',
28
+ 'EphemeralDashboard',
29
+ 'Folder',
30
+ 'GlobalDatasource',
31
+ 'GlobalRole',
32
+ 'GlobalRoleBinding',
33
+ 'GlobalSecret',
34
+ 'GlobalVariable',
35
+ 'Project',
36
+ 'Role',
37
+ 'RoleBinding',
38
+ 'Secret',
39
+ 'User',
40
+ 'Variable'
41
+ ])).nonempty('Must contains at least 1 scope')
42
+ });
43
+ export const roleValidationSchema = z.object({
44
+ kind: z.literal('Role'),
45
+ metadata: z.object({
46
+ name: resourceIdValidationSchema,
47
+ project: resourceIdValidationSchema
48
+ }),
49
+ spec: z.object({
50
+ permissions: z.array(permissionValidationSchema)
51
+ })
52
+ });
53
+ export const globalRoleValidationSchema = z.object({
54
+ kind: z.literal('GlobalRole'),
55
+ metadata: z.object({
56
+ name: resourceIdValidationSchema
57
+ }),
58
+ spec: z.object({
59
+ permissions: z.array(permissionValidationSchema)
60
+ })
61
+ });
62
+ export const rolesEditorValidationSchema = z.discriminatedUnion('kind', [
63
+ roleValidationSchema,
64
+ globalRoleValidationSchema
65
+ ]);
66
+
67
+ //# sourceMappingURL=role.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/validation/role.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { z } from 'zod';\nimport { resourceIdValidationSchema } from './resource';\n\nconst permissionValidationSchema = z.object({\n // TODO: use SCOPE & ACTIONS constants\n actions: z.array(z.enum(['*', 'create', 'read', 'update', 'delete'])).nonempty('Must contains at least 1 action'),\n scopes: z\n .array(\n z.enum([\n '*',\n 'Dashboard',\n 'Datasource',\n 'EphemeralDashboard',\n 'Folder',\n 'GlobalDatasource',\n 'GlobalRole',\n 'GlobalRoleBinding',\n 'GlobalSecret',\n 'GlobalVariable',\n 'Project',\n 'Role',\n 'RoleBinding',\n 'Secret',\n 'User',\n 'Variable',\n ])\n )\n .nonempty('Must contains at least 1 scope'), // TODO: limit project role\n});\n\nexport const roleValidationSchema = z.object({\n kind: z.literal('Role'),\n metadata: z.object({\n name: resourceIdValidationSchema,\n project: resourceIdValidationSchema,\n }),\n spec: z.object({\n permissions: z.array(permissionValidationSchema),\n }),\n});\n\nexport const globalRoleValidationSchema = z.object({\n kind: z.literal('GlobalRole'),\n metadata: z.object({\n name: resourceIdValidationSchema,\n }),\n spec: z.object({\n permissions: z.array(permissionValidationSchema),\n }),\n});\n\nexport const rolesEditorValidationSchema = z.discriminatedUnion('kind', [\n roleValidationSchema,\n globalRoleValidationSchema,\n]);\n\nexport type RolesEditorValidationType = z.infer<typeof rolesEditorValidationSchema>;\n"],"names":["z","resourceIdValidationSchema","permissionValidationSchema","object","actions","array","enum","nonempty","scopes","roleValidationSchema","kind","literal","metadata","name","project","spec","permissions","globalRoleValidationSchema","rolesEditorValidationSchema","discriminatedUnion"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,CAAC,QAAQ,MAAM;AACxB,SAASC,0BAA0B,QAAQ,aAAa;AAExD,MAAMC,6BAA6BF,EAAEG,MAAM,CAAC;IAC1C,sCAAsC;IACtCC,SAASJ,EAAEK,KAAK,CAACL,EAAEM,IAAI,CAAC;QAAC;QAAK;QAAU;QAAQ;QAAU;KAAS,GAAGC,QAAQ,CAAC;IAC/EC,QAAQR,EACLK,KAAK,CACJL,EAAEM,IAAI,CAAC;QACL;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;KACD,GAEFC,QAAQ,CAAC;AACd;AAEA,OAAO,MAAME,uBAAuBT,EAAEG,MAAM,CAAC;IAC3CO,MAAMV,EAAEW,OAAO,CAAC;IAChBC,UAAUZ,EAAEG,MAAM,CAAC;QACjBU,MAAMZ;QACNa,SAASb;IACX;IACAc,MAAMf,EAAEG,MAAM,CAAC;QACba,aAAahB,EAAEK,KAAK,CAACH;IACvB;AACF,GAAG;AAEH,OAAO,MAAMe,6BAA6BjB,EAAEG,MAAM,CAAC;IACjDO,MAAMV,EAAEW,OAAO,CAAC;IAChBC,UAAUZ,EAAEG,MAAM,CAAC;QACjBU,MAAMZ;IACR;IACAc,MAAMf,EAAEG,MAAM,CAAC;QACba,aAAahB,EAAEK,KAAK,CAACH;IACvB;AACF,GAAG;AAEH,OAAO,MAAMgB,8BAA8BlB,EAAEmB,kBAAkB,CAAC,QAAQ;IACtEV;IACAQ;CACD,EAAE"}