@perses-dev/plugin-system 0.43.0-rc2 → 0.44.0-rc0

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 (255) hide show
  1. package/dist/cjs/components/CalculationSelector/CalculationSelector.js +1 -1
  2. package/dist/cjs/components/DatasourceEditorForm/DatasourceEditorForm.js +8 -8
  3. package/dist/cjs/components/DatasourceSelect.js +11 -9
  4. package/dist/cjs/components/LegendOptionsEditor/LegendOptionsEditor.js +1 -1
  5. package/dist/cjs/components/OptionsEditorRadios/OptionsEditorRadios.js +3 -3
  6. package/dist/cjs/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js +1 -1
  7. package/dist/cjs/components/OptionsEditorTabs/OptionsEditorTabs.js +3 -3
  8. package/dist/cjs/components/PanelSpecEditor/PanelSpecEditor.js +49 -11
  9. package/dist/cjs/components/PluginEditor/PluginEditor.js +2 -3
  10. package/dist/cjs/components/PluginEditor/plugin-editor-api.js +3 -3
  11. package/dist/cjs/components/PluginKindSelect/PluginKindSelect.js +2 -2
  12. package/dist/cjs/components/PluginRegistry/PluginRegistry.js +1 -1
  13. package/dist/cjs/components/PluginRegistry/plugin-indexes.js +4 -4
  14. package/dist/cjs/components/PluginSpecEditor/PluginSpecEditor.js +3 -3
  15. package/dist/cjs/components/ProjectSelect.js +2 -2
  16. package/dist/cjs/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.js +3 -3
  17. package/dist/cjs/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.js +3 -3
  18. package/dist/cjs/components/TraceQueryEditor/TraceQueryEditor.js +143 -0
  19. package/dist/cjs/components/TraceQueryEditor/TraceQueryInput.js +96 -0
  20. package/dist/cjs/components/TraceQueryEditor/index.js +30 -0
  21. package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +29 -23
  22. package/dist/cjs/components/Variables/VariableEditorForm/VariablePreview.js +10 -8
  23. package/dist/cjs/components/Variables/VariableEditorForm/variable-editor-form-model.js +1 -1
  24. package/dist/cjs/components/Variables/variable-model.js +12 -13
  25. package/dist/cjs/context/ProjectStoreProvider.js +5 -5
  26. package/dist/cjs/model/legend.js +5 -5
  27. package/dist/cjs/runtime/DataQueriesProvider/DataQueriesProvider.js +6 -6
  28. package/dist/cjs/runtime/DataQueriesProvider/model.js +3 -3
  29. package/dist/cjs/runtime/TimeRangeProvider/TimeRangeProvider.js +8 -6
  30. package/dist/cjs/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.js +3 -3
  31. package/dist/cjs/runtime/TimeRangeProvider/query-params.js +16 -16
  32. package/dist/cjs/runtime/builtin-variables.js +5 -5
  33. package/dist/cjs/runtime/datasources.js +7 -7
  34. package/dist/cjs/runtime/plugin-registry.js +12 -12
  35. package/dist/cjs/runtime/template-variables.js +15 -7
  36. package/dist/cjs/runtime/time-series-queries.js +14 -14
  37. package/dist/cjs/runtime/trace-queries.js +24 -7
  38. package/dist/cjs/stories/shared-utils/decorators/WithPluginRegistry.js +3 -1
  39. package/dist/cjs/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js +1 -1
  40. package/dist/cjs/test/test-plugins/bert/index.js +2 -2
  41. package/dist/cjs/test/test-plugins/ernie/index.js +2 -2
  42. package/dist/cjs/test/test-plugins/index.js +3 -1
  43. package/dist/cjs/test-utils/mock-plugin-registry.js +4 -4
  44. package/dist/cjs/utils/action.js +3 -3
  45. package/dist/cjs/utils/variables.js +4 -4
  46. package/dist/cjs/validation/role.js +3 -3
  47. package/dist/cjs/validation/secret.js +3 -3
  48. package/dist/components/CalculationSelector/CalculationSelector.d.ts +1 -2
  49. package/dist/components/CalculationSelector/CalculationSelector.d.ts.map +1 -1
  50. package/dist/components/CalculationSelector/CalculationSelector.js +1 -1
  51. package/dist/components/CalculationSelector/CalculationSelector.js.map +1 -1
  52. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts +1 -1
  53. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts.map +1 -1
  54. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js +8 -8
  55. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js.map +1 -1
  56. package/dist/components/DatasourceSelect.d.ts +3 -4
  57. package/dist/components/DatasourceSelect.d.ts.map +1 -1
  58. package/dist/components/DatasourceSelect.js +8 -6
  59. package/dist/components/DatasourceSelect.js.map +1 -1
  60. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.d.ts +1 -2
  61. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.d.ts.map +1 -1
  62. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js +1 -1
  63. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js.map +1 -1
  64. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.d.ts +3 -3
  65. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.d.ts.map +1 -1
  66. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js +3 -3
  67. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js.map +1 -1
  68. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.d.ts +1 -1
  69. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.d.ts.map +1 -1
  70. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js +1 -1
  71. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js.map +1 -1
  72. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.d.ts +3 -3
  73. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.d.ts.map +1 -1
  74. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js +3 -3
  75. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js.map +1 -1
  76. package/dist/components/PanelSpecEditor/PanelSpecEditor.d.ts +1 -2
  77. package/dist/components/PanelSpecEditor/PanelSpecEditor.d.ts.map +1 -1
  78. package/dist/components/PanelSpecEditor/PanelSpecEditor.js +49 -11
  79. package/dist/components/PanelSpecEditor/PanelSpecEditor.js.map +1 -1
  80. package/dist/components/PluginEditor/PluginEditor.d.ts +1 -2
  81. package/dist/components/PluginEditor/PluginEditor.d.ts.map +1 -1
  82. package/dist/components/PluginEditor/PluginEditor.js +2 -3
  83. package/dist/components/PluginEditor/PluginEditor.js.map +1 -1
  84. package/dist/components/PluginEditor/plugin-editor-api.d.ts +3 -3
  85. package/dist/components/PluginEditor/plugin-editor-api.d.ts.map +1 -1
  86. package/dist/components/PluginEditor/plugin-editor-api.js +3 -3
  87. package/dist/components/PluginEditor/plugin-editor-api.js.map +1 -1
  88. package/dist/components/PluginKindSelect/PluginKindSelect.d.ts +1 -1
  89. package/dist/components/PluginKindSelect/PluginKindSelect.d.ts.map +1 -1
  90. package/dist/components/PluginKindSelect/PluginKindSelect.js +2 -2
  91. package/dist/components/PluginKindSelect/PluginKindSelect.js.map +1 -1
  92. package/dist/components/PluginRegistry/PluginRegistry.d.ts +1 -1
  93. package/dist/components/PluginRegistry/PluginRegistry.d.ts.map +1 -1
  94. package/dist/components/PluginRegistry/PluginRegistry.js +1 -1
  95. package/dist/components/PluginRegistry/PluginRegistry.js.map +1 -1
  96. package/dist/components/PluginRegistry/plugin-indexes.js +1 -1
  97. package/dist/components/PluginRegistry/plugin-indexes.js.map +1 -1
  98. package/dist/components/PluginSpecEditor/PluginSpecEditor.d.ts +1 -2
  99. package/dist/components/PluginSpecEditor/PluginSpecEditor.d.ts.map +1 -1
  100. package/dist/components/PluginSpecEditor/PluginSpecEditor.js +3 -3
  101. package/dist/components/PluginSpecEditor/PluginSpecEditor.js.map +1 -1
  102. package/dist/components/ProjectSelect.d.ts +2 -3
  103. package/dist/components/ProjectSelect.d.ts.map +1 -1
  104. package/dist/components/ProjectSelect.js +2 -2
  105. package/dist/components/ProjectSelect.js.map +1 -1
  106. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.d.ts +1 -2
  107. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.d.ts.map +1 -1
  108. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.js +3 -3
  109. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.js.map +1 -1
  110. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.d.ts +1 -2
  111. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.d.ts.map +1 -1
  112. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.js +3 -3
  113. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.js.map +1 -1
  114. package/dist/components/TraceQueryEditor/TraceQueryEditor.d.ts +8 -0
  115. package/dist/components/TraceQueryEditor/TraceQueryEditor.d.ts.map +1 -0
  116. package/dist/components/TraceQueryEditor/TraceQueryEditor.js +130 -0
  117. package/dist/components/TraceQueryEditor/TraceQueryEditor.js.map +1 -0
  118. package/dist/components/TraceQueryEditor/TraceQueryInput.d.ts +12 -0
  119. package/dist/components/TraceQueryEditor/TraceQueryInput.d.ts.map +1 -0
  120. package/dist/components/TraceQueryEditor/TraceQueryInput.js +83 -0
  121. package/dist/components/TraceQueryEditor/TraceQueryInput.js.map +1 -0
  122. package/dist/components/TraceQueryEditor/index.d.ts +2 -0
  123. package/dist/components/TraceQueryEditor/index.d.ts.map +1 -0
  124. package/dist/components/TraceQueryEditor/index.js +15 -0
  125. package/dist/components/TraceQueryEditor/index.js.map +1 -0
  126. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts +1 -1
  127. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts.map +1 -1
  128. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +26 -22
  129. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -1
  130. package/dist/components/Variables/VariableEditorForm/VariablePreview.d.ts +2 -3
  131. package/dist/components/Variables/VariableEditorForm/VariablePreview.d.ts.map +1 -1
  132. package/dist/components/Variables/VariableEditorForm/VariablePreview.js +4 -4
  133. package/dist/components/Variables/VariableEditorForm/VariablePreview.js.map +1 -1
  134. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts +1 -1
  135. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts.map +1 -1
  136. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js +1 -1
  137. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js.map +1 -1
  138. package/dist/components/Variables/variable-model.d.ts.map +1 -1
  139. package/dist/components/Variables/variable-model.js +6 -7
  140. package/dist/components/Variables/variable-model.js.map +1 -1
  141. package/dist/context/ProjectStoreProvider.d.ts +1 -1
  142. package/dist/context/ProjectStoreProvider.d.ts.map +1 -1
  143. package/dist/context/ProjectStoreProvider.js +2 -2
  144. package/dist/context/ProjectStoreProvider.js.map +1 -1
  145. package/dist/context/query-params.js.map +1 -1
  146. package/dist/model/datasource.js +3 -1
  147. package/dist/model/datasource.js.map +1 -1
  148. package/dist/model/legend.d.ts +2 -2
  149. package/dist/model/legend.d.ts.map +1 -1
  150. package/dist/model/legend.js.map +1 -1
  151. package/dist/model/panels.d.ts +3 -2
  152. package/dist/model/panels.d.ts.map +1 -1
  153. package/dist/model/panels.js.map +1 -1
  154. package/dist/model/plugin-loading.js.map +1 -1
  155. package/dist/model/plugins.d.ts +4 -4
  156. package/dist/model/plugins.d.ts.map +1 -1
  157. package/dist/model/plugins.js.map +1 -1
  158. package/dist/model/time-series-queries.d.ts +2 -2
  159. package/dist/model/time-series-queries.d.ts.map +1 -1
  160. package/dist/model/time-series-queries.js.map +1 -1
  161. package/dist/model/trace-queries.d.ts +3 -2
  162. package/dist/model/trace-queries.d.ts.map +1 -1
  163. package/dist/model/trace-queries.js.map +1 -1
  164. package/dist/model/variables.d.ts +2 -2
  165. package/dist/model/variables.d.ts.map +1 -1
  166. package/dist/model/variables.js +3 -1
  167. package/dist/model/variables.js.map +1 -1
  168. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.d.ts +1 -1
  169. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.d.ts.map +1 -1
  170. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js +2 -2
  171. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js.map +1 -1
  172. package/dist/runtime/DataQueriesProvider/model.d.ts +2 -2
  173. package/dist/runtime/DataQueriesProvider/model.d.ts.map +1 -1
  174. package/dist/runtime/DataQueriesProvider/model.js +3 -3
  175. package/dist/runtime/DataQueriesProvider/model.js.map +1 -1
  176. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.d.ts +1 -1
  177. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.d.ts.map +1 -1
  178. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js +1 -1
  179. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js.map +1 -1
  180. package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.d.ts +1 -1
  181. package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.d.ts.map +1 -1
  182. package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.js +3 -3
  183. package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.js.map +1 -1
  184. package/dist/runtime/TimeRangeProvider/query-params.d.ts +1 -1
  185. package/dist/runtime/TimeRangeProvider/query-params.d.ts.map +1 -1
  186. package/dist/runtime/TimeRangeProvider/query-params.js +4 -4
  187. package/dist/runtime/TimeRangeProvider/query-params.js.map +1 -1
  188. package/dist/runtime/builtin-variables.d.ts +1 -1
  189. package/dist/runtime/builtin-variables.d.ts.map +1 -1
  190. package/dist/runtime/builtin-variables.js +2 -2
  191. package/dist/runtime/builtin-variables.js.map +1 -1
  192. package/dist/runtime/datasources.js +1 -1
  193. package/dist/runtime/datasources.js.map +1 -1
  194. package/dist/runtime/plugin-registry.d.ts +2 -2
  195. package/dist/runtime/plugin-registry.d.ts.map +1 -1
  196. package/dist/runtime/plugin-registry.js +4 -4
  197. package/dist/runtime/plugin-registry.js.map +1 -1
  198. package/dist/runtime/template-variables.d.ts +4 -4
  199. package/dist/runtime/template-variables.d.ts.map +1 -1
  200. package/dist/runtime/template-variables.js +10 -2
  201. package/dist/runtime/template-variables.js.map +1 -1
  202. package/dist/runtime/time-series-queries.js +7 -7
  203. package/dist/runtime/time-series-queries.js.map +1 -1
  204. package/dist/runtime/trace-queries.d.ts +6 -2
  205. package/dist/runtime/trace-queries.d.ts.map +1 -1
  206. package/dist/runtime/trace-queries.js +21 -7
  207. package/dist/runtime/trace-queries.js.map +1 -1
  208. package/dist/stories/shared-utils/decorators/WithDataQueries.d.ts +2 -3
  209. package/dist/stories/shared-utils/decorators/WithDataQueries.d.ts.map +1 -1
  210. package/dist/stories/shared-utils/decorators/WithDataQueries.js.map +1 -1
  211. package/dist/stories/shared-utils/decorators/WithPluginRegistry.d.ts +1 -2
  212. package/dist/stories/shared-utils/decorators/WithPluginRegistry.d.ts.map +1 -1
  213. package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.d.ts +2 -3
  214. package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.d.ts.map +1 -1
  215. package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.js.map +1 -1
  216. package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.d.ts +2 -3
  217. package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.d.ts.map +1 -1
  218. package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js +1 -1
  219. package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js.map +1 -1
  220. package/dist/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.d.ts +2 -3
  221. package/dist/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.d.ts.map +1 -1
  222. package/dist/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.js.map +1 -1
  223. package/dist/stories/shared-utils/decorators/WithTimeRange.d.ts +2 -3
  224. package/dist/stories/shared-utils/decorators/WithTimeRange.d.ts.map +1 -1
  225. package/dist/stories/shared-utils/decorators/WithTimeRange.js.map +1 -1
  226. package/dist/test/render.d.ts +1 -1
  227. package/dist/test/render.d.ts.map +1 -1
  228. package/dist/test/render.js.map +1 -1
  229. package/dist/test/setup-tests.js.map +1 -1
  230. package/dist/test/test-plugins/bert/index.js +2 -2
  231. package/dist/test/test-plugins/bert/index.js.map +1 -1
  232. package/dist/test/test-plugins/ernie/index.js +2 -2
  233. package/dist/test/test-plugins/ernie/index.js.map +1 -1
  234. package/dist/test-utils/mock-plugin-registry.d.ts +1 -1
  235. package/dist/test-utils/mock-plugin-registry.d.ts.map +1 -1
  236. package/dist/test-utils/mock-plugin-registry.js +1 -1
  237. package/dist/test-utils/mock-plugin-registry.js.map +1 -1
  238. package/dist/utils/variables.js.map +1 -1
  239. package/dist/validation/datasource.d.ts +1 -1
  240. package/dist/validation/datasource.d.ts.map +1 -1
  241. package/dist/validation/datasource.js.map +1 -1
  242. package/dist/validation/resource.js.map +1 -1
  243. package/dist/validation/role.d.ts +43 -43
  244. package/dist/validation/role.d.ts.map +1 -1
  245. package/dist/validation/role.js.map +1 -1
  246. package/dist/validation/rolebinding.d.ts +10 -10
  247. package/dist/validation/rolebinding.d.ts.map +1 -1
  248. package/dist/validation/rolebinding.js.map +1 -1
  249. package/dist/validation/secret.d.ts +19 -19
  250. package/dist/validation/secret.d.ts.map +1 -1
  251. package/dist/validation/secret.js.map +1 -1
  252. package/dist/validation/variable.d.ts +1 -1
  253. package/dist/validation/variable.d.ts.map +1 -1
  254. package/dist/validation/variable.js.map +1 -1
  255. package/package.json +4 -4
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/test-utils/mock-plugin-registry.tsx"],"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 { UnknownSpec } from '@perses-dev/core';\nimport { PluginRegistryProps } from '../components';\nimport { PluginModuleResource, Plugin, PluginLoader, PluginImplementation, PluginType } from '../model';\n\nexport type MockPlugin = {\n [T in PluginType]: {\n pluginType: T;\n kind: string;\n plugin: PluginImplementation<T>;\n };\n}[PluginType];\n\n/**\n * Helper for mocking `PluginRegistry` data during tests. Returns props that can be spread on the `PluginRegistry`\n * component so that it will load the mock plugins you provide.\n */\nexport function mockPluginRegistry(...mockPlugins: MockPlugin[]): Omit<PluginRegistryProps, 'children'> {\n const mockPluginResource: PluginModuleResource = {\n kind: 'PluginModule',\n metadata: {\n name: 'Fake Plugin Module for Tests',\n createdAt: '',\n updatedAt: '',\n version: 0,\n },\n spec: {\n // Add metadata for all mock plugins\n plugins: mockPlugins.map(({ pluginType, kind }) => ({\n pluginType,\n kind,\n display: {\n name: getMockPluginName(pluginType, kind),\n },\n })),\n },\n };\n\n const mockPluginModule: Record<string, Plugin<UnknownSpec>> = {};\n for (const mockPlugin of mockPlugins) {\n // \"Export\" on the module under the same name as the kind the plugin handles\n mockPluginModule[mockPlugin.kind] = mockPlugin.plugin;\n }\n\n const pluginLoader: PluginLoader = {\n getInstalledPlugins() {\n return Promise.resolve([mockPluginResource]);\n },\n importPluginModule(/* resource */) {\n return Promise.resolve(mockPluginModule);\n },\n };\n\n return {\n pluginLoader,\n defaultPluginKinds: {\n TimeSeriesQuery: 'PrometheusTimeSeriesQuery',\n },\n };\n}\n\n/**\n * The function that's used to generate the display name of mocked plugins in mockPluginRegistry. Can be useful if you\n * need to interact with some UI component that's displaying it.\n */\nexport function getMockPluginName(pluginType: PluginType, kind: string) {\n return `${pluginType} Plugin for ${kind}`;\n}\n"],"names":["mockPluginRegistry","mockPlugins","mockPluginResource","kind","metadata","name","createdAt","updatedAt","version","spec","plugins","map","pluginType","display","getMockPluginName","mockPluginModule","mockPlugin","plugin","pluginLoader","getInstalledPlugins","Promise","resolve","importPluginModule","defaultPluginKinds","TimeSeriesQuery"],"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;AAcjC;;;CAGC,GACD,OAAO,SAASA,mBAAmB,GAAGC,WAAyB;IAC7D,MAAMC,qBAA2C;QAC/CC,MAAM;QACNC,UAAU;YACRC,MAAM;YACNC,WAAW;YACXC,WAAW;YACXC,SAAS;QACX;QACAC,MAAM;YACJ,oCAAoC;YACpCC,SAAST,YAAYU,IAAI,CAAC,EAAEC,WAAU,EAAET,KAAI,EAAE,GAAM,CAAA;oBAClDS;oBACAT;oBACAU,SAAS;wBACPR,MAAMS,kBAAkBF,YAAYT;oBACtC;gBACF,CAAA;QACF;IACF;IAEA,MAAMY,mBAAwD,CAAC;IAC/D,KAAK,MAAMC,cAAcf,YAAa;QACpC,4EAA4E;QAC5Ec,gBAAgB,CAACC,WAAWb,KAAK,GAAGa,WAAWC;IACjD;IAEA,MAAMC,eAA6B;QACjCC;YACE,OAAOC,QAAQC,QAAQ;gBAACnB;aAAmB;QAC7C;QACAoB;YACE,OAAOF,QAAQC,QAAQN;QACzB;IACF;IAEA,OAAO;QACLG;QACAK,oBAAoB;YAClBC,iBAAiB;QACnB;IACF;AACF;AAEA;;;CAGC,GACD,OAAO,SAASV,kBAAkBF,UAAsB,EAAET,IAAY;IACpE,OAAO,CAAC,EAAES,WAAW,YAAY,EAAET,KAAK,CAAC;AAC3C"}
1
+ {"version":3,"sources":["../../src/test-utils/mock-plugin-registry.tsx"],"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 { UnknownSpec } from '@perses-dev/core';\nimport { PluginRegistryProps } from '../components';\nimport { PluginModuleResource, Plugin, PluginLoader, PluginImplementation, PluginType } from '../model';\n\nexport type MockPlugin = {\n [T in PluginType]: {\n pluginType: T;\n kind: string;\n plugin: PluginImplementation<T>;\n };\n}[PluginType];\n\n/**\n * Helper for mocking `PluginRegistry` data during tests. Returns props that can be spread on the `PluginRegistry`\n * component so that it will load the mock plugins you provide.\n */\nexport function mockPluginRegistry(...mockPlugins: MockPlugin[]): Omit<PluginRegistryProps, 'children'> {\n const mockPluginResource: PluginModuleResource = {\n kind: 'PluginModule',\n metadata: {\n name: 'Fake Plugin Module for Tests',\n createdAt: '',\n updatedAt: '',\n version: 0,\n },\n spec: {\n // Add metadata for all mock plugins\n plugins: mockPlugins.map(({ pluginType, kind }) => ({\n pluginType,\n kind,\n display: {\n name: getMockPluginName(pluginType, kind),\n },\n })),\n },\n };\n\n const mockPluginModule: Record<string, Plugin<UnknownSpec>> = {};\n for (const mockPlugin of mockPlugins) {\n // \"Export\" on the module under the same name as the kind the plugin handles\n mockPluginModule[mockPlugin.kind] = mockPlugin.plugin;\n }\n\n const pluginLoader: PluginLoader = {\n getInstalledPlugins() {\n return Promise.resolve([mockPluginResource]);\n },\n importPluginModule(/* resource */) {\n return Promise.resolve(mockPluginModule);\n },\n };\n\n return {\n pluginLoader,\n defaultPluginKinds: {\n TimeSeriesQuery: 'PrometheusTimeSeriesQuery',\n },\n };\n}\n\n/**\n * The function that's used to generate the display name of mocked plugins in mockPluginRegistry. Can be useful if you\n * need to interact with some UI component that's displaying it.\n */\nexport function getMockPluginName(pluginType: PluginType, kind: string) {\n return `${pluginType} Plugin for ${kind}`;\n}\n"],"names":["mockPluginRegistry","mockPlugins","mockPluginResource","kind","metadata","name","createdAt","updatedAt","version","spec","plugins","map","pluginType","display","getMockPluginName","mockPluginModule","mockPlugin","plugin","pluginLoader","getInstalledPlugins","Promise","resolve","importPluginModule","defaultPluginKinds","TimeSeriesQuery"],"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;AAcjC;;;CAGC,GACD,OAAO,SAASA,mBAAmB,GAAGC,WAAyB;IAC7D,MAAMC,qBAA2C;QAC/CC,MAAM;QACNC,UAAU;YACRC,MAAM;YACNC,WAAW;YACXC,WAAW;YACXC,SAAS;QACX;QACAC,MAAM;YACJ,oCAAoC;YACpCC,SAAST,YAAYU,GAAG,CAAC,CAAC,EAAEC,UAAU,EAAET,IAAI,EAAE,GAAM,CAAA;oBAClDS;oBACAT;oBACAU,SAAS;wBACPR,MAAMS,kBAAkBF,YAAYT;oBACtC;gBACF,CAAA;QACF;IACF;IAEA,MAAMY,mBAAwD,CAAC;IAC/D,KAAK,MAAMC,cAAcf,YAAa;QACpC,4EAA4E;QAC5Ec,gBAAgB,CAACC,WAAWb,IAAI,CAAC,GAAGa,WAAWC,MAAM;IACvD;IAEA,MAAMC,eAA6B;QACjCC;YACE,OAAOC,QAAQC,OAAO,CAAC;gBAACnB;aAAmB;QAC7C;QACAoB;YACE,OAAOF,QAAQC,OAAO,CAACN;QACzB;IACF;IAEA,OAAO;QACLG;QACAK,oBAAoB;YAClBC,iBAAiB;QACnB;IACF;AACF;AAEA;;;CAGC,GACD,OAAO,SAASV,kBAAkBF,UAAsB,EAAET,IAAY;IACpE,OAAO,CAAC,EAAES,WAAW,YAAY,EAAET,KAAK,CAAC;AAC3C"}
@@ -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\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,KAAK,CAACC,GAAGC,IAAMA,EAAEC,SAASF,EAAEE,QAC5BC,QAAQ,CAACC;QACR,MAAMC,WAAWV,aAAa,CAACS,EAAE;QACjC,IAAIC,YAAYA,CAAAA,qBAAAA,sBAAAA,KAAAA,IAAAA,SAAUC,KAAI,GAAG;YAC/BR,YAAYS,wBAAwBT,WAAWM,GAAGC,qBAAAA,sBAAAA,KAAAA,IAAAA,SAAUC;QAC9D;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,QAAQL,wBAAwB;QACxCG,gBAAgB,CAAC,CAAC,EAAEH,sBAAsBM,KAAK,KAAK,CAAC,CAAC,EAAE,cAAc;IACxE;IACA,IAAI,OAAON,0BAA0B,UAAU;QAC7CG,gBAAgBH;IAClB;IAEAf,OAAOA,KAAKsB,WAAWN,kBAAkBE;IACzC,OAAOlB,KAAKsB,WAAWL,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,KAAK5B,KAAI,MAAO,KAAM;QAC1C,IAAI2B,OAAO;YACT,IAAIA,KAAK,CAAC,EAAE,EAAE;gBACZ,WAAW;gBACXF,QAAQI,IAAIF,KAAK,CAAC,EAAE;YACtB,OAAO,IAAIA,KAAK,CAAC,EAAE,EAAE;gBACnB,aAAa;gBACbF,QAAQI,IAAIF,KAAK,CAAC,EAAE;YACtB;QACF;IACF;IACA,wBAAwB;IACxB,OAAOR,MAAMW,KAAKL,QAAQM;AAC5B,EAAE"}
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"}
@@ -15,5 +15,5 @@ export declare const datasourceEditValidationSchema: z.ZodObject<{
15
15
  title?: string | undefined;
16
16
  description?: string | undefined;
17
17
  }>;
18
- export declare type DatasourceEditValidationType = z.infer<typeof datasourceEditValidationSchema>;
18
+ export type DatasourceEditValidationType = z.infer<typeof datasourceEditValidationSchema>;
19
19
  //# sourceMappingURL=datasource.d.ts.map
@@ -1 +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,oBAAY,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC"}
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"}
@@ -1 +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,OAAO;IACrDC,MAAMH;IACNI,OAAOL,EAAEM,SAASC;IAClBC,aAAaR,EAAEM,SAASC;IACxBE,SAAST,EAAEU;AACb,GAAG"}
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"}
@@ -1 +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 .nonempty('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","nonempty","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,SACAC,SAAS,YACTC,IAAI,IAAI,uCACRC,MAAM,qBAAqB,6EAA6E"}
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 .nonempty('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","nonempty","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,QAAQ,CAAC,YACTC,GAAG,CAAC,IAAI,uCACRC,KAAK,CAAC,qBAAqB,6EAA6E"}
@@ -17,46 +17,46 @@ export declare const roleValidationSchema: z.ZodObject<{
17
17
  scopes: z.ZodArray<z.ZodEnum<["*", "Dashboard", "Datasource", "Folder", "GlobalDatasource", "GlobalRole", "GlobalRoleBinding", "GlobalSecret", "GlobalVariable", "Project", "Role", "RoleBinding", "Secret", "User", "Variable"]>, "atleastone">;
18
18
  }, "strip", z.ZodTypeAny, {
19
19
  actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
20
- scopes: ["*" | "Datasource" | "Secret" | "GlobalSecret" | "Variable" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Datasource" | "Secret" | "GlobalSecret" | "Variable" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
20
+ scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
21
21
  }, {
22
22
  actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
23
- scopes: ["*" | "Datasource" | "Secret" | "GlobalSecret" | "Variable" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Datasource" | "Secret" | "GlobalSecret" | "Variable" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
23
+ scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
24
24
  }>, "many">;
25
25
  }, "strip", z.ZodTypeAny, {
26
26
  permissions: {
27
27
  actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
28
- scopes: ["*" | "Datasource" | "Secret" | "GlobalSecret" | "Variable" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Datasource" | "Secret" | "GlobalSecret" | "Variable" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
28
+ scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
29
29
  }[];
30
30
  }, {
31
31
  permissions: {
32
32
  actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
33
- scopes: ["*" | "Datasource" | "Secret" | "GlobalSecret" | "Variable" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Datasource" | "Secret" | "GlobalSecret" | "Variable" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
33
+ scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
34
34
  }[];
35
35
  }>;
36
36
  }, "strip", z.ZodTypeAny, {
37
- metadata: {
38
- name: string;
39
- project: string;
40
- };
41
37
  kind: "Role";
42
38
  spec: {
43
39
  permissions: {
44
40
  actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
45
- scopes: ["*" | "Datasource" | "Secret" | "GlobalSecret" | "Variable" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Datasource" | "Secret" | "GlobalSecret" | "Variable" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
41
+ scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
46
42
  }[];
47
43
  };
48
- }, {
49
44
  metadata: {
50
45
  name: string;
51
46
  project: string;
52
47
  };
48
+ }, {
53
49
  kind: "Role";
54
50
  spec: {
55
51
  permissions: {
56
52
  actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
57
- scopes: ["*" | "Datasource" | "Secret" | "GlobalSecret" | "Variable" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Datasource" | "Secret" | "GlobalSecret" | "Variable" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
53
+ scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
58
54
  }[];
59
55
  };
56
+ metadata: {
57
+ name: string;
58
+ project: string;
59
+ };
60
60
  }>;
61
61
  export declare const globalRoleValidationSchema: z.ZodObject<{
62
62
  kind: z.ZodLiteral<"GlobalRole">;
@@ -73,44 +73,44 @@ export declare const globalRoleValidationSchema: z.ZodObject<{
73
73
  scopes: z.ZodArray<z.ZodEnum<["*", "Dashboard", "Datasource", "Folder", "GlobalDatasource", "GlobalRole", "GlobalRoleBinding", "GlobalSecret", "GlobalVariable", "Project", "Role", "RoleBinding", "Secret", "User", "Variable"]>, "atleastone">;
74
74
  }, "strip", z.ZodTypeAny, {
75
75
  actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
76
- scopes: ["*" | "Datasource" | "Secret" | "GlobalSecret" | "Variable" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Datasource" | "Secret" | "GlobalSecret" | "Variable" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
76
+ scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
77
77
  }, {
78
78
  actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
79
- scopes: ["*" | "Datasource" | "Secret" | "GlobalSecret" | "Variable" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Datasource" | "Secret" | "GlobalSecret" | "Variable" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
79
+ scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
80
80
  }>, "many">;
81
81
  }, "strip", z.ZodTypeAny, {
82
82
  permissions: {
83
83
  actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
84
- scopes: ["*" | "Datasource" | "Secret" | "GlobalSecret" | "Variable" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Datasource" | "Secret" | "GlobalSecret" | "Variable" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
84
+ scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
85
85
  }[];
86
86
  }, {
87
87
  permissions: {
88
88
  actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
89
- scopes: ["*" | "Datasource" | "Secret" | "GlobalSecret" | "Variable" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Datasource" | "Secret" | "GlobalSecret" | "Variable" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
89
+ scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
90
90
  }[];
91
91
  }>;
92
92
  }, "strip", z.ZodTypeAny, {
93
- metadata: {
94
- name: string;
95
- };
96
93
  kind: "GlobalRole";
97
94
  spec: {
98
95
  permissions: {
99
96
  actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
100
- scopes: ["*" | "Datasource" | "Secret" | "GlobalSecret" | "Variable" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Datasource" | "Secret" | "GlobalSecret" | "Variable" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
97
+ scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
101
98
  }[];
102
99
  };
103
- }, {
104
100
  metadata: {
105
101
  name: string;
106
102
  };
103
+ }, {
107
104
  kind: "GlobalRole";
108
105
  spec: {
109
106
  permissions: {
110
107
  actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
111
- scopes: ["*" | "Datasource" | "Secret" | "GlobalSecret" | "Variable" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Datasource" | "Secret" | "GlobalSecret" | "Variable" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
108
+ scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
112
109
  }[];
113
110
  };
111
+ metadata: {
112
+ name: string;
113
+ };
114
114
  }>;
115
115
  export declare const rolesEditorValidationSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
116
116
  kind: z.ZodLiteral<"Role">;
@@ -130,46 +130,46 @@ export declare const rolesEditorValidationSchema: z.ZodDiscriminatedUnion<"kind"
130
130
  scopes: z.ZodArray<z.ZodEnum<["*", "Dashboard", "Datasource", "Folder", "GlobalDatasource", "GlobalRole", "GlobalRoleBinding", "GlobalSecret", "GlobalVariable", "Project", "Role", "RoleBinding", "Secret", "User", "Variable"]>, "atleastone">;
131
131
  }, "strip", z.ZodTypeAny, {
132
132
  actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
133
- scopes: ["*" | "Datasource" | "Secret" | "GlobalSecret" | "Variable" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Datasource" | "Secret" | "GlobalSecret" | "Variable" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
133
+ scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
134
134
  }, {
135
135
  actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
136
- scopes: ["*" | "Datasource" | "Secret" | "GlobalSecret" | "Variable" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Datasource" | "Secret" | "GlobalSecret" | "Variable" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
136
+ scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
137
137
  }>, "many">;
138
138
  }, "strip", z.ZodTypeAny, {
139
139
  permissions: {
140
140
  actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
141
- scopes: ["*" | "Datasource" | "Secret" | "GlobalSecret" | "Variable" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Datasource" | "Secret" | "GlobalSecret" | "Variable" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
141
+ scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
142
142
  }[];
143
143
  }, {
144
144
  permissions: {
145
145
  actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
146
- scopes: ["*" | "Datasource" | "Secret" | "GlobalSecret" | "Variable" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Datasource" | "Secret" | "GlobalSecret" | "Variable" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
146
+ scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
147
147
  }[];
148
148
  }>;
149
149
  }, "strip", z.ZodTypeAny, {
150
- metadata: {
151
- name: string;
152
- project: string;
153
- };
154
150
  kind: "Role";
155
151
  spec: {
156
152
  permissions: {
157
153
  actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
158
- scopes: ["*" | "Datasource" | "Secret" | "GlobalSecret" | "Variable" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Datasource" | "Secret" | "GlobalSecret" | "Variable" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
154
+ scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
159
155
  }[];
160
156
  };
161
- }, {
162
157
  metadata: {
163
158
  name: string;
164
159
  project: string;
165
160
  };
161
+ }, {
166
162
  kind: "Role";
167
163
  spec: {
168
164
  permissions: {
169
165
  actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
170
- scopes: ["*" | "Datasource" | "Secret" | "GlobalSecret" | "Variable" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Datasource" | "Secret" | "GlobalSecret" | "Variable" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
166
+ scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
171
167
  }[];
172
168
  };
169
+ metadata: {
170
+ name: string;
171
+ project: string;
172
+ };
173
173
  }>, z.ZodObject<{
174
174
  kind: z.ZodLiteral<"GlobalRole">;
175
175
  metadata: z.ZodObject<{
@@ -185,44 +185,44 @@ export declare const rolesEditorValidationSchema: z.ZodDiscriminatedUnion<"kind"
185
185
  scopes: z.ZodArray<z.ZodEnum<["*", "Dashboard", "Datasource", "Folder", "GlobalDatasource", "GlobalRole", "GlobalRoleBinding", "GlobalSecret", "GlobalVariable", "Project", "Role", "RoleBinding", "Secret", "User", "Variable"]>, "atleastone">;
186
186
  }, "strip", z.ZodTypeAny, {
187
187
  actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
188
- scopes: ["*" | "Datasource" | "Secret" | "GlobalSecret" | "Variable" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Datasource" | "Secret" | "GlobalSecret" | "Variable" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
188
+ scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
189
189
  }, {
190
190
  actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
191
- scopes: ["*" | "Datasource" | "Secret" | "GlobalSecret" | "Variable" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Datasource" | "Secret" | "GlobalSecret" | "Variable" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
191
+ scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
192
192
  }>, "many">;
193
193
  }, "strip", z.ZodTypeAny, {
194
194
  permissions: {
195
195
  actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
196
- scopes: ["*" | "Datasource" | "Secret" | "GlobalSecret" | "Variable" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Datasource" | "Secret" | "GlobalSecret" | "Variable" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
196
+ scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
197
197
  }[];
198
198
  }, {
199
199
  permissions: {
200
200
  actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
201
- scopes: ["*" | "Datasource" | "Secret" | "GlobalSecret" | "Variable" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Datasource" | "Secret" | "GlobalSecret" | "Variable" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
201
+ scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
202
202
  }[];
203
203
  }>;
204
204
  }, "strip", z.ZodTypeAny, {
205
- metadata: {
206
- name: string;
207
- };
208
205
  kind: "GlobalRole";
209
206
  spec: {
210
207
  permissions: {
211
208
  actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
212
- scopes: ["*" | "Datasource" | "Secret" | "GlobalSecret" | "Variable" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Datasource" | "Secret" | "GlobalSecret" | "Variable" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
209
+ scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
213
210
  }[];
214
211
  };
215
- }, {
216
212
  metadata: {
217
213
  name: string;
218
214
  };
215
+ }, {
219
216
  kind: "GlobalRole";
220
217
  spec: {
221
218
  permissions: {
222
219
  actions: ["create" | "read" | "update" | "delete" | "*", ...("create" | "read" | "update" | "delete" | "*")[]];
223
- scopes: ["*" | "Datasource" | "Secret" | "GlobalSecret" | "Variable" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Datasource" | "Secret" | "GlobalSecret" | "Variable" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
220
+ scopes: ["*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User", ...("*" | "Variable" | "Datasource" | "Secret" | "GlobalSecret" | "Project" | "Dashboard" | "Folder" | "GlobalDatasource" | "GlobalRole" | "GlobalRoleBinding" | "GlobalVariable" | "Role" | "RoleBinding" | "User")[]];
224
221
  }[];
225
222
  };
223
+ metadata: {
224
+ name: string;
225
+ };
226
226
  }>]>;
227
- export declare type RolesEditorValidationType = z.infer<typeof rolesEditorValidationSchema>;
227
+ export type RolesEditorValidationType = z.infer<typeof rolesEditorValidationSchema>;
228
228
  //# sourceMappingURL=role.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"role.d.ts","sourceRoot":"","sources":["../../src/validation/role.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA6BxB,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAS/B,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQrC,CAAC;AAEH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAGtC,CAAC;AAEH,oBAAY,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC"}
1
+ {"version":3,"file":"role.d.ts","sourceRoot":"","sources":["../../src/validation/role.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA6BxB,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"}
@@ -1 +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 '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,OAAO;IAC1C,sCAAsC;IACtCC,SAASJ,EAAEK,MAAML,EAAEM,KAAK;QAAC;QAAK;QAAU;QAAQ;QAAU;KAAS,GAAGC,SAAS;IAC/EC,QAAQR,EACLK,MACCL,EAAEM,KAAK;QACL;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;KACD,GAEFC,SAAS;AACd;AAEA,OAAO,MAAME,uBAAuBT,EAAEG,OAAO;IAC3CO,MAAMV,EAAEW,QAAQ;IAChBC,UAAUZ,EAAEG,OAAO;QACjBU,MAAMZ;QACNa,SAASb;IACX;IACAc,MAAMf,EAAEG,OAAO;QACba,aAAahB,EAAEK,MAAMH;IACvB;AACF,GAAG;AAEH,OAAO,MAAMe,6BAA6BjB,EAAEG,OAAO;IACjDO,MAAMV,EAAEW,QAAQ;IAChBC,UAAUZ,EAAEG,OAAO;QACjBU,MAAMZ;IACR;IACAc,MAAMf,EAAEG,OAAO;QACba,aAAahB,EAAEK,MAAMH;IACvB;AACF,GAAG;AAEH,OAAO,MAAMgB,8BAA8BlB,EAAEmB,mBAAmB,QAAQ;IACtEV;IACAQ;CACD,EAAE"}
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 '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;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"}
@@ -43,10 +43,6 @@ export declare const roleBindingsEditorValidationSchema: z.ZodDiscriminatedUnion
43
43
  }[]];
44
44
  }>;
45
45
  }, "strip", z.ZodTypeAny, {
46
- metadata: {
47
- name: string;
48
- project: string;
49
- };
50
46
  kind: "RoleBinding";
51
47
  spec: {
52
48
  role: string;
@@ -58,11 +54,11 @@ export declare const roleBindingsEditorValidationSchema: z.ZodDiscriminatedUnion
58
54
  kind: "User";
59
55
  }[]];
60
56
  };
61
- }, {
62
57
  metadata: {
63
58
  name: string;
64
59
  project: string;
65
60
  };
61
+ }, {
66
62
  kind: "RoleBinding";
67
63
  spec: {
68
64
  role: string;
@@ -74,6 +70,10 @@ export declare const roleBindingsEditorValidationSchema: z.ZodDiscriminatedUnion
74
70
  kind: "User";
75
71
  }[]];
76
72
  };
73
+ metadata: {
74
+ name: string;
75
+ project: string;
76
+ };
77
77
  }>, z.ZodObject<{
78
78
  kind: z.ZodLiteral<"GlobalRoleBinding">;
79
79
  metadata: z.ZodObject<{
@@ -109,9 +109,6 @@ export declare const roleBindingsEditorValidationSchema: z.ZodDiscriminatedUnion
109
109
  }[];
110
110
  }>;
111
111
  }, "strip", z.ZodTypeAny, {
112
- metadata: {
113
- name: string;
114
- };
115
112
  kind: "GlobalRoleBinding";
116
113
  spec: {
117
114
  role: string;
@@ -120,10 +117,10 @@ export declare const roleBindingsEditorValidationSchema: z.ZodDiscriminatedUnion
120
117
  kind: "User";
121
118
  }[];
122
119
  };
123
- }, {
124
120
  metadata: {
125
121
  name: string;
126
122
  };
123
+ }, {
127
124
  kind: "GlobalRoleBinding";
128
125
  spec: {
129
126
  role: string;
@@ -132,6 +129,9 @@ export declare const roleBindingsEditorValidationSchema: z.ZodDiscriminatedUnion
132
129
  kind: "User";
133
130
  }[];
134
131
  };
132
+ metadata: {
133
+ name: string;
134
+ };
135
135
  }>]>;
136
- export declare type RoleBindingsEditorValidationType = z.infer<typeof roleBindingsEditorValidationSchema>;
136
+ export type RoleBindingsEditorValidationType = z.infer<typeof roleBindingsEditorValidationSchema>;
137
137
  //# sourceMappingURL=rolebinding.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rolebinding.d.ts","sourceRoot":"","sources":["../../src/validation/rolebinding.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA+BxB,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAG7C,CAAC;AAEH,oBAAY,gCAAgC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kCAAkC,CAAC,CAAC"}
1
+ {"version":3,"file":"rolebinding.d.ts","sourceRoot":"","sources":["../../src/validation/rolebinding.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA+BxB,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAG7C,CAAC;AAEH,MAAM,MAAM,gCAAgC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kCAAkC,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/validation/rolebinding.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 subjectValidationSchema = z.object({\n kind: z.enum(['User']),\n name: resourceIdValidationSchema,\n});\n\nconst roleBindingValidationSchema = z.object({\n kind: z.literal('RoleBinding'),\n metadata: z.object({\n name: resourceIdValidationSchema,\n project: resourceIdValidationSchema,\n }),\n spec: z.object({\n role: resourceIdValidationSchema,\n subjects: z.array(subjectValidationSchema).nonempty(),\n }),\n});\n\nconst globalRoleBindingValidationSchema = z.object({\n kind: z.literal('GlobalRoleBinding'),\n metadata: z.object({\n name: resourceIdValidationSchema,\n }),\n spec: z.object({\n role: resourceIdValidationSchema,\n subjects: z.array(subjectValidationSchema),\n }),\n});\n\nexport const roleBindingsEditorValidationSchema = z.discriminatedUnion('kind', [\n roleBindingValidationSchema,\n globalRoleBindingValidationSchema,\n]);\n\nexport type RoleBindingsEditorValidationType = z.infer<typeof roleBindingsEditorValidationSchema>;\n"],"names":["z","resourceIdValidationSchema","subjectValidationSchema","object","kind","enum","name","roleBindingValidationSchema","literal","metadata","project","spec","role","subjects","array","nonempty","globalRoleBindingValidationSchema","roleBindingsEditorValidationSchema","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,0BAA0BF,EAAEG,OAAO;IACvCC,MAAMJ,EAAEK,KAAK;QAAC;KAAO;IACrBC,MAAML;AACR;AAEA,MAAMM,8BAA8BP,EAAEG,OAAO;IAC3CC,MAAMJ,EAAEQ,QAAQ;IAChBC,UAAUT,EAAEG,OAAO;QACjBG,MAAML;QACNS,SAAST;IACX;IACAU,MAAMX,EAAEG,OAAO;QACbS,MAAMX;QACNY,UAAUb,EAAEc,MAAMZ,yBAAyBa;IAC7C;AACF;AAEA,MAAMC,oCAAoChB,EAAEG,OAAO;IACjDC,MAAMJ,EAAEQ,QAAQ;IAChBC,UAAUT,EAAEG,OAAO;QACjBG,MAAML;IACR;IACAU,MAAMX,EAAEG,OAAO;QACbS,MAAMX;QACNY,UAAUb,EAAEc,MAAMZ;IACpB;AACF;AAEA,OAAO,MAAMe,qCAAqCjB,EAAEkB,mBAAmB,QAAQ;IAC7EX;IACAS;CACD,EAAE"}
1
+ {"version":3,"sources":["../../src/validation/rolebinding.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 subjectValidationSchema = z.object({\n kind: z.enum(['User']),\n name: resourceIdValidationSchema,\n});\n\nconst roleBindingValidationSchema = z.object({\n kind: z.literal('RoleBinding'),\n metadata: z.object({\n name: resourceIdValidationSchema,\n project: resourceIdValidationSchema,\n }),\n spec: z.object({\n role: resourceIdValidationSchema,\n subjects: z.array(subjectValidationSchema).nonempty(),\n }),\n});\n\nconst globalRoleBindingValidationSchema = z.object({\n kind: z.literal('GlobalRoleBinding'),\n metadata: z.object({\n name: resourceIdValidationSchema,\n }),\n spec: z.object({\n role: resourceIdValidationSchema,\n subjects: z.array(subjectValidationSchema),\n }),\n});\n\nexport const roleBindingsEditorValidationSchema = z.discriminatedUnion('kind', [\n roleBindingValidationSchema,\n globalRoleBindingValidationSchema,\n]);\n\nexport type RoleBindingsEditorValidationType = z.infer<typeof roleBindingsEditorValidationSchema>;\n"],"names":["z","resourceIdValidationSchema","subjectValidationSchema","object","kind","enum","name","roleBindingValidationSchema","literal","metadata","project","spec","role","subjects","array","nonempty","globalRoleBindingValidationSchema","roleBindingsEditorValidationSchema","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,0BAA0BF,EAAEG,MAAM,CAAC;IACvCC,MAAMJ,EAAEK,IAAI,CAAC;QAAC;KAAO;IACrBC,MAAML;AACR;AAEA,MAAMM,8BAA8BP,EAAEG,MAAM,CAAC;IAC3CC,MAAMJ,EAAEQ,OAAO,CAAC;IAChBC,UAAUT,EAAEG,MAAM,CAAC;QACjBG,MAAML;QACNS,SAAST;IACX;IACAU,MAAMX,EAAEG,MAAM,CAAC;QACbS,MAAMX;QACNY,UAAUb,EAAEc,KAAK,CAACZ,yBAAyBa,QAAQ;IACrD;AACF;AAEA,MAAMC,oCAAoChB,EAAEG,MAAM,CAAC;IACjDC,MAAMJ,EAAEQ,OAAO,CAAC;IAChBC,UAAUT,EAAEG,MAAM,CAAC;QACjBG,MAAML;IACR;IACAU,MAAMX,EAAEG,MAAM,CAAC;QACbS,MAAMX;QACNY,UAAUb,EAAEc,KAAK,CAACZ;IACpB;AACF;AAEA,OAAO,MAAMe,qCAAqCjB,EAAEkB,kBAAkB,CAAC,QAAQ;IAC7EX;IACAS;CACD,EAAE"}