@perses-dev/plugin-system 0.38.0 → 0.39.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/OptionsEditorRadios/OptionsEditorRadios.js +74 -0
- package/dist/cjs/components/OptionsEditorRadios/index.js +28 -0
- package/dist/cjs/components/{OptionsEditorTabs/TabPanel.js → OptionsEditorTabPanel/OptionsEditorTabPanel.js} +3 -3
- package/dist/cjs/components/OptionsEditorTabPanel/index.js +28 -0
- package/dist/cjs/components/OptionsEditorTabs/OptionsEditorTabs.js +2 -2
- package/dist/cjs/components/index.js +1 -0
- package/dist/cjs/runtime/DataQueriesProvider/DataQueriesProvider.js +40 -28
- package/dist/cjs/runtime/DataQueriesProvider/model.js +57 -0
- package/dist/cjs/runtime/template-variables.js +62 -0
- package/dist/cjs/test/index.js +1 -0
- package/dist/cjs/test/mock-data.js +55 -0
- 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 +68 -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/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -0
- package/dist/components/index.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 +39 -27
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js.map +1 -1
- package/dist/runtime/DataQueriesProvider/model.d.ts +15 -11
- 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/template-variables.d.ts +61 -2
- package/dist/runtime/template-variables.d.ts.map +1 -1
- package/dist/runtime/template-variables.js +63 -0
- package/dist/runtime/template-variables.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/package.json +4 -4
- 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 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/OptionsEditorTabPanel/index.ts"],"names":[],"mappings":"AAaA,cAAc,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
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 './OptionsEditorTabPanel';
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/OptionsEditorTabPanel/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 './OptionsEditorTabPanel';\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,yBAAyB,CAAC"}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
14
14
|
import { Tab, Tabs, Box } from '@mui/material';
|
|
15
15
|
import { useState } from 'react';
|
|
16
|
-
import {
|
|
16
|
+
import { OptionsEditorTabPanel } from '../OptionsEditorTabPanel';
|
|
17
17
|
export const OptionsEditorTabs = ({ tabs })=>{
|
|
18
18
|
const [activeTab, setActiveTab] = useState(0);
|
|
19
19
|
const handleChange = (_, newValue)=>{
|
|
@@ -40,7 +40,7 @@ export const OptionsEditorTabs = ({ tabs })=>{
|
|
|
40
40
|
})
|
|
41
41
|
}),
|
|
42
42
|
tabs.map(({ label , content }, i)=>{
|
|
43
|
-
return /*#__PURE__*/ _jsx(
|
|
43
|
+
return /*#__PURE__*/ _jsx(OptionsEditorTabPanel, {
|
|
44
44
|
value: activeTab,
|
|
45
45
|
index: i,
|
|
46
46
|
children: content
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/OptionsEditorTabs/OptionsEditorTabs.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 { Tab, Tabs, TabsProps, Box } from '@mui/material';\nimport { useState } from 'react';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../src/components/OptionsEditorTabs/OptionsEditorTabs.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 { Tab, Tabs, TabsProps, Box } from '@mui/material';\nimport { useState } from 'react';\nimport { OptionsEditorTabPanel } from '../OptionsEditorTabPanel';\n\nexport type OptionsEditorTab = {\n label: string;\n /**\n * Content rendered when the tab is active.\n */\n content: React.ReactNode;\n};\n\nexport type OptionsEditorTabsProps = {\n tabs: OptionsEditorTab[];\n};\n\nexport const OptionsEditorTabs = ({ tabs }: OptionsEditorTabsProps) => {\n const [activeTab, setActiveTab] = useState(0);\n\n const handleChange: TabsProps['onChange'] = (_, newValue) => {\n setActiveTab(newValue);\n };\n\n return (\n <>\n <Box sx={{ borderBottom: 1, borderColor: (theme) => theme.palette.divider }}>\n <Tabs value={activeTab} onChange={handleChange} aria-label=\"Panel configuration tabs\">\n {tabs.map(({ label }, i) => {\n return (\n <Tab\n key={label}\n label={label}\n id={`options-editor-tab-${i}`}\n aria-controls={`options-editor-tabpanel-${i}`}\n />\n );\n })}\n </Tabs>\n </Box>\n {tabs.map(({ label, content }, i) => {\n return (\n <OptionsEditorTabPanel key={label} value={activeTab} index={i}>\n {content}\n </OptionsEditorTabPanel>\n );\n })}\n </>\n );\n};\n"],"names":["Tab","Tabs","Box","useState","OptionsEditorTabPanel","OptionsEditorTabs","tabs","activeTab","setActiveTab","handleChange","_","newValue","sx","borderBottom","borderColor","theme","palette","divider","value","onChange","aria-label","map","label","i","id","aria-controls","content","index"],"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,EAAEC,IAAI,EAAaC,GAAG,QAAQ,eAAe,CAAC;AAC1D,SAASC,QAAQ,QAAQ,OAAO,CAAC;AACjC,SAASC,qBAAqB,QAAQ,0BAA0B,CAAC;AAcjE,OAAO,MAAMC,iBAAiB,GAAG,CAAC,EAAEC,IAAI,CAAA,EAA0B,GAAK;IACrE,MAAM,CAACC,SAAS,EAAEC,YAAY,CAAC,GAAGL,QAAQ,CAAC,CAAC,CAAC,AAAC;IAE9C,MAAMM,YAAY,GAA0B,CAACC,CAAC,EAAEC,QAAQ,GAAK;QAC3DH,YAAY,CAACG,QAAQ,CAAC,CAAC;IACzB,CAAC,AAAC;IAEF,qBACE;;0BACE,KAACT,GAAG;gBAACU,EAAE,EAAE;oBAAEC,YAAY,EAAE,CAAC;oBAAEC,WAAW,EAAE,CAACC,KAAK,GAAKA,KAAK,CAACC,OAAO,CAACC,OAAO;iBAAE;0BACzE,cAAA,KAAChB,IAAI;oBAACiB,KAAK,EAAEX,SAAS;oBAAEY,QAAQ,EAAEV,YAAY;oBAAEW,YAAU,EAAC,0BAA0B;8BAClFd,IAAI,CAACe,GAAG,CAAC,CAAC,EAAEC,KAAK,CAAA,EAAE,EAAEC,CAAC,GAAK;wBAC1B,qBACE,KAACvB,GAAG;4BAEFsB,KAAK,EAAEA,KAAK;4BACZE,EAAE,EAAE,CAAC,mBAAmB,EAAED,CAAC,CAAC,CAAC;4BAC7BE,eAAa,EAAE,CAAC,wBAAwB,EAAEF,CAAC,CAAC,CAAC;2BAHxCD,KAAK,CAIV,CACF;oBACJ,CAAC,CAAC;kBACG;cACH;YACLhB,IAAI,CAACe,GAAG,CAAC,CAAC,EAAEC,KAAK,CAAA,EAAEI,OAAO,CAAA,EAAE,EAAEH,CAAC,GAAK;gBACnC,qBACE,KAACnB,qBAAqB;oBAAac,KAAK,EAAEX,SAAS;oBAAEoB,KAAK,EAAEJ,CAAC;8BAC1DG,OAAO;mBADkBJ,KAAK,CAET,CACxB;YACJ,CAAC,CAAC;;MACD,CACH;AACJ,CAAC,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './CalculationSelector';
|
|
2
2
|
export * from './DatasourceSelect';
|
|
3
3
|
export * from './LegendOptionsEditor';
|
|
4
|
+
export * from './OptionsEditorRadios';
|
|
4
5
|
export * from './OptionsEditorTabs';
|
|
5
6
|
export * from './PanelSpecEditor';
|
|
6
7
|
export * from './PluginEditor';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAaA,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAaA,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,aAAa,CAAC"}
|
package/dist/components/index.js
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
export * from './CalculationSelector';
|
|
14
14
|
export * from './DatasourceSelect';
|
|
15
15
|
export * from './LegendOptionsEditor';
|
|
16
|
+
export * from './OptionsEditorRadios';
|
|
16
17
|
export * from './OptionsEditorTabs';
|
|
17
18
|
export * from './PanelSpecEditor';
|
|
18
19
|
export * from './PluginEditor';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/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 './CalculationSelector';\nexport * from './DatasourceSelect';\nexport * from './LegendOptionsEditor';\nexport * from './OptionsEditorTabs';\nexport * from './PanelSpecEditor';\nexport * from './PluginEditor';\nexport * from './PluginKindSelect';\nexport * from './PluginRegistry';\nexport * from './PluginSpecEditor';\nexport * from './TimeSeriesQueryEditor';\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,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"sources":["../../src/components/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 './CalculationSelector';\nexport * from './DatasourceSelect';\nexport * from './LegendOptionsEditor';\nexport * from './OptionsEditorRadios';\nexport * from './OptionsEditorTabs';\nexport * from './PanelSpecEditor';\nexport * from './PluginEditor';\nexport * from './PluginKindSelect';\nexport * from './PluginRegistry';\nexport * from './PluginSpecEditor';\nexport * from './TimeSeriesQueryEditor';\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,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,aAAa,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
3
|
-
import { DataQueriesProviderProps, UseDataQueryResults } from './model';
|
|
4
|
-
export declare
|
|
5
|
-
export declare
|
|
6
|
-
export declare function
|
|
2
|
+
import { QueryType } from '@perses-dev/core';
|
|
3
|
+
import { DataQueriesProviderProps, UseDataQueryResults, DataQueriesContextType } from './model';
|
|
4
|
+
export declare const DataQueriesContext: import("react").Context<DataQueriesContextType | undefined>;
|
|
5
|
+
export declare function useDataQueriesContext(): DataQueriesContextType;
|
|
6
|
+
export declare function useDataQueries<T extends keyof QueryType>(queryType: T): UseDataQueryResults<QueryType[T]>;
|
|
7
7
|
export declare function DataQueriesProvider(props: DataQueriesProviderProps): JSX.Element;
|
|
8
8
|
//# sourceMappingURL=DataQueriesProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataQueriesProvider.d.ts","sourceRoot":"","sources":["../../../src/runtime/DataQueriesProvider/DataQueriesProvider.tsx"],"names":[],"mappings":";AAcA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"DataQueriesProvider.d.ts","sourceRoot":"","sources":["../../../src/runtime/DataQueriesProvider/DataQueriesProvider.tsx"],"names":[],"mappings":";AAcA,OAAO,EAAE,SAAS,EAA6B,MAAM,kBAAkB,CAAC;AAExE,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EAEnB,sBAAsB,EAGvB,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,kBAAkB,6DAA+D,CAAC;AAE/F,wBAAgB,qBAAqB,2BAMpC;AAED,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,SAAS,EAAE,SAAS,EAAE,CAAC,GAAG,mBAAmB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAqBzG;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,eAsClE"}
|
|
@@ -13,10 +13,7 @@
|
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
14
|
import { createContext, useCallback, useContext, useMemo } from 'react';
|
|
15
15
|
import { useTimeSeriesQueries } from '../time-series-queries';
|
|
16
|
-
|
|
17
|
-
const ctx = useDataQueriesContext();
|
|
18
|
-
return ctx;
|
|
19
|
-
}
|
|
16
|
+
import { transformQueryResults, useQueryType } from './model';
|
|
20
17
|
export const DataQueriesContext = /*#__PURE__*/ createContext(undefined);
|
|
21
18
|
export function useDataQueriesContext() {
|
|
22
19
|
const ctx = useContext(DataQueriesContext);
|
|
@@ -25,44 +22,59 @@ export function useDataQueriesContext() {
|
|
|
25
22
|
}
|
|
26
23
|
return ctx;
|
|
27
24
|
}
|
|
25
|
+
export function useDataQueries(queryType) {
|
|
26
|
+
const ctx = useDataQueriesContext();
|
|
27
|
+
// Filter the query results based on the specified query type
|
|
28
|
+
const filteredQueryResults = ctx.queryResults.filter((queryResult)=>queryResult.definition.kind === queryType);
|
|
29
|
+
// Filter the errors based on the specified query type
|
|
30
|
+
const filteredErrors = ctx.errors.filter((errors, index)=>{
|
|
31
|
+
var ref;
|
|
32
|
+
return ((ref = ctx.queryResults[index]) === null || ref === void 0 ? void 0 : ref.definition.kind) === queryType;
|
|
33
|
+
});
|
|
34
|
+
// Create a new context object with the filtered results and errors
|
|
35
|
+
const filteredCtx = {
|
|
36
|
+
queryResults: filteredQueryResults,
|
|
37
|
+
isFetching: filteredQueryResults.some((result)=>result.isFetching),
|
|
38
|
+
isLoading: filteredQueryResults.some((result)=>result.isLoading),
|
|
39
|
+
refetchAll: ctx.refetchAll,
|
|
40
|
+
errors: filteredErrors
|
|
41
|
+
};
|
|
42
|
+
return filteredCtx;
|
|
43
|
+
}
|
|
28
44
|
export function DataQueriesProvider(props) {
|
|
29
45
|
const { definitions , options , children } = props;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
kind:
|
|
46
|
+
const getQueryType = useQueryType();
|
|
47
|
+
const queryDefinitions = definitions.map((definition)=>{
|
|
48
|
+
const type = getQueryType(definition.kind);
|
|
49
|
+
return {
|
|
50
|
+
kind: type,
|
|
35
51
|
spec: {
|
|
36
52
|
plugin: definition
|
|
37
53
|
}
|
|
38
|
-
}));
|
|
39
|
-
const results = useTimeSeriesQueries(timeSeriesQueries, options);
|
|
40
|
-
const data = results.map(({ data , isFetching , isLoading , refetch , error }, i)=>{
|
|
41
|
-
return {
|
|
42
|
-
definition: definitions[i],
|
|
43
|
-
data,
|
|
44
|
-
isFetching,
|
|
45
|
-
isLoading,
|
|
46
|
-
refetch,
|
|
47
|
-
error
|
|
48
54
|
};
|
|
49
55
|
});
|
|
56
|
+
// Filter definitions for time series query and other future query plugins
|
|
57
|
+
const timeSeriesQueries = queryDefinitions.filter((definition)=>definition.kind === 'TimeSeriesQuery');
|
|
58
|
+
const timeSeriesResults = useTimeSeriesQueries(timeSeriesQueries, options);
|
|
50
59
|
const refetchAll = useCallback(()=>{
|
|
51
|
-
|
|
60
|
+
timeSeriesResults.forEach((result)=>result.refetch());
|
|
52
61
|
}, [
|
|
53
|
-
|
|
62
|
+
timeSeriesResults
|
|
54
63
|
]);
|
|
55
64
|
const ctx = useMemo(()=>{
|
|
65
|
+
const mergedQueryResults = [
|
|
66
|
+
...transformQueryResults(timeSeriesResults, timeSeriesQueries)
|
|
67
|
+
];
|
|
56
68
|
return {
|
|
57
|
-
queryResults:
|
|
58
|
-
isFetching:
|
|
59
|
-
isLoading:
|
|
69
|
+
queryResults: mergedQueryResults,
|
|
70
|
+
isFetching: mergedQueryResults.some((result)=>result.isFetching),
|
|
71
|
+
isLoading: mergedQueryResults.some((result)=>result.isLoading),
|
|
60
72
|
refetchAll,
|
|
61
|
-
errors:
|
|
73
|
+
errors: mergedQueryResults.map((result)=>result.error)
|
|
62
74
|
};
|
|
63
75
|
}, [
|
|
64
|
-
|
|
65
|
-
|
|
76
|
+
timeSeriesQueries,
|
|
77
|
+
timeSeriesResults,
|
|
66
78
|
refetchAll
|
|
67
79
|
]);
|
|
68
80
|
return /*#__PURE__*/ _jsx(DataQueriesContext.Provider, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/runtime/DataQueriesProvider/DataQueriesProvider.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 { createContext, useCallback, useContext, useMemo } from 'react';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../src/runtime/DataQueriesProvider/DataQueriesProvider.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 { createContext, useCallback, useContext, useMemo } from 'react';\nimport { QueryType, TimeSeriesQueryDefinition } from '@perses-dev/core';\nimport { useTimeSeriesQueries } from '../time-series-queries';\nimport {\n DataQueriesProviderProps,\n UseDataQueryResults,\n transformQueryResults,\n DataQueriesContextType,\n QueryData,\n useQueryType,\n} from './model';\n\nexport const DataQueriesContext = createContext<DataQueriesContextType | undefined>(undefined);\n\nexport function useDataQueriesContext() {\n const ctx = useContext(DataQueriesContext);\n if (ctx === undefined) {\n throw new Error('No DataQueriesContext found. Did you forget a Provider?');\n }\n return ctx;\n}\n\nexport function useDataQueries<T extends keyof QueryType>(queryType: T): UseDataQueryResults<QueryType[T]> {\n const ctx = useDataQueriesContext();\n\n // Filter the query results based on the specified query type\n const filteredQueryResults = ctx.queryResults.filter(\n (queryResult) => queryResult.definition.kind === queryType\n ) as Array<QueryData<QueryType[T]>>;\n\n // Filter the errors based on the specified query type\n const filteredErrors = ctx.errors.filter((errors, index) => ctx.queryResults[index]?.definition.kind === queryType);\n\n // Create a new context object with the filtered results and errors\n const filteredCtx = {\n queryResults: filteredQueryResults,\n isFetching: filteredQueryResults.some((result) => result.isFetching),\n isLoading: filteredQueryResults.some((result) => result.isLoading),\n refetchAll: ctx.refetchAll,\n errors: filteredErrors,\n };\n\n return filteredCtx;\n}\n\nexport function DataQueriesProvider(props: DataQueriesProviderProps) {\n const { definitions, options, children } = props;\n\n const getQueryType = useQueryType();\n\n const queryDefinitions = definitions.map((definition) => {\n const type = getQueryType(definition.kind);\n return {\n kind: type,\n spec: {\n plugin: definition,\n },\n };\n });\n\n // Filter definitions for time series query and other future query plugins\n const timeSeriesQueries = queryDefinitions.filter(\n (definition) => definition.kind === 'TimeSeriesQuery'\n ) as TimeSeriesQueryDefinition[];\n const timeSeriesResults = useTimeSeriesQueries(timeSeriesQueries, options);\n\n const refetchAll = useCallback(() => {\n timeSeriesResults.forEach((result) => result.refetch());\n }, [timeSeriesResults]);\n\n const ctx = useMemo(() => {\n const mergedQueryResults = [...transformQueryResults(timeSeriesResults, timeSeriesQueries)];\n\n return {\n queryResults: mergedQueryResults,\n isFetching: mergedQueryResults.some((result) => result.isFetching),\n isLoading: mergedQueryResults.some((result) => result.isLoading),\n refetchAll,\n errors: mergedQueryResults.map((result) => result.error),\n };\n }, [timeSeriesQueries, timeSeriesResults, refetchAll]);\n\n return <DataQueriesContext.Provider value={ctx}>{children}</DataQueriesContext.Provider>;\n}\n"],"names":["createContext","useCallback","useContext","useMemo","useTimeSeriesQueries","transformQueryResults","useQueryType","DataQueriesContext","undefined","useDataQueriesContext","ctx","Error","useDataQueries","queryType","filteredQueryResults","queryResults","filter","queryResult","definition","kind","filteredErrors","errors","index","filteredCtx","isFetching","some","result","isLoading","refetchAll","DataQueriesProvider","props","definitions","options","children","getQueryType","queryDefinitions","map","type","spec","plugin","timeSeriesQueries","timeSeriesResults","forEach","refetch","mergedQueryResults","error","Provider","value"],"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,aAAa,EAAEC,WAAW,EAAEC,UAAU,EAAEC,OAAO,QAAQ,OAAO,CAAC;AAExE,SAASC,oBAAoB,QAAQ,wBAAwB,CAAC;AAC9D,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,EAAEiB,kBAAkB,CAACnB,IAAI,CAAC,CAACC,MAAM,GAAKA,MAAM,CAACC,SAAS,CAAC;YAChEC,UAAU;YACVP,MAAM,EAAEuB,kBAAkB,CAACR,GAAG,CAAC,CAACV,MAAM,GAAKA,MAAM,CAACmB,KAAK,CAAC;SACzD,CAAC;IACJ,CAAC,EAAE;QAACL,iBAAiB;QAAEC,iBAAiB;QAAEb,UAAU;KAAC,CAAC,AAAC;IAEvD,qBAAO,KAACrB,kBAAkB,CAACuC,QAAQ;QAACC,KAAK,EAAErC,GAAG;kBAAGuB,QAAQ;MAA+B,CAAC;AAC3F,CAAC"}
|
|
@@ -1,27 +1,31 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { Definition,
|
|
2
|
+
import { Definition, QueryDefinition, UnknownSpec, QueryDataType } from '@perses-dev/core';
|
|
3
|
+
import { UseQueryResult } from '@tanstack/react-query';
|
|
3
4
|
declare type QueryOptions = Record<string, unknown>;
|
|
4
|
-
interface
|
|
5
|
-
definitions:
|
|
6
|
-
}
|
|
7
|
-
export interface DataQueriesProviderProps<QueryPluginDefinition = Definition<UnknownSpec>> extends DataQueriesDefinitions<QueryPluginDefinition> {
|
|
5
|
+
export interface DataQueriesProviderProps<QueryPluginSpec = UnknownSpec> {
|
|
6
|
+
definitions: Array<Definition<QueryPluginSpec>>;
|
|
8
7
|
options?: QueryOptions;
|
|
9
8
|
children?: React.ReactNode;
|
|
10
9
|
}
|
|
11
|
-
export interface
|
|
12
|
-
queryResults:
|
|
10
|
+
export interface DataQueriesContextType {
|
|
11
|
+
queryResults: QueryData[];
|
|
13
12
|
refetchAll: () => void;
|
|
14
13
|
isFetching: boolean;
|
|
15
14
|
isLoading: boolean;
|
|
16
15
|
errors: unknown[];
|
|
17
16
|
}
|
|
18
|
-
export interface
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
export interface UseDataQueryResults<T> extends Omit<DataQueriesContextType, 'queryResults'> {
|
|
18
|
+
queryResults: Array<QueryData<T>>;
|
|
19
|
+
}
|
|
20
|
+
export declare type QueryData<T = QueryDataType> = {
|
|
21
|
+
data?: T;
|
|
22
|
+
definition: QueryDefinition;
|
|
21
23
|
error: unknown;
|
|
22
24
|
isFetching: boolean;
|
|
23
25
|
isLoading: boolean;
|
|
24
26
|
refetch?: () => void;
|
|
25
|
-
}
|
|
27
|
+
};
|
|
28
|
+
export declare function transformQueryResults(results: UseQueryResult[], definitions: QueryDefinition[]): QueryData<import("@perses-dev/core").TimeSeriesData>[];
|
|
29
|
+
export declare function useQueryType(): (pluginKind: string) => string | undefined;
|
|
26
30
|
export {};
|
|
27
31
|
//# sourceMappingURL=model.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../src/runtime/DataQueriesProvider/model.ts"],"names":[],"mappings":";AAaA,OAAO,EAAE,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../src/runtime/DataQueriesProvider/model.ts"],"names":[],"mappings":";AAaA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC3F,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAIvD,aAAK,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC5C,MAAM,WAAW,wBAAwB,CAAC,eAAe,GAAG,WAAW;IACrE,WAAW,EAAE,KAAK,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC,CAAC;IAChD,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,MAAM,WAAW,sBAAsB;IACrC,YAAY,EAAE,SAAS,EAAE,CAAC;IAC1B,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,OAAO,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,mBAAmB,CAAC,CAAC,CAAE,SAAQ,IAAI,CAAC,sBAAsB,EAAE,cAAc,CAAC;IAC1F,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;CACnC;AAED,oBAAY,SAAS,CAAC,CAAC,GAAG,aAAa,IAAI;IACzC,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,UAAU,EAAE,eAAe,CAAC;IAC5B,KAAK,EAAE,OAAO,CAAC;IACf,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAEF,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,cAAc,EAAE,EAAE,WAAW,EAAE,eAAe,EAAE,0DAW9F;AAED,wBAAgB,YAAY,IAAI,CAAC,UAAU,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAmCzE"}
|
|
@@ -10,6 +10,52 @@
|
|
|
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
|
-
|
|
13
|
+
import { useCallback, useMemo } from 'react';
|
|
14
|
+
import { useListPluginMetadata } from '../plugin-registry';
|
|
15
|
+
export function transformQueryResults(results, definitions) {
|
|
16
|
+
return results.map(({ data , isFetching , isLoading , refetch , error }, i)=>{
|
|
17
|
+
return {
|
|
18
|
+
definition: definitions[i],
|
|
19
|
+
data,
|
|
20
|
+
isFetching,
|
|
21
|
+
isLoading,
|
|
22
|
+
refetch,
|
|
23
|
+
error
|
|
24
|
+
};
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
export function useQueryType() {
|
|
28
|
+
const { data: timeSeriesQueryPlugins , isLoading } = useListPluginMetadata('TimeSeriesQuery');
|
|
29
|
+
const queryTypeMap = useMemo(()=>{
|
|
30
|
+
const map = {
|
|
31
|
+
TimeSeriesQuery: []
|
|
32
|
+
};
|
|
33
|
+
if (timeSeriesQueryPlugins) {
|
|
34
|
+
timeSeriesQueryPlugins.forEach((plugin)=>{
|
|
35
|
+
var ref;
|
|
36
|
+
(ref = map['TimeSeriesQuery']) === null || ref === void 0 ? void 0 : ref.push(plugin.kind);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
return map;
|
|
40
|
+
}, [
|
|
41
|
+
timeSeriesQueryPlugins
|
|
42
|
+
]);
|
|
43
|
+
const getQueryType = useCallback((pluginKind)=>{
|
|
44
|
+
if (isLoading) {
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
for(const queryType in queryTypeMap){
|
|
48
|
+
var ref;
|
|
49
|
+
if ((ref = queryTypeMap[queryType]) === null || ref === void 0 ? void 0 : ref.includes(pluginKind)) {
|
|
50
|
+
return queryType;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
throw new Error(`Unable to determine the query type: ${pluginKind}`);
|
|
54
|
+
}, [
|
|
55
|
+
queryTypeMap,
|
|
56
|
+
isLoading
|
|
57
|
+
]);
|
|
58
|
+
return getQueryType;
|
|
59
|
+
}
|
|
14
60
|
|
|
15
61
|
//# sourceMappingURL=model.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/runtime/DataQueriesProvider/model.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 { Definition,
|
|
1
|
+
{"version":3,"sources":["../../../src/runtime/DataQueriesProvider/model.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 { Definition, QueryDefinition, UnknownSpec, QueryDataType } from '@perses-dev/core';\nimport { UseQueryResult } from '@tanstack/react-query';\nimport { useCallback, useMemo } from 'react';\nimport { useListPluginMetadata } from '../plugin-registry';\n\ntype QueryOptions = Record<string, unknown>;\nexport interface DataQueriesProviderProps<QueryPluginSpec = UnknownSpec> {\n definitions: Array<Definition<QueryPluginSpec>>;\n options?: QueryOptions;\n children?: React.ReactNode;\n}\n\nexport interface DataQueriesContextType {\n queryResults: QueryData[];\n refetchAll: () => void;\n isFetching: boolean;\n isLoading: boolean;\n errors: unknown[];\n}\n\nexport interface UseDataQueryResults<T> extends Omit<DataQueriesContextType, 'queryResults'> {\n queryResults: Array<QueryData<T>>;\n}\n\nexport type QueryData<T = QueryDataType> = {\n data?: T;\n definition: QueryDefinition;\n error: unknown;\n isFetching: boolean;\n isLoading: boolean;\n refetch?: () => void;\n};\n\nexport function transformQueryResults(results: UseQueryResult[], definitions: QueryDefinition[]) {\n return results.map(({ data, isFetching, isLoading, refetch, error }, i) => {\n return {\n definition: definitions[i],\n data,\n isFetching,\n isLoading,\n refetch,\n error,\n } as QueryData;\n });\n}\n\nexport function useQueryType(): (pluginKind: string) => string | undefined {\n const { data: timeSeriesQueryPlugins, isLoading } = useListPluginMetadata('TimeSeriesQuery');\n\n const queryTypeMap = useMemo(() => {\n const map: Record<string, string[]> = {\n TimeSeriesQuery: [],\n };\n\n if (timeSeriesQueryPlugins) {\n timeSeriesQueryPlugins.forEach((plugin) => {\n map['TimeSeriesQuery']?.push(plugin.kind);\n });\n }\n\n return map;\n }, [timeSeriesQueryPlugins]);\n\n const getQueryType = useCallback(\n (pluginKind: string) => {\n if (isLoading) {\n return undefined;\n }\n\n for (const queryType in queryTypeMap) {\n if (queryTypeMap[queryType]?.includes(pluginKind)) {\n return queryType;\n }\n }\n\n throw new Error(`Unable to determine the query type: ${pluginKind}`);\n },\n [queryTypeMap, isLoading]\n );\n\n return getQueryType;\n}\n"],"names":["useCallback","useMemo","useListPluginMetadata","transformQueryResults","results","definitions","map","data","isFetching","isLoading","refetch","error","i","definition","useQueryType","timeSeriesQueryPlugins","queryTypeMap","TimeSeriesQuery","forEach","plugin","push","kind","getQueryType","pluginKind","undefined","queryType","includes","Error"],"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,SAASA,WAAW,EAAEC,OAAO,QAAQ,OAAO,CAAC;AAC7C,SAASC,qBAAqB,QAAQ,oBAAoB,CAAC;AA8B3D,OAAO,SAASC,qBAAqB,CAACC,OAAyB,EAAEC,WAA8B,EAAE;IAC/F,OAAOD,OAAO,CAACE,GAAG,CAAC,CAAC,EAAEC,IAAI,CAAA,EAAEC,UAAU,CAAA,EAAEC,SAAS,CAAA,EAAEC,OAAO,CAAA,EAAEC,KAAK,CAAA,EAAE,EAAEC,CAAC,GAAK;QACzE,OAAO;YACLC,UAAU,EAAER,WAAW,CAACO,CAAC,CAAC;YAC1BL,IAAI;YACJC,UAAU;YACVC,SAAS;YACTC,OAAO;YACPC,KAAK;SACN,CAAc;IACjB,CAAC,CAAC,CAAC;AACL,CAAC;AAED,OAAO,SAASG,YAAY,GAA+C;IACzE,MAAM,EAAEP,IAAI,EAAEQ,sBAAsB,CAAA,EAAEN,SAAS,CAAA,EAAE,GAAGP,qBAAqB,CAAC,iBAAiB,CAAC,AAAC;IAE7F,MAAMc,YAAY,GAAGf,OAAO,CAAC,IAAM;QACjC,MAAMK,GAAG,GAA6B;YACpCW,eAAe,EAAE,EAAE;SACpB,AAAC;QAEF,IAAIF,sBAAsB,EAAE;YAC1BA,sBAAsB,CAACG,OAAO,CAAC,CAACC,MAAM,GAAK;oBACzCb,GAAsB;gBAAtBA,CAAAA,GAAsB,GAAtBA,GAAG,CAAC,iBAAiB,CAAC,cAAtBA,GAAsB,WAAM,GAA5BA,KAAAA,CAA4B,GAA5BA,GAAsB,CAAEc,IAAI,CAACD,MAAM,CAACE,IAAI,CAAC,CAAC;YAC5C,CAAC,CAAC,CAAC;QACL,CAAC;QAED,OAAOf,GAAG,CAAC;IACb,CAAC,EAAE;QAACS,sBAAsB;KAAC,CAAC,AAAC;IAE7B,MAAMO,YAAY,GAAGtB,WAAW,CAC9B,CAACuB,UAAkB,GAAK;QACtB,IAAId,SAAS,EAAE;YACb,OAAOe,SAAS,CAAC;QACnB,CAAC;QAED,IAAK,MAAMC,SAAS,IAAIT,YAAY,CAAE;gBAChCA,GAAuB;YAA3B,IAAIA,CAAAA,GAAuB,GAAvBA,YAAY,CAACS,SAAS,CAAC,cAAvBT,GAAuB,WAAU,GAAjCA,KAAAA,CAAiC,GAAjCA,GAAuB,CAAEU,QAAQ,CAACH,UAAU,CAAC,EAAE;gBACjD,OAAOE,SAAS,CAAC;YACnB,CAAC;QACH,CAAC;QAED,MAAM,IAAIE,KAAK,CAAC,CAAC,oCAAoC,EAAEJ,UAAU,CAAC,CAAC,CAAC,CAAC;IACvE,CAAC,EACD;QAACP,YAAY;QAAEP,SAAS;KAAC,CAC1B,AAAC;IAEF,OAAOa,YAAY,CAAC;AACtB,CAAC"}
|
|
@@ -1,13 +1,72 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
2
|
+
import { VariableValue } from '@perses-dev/core';
|
|
3
|
+
import { immerable } from 'immer';
|
|
3
4
|
import { VariableOption } from '../model';
|
|
4
5
|
export declare type VariableState = {
|
|
5
6
|
value: VariableValue;
|
|
6
7
|
options?: VariableOption[];
|
|
7
8
|
loading: boolean;
|
|
8
9
|
error?: Error;
|
|
10
|
+
/**
|
|
11
|
+
* If a local variable is overriding an external variable, local var will have the flag ``overriding=true``.
|
|
12
|
+
*/
|
|
13
|
+
overriding?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* If a local variable is overriding an external variable, external var will have the flag ``overridden=true``.
|
|
16
|
+
*/
|
|
17
|
+
overridden?: boolean;
|
|
18
|
+
default_value?: VariableValue;
|
|
9
19
|
};
|
|
10
|
-
export declare type VariableStateMap = Record<
|
|
20
|
+
export declare type VariableStateMap = Record<string, VariableState>;
|
|
21
|
+
/**
|
|
22
|
+
* Structure used as key in the {@link VariableStoreStateMap}.
|
|
23
|
+
*/
|
|
24
|
+
export declare type VariableStateKey = {
|
|
25
|
+
/**
|
|
26
|
+
* name of the variable we want to access in the state.
|
|
27
|
+
*/
|
|
28
|
+
name: string;
|
|
29
|
+
/**
|
|
30
|
+
* source of the variable we want to access in the state.
|
|
31
|
+
* Defined only for external variables.
|
|
32
|
+
*/
|
|
33
|
+
source?: string;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* A state map with two entry keys, materialized by {@link VariableStateKey} structure.
|
|
37
|
+
*/
|
|
38
|
+
export declare class VariableStoreStateMap {
|
|
39
|
+
/**
|
|
40
|
+
* "Immerable" is mandatory to be able to use this class in an immer context.
|
|
41
|
+
* Ref: https://docs.pmnd.rs/zustand/integrations/immer-middleware#gotchas
|
|
42
|
+
*/
|
|
43
|
+
[immerable]: boolean;
|
|
44
|
+
private readonly DEFAULT_LOCAL_SOURCE_NAME;
|
|
45
|
+
private readonly _state;
|
|
46
|
+
/**
|
|
47
|
+
* Get variable state by key.
|
|
48
|
+
* @param key
|
|
49
|
+
*/
|
|
50
|
+
get(key: VariableStateKey): VariableState | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* Set variable state by key.
|
|
53
|
+
* @param key
|
|
54
|
+
* @param value
|
|
55
|
+
*/
|
|
56
|
+
set(key: VariableStateKey, value: VariableState): VariableState | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* Check presence of variable state by key.
|
|
59
|
+
* @param key
|
|
60
|
+
*/
|
|
61
|
+
has(key: VariableStateKey): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Delete variable state by key.
|
|
64
|
+
* @param key
|
|
65
|
+
*/
|
|
66
|
+
delete(key: VariableStateKey): boolean;
|
|
67
|
+
private _sourceName;
|
|
68
|
+
private _sourceStatesOrEmpty;
|
|
69
|
+
}
|
|
11
70
|
export declare type TemplateVariableSrv = {
|
|
12
71
|
state: VariableStateMap;
|
|
13
72
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template-variables.d.ts","sourceRoot":"","sources":["../../src/runtime/template-variables.ts"],"names":[],"mappings":";AAcA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"template-variables.d.ts","sourceRoot":"","sources":["../../src/runtime/template-variables.ts"],"names":[],"mappings":";AAcA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG1C,oBAAY,aAAa,GAAG;IAC1B,KAAK,EAAE,aAAa,CAAC;IACrB,OAAO,CAAC,EAAE,cAAc,EAAE,CAAC;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B,CAAC;AAEF,oBAAY,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;AAE7D;;GAEG;AACH,oBAAY,gBAAgB,GAAG;IAC7B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;GAEG;AACH,qBAAa,qBAAqB;IAChC;;;OAGG;IACH,CAAC,SAAS,CAAC,UAAQ;IAEnB,OAAO,CAAC,QAAQ,CAAC,yBAAyB,CAAM;IAChD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAqD;IAE5E;;;OAGG;IACH,GAAG,CAAC,GAAG,EAAE,gBAAgB,GAAG,aAAa,GAAG,SAAS;IAIrD;;;;OAIG;IACH,GAAG,CAAC,GAAG,EAAE,gBAAgB,EAAE,KAAK,EAAE,aAAa,GAAG,aAAa,GAAG,SAAS;IAS3E;;;OAGG;IACH,GAAG,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO;IAInC;;;OAGG;IACH,MAAM,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO;IAiBtC,OAAO,CAAC,WAAW;IAInB,OAAO,CAAC,oBAAoB;CAG7B;AAED,oBAAY,mBAAmB,GAAG;IAChC,KAAK,EAAE,gBAAgB,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,uBAAuB,0DAA4D,CAAC;AAUjG,wBAAgB,yBAAyB,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,oBAmBzD;AAGD,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAKvF"}
|
|
@@ -11,7 +11,70 @@
|
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
13
|
import { createContext, useContext, useMemo } from 'react';
|
|
14
|
+
import { immerable } from 'immer';
|
|
14
15
|
import { parseTemplateVariables, replaceTemplateVariables } from '../utils';
|
|
16
|
+
let _immerable = immerable;
|
|
17
|
+
/**
|
|
18
|
+
* A state map with two entry keys, materialized by {@link VariableStateKey} structure.
|
|
19
|
+
*/ export class VariableStoreStateMap {
|
|
20
|
+
/**
|
|
21
|
+
* Get variable state by key.
|
|
22
|
+
* @param key
|
|
23
|
+
*/ get(key) {
|
|
24
|
+
return this._sourceStatesOrEmpty(key.source)[key.name];
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Set variable state by key.
|
|
28
|
+
* @param key
|
|
29
|
+
* @param value
|
|
30
|
+
*/ set(key, value) {
|
|
31
|
+
const sourceName = this._sourceName(key.source);
|
|
32
|
+
if (!this._state[sourceName]) {
|
|
33
|
+
this._state[sourceName] = {};
|
|
34
|
+
}
|
|
35
|
+
this._sourceStatesOrEmpty(key.source)[key.name] = value;
|
|
36
|
+
return value;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Check presence of variable state by key.
|
|
40
|
+
* @param key
|
|
41
|
+
*/ has(key) {
|
|
42
|
+
return this._sourceStatesOrEmpty(key.source)[key.name] !== undefined;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Delete variable state by key.
|
|
46
|
+
* @param key
|
|
47
|
+
*/ delete(key) {
|
|
48
|
+
var ref;
|
|
49
|
+
const result = this.has(key);
|
|
50
|
+
const sourceName = this._sourceName(key.source);
|
|
51
|
+
const sourceStates = this._state[sourceName];
|
|
52
|
+
// Delete var from source state
|
|
53
|
+
if (sourceStates) {
|
|
54
|
+
delete sourceStates[key.name];
|
|
55
|
+
}
|
|
56
|
+
// Delete source state from state if empty
|
|
57
|
+
if (((ref = Object.keys(sourceStates !== null && sourceStates !== void 0 ? sourceStates : {})) === null || ref === void 0 ? void 0 : ref.length) === 0) {
|
|
58
|
+
delete this._state[sourceName];
|
|
59
|
+
}
|
|
60
|
+
return result;
|
|
61
|
+
}
|
|
62
|
+
_sourceName(source) {
|
|
63
|
+
return source !== null && source !== void 0 ? source : this.DEFAULT_LOCAL_SOURCE_NAME;
|
|
64
|
+
}
|
|
65
|
+
_sourceStatesOrEmpty(source) {
|
|
66
|
+
var ref;
|
|
67
|
+
return (ref = this._state[this._sourceName(source)]) !== null && ref !== void 0 ? ref : {};
|
|
68
|
+
}
|
|
69
|
+
constructor(){
|
|
70
|
+
/**
|
|
71
|
+
* "Immerable" is mandatory to be able to use this class in an immer context.
|
|
72
|
+
* Ref: https://docs.pmnd.rs/zustand/integrations/immer-middleware#gotchas
|
|
73
|
+
*/ this[_immerable] = true;
|
|
74
|
+
this.DEFAULT_LOCAL_SOURCE_NAME = '';
|
|
75
|
+
this._state = {};
|
|
76
|
+
}
|
|
77
|
+
}
|
|
15
78
|
export const TemplateVariableContext = createContext(undefined);
|
|
16
79
|
function useTemplateVariableContext() {
|
|
17
80
|
const ctx = useContext(TemplateVariableContext);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/runtime/template-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 { createContext, useContext, useMemo } from 'react';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../src/runtime/template-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 { createContext, useContext, useMemo } from 'react';\nimport { VariableValue } from '@perses-dev/core';\nimport { immerable } from 'immer';\nimport { VariableOption } from '../model';\nimport { parseTemplateVariables, replaceTemplateVariables } from '../utils';\n\nexport type VariableState = {\n value: VariableValue;\n options?: VariableOption[];\n loading: boolean;\n error?: Error;\n /**\n * If a local variable is overriding an external variable, local var will have the flag ``overriding=true``.\n */\n overriding?: boolean;\n /**\n * If a local variable is overriding an external variable, external var will have the flag ``overridden=true``.\n */\n overridden?: boolean;\n default_value?: VariableValue;\n};\n\nexport type VariableStateMap = Record<string, VariableState>;\n\n/**\n * Structure used as key in the {@link VariableStoreStateMap}.\n */\nexport type VariableStateKey = {\n /**\n * name of the variable we want to access in the state.\n */\n name: string;\n /**\n * source of the variable we want to access in the state.\n * Defined only for external variables.\n */\n source?: string;\n};\n\n/**\n * A state map with two entry keys, materialized by {@link VariableStateKey} structure.\n */\nexport class VariableStoreStateMap {\n /**\n * \"Immerable\" is mandatory to be able to use this class in an immer context.\n * Ref: https://docs.pmnd.rs/zustand/integrations/immer-middleware#gotchas\n */\n [immerable] = true;\n\n private readonly DEFAULT_LOCAL_SOURCE_NAME = '';\n private readonly _state: Record<string, Record<string, VariableState>> = {};\n\n /**\n * Get variable state by key.\n * @param key\n */\n get(key: VariableStateKey): VariableState | undefined {\n return this._sourceStatesOrEmpty(key.source)[key.name];\n }\n\n /**\n * Set variable state by key.\n * @param key\n * @param value\n */\n set(key: VariableStateKey, value: VariableState): VariableState | undefined {\n const sourceName = this._sourceName(key.source);\n if (!this._state[sourceName]) {\n this._state[sourceName] = {};\n }\n this._sourceStatesOrEmpty(key.source)[key.name] = value;\n return value;\n }\n\n /**\n * Check presence of variable state by key.\n * @param key\n */\n has(key: VariableStateKey): boolean {\n return this._sourceStatesOrEmpty(key.source)[key.name] !== undefined;\n }\n\n /**\n * Delete variable state by key.\n * @param key\n */\n delete(key: VariableStateKey): boolean {\n const result = this.has(key);\n const sourceName = this._sourceName(key.source);\n const sourceStates = this._state[sourceName];\n\n // Delete var from source state\n if (sourceStates) {\n delete sourceStates[key.name];\n }\n\n // Delete source state from state if empty\n if (Object.keys(sourceStates ?? {})?.length === 0) {\n delete this._state[sourceName];\n }\n return result;\n }\n\n private _sourceName(source: string | undefined): string {\n return source ?? this.DEFAULT_LOCAL_SOURCE_NAME;\n }\n\n private _sourceStatesOrEmpty(source: string | undefined): Record<string, VariableState> {\n return this._state[this._sourceName(source)] ?? {};\n }\n}\n\nexport type TemplateVariableSrv = {\n state: VariableStateMap;\n};\n\nexport const TemplateVariableContext = createContext<TemplateVariableSrv | undefined>(undefined);\n\nfunction useTemplateVariableContext() {\n const ctx = useContext(TemplateVariableContext);\n if (ctx === undefined) {\n throw new Error('No TemplateVariableContext found. Did you forget a Provider?');\n }\n return ctx;\n}\n\nexport function useTemplateVariableValues(names?: string[]) {\n const { state } = useTemplateVariableContext();\n\n const values = useMemo(() => {\n const values: VariableStateMap = {};\n names?.forEach((name) => {\n const s = state[name];\n if (s) {\n values[name] = s;\n }\n });\n return values;\n }, [state, names]);\n\n if (names === undefined) {\n return state;\n }\n\n return values;\n}\n\n// Convenience hook for replacing template variables in a string\nexport function useReplaceVariablesInString(str: string | undefined): string | undefined {\n const variablesInString = str ? parseTemplateVariables(str) : [];\n const variableValues = useTemplateVariableValues(variablesInString);\n if (!str) return undefined;\n return replaceTemplateVariables(str, variableValues);\n}\n"],"names":["createContext","useContext","useMemo","immerable","parseTemplateVariables","replaceTemplateVariables","VariableStoreStateMap","get","key","_sourceStatesOrEmpty","source","name","set","value","sourceName","_sourceName","_state","has","undefined","delete","Object","result","sourceStates","keys","length","DEFAULT_LOCAL_SOURCE_NAME","TemplateVariableContext","useTemplateVariableContext","ctx","Error","useTemplateVariableValues","names","state","values","forEach","s","useReplaceVariablesInString","str","variablesInString","variableValues"],"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,aAAa,EAAEC,UAAU,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D,MAAM,EAAEC,KAAK,CAAA,EAAE,GAAGL,0BAA0B,EAAE,AAAC;IAE/C,MAAMM,MAAM,GAAG/B,OAAO,CAAC,IAAM;QAC3B,MAAM+B,MAAM,GAAqB,EAAE,AAAC;QACpCF,KAAK,aAALA,KAAK,WAAS,GAAdA,KAAAA,CAAc,GAAdA,KAAK,CAAEG,OAAO,CAAC,CAACvB,IAAI,GAAK;YACvB,MAAMwB,CAAC,GAAGH,KAAK,CAACrB,IAAI,CAAC,AAAC;YACtB,IAAIwB,CAAC,EAAE;gBACLF,MAAM,CAACtB,IAAI,CAAC,GAAGwB,CAAC,CAAC;YACnB,CAAC;QACH,CAAC,CAAC,CAAC;QACH,OAAOF,MAAM,CAAC;IAChB,CAAC,EAAE;QAACD,KAAK;QAAED,KAAK;KAAC,CAAC,AAAC;IAEnB,IAAIA,KAAK,KAAKb,SAAS,EAAE;QACvB,OAAOc,KAAK,CAAC;IACf,CAAC;IAED,OAAOC,MAAM,CAAC;AAChB,CAAC;AAED,gEAAgE;AAChE,OAAO,SAASG,2BAA2B,CAACC,GAAuB,EAAsB;IACvF,MAAMC,iBAAiB,GAAGD,GAAG,GAAGjC,sBAAsB,CAACiC,GAAG,CAAC,GAAG,EAAE,AAAC;IACjE,MAAME,cAAc,GAAGT,yBAAyB,CAACQ,iBAAiB,CAAC,AAAC;IACpE,IAAI,CAACD,GAAG,EAAE,OAAOnB,SAAS,CAAC;IAC3B,OAAOb,wBAAwB,CAACgC,GAAG,EAAEE,cAAc,CAAC,CAAC;AACvD,CAAC"}
|
package/dist/test/index.d.ts
CHANGED
package/dist/test/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/test/index.ts"],"names":[],"mappings":"AAaA,cAAc,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/test/index.ts"],"names":[],"mappings":"AAaA,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC"}
|
package/dist/test/index.js
CHANGED
package/dist/test/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/test/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 './render';\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,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"sources":["../../src/test/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 './render';\nexport * from './mock-data';\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,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC"}
|