@perses-dev/plugin-system 0.55.0-beta.6 → 0.55.0-beta.8

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 (64) hide show
  1. package/dist/components/DatasourceSelect/DatasourceSelect.d.ts.map +1 -1
  2. package/dist/components/DatasourceTestConnectionButton/DatasourceTestConnectionButton.d.ts.map +1 -1
  3. package/dist/components/HTTPSettingsEditor/HTTPHeaderPolicyEditor.d.ts +10 -0
  4. package/dist/components/HTTPSettingsEditor/HTTPHeaderPolicyEditor.d.ts.map +1 -0
  5. package/dist/components/HTTPSettingsEditor/HTTPHeaderPolicyEditor.js +99 -0
  6. package/dist/components/HTTPSettingsEditor/HTTPHeaderPolicyEditor.js.map +1 -0
  7. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.d.ts +1 -0
  8. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.d.ts.map +1 -1
  9. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.js +50 -25
  10. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.js.map +1 -1
  11. package/dist/components/ItemSelectionActionsOptionsEditor/ItemSelectionActionsOptionsEditor.js +4 -4
  12. package/dist/components/ItemSelectionActionsOptionsEditor/ItemSelectionActionsOptionsEditor.js.map +1 -1
  13. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.d.ts.map +1 -1
  14. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.d.ts.map +1 -1
  15. package/dist/components/PluginKindSelect/PluginKindSelect.js +2 -2
  16. package/dist/components/PluginKindSelect/PluginKindSelect.js.map +1 -1
  17. package/dist/components/PluginRegistry/getPluginSearchHelper.d.ts.map +1 -1
  18. package/dist/components/TimeRangeControls/TimeRangeControls.d.ts +2 -2
  19. package/dist/components/TimeRangeControls/TimeRangeControls.d.ts.map +1 -1
  20. package/dist/components/TimeRangeControls/TimeRangeControls.js +7 -43
  21. package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -1
  22. package/dist/components/Variables/VariableEditorForm/VariablePreview.d.ts.map +1 -1
  23. package/dist/components/Variables/VariableEditorForm/VariablePreview.js +1 -0
  24. package/dist/components/Variables/VariableEditorForm/VariablePreview.js.map +1 -1
  25. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js +6 -6
  26. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js.map +1 -1
  27. package/dist/components/Variables/variable-model.d.ts +4 -4
  28. package/dist/components/Variables/variable-model.d.ts.map +1 -1
  29. package/dist/constants/repeat.d.ts +1 -1
  30. package/dist/constants/user-interface-text.d.ts.map +1 -1
  31. package/dist/context/ValidationProvider.d.ts +4 -4
  32. package/dist/context/ValidationProvider.d.ts.map +1 -1
  33. package/dist/context/ValidationProvider.js +1 -1
  34. package/dist/context/ValidationProvider.js.map +1 -1
  35. package/dist/model/calculations.d.ts.map +1 -1
  36. package/dist/model/legend.d.ts +1 -1
  37. package/dist/remote/PluginRuntime.d.ts +9 -0
  38. package/dist/remote/PluginRuntime.d.ts.map +1 -1
  39. package/dist/remote/PluginRuntime.js +81 -68
  40. package/dist/remote/PluginRuntime.js.map +1 -1
  41. package/dist/remote/index.d.ts +1 -0
  42. package/dist/remote/index.d.ts.map +1 -1
  43. package/dist/remote/index.js +1 -0
  44. package/dist/remote/index.js.map +1 -1
  45. package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.d.ts +4 -0
  46. package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.d.ts.map +1 -1
  47. package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js +49 -1
  48. package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js.map +1 -1
  49. package/dist/runtime/TimeRangeProvider/query-params.d.ts.map +1 -1
  50. package/dist/runtime/UsageMetricsProvider.d.ts.map +1 -1
  51. package/dist/runtime/time-series-queries.d.ts.map +1 -1
  52. package/dist/runtime/variables.d.ts.map +1 -1
  53. package/dist/schema/panel.d.ts +2 -2
  54. package/dist/schema/panel.d.ts.map +1 -1
  55. package/dist/schema/panel.js.map +1 -1
  56. package/dist/test/mock-data.d.ts +12 -12
  57. package/dist/test/mock-data.d.ts.map +1 -1
  58. package/dist/test/test-plugins/bert/index.d.ts.map +1 -1
  59. package/dist/test/test-plugins/ernie/index.d.ts.map +1 -1
  60. package/dist/test/utils.d.ts.map +1 -1
  61. package/dist/utils/csv-export.d.ts.map +1 -1
  62. package/dist/utils/csv-export.js +1 -1
  63. package/dist/utils/csv-export.js.map +1 -1
  64. package/package.json +9 -9
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/Variables/VariableEditorForm/VariablePreview.tsx"],"sourcesContent":["// Copyright 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 { Alert, Box, Card, Chip, CircularProgress, IconButton, Stack, Typography } from '@mui/material';\nimport { InfoTooltip, useSnackbar } from '@perses-dev/components';\nimport type { ListVariableDefinition } from '@perses-dev/spec';\nimport Clipboard from 'mdi-material-ui/ClipboardOutline';\nimport type { ReactElement } from 'react';\nimport React, { useMemo, useState } from 'react';\n\nimport { TOOLTIP_TEXT } from '../../../constants';\nimport { useListVariablePluginValues } from '../variable-model';\nimport { SORT_METHODS } from './variable-editor-form-model';\n\nconst DEFAULT_MAX_PREVIEW_VALUES = 50;\n\ninterface VariablePreviewProps {\n values?: string[];\n isLoading?: boolean;\n error?: string;\n}\n\nexport function VariablePreview(props: VariablePreviewProps): ReactElement {\n const { values, isLoading, error } = props;\n const [maxValues, setMaxValues] = useState<number | undefined>(DEFAULT_MAX_PREVIEW_VALUES);\n const { infoSnackbar } = useSnackbar();\n const showAll = (): void => {\n setMaxValues(undefined);\n };\n let notShown = 0;\n\n if (values && values?.length > 0 && maxValues) {\n notShown = values.length - maxValues;\n }\n\n const variablePreviewState = useMemo((): ReactElement | null => {\n if (isLoading) {\n return (\n <Stack width=\"100%\" sx={{ alignItems: 'center', justifyContent: 'center' }}>\n <CircularProgress />\n </Stack>\n );\n } else if (error) {\n return <Alert severity=\"error\">{error}</Alert>;\n } else if (!values?.length) {\n return <Alert severity=\"info\">No results</Alert>;\n }\n return null;\n }, [error, isLoading, values]);\n\n return (\n <Box>\n <Stack direction=\"row\" spacing={1} alignItems=\"center\" mb={1}>\n <Typography variant=\"h4\">Preview Values</Typography>\n <InfoTooltip description={TOOLTIP_TEXT.copyVariableValues}>\n <IconButton\n onClick={async () => {\n if (values?.length) {\n await navigator.clipboard.writeText(values.map((value) => value).join(', '));\n infoSnackbar('Preview values copied to clipboard!');\n }\n }}\n size=\"small\"\n >\n <Clipboard />\n </IconButton>\n </InfoTooltip>\n </Stack>\n <Card variant=\"outlined\">\n <Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 1, m: 2 }}>\n {variablePreviewState}\n {values\n ?.slice(0, maxValues)\n .filter((val) => val)\n .map((val, index) => (\n <Chip size=\"small\" key={index} label={val} />\n ))}\n {notShown > 0 && <Chip onClick={showAll} variant=\"outlined\" size=\"small\" label={`+${notShown} more`} />}\n </Box>\n </Card>\n </Box>\n );\n}\n\ninterface VariableListPreviewProps {\n definition: ListVariableDefinition;\n sortMethod?: keyof typeof SORT_METHODS;\n}\n\nexport function VariableListPreview(props: VariableListPreviewProps): ReactElement {\n const { definition, sortMethod } = props;\n const { data, isFetching, error } = useListVariablePluginValues(definition);\n const errorMessage = (error as Error)?.message;\n\n const result = !sortMethod || sortMethod === 'none' || !data ? data : SORT_METHODS[sortMethod].sort(data);\n\n const variablePreview = useMemo(\n () => (\n <VariablePreview\n values={result?.map((val) => val.label || val.value)}\n isLoading={isFetching}\n error={errorMessage}\n />\n ),\n [errorMessage, isFetching, result],\n );\n\n return variablePreview;\n}\n"],"names":["Alert","Box","Card","Chip","CircularProgress","IconButton","Stack","Typography","InfoTooltip","useSnackbar","Clipboard","React","useMemo","useState","TOOLTIP_TEXT","useListVariablePluginValues","SORT_METHODS","DEFAULT_MAX_PREVIEW_VALUES","VariablePreview","props","values","isLoading","error","maxValues","setMaxValues","infoSnackbar","showAll","undefined","notShown","length","variablePreviewState","width","sx","alignItems","justifyContent","severity","direction","spacing","mb","variant","description","copyVariableValues","onClick","navigator","clipboard","writeText","map","value","join","size","display","flexWrap","gap","m","slice","filter","val","index","label","VariableListPreview","definition","sortMethod","data","isFetching","errorMessage","message","result","sort","variablePreview"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,KAAK,EAAEC,GAAG,EAAEC,IAAI,EAAEC,IAAI,EAAEC,gBAAgB,EAAEC,UAAU,EAAEC,KAAK,EAAEC,UAAU,QAAQ,gBAAgB;AACxG,SAASC,WAAW,EAAEC,WAAW,QAAQ,yBAAyB;AAElE,OAAOC,eAAe,mCAAmC;AAEzD,OAAOC,SAASC,OAAO,EAAEC,QAAQ,QAAQ,QAAQ;AAEjD,SAASC,YAAY,QAAQ,8BAAqB;AAClD,SAASC,2BAA2B,QAAQ,uBAAoB;AAChE,SAASC,YAAY,QAAQ,kCAA+B;AAE5D,MAAMC,6BAA6B;AAQnC,OAAO,SAASC,gBAAgBC,KAA2B;IACzD,MAAM,EAAEC,MAAM,EAAEC,SAAS,EAAEC,KAAK,EAAE,GAAGH;IACrC,MAAM,CAACI,WAAWC,aAAa,GAAGX,SAA6BI;IAC/D,MAAM,EAAEQ,YAAY,EAAE,GAAGhB;IACzB,MAAMiB,UAAU;QACdF,aAAaG;IACf;IACA,IAAIC,WAAW;IA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AQS,OAAO,CAAC,CAAC,EAAE9B,SAAS,KAAK,CAAC;;;;;;;AAK7G;AAOA,OAAO,SAAS+B,oBAAoBxC,KAA+B;IACjE,MAAM,EAAEyC,UAAU,EAAEC,UAAU,EAAE,GAAG1C;IACnC,MAAM,EAAE2C,IAAI,EAAEC,UAAU,EAAEzC,KAAK,EAAE,GAAGP,4BAA4B6C;IAChE,MAAMI,eAAgB1C,OAAiB2C;IAEvC,MAAMC,SAAS,CAACL,cAAcA,eAAe,UAAU,CAACC,OAAOA,OAAO9C,YAAY,CAAC6C,WAAW,CAACM,IAAI,CAACL;IAEpG,MAAMM,kBAAkBxD,QACtB,kBACE,KAACM;YACCE,QAAQ8C,QAAQpB,IAAI,CAACU,MAAQA,IAAIE,KAAK,IAAIF,IAAIT,KAAK;YACnD1B,WAAW0C;YACXzC,OAAO0C;YAGX;QAACA;QAAcD;QAAYG;KAAO;IAGpC,OAAOE;AACT"}
1
+ {"version":3,"sources":["../../../../src/components/Variables/VariableEditorForm/VariablePreview.tsx"],"sourcesContent":["// Copyright 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 { Alert, Box, Card, Chip, CircularProgress, IconButton, Stack, Typography } from '@mui/material';\nimport { InfoTooltip, useSnackbar } from '@perses-dev/components';\nimport type { ListVariableDefinition } from '@perses-dev/spec';\nimport Clipboard from 'mdi-material-ui/ClipboardOutline';\nimport type { ReactElement } from 'react';\nimport React, { useMemo, useState } from 'react';\n\nimport { TOOLTIP_TEXT } from '../../../constants';\nimport { useListVariablePluginValues } from '../variable-model';\nimport { SORT_METHODS } from './variable-editor-form-model';\n\nconst DEFAULT_MAX_PREVIEW_VALUES = 50;\n\ninterface VariablePreviewProps {\n values?: string[];\n isLoading?: boolean;\n error?: string;\n}\n\nexport function VariablePreview(props: VariablePreviewProps): ReactElement {\n const { values, isLoading, error } = props;\n const [maxValues, setMaxValues] = useState<number | undefined>(DEFAULT_MAX_PREVIEW_VALUES);\n const { infoSnackbar } = useSnackbar();\n const showAll = (): void => {\n setMaxValues(undefined);\n };\n let notShown = 0;\n\n if (values && values?.length > 0 && maxValues) {\n notShown = values.length - maxValues;\n }\n\n const variablePreviewState = useMemo((): ReactElement | null => {\n if (isLoading) {\n return (\n <Stack width=\"100%\" sx={{ alignItems: 'center', justifyContent: 'center' }}>\n <CircularProgress />\n </Stack>\n );\n } else if (error) {\n return <Alert severity=\"error\">{error}</Alert>;\n } else if (!values?.length) {\n return <Alert severity=\"info\">No results</Alert>;\n }\n return null;\n }, [error, isLoading, values]);\n\n return (\n <Box>\n <Stack direction=\"row\" spacing={1} alignItems=\"center\" mb={1}>\n <Typography variant=\"h4\">Preview Values</Typography>\n <InfoTooltip description={TOOLTIP_TEXT.copyVariableValues}>\n <IconButton\n onClick={async () => {\n if (values?.length) {\n await navigator.clipboard.writeText(values.map((value) => value).join(', '));\n infoSnackbar('Preview values copied to clipboard!');\n }\n }}\n size=\"small\"\n >\n <Clipboard />\n </IconButton>\n </InfoTooltip>\n </Stack>\n <Card variant=\"outlined\">\n <Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 1, m: 2 }}>\n {variablePreviewState}\n {values\n ?.slice(0, maxValues)\n .filter((val) => val)\n .map((val, index) => (\n <Chip size=\"small\" key={index} label={val} />\n ))}\n {notShown > 0 && <Chip onClick={showAll} variant=\"outlined\" size=\"small\" label={`+${notShown} more`} />}\n </Box>\n </Card>\n </Box>\n );\n}\n\ninterface VariableListPreviewProps {\n definition: ListVariableDefinition;\n sortMethod?: keyof typeof SORT_METHODS;\n}\n\nexport function VariableListPreview(props: VariableListPreviewProps): ReactElement {\n const { definition, sortMethod } = props;\n const { data, isFetching, error } = useListVariablePluginValues(definition);\n const errorMessage = (error as Error)?.message;\n\n // oxlint-disable-next-line unicorn/no-array-sort Calling sort of object, not the built-in array sort function\n const result = !sortMethod || sortMethod === 'none' || !data ? data : SORT_METHODS[sortMethod].sort(data);\n\n const variablePreview = useMemo(\n () => (\n <VariablePreview\n values={result?.map((val) => val.label || val.value)}\n isLoading={isFetching}\n error={errorMessage}\n />\n ),\n [errorMessage, isFetching, result],\n );\n\n return variablePreview;\n}\n"],"names":["Alert","Box","Card","Chip","CircularProgress","IconButton","Stack","Typography","InfoTooltip","useSnackbar","Clipboard","React","useMemo","useState","TOOLTIP_TEXT","useListVariablePluginValues","SORT_METHODS","DEFAULT_MAX_PREVIEW_VALUES","VariablePreview","props","values","isLoading","error","maxValues","setMaxValues","infoSnackbar","showAll","undefined","notShown","length","variablePreviewState","width","sx","alignItems","justifyContent","severity","direction","spacing","mb","variant","description","copyVariableValues","onClick","navigator","clipboard","writeText","map","value","join","size","display","flexWrap","gap","m","slice","filter","val","index","label","VariableListPreview","definition","sortMethod","data","isFetching","errorMessage","message","result","sort","variablePreview"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,KAAK,EAAEC,GAAG,EAAEC,IAAI,EAAEC,IAAI,EAAEC,gBAAgB,EAAEC,UAAU,EAAEC,KAAK,EAAEC,UAAU,QAAQ,gBAAgB;AACxG,SAASC,WAAW,EAAEC,WAAW,QAAQ,yBAAyB;AAElE,OAAOC,eAAe,mCAAmC;AAEzD,OAAOC,SAASC,OAAO,EAAEC,QAAQ,QAAQ,QAAQ;AAEjD,SAASC,YAAY,QAAQ,8BAAqB;AAClD,SAASC,2BAA2B,QAAQ,uBAAoB;AAChE,SAASC,YAAY,QAAQ,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S;wBAAQC,UAAU;wBAAQC,KAAK;wBAAGC,GAAG;oBAAE;;wBACxDvB;wBACAV,QACGkC,MAAM,GAAG/B,WACVgC,OAAO,CAACC,MAAQA,KAChBV,IAAI,CAACU,KAAKC,sBACT,KAACtD;gCAAK8C,MAAK;gCAAoBS,OAAOF;+BAAdC;wBAE3B7B,WAAW,mBAAK,KAACzB;4BAAKuC,SAAShB;4BAASa,SAAQ;4BAAWU,MAAK;4BAAQS,OAAO,CAAC,CAAC,EAAE9B,SAAS,KAAK,CAAC;;;;;;;AAK7G;AAOA,OAAO,SAAS+B,oBAAoBxC,KAA+B;IACjE,MAAM,EAAEyC,UAAU,EAAEC,UAAU,EAAE,GAAG1C;IACnC,MAAM,EAAE2C,IAAI,EAAEC,UAAU,EAAEzC,KAAK,EAAE,GAAGP,4BAA4B6C;IAChE,MAAMI,eAAgB1C,OAAiB2C;IAEvC,8GAA8G;IAC9G,MAAMC,SAAS,CAACL,cAAcA,eAAe,UAAU,CAACC,OAAOA,OAAO9C,YAAY,CAAC6C,WAAW,CAACM,IAAI,CAACL;IAEpG,MAAMM,kBAAkBxD,QACtB,kBACE,KAACM;YACCE,QAAQ8C,QAAQpB,IAAI,CAACU,MAAQA,IAAIE,KAAK,IAAIF,IAAIT,KAAK;YACnD1B,WAAW0C;YACXzC,OAAO0C;YAGX;QAACA;QAAcD;QAAYG;KAAO;IAGpC,OAAOE;AACT"}
@@ -20,37 +20,37 @@ export const SORT_METHODS = {
20
20
  'alphabetical-asc': {
21
21
  label: 'Alphabetical, asc',
22
22
  sort: (input)=>{
23
- return input.slice().sort((a, b)=>a.label > b.label ? 1 : -1);
23
+ return input.slice().toSorted((a, b)=>a.label > b.label ? 1 : -1);
24
24
  }
25
25
  },
26
26
  'alphabetical-desc': {
27
27
  label: 'Alphabetical, desc',
28
28
  sort: (input)=>{
29
- return input.slice().sort((a, b)=>a.label > b.label ? -1 : 1);
29
+ return input.slice().toSorted((a, b)=>a.label > b.label ? -1 : 1);
30
30
  }
31
31
  },
32
32
  'numerical-asc': {
33
33
  label: 'Numerical, asc',
34
34
  sort: (input)=>{
35
- return input.slice().sort((a, b)=>parseInt(a.label) > parseInt(b.label) ? 1 : -1);
35
+ return input.slice().toSorted((a, b)=>parseInt(a.label) > parseInt(b.label) ? 1 : -1);
36
36
  }
37
37
  },
38
38
  'numerical-desc': {
39
39
  label: 'Numerical, desc',
40
40
  sort: (input)=>{
41
- return input.slice().sort((a, b)=>parseInt(a.label) < parseInt(b.label) ? 1 : -1);
41
+ return input.slice().toSorted((a, b)=>parseInt(a.label) < parseInt(b.label) ? 1 : -1);
42
42
  }
43
43
  },
44
44
  'alphabetical-ci-asc': {
45
45
  label: 'Alphabetical, case-insensitive, asc',
46
46
  sort: (input)=>{
47
- return input.slice().sort((a, b)=>a.label.toLowerCase() > b.label.toLowerCase() ? 1 : -1);
47
+ return input.slice().toSorted((a, b)=>a.label.toLowerCase() > b.label.toLowerCase() ? 1 : -1);
48
48
  }
49
49
  },
50
50
  'alphabetical-ci-desc': {
51
51
  label: 'Alphabetical, case-insensitive, desc',
52
52
  sort: (input)=>{
53
- return input.slice().sort((a, b)=>a.label.toLowerCase() > b.label.toLowerCase() ? -1 : 1);
53
+ return input.slice().toSorted((a, b)=>a.label.toLowerCase() > b.label.toLowerCase() ? -1 : 1);
54
54
  }
55
55
  }
56
56
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/Variables/VariableEditorForm/variable-editor-form-model.ts"],"sourcesContent":["// Copyright 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 type { ListVariableSpec, TextVariableDefinition, TextVariableSpec, VariableDefinition } from '@perses-dev/spec';\n\nimport type { VariableOption } from '../../../model';\n\nexport type SortMethodName =\n | 'none'\n | 'alphabetical-asc'\n | 'alphabetical-desc'\n | 'numerical-asc'\n | 'numerical-desc'\n | 'alphabetical-ci-asc'\n | 'alphabetical-ci-desc';\n\nexport const SORT_METHODS: Record<\n SortMethodName,\n { label: string; sort: (input: VariableOption[]) => VariableOption[] }\n> = {\n none: {\n label: 'None',\n sort: (input: VariableOption[]): VariableOption[] => {\n return input.slice();\n },\n },\n 'alphabetical-asc': {\n label: 'Alphabetical, asc',\n sort: (input: VariableOption[]): VariableOption[] => {\n return input.slice().sort((a, b) => (a.label > b.label ? 1 : -1));\n },\n },\n 'alphabetical-desc': {\n label: 'Alphabetical, desc',\n sort: (input: VariableOption[]): VariableOption[] => {\n return input.slice().sort((a, b) => (a.label > b.label ? -1 : 1));\n },\n },\n 'numerical-asc': {\n label: 'Numerical, asc',\n sort: (input: VariableOption[]): VariableOption[] => {\n return input.slice().sort((a, b) => (parseInt(a.label) > parseInt(b.label) ? 1 : -1));\n },\n },\n 'numerical-desc': {\n label: 'Numerical, desc',\n sort: (input: VariableOption[]): VariableOption[] => {\n return input.slice().sort((a, b) => (parseInt(a.label) < parseInt(b.label) ? 1 : -1));\n },\n },\n 'alphabetical-ci-asc': {\n label: 'Alphabetical, case-insensitive, asc',\n sort: (input: VariableOption[]): VariableOption[] => {\n return input.slice().sort((a, b) => (a.label.toLowerCase() > b.label.toLowerCase() ? 1 : -1));\n },\n },\n 'alphabetical-ci-desc': {\n label: 'Alphabetical, case-insensitive, desc',\n sort: (input: VariableOption[]): VariableOption[] => {\n return input.slice().sort((a, b) => (a.label.toLowerCase() > b.label.toLowerCase() ? -1 : 1));\n },\n },\n};\n\nexport type VariableEditorState = {\n name: string;\n title?: string;\n kind: 'TextVariable' | 'ListVariable' | 'BuiltinVariable';\n description?: string;\n listVariableFields: Omit<ListVariableSpec, 'name' | 'display'>;\n textVariableFields: Omit<TextVariableSpec, 'name' | 'display'>;\n};\n\nexport function getInitialState(initialVariableDefinition: VariableDefinition): VariableEditorState {\n const textVariableFields: Omit<TextVariableSpec, 'name' | 'display'> = {\n value: (initialVariableDefinition as TextVariableDefinition).spec.value ?? '',\n constant: (initialVariableDefinition as TextVariableDefinition).spec.constant ?? false,\n };\n\n const listVariableFields: Omit<ListVariableSpec, 'name' | 'display'> = {\n allowMultiple: false,\n allowAllValue: false,\n customAllValue: undefined,\n capturingRegexp: undefined,\n sort: undefined,\n plugin: {\n kind: '',\n spec: {},\n },\n };\n if (initialVariableDefinition.kind === 'ListVariable') {\n listVariableFields.allowMultiple = initialVariableDefinition.spec.allowMultiple ?? false;\n listVariableFields.allowAllValue = initialVariableDefinition.spec.allowAllValue ?? false;\n listVariableFields.customAllValue = initialVariableDefinition.spec.customAllValue;\n listVariableFields.capturingRegexp = initialVariableDefinition.spec.capturingRegexp;\n listVariableFields.sort = initialVariableDefinition.spec.sort;\n listVariableFields.plugin = initialVariableDefinition.spec.plugin;\n }\n\n return {\n name: initialVariableDefinition.spec.name,\n title: initialVariableDefinition.spec.display?.name ?? '',\n kind: initialVariableDefinition.kind,\n description: initialVariableDefinition.spec.display?.description ?? '',\n listVariableFields,\n textVariableFields,\n };\n}\n\nexport function getVariableDefinitionFromState(state: VariableEditorState): VariableDefinition {\n const { name, title, kind, description } = state;\n\n const display = { name: title, description: description };\n\n if (kind === 'TextVariable') {\n return {\n kind,\n spec: {\n name,\n display,\n ...state.textVariableFields,\n },\n };\n }\n\n if (kind === 'ListVariable') {\n return {\n kind,\n spec: {\n name,\n display,\n allowMultiple: state.listVariableFields.allowMultiple,\n allowAllValue: state.listVariableFields.allowAllValue,\n customAllValue: state.listVariableFields.customAllValue,\n capturingRegexp: state.listVariableFields.capturingRegexp,\n sort: state.listVariableFields.sort,\n plugin: state.listVariableFields.plugin,\n },\n };\n }\n throw new Error(`Unknown variable kind: ${kind}`);\n}\n"],"names":["SORT_METHODS","none","label","sort","input","slice","a","b","parseInt","toLowerCase","getInitialState","initialVariableDefinition","textVariableFields","value","spec","constant","listVariableFields","allowMultiple","allowAllValue","customAllValue","undefined","capturingRegexp","plugin","kind","name","title","display","description","getVariableDefinitionFromState","state","Error"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAejC,OAAO,MAAMA,eAGT;IACFC,MAAM;QACJC,OAAO;QACPC,MAAM,CAACC;YACL,OAAOA,MAAMC,KAAK;QACpB;IACF;IACA,oBAAoB;QAClBH,OAAO;QACPC,MAAM,CAACC;YACL,OAAOA,MAAMC,KAAK,GAAGF,IAAI,CAAC,CAACG,GAAGC,IAAOD,EAAEJ,KAAK,GAAGK,EAAEL,KAAK,GAAG,IAAI,CAAC;QAChE;IACF;IACA,qBAAqB;QACnBA,OAAO;QACPC,MAAM,CAACC;YACL,OAAOA,MAAMC,KAAK,GAAGF,IAAI,CAAC,CAACG,GAAGC,IAAOD,EAAEJ,KAAK,GAAGK,EAAEL,KAAK,GAAG,CAAC,IAAI;QAChE;IACF;IACA,iBAAiB;QACfA,OAAO;QACPC,MAAM,CAACC;YACL,OAAOA,MAAMC,KAAK,GAAGF,IAAI,CAAC,CAACG,GAAGC,IAAOC,SAASF,EAAEJ,KAAK,IAAIM,SAASD,EAAEL,KAAK,IAAI,IAAI,CAAC;QACpF;IACF;IACA,kBAAkB;QAChBA,OAAO;QACPC,MAAM,CAACC;YACL,OAAOA,MAAMC,KAAK,GAAGF,IAAI,CAAC,CAACG,GAAGC,IAAOC,SAASF,EAAEJ,KAAK,IAAIM,SAASD,EAAEL,KAAK,IAAI,IAAI,CAAC;QACpF;IACF;IACA,uBAAuB;QACrBA,OAAO;QACPC,MAAM,CAACC;YACL,OAAOA,MAAMC,KAAK,GAAGF,IAAI,CAAC,CAACG,GAAG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eAAe;QACpEX;QACAJ;IACF;AACF;AAEA,OAAO,SAASgB,+BAA+BC,KAA0B;IACvE,MAAM,EAAEL,IAAI,EAAEC,KAAK,EAAEF,IAAI,EAAEI,WAAW,EAAE,GAAGE;IAE3C,MAAMH,UAAU;QAAEF,MAAMC;QAAOE,aAAaA;IAAY;IAExD,IAAIJ,SAAS,gBAAgB;QAC3B,OAAO;YACLA;YACAT,MAAM;gBACJU;gBACAE;gBACA,GAAGG,MAAMjB,kBAAkB;YAC7B;QACF;IACF;IAEA,IAAIW,SAAS,gBAAgB;QAC3B,OAAO;YACLA;YACAT,MAAM;gBACJU;gBACAE;gBACAT,eAAeY,MAAMb,kBAAkB,CAACC,aAAa;gBACrDC,eAAeW,MAAMb,kBAAkB,CAACE,aAAa;gBACrDC,gBAAgBU,MAAMb,kBAAkB,CAACG,cAAc;gBACvDE,iBAAiBQ,MAAMb,kBAAkB,CAACK,eAAe;gBACzDlB,MAAM0B,MAAMb,kBAAkB,CAACb,IAAI;gBACnCmB,QAAQO,MAAMb,kBAAkB,CAACM,MAAM;YACzC;QACF;IACF;IACA,MAAM,IAAIQ,MAAM,CAAC,uBAAuB,EAAEP,MAAM;AAClD"}
1
+ {"version":3,"sources":["../../../../src/components/Variables/VariableEditorForm/variable-editor-form-model.ts"],"sourcesContent":["// Copyright 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 type { ListVariableSpec, TextVariableDefinition, TextVariableSpec, VariableDefinition } from '@perses-dev/spec';\n\nimport type { VariableOption } from '../../../model';\n\nexport type SortMethodName =\n | 'none'\n | 'alphabetical-asc'\n | 'alphabetical-desc'\n | 'numerical-asc'\n | 'numerical-desc'\n | 'alphabetical-ci-asc'\n | 'alphabetical-ci-desc';\n\nexport const SORT_METHODS: Record<\n SortMethodName,\n { label: string; sort: (input: VariableOption[]) => VariableOption[] }\n> = {\n none: {\n label: 'None',\n sort: (input: VariableOption[]): VariableOption[] => {\n return input.slice();\n },\n },\n 'alphabetical-asc': {\n label: 'Alphabetical, asc',\n sort: (input: VariableOption[]): VariableOption[] => {\n return input.slice().toSorted((a, b) => (a.label > b.label ? 1 : -1));\n },\n },\n 'alphabetical-desc': {\n label: 'Alphabetical, desc',\n sort: (input: VariableOption[]): VariableOption[] => {\n return input.slice().toSorted((a, b) => (a.label > b.label ? -1 : 1));\n },\n },\n 'numerical-asc': {\n label: 'Numerical, asc',\n sort: (input: VariableOption[]): VariableOption[] => {\n return input.slice().toSorted((a, b) => (parseInt(a.label) > parseInt(b.label) ? 1 : -1));\n },\n },\n 'numerical-desc': {\n label: 'Numerical, desc',\n sort: (input: VariableOption[]): VariableOption[] => {\n return input.slice().toSorted((a, b) => (parseInt(a.label) < parseInt(b.label) ? 1 : -1));\n },\n },\n 'alphabetical-ci-asc': {\n label: 'Alphabetical, case-insensitive, asc',\n sort: (input: VariableOption[]): VariableOption[] => {\n return input.slice().toSorted((a, b) => (a.label.toLowerCase() > b.label.toLowerCase() ? 1 : -1));\n },\n },\n 'alphabetical-ci-desc': {\n label: 'Alphabetical, case-insensitive, desc',\n sort: (input: VariableOption[]): VariableOption[] => {\n return input.slice().toSorted((a, b) => (a.label.toLowerCase() > b.label.toLowerCase() ? -1 : 1));\n },\n },\n};\n\nexport type VariableEditorState = {\n name: string;\n title?: string;\n kind: 'TextVariable' | 'ListVariable' | 'BuiltinVariable';\n description?: string;\n listVariableFields: Omit<ListVariableSpec, 'name' | 'display'>;\n textVariableFields: Omit<TextVariableSpec, 'name' | 'display'>;\n};\n\nexport function getInitialState(initialVariableDefinition: VariableDefinition): VariableEditorState {\n const textVariableFields: Omit<TextVariableSpec, 'name' | 'display'> = {\n value: (initialVariableDefinition as TextVariableDefinition).spec.value ?? '',\n constant: (initialVariableDefinition as TextVariableDefinition).spec.constant ?? false,\n };\n\n const listVariableFields: Omit<ListVariableSpec, 'name' | 'display'> = {\n allowMultiple: false,\n allowAllValue: false,\n customAllValue: undefined,\n capturingRegexp: undefined,\n sort: undefined,\n plugin: {\n kind: '',\n spec: {},\n },\n };\n if (initialVariableDefinition.kind === 'ListVariable') {\n listVariableFields.allowMultiple = initialVariableDefinition.spec.allowMultiple ?? false;\n listVariableFields.allowAllValue = initialVariableDefinition.spec.allowAllValue ?? false;\n listVariableFields.customAllValue = initialVariableDefinition.spec.customAllValue;\n listVariableFields.capturingRegexp = initialVariableDefinition.spec.capturingRegexp;\n listVariableFields.sort = initialVariableDefinition.spec.sort;\n listVariableFields.plugin = initialVariableDefinition.spec.plugin;\n }\n\n return {\n name: initialVariableDefinition.spec.name,\n title: initialVariableDefinition.spec.display?.name ?? '',\n kind: initialVariableDefinition.kind,\n description: initialVariableDefinition.spec.display?.description ?? '',\n listVariableFields,\n textVariableFields,\n };\n}\n\nexport function getVariableDefinitionFromState(state: VariableEditorState): VariableDefinition {\n const { name, title, kind, description } = state;\n\n const display = { name: title, description: description };\n\n if (kind === 'TextVariable') {\n return {\n kind,\n spec: {\n name,\n display,\n ...state.textVariableFields,\n },\n };\n }\n\n if (kind === 'ListVariable') {\n return {\n kind,\n spec: {\n name,\n display,\n allowMultiple: state.listVariableFields.allowMultiple,\n allowAllValue: state.listVariableFields.allowAllValue,\n customAllValue: state.listVariableFields.customAllValue,\n capturingRegexp: state.listVariableFields.capturingRegexp,\n sort: state.listVariableFields.sort,\n plugin: state.listVariableFields.plugin,\n },\n };\n }\n throw new Error(`Unknown variable kind: ${kind}`);\n}\n"],"names":["SORT_METHODS","none","label","sort","input","slice","toSorted","a","b","parseInt","toLowerCase","getInitialState","initialVariableDefinition","textVariableFields","value","spec","constant","listVariableFields","allowMultiple","allowAllValue","customAllValue","undefined","capturingRegexp","plugin","kind","name","title","display","description","getVariableDefinitionFromState","state","Error"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAejC,OAAO,MAAMA,eAGT;IACFC,MAAM;QACJC,OAAO;QACPC,MAAM,CAACC;YACL,OAAOA,MAAMC,KAAK;QACpB;IACF;IACA,oBAAoB;QAClBH,OAAO;QACPC,MAAM,CAACC;YACL,OAAOA,MAAMC,KAAK,GAAGC,QAAQ,CAAC,CAACC,GAAGC,IAAOD,EAAEL,KAAK,GAAGM,EAAEN,KAAK,GAAG,IAAI,CAAC;QACpE;IACF;IACA,qBAAqB;QACnBA,OAAO;QACPC,MAAM,CAACC;YACL,OAAOA,MAAMC,KAAK,GAAGC,QAAQ,CAAC,CAACC,GAAGC,IAAOD,EAAEL,KAAK,GAAGM,EAAEN,KAAK,GAAG,CAAC,IAAI;QACpE;IACF;IACA,iBAAiB;QACfA,OAAO;QACPC,MAAM,CAACC;YACL,OAAOA,MAAMC,KAAK,GAAGC,QAAQ,CAAC,CAACC,GAAGC,IAAOC,SAASF,EAAEL,KAAK,IAAIO,SAASD,EAAEN,KAAK,IAAI,IAAI,CAAC;QACxF;IACF;IACA,kBAAkB;QAChBA,OAAO;QACPC,MAAM,CAACC;YACL,OAAOA,MAAMC,KAAK,GAAGC,QAAQ,CAAC,CAACC,GAAGC,IAAOC,SAASF,EAAEL,KAAK,IAAIO,SAASD,EAAEN,KAAK,IAAI,IAAI,CAAC;QACxF;IACF;IACA,uBAAuB;QACrBA,OAAO;QACPC,MAAM,CAACC;YACL,OAAOA,MAAMC,KAAK,GAAGC,QAAQ,CAAC,CAACC,GAAGC,IAAOD,EAAEL,KAAK,CAACQ,WAAW,KAAKF,EAAEN,KAAK,CAACQ,WAAW,KAAK,IAAI,CAAC;QACh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I,EAAEC,KAAK,EAAEF,IAAI,EAAEI,WAAW,EAAE,GAAGE;IAE3C,MAAMH,UAAU;QAAEF,MAAMC;QAAOE,aAAaA;IAAY;IAExD,IAAIJ,SAAS,gBAAgB;QAC3B,OAAO;YACLA;YACAT,MAAM;gBACJU;gBACAE;gBACA,GAAGG,MAAMjB,kBAAkB;YAC7B;QACF;IACF;IAEA,IAAIW,SAAS,gBAAgB;QAC3B,OAAO;YACLA;YACAT,MAAM;gBACJU;gBACAE;gBACAT,eAAeY,MAAMb,kBAAkB,CAACC,aAAa;gBACrDC,eAAeW,MAAMb,kBAAkB,CAACE,aAAa;gBACrDC,gBAAgBU,MAAMb,kBAAkB,CAACG,cAAc;gBACvDE,iBAAiBQ,MAAMb,kBAAkB,CAACK,eAAe;gBACzDnB,MAAM2B,MAAMb,kBAAkB,CAACd,IAAI;gBACnCoB,QAAQO,MAAMb,kBAAkB,CAACM,MAAM;YACzC;QACF;IACF;IACA,MAAM,IAAIQ,MAAM,CAAC,uBAAuB,EAAEP,MAAM;AAClD"}
@@ -17,10 +17,10 @@ export declare function useResolveListVariableValues(variableDefinitions: Variab
17
17
  */
18
18
  export declare function getVariableValuesKey(v: VariableStateMap): string;
19
19
  export declare const VARIABLE_TYPES: readonly [{
20
- readonly label: "List";
21
- readonly kind: "ListVariable";
20
+ readonly label: 'List';
21
+ readonly kind: 'ListVariable';
22
22
  }, {
23
- readonly label: "Text";
24
- readonly kind: "TextVariable";
23
+ readonly label: 'Text';
24
+ readonly kind: 'TextVariable';
25
25
  }];
26
26
  //# sourceMappingURL=variable-model.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"variable-model.d.ts","sourceRoot":"","sources":["../../../src/components/Variables/variable-model.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAClG,OAAO,KAAK,EAAmB,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAI7E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F,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IACrD,SAAS,EAAE,OAAO,CAAC;CACpB,CAqEA;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,gBAAgB,GAAG,MAAM,CAIhE;AAED,eAAO,MAAM,cAAc;aACvB,KAAK,EAAE,MAAM;aAAE,IAAI,EAAE,cAAc;;aACnC,KAAK,EAAE,MAAM;aAAE,IAAI,EAAE,cAAc;EAC7B,CAAC"}
@@ -1,3 +1,3 @@
1
- export declare const DEFAULT_REPEAT_ALIGNMENT: "horizontal";
1
+ export declare const DEFAULT_REPEAT_ALIGNMENT: 'horizontal';
2
2
  export declare const DEFAULT_MAX_PER_ROW = 4;
3
3
  //# sourceMappingURL=repeat.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"user-interface-text.d.ts","sourceRoot":"","sources":["../../src/constants/user-interface-text.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,YAAY;;;;;;;CASxB,CAAC"}
1
+ {"version":3,"file":"user-interface-text.d.ts","sourceRoot":"","sources":["../../src/constants/user-interface-text.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,YAAY;IAEvB,qBAAqB;IACrB,kBAAkB;IAElB,OAAO;IACP,eAAe;IACf,MAAM;IACN,OAAO;CACR,CAAC"}
@@ -4,10 +4,10 @@ import type { ReactElement, ReactNode } from 'react';
4
4
  import type { z } from 'zod';
5
5
  import type { PanelEditorValues } from '../model';
6
6
  export interface ValidationSchemas {
7
- datasourceEditorSchema: z.Schema<DatasourceDefinition>;
8
- panelEditorSchema: z.Schema<PanelEditorValues>;
9
- variableEditorSchema: z.Schema<VariableDefinition>;
10
- annotationEditorSchema: z.Schema<AnnotationSpec>;
7
+ datasourceEditorSchema: z.ZodType<DatasourceDefinition, DatasourceDefinition>;
8
+ panelEditorSchema: z.ZodType<PanelEditorValues, PanelEditorValues>;
9
+ variableEditorSchema: z.ZodType<VariableDefinition, VariableDefinition>;
10
+ annotationEditorSchema: z.ZodType<AnnotationSpec, AnnotationSpec>;
11
11
  setDatasourceEditorSchemaPlugin: (pluginSchema: PluginSchema) => void;
12
12
  setPanelEditorSchemaPlugin: (pluginSchema: PluginSchema) => void;
13
13
  setVariableEditorSchemaPlugin: (pluginSchema: PluginSchema) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"ValidationProvider.d.ts","sourceRoot":"","sources":["../../src/context/ValidationProvider.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAOzF,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAErD,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAGlD,MAAM,WAAW,iBAAiB;IAChC,sBAAsB,EAAE,CAAC,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;IACvD,iBAAiB,EAAE,CAAC,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;IAC/C,oBAAoB,EAAE,CAAC,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC;IACnD,sBAAsB,EAAE,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;IACjD,+BAA+B,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,IAAI,CAAC;IACtE,0BAA0B,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,IAAI,CAAC;IACjE,6BAA6B,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,IAAI,CAAC;IACpE,+BAA+B,CAAC,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,IAAI,CAAC;CACxE;AAED,eAAO,MAAM,wBAAwB,wDAA0D,CAAC;AAEhG,wBAAgB,oBAAoB,I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AAoB,IAAI,iBAAiB,CAMxD;AAED,UAAU,uBAAuB;IAC/B,QAAQ,EAAE,SAAS,CAAC;CACrB;AAKD,wBAAgB,kBAAkB,CAAC,EAAE,QAAQ,EAAE,EAAE,uBAAuB,GAAG,YAAY,CA0CtF"}
@@ -27,7 +27,7 @@ export function useValidationSchemas() {
27
27
  * Provide validation schemas for forms handling plugins (datasources, variables, panels).
28
28
  */ export function ValidationProvider({ children }) {
29
29
  const [datasourceEditorSchema, setDatasourceEditorSchema] = useState(datasourceDefinitionSchema);
30
- const [panelEditorSchema, setPanelEditorSchema] = useState(defaultPanelEditorSchema); // TODO I don't get why this does not compile
30
+ const [panelEditorSchema, setPanelEditorSchema] = useState(defaultPanelEditorSchema);
31
31
  const [variableEditorSchema, setVariableEditorSchema] = useState(variableDefinitionSchema);
32
32
  const [annotationEditorSchema, setAnnotationEditorSchema] = useState(annotationSpecSchema);
33
33
  function setDatasourceEditorSchemaPlugin(pluginSchema) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/context/ValidationProvider.tsx"],"sourcesContent":["// Copyright 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 type { DatasourceDefinition } from '@perses-dev/client';\nimport { buildDatasourceDefinitionSchema, datasourceDefinitionSchema } from '@perses-dev/client';\nimport type { AnnotationSpec, PluginSchema, VariableDefinition } from '@perses-dev/spec';\nimport {\n annotationSpecSchema,\n buildAnnotationSpecSchema,\n buildVariableDefinitionSchema,\n variableDefinitionSchema,\n} from '@perses-dev/spec';\nimport type { ReactElement, ReactNode } from 'react';\nimport { createContext, useContext, useState } from 'react';\nimport type { z } from 'zod';\n\nimport type { PanelEditorValues } from '../model';\nimport { buildPanelEditorSchema, panelEditorSchema as defaultPanelEditorSchema } from '../schema';\n\nexport interface ValidationSchemas {\n datasourceEditorSchema: z.Schema<DatasourceDefinition>;\n panelEditorSchema: z.Schema<PanelEditorValues>;\n variableEditorSchema: z.Schema<VariableDefinition>;\n annotationEditorSchema: z.Schema<AnnotationSpec>;\n setDatasourceEditorSchemaPlugin: (pluginSchema: PluginSchema) => void;\n setPanelEditorSchemaPlugin: (pluginSchema: PluginSchema) => void;\n setVariableEditorSchemaPlugin: (pluginSchema: PluginSchema) => void;\n setAnnotationEditorSchemaPlugin?: (pluginSchema: PluginSchema) => void;\n}\n\nexport const ValidationSchemasContext = createContext<ValidationSchemas | undefined>(undefined);\n\nexport function useValidationSchemas(): ValidationSchemas {\n const ctx = useContext(ValidationSchemasContext);\n if (ctx === undefined) {\n throw new Error('No ValidationSchemasContext found. Did you forget a Provider?');\n }\n return ctx;\n}\n\ninterface ValidationProviderProps {\n children: ReactNode;\n}\n\n/*\n * Provide validation schemas for forms handling plugins (datasources, variables, panels).\n */\nexport function ValidationProvider({ children }: ValidationProviderProps): ReactElement {\n const [datasourceEditorSchema, setDatasourceEditorSchema] =\n useState<z.Schema<DatasourceDefinition>>(datasourceDefinitionSchema);\n const [panelEditorSchema, setPanelEditorSchema] = useState<z.Schema<PanelEditorValues>>(defaultPanelEditorSchema); // TODO I don't get why this does not compile\n const [variableEditorSchema, setVariableEditorSchema] =\n useState<z.Schema<VariableDefinition>>(variableDefinitionSchema);\n const [annotationEditorSchema, setAnnotationEditorSchema] = useState<z.Schema<AnnotationSpec>>(annotationSpecSchema);\n\n function setDatasourceEditorSchemaPlugin(pluginSchema: PluginSchema): void {\n setDatasourceEditorSchema(buildDatasourceDefinitionSchema(pluginSchema));\n }\n\n function setPanelEditorSchemaPlugin(pluginSchema: PluginSchema): void {\n setPanelEditorSchema(buildPanelEditorSchema(pluginSchema));\n }\n\n function setVariableEditorSchemaPlugin(pluginSchema: PluginSchema): void {\n setVariableEditorSchema(buildVariableDefinitionSchema(pluginSchema));\n }\n\n function setAnnotationEditorSchemaPlugin(pluginSchema: PluginSchema): void {\n setAnnotationEditorSchema(buildAnnotationSpecSchema(pluginSchema));\n }\n\n return (\n <ValidationSchemasContext.Provider\n value={{\n datasourceEditorSchema,\n panelEditorSchema,\n variableEditorSchema,\n annotationEditorSchema,\n setDatasourceEditorSchemaPlugin,\n setPanelEditorSchemaPlugin,\n setVariableEditorSchemaPlugin,\n setAnnotationEditorSchemaPlugin,\n }}\n >\n {children}\n </ValidationSchemasContext.Provider>\n );\n}\n"],"names":["buildDatasourceDefinitionSchema","datasourceDefinitionSchema","annotationSpecSchema","buildAnnotationSpecSchema","buildVariableDefinitionSchema","variableDefinitionSchema","createContext","useContext","useState","buildPanelEditorSchema","panelEditorSchema","defaultPanelEditorSchema","ValidationSchemasContext","undefined","useValidationSchemas","ctx","Error","ValidationProvider","children","datasourceEditorSchema","setDatasourceEditorSchema","setPanelEditorSchema","variableEditorSchema","setVariableEditorSchema","annotationEditorSchema","setAnnotationEditorSchema","setDatasourceEditorSchemaPlugin","pluginSchema","setPanelEditorSchemaPlugin","setVariableEditorSchemaPlugin","setAnnotationEditorSchemaPlugin","Provider","value"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAGjC,SAASA,+BAA+B,EAAEC,0BAA0B,QAAQ,qBAAqB;AAEjG,SACEC,oBAAoB,EACpBC,yBAAyB,EACzBC,6BAA6B,EAC7BC,wBAAwB,QACnB,mBAAmB;AAE1B,SAASC,aAAa,EAAEC,UAAU,EAAEC,QAAQ,QAAQ,QAAQ;AAI5D,SAASC,sBAAsB,EAAEC,qBAAqBC,wBAAwB,QAAQ,qBAAY;AAalG,OAAO,MAAMC,yCAA2BN,cAA6CO,WAAW;AAEhG,OAAO,SAASC;IACd,MAAMC,MAAMR,WAAWK;IACvB,IAAIG,QAAQF,WAAW;QACrB,MAAM,IAAIG,MAAM;IAClB;IACA,OAAOD;AACT;AAMA;;CAEC,GACD,OAAO,SAASE,mBAAmB,EAAEC,QAAQ,EAA2B;IACtE,MAAM,CAACC,wBAAwBC,0BAA0B,GACvDZ,SAAyCP;IAC3C,MAAM,CAACS,mBAAmBW,qBAAqB,GAAGb,SAAsCG,2BAA2B,6CAA6C;IAChK,MAAM,CAACW,sBAAsBC,wBAAwB,GACnDf,SAAuCH;IACzC,MAAM,CAACmB,wBAAwBC,0BAA0B,GAAGjB,SAAmCN;IAE/F,SAASwB,gCAAgCC,YAA0B;QACjEP,0BAA0BpB,gCAAgC2B;IAC5D;IAEA,SAASC,2BAA2BD,YAA0B;QAC5DN,qBAAqBZ,uBAAuBkB;IAC9C;IAEA,SAASE,8BAA8BF,YAA0B;QAC/DJ,wBAAwBnB,8BAA8BuB;IACxD;IAEA,SAASG,gCAAgCH,YAA0B;QACjEF,0BAA0BtB,0BAA0BwB;IACtD;IAEA,qBACE,KAACf,yBAAyBmB,QAAQ;QAChCC,OAAO;YACLb;YACAT;YACAY;YACAE;YACAE;YACAE;YACAC;YACAC;QACF;kBAECZ;;AAGP"}
1
+ {"version":3,"sources":["../../src/context/ValidationProvider.tsx"],"sourcesContent":["// Copyright 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 type { DatasourceDefinition } from '@perses-dev/client';\nimport { buildDatasourceDefinitionSchema, datasourceDefinitionSchema } from '@perses-dev/client';\nimport type { AnnotationSpec, PluginSchema, VariableDefinition } from '@perses-dev/spec';\nimport {\n annotationSpecSchema,\n buildAnnotationSpecSchema,\n buildVariableDefinitionSchema,\n variableDefinitionSchema,\n} from '@perses-dev/spec';\nimport type { ReactElement, ReactNode } from 'react';\nimport { createContext, useContext, useState } from 'react';\nimport type { z } from 'zod';\n\nimport type { PanelEditorValues } from '../model';\nimport { buildPanelEditorSchema, panelEditorSchema as defaultPanelEditorSchema } from '../schema';\n\nexport interface ValidationSchemas {\n datasourceEditorSchema: z.ZodType<DatasourceDefinition, DatasourceDefinition>;\n panelEditorSchema: z.ZodType<PanelEditorValues, PanelEditorValues>;\n variableEditorSchema: z.ZodType<VariableDefinition, VariableDefinition>;\n annotationEditorSchema: z.ZodType<AnnotationSpec, AnnotationSpec>;\n setDatasourceEditorSchemaPlugin: (pluginSchema: PluginSchema) => void;\n setPanelEditorSchemaPlugin: (pluginSchema: PluginSchema) => void;\n setVariableEditorSchemaPlugin: (pluginSchema: PluginSchema) => void;\n setAnnotationEditorSchemaPlugin?: (pluginSchema: PluginSchema) => void;\n}\n\nexport const ValidationSchemasContext = createContext<ValidationSchemas | undefined>(undefined);\n\nexport function useValidationSchemas(): ValidationSchemas {\n const ctx = useContext(ValidationSchemasContext);\n if (ctx === undefined) {\n throw new Error('No ValidationSchemasContext found. Did you forget a Provider?');\n }\n return ctx;\n}\n\ninterface ValidationProviderProps {\n children: ReactNode;\n}\n\n/*\n * Provide validation schemas for forms handling plugins (datasources, variables, panels).\n */\nexport function ValidationProvider({ children }: ValidationProviderProps): ReactElement {\n const [datasourceEditorSchema, setDatasourceEditorSchema] =\n useState<z.ZodType<DatasourceDefinition, DatasourceDefinition>>(datasourceDefinitionSchema);\n const [panelEditorSchema, setPanelEditorSchema] =\n useState<z.ZodType<PanelEditorValues, PanelEditorValues>>(defaultPanelEditorSchema);\n const [variableEditorSchema, setVariableEditorSchema] =\n useState<z.ZodType<VariableDefinition, VariableDefinition>>(variableDefinitionSchema);\n const [annotationEditorSchema, setAnnotationEditorSchema] =\n useState<z.ZodType<AnnotationSpec, AnnotationSpec>>(annotationSpecSchema);\n\n function setDatasourceEditorSchemaPlugin(pluginSchema: PluginSchema): void {\n setDatasourceEditorSchema(buildDatasourceDefinitionSchema(pluginSchema));\n }\n\n function setPanelEditorSchemaPlugin(pluginSchema: PluginSchema): void {\n setPanelEditorSchema(buildPanelEditorSchema(pluginSchema));\n }\n\n function setVariableEditorSchemaPlugin(pluginSchema: PluginSchema): void {\n setVariableEditorSchema(buildVariableDefinitionSchema(pluginSchema));\n }\n\n function setAnnotationEditorSchemaPlugin(pluginSchema: PluginSchema): void {\n setAnnotationEditorSchema(buildAnnotationSpecSchema(pluginSchema));\n }\n\n return (\n <ValidationSchemasContext.Provider\n value={{\n datasourceEditorSchema,\n panelEditorSchema,\n variableEditorSchema,\n annotationEditorSchema,\n setDatasourceEditorSchemaPlugin,\n setPanelEditorSchemaPlugin,\n setVariableEditorSchemaPlugin,\n setAnnotationEditorSchemaPlugin,\n }}\n >\n {children}\n </ValidationSchemasContext.Provider>\n );\n}\n"],"names":["buildDatasourceDefinitionSchema","datasourceDefinitionSchema","annotationSpecSchema","buildAnnotationSpecSchema","buildVariableDefinitionSchema","variableDefinitionSchema","createContext","useContext","useState","buildPanelEditorSchema","panelEditorSchema","defaultPanelEditorSchema","ValidationSchemasContext","undefined","useValidationSchemas","ctx","Error","ValidationProvider","children","datasourceEditorSchema","setDatasourceEditorSchema","setPanelEditorSchema","variableEditorSchema","setVariableEditorSchema","annotationEditorSchema","setAnnotationEditorSchema","setDatasourceEditorSchemaPlugin","pluginSchema","setPanelEditorSchemaPlugin","setVariableEditorSchemaPlugin","setAnnotationEditorSchemaPlugin","Provider","value"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAGjC,SAASA,+BAA+B,EAAEC,0BAA0B,QAAQ,qBAAqB;AAEjG,SACEC,oBAAoB,EACpBC,yBAAyB,EACzBC,6BAA6B,EAC7BC,wBAAwB,QACnB,mBAAmB;AAE1B,SAASC,aAAa,EAAEC,UAAU,EAAEC,QAAQ,QAAQ,QAAQ;AAI5D,SAASC,sBAAsB,EAAEC,qBAAqBC,wBAAwB,QAAQ,qBAAY;AAalG,OAAO,MAAMC,yCAA2BN,cAA6CO,WAAW;AAEhG,OAAO,SAASC;IACd,MAAMC,MAAMR,WAAWK;IACvB,IAAIG,QAAQF,WAAW;QACrB,MAAM,IAAIG,MAAM;IAClB;IACA,OAAOD;AACT;AAMA;;CAEC,GACD,OAAO,SAASE,mBAAmB,EAAEC,QAAQ,EAA2B;IACtE,MAAM,CAACC,wBAAwBC,0BAA0B,GACvDZ,SAAgEP;IAClE,MAAM,CAACS,mBAAmBW,qBAAqB,GAC7Cb,SAA0DG;IAC5D,MAAM,CAACW,sBAAsBC,wBAAwB,GACnDf,SAA4DH;IAC9D,MAAM,CAACmB,wBAAwBC,0BAA0B,GACvDjB,SAAoDN;IAEtD,SAASwB,gCAAgCC,YAA0B;QACjEP,0BAA0BpB,gCAAgC2B;IAC5D;IAEA,SAASC,2BAA2BD,YAA0B;QAC5DN,qBAAqBZ,uBAAuBkB;IAC9C;IAEA,SAASE,8BAA8BF,YAA0B;QAC/DJ,wBAAwBnB,8BAA8BuB;IACxD;IAEA,SAASG,gCAAgCH,YAA0B;QACjEF,0BAA0BtB,0BAA0BwB;IACtD;IAEA,qBACE,KAACf,yBAAyBmB,QAAQ;QAChCC,OAAO;YACLb;YACAT;YACAY;YACAE;YACAE;YACAE;YACAC;YACAC;QACF;kBAECZ;;AAGP"}
@@ -1 +1 @@
1
- {"version":3,"file":"calculations.d.ts","sourceRoot":"","sources":["../../src/model/calculations.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,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D;AAED,iBAAS,WAAW,CAAC,MAAM,EAAE,oBAAoB,EAAE,GAAG,gBAAgB,CAErE;AAED,iBAAS,UAAU,CAAC,MAAM,EAAE,oBAAoB,EAAE,GAAG,gBAAgB,CAEpE;AAED,iBAAS,IAAI,CAAC,MAAM,EAAE,oBAAoB,EAAE,GAAG,gBAAgB,CAE9D;AAED,iBAAS,GAAG,CAAC,MAAM,EAAE,oBAAoB,EAAE,GAAG,gBAAgB,CAE7D;AAED,iBAAS,GAAG,CAAC,MAAM,EAAE,oBAAoB,EAAE,GAAG,gBAAgB,CAE7D;AAED,iBAAS,GAAG,CAAC,MAAM,EAAE,oBAAoB,EAAE,GAAG,gBAAgB,CAE7D"}
@@ -14,6 +14,6 @@ export type LegendSingleSelectConfig = {
14
14
  export declare const LEGEND_POSITIONS_CONFIG: Readonly<Record<LegendPositions, LegendSingleSelectConfig>>;
15
15
  export declare const LEGEND_MODE_CONFIG: Readonly<Record<LegendMode, LegendSingleSelectConfig>>;
16
16
  export declare const LEGEND_SIZE_CONFIG: Readonly<Record<LegendSize, LegendSingleSelectConfig>>;
17
- export declare const LEGEND_VALUE_CONFIG: Partial<Record<"max" | "min" | "first" | "last" | "first-number" | "last-number" | "mean" | "sum", LegendSingleSelectConfig>>;
17
+ export declare const LEGEND_VALUE_CONFIG: Partial<Record<"first" | "first-number" | "last" | "last-number" | "max" | "mean" | "min" | "sum", LegendSingleSelectConfig>>;
18
18
  export declare function validateLegendSpec(legend?: LegendOptionsBase): boolean;
19
19
  //# sourceMappingURL=legend.d.ts.map
@@ -1,5 +1,14 @@
1
1
  import type { ModuleFederation } from '@module-federation/enhanced/runtime';
2
2
  import type { PersesPlugin, RemotePluginModule } from './PersesPlugin.types';
3
+ export interface HostSharedModules {
4
+ '@perses-dev/spec': unknown;
5
+ '@perses-dev/client': unknown;
6
+ '@perses-dev/components': unknown;
7
+ '@perses-dev/plugin-system': unknown;
8
+ '@perses-dev/explore': unknown;
9
+ '@perses-dev/dashboards': unknown;
10
+ }
11
+ export declare function registerHostSharedModules(modules: HostSharedModules): void;
3
12
  export declare const loadPlugin: (target: {
4
13
  moduleName: string;
5
14
  pluginName: string;
@@ -1 +1 @@
1
- {"version":3,"file":"PluginRuntime.d.ts","sourceRoot":"","sources":["../../src/remote/PluginRuntime.tsx"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AAQ5E,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAqN7E,eAAO,MAAM,UAAU,GAAU,QAAQ;IACvC,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,KAAG,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAOpC,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,YAAY,CAAA;CAAE,GAAG;IACtE,aAAa,EAAE,gBAAgB,CAAC;IAChC,UAAU,EAAE,MAAM,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAAC;CACtD,CAQA"}
1
+ {"version":3,"file":"PluginRuntime.d.ts","sourceRoot":"","sources":["../../src/remote/PluginRuntime.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AAQ5E,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAW7E,MAAM,WAAW,iBAAiB;IAChC,kBAAkB,EAAE,OAAO,CAAC;IAC5B,oBAAoB,EAAE,OAAO,CAAC;IAC9B,wBAAwB,EAAE,OAAO,CAAC;IAClC,2BAA2B,EAAE,OAAO,CAAC;IACrC,qBAAqB,EAAE,OAAO,CAAC;IAC/B,wBAAwB,EAAE,OAAO,CAAC;CACnC;AAUD,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,iBAAiB,GAAG,IAAI,CAI1E;AA+ND,eAAO,MAAM,UAAU,WAAkB;IACvC,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,KAAG,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAOpC,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,YAAY,CAAA;CAAE,GAAG;IACtE,aAAa,EAAE,gBAAgB,CAAC;IAChC,UAAU,EAAE,MAAM,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAAC;CACtD,CAQA"}
@@ -1,16 +1,4 @@
1
1
  // Copyright 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
- /* eslint-disable @typescript-eslint/no-require-imports */ // Copyright The Perses Authors
14
2
  // Licensed under the Apache License, Version 2.0 (the "License");
15
3
  // you may not use this file except in compliance with the License.
16
4
  // You may obtain a copy of the License at
@@ -22,6 +10,8 @@
22
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23
11
  // See the License for the specific language governing permissions and
24
12
  // limitations under the License.
13
+ import * as EmotionReact from "@emotion/react";
14
+ import * as EmotionStyled from "@emotion/styled";
25
15
  import { createInstance } from "@module-federation/enhanced/runtime";
26
16
  import * as ReactQuery from "@tanstack/react-query";
27
17
  import React from "react";
@@ -29,6 +19,28 @@ import ReactDOM from "react-dom";
29
19
  import * as ReactHookForm from "react-hook-form";
30
20
  import * as ReactRouterDOM from "react-router-dom";
31
21
  let instance = null;
22
+ function createSharedModuleLoader(loadModule) {
23
+ return async ()=>{
24
+ const module = await loadModule();
25
+ return ()=>module;
26
+ };
27
+ }
28
+ const hostSharedModules = new Map();
29
+ /*
30
+ * Shared singletons must be provided to Module Federation *synchronously* (via `lib`) so the host's
31
+ * copy wins singleton negotiation to avoid loader deadlocks or multiple instances.
32
+ */ export function registerHostSharedModules(modules) {
33
+ for (const [name, module] of Object.entries(modules)){
34
+ hostSharedModules.set(name, module);
35
+ }
36
+ }
37
+ function getHostSharedModule(name) {
38
+ const module = hostSharedModules.get(name);
39
+ if (!module) {
40
+ throw new Error(`Shared module "${name}" was not registered before a plugin tried to consume it. ` + `Call registerHostSharedModules() during app bootstrap.`);
41
+ }
42
+ return module;
43
+ }
32
44
  const getPluginRuntime = ()=>{
33
45
  if (instance === null) {
34
46
  const pluginRuntime = createInstance({
@@ -52,7 +64,7 @@ const getPluginRuntime = ()=>{
52
64
  }
53
65
  },
54
66
  'react-router-dom': {
55
- version: '6.26.0',
67
+ version: '6.30.4',
56
68
  lib: ()=>ReactRouterDOM,
57
69
  shareConfig: {
58
70
  singleton: true,
@@ -60,7 +72,7 @@ const getPluginRuntime = ()=>{
60
72
  }
61
73
  },
62
74
  '@tanstack/react-query': {
63
- version: '4.39.1',
75
+ version: '4.44.0',
64
76
  lib: ()=>ReactQuery,
65
77
  shareConfig: {
66
78
  singleton: true,
@@ -68,73 +80,90 @@ const getPluginRuntime = ()=>{
68
80
  }
69
81
  },
70
82
  'react-hook-form': {
71
- version: '7.52.2',
83
+ version: '7.87.0',
72
84
  lib: ()=>ReactHookForm,
73
85
  shareConfig: {
74
86
  singleton: true,
75
- requiredVersion: '^7.52.2'
87
+ requiredVersion: '^7.87.0'
76
88
  }
77
89
  },
78
- echarts: {
79
- version: '5.5.0',
80
- lib: ()=>require('echarts'),
90
+ '@emotion/react': {
91
+ version: '11.14.0',
92
+ lib: ()=>EmotionReact,
81
93
  shareConfig: {
82
94
  singleton: true,
83
- requiredVersion: '^5.5.0'
95
+ requiredVersion: '^11.11.3'
96
+ }
97
+ },
98
+ '@emotion/styled': {
99
+ version: '11.14.1',
100
+ lib: ()=>EmotionStyled,
101
+ shareConfig: {
102
+ singleton: true,
103
+ requiredVersion: '^11.11.0'
84
104
  }
85
105
  },
86
106
  '@perses-dev/spec': {
87
- version: '0.3.0-beta.5',
88
- lib: ()=>require('@perses-dev/spec'),
107
+ version: '0.3.0-beta.7',
108
+ lib: ()=>getHostSharedModule('@perses-dev/spec'),
89
109
  shareConfig: {
90
110
  singleton: true,
91
- requiredVersion: '^0.3.0-beta.5'
111
+ requiredVersion: '^0.3.0-beta.7'
92
112
  }
93
113
  },
94
114
  '@perses-dev/client': {
95
- version: '0.55.0-beta.6',
96
- lib: ()=>require('@perses-dev/client'),
115
+ version: '0.55.0-beta.8',
116
+ lib: ()=>getHostSharedModule('@perses-dev/client'),
97
117
  shareConfig: {
98
118
  singleton: true,
99
- requiredVersion: '^0.55.0-beta.6'
119
+ requiredVersion: '^0.55.0-beta.8'
100
120
  }
101
121
  },
102
122
  '@perses-dev/components': {
103
- version: '0.55.0-beta.6',
104
- lib: ()=>require('@perses-dev/components'),
123
+ version: '0.55.0-beta.8',
124
+ lib: ()=>getHostSharedModule('@perses-dev/components'),
105
125
  shareConfig: {
106
126
  singleton: true,
107
- requiredVersion: '^0.55.0-beta.6'
127
+ requiredVersion: '^0.55.0-beta.8'
108
128
  }
109
129
  },
110
130
  '@perses-dev/plugin-system': {
111
- version: '0.55.0-beta.6',
112
- lib: ()=>require('@perses-dev/plugin-system'),
131
+ version: '0.55.0-beta.8',
132
+ lib: ()=>getHostSharedModule('@perses-dev/plugin-system'),
113
133
  shareConfig: {
114
134
  singleton: true,
115
- requiredVersion: '^0.55.0-beta.6'
135
+ requiredVersion: '^0.55.0-beta.8'
116
136
  }
117
137
  },
118
138
  '@perses-dev/explore': {
119
- version: '0.55.0-beta.6',
120
- lib: ()=>require('@perses-dev/explore'),
139
+ version: '0.55.0-beta.8',
140
+ lib: ()=>getHostSharedModule('@perses-dev/explore'),
121
141
  shareConfig: {
122
142
  singleton: true,
123
- requiredVersion: '^0.55.0-beta.6'
143
+ requiredVersion: '^0.55.0-beta.8'
124
144
  }
125
145
  },
126
146
  '@perses-dev/dashboards': {
127
- version: '0.55.0-beta.6',
128
- lib: ()=>require('@perses-dev/dashboards'),
147
+ version: '0.55.0-beta.8',
148
+ lib: ()=>getHostSharedModule('@perses-dev/dashboards'),
129
149
  shareConfig: {
130
150
  singleton: true,
131
- requiredVersion: '^0.55.0-beta.6'
151
+ requiredVersion: '^0.55.0-beta.8'
152
+ }
153
+ },
154
+ // Below are the shared modules that are used by the plugins and are loaded asynchronously on demand using get rather than lib.
155
+ // This is to avoid loading the modules if they are not used by the plugin.
156
+ echarts: {
157
+ version: '5.5.0',
158
+ get: createSharedModuleLoader(()=>import("echarts")),
159
+ shareConfig: {
160
+ singleton: true,
161
+ requiredVersion: '^5.5.0'
132
162
  }
133
163
  },
134
- // Below are the shared modules that are used by the plugins, this can be part of the SDK
135
164
  'date-fns': {
136
- version: '4.1.0',
137
- lib: ()=>require('date-fns'),
165
+ version: '4.2.1',
166
+ get: createSharedModuleLoader(()=>import("date-fns")),
138
167
  shareConfig: {
139
168
  singleton: true,
140
169
  requiredVersion: '^4.1.0'
@@ -142,63 +171,47 @@ const getPluginRuntime = ()=>{
142
171
  },
143
172
  'date-fns-tz': {
144
173
  version: '3.2.0',
145
- lib: ()=>require('date-fns-tz'),
174
+ get: createSharedModuleLoader(()=>import("date-fns-tz")),
146
175
  shareConfig: {
147
176
  singleton: true,
148
177
  requiredVersion: '^3.2.0'
149
178
  }
150
179
  },
151
180
  lodash: {
152
- version: '4.17.21',
153
- lib: ()=>require('lodash'),
181
+ version: '4.18.1',
182
+ get: createSharedModuleLoader(()=>import("lodash")),
154
183
  shareConfig: {
155
184
  singleton: true,
156
185
  requiredVersion: '^4.17.21'
157
186
  }
158
187
  },
159
- '@emotion/react': {
160
- version: '11.11.3',
161
- lib: ()=>require('@emotion/react'),
162
- shareConfig: {
163
- singleton: true,
164
- requiredVersion: '^11.11.3'
165
- }
166
- },
167
- '@emotion/styled': {
168
- version: '11.11.0',
169
- lib: ()=>require('@emotion/styled'),
170
- shareConfig: {
171
- singleton: true,
172
- requiredVersion: '^11.11.0'
173
- }
174
- },
175
188
  '@hookform/resolvers/zod': {
176
- version: '3.3.4',
177
- lib: ()=>require('@hookform/resolvers/zod'),
189
+ version: '5.9.1',
190
+ get: createSharedModuleLoader(()=>import("@hookform/resolvers/zod")),
178
191
  shareConfig: {
179
192
  singleton: true,
180
- requiredVersion: '^3.3.4'
193
+ requiredVersion: '^5.9.1'
181
194
  }
182
195
  },
183
196
  'use-resize-observer': {
184
197
  version: '9.1.0',
185
- lib: ()=>require('use-resize-observer'),
198
+ get: createSharedModuleLoader(()=>import("use-resize-observer")),
186
199
  shareConfig: {
187
200
  singleton: true,
188
201
  requiredVersion: '^9.1.0'
189
202
  }
190
203
  },
191
204
  'mdi-material-ui': {
192
- version: '7.4.0',
193
- lib: ()=>require('mdi-material-ui'),
205
+ version: '7.9.4',
206
+ get: createSharedModuleLoader(()=>import("mdi-material-ui")),
194
207
  shareConfig: {
195
208
  singleton: true,
196
209
  requiredVersion: '^7.4.0'
197
210
  }
198
211
  },
199
212
  immer: {
200
- version: '10.1.1',
201
- lib: ()=>require('immer'),
213
+ version: '10.2.0',
214
+ get: createSharedModuleLoader(()=>import("immer")),
202
215
  shareConfig: {
203
216
  singleton: true,
204
217
  requiredVersion: '^10.1.1'