@perses-dev/plugin-system 0.38.0 → 0.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/CalculationSelector/CalculationSelector.js +6 -4
- package/dist/cjs/components/CalculationSelector/index.js +10 -8
- package/dist/cjs/components/DatasourceEditorForm/DatasourceEditorForm.js +380 -0
- package/dist/cjs/components/DatasourceEditorForm/index.js +30 -0
- package/dist/cjs/components/DatasourceSelect.js +119 -21
- package/dist/cjs/components/LegendOptionsEditor/LegendOptionsEditor.js +18 -16
- package/dist/cjs/components/LegendOptionsEditor/index.js +10 -8
- package/dist/cjs/components/OptionsEditorRadios/OptionsEditorRadios.js +69 -0
- package/dist/cjs/components/OptionsEditorRadios/index.js +30 -0
- package/dist/cjs/components/{OptionsEditorTabs/TabPanel.js → OptionsEditorTabPanel/OptionsEditorTabPanel.js} +8 -6
- package/dist/cjs/components/OptionsEditorTabPanel/index.js +30 -0
- package/dist/cjs/components/OptionsEditorTabs/OptionsEditorTabs.js +10 -8
- package/dist/cjs/components/OptionsEditorTabs/index.js +10 -8
- package/dist/cjs/components/PanelSpecEditor/PanelSpecEditor.js +13 -11
- package/dist/cjs/components/PanelSpecEditor/index.js +10 -8
- package/dist/cjs/components/PluginEditor/PluginEditor.js +24 -31
- package/dist/cjs/components/PluginEditor/index.js +11 -9
- package/dist/cjs/components/PluginEditor/plugin-editor-api.js +5 -3
- package/dist/cjs/components/PluginKindSelect/PluginKindSelect.js +23 -12
- package/dist/cjs/components/PluginKindSelect/index.js +10 -8
- package/dist/cjs/components/PluginRegistry/PluginRegistry.js +11 -9
- package/dist/cjs/components/PluginRegistry/index.js +10 -8
- package/dist/cjs/components/PluginRegistry/plugin-indexes.js +6 -2
- package/dist/cjs/components/PluginSpecEditor/PluginSpecEditor.js +6 -4
- package/dist/cjs/components/PluginSpecEditor/index.js +10 -8
- package/dist/cjs/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.js +15 -13
- package/dist/cjs/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.js +21 -19
- package/dist/cjs/components/TimeSeriesQueryEditor/index.js +10 -8
- package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +256 -166
- package/dist/cjs/components/Variables/VariableEditorForm/VariablePreview.js +32 -28
- package/dist/cjs/components/Variables/VariableEditorForm/index.js +11 -9
- package/dist/cjs/components/Variables/VariableEditorForm/variable-editor-form-model.js +28 -32
- package/dist/cjs/components/Variables/index.js +11 -9
- package/dist/cjs/components/Variables/variable-model.js +17 -9
- package/dist/cjs/components/index.js +22 -18
- package/dist/cjs/constants/index.js +10 -8
- package/dist/cjs/constants/user-interface-text.js +3 -1
- package/dist/cjs/index.js +16 -13
- package/dist/cjs/model/index.js +17 -15
- package/dist/cjs/model/legend.js +32 -20
- package/dist/cjs/model/panels.js +2 -2
- package/dist/cjs/model/plugin-base.js +2 -2
- package/dist/cjs/model/plugin-loading.js +3 -1
- package/dist/cjs/runtime/DataQueriesProvider/DataQueriesProvider.js +55 -35
- package/dist/cjs/runtime/DataQueriesProvider/index.js +11 -9
- package/dist/cjs/runtime/DataQueriesProvider/model.js +61 -0
- package/dist/cjs/runtime/TimeRangeProvider/TimeRangeProvider.js +19 -11
- package/dist/cjs/runtime/TimeRangeProvider/index.js +11 -9
- package/dist/cjs/runtime/TimeRangeProvider/query-params.js +36 -18
- package/dist/cjs/runtime/builtin-variables.js +81 -0
- package/dist/cjs/runtime/datasources.js +29 -11
- package/dist/cjs/runtime/index.js +16 -13
- package/dist/cjs/runtime/plugin-registry.js +41 -11
- package/dist/cjs/runtime/template-variables.js +96 -4
- package/dist/cjs/runtime/time-series-queries.js +39 -27
- package/dist/cjs/stories/shared-utils/decorators/WithDataQueries.js +7 -5
- package/dist/cjs/stories/shared-utils/decorators/WithPluginRegistry.js +16 -14
- package/dist/cjs/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.js +42 -0
- package/dist/cjs/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js +19 -13
- package/dist/cjs/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.js +6 -4
- package/dist/cjs/stories/shared-utils/decorators/WithTimeRange.js +7 -5
- package/dist/cjs/stories/shared-utils/decorators/index.js +15 -12
- package/dist/cjs/stories/shared-utils/index.js +10 -8
- package/dist/cjs/test/index.js +11 -8
- package/dist/cjs/test/mock-data.js +57 -0
- package/dist/cjs/test/render.js +13 -11
- package/dist/cjs/test/test-plugins/bert/index.js +14 -10
- package/dist/cjs/test/test-plugins/ernie/index.js +13 -9
- package/dist/cjs/test/test-plugins/index.js +11 -9
- package/dist/cjs/test-utils/index.js +10 -8
- package/dist/cjs/test-utils/mock-plugin-registry.js +8 -4
- package/dist/cjs/utils/action.js +43 -0
- package/dist/cjs/utils/index.js +11 -8
- package/dist/cjs/utils/variables.js +26 -8
- package/dist/cjs/validation/datasource.js +30 -0
- package/dist/cjs/validation/index.js +32 -0
- package/dist/cjs/validation/resource.js +24 -0
- package/dist/cjs/validation/variable.js +29 -0
- package/dist/components/CalculationSelector/CalculationSelector.js.map +1 -1
- package/dist/components/CalculationSelector/index.js.map +1 -1
- package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts +15 -0
- package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts.map +1 -0
- package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js +333 -0
- package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js.map +1 -0
- package/dist/components/DatasourceEditorForm/index.d.ts +2 -0
- package/dist/components/DatasourceEditorForm/index.d.ts.map +1 -0
- package/dist/components/DatasourceEditorForm/index.js +15 -0
- package/dist/components/DatasourceEditorForm/index.js.map +1 -0
- package/dist/components/DatasourceSelect.d.ts +5 -0
- package/dist/components/DatasourceSelect.d.ts.map +1 -1
- package/dist/components/DatasourceSelect.js +102 -19
- package/dist/components/DatasourceSelect.js.map +1 -1
- package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js +2 -2
- package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js.map +1 -1
- package/dist/components/LegendOptionsEditor/index.js.map +1 -1
- package/dist/components/OptionsEditorRadios/OptionsEditorRadios.d.ts +16 -0
- package/dist/components/OptionsEditorRadios/OptionsEditorRadios.d.ts.map +1 -0
- package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js +61 -0
- package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js.map +1 -0
- package/dist/components/OptionsEditorRadios/index.d.ts +2 -0
- package/dist/components/OptionsEditorRadios/index.d.ts.map +1 -0
- package/dist/components/OptionsEditorRadios/index.js +15 -0
- package/dist/components/OptionsEditorRadios/index.js.map +1 -0
- package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.d.ts +9 -0
- package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.d.ts.map +1 -0
- package/dist/components/{OptionsEditorTabs/TabPanel.js → OptionsEditorTabPanel/OptionsEditorTabPanel.js} +2 -2
- package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js.map +1 -0
- package/dist/components/OptionsEditorTabPanel/index.d.ts +2 -0
- package/dist/components/OptionsEditorTabPanel/index.d.ts.map +1 -0
- package/dist/components/OptionsEditorTabPanel/index.js +15 -0
- package/dist/components/OptionsEditorTabPanel/index.js.map +1 -0
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js +2 -2
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js.map +1 -1
- package/dist/components/OptionsEditorTabs/index.js.map +1 -1
- package/dist/components/PanelSpecEditor/PanelSpecEditor.js +2 -2
- package/dist/components/PanelSpecEditor/PanelSpecEditor.js.map +1 -1
- package/dist/components/PanelSpecEditor/index.js.map +1 -1
- package/dist/components/PluginEditor/PluginEditor.js +15 -24
- package/dist/components/PluginEditor/PluginEditor.js.map +1 -1
- package/dist/components/PluginEditor/index.js.map +1 -1
- package/dist/components/PluginEditor/plugin-editor-api.d.ts +1 -1
- package/dist/components/PluginEditor/plugin-editor-api.js +2 -2
- package/dist/components/PluginEditor/plugin-editor-api.js.map +1 -1
- package/dist/components/PluginKindSelect/PluginKindSelect.d.ts +3 -3
- package/dist/components/PluginKindSelect/PluginKindSelect.d.ts.map +1 -1
- package/dist/components/PluginKindSelect/PluginKindSelect.js +21 -12
- package/dist/components/PluginKindSelect/PluginKindSelect.js.map +1 -1
- package/dist/components/PluginKindSelect/index.js.map +1 -1
- package/dist/components/PluginRegistry/PluginRegistry.js +3 -3
- package/dist/components/PluginRegistry/PluginRegistry.js.map +1 -1
- package/dist/components/PluginRegistry/index.js.map +1 -1
- package/dist/components/PluginRegistry/plugin-indexes.js.map +1 -1
- package/dist/components/PluginSpecEditor/PluginSpecEditor.js.map +1 -1
- package/dist/components/PluginSpecEditor/index.js.map +1 -1
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.js +4 -4
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.js.map +1 -1
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.js +1 -1
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.js.map +1 -1
- package/dist/components/TimeSeriesQueryEditor/index.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts +10 -7
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +200 -112
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariablePreview.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/index.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts +5 -4
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js +22 -30
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js.map +1 -1
- package/dist/components/Variables/index.js.map +1 -1
- package/dist/components/Variables/variable-model.js +3 -3
- package/dist/components/Variables/variable-model.js.map +1 -1
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +2 -0
- package/dist/components/index.js.map +1 -1
- package/dist/constants/index.js.map +1 -1
- package/dist/constants/user-interface-text.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/model/datasource.d.ts +2 -1
- package/dist/model/datasource.d.ts.map +1 -1
- package/dist/model/datasource.js.map +1 -1
- package/dist/model/index.js.map +1 -1
- package/dist/model/legend.d.ts +1 -1
- package/dist/model/legend.d.ts.map +1 -1
- package/dist/model/legend.js +14 -14
- package/dist/model/legend.js.map +1 -1
- package/dist/model/panels.js.map +1 -1
- package/dist/model/plugin-base.js.map +1 -1
- package/dist/model/plugin-loading.js.map +1 -1
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.d.ts +5 -5
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.d.ts.map +1 -1
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js +40 -28
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js.map +1 -1
- package/dist/runtime/DataQueriesProvider/index.js.map +1 -1
- package/dist/runtime/DataQueriesProvider/model.d.ts +17 -12
- package/dist/runtime/DataQueriesProvider/model.d.ts.map +1 -1
- package/dist/runtime/DataQueriesProvider/model.js +47 -1
- package/dist/runtime/DataQueriesProvider/model.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/index.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/query-params.js +1 -1
- package/dist/runtime/TimeRangeProvider/query-params.js.map +1 -1
- package/dist/runtime/builtin-variables.d.ts +11 -0
- package/dist/runtime/builtin-variables.d.ts.map +1 -0
- package/dist/runtime/builtin-variables.js +59 -0
- package/dist/runtime/builtin-variables.js.map +1 -0
- package/dist/runtime/datasources.d.ts +14 -6
- package/dist/runtime/datasources.d.ts.map +1 -1
- package/dist/runtime/datasources.js +13 -6
- package/dist/runtime/datasources.js.map +1 -1
- package/dist/runtime/index.d.ts +1 -0
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +1 -0
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/plugin-registry.d.ts +2 -0
- package/dist/runtime/plugin-registry.d.ts.map +1 -1
- package/dist/runtime/plugin-registry.js +19 -2
- package/dist/runtime/plugin-registry.js.map +1 -1
- package/dist/runtime/template-variables.d.ts +62 -2
- package/dist/runtime/template-variables.d.ts.map +1 -1
- package/dist/runtime/template-variables.js +83 -1
- package/dist/runtime/template-variables.js.map +1 -1
- package/dist/runtime/time-series-queries.d.ts +3 -3
- package/dist/runtime/time-series-queries.d.ts.map +1 -1
- package/dist/runtime/time-series-queries.js +14 -12
- package/dist/runtime/time-series-queries.js.map +1 -1
- package/dist/stories/shared-utils/decorators/WithDataQueries.js.map +1 -1
- package/dist/stories/shared-utils/decorators/WithPluginRegistry.js.map +1 -1
- package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.d.ts +13 -0
- package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.d.ts.map +1 -0
- package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.js +39 -0
- package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.js.map +1 -0
- package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.d.ts.map +1 -1
- package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js +11 -7
- package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js.map +1 -1
- package/dist/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.js.map +1 -1
- package/dist/stories/shared-utils/decorators/WithTimeRange.js.map +1 -1
- package/dist/stories/shared-utils/decorators/index.d.ts +1 -0
- package/dist/stories/shared-utils/decorators/index.d.ts.map +1 -1
- package/dist/stories/shared-utils/decorators/index.js +1 -0
- package/dist/stories/shared-utils/decorators/index.js.map +1 -1
- package/dist/stories/shared-utils/index.js.map +1 -1
- package/dist/test/index.d.ts +1 -0
- package/dist/test/index.d.ts.map +1 -1
- package/dist/test/index.js +1 -0
- package/dist/test/index.js.map +1 -1
- package/dist/test/mock-data.d.ts +3 -0
- package/dist/test/mock-data.d.ts.map +1 -0
- package/dist/test/mock-data.js +49 -0
- package/dist/test/mock-data.js.map +1 -0
- package/dist/test/render.js +2 -2
- package/dist/test/render.js.map +1 -1
- package/dist/test/setup-tests.js.map +1 -1
- package/dist/test/test-plugins/bert/index.js.map +1 -1
- package/dist/test/test-plugins/ernie/index.js.map +1 -1
- package/dist/test/test-plugins/index.js.map +1 -1
- package/dist/test-utils/index.js.map +1 -1
- package/dist/test-utils/mock-plugin-registry.js +2 -2
- package/dist/test-utils/mock-plugin-registry.js.map +1 -1
- package/dist/utils/action.d.ts +4 -0
- package/dist/utils/action.d.ts.map +1 -0
- package/dist/utils/action.js +27 -0
- package/dist/utils/action.js.map +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/variables.d.ts.map +1 -1
- package/dist/utils/variables.js +17 -5
- package/dist/utils/variables.js.map +1 -1
- package/dist/validation/datasource.d.ts +19 -0
- package/dist/validation/datasource.d.ts.map +1 -0
- package/dist/validation/datasource.js +22 -0
- package/dist/validation/datasource.js.map +1 -0
- package/dist/validation/index.d.ts +4 -0
- package/dist/validation/index.d.ts.map +1 -0
- package/dist/validation/index.js +17 -0
- package/dist/validation/index.js.map +1 -0
- package/dist/validation/resource.d.ts +3 -0
- package/dist/validation/resource.d.ts.map +1 -0
- package/dist/validation/resource.js +16 -0
- package/dist/validation/resource.js.map +1 -0
- package/dist/validation/variable.d.ts +19 -0
- package/dist/validation/variable.d.ts.map +1 -0
- package/dist/validation/variable.js +21 -0
- package/dist/validation/variable.js.map +1 -0
- package/package.json +8 -6
- package/dist/components/OptionsEditorTabs/TabPanel.d.ts +0 -9
- package/dist/components/OptionsEditorTabs/TabPanel.d.ts.map +0 -1
- package/dist/components/OptionsEditorTabs/TabPanel.js.map +0 -1
|
@@ -0,0 +1,27 @@
|
|
|
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 function getTitleAction(action, isDraft) {
|
|
14
|
+
if (action === 'read') return 'View';
|
|
15
|
+
if (isDraft && action === 'create') return 'Add';
|
|
16
|
+
if (!isDraft && action === 'create') return 'Create';
|
|
17
|
+
if (action === 'update') return 'Edit';
|
|
18
|
+
return '';
|
|
19
|
+
}
|
|
20
|
+
export function getSubmitText(action, isDraft) {
|
|
21
|
+
if (isDraft && action === 'create') return 'Add';
|
|
22
|
+
if (isDraft && action === 'update') return 'Apply';
|
|
23
|
+
if (!isDraft) return 'Save';
|
|
24
|
+
return '';
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/action.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 type Action = 'create' | 'read' | 'update';\n\nexport function getTitleAction(action: Action, isDraft: boolean): string {\n if (action === 'read') return 'View';\n if (isDraft && action === 'create') return 'Add';\n if (!isDraft && action === 'create') return 'Create';\n if (action === 'update') return 'Edit';\n return '';\n}\n\nexport function getSubmitText(action: Action, isDraft: boolean): string {\n if (isDraft && action === 'create') return 'Add';\n if (isDraft && action === 'update') return 'Apply';\n if (!isDraft) return 'Save';\n return '';\n}\n"],"names":["getTitleAction","action","isDraft","getSubmitText"],"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;AAIjC,OAAO,SAASA,eAAeC,MAAc,EAAEC,OAAgB;IAC7D,IAAID,WAAW,QAAQ,OAAO;IAC9B,IAAIC,WAAWD,WAAW,UAAU,OAAO;IAC3C,IAAI,CAACC,WAAWD,WAAW,UAAU,OAAO;IAC5C,IAAIA,WAAW,UAAU,OAAO;IAChC,OAAO;AACT;AAEA,OAAO,SAASE,cAAcF,MAAc,EAAEC,OAAgB;IAC5D,IAAIA,WAAWD,WAAW,UAAU,OAAO;IAC3C,IAAIC,WAAWD,WAAW,UAAU,OAAO;IAC3C,IAAI,CAACC,SAAS,OAAO;IACrB,OAAO;AACT"}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAaA,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAaA,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC"}
|
package/dist/utils/index.js
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
|
+
export * from './action';
|
|
13
14
|
export * from './variables';
|
|
14
15
|
|
|
15
16
|
//# sourceMappingURL=index.js.map
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/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 './variables';\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,
|
|
1
|
+
{"version":3,"sources":["../../src/utils/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 './action';\nexport * from './variables';\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,WAAW;AACzB,cAAc,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"variables.d.ts","sourceRoot":"","sources":["../../src/utils/variables.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE7D,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,gBAAgB,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"variables.d.ts","sourceRoot":"","sources":["../../src/utils/variables.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE7D,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,gBAAgB,GAAG,MAAM,CAgB9F;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,qBAAqB,EAAE,aAAa,UAc1G;AAWD;;GAEG;AACH,eAAO,MAAM,sBAAsB,SAAU,MAAM,aAkBlD,CAAC"}
|
package/dist/utils/variables.js
CHANGED
|
@@ -13,7 +13,10 @@
|
|
|
13
13
|
export function replaceTemplateVariables(text, variableState) {
|
|
14
14
|
const variables = parseTemplateVariables(text);
|
|
15
15
|
let finalText = text;
|
|
16
|
-
variables.
|
|
16
|
+
variables// Sorting variables by their length.
|
|
17
|
+
// In order to not have a variable name have contained in another variable name.
|
|
18
|
+
// i.e.: $__range replacing $__range_ms => '3600_ms' instead of '3600000'
|
|
19
|
+
.sort((a, b)=>b.length - a.length).forEach((v)=>{
|
|
17
20
|
const variable = variableState[v];
|
|
18
21
|
if (variable && (variable === null || variable === void 0 ? void 0 : variable.value)) {
|
|
19
22
|
finalText = replaceTemplateVariable(finalText, v, variable === null || variable === void 0 ? void 0 : variable.value);
|
|
@@ -23,6 +26,7 @@ export function replaceTemplateVariables(text, variableState) {
|
|
|
23
26
|
}
|
|
24
27
|
export function replaceTemplateVariable(text, varName, templateVariableValue) {
|
|
25
28
|
const variableTemplate = '$' + varName;
|
|
29
|
+
const bracketsVariableTemplate = '${' + varName + '}';
|
|
26
30
|
let replaceString = '';
|
|
27
31
|
if (Array.isArray(templateVariableValue)) {
|
|
28
32
|
replaceString = `(${templateVariableValue.join('|')})`; // regex style
|
|
@@ -30,12 +34,14 @@ export function replaceTemplateVariable(text, varName, templateVariableValue) {
|
|
|
30
34
|
if (typeof templateVariableValue === 'string') {
|
|
31
35
|
replaceString = templateVariableValue;
|
|
32
36
|
}
|
|
33
|
-
|
|
37
|
+
text = text.replaceAll(variableTemplate, replaceString);
|
|
38
|
+
return text.replaceAll(bracketsVariableTemplate, replaceString);
|
|
34
39
|
}
|
|
35
40
|
// This regular expression is designed to identify variable references in a template string.
|
|
36
41
|
// It supports two formats for referencing variables:
|
|
37
42
|
// 1. $variableName - This is a simpler format, and the regular expression captures the variable name (\w+ matches one or more word characters).
|
|
38
|
-
// 2.
|
|
43
|
+
// 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.
|
|
44
|
+
// 3. [COMING SOON] ${variableName:value} - This is a more complex format that allows specifying a format function as well.
|
|
39
45
|
// TODO: Fix this lint error
|
|
40
46
|
// eslint-disable-next-line no-useless-escape
|
|
41
47
|
const TEMPLATE_VARIABLE_REGEX = /\$(\w+)|\${(\w+)(?:\.([^:^\}]+))?(?::([^\}]+))?}/gm;
|
|
@@ -46,8 +52,14 @@ const TEMPLATE_VARIABLE_REGEX = /\$(\w+)|\${(\w+)(?:\.([^:^\}]+))?(?::([^\}]+))?
|
|
|
46
52
|
const matches = new Set();
|
|
47
53
|
let match;
|
|
48
54
|
while((match = regex.exec(text)) !== null){
|
|
49
|
-
if (match
|
|
50
|
-
|
|
55
|
+
if (match) {
|
|
56
|
+
if (match[1]) {
|
|
57
|
+
// \$(\w+)\
|
|
58
|
+
matches.add(match[1]);
|
|
59
|
+
} else if (match[2]) {
|
|
60
|
+
// \${(\w+)}\
|
|
61
|
+
matches.add(match[2]);
|
|
62
|
+
}
|
|
51
63
|
}
|
|
52
64
|
}
|
|
53
65
|
// return unique matches
|
|
@@ -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
|
|
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"}
|
|
@@ -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 declare 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,oBAAY,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,OAAO;IACrDC,MAAMH;IACNI,OAAOL,EAAEM,SAASC;IAClBC,aAAaR,EAAEM,SAASC;IACxBE,SAAST,EAAEU;AACb,GAAG"}
|
|
@@ -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"}
|
|
@@ -0,0 +1,17 @@
|
|
|
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 './resource';
|
|
15
|
+
export * from './variable';
|
|
16
|
+
|
|
17
|
+
//# 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 './resource';\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"}
|
|
@@ -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().nonempty('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 .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"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const variableEditValidationSchema: z.ZodObject<{
|
|
3
|
+
name: z.ZodEffects<z.ZodString, string, string>;
|
|
4
|
+
title: z.ZodOptional<z.ZodString>;
|
|
5
|
+
description: z.ZodOptional<z.ZodString>;
|
|
6
|
+
kind: z.ZodString;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
name: string;
|
|
9
|
+
kind: string;
|
|
10
|
+
title?: string | undefined;
|
|
11
|
+
description?: string | undefined;
|
|
12
|
+
}, {
|
|
13
|
+
name: string;
|
|
14
|
+
kind: string;
|
|
15
|
+
title?: string | undefined;
|
|
16
|
+
description?: string | undefined;
|
|
17
|
+
}>;
|
|
18
|
+
export declare type VariableEditValidationType = z.infer<typeof variableEditValidationSchema>;
|
|
19
|
+
//# sourceMappingURL=variable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"variable.d.ts","sourceRoot":"","sources":["../../src/validation/variable.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;EASvC,CAAC;AAEH,oBAAY,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
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 variableEditValidationSchema = z.object({
|
|
15
|
+
name: z.string().nonempty('Required').regex(/^\w+$/, 'Must only contains alphanumerical characters and underscores').refine((val)=>!val.startsWith('__'), '__ prefix is reserved to builtin variables'),
|
|
16
|
+
title: z.string().optional(),
|
|
17
|
+
description: z.string().optional(),
|
|
18
|
+
kind: z.string().nonempty('Required')
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=variable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/validation/variable.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 variableEditValidationSchema = z.object({\n name: z\n .string()\n .nonempty('Required')\n .regex(/^\\w+$/, 'Must only contains alphanumerical characters and underscores')\n .refine((val) => !val.startsWith('__'), '__ prefix is reserved to builtin variables'),\n title: z.string().optional(), // display name\n description: z.string().optional(),\n kind: z.string().nonempty('Required'),\n});\n\nexport type VariableEditValidationType = z.infer<typeof variableEditValidationSchema>;\n"],"names":["z","variableEditValidationSchema","object","name","string","nonempty","regex","refine","val","startsWith","title","optional","description","kind"],"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,+BAA+BD,EAAEE,OAAO;IACnDC,MAAMH,EACHI,SACAC,SAAS,YACTC,MAAM,SAAS,gEACfC,OAAO,CAACC,MAAQ,CAACA,IAAIC,WAAW,OAAO;IAC1CC,OAAOV,EAAEI,SAASO;IAClBC,aAAaZ,EAAEI,SAASO;IACxBE,MAAMb,EAAEI,SAASC,SAAS;AAC5B,GAAG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@perses-dev/plugin-system",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.40.0",
|
|
4
4
|
"description": "The plugin feature in Pereses",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/perses/perses/blob/main/README.md",
|
|
@@ -23,19 +23,21 @@
|
|
|
23
23
|
"build:types": "tsc --project tsconfig.build.json",
|
|
24
24
|
"type-check": "tsc --noEmit",
|
|
25
25
|
"start": "concurrently -P \"npm:build:* -- {*}\" -- --watch",
|
|
26
|
-
"test": "TZ=UTC jest",
|
|
26
|
+
"test": "cross-env TZ=UTC jest",
|
|
27
27
|
"lint": "eslint src --ext .ts,.tsx",
|
|
28
28
|
"lint:fix": "eslint --fix src --ext .ts,.tsx"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@perses-dev/components": "0.
|
|
32
|
-
"@perses-dev/core": "0.
|
|
31
|
+
"@perses-dev/components": "0.40.0",
|
|
32
|
+
"@perses-dev/core": "0.40.0",
|
|
33
33
|
"immer": "^9.0.15",
|
|
34
|
+
"react-hook-form": "^7.46.1",
|
|
34
35
|
"use-immer": "^0.7.0",
|
|
35
|
-
"use-query-params": "^2.1.2"
|
|
36
|
+
"use-query-params": "^2.1.2",
|
|
37
|
+
"zod": "^3.22.2"
|
|
36
38
|
},
|
|
37
39
|
"devDependencies": {
|
|
38
|
-
"@perses-dev/storybook": "0.
|
|
40
|
+
"@perses-dev/storybook": "0.40.0"
|
|
39
41
|
},
|
|
40
42
|
"peerDependencies": {
|
|
41
43
|
"@mui/material": "^5.10.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TabPanel.d.ts","sourceRoot":"","sources":["../../../src/components/OptionsEditorTabs/TabPanel.tsx"],"names":[],"mappings":";AAeA,UAAU,aAAa;IACrB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,eAgB5C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/OptionsEditorTabs/TabPanel.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 { Box } from '@mui/material';\n\ninterface TabPanelProps {\n children: React.ReactNode;\n index: number;\n value: number;\n}\n\nexport function TabPanel(props: TabPanelProps) {\n const { children, value, index, ...other } = props;\n\n const isActive = value === index;\n\n return (\n <div\n role=\"tabpanel\"\n hidden={!isActive}\n id={`options-editor-tabpanel-${index}`}\n aria-labelledby={`options-editor-tab-${index}`}\n {...other}\n >\n {isActive && <Box mt={2}>{children}</Box>}\n </div>\n );\n}\n"],"names":["Box","TabPanel","props","children","value","index","other","isActive","div","role","hidden","id","aria-labelledby","mt"],"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;AAAA,SAASA,GAAG,QAAQ,eAAe,CAAC;AAQpC,OAAO,SAASC,QAAQ,CAACC,KAAoB,EAAE;IAC7C,MAAM,EAAEC,QAAQ,CAAA,EAAEC,KAAK,CAAA,EAAEC,KAAK,CAAA,EAAE,GAAGC,KAAK,EAAE,GAAGJ,KAAK,AAAC;IAEnD,MAAMK,QAAQ,GAAGH,KAAK,KAAKC,KAAK,AAAC;IAEjC,qBACE,KAACG,KAAG;QACFC,IAAI,EAAC,UAAU;QACfC,MAAM,EAAE,CAACH,QAAQ;QACjBI,EAAE,EAAE,CAAC,wBAAwB,EAAEN,KAAK,CAAC,CAAC;QACtCO,iBAAe,EAAE,CAAC,mBAAmB,EAAEP,KAAK,CAAC,CAAC;QAC7C,GAAGC,KAAK;kBAERC,QAAQ,kBAAI,KAACP,GAAG;YAACa,EAAE,EAAE,CAAC;sBAAGV,QAAQ;UAAO;MACrC,CACN;AACJ,CAAC"}
|