@perses-dev/explore 0.52.0-rc.0 → 0.52.0-rc.1

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.
@@ -36,7 +36,7 @@ function ExplorerManagerProvider({ children, store: externalStore }) {
36
36
  const [explorerStateCache, setExplorerStateCache] = (0, _react.useState)({});
37
37
  // local store in case external store is not provided by prop
38
38
  const localStore = (0, _react.useState)({
39
- explorer: undefined,
39
+ explorer: null,
40
40
  data: {}
41
41
  });
42
42
  // use store provided by 'store' prop if available, otherwise use local store
@@ -14,27 +14,36 @@
14
14
  Object.defineProperty(exports, "__esModule", {
15
15
  value: true
16
16
  });
17
- Object.defineProperty(exports, "ExplorerManagerProviderWithQueryParams", {
18
- enumerable: true,
19
- get: function() {
17
+ function _export(target, all) {
18
+ for(var name in all)Object.defineProperty(target, name, {
19
+ enumerable: true,
20
+ get: all[name]
21
+ });
22
+ }
23
+ _export(exports, {
24
+ ExplorerManagerProviderWithQueryParams: function() {
20
25
  return ExplorerManagerProviderWithQueryParams;
26
+ },
27
+ parseAsExplorerConfig: function() {
28
+ return parseAsExplorerConfig;
21
29
  }
22
30
  });
23
31
  const _jsxruntime = require("react/jsx-runtime");
24
32
  const _react = /*#__PURE__*/ _interop_require_default(require("react"));
25
- const _usequeryparams = require("use-query-params");
33
+ const _nuqs = require("nuqs");
34
+ const _zod = require("zod");
26
35
  const _ExplorerManagerProvider = require("./ExplorerManagerProvider");
27
36
  function _interop_require_default(obj) {
28
37
  return obj && obj.__esModule ? obj : {
29
38
  default: obj
30
39
  };
31
40
  }
32
- const exploreQueryConfig = {
33
- explorer: (0, _usequeryparams.withDefault)(_usequeryparams.StringParam, undefined),
34
- data: (0, _usequeryparams.withDefault)(_usequeryparams.JsonParam, {})
41
+ const parseAsExplorerConfig = {
42
+ explorer: _nuqs.parseAsString,
43
+ data: (0, _nuqs.parseAsJson)(_zod.z.unknown())
35
44
  };
36
45
  function ExplorerManagerProviderWithQueryParams({ children }) {
37
- const [queryParams, setQueryParams] = (0, _usequeryparams.useQueryParams)(exploreQueryConfig);
46
+ const [queryParams, setQueryParams] = (0, _nuqs.useQueryStates)(parseAsExplorerConfig);
38
47
  return /*#__PURE__*/ (0, _jsxruntime.jsx)(_ExplorerManagerProvider.ExplorerManagerProvider, {
39
48
  store: [
40
49
  queryParams,
@@ -16,6 +16,7 @@ Object.defineProperty(exports, "__esModule", {
16
16
  });
17
17
  _export_star(require("./ExploreManager"), exports);
18
18
  _export_star(require("./ExplorerManagerProvider"), exports);
19
+ _export_star(require("./ExplorerManagerProviderWithQueryParams"), exports);
19
20
  _export_star(require("./query-params"), exports);
20
21
  function _export_star(from, to) {
21
22
  Object.keys(from).forEach(function(k) {
@@ -21,29 +21,30 @@ function _export(target, all) {
21
21
  });
22
22
  }
23
23
  _export(exports, {
24
- explorerQueryConfig: function() {
25
- return explorerQueryConfig;
24
+ parseAsExplorerQueryConfig: function() {
25
+ return parseAsExplorerQueryConfig;
26
26
  },
27
27
  useExplorerQueryParams: function() {
28
28
  return useExplorerQueryParams;
29
29
  }
30
30
  });
31
- const _usequeryparams = require("use-query-params");
31
+ const _nuqs = require("nuqs");
32
32
  const _pluginsystem = require("@perses-dev/plugin-system");
33
- const _qs = require("qs");
34
- const explorerQueryConfig = {
35
- refresh: _pluginsystem.TimeRangeParam,
36
- start: _pluginsystem.TimeRangeParam,
37
- end: _pluginsystem.TimeRangeParam,
38
- explorer: _usequeryparams.StringParam,
39
- data: _usequeryparams.JsonParam
33
+ const _zod = require("zod");
34
+ const parseAsExplorerQueryConfig = {
35
+ refresh: _pluginsystem.parseAsTimeRangeValue,
36
+ start: _pluginsystem.parseAsTimeRangeValue,
37
+ end: _pluginsystem.parseAsTimeRangeValue,
38
+ explorer: _nuqs.parseAsString,
39
+ data: (0, _nuqs.parseAsJson)(_zod.z.unknown())
40
40
  };
41
41
  function useExplorerQueryParams(inputs) {
42
- const [query] = (0, _usequeryparams.useQueryParams)(explorerQueryConfig, {
43
- updateType: 'replaceIn'
42
+ const [query] = (0, _nuqs.useQueryStates)(parseAsExplorerQueryConfig, {
43
+ history: 'replace'
44
44
  });
45
- return (0, _qs.stringify)((0, _usequeryparams.encodeQueryParams)(explorerQueryConfig, {
45
+ const serialize = (0, _nuqs.createSerializer)(parseAsExplorerQueryConfig);
46
+ return serialize({
46
47
  ...query,
47
48
  ...inputs
48
- }));
49
+ });
49
50
  }
@@ -1,11 +1,11 @@
1
1
  import { ReactElement, ReactNode } from 'react';
2
2
  interface ExplorerState<T> {
3
- explorer?: string;
3
+ explorer: string | null;
4
4
  data: T;
5
5
  }
6
6
  interface ExplorerManagerContextType<T> {
7
7
  /** observability signal, for example metrics or traces */
8
- explorer?: string;
8
+ explorer: string | null;
9
9
  data: T;
10
10
  setExplorer: (explorer: string) => void;
11
11
  setData: (data: T) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"ExplorerManagerProvider.d.ts","sourceRoot":"","sources":["../../../src/components/ExploreManager/ExplorerManagerProvider.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAiB,YAAY,EAAE,SAAS,EAAwB,MAAM,OAAO,CAAC;AAErF,UAAU,aAAa,CAAC,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,CAAC,CAAC;CAGT;AAED,UAAU,0BAA0B,CAAC,CAAC;IACpC,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,CAAC,CAAC;IACR,WAAW,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,OAAO,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;CAC5B;AAID,UAAU,4BAA4B;IACpC,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,CAAC,EAAE,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC,CAAC;CAC3E;AAED,wBAAgB,uBAAuB,CAAC,EACtC,QAAQ,EACR,KAAK,EAAE,aAAa,GACrB,EAAE,4BAA4B,GAAG,YAAY,CAgC7C;AAED,wBAAgB,yBAAyB,CAAC,CAAC,KAAK,0BAA0B,CAAC,CAAC,CAAC,CAM5E"}
1
+ {"version":3,"file":"ExplorerManagerProvider.d.ts","sourceRoot":"","sources":["../../../src/components/ExploreManager/ExplorerManagerProvider.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAiB,YAAY,EAAE,SAAS,EAAwB,MAAM,OAAO,CAAC;AAErF,UAAU,aAAa,CAAC,CAAC;IACvB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,IAAI,EAAE,CAAC,CAAC;CACT;AAED,UAAU,0BAA0B,CAAC,CAAC;IACpC,0DAA0D;IAC1D,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,IAAI,EAAE,CAAC,CAAC;IACR,WAAW,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,OAAO,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;CAC5B;AAID,UAAU,4BAA4B;IACpC,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,CAAC,EAAE,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC,CAAC;CAC3E;AAED,wBAAgB,uBAAuB,CAAC,EACtC,QAAQ,EACR,KAAK,EAAE,aAAa,GACrB,EAAE,4BAA4B,GAAG,YAAY,CAgC7C;AAED,wBAAgB,yBAAyB,CAAC,CAAC,KAAK,0BAA0B,CAAC,CAAC,CAAC,CAM5E"}
@@ -18,7 +18,7 @@ export function ExplorerManagerProvider({ children, store: externalStore }) {
18
18
  const [explorerStateCache, setExplorerStateCache] = useState({});
19
19
  // local store in case external store is not provided by prop
20
20
  const localStore = useState({
21
- explorer: undefined,
21
+ explorer: null,
22
22
  data: {}
23
23
  });
24
24
  // use store provided by 'store' prop if available, otherwise use local store
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/ExploreManager/ExplorerManagerProvider.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { createContext, ReactElement, ReactNode, useContext, useState } from 'react';\n\ninterface ExplorerState<T> {\n explorer?: string;\n data: T;\n // tab: number;\n // queries: QueryDefinition[];\n}\n\ninterface ExplorerManagerContextType<T> {\n /** observability signal, for example metrics or traces */\n explorer?: string;\n data: T;\n setExplorer: (explorer: string) => void;\n setData: (data: T) => void;\n}\n\nconst ExplorerManagerContext = createContext<ExplorerManagerContextType<unknown> | undefined>(undefined);\n\ninterface ExplorerManagerProviderProps {\n children: ReactNode;\n store?: [ExplorerState<unknown>, (state: ExplorerState<unknown>) => void];\n}\n\nexport function ExplorerManagerProvider({\n children,\n store: externalStore,\n}: ExplorerManagerProviderProps): ReactElement {\n // cache the state of currently not rendered explore UIs\n const [explorerStateCache, setExplorerStateCache] = useState<\n Record<string, Omit<ExplorerState<unknown>, 'explorer'>>\n >({});\n // local store in case external store is not provided by prop\n const localStore = useState<ExplorerState<unknown>>({ explorer: undefined, data: {} });\n // use store provided by 'store' prop if available, otherwise use local store\n const [explorerState, setExplorerState] = externalStore ? externalStore : localStore;\n const { explorer, data } = explorerState;\n\n function setExplorer(newExplorer: string): void {\n if (explorer) {\n // store current explorer state\n explorerStateCache[explorer] = { data };\n setExplorerStateCache(explorerStateCache);\n }\n\n // restore previous explorer state (if any)\n const state = explorerStateCache[newExplorer] ?? { data: {} };\n setExplorerState({ explorer: newExplorer, data: state.data });\n }\n\n function setData(newData: unknown): void {\n setExplorerState({ explorer, data: newData });\n }\n\n return (\n <ExplorerManagerContext.Provider value={{ explorer, data, setExplorer, setData }}>\n {children}\n </ExplorerManagerContext.Provider>\n );\n}\n\nexport function useExplorerManagerContext<T>(): ExplorerManagerContextType<T> {\n const ctx = useContext(ExplorerManagerContext);\n if (ctx === undefined) {\n throw new Error('No ExplorerManagerContext found. Did you forget a Provider?');\n }\n return ctx as ExplorerManagerContextType<T>;\n}\n"],"names":["createContext","useContext","useState","ExplorerManagerContext","undefined","ExplorerManagerProvider","children","store","externalStore","explorerStateCache","setExplorerStateCache","localStore","explorer","data","explorerState","setExplorerState","setExplorer","newExplorer","state","setData","newData","Provider","value","useExplorerManagerContext","ctx","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;;AAEjC,SAASA,aAAa,EAA2BC,UAAU,EAAEC,QAAQ,QAAQ,QAAQ;AAiBrF,MAAMC,uCAAyBH,cAA+DI;AAO9F,OAAO,SAASC,wBAAwB,EACtCC,QAAQ,EACRC,OAAOC,aAAa,EACS;IAC7B,wDAAwD;IACxD,MAAM,CAACC,oBAAoBC,sBAAsB,GAAGR,SAElD,CAAC;IACH,6DAA6D;IAC7D,MAAMS,aAAaT,SAAiC;QAAEU,UAAUR;QAAWS,MAAM,CAAC;IAAE;IACpF,6EAA6E;IAC7E,MAAM,CAACC,eAAeC,iBAAiB,GAAGP,gBAAgBA,gBAAgBG;IAC1E,MAAM,EAAEC,QAAQ,EAAEC,IAAI,EAAE,GAAGC;IAE3B,SAASE,YAAYC,WAAmB;QACtC,IAAIL,UAAU;YACZ,+BAA+B;YAC/BH,kBAAkB,CAACG,SAAS,GAAG;gBAAEC;YAAK;YACtCH,sBAAsBD;QACxB;QAEA,2CAA2C;QAC3C,MAAMS,QAAQT,kBAAkB,CAACQ,YAAY,IAAI;YAAEJ,MAAM,CAAC;QAAE;QAC5DE,iBAAiB;YAAEH,UAAUK;YAAaJ,MAAMK,MAAML,IAAI;QAAC;IAC7D;IAEA,SAASM,QAAQC,OAAgB;QAC/BL,iBAAiB;YAAEH;YAAUC,MAAMO;QAAQ;IAC7C;IAEA,qBACE,KAACjB,uBAAuBkB,QAAQ;QAACC,OAAO;YAAEV;YAAUC;YAAMG;YAAaG;QAAQ;kBAC5Eb;;AAGP;AAEA,OAAO,SAASiB;IACd,MAAMC,MAAMvB,WAAWE;IACvB,IAAIqB,QAAQpB,WAAW;QACrB,MAAM,IAAIqB,MAAM;IAClB;IACA,OAAOD;AACT"}
1
+ {"version":3,"sources":["../../../src/components/ExploreManager/ExplorerManagerProvider.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { createContext, ReactElement, ReactNode, useContext, useState } from 'react';\n\ninterface ExplorerState<T> {\n explorer: string | null;\n data: T;\n}\n\ninterface ExplorerManagerContextType<T> {\n /** observability signal, for example metrics or traces */\n explorer: string | null;\n data: T;\n setExplorer: (explorer: string) => void;\n setData: (data: T) => void;\n}\n\nconst ExplorerManagerContext = createContext<ExplorerManagerContextType<unknown> | undefined>(undefined);\n\ninterface ExplorerManagerProviderProps {\n children: ReactNode;\n store?: [ExplorerState<unknown>, (state: ExplorerState<unknown>) => void];\n}\n\nexport function ExplorerManagerProvider({\n children,\n store: externalStore,\n}: ExplorerManagerProviderProps): ReactElement {\n // cache the state of currently not rendered explore UIs\n const [explorerStateCache, setExplorerStateCache] = useState<\n Record<string, Omit<ExplorerState<unknown>, 'explorer'>>\n >({});\n // local store in case external store is not provided by prop\n const localStore = useState<ExplorerState<unknown>>({ explorer: null, data: {} });\n // use store provided by 'store' prop if available, otherwise use local store\n const [explorerState, setExplorerState] = externalStore ? externalStore : localStore;\n const { explorer, data } = explorerState;\n\n function setExplorer(newExplorer: string): void {\n if (explorer) {\n // store current explorer state\n explorerStateCache[explorer] = { data };\n setExplorerStateCache(explorerStateCache);\n }\n\n // restore previous explorer state (if any)\n const state = explorerStateCache[newExplorer] ?? { data: {} };\n setExplorerState({ explorer: newExplorer, data: state.data });\n }\n\n function setData(newData: unknown): void {\n setExplorerState({ explorer, data: newData });\n }\n\n return (\n <ExplorerManagerContext.Provider value={{ explorer, data, setExplorer, setData }}>\n {children}\n </ExplorerManagerContext.Provider>\n );\n}\n\nexport function useExplorerManagerContext<T>(): ExplorerManagerContextType<T> {\n const ctx = useContext(ExplorerManagerContext);\n if (ctx === undefined) {\n throw new Error('No ExplorerManagerContext found. Did you forget a Provider?');\n }\n return ctx as ExplorerManagerContextType<T>;\n}\n"],"names":["createContext","useContext","useState","ExplorerManagerContext","undefined","ExplorerManagerProvider","children","store","externalStore","explorerStateCache","setExplorerStateCache","localStore","explorer","data","explorerState","setExplorerState","setExplorer","newExplorer","state","setData","newData","Provider","value","useExplorerManagerContext","ctx","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;;AAEjC,SAASA,aAAa,EAA2BC,UAAU,EAAEC,QAAQ,QAAQ,QAAQ;AAerF,MAAMC,uCAAyBH,cAA+DI;AAO9F,OAAO,SAASC,wBAAwB,EACtCC,QAAQ,EACRC,OAAOC,aAAa,EACS;IAC7B,wDAAwD;IACxD,MAAM,CAACC,oBAAoBC,sBAAsB,GAAGR,SAElD,CAAC;IACH,6DAA6D;IAC7D,MAAMS,aAAaT,SAAiC;QAAEU,UAAU;QAAMC,MAAM,CAAC;IAAE;IAC/E,6EAA6E;IAC7E,MAAM,CAACC,eAAeC,iBAAiB,GAAGP,gBAAgBA,gBAAgBG;IAC1E,MAAM,EAAEC,QAAQ,EAAEC,IAAI,EAAE,GAAGC;IAE3B,SAASE,YAAYC,WAAmB;QACtC,IAAIL,UAAU;YACZ,+BAA+B;YAC/BH,kBAAkB,CAACG,SAAS,GAAG;gBAAEC;YAAK;YACtCH,sBAAsBD;QACxB;QAEA,2CAA2C;QAC3C,MAAMS,QAAQT,kBAAkB,CAACQ,YAAY,IAAI;YAAEJ,MAAM,CAAC;QAAE;QAC5DE,iBAAiB;YAAEH,UAAUK;YAAaJ,MAAMK,MAAML,IAAI;QAAC;IAC7D;IAEA,SAASM,QAAQC,OAAgB;QAC/BL,iBAAiB;YAAEH;YAAUC,MAAMO;QAAQ;IAC7C;IAEA,qBACE,KAACjB,uBAAuBkB,QAAQ;QAACC,OAAO;YAAEV;YAAUC;YAAMG;YAAaG;QAAQ;kBAC5Eb;;AAGP;AAEA,OAAO,SAASiB;IACd,MAAMC,MAAMvB,WAAWE;IACvB,IAAIqB,QAAQpB,WAAW;QACrB,MAAM,IAAIqB,MAAM;IAClB;IACA,OAAOD;AACT"}
@@ -1,4 +1,8 @@
1
1
  import { ReactElement, ReactNode } from 'react';
2
+ export declare const parseAsExplorerConfig: {
3
+ explorer: import("nuqs").ParserBuilder<string>;
4
+ data: import("nuqs").ParserBuilder<unknown>;
5
+ };
2
6
  interface ExplorerManagerProviderWithQueryParamsProps {
3
7
  children: ReactNode;
4
8
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ExplorerManagerProviderWithQueryParams.d.ts","sourceRoot":"","sources":["../../../src/components/ExploreManager/ExplorerManagerProviderWithQueryParams.tsx"],"names":[],"mappings":"AAaA,OAAc,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAUvD,UAAU,2CAA2C;IACnD,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,sCAAsC,CAAC,EACrD,QAAQ,GACT,EAAE,2CAA2C,GAAG,YAAY,CAI5D"}
1
+ {"version":3,"file":"ExplorerManagerProviderWithQueryParams.d.ts","sourceRoot":"","sources":["../../../src/components/ExploreManager/ExplorerManagerProviderWithQueryParams.tsx"],"names":[],"mappings":"AAaA,OAAc,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAMvD,eAAO,MAAM,qBAAqB;;;CAGjC,CAAC;AAEF,UAAU,2CAA2C;IACnD,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,sCAAsC,CAAC,EACrD,QAAQ,GACT,EAAE,2CAA2C,GAAG,YAAY,CAI5D"}
@@ -12,14 +12,15 @@
12
12
  // limitations under the License.
13
13
  import { jsx as _jsx } from "react/jsx-runtime";
14
14
  import React from 'react';
15
- import { JsonParam, StringParam, useQueryParams, withDefault } from 'use-query-params';
15
+ import { parseAsJson, parseAsString, useQueryStates } from 'nuqs';
16
+ import { z } from 'zod';
16
17
  import { ExplorerManagerProvider } from './ExplorerManagerProvider';
17
- const exploreQueryConfig = {
18
- explorer: withDefault(StringParam, undefined),
19
- data: withDefault(JsonParam, {})
18
+ export const parseAsExplorerConfig = {
19
+ explorer: parseAsString,
20
+ data: parseAsJson(z.unknown())
20
21
  };
21
22
  export function ExplorerManagerProviderWithQueryParams({ children }) {
22
- const [queryParams, setQueryParams] = useQueryParams(exploreQueryConfig);
23
+ const [queryParams, setQueryParams] = useQueryStates(parseAsExplorerConfig);
23
24
  return /*#__PURE__*/ _jsx(ExplorerManagerProvider, {
24
25
  store: [
25
26
  queryParams,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/ExploreManager/ExplorerManagerProviderWithQueryParams.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport React, { ReactElement, ReactNode } from 'react';\n\nimport { JsonParam, StringParam, useQueryParams, withDefault } from 'use-query-params';\nimport { ExplorerManagerProvider } from './ExplorerManagerProvider';\n\nconst exploreQueryConfig = {\n explorer: withDefault(StringParam, undefined),\n data: withDefault(JsonParam, {}),\n};\n\ninterface ExplorerManagerProviderWithQueryParamsProps {\n children: ReactNode;\n}\n\nexport function ExplorerManagerProviderWithQueryParams({\n children,\n}: ExplorerManagerProviderWithQueryParamsProps): ReactElement {\n const [queryParams, setQueryParams] = useQueryParams(exploreQueryConfig);\n\n return <ExplorerManagerProvider store={[queryParams, setQueryParams]}>{children}</ExplorerManagerProvider>;\n}\n"],"names":["React","JsonParam","StringParam","useQueryParams","withDefault","ExplorerManagerProvider","exploreQueryConfig","explorer","undefined","data","ExplorerManagerProviderWithQueryParams","children","queryParams","setQueryParams","store"],"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,OAAOA,WAAwC,QAAQ;AAEvD,SAASC,SAAS,EAAEC,WAAW,EAAEC,cAAc,EAAEC,WAAW,QAAQ,mBAAmB;AACvF,SAASC,uBAAuB,QAAQ,4BAA4B;AAEpE,MAAMC,qBAAqB;IACzBC,UAAUH,YAAYF,aAAaM;IACnCC,MAAML,YAAYH,WAAW,CAAC;AAChC;AAMA,OAAO,SAASS,uCAAuC,EACrDC,QAAQ,EACoC;IAC5C,MAAM,CAACC,aAAaC,eAAe,GAAGV,eAAeG;IAErD,qBAAO,KAACD;QAAwBS,OAAO;YAACF;YAAaC;SAAe;kBAAGF;;AACzE"}
1
+ {"version":3,"sources":["../../../src/components/ExploreManager/ExplorerManagerProviderWithQueryParams.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport React, { ReactElement, ReactNode } from 'react';\n\nimport { parseAsJson, parseAsString, useQueryStates } from 'nuqs';\nimport { z } from 'zod';\nimport { ExplorerManagerProvider } from './ExplorerManagerProvider';\n\nexport const parseAsExplorerConfig = {\n explorer: parseAsString,\n data: parseAsJson(z.unknown()),\n};\n\ninterface ExplorerManagerProviderWithQueryParamsProps {\n children: ReactNode;\n}\n\nexport function ExplorerManagerProviderWithQueryParams({\n children,\n}: ExplorerManagerProviderWithQueryParamsProps): ReactElement {\n const [queryParams, setQueryParams] = useQueryStates(parseAsExplorerConfig);\n\n return <ExplorerManagerProvider store={[queryParams, setQueryParams]}>{children}</ExplorerManagerProvider>;\n}\n"],"names":["React","parseAsJson","parseAsString","useQueryStates","z","ExplorerManagerProvider","parseAsExplorerConfig","explorer","data","unknown","ExplorerManagerProviderWithQueryParams","children","queryParams","setQueryParams","store"],"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,OAAOA,WAAwC,QAAQ;AAEvD,SAASC,WAAW,EAAEC,aAAa,EAAEC,cAAc,QAAQ,OAAO;AAClE,SAASC,CAAC,QAAQ,MAAM;AACxB,SAASC,uBAAuB,QAAQ,4BAA4B;AAEpE,OAAO,MAAMC,wBAAwB;IACnCC,UAAUL;IACVM,MAAMP,YAAYG,EAAEK,OAAO;AAC7B,EAAE;AAMF,OAAO,SAASC,uCAAuC,EACrDC,QAAQ,EACoC;IAC5C,MAAM,CAACC,aAAaC,eAAe,GAAGV,eAAeG;IAErD,qBAAO,KAACD;QAAwBS,OAAO;YAACF;YAAaC;SAAe;kBAAGF;;AACzE"}
@@ -1,4 +1,5 @@
1
1
  export * from './ExploreManager';
2
2
  export * from './ExplorerManagerProvider';
3
+ export * from './ExplorerManagerProviderWithQueryParams';
3
4
  export * from './query-params';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ExploreManager/index.ts"],"names":[],"mappings":"AAaA,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ExploreManager/index.ts"],"names":[],"mappings":"AAaA,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0CAA0C,CAAC;AACzD,cAAc,gBAAgB,CAAC"}
@@ -12,6 +12,7 @@
12
12
  // limitations under the License.
13
13
  export * from './ExploreManager';
14
14
  export * from './ExplorerManagerProvider';
15
+ export * from './ExplorerManagerProviderWithQueryParams';
15
16
  export * from './query-params';
16
17
 
17
18
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/ExploreManager/index.ts"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './ExploreManager';\nexport * from './ExplorerManagerProvider';\nexport * from './query-params';\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,mBAAmB;AACjC,cAAc,4BAA4B;AAC1C,cAAc,iBAAiB"}
1
+ {"version":3,"sources":["../../../src/components/ExploreManager/index.ts"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './ExploreManager';\nexport * from './ExplorerManagerProvider';\nexport * from './ExplorerManagerProviderWithQueryParams';\nexport * from './query-params';\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,mBAAmB;AACjC,cAAc,4BAA4B;AAC1C,cAAc,2CAA2C;AACzD,cAAc,iBAAiB"}
@@ -1,9 +1,9 @@
1
- export declare const explorerQueryConfig: {
2
- refresh: import("use-query-params").QueryParamConfig<import("@perses-dev/plugin-system").TimeOptionValue, import("@perses-dev/plugin-system").TimeOptionValue>;
3
- start: import("use-query-params").QueryParamConfig<import("@perses-dev/plugin-system").TimeOptionValue, import("@perses-dev/plugin-system").TimeOptionValue>;
4
- end: import("use-query-params").QueryParamConfig<import("@perses-dev/plugin-system").TimeOptionValue, import("@perses-dev/plugin-system").TimeOptionValue>;
5
- explorer: import("use-query-params").QueryParamConfig<string | null | undefined, string | null | undefined>;
6
- data: import("use-query-params").QueryParamConfig<any, any>;
1
+ export declare const parseAsExplorerQueryConfig: {
2
+ refresh: import("nuqs").ParserBuilder<import("@perses-dev/plugin-system").TimeOptionValue>;
3
+ start: import("nuqs").ParserBuilder<import("@perses-dev/plugin-system").TimeOptionValue>;
4
+ end: import("nuqs").ParserBuilder<import("@perses-dev/plugin-system").TimeOptionValue>;
5
+ explorer: import("nuqs").ParserBuilder<string>;
6
+ data: import("nuqs").ParserBuilder<unknown>;
7
7
  };
8
8
  interface ExplorerQueryData {
9
9
  refresh?: Date;
@@ -1 +1 @@
1
- {"version":3,"file":"query-params.d.ts","sourceRoot":"","sources":["../../../src/components/ExploreManager/query-params.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,mBAAmB;;;;;;CAM/B,CAAC;AAEF,UAAU,iBAAiB;IACzB,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,KAAK,CAAC,EAAE,IAAI,CAAC;IACb,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAGD,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAGxE"}
1
+ {"version":3,"file":"query-params.d.ts","sourceRoot":"","sources":["../../../src/components/ExploreManager/query-params.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,0BAA0B;;;;;;CAMtC,CAAC;AAEF,UAAU,iBAAiB;IACzB,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,KAAK,CAAC,EAAE,IAAI,CAAC;IACb,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAGD,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAIxE"}
@@ -10,25 +10,26 @@
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
- import { encodeQueryParams, JsonParam, StringParam, useQueryParams } from 'use-query-params';
14
- import { TimeRangeParam } from '@perses-dev/plugin-system';
15
- import { stringify } from 'qs';
16
- export const explorerQueryConfig = {
17
- refresh: TimeRangeParam,
18
- start: TimeRangeParam,
19
- end: TimeRangeParam,
20
- explorer: StringParam,
21
- data: JsonParam
13
+ import { useQueryStates, createSerializer, parseAsString, parseAsJson } from 'nuqs';
14
+ import { parseAsTimeRangeValue } from '@perses-dev/plugin-system';
15
+ import { z } from 'zod';
16
+ export const parseAsExplorerQueryConfig = {
17
+ refresh: parseAsTimeRangeValue,
18
+ start: parseAsTimeRangeValue,
19
+ end: parseAsTimeRangeValue,
20
+ explorer: parseAsString,
21
+ data: parseAsJson(z.unknown())
22
22
  };
23
23
  // Provide a query string for the explorer page using the given inputs, but also including any existing query params
24
24
  export function useExplorerQueryParams(inputs) {
25
- const [query] = useQueryParams(explorerQueryConfig, {
26
- updateType: 'replaceIn'
25
+ const [query] = useQueryStates(parseAsExplorerQueryConfig, {
26
+ history: 'replace'
27
27
  });
28
- return stringify(encodeQueryParams(explorerQueryConfig, {
28
+ const serialize = createSerializer(parseAsExplorerQueryConfig);
29
+ return serialize({
29
30
  ...query,
30
31
  ...inputs
31
- }));
32
+ });
32
33
  }
33
34
 
34
35
  //# sourceMappingURL=query-params.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/ExploreManager/query-params.ts"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { encodeQueryParams, JsonParam, StringParam, useQueryParams } from 'use-query-params';\nimport { TimeRangeParam } from '@perses-dev/plugin-system';\nimport { stringify } from 'qs';\n\nexport const explorerQueryConfig = {\n refresh: TimeRangeParam,\n start: TimeRangeParam,\n end: TimeRangeParam,\n explorer: StringParam,\n data: JsonParam,\n};\n\ninterface ExplorerQueryData {\n refresh?: Date;\n start?: Date;\n end?: Date;\n explorer?: string;\n data?: Record<string, unknown>;\n}\n\n// Provide a query string for the explorer page using the given inputs, but also including any existing query params\nexport function useExplorerQueryParams(inputs: ExplorerQueryData): string {\n const [query] = useQueryParams(explorerQueryConfig, { updateType: 'replaceIn' });\n return stringify(encodeQueryParams(explorerQueryConfig, { ...query, ...inputs }));\n}\n"],"names":["encodeQueryParams","JsonParam","StringParam","useQueryParams","TimeRangeParam","stringify","explorerQueryConfig","refresh","start","end","explorer","data","useExplorerQueryParams","inputs","query","updateType"],"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,iBAAiB,EAAEC,SAAS,EAAEC,WAAW,EAAEC,cAAc,QAAQ,mBAAmB;AAC7F,SAASC,cAAc,QAAQ,4BAA4B;AAC3D,SAASC,SAAS,QAAQ,KAAK;AAE/B,OAAO,MAAMC,sBAAsB;IACjCC,SAASH;IACTI,OAAOJ;IACPK,KAAKL;IACLM,UAAUR;IACVS,MAAMV;AACR,EAAE;AAUF,oHAAoH;AACpH,OAAO,SAASW,uBAAuBC,MAAyB;IAC9D,MAAM,CAACC,MAAM,GAAGX,eAAeG,qBAAqB;QAAES,YAAY;IAAY;IAC9E,OAAOV,UAAUL,kBAAkBM,qBAAqB;QAAE,GAAGQ,KAAK;QAAE,GAAGD,MAAM;IAAC;AAChF"}
1
+ {"version":3,"sources":["../../../src/components/ExploreManager/query-params.ts"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { useQueryStates, createSerializer, parseAsString, parseAsJson } from 'nuqs';\nimport { parseAsTimeRangeValue } from '@perses-dev/plugin-system';\nimport { z } from 'zod';\n\nexport const parseAsExplorerQueryConfig = {\n refresh: parseAsTimeRangeValue,\n start: parseAsTimeRangeValue,\n end: parseAsTimeRangeValue,\n explorer: parseAsString,\n data: parseAsJson(z.unknown()),\n};\n\ninterface ExplorerQueryData {\n refresh?: Date;\n start?: Date;\n end?: Date;\n explorer?: string;\n data?: Record<string, unknown>;\n}\n\n// Provide a query string for the explorer page using the given inputs, but also including any existing query params\nexport function useExplorerQueryParams(inputs: ExplorerQueryData): string {\n const [query] = useQueryStates(parseAsExplorerQueryConfig, { history: 'replace' });\n const serialize = createSerializer(parseAsExplorerQueryConfig);\n return serialize({ ...query, ...inputs });\n}\n"],"names":["useQueryStates","createSerializer","parseAsString","parseAsJson","parseAsTimeRangeValue","z","parseAsExplorerQueryConfig","refresh","start","end","explorer","data","unknown","useExplorerQueryParams","inputs","query","history","serialize"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,cAAc,EAAEC,gBAAgB,EAAEC,aAAa,EAAEC,WAAW,QAAQ,OAAO;AACpF,SAASC,qBAAqB,QAAQ,4BAA4B;AAClE,SAASC,CAAC,QAAQ,MAAM;AAExB,OAAO,MAAMC,6BAA6B;IACxCC,SAASH;IACTI,OAAOJ;IACPK,KAAKL;IACLM,UAAUR;IACVS,MAAMR,YAAYE,EAAEO,OAAO;AAC7B,EAAE;AAUF,oHAAoH;AACpH,OAAO,SAASC,uBAAuBC,MAAyB;IAC9D,MAAM,CAACC,MAAM,GAAGf,eAAeM,4BAA4B;QAAEU,SAAS;IAAU;IAChF,MAAMC,YAAYhB,iBAAiBK;IACnC,OAAOW,UAAU;QAAE,GAAGF,KAAK;QAAE,GAAGD,MAAM;IAAC;AACzC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@perses-dev/explore",
3
- "version": "0.52.0-rc.0",
3
+ "version": "0.52.0-rc.1",
4
4
  "description": "The explore feature in Perses",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/perses/perses/blob/main/README.md",
@@ -28,29 +28,29 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "@nexucis/fuzzy": "^0.5.1",
31
- "@perses-dev/components": "0.52.0-rc.0",
32
- "@perses-dev/core": "0.52.0-rc.0",
33
- "@perses-dev/dashboards": "0.52.0-rc.0",
34
- "@perses-dev/plugin-system": "0.52.0-rc.0",
31
+ "@perses-dev/components": "0.52.0-rc.1",
32
+ "@perses-dev/core": "0.52.0-rc.1",
33
+ "@perses-dev/dashboards": "0.52.0-rc.1",
34
+ "@perses-dev/plugin-system": "0.52.0-rc.1",
35
35
  "@types/react-grid-layout": "^1.3.2",
36
36
  "date-fns": "^4.1.0",
37
37
  "immer": "^10.1.1",
38
38
  "mdi-material-ui": "^7.9.2",
39
- "qs": "^6.13.0",
39
+ "nuqs": "^2.5.1",
40
40
  "react-grid-layout": "^1.3.4",
41
41
  "react-hook-form": "^7.46.1",
42
42
  "react-intersection-observer": "^9.4.0",
43
43
  "react-virtuoso": "^4.12.2",
44
44
  "use-immer": "^0.11.0",
45
- "use-query-params": "^2.1.1",
46
45
  "use-resize-observer": "^9.0.0",
46
+ "zod": "^3.21.4",
47
47
  "zustand": "^4.3.3"
48
48
  },
49
49
  "devDependencies": {
50
- "@perses-dev/internal-utils": "0.52.0-rc.0",
50
+ "@perses-dev/internal-utils": "0.52.0-rc.1",
51
51
  "history": "^5.3.0",
52
52
  "intersection-observer": "^0.12.2",
53
- "react-router-dom": "^6.11.0"
53
+ "react-router-dom": "^6.30.1"
54
54
  },
55
55
  "peerDependencies": {
56
56
  "@mui/material": "^6.1.10",