@xyo-network/react-schema 2.64.7 → 2.64.9

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 (43) hide show
  1. package/dist/browser/contexts/Schema/Provider/Route.cjs +2 -2
  2. package/dist/browser/contexts/Schema/Provider/Route.cjs.map +1 -1
  3. package/dist/browser/contexts/Schema/Provider/Route.js +1 -1
  4. package/dist/browser/contexts/Schema/Provider/Route.js.map +1 -1
  5. package/dist/browser/contexts/Schema/Provider/index.cjs +2 -2
  6. package/dist/browser/contexts/Schema/Provider/index.cjs.map +1 -1
  7. package/dist/browser/contexts/Schema/Provider/index.js +1 -1
  8. package/dist/browser/contexts/Schema/Provider/index.js.map +1 -1
  9. package/dist/browser/contexts/Schema/index.cjs +2 -2
  10. package/dist/browser/contexts/Schema/index.cjs.map +1 -1
  11. package/dist/browser/contexts/Schema/index.js +1 -1
  12. package/dist/browser/contexts/Schema/index.js.map +1 -1
  13. package/dist/browser/contexts/index.cjs +2 -2
  14. package/dist/browser/contexts/index.cjs.map +1 -1
  15. package/dist/browser/contexts/index.js +1 -1
  16. package/dist/browser/contexts/index.js.map +1 -1
  17. package/dist/browser/index.cjs +2 -2
  18. package/dist/browser/index.cjs.map +1 -1
  19. package/dist/browser/index.js +1 -1
  20. package/dist/browser/index.js.map +1 -1
  21. package/dist/docs.json +38 -38
  22. package/dist/node/contexts/Schema/Provider/Route.cjs +2 -2
  23. package/dist/node/contexts/Schema/Provider/Route.cjs.map +1 -1
  24. package/dist/node/contexts/Schema/Provider/Route.js +1 -1
  25. package/dist/node/contexts/Schema/Provider/Route.js.map +1 -1
  26. package/dist/node/contexts/Schema/Provider/index.cjs +2 -2
  27. package/dist/node/contexts/Schema/Provider/index.cjs.map +1 -1
  28. package/dist/node/contexts/Schema/Provider/index.js +1 -1
  29. package/dist/node/contexts/Schema/Provider/index.js.map +1 -1
  30. package/dist/node/contexts/Schema/index.cjs +2 -2
  31. package/dist/node/contexts/Schema/index.cjs.map +1 -1
  32. package/dist/node/contexts/Schema/index.js +1 -1
  33. package/dist/node/contexts/Schema/index.js.map +1 -1
  34. package/dist/node/contexts/index.cjs +2 -2
  35. package/dist/node/contexts/index.cjs.map +1 -1
  36. package/dist/node/contexts/index.js +1 -1
  37. package/dist/node/contexts/index.js.map +1 -1
  38. package/dist/node/index.cjs +2 -2
  39. package/dist/node/index.cjs.map +1 -1
  40. package/dist/node/index.js +1 -1
  41. package/dist/node/index.js.map +1 -1
  42. package/package.json +24 -24
  43. package/src/contexts/Schema/Provider/Route.tsx +1 -1
@@ -24,7 +24,7 @@ __export(Route_exports, {
24
24
  });
25
25
  module.exports = __toCommonJS(Route_exports);
26
26
  var import_react3 = require("react");
27
- var import_react_router_dom_6 = require("react-router-dom-6");
27
+ var import_react_router_dom = require("react-router-dom");
28
28
 
29
29
  // src/contexts/Schema/Context.ts
30
30
  var import_react_shared = require("@xyo-network/react-shared");
@@ -106,7 +106,7 @@ var SchemaMemoryProvider = ({ defaultSchema, knownSchemaList = [], ...props }) =
106
106
  var import_jsx_runtime2 = require("react/jsx-runtime");
107
107
  var SchemaRouteProviderInner = ({ children }) => {
108
108
  const { schema, setSchema, schemaList } = useSchema();
109
- const [params, setParams] = (0, import_react_router_dom_6.useSearchParams)();
109
+ const [params, setParams] = (0, import_react_router_dom.useSearchParams)();
110
110
  const routeSchema = params.get("schema");
111
111
  const setSchemaParam = (0, import_react3.useCallback)(
112
112
  (schema2) => {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/contexts/Schema/Provider/Route.tsx","../../../../../src/contexts/Schema/Context.ts","../../../../../src/contexts/Schema/use.ts","../../../../../src/contexts/Schema/Provider/Memory.tsx","../../../../../src/hooks/useSchemaStats.tsx"],"sourcesContent":["import type { WithChildren } from '@xylabs/react-shared'\nimport { useCallback, useEffect } from 'react'\nimport { useSearchParams } from 'react-router-dom-6'\n\nimport { SchemaContext } from '../Context'\nimport { useSchema } from '../use'\nimport { SchemaMemoryProvider } from './Memory'\nimport { SchemaProviderProps } from './Props'\n\nconst SchemaRouteProviderInner: React.FC<WithChildren> = ({ children }) => {\n const { schema, setSchema, schemaList } = useSchema()\n\n const [params, setParams] = useSearchParams()\n\n const routeSchema = params.get('schema')\n\n //update the network stored in the route\n const setSchemaParam = useCallback(\n (schema?: string) => {\n if (schema) {\n params.set('schema', schema)\n setParams(params, { replace: true })\n setSchema?.(schema)\n } else {\n params.delete('network')\n }\n },\n [params, setParams, setSchema],\n )\n\n //if the network is actively changed, update both memory and route\n const setSchemaLocal = useCallback(\n (schema: string) => {\n setSchemaParam(schema)\n setSchema?.(schema)\n },\n [setSchemaParam, setSchema],\n )\n\n //sync memory and route storage of network\n useEffect(() => {\n if (routeSchema !== schema) {\n if (routeSchema === undefined && schema !== undefined) {\n //if the route does not have a network selected, use what is in the memory context\n setSchemaLocal(schema)\n } else if (routeSchema) {\n //if the route has a selection and it is different from memory, update memory\n setSchema?.(routeSchema)\n }\n }\n }, [routeSchema, schema, setSchemaParam, setSchema, setSchemaLocal])\n\n return <SchemaContext.Provider value={{ provided: true, schema, schemaList, setSchema: setSchemaLocal }}>{children}</SchemaContext.Provider>\n}\n\nexport const SchemaRouteProvider: React.FC<WithChildren<SchemaProviderProps>> = ({ knownSchemaList, defaultSchema, ...props }) => {\n return (\n <SchemaMemoryProvider knownSchemaList={knownSchemaList} defaultSchema={defaultSchema}>\n <SchemaRouteProviderInner {...props} />\n </SchemaMemoryProvider>\n )\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { SchemaContextState } from './State'\n\nexport const SchemaContext = createContextEx<SchemaContextState>()\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { SchemaContext } from './Context'\nimport { SchemaContextState } from './State'\n\nexport const useSchema = (required = false) => {\n return useContextEx<SchemaContextState>(SchemaContext, 'Schema', required)\n}\n","import { compact } from '@xylabs/lodash'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { useEffect, useState } from 'react'\n\nimport { useSchemaStats } from '../../../hooks'\nimport { SchemaContext } from '../Context'\nimport { SchemaProviderProps } from './Props'\n\nexport const SchemaMemoryProvider: React.FC<WithChildren<SchemaProviderProps>> = ({ defaultSchema, knownSchemaList = [], ...props }) => {\n const [schema, setSchema] = useState(defaultSchema)\n const [schemaList, setSchemaList] = useState<string[] | undefined>(knownSchemaList)\n const [fetchedSchemaStats] = useSchemaStats()\n\n useEffect(() => {\n if (fetchedSchemaStats) {\n const schemaList = compact(fetchedSchemaStats.map(({ name }) => name))\n setSchemaList(schemaList)\n }\n }, [fetchedSchemaStats])\n\n return <SchemaContext.Provider value={{ provided: true, schema, schemaList: knownSchemaList ?? schemaList, setSchema, setSchemaList }} {...props} />\n}\n","import { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { isSchemaStatsPayload, SchemaStatsPayload, SchemaStatsQueryPayload, SchemaStatsQuerySchema } from '@xyo-network/diviner-schema-stats-model'\nimport { TYPES } from '@xyo-network/node-core-types'\nimport { useDivinerFromNode } from '@xyo-network/react-diviner'\nimport { Dispatch, SetStateAction, useMemo, useState } from 'react'\n\nexport const useSchemaStats = (\n statsAddress?: string,\n nameOrAddress = TYPES.SchemaStatsDiviner.description,\n): [SchemaStatsPayload[] | undefined, Error | undefined, Dispatch<SetStateAction<number>>] => {\n const [refresh, setRefresh] = useState(1)\n const [diviner, divinerError] = useDivinerFromNode(nameOrAddress)\n const [error, setError] = useState<Error>()\n const refreshHistory = () => setRefresh((previous) => previous + 1)\n\n const [schemaList, setSchemaList] = useState<SchemaStatsPayload[]>()\n\n const query: SchemaStatsQueryPayload = useMemo(\n () => ({\n address: statsAddress,\n schema: SchemaStatsQuerySchema,\n }),\n [statsAddress],\n )\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n if (diviner) {\n if (divinerError) {\n if (mounted()) {\n setError(divinerError)\n setSchemaList(undefined)\n }\n } else {\n try {\n const schemas = (await diviner.divine([query])).filter(isSchemaStatsPayload)\n if (mounted()) {\n setSchemaList(schemas)\n setError(undefined)\n }\n } catch (ex) {\n setError(ex as Error)\n setSchemaList(undefined)\n }\n }\n }\n },\n [diviner, refresh, divinerError, query],\n )\n\n return [schemaList, error, refreshHistory]\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,IAAAA,gBAAuC;AACvC,gCAAgC;;;ACFhC,0BAAgC;AAIzB,IAAM,oBAAgB,qCAAoC;;;ACJjE,IAAAC,uBAA6B;AAKtB,IAAM,YAAY,CAAC,WAAW,UAAU;AAC7C,aAAO,mCAAiC,eAAe,UAAU,QAAQ;AAC3E;;;ACPA,oBAAwB;AAExB,IAAAC,gBAAoC;;;ACFpC,gCAA+B;AAC/B,wCAA0G;AAC1G,6BAAsB;AACtB,2BAAmC;AACnC,mBAA4D;AAErD,IAAM,iBAAiB,CAC5B,cACA,gBAAgB,6BAAM,mBAAmB,gBACmD;AAC5F,QAAM,CAAC,SAAS,UAAU,QAAI,uBAAS,CAAC;AACxC,QAAM,CAAC,SAAS,YAAY,QAAI,yCAAmB,aAAa;AAChE,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAgB;AAC1C,QAAM,iBAAiB,MAAM,WAAW,CAAC,aAAa,WAAW,CAAC;AAElE,QAAM,CAAC,YAAY,aAAa,QAAI,uBAA+B;AAEnE,QAAM,YAAiC;AAAA,IACrC,OAAO;AAAA,MACL,SAAS;AAAA,MACT,QAAQ;AAAA,IACV;AAAA,IACA,CAAC,YAAY;AAAA,EACf;AAEA;AAAA;AAAA,IAEE,OAAO,YAAY;AACjB,UAAI,SAAS;AACX,YAAI,cAAc;AAChB,cAAI,QAAQ,GAAG;AACb,qBAAS,YAAY;AACrB,0BAAc,MAAS;AAAA,UACzB;AAAA,QACF,OAAO;AACL,cAAI;AACF,kBAAM,WAAW,MAAM,QAAQ,OAAO,CAAC,KAAK,CAAC,GAAG,OAAO,sDAAoB;AAC3E,gBAAI,QAAQ,GAAG;AACb,4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CAAC,QAAQ,WAAW,SAAS;AAAA,EAC/B;AAGA,QAAM,qBAAiB;AAAA,IACrB,CAACA,YAAmB;AAClB,qBAAeA,OAAM;AACrB,kBAAYA,OAAM;AAAA,IACpB;AAAA,IACA,CAAC,gBAAgB,SAAS;AAAA,EAC5B;AAGA,+BAAU,MAAM;AACd,QAAI,gBAAgB,QAAQ;AAC1B,UAAI,gBAAgB,UAAa,WAAW,QAAW;AAErD,uBAAe,MAAM;AAAA,MACvB,WAAW,aAAa;AAEtB,oBAAY,WAAW;AAAA,MACzB;AAAA,IACF;AAAA,EACF,GAAG,CAAC,aAAa,QAAQ,gBAAgB,WAAW,cAAc,CAAC;AAEnE,SAAO,6CAAC,cAAc,UAAd,EAAuB,OAAO,EAAE,UAAU,MAAM,QAAQ,YAAY,WAAW,eAAe,GAAI,UAAS;AACrH;AAEO,IAAM,sBAAmE,CAAC,EAAE,iBAAiB,eAAe,GAAG,MAAM,MAAM;AAChI,SACE,6CAAC,wBAAqB,iBAAkC,eACtD,uDAAC,4BAA0B,GAAG,OAAO,GACvC;AAEJ;","names":["import_react","import_react_shared","import_react","schemaList","import_jsx_runtime","schema"]}
1
+ {"version":3,"sources":["../../../../../src/contexts/Schema/Provider/Route.tsx","../../../../../src/contexts/Schema/Context.ts","../../../../../src/contexts/Schema/use.ts","../../../../../src/contexts/Schema/Provider/Memory.tsx","../../../../../src/hooks/useSchemaStats.tsx"],"sourcesContent":["import type { WithChildren } from '@xylabs/react-shared'\nimport { useCallback, useEffect } from 'react'\nimport { useSearchParams } from 'react-router-dom'\n\nimport { SchemaContext } from '../Context'\nimport { useSchema } from '../use'\nimport { SchemaMemoryProvider } from './Memory'\nimport { SchemaProviderProps } from './Props'\n\nconst SchemaRouteProviderInner: React.FC<WithChildren> = ({ children }) => {\n const { schema, setSchema, schemaList } = useSchema()\n\n const [params, setParams] = useSearchParams()\n\n const routeSchema = params.get('schema')\n\n //update the network stored in the route\n const setSchemaParam = useCallback(\n (schema?: string) => {\n if (schema) {\n params.set('schema', schema)\n setParams(params, { replace: true })\n setSchema?.(schema)\n } else {\n params.delete('network')\n }\n },\n [params, setParams, setSchema],\n )\n\n //if the network is actively changed, update both memory and route\n const setSchemaLocal = useCallback(\n (schema: string) => {\n setSchemaParam(schema)\n setSchema?.(schema)\n },\n [setSchemaParam, setSchema],\n )\n\n //sync memory and route storage of network\n useEffect(() => {\n if (routeSchema !== schema) {\n if (routeSchema === undefined && schema !== undefined) {\n //if the route does not have a network selected, use what is in the memory context\n setSchemaLocal(schema)\n } else if (routeSchema) {\n //if the route has a selection and it is different from memory, update memory\n setSchema?.(routeSchema)\n }\n }\n }, [routeSchema, schema, setSchemaParam, setSchema, setSchemaLocal])\n\n return <SchemaContext.Provider value={{ provided: true, schema, schemaList, setSchema: setSchemaLocal }}>{children}</SchemaContext.Provider>\n}\n\nexport const SchemaRouteProvider: React.FC<WithChildren<SchemaProviderProps>> = ({ knownSchemaList, defaultSchema, ...props }) => {\n return (\n <SchemaMemoryProvider knownSchemaList={knownSchemaList} defaultSchema={defaultSchema}>\n <SchemaRouteProviderInner {...props} />\n </SchemaMemoryProvider>\n )\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { SchemaContextState } from './State'\n\nexport const SchemaContext = createContextEx<SchemaContextState>()\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { SchemaContext } from './Context'\nimport { SchemaContextState } from './State'\n\nexport const useSchema = (required = false) => {\n return useContextEx<SchemaContextState>(SchemaContext, 'Schema', required)\n}\n","import { compact } from '@xylabs/lodash'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { useEffect, useState } from 'react'\n\nimport { useSchemaStats } from '../../../hooks'\nimport { SchemaContext } from '../Context'\nimport { SchemaProviderProps } from './Props'\n\nexport const SchemaMemoryProvider: React.FC<WithChildren<SchemaProviderProps>> = ({ defaultSchema, knownSchemaList = [], ...props }) => {\n const [schema, setSchema] = useState(defaultSchema)\n const [schemaList, setSchemaList] = useState<string[] | undefined>(knownSchemaList)\n const [fetchedSchemaStats] = useSchemaStats()\n\n useEffect(() => {\n if (fetchedSchemaStats) {\n const schemaList = compact(fetchedSchemaStats.map(({ name }) => name))\n setSchemaList(schemaList)\n }\n }, [fetchedSchemaStats])\n\n return <SchemaContext.Provider value={{ provided: true, schema, schemaList: knownSchemaList ?? schemaList, setSchema, setSchemaList }} {...props} />\n}\n","import { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { isSchemaStatsPayload, SchemaStatsPayload, SchemaStatsQueryPayload, SchemaStatsQuerySchema } from '@xyo-network/diviner-schema-stats-model'\nimport { TYPES } from '@xyo-network/node-core-types'\nimport { useDivinerFromNode } from '@xyo-network/react-diviner'\nimport { Dispatch, SetStateAction, useMemo, useState } from 'react'\n\nexport const useSchemaStats = (\n statsAddress?: string,\n nameOrAddress = TYPES.SchemaStatsDiviner.description,\n): [SchemaStatsPayload[] | undefined, Error | undefined, Dispatch<SetStateAction<number>>] => {\n const [refresh, setRefresh] = useState(1)\n const [diviner, divinerError] = useDivinerFromNode(nameOrAddress)\n const [error, setError] = useState<Error>()\n const refreshHistory = () => setRefresh((previous) => previous + 1)\n\n const [schemaList, setSchemaList] = useState<SchemaStatsPayload[]>()\n\n const query: SchemaStatsQueryPayload = useMemo(\n () => ({\n address: statsAddress,\n schema: SchemaStatsQuerySchema,\n }),\n [statsAddress],\n )\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n if (diviner) {\n if (divinerError) {\n if (mounted()) {\n setError(divinerError)\n setSchemaList(undefined)\n }\n } else {\n try {\n const schemas = (await diviner.divine([query])).filter(isSchemaStatsPayload)\n if (mounted()) {\n setSchemaList(schemas)\n setError(undefined)\n }\n } catch (ex) {\n setError(ex as Error)\n setSchemaList(undefined)\n }\n }\n }\n },\n [diviner, refresh, divinerError, query],\n )\n\n return [schemaList, error, refreshHistory]\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;A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I,gBAAgB,QAAQ;AAC1B,UAAI,gBAAgB,UAAa,WAAW,QAAW;AAErD,uBAAe,MAAM;AAAA,MACvB,WAAW,aAAa;AAEtB,oBAAY,WAAW;AAAA,MACzB;AAAA,IACF;AAAA,EACF,GAAG,CAAC,aAAa,QAAQ,gBAAgB,WAAW,cAAc,CAAC;AAEnE,SAAO,6CAAC,cAAc,UAAd,EAAuB,OAAO,EAAE,UAAU,MAAM,QAAQ,YAAY,WAAW,eAAe,GAAI,UAAS;AACrH;AAEO,IAAM,sBAAmE,CAAC,EAAE,iBAAiB,eAAe,GAAG,MAAM,MAAM;AAChI,SACE,6CAAC,wBAAqB,iBAAkC,eACtD,uDAAC,4BAA0B,GAAG,OAAO,GACvC;AAEJ;","names":["import_react","import_react_shared","import_react","schemaList","import_jsx_runtime","schema"]}
@@ -1,6 +1,6 @@
1
1
  // src/contexts/Schema/Provider/Route.tsx
2
2
  import { useCallback, useEffect as useEffect2 } from "react";
3
- import { useSearchParams } from "react-router-dom-6";
3
+ import { useSearchParams } from "react-router-dom";
4
4
 
5
5
  // src/contexts/Schema/Context.ts
6
6
  import { createContextEx } from "@xyo-network/react-shared";
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/contexts/Schema/Provider/Route.tsx","../../../../../src/contexts/Schema/Context.ts","../../../../../src/contexts/Schema/use.ts","../../../../../src/contexts/Schema/Provider/Memory.tsx","../../../../../src/hooks/useSchemaStats.tsx"],"sourcesContent":["import type { WithChildren } from '@xylabs/react-shared'\nimport { useCallback, useEffect } from 'react'\nimport { useSearchParams } from 'react-router-dom-6'\n\nimport { SchemaContext } from '../Context'\nimport { useSchema } from '../use'\nimport { SchemaMemoryProvider } from './Memory'\nimport { SchemaProviderProps } from './Props'\n\nconst SchemaRouteProviderInner: React.FC<WithChildren> = ({ children }) => {\n const { schema, setSchema, schemaList } = useSchema()\n\n const [params, setParams] = useSearchParams()\n\n const routeSchema = params.get('schema')\n\n //update the network stored in the route\n const setSchemaParam = useCallback(\n (schema?: string) => {\n if (schema) {\n params.set('schema', schema)\n setParams(params, { replace: true })\n setSchema?.(schema)\n } else {\n params.delete('network')\n }\n },\n [params, setParams, setSchema],\n )\n\n //if the network is actively changed, update both memory and route\n const setSchemaLocal = useCallback(\n (schema: string) => {\n setSchemaParam(schema)\n setSchema?.(schema)\n },\n [setSchemaParam, setSchema],\n )\n\n //sync memory and route storage of network\n useEffect(() => {\n if (routeSchema !== schema) {\n if (routeSchema === undefined && schema !== undefined) {\n //if the route does not have a network selected, use what is in the memory context\n setSchemaLocal(schema)\n } else if (routeSchema) {\n //if the route has a selection and it is different from memory, update memory\n setSchema?.(routeSchema)\n }\n }\n }, [routeSchema, schema, setSchemaParam, setSchema, setSchemaLocal])\n\n return <SchemaContext.Provider value={{ provided: true, schema, schemaList, setSchema: setSchemaLocal }}>{children}</SchemaContext.Provider>\n}\n\nexport const SchemaRouteProvider: React.FC<WithChildren<SchemaProviderProps>> = ({ knownSchemaList, defaultSchema, ...props }) => {\n return (\n <SchemaMemoryProvider knownSchemaList={knownSchemaList} defaultSchema={defaultSchema}>\n <SchemaRouteProviderInner {...props} />\n </SchemaMemoryProvider>\n )\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { SchemaContextState } from './State'\n\nexport const SchemaContext = createContextEx<SchemaContextState>()\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { SchemaContext } from './Context'\nimport { SchemaContextState } from './State'\n\nexport const useSchema = (required = false) => {\n return useContextEx<SchemaContextState>(SchemaContext, 'Schema', required)\n}\n","import { compact } from '@xylabs/lodash'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { useEffect, useState } from 'react'\n\nimport { useSchemaStats } from '../../../hooks'\nimport { SchemaContext } from '../Context'\nimport { SchemaProviderProps } from './Props'\n\nexport const SchemaMemoryProvider: React.FC<WithChildren<SchemaProviderProps>> = ({ defaultSchema, knownSchemaList = [], ...props }) => {\n const [schema, setSchema] = useState(defaultSchema)\n const [schemaList, setSchemaList] = useState<string[] | undefined>(knownSchemaList)\n const [fetchedSchemaStats] = useSchemaStats()\n\n useEffect(() => {\n if (fetchedSchemaStats) {\n const schemaList = compact(fetchedSchemaStats.map(({ name }) => name))\n setSchemaList(schemaList)\n }\n }, [fetchedSchemaStats])\n\n return <SchemaContext.Provider value={{ provided: true, schema, schemaList: knownSchemaList ?? schemaList, setSchema, setSchemaList }} {...props} />\n}\n","import { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { isSchemaStatsPayload, SchemaStatsPayload, SchemaStatsQueryPayload, SchemaStatsQuerySchema } from '@xyo-network/diviner-schema-stats-model'\nimport { TYPES } from '@xyo-network/node-core-types'\nimport { useDivinerFromNode } from '@xyo-network/react-diviner'\nimport { Dispatch, SetStateAction, useMemo, useState } from 'react'\n\nexport const useSchemaStats = (\n statsAddress?: string,\n nameOrAddress = TYPES.SchemaStatsDiviner.description,\n): [SchemaStatsPayload[] | undefined, Error | undefined, Dispatch<SetStateAction<number>>] => {\n const [refresh, setRefresh] = useState(1)\n const [diviner, divinerError] = useDivinerFromNode(nameOrAddress)\n const [error, setError] = useState<Error>()\n const refreshHistory = () => setRefresh((previous) => previous + 1)\n\n const [schemaList, setSchemaList] = useState<SchemaStatsPayload[]>()\n\n const query: SchemaStatsQueryPayload = useMemo(\n () => ({\n address: statsAddress,\n schema: SchemaStatsQuerySchema,\n }),\n [statsAddress],\n )\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n if (diviner) {\n if (divinerError) {\n if (mounted()) {\n setError(divinerError)\n setSchemaList(undefined)\n }\n } else {\n try {\n const schemas = (await diviner.divine([query])).filter(isSchemaStatsPayload)\n if (mounted()) {\n setSchemaList(schemas)\n setError(undefined)\n }\n } catch (ex) {\n setError(ex as Error)\n setSchemaList(undefined)\n }\n }\n }\n },\n [diviner, refresh, divinerError, query],\n )\n\n return [schemaList, error, refreshHistory]\n}\n"],"mappings":";AACA,SAAS,aAAa,aAAAA,kBAAiB;AACvC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,EAC5B;AAGA,EAAAC,WAAU,MAAM;AACd,QAAI,gBAAgB,QAAQ;AAC1B,UAAI,gBAAgB,UAAa,WAAW,QAAW;AAErD,uBAAe,MAAM;AAAA,MACvB,WAAW,aAAa;AAEtB,oBAAY,WAAW;AAAA,MACzB;AAAA,IACF;AAAA,EACF,GAAG,CAAC,aAAa,QAAQ,gBAAgB,WAAW,cAAc,CAAC;AAEnE,SAAO,gBAAAF,KAAC,cAAc,UAAd,EAAuB,OAAO,EAAE,UAAU,MAAM,QAAQ,YAAY,WAAW,eAAe,GAAI,UAAS;AACrH;AAEO,IAAM,sBAAmE,CAAC,EAAE,iBAAiB,eAAe,GAAG,MAAM,MAAM;AAChI,SACE,gBAAAA,KAAC,wBAAqB,iBAAkC,eACtD,0BAAAA,KAAC,4BAA0B,GAAG,OAAO,GACvC;AAEJ;","names":["useEffect","useState","useState","schemaList","jsx","schema","useEffect"]}
1
+ {"version":3,"sources":["../../../../../src/contexts/Schema/Provider/Route.tsx","../../../../../src/contexts/Schema/Context.ts","../../../../../src/contexts/Schema/use.ts","../../../../../src/contexts/Schema/Provider/Memory.tsx","../../../../../src/hooks/useSchemaStats.tsx"],"sourcesContent":["import type { WithChildren } from '@xylabs/react-shared'\nimport { useCallback, useEffect } from 'react'\nimport { useSearchParams } from 'react-router-dom'\n\nimport { SchemaContext } from '../Context'\nimport { useSchema } from '../use'\nimport { SchemaMemoryProvider } from './Memory'\nimport { SchemaProviderProps } from './Props'\n\nconst SchemaRouteProviderInner: React.FC<WithChildren> = ({ children }) => {\n const { schema, setSchema, schemaList } = useSchema()\n\n const [params, setParams] = useSearchParams()\n\n const routeSchema = params.get('schema')\n\n //update the network stored in the route\n const setSchemaParam = useCallback(\n (schema?: string) => {\n if (schema) {\n params.set('schema', schema)\n setParams(params, { replace: true })\n setSchema?.(schema)\n } else {\n params.delete('network')\n }\n },\n [params, setParams, setSchema],\n )\n\n //if the network is actively changed, update both memory and route\n const setSchemaLocal = useCallback(\n (schema: string) => {\n setSchemaParam(schema)\n setSchema?.(schema)\n },\n [setSchemaParam, setSchema],\n )\n\n //sync memory and route storage of network\n useEffect(() => {\n if (routeSchema !== schema) {\n if (routeSchema === undefined && schema !== undefined) {\n //if the route does not have a network selected, use what is in the memory context\n setSchemaLocal(schema)\n } else if (routeSchema) {\n //if the route has a selection and it is different from memory, update memory\n setSchema?.(routeSchema)\n }\n }\n }, [routeSchema, schema, setSchemaParam, setSchema, setSchemaLocal])\n\n return <SchemaContext.Provider value={{ provided: true, schema, schemaList, setSchema: setSchemaLocal }}>{children}</SchemaContext.Provider>\n}\n\nexport const SchemaRouteProvider: React.FC<WithChildren<SchemaProviderProps>> = ({ knownSchemaList, defaultSchema, ...props }) => {\n return (\n <SchemaMemoryProvider knownSchemaList={knownSchemaList} defaultSchema={defaultSchema}>\n <SchemaRouteProviderInner {...props} />\n </SchemaMemoryProvider>\n )\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { SchemaContextState } from './State'\n\nexport const SchemaContext = createContextEx<SchemaContextState>()\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { SchemaContext } from './Context'\nimport { SchemaContextState } from './State'\n\nexport const useSchema = (required = false) => {\n return useContextEx<SchemaContextState>(SchemaContext, 'Schema', required)\n}\n","import { compact } from '@xylabs/lodash'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { useEffect, useState } from 'react'\n\nimport { useSchemaStats } from '../../../hooks'\nimport { SchemaContext } from '../Context'\nimport { SchemaProviderProps } from './Props'\n\nexport const SchemaMemoryProvider: React.FC<WithChildren<SchemaProviderProps>> = ({ defaultSchema, knownSchemaList = [], ...props }) => {\n const [schema, setSchema] = useState(defaultSchema)\n const [schemaList, setSchemaList] = useState<string[] | undefined>(knownSchemaList)\n const [fetchedSchemaStats] = useSchemaStats()\n\n useEffect(() => {\n if (fetchedSchemaStats) {\n const schemaList = compact(fetchedSchemaStats.map(({ name }) => name))\n setSchemaList(schemaList)\n }\n }, [fetchedSchemaStats])\n\n return <SchemaContext.Provider value={{ provided: true, schema, schemaList: knownSchemaList ?? schemaList, setSchema, setSchemaList }} {...props} />\n}\n","import { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { isSchemaStatsPayload, SchemaStatsPayload, SchemaStatsQueryPayload, SchemaStatsQuerySchema } from '@xyo-network/diviner-schema-stats-model'\nimport { TYPES } from '@xyo-network/node-core-types'\nimport { useDivinerFromNode } from '@xyo-network/react-diviner'\nimport { Dispatch, SetStateAction, useMemo, useState } from 'react'\n\nexport const useSchemaStats = (\n statsAddress?: string,\n nameOrAddress = TYPES.SchemaStatsDiviner.description,\n): [SchemaStatsPayload[] | undefined, Error | undefined, Dispatch<SetStateAction<number>>] => {\n const [refresh, setRefresh] = useState(1)\n const [diviner, divinerError] = useDivinerFromNode(nameOrAddress)\n const [error, setError] = useState<Error>()\n const refreshHistory = () => setRefresh((previous) => previous + 1)\n\n const [schemaList, setSchemaList] = useState<SchemaStatsPayload[]>()\n\n const query: SchemaStatsQueryPayload = useMemo(\n () => ({\n address: statsAddress,\n schema: SchemaStatsQuerySchema,\n }),\n [statsAddress],\n )\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n if (diviner) {\n if (divinerError) {\n if (mounted()) {\n setError(divinerError)\n setSchemaList(undefined)\n }\n } else {\n try {\n const schemas = (await diviner.divine([query])).filter(isSchemaStatsPayload)\n if (mounted()) {\n setSchemaList(schemas)\n setError(undefined)\n }\n } catch (ex) {\n setError(ex as Error)\n setSchemaList(undefined)\n }\n }\n }\n },\n [diviner, refresh, divinerError, query],\n )\n\n return [schemaList, error, refreshHistory]\n}\n"],"mappings":";AACA,SAAS,aAAa,aAAAA,kBAAiB;AACvC,SAAS,uBAAuB;;;ACFhC,SAAS,uBAAuB;AAIzB,IAAM,gBAAgB,gBAAoC;;;ACJjE,SAAS,oBAAoB;AAKtB,IAAM,YAAY,CAAC,WAAW,UAAU;AAC7C,SAAO,aAAiC,eAAe,UAAU,QAAQ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,MACzB;AAAA,IACF;AAAA,EACF,GAAG,CAAC,aAAa,QAAQ,gBAAgB,WAAW,cAAc,CAAC;AAEnE,SAAO,gBAAAF,KAAC,cAAc,UAAd,EAAuB,OAAO,EAAE,UAAU,MAAM,QAAQ,YAAY,WAAW,eAAe,GAAI,UAAS;AACrH;AAEO,IAAM,sBAAmE,CAAC,EAAE,iBAAiB,eAAe,GAAG,MAAM,MAAM;AAChI,SACE,gBAAAA,KAAC,wBAAqB,iBAAkC,eACtD,0BAAAA,KAAC,4BAA0B,GAAG,OAAO,GACvC;AAEJ;","names":["useEffect","useState","useState","schemaList","jsx","schema","useEffect"]}
@@ -97,7 +97,7 @@ var SchemaMemoryProvider = ({ defaultSchema, knownSchemaList = [], ...props }) =
97
97
 
98
98
  // src/contexts/Schema/Provider/Route.tsx
99
99
  var import_react3 = require("react");
100
- var import_react_router_dom_6 = require("react-router-dom-6");
100
+ var import_react_router_dom = require("react-router-dom");
101
101
 
102
102
  // src/contexts/Schema/use.ts
103
103
  var import_react_shared2 = require("@xyo-network/react-shared");
@@ -109,7 +109,7 @@ var useSchema = (required = false) => {
109
109
  var import_jsx_runtime2 = require("react/jsx-runtime");
110
110
  var SchemaRouteProviderInner = ({ children }) => {
111
111
  const { schema, setSchema, schemaList } = useSchema();
112
- const [params, setParams] = (0, import_react_router_dom_6.useSearchParams)();
112
+ const [params, setParams] = (0, import_react_router_dom.useSearchParams)();
113
113
  const routeSchema = params.get("schema");
114
114
  const setSchemaParam = (0, import_react3.useCallback)(
115
115
  (schema2) => {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/contexts/Schema/Provider/index.ts","../../../../../src/contexts/Schema/Provider/Memory.tsx","../../../../../src/hooks/useSchemaStats.tsx","../../../../../src/contexts/Schema/Context.ts","../../../../../src/contexts/Schema/Provider/Route.tsx","../../../../../src/contexts/Schema/use.ts"],"sourcesContent":["export * from './Memory'\nexport * from './Props'\nexport * from './Route'\n","import { compact } from '@xylabs/lodash'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { useEffect, useState } from 'react'\n\nimport { useSchemaStats } from '../../../hooks'\nimport { SchemaContext } from '../Context'\nimport { SchemaProviderProps } from './Props'\n\nexport const SchemaMemoryProvider: React.FC<WithChildren<SchemaProviderProps>> = ({ defaultSchema, knownSchemaList = [], ...props }) => {\n const [schema, setSchema] = useState(defaultSchema)\n const [schemaList, setSchemaList] = useState<string[] | undefined>(knownSchemaList)\n const [fetchedSchemaStats] = useSchemaStats()\n\n useEffect(() => {\n if (fetchedSchemaStats) {\n const schemaList = compact(fetchedSchemaStats.map(({ name }) => name))\n setSchemaList(schemaList)\n }\n }, [fetchedSchemaStats])\n\n return <SchemaContext.Provider value={{ provided: true, schema, schemaList: knownSchemaList ?? schemaList, setSchema, setSchemaList }} {...props} />\n}\n","import { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { isSchemaStatsPayload, SchemaStatsPayload, SchemaStatsQueryPayload, SchemaStatsQuerySchema } from '@xyo-network/diviner-schema-stats-model'\nimport { TYPES } from '@xyo-network/node-core-types'\nimport { useDivinerFromNode } from '@xyo-network/react-diviner'\nimport { Dispatch, SetStateAction, useMemo, useState } from 'react'\n\nexport const useSchemaStats = (\n statsAddress?: string,\n nameOrAddress = TYPES.SchemaStatsDiviner.description,\n): [SchemaStatsPayload[] | undefined, Error | undefined, Dispatch<SetStateAction<number>>] => {\n const [refresh, setRefresh] = useState(1)\n const [diviner, divinerError] = useDivinerFromNode(nameOrAddress)\n const [error, setError] = useState<Error>()\n const refreshHistory = () => setRefresh((previous) => previous + 1)\n\n const [schemaList, setSchemaList] = useState<SchemaStatsPayload[]>()\n\n const query: SchemaStatsQueryPayload = useMemo(\n () => ({\n address: statsAddress,\n schema: SchemaStatsQuerySchema,\n }),\n [statsAddress],\n )\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n if (diviner) {\n if (divinerError) {\n if (mounted()) {\n setError(divinerError)\n setSchemaList(undefined)\n }\n } else {\n try {\n const schemas = (await diviner.divine([query])).filter(isSchemaStatsPayload)\n if (mounted()) {\n setSchemaList(schemas)\n setError(undefined)\n }\n } catch (ex) {\n setError(ex as Error)\n setSchemaList(undefined)\n }\n }\n }\n },\n [diviner, refresh, divinerError, query],\n )\n\n return [schemaList, error, refreshHistory]\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { SchemaContextState } from './State'\n\nexport const SchemaContext = createContextEx<SchemaContextState>()\n","import type { WithChildren } from '@xylabs/react-shared'\nimport { useCallback, useEffect } from 'react'\nimport { useSearchParams } from 'react-router-dom-6'\n\nimport { SchemaContext } from '../Context'\nimport { useSchema } from '../use'\nimport { SchemaMemoryProvider } from './Memory'\nimport { SchemaProviderProps } from './Props'\n\nconst SchemaRouteProviderInner: React.FC<WithChildren> = ({ children }) => {\n const { schema, setSchema, schemaList } = useSchema()\n\n const [params, setParams] = useSearchParams()\n\n const routeSchema = params.get('schema')\n\n //update the network stored in the route\n const setSchemaParam = useCallback(\n (schema?: string) => {\n if (schema) {\n params.set('schema', schema)\n setParams(params, { replace: true })\n setSchema?.(schema)\n } else {\n params.delete('network')\n }\n },\n [params, setParams, setSchema],\n )\n\n //if the network is actively changed, update both memory and route\n const setSchemaLocal = useCallback(\n (schema: string) => {\n setSchemaParam(schema)\n setSchema?.(schema)\n },\n [setSchemaParam, setSchema],\n )\n\n //sync memory and route storage of network\n useEffect(() => {\n if (routeSchema !== schema) {\n if (routeSchema === undefined && schema !== undefined) {\n //if the route does not have a network selected, use what is in the memory context\n setSchemaLocal(schema)\n } else if (routeSchema) {\n //if the route has a selection and it is different from memory, update memory\n setSchema?.(routeSchema)\n }\n }\n }, [routeSchema, schema, setSchemaParam, setSchema, setSchemaLocal])\n\n return <SchemaContext.Provider value={{ provided: true, schema, schemaList, setSchema: setSchemaLocal }}>{children}</SchemaContext.Provider>\n}\n\nexport const SchemaRouteProvider: React.FC<WithChildren<SchemaProviderProps>> = ({ knownSchemaList, defaultSchema, ...props }) => {\n return (\n <SchemaMemoryProvider knownSchemaList={knownSchemaList} defaultSchema={defaultSchema}>\n <SchemaRouteProviderInner {...props} />\n </SchemaMemoryProvider>\n )\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { SchemaContext } from './Context'\nimport { SchemaContextState } from './State'\n\nexport const useSchema = (required = false) => {\n return useContextEx<SchemaContextState>(SchemaContext, 'Schema', required)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,oBAAwB;AAExB,IAAAA,gBAAoC;;;ACFpC,gCAA+B;AAC/B,wCAA0G;AAC1G,6BAAsB;AACtB,2BAAmC;AACnC,mBAA4D;AAErD,IAAM,iBAAiB,CAC5B,cACA,gBAAgB,6BAAM,mBAAmB,gBACmD;AAC5F,QAAM,CAAC,SAAS,UAAU,QAAI,uBAAS,CAAC;AACxC,QAAM,CAAC,SAAS,YAAY,QAAI,yCAAmB,aAAa;AAChE,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAgB;AAC1C,QAAM,iBAAiB,MAAM,WAAW,CAAC,aAAa,WAAW,CAAC;AAElE,QAAM,CAAC,YAAY,aAAa,QAAI,uBAA+B;AAEnE,QAAM,YAAiC;AAAA,IACrC,OAAO;AAAA,MACL,SAAS;AAAA,MACT,QAAQ;AAAA,IACV;AAAA,IACA,CAAC,YAAY;AAAA,EACf;AAEA;AAAA;AAAA,IAEE,OAAO,YAAY;AACjB,UAAI,SAAS;AACX,YAAI,cAAc;AAChB,cAAI,QAAQ,GAAG;AACb,qBAAS,YAAY;AACrB,0BAAc,MAAS;AAAA,UACzB;AAAA,QACF,OAAO;AACL,cAAI;AACF,kBAAM,WAAW,MAAM,QAAQ,OAAO,CAAC,KAAK,CAAC,GAAG,OAAO,sDAAoB;AAC3E,gBAAI,QAAQ,GAAG;AACb,4BAAc,OAAO;AACrB,uBAAS,MAAS;AAAA,YACpB;AAAA,UACF,SAAS,IAAI;AACX,qBAAS,E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,EAAE,SAAS,KAAK,CAAC;AACnC,oBAAYA,OAAM;AAAA,MACpB,OAAO;AACL,eAAO,OAAO,SAAS;AAAA,MACzB;AAAA,IACF;AAAA,IACA,CAAC,QAAQ,WAAW,SAAS;AAAA,EAC/B;AAGA,QAAM,qBAAiB;AAAA,IACrB,CAACA,YAAmB;AAClB,qBAAeA,OAAM;AACrB,kBAAYA,OAAM;AAAA,IACpB;AAAA,IACA,CAAC,gBAAgB,SAAS;AAAA,EAC5B;AAGA,+BAAU,MAAM;AACd,QAAI,gBAAgB,QAAQ;AAC1B,UAAI,gBAAgB,UAAa,WAAW,QAAW;AAErD,uBAAe,MAAM;AAAA,MACvB,WAAW,aAAa;AAEtB,oBAAY,WAAW;AAAA,MACzB;AAAA,IACF;AAAA,EACF,GAAG,CAAC,aAAa,QAAQ,gBAAgB,WAAW,cAAc,CAAC;AAEnE,SAAO,6CAAC,cAAc,UAAd,EAAuB,OAAO,EAAE,UAAU,MAAM,QAAQ,YAAY,WAAW,eAAe,GAAI,UAAS;AACrH;AAEO,IAAM,sBAAmE,CAAC,EAAE,iBAAiB,eAAe,GAAG,MAAM,MAAM;AAChI,SACE,6CAAC,wBAAqB,iBAAkC,eACtD,uDAAC,4BAA0B,GAAG,OAAO,GACvC;AAEJ;","names":["import_react","schemaList","import_react","import_react_shared","import_jsx_runtime","schema"]}
1
+ {"version":3,"sources":["../../../../../src/contexts/Schema/Provider/index.ts","../../../../../src/contexts/Schema/Provider/Memory.tsx","../../../../../src/hooks/useSchemaStats.tsx","../../../../../src/contexts/Schema/Context.ts","../../../../../src/contexts/Schema/Provider/Route.tsx","../../../../../src/contexts/Schema/use.ts"],"sourcesContent":["export * from './Memory'\nexport * from './Props'\nexport * from './Route'\n","import { compact } from '@xylabs/lodash'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { useEffect, useState } from 'react'\n\nimport { useSchemaStats } from '../../../hooks'\nimport { SchemaContext } from '../Context'\nimport { SchemaProviderProps } from './Props'\n\nexport const SchemaMemoryProvider: React.FC<WithChildren<SchemaProviderProps>> = ({ defaultSchema, knownSchemaList = [], ...props }) => {\n const [schema, setSchema] = useState(defaultSchema)\n const [schemaList, setSchemaList] = useState<string[] | undefined>(knownSchemaList)\n const [fetchedSchemaStats] = useSchemaStats()\n\n useEffect(() => {\n if (fetchedSchemaStats) {\n const schemaList = compact(fetchedSchemaStats.map(({ name }) => name))\n setSchemaList(schemaList)\n }\n }, [fetchedSchemaStats])\n\n return <SchemaContext.Provider value={{ provided: true, schema, schemaList: knownSchemaList ?? schemaList, setSchema, setSchemaList }} {...props} />\n}\n","import { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { isSchemaStatsPayload, SchemaStatsPayload, SchemaStatsQueryPayload, SchemaStatsQuerySchema } from '@xyo-network/diviner-schema-stats-model'\nimport { TYPES } from '@xyo-network/node-core-types'\nimport { useDivinerFromNode } from '@xyo-network/react-diviner'\nimport { Dispatch, SetStateAction, useMemo, useState } from 'react'\n\nexport const useSchemaStats = (\n statsAddress?: string,\n nameOrAddress = TYPES.SchemaStatsDiviner.description,\n): [SchemaStatsPayload[] | undefined, Error | undefined, Dispatch<SetStateAction<number>>] => {\n const [refresh, setRefresh] = useState(1)\n const [diviner, divinerError] = useDivinerFromNode(nameOrAddress)\n const [error, setError] = useState<Error>()\n const refreshHistory = () => setRefresh((previous) => previous + 1)\n\n const [schemaList, setSchemaList] = useState<SchemaStatsPayload[]>()\n\n const query: SchemaStatsQueryPayload = useMemo(\n () => ({\n address: statsAddress,\n schema: SchemaStatsQuerySchema,\n }),\n [statsAddress],\n )\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n if (diviner) {\n if (divinerError) {\n if (mounted()) {\n setError(divinerError)\n setSchemaList(undefined)\n }\n } else {\n try {\n const schemas = (await diviner.divine([query])).filter(isSchemaStatsPayload)\n if (mounted()) {\n setSchemaList(schemas)\n setError(undefined)\n }\n } catch (ex) {\n setError(ex as Error)\n setSchemaList(undefined)\n }\n }\n }\n },\n [diviner, refresh, divinerError, query],\n )\n\n return [schemaList, error, refreshHistory]\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { SchemaContextState } from './State'\n\nexport const SchemaContext = createContextEx<SchemaContextState>()\n","import type { WithChildren } from '@xylabs/react-shared'\nimport { useCallback, useEffect } from 'react'\nimport { useSearchParams } from 'react-router-dom'\n\nimport { SchemaContext } from '../Context'\nimport { useSchema } from '../use'\nimport { SchemaMemoryProvider } from './Memory'\nimport { SchemaProviderProps } from './Props'\n\nconst SchemaRouteProviderInner: React.FC<WithChildren> = ({ children }) => {\n const { schema, setSchema, schemaList } = useSchema()\n\n const [params, setParams] = useSearchParams()\n\n const routeSchema = params.get('schema')\n\n //update the network stored in the route\n const setSchemaParam = useCallback(\n (schema?: string) => {\n if (schema) {\n params.set('schema', schema)\n setParams(params, { replace: true })\n setSchema?.(schema)\n } else {\n params.delete('network')\n }\n },\n [params, setParams, setSchema],\n )\n\n //if the network is actively changed, update both memory and route\n const setSchemaLocal = useCallback(\n (schema: string) => {\n setSchemaParam(schema)\n setSchema?.(schema)\n },\n [setSchemaParam, setSchema],\n )\n\n //sync memory and route storage of network\n useEffect(() => {\n if (routeSchema !== schema) {\n if (routeSchema === undefined && schema !== undefined) {\n //if the route does not have a network selected, use what is in the memory context\n setSchemaLocal(schema)\n } else if (routeSchema) {\n //if the route has a selection and it is different from memory, update memory\n setSchema?.(routeSchema)\n }\n }\n }, [routeSchema, schema, setSchemaParam, setSchema, setSchemaLocal])\n\n return <SchemaContext.Provider value={{ provided: true, schema, schemaList, setSchema: setSchemaLocal }}>{children}</SchemaContext.Provider>\n}\n\nexport const SchemaRouteProvider: React.FC<WithChildren<SchemaProviderProps>> = ({ knownSchemaList, defaultSchema, ...props }) => {\n return (\n <SchemaMemoryProvider knownSchemaList={knownSchemaList} defaultSchema={defaultSchema}>\n <SchemaRouteProviderInner {...props} />\n </SchemaMemoryProvider>\n )\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { SchemaContext } from './Context'\nimport { SchemaContextState } from './State'\n\nexport const useSchema = (required = false) => {\n return useContextEx<SchemaContextState>(SchemaContext, 'Schema', required)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,oBAAwB;AAExB,IAAAA,gBAAoC;;;ACFpC,gCAA+B;AAC/B,wCAA0G;AAC1G,6BAAsB;AACtB,2BAAmC;AACnC,mBAA4D;AAErD,IAAM,iBAAiB,CAC5B,cACA,gBAAgB,6BAAM,mBAAmB,gBACmD;AAC5F,QAAM,CAAC,SAAS,UAAU,QAAI,uBAAS,CAAC;AACxC,QAAM,CAAC,SAAS,YAAY,QAAI,yCAAmB,aAAa;AAChE,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAgB;AAC1C,QAAM,iBAAiB,MAAM,WAAW,CAAC,aAAa,WAAW,CAAC;AAElE,QAAM,CAAC,YAAY,aAAa,QAAI,uBAA+B;AAEnE,QAAM,YAAiC;AAAA,IACrC,OAAO;AAAA,MACL,SAAS;AAAA,MACT,QAAQ;AAAA,IACV;AAAA,IACA,CAAC,YAAY;AAAA,EACf;AAEA;AAAA;AAAA,IAEE,OAAO,YAAY;AACjB,UAAI,SAAS;AACX,YAAI,cAAc;AAChB,cAAI,QAAQ,GAAG;AACb,qBAAS,YAAY;AACrB,0BAAc,MAAS;AAAA,UACzB;AAAA,QACF,OAAO;AACL,cAAI;AACF,kBAAM,WAAW,MAAM,QAAQ,OAAO,CAAC,KAAK,CAAC,GAAG,OAAO,sDAAoB;AAC3E,gBAAI,QAAQ,GAAG;AACb,4BAAc,OAAO;AACrB,uBAAS,MAAS;AAAA,YACpB;AAAA,UACF,SAAS,IAAI;AACX,qBAAS,EAAW;AACpB,0BAAc,MAAS;AAAA,UACzB;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,IACA,CAAC,SAAS,SAAS,cAAc,KAAK;AAAA,EACxC;AAEA,SAA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,WAAW,SAAS;AAAA,EAC/B;AAGA,QAAM,qBAAiB;AAAA,IACrB,CAACA,YAAmB;AAClB,qBAAeA,OAAM;AACrB,kBAAYA,OAAM;AAAA,IACpB;AAAA,IACA,CAAC,gBAAgB,SAAS;AAAA,EAC5B;AAGA,+BAAU,MAAM;AACd,QAAI,gBAAgB,QAAQ;AAC1B,UAAI,gBAAgB,UAAa,WAAW,QAAW;AAErD,uBAAe,MAAM;AAAA,MACvB,WAAW,aAAa;AAEtB,oBAAY,WAAW;AAAA,MACzB;AAAA,IACF;AAAA,EACF,GAAG,CAAC,aAAa,QAAQ,gBAAgB,WAAW,cAAc,CAAC;AAEnE,SAAO,6CAAC,cAAc,UAAd,EAAuB,OAAO,EAAE,UAAU,MAAM,QAAQ,YAAY,WAAW,eAAe,GAAI,UAAS;AACrH;AAEO,IAAM,sBAAmE,CAAC,EAAE,iBAAiB,eAAe,GAAG,MAAM,MAAM;AAChI,SACE,6CAAC,wBAAqB,iBAAkC,eACtD,uDAAC,4BAA0B,GAAG,OAAO,GACvC;AAEJ;","names":["import_react","schemaList","import_react","import_react_shared","import_jsx_runtime","schema"]}
@@ -70,7 +70,7 @@ var SchemaMemoryProvider = ({ defaultSchema, knownSchemaList = [], ...props }) =
70
70
 
71
71
  // src/contexts/Schema/Provider/Route.tsx
72
72
  import { useCallback, useEffect as useEffect2 } from "react";
73
- import { useSearchParams } from "react-router-dom-6";
73
+ import { useSearchParams } from "react-router-dom";
74
74
 
75
75
  // src/contexts/Schema/use.ts
76
76
  import { useContextEx } from "@xyo-network/react-shared";
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/contexts/Schema/Provider/Memory.tsx","../../../../../src/hooks/useSchemaStats.tsx","../../../../../src/contexts/Schema/Context.ts","../../../../../src/contexts/Schema/Provider/Route.tsx","../../../../../src/contexts/Schema/use.ts"],"sourcesContent":["import { compact } from '@xylabs/lodash'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { useEffect, useState } from 'react'\n\nimport { useSchemaStats } from '../../../hooks'\nimport { SchemaContext } from '../Context'\nimport { SchemaProviderProps } from './Props'\n\nexport const SchemaMemoryProvider: React.FC<WithChildren<SchemaProviderProps>> = ({ defaultSchema, knownSchemaList = [], ...props }) => {\n const [schema, setSchema] = useState(defaultSchema)\n const [schemaList, setSchemaList] = useState<string[] | undefined>(knownSchemaList)\n const [fetchedSchemaStats] = useSchemaStats()\n\n useEffect(() => {\n if (fetchedSchemaStats) {\n const schemaList = compact(fetchedSchemaStats.map(({ name }) => name))\n setSchemaList(schemaList)\n }\n }, [fetchedSchemaStats])\n\n return <SchemaContext.Provider value={{ provided: true, schema, schemaList: knownSchemaList ?? schemaList, setSchema, setSchemaList }} {...props} />\n}\n","import { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { isSchemaStatsPayload, SchemaStatsPayload, SchemaStatsQueryPayload, SchemaStatsQuerySchema } from '@xyo-network/diviner-schema-stats-model'\nimport { TYPES } from '@xyo-network/node-core-types'\nimport { useDivinerFromNode } from '@xyo-network/react-diviner'\nimport { Dispatch, SetStateAction, useMemo, useState } from 'react'\n\nexport const useSchemaStats = (\n statsAddress?: string,\n nameOrAddress = TYPES.SchemaStatsDiviner.description,\n): [SchemaStatsPayload[] | undefined, Error | undefined, Dispatch<SetStateAction<number>>] => {\n const [refresh, setRefresh] = useState(1)\n const [diviner, divinerError] = useDivinerFromNode(nameOrAddress)\n const [error, setError] = useState<Error>()\n const refreshHistory = () => setRefresh((previous) => previous + 1)\n\n const [schemaList, setSchemaList] = useState<SchemaStatsPayload[]>()\n\n const query: SchemaStatsQueryPayload = useMemo(\n () => ({\n address: statsAddress,\n schema: SchemaStatsQuerySchema,\n }),\n [statsAddress],\n )\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n if (diviner) {\n if (divinerError) {\n if (mounted()) {\n setError(divinerError)\n setSchemaList(undefined)\n }\n } else {\n try {\n const schemas = (await diviner.divine([query])).filter(isSchemaStatsPayload)\n if (mounted()) {\n setSchemaList(schemas)\n setError(undefined)\n }\n } catch (ex) {\n setError(ex as Error)\n setSchemaList(undefined)\n }\n }\n }\n },\n [diviner, refresh, divinerError, query],\n )\n\n return [schemaList, error, refreshHistory]\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { SchemaContextState } from './State'\n\nexport const SchemaContext = createContextEx<SchemaContextState>()\n","import type { WithChildren } from '@xylabs/react-shared'\nimport { useCallback, useEffect } from 'react'\nimport { useSearchParams } from 'react-router-dom-6'\n\nimport { SchemaContext } from '../Context'\nimport { useSchema } from '../use'\nimport { SchemaMemoryProvider } from './Memory'\nimport { SchemaProviderProps } from './Props'\n\nconst SchemaRouteProviderInner: React.FC<WithChildren> = ({ children }) => {\n const { schema, setSchema, schemaList } = useSchema()\n\n const [params, setParams] = useSearchParams()\n\n const routeSchema = params.get('schema')\n\n //update the network stored in the route\n const setSchemaParam = useCallback(\n (schema?: string) => {\n if (schema) {\n params.set('schema', schema)\n setParams(params, { replace: true })\n setSchema?.(schema)\n } else {\n params.delete('network')\n }\n },\n [params, setParams, setSchema],\n )\n\n //if the network is actively changed, update both memory and route\n const setSchemaLocal = useCallback(\n (schema: string) => {\n setSchemaParam(schema)\n setSchema?.(schema)\n },\n [setSchemaParam, setSchema],\n )\n\n //sync memory and route storage of network\n useEffect(() => {\n if (routeSchema !== schema) {\n if (routeSchema === undefined && schema !== undefined) {\n //if the route does not have a network selected, use what is in the memory context\n setSchemaLocal(schema)\n } else if (routeSchema) {\n //if the route has a selection and it is different from memory, update memory\n setSchema?.(routeSchema)\n }\n }\n }, [routeSchema, schema, setSchemaParam, setSchema, setSchemaLocal])\n\n return <SchemaContext.Provider value={{ provided: true, schema, schemaList, setSchema: setSchemaLocal }}>{children}</SchemaContext.Provider>\n}\n\nexport const SchemaRouteProvider: React.FC<WithChildren<SchemaProviderProps>> = ({ knownSchemaList, defaultSchema, ...props }) => {\n return (\n <SchemaMemoryProvider knownSchemaList={knownSchemaList} defaultSchema={defaultSchema}>\n <SchemaRouteProviderInner {...props} />\n </SchemaMemoryProvider>\n )\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { SchemaContext } from './Context'\nimport { SchemaContextState } from './State'\n\nexport const useSchema = (required = false) => {\n return useContextEx<SchemaContextState>(SchemaContext, 'Schema', required)\n}\n"],"mappings":";AAAA,SAAS,eAAe;AAExB,SAAS,WAAW,YAAAA,iBAAgB;;;ACFpC,SAAS,sBAAsB;AAC/B,SAAS,sBAAmE,8BAA8B;AAC1G,SAAS,aAAa;AACtB,SAAS,0BAA0B;AACnC,SAAmC,SAAS,gBAAgB;AAErD,IAAM,iBAAiB,CAC5B,cACA,gBAAgB,MAAM,mBAAmB,gBACmD;AAC5F,QAAM,CAAC,SAAS,UAAU,IAAI,SAAS,CAAC;AACxC,QAAM,CAAC,SAAS,YAAY,IAAI,mBAAmB,aAAa;AAChE,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAgB;AAC1C,QAAM,iBAAiB,MAAM,WAAW,CAAC,aAAa,WAAW,CAAC;AAElE,QAAM,CAAC,YAAY,aAAa,IAAI,SAA+B;AAEnE,QAAM,QAAiC;AAAA,IACrC,OAAO;AAAA,MACL,SAAS;AAAA,MACT,QAAQ;AAAA,IACV;AAAA,IACA,CAAC,YAAY;AAAA,EACf;AAEA;AAAA;AAAA,IAEE,OAAO,YAAY;AACjB,UAAI,SAAS;AACX,YAAI,cAAc;AAChB,cAAI,QAAQ,GAAG;AACb,qBAAS,YAAY;AACrB,0BAAc,MAAS;AAAA,UACzB;AAAA,QACF,OAAO;AACL,cAAI;AACF,kBAAM,WAAW,MAAM,QAAQ,OAAO,CAAC,KAAK,CAAC,GAAG,OAAO,oBAAoB;AAC3E,gBAAI,QAAQ,GAAG;AACb,4BAAc,OAAO;AACrB,uBAAS,MAAS;AAAA,YACpB;AAAA,UACF,SAAS,IAAI;AACX,qBAAS,EAAW;AACpB,0BAAc,MAAS;AAAA,UACzB;AAAA,QACF;AAAA,MAC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A,OAAM;AAAA,MACpB,OAAO;AACL,eAAO,OAAO,SAAS;AAAA,MACzB;AAAA,IACF;AAAA,IACA,CAAC,QAAQ,WAAW,SAAS;AAAA,EAC/B;AAGA,QAAM,iBAAiB;AAAA,IACrB,CAACA,YAAmB;AAClB,qBAAeA,OAAM;AACrB,kBAAYA,OAAM;AAAA,IACpB;AAAA,IACA,CAAC,gBAAgB,SAAS;AAAA,EAC5B;AAGA,EAAAC,WAAU,MAAM;AACd,QAAI,gBAAgB,QAAQ;AAC1B,UAAI,gBAAgB,UAAa,WAAW,QAAW;AAErD,uBAAe,MAAM;AAAA,MACvB,WAAW,aAAa;AAEtB,oBAAY,WAAW;AAAA,MACzB;AAAA,IACF;AAAA,EACF,GAAG,CAAC,aAAa,QAAQ,gBAAgB,WAAW,cAAc,CAAC;AAEnE,SAAO,gBAAAF,KAAC,cAAc,UAAd,EAAuB,OAAO,EAAE,UAAU,MAAM,QAAQ,YAAY,WAAW,eAAe,GAAI,UAAS;AACrH;AAEO,IAAM,sBAAmE,CAAC,EAAE,iBAAiB,eAAe,GAAG,MAAM,MAAM;AAChI,SACE,gBAAAA,KAAC,wBAAqB,iBAAkC,eACtD,0BAAAA,KAAC,4BAA0B,GAAG,OAAO,GACvC;AAEJ;","names":["useState","useState","schemaList","useEffect","jsx","schema","useEffect"]}
1
+ {"version":3,"sources":["../../../../../src/contexts/Schema/Provider/Memory.tsx","../../../../../src/hooks/useSchemaStats.tsx","../../../../../src/contexts/Schema/Context.ts","../../../../../src/contexts/Schema/Provider/Route.tsx","../../../../../src/contexts/Schema/use.ts"],"sourcesContent":["import { compact } from '@xylabs/lodash'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { useEffect, useState } from 'react'\n\nimport { useSchemaStats } from '../../../hooks'\nimport { SchemaContext } from '../Context'\nimport { SchemaProviderProps } from './Props'\n\nexport const SchemaMemoryProvider: React.FC<WithChildren<SchemaProviderProps>> = ({ defaultSchema, knownSchemaList = [], ...props }) => {\n const [schema, setSchema] = useState(defaultSchema)\n const [schemaList, setSchemaList] = useState<string[] | undefined>(knownSchemaList)\n const [fetchedSchemaStats] = useSchemaStats()\n\n useEffect(() => {\n if (fetchedSchemaStats) {\n const schemaList = compact(fetchedSchemaStats.map(({ name }) => name))\n setSchemaList(schemaList)\n }\n }, [fetchedSchemaStats])\n\n return <SchemaContext.Provider value={{ provided: true, schema, schemaList: knownSchemaList ?? schemaList, setSchema, setSchemaList }} {...props} />\n}\n","import { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { isSchemaStatsPayload, SchemaStatsPayload, SchemaStatsQueryPayload, SchemaStatsQuerySchema } from '@xyo-network/diviner-schema-stats-model'\nimport { TYPES } from '@xyo-network/node-core-types'\nimport { useDivinerFromNode } from '@xyo-network/react-diviner'\nimport { Dispatch, SetStateAction, useMemo, useState } from 'react'\n\nexport const useSchemaStats = (\n statsAddress?: string,\n nameOrAddress = TYPES.SchemaStatsDiviner.description,\n): [SchemaStatsPayload[] | undefined, Error | undefined, Dispatch<SetStateAction<number>>] => {\n const [refresh, setRefresh] = useState(1)\n const [diviner, divinerError] = useDivinerFromNode(nameOrAddress)\n const [error, setError] = useState<Error>()\n const refreshHistory = () => setRefresh((previous) => previous + 1)\n\n const [schemaList, setSchemaList] = useState<SchemaStatsPayload[]>()\n\n const query: SchemaStatsQueryPayload = useMemo(\n () => ({\n address: statsAddress,\n schema: SchemaStatsQuerySchema,\n }),\n [statsAddress],\n )\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n if (diviner) {\n if (divinerError) {\n if (mounted()) {\n setError(divinerError)\n setSchemaList(undefined)\n }\n } else {\n try {\n const schemas = (await diviner.divine([query])).filter(isSchemaStatsPayload)\n if (mounted()) {\n setSchemaList(schemas)\n setError(undefined)\n }\n } catch (ex) {\n setError(ex as Error)\n setSchemaList(undefined)\n }\n }\n }\n },\n [diviner, refresh, divinerError, query],\n )\n\n return [schemaList, error, refreshHistory]\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { SchemaContextState } from './State'\n\nexport const SchemaContext = createContextEx<SchemaContextState>()\n","import type { WithChildren } from '@xylabs/react-shared'\nimport { useCallback, useEffect } from 'react'\nimport { useSearchParams } from 'react-router-dom'\n\nimport { SchemaContext } from '../Context'\nimport { useSchema } from '../use'\nimport { SchemaMemoryProvider } from './Memory'\nimport { SchemaProviderProps } from './Props'\n\nconst SchemaRouteProviderInner: React.FC<WithChildren> = ({ children }) => {\n const { schema, setSchema, schemaList } = useSchema()\n\n const [params, setParams] = useSearchParams()\n\n const routeSchema = params.get('schema')\n\n //update the network stored in the route\n const setSchemaParam = useCallback(\n (schema?: string) => {\n if (schema) {\n params.set('schema', schema)\n setParams(params, { replace: true })\n setSchema?.(schema)\n } else {\n params.delete('network')\n }\n },\n [params, setParams, setSchema],\n )\n\n //if the network is actively changed, update both memory and route\n const setSchemaLocal = useCallback(\n (schema: string) => {\n setSchemaParam(schema)\n setSchema?.(schema)\n },\n [setSchemaParam, setSchema],\n )\n\n //sync memory and route storage of network\n useEffect(() => {\n if (routeSchema !== schema) {\n if (routeSchema === undefined && schema !== undefined) {\n //if the route does not have a network selected, use what is in the memory context\n setSchemaLocal(schema)\n } else if (routeSchema) {\n //if the route has a selection and it is different from memory, update memory\n setSchema?.(routeSchema)\n }\n }\n }, [routeSchema, schema, setSchemaParam, setSchema, setSchemaLocal])\n\n return <SchemaContext.Provider value={{ provided: true, schema, schemaList, setSchema: setSchemaLocal }}>{children}</SchemaContext.Provider>\n}\n\nexport const SchemaRouteProvider: React.FC<WithChildren<SchemaProviderProps>> = ({ knownSchemaList, defaultSchema, ...props }) => {\n return (\n <SchemaMemoryProvider knownSchemaList={knownSchemaList} defaultSchema={defaultSchema}>\n <SchemaRouteProviderInner {...props} />\n </SchemaMemoryProvider>\n )\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { SchemaContext } from './Context'\nimport { SchemaContextState } from './State'\n\nexport const useSchema = (required = false) => {\n return use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B;AAClB,qBAAeA,OAAM;AACrB,kBAAYA,OAAM;AAAA,IACpB;AAAA,IACA,CAAC,gBAAgB,SAAS;AAAA,EAC5B;AAGA,EAAAC,WAAU,MAAM;AACd,QAAI,gBAAgB,QAAQ;AAC1B,UAAI,gBAAgB,UAAa,WAAW,QAAW;AAErD,uBAAe,MAAM;AAAA,MACvB,WAAW,aAAa;AAEtB,oBAAY,WAAW;AAAA,MACzB;AAAA,IACF;AAAA,EACF,GAAG,CAAC,aAAa,QAAQ,gBAAgB,WAAW,cAAc,CAAC;AAEnE,SAAO,gBAAAF,KAAC,cAAc,UAAd,EAAuB,OAAO,EAAE,UAAU,MAAM,QAAQ,YAAY,WAAW,eAAe,GAAI,UAAS;AACrH;AAEO,IAAM,sBAAmE,CAAC,EAAE,iBAAiB,eAAe,GAAG,MAAM,MAAM;AAChI,SACE,gBAAAA,KAAC,wBAAqB,iBAAkC,eACtD,0BAAAA,KAAC,4BAA0B,GAAG,OAAO,GACvC;AAEJ;","names":["useState","useState","schemaList","useEffect","jsx","schema","useEffect"]}
@@ -99,7 +99,7 @@ var SchemaMemoryProvider = ({ defaultSchema, knownSchemaList = [], ...props }) =
99
99
 
100
100
  // src/contexts/Schema/Provider/Route.tsx
101
101
  var import_react3 = require("react");
102
- var import_react_router_dom_6 = require("react-router-dom-6");
102
+ var import_react_router_dom = require("react-router-dom");
103
103
 
104
104
  // src/contexts/Schema/use.ts
105
105
  var import_react_shared2 = require("@xyo-network/react-shared");
@@ -111,7 +111,7 @@ var useSchema = (required = false) => {
111
111
  var import_jsx_runtime2 = require("react/jsx-runtime");
112
112
  var SchemaRouteProviderInner = ({ children }) => {
113
113
  const { schema, setSchema, schemaList } = useSchema();
114
- const [params, setParams] = (0, import_react_router_dom_6.useSearchParams)();
114
+ const [params, setParams] = (0, import_react_router_dom.useSearchParams)();
115
115
  const routeSchema = params.get("schema");
116
116
  const setSchemaParam = (0, import_react3.useCallback)(
117
117
  (schema2) => {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/contexts/Schema/index.ts","../../../../src/contexts/Schema/Context.ts","../../../../src/contexts/Schema/Provider/Memory.tsx","../../../../src/hooks/useSchemaStats.tsx","../../../../src/contexts/Schema/Provider/Route.tsx","../../../../src/contexts/Schema/use.ts"],"sourcesContent":["export * from './Context'\nexport * from './Provider'\nexport * from './State'\nexport * from './use'\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { SchemaContextState } from './State'\n\nexport const SchemaContext = createContextEx<SchemaContextState>()\n","import { compact } from '@xylabs/lodash'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { useEffect, useState } from 'react'\n\nimport { useSchemaStats } from '../../../hooks'\nimport { SchemaContext } from '../Context'\nimport { SchemaProviderProps } from './Props'\n\nexport const SchemaMemoryProvider: React.FC<WithChildren<SchemaProviderProps>> = ({ defaultSchema, knownSchemaList = [], ...props }) => {\n const [schema, setSchema] = useState(defaultSchema)\n const [schemaList, setSchemaList] = useState<string[] | undefined>(knownSchemaList)\n const [fetchedSchemaStats] = useSchemaStats()\n\n useEffect(() => {\n if (fetchedSchemaStats) {\n const schemaList = compact(fetchedSchemaStats.map(({ name }) => name))\n setSchemaList(schemaList)\n }\n }, [fetchedSchemaStats])\n\n return <SchemaContext.Provider value={{ provided: true, schema, schemaList: knownSchemaList ?? schemaList, setSchema, setSchemaList }} {...props} />\n}\n","import { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { isSchemaStatsPayload, SchemaStatsPayload, SchemaStatsQueryPayload, SchemaStatsQuerySchema } from '@xyo-network/diviner-schema-stats-model'\nimport { TYPES } from '@xyo-network/node-core-types'\nimport { useDivinerFromNode } from '@xyo-network/react-diviner'\nimport { Dispatch, SetStateAction, useMemo, useState } from 'react'\n\nexport const useSchemaStats = (\n statsAddress?: string,\n nameOrAddress = TYPES.SchemaStatsDiviner.description,\n): [SchemaStatsPayload[] | undefined, Error | undefined, Dispatch<SetStateAction<number>>] => {\n const [refresh, setRefresh] = useState(1)\n const [diviner, divinerError] = useDivinerFromNode(nameOrAddress)\n const [error, setError] = useState<Error>()\n const refreshHistory = () => setRefresh((previous) => previous + 1)\n\n const [schemaList, setSchemaList] = useState<SchemaStatsPayload[]>()\n\n const query: SchemaStatsQueryPayload = useMemo(\n () => ({\n address: statsAddress,\n schema: SchemaStatsQuerySchema,\n }),\n [statsAddress],\n )\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n if (diviner) {\n if (divinerError) {\n if (mounted()) {\n setError(divinerError)\n setSchemaList(undefined)\n }\n } else {\n try {\n const schemas = (await diviner.divine([query])).filter(isSchemaStatsPayload)\n if (mounted()) {\n setSchemaList(schemas)\n setError(undefined)\n }\n } catch (ex) {\n setError(ex as Error)\n setSchemaList(undefined)\n }\n }\n }\n },\n [diviner, refresh, divinerError, query],\n )\n\n return [schemaList, error, refreshHistory]\n}\n","import type { WithChildren } from '@xylabs/react-shared'\nimport { useCallback, useEffect } from 'react'\nimport { useSearchParams } from 'react-router-dom-6'\n\nimport { SchemaContext } from '../Context'\nimport { useSchema } from '../use'\nimport { SchemaMemoryProvider } from './Memory'\nimport { SchemaProviderProps } from './Props'\n\nconst SchemaRouteProviderInner: React.FC<WithChildren> = ({ children }) => {\n const { schema, setSchema, schemaList } = useSchema()\n\n const [params, setParams] = useSearchParams()\n\n const routeSchema = params.get('schema')\n\n //update the network stored in the route\n const setSchemaParam = useCallback(\n (schema?: string) => {\n if (schema) {\n params.set('schema', schema)\n setParams(params, { replace: true })\n setSchema?.(schema)\n } else {\n params.delete('network')\n }\n },\n [params, setParams, setSchema],\n )\n\n //if the network is actively changed, update both memory and route\n const setSchemaLocal = useCallback(\n (schema: string) => {\n setSchemaParam(schema)\n setSchema?.(schema)\n },\n [setSchemaParam, setSchema],\n )\n\n //sync memory and route storage of network\n useEffect(() => {\n if (routeSchema !== schema) {\n if (routeSchema === undefined && schema !== undefined) {\n //if the route does not have a network selected, use what is in the memory context\n setSchemaLocal(schema)\n } else if (routeSchema) {\n //if the route has a selection and it is different from memory, update memory\n setSchema?.(routeSchema)\n }\n }\n }, [routeSchema, schema, setSchemaParam, setSchema, setSchemaLocal])\n\n return <SchemaContext.Provider value={{ provided: true, schema, schemaList, setSchema: setSchemaLocal }}>{children}</SchemaContext.Provider>\n}\n\nexport const SchemaRouteProvider: React.FC<WithChildren<SchemaProviderProps>> = ({ knownSchemaList, defaultSchema, ...props }) => {\n return (\n <SchemaMemoryProvider knownSchemaList={knownSchemaList} defaultSchema={defaultSchema}>\n <SchemaRouteProviderInner {...props} />\n </SchemaMemoryProvider>\n )\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { SchemaContext } from './Context'\nimport { SchemaContextState } from './State'\n\nexport const useSchema = (required = false) => {\n return useContextEx<SchemaContextState>(SchemaContext, 'Schema', required)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,0BAAgC;AAIzB,IAAM,oBAAgB,qCAAoC;;;ACJjE,oBAAwB;AAExB,IAAAA,gBAAoC;;;ACFpC,gCAA+B;AAC/B,wCAA0G;AAC1G,6BAAsB;AACtB,2BAAmC;AACnC,mBAA4D;AAErD,IAAM,iBAAiB,CAC5B,cACA,gBAAgB,6BAAM,mBAAmB,gBACmD;AAC5F,QAAM,CAAC,SAAS,UAAU,QAAI,uBAAS,CAAC;AACxC,QAAM,CAAC,SAAS,YAAY,QAAI,yCAAmB,aAAa;AAChE,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAgB;AAC1C,QAAM,iBAAiB,MAAM,WAAW,CAAC,aAAa,WAAW,CAAC;AAElE,QAAM,CAAC,YAAY,aAAa,QAAI,uBAA+B;AAEnE,QAAM,YAAiC;AAAA,IACrC,OAAO;AAAA,MACL,SAAS;AAAA,MACT,QAAQ;AAAA,IACV;AAAA,IACA,CAAC,YAAY;AAAA,EACf;AAEA;AAAA;AAAA,IAEE,OAAO,YAAY;AACjB,UA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AE,SAAS,MAAM;AACzE,QAAM,EAAE,QAAQ,WAAW,WAAW,IAAI,UAAU;AAEpD,QAAM,CAAC,QAAQ,SAAS,QAAI,2CAAgB;AAE5C,QAAM,cAAc,OAAO,IAAI,QAAQ;AAGvC,QAAM,qBAAiB;AAAA,IACrB,CAACC,YAAoB;AACnB,UAAIA,SAAQ;AACV,eAAO,IAAI,UAAUA,OAAM;AAC3B,kBAAU,QAAQ,EAAE,SAAS,KAAK,CAAC;AACnC,oBAAYA,OAAM;AAAA,MACpB,OAAO;AACL,eAAO,OAAO,SAAS;AAAA,MACzB;AAAA,IACF;AAAA,IACA,CAAC,QAAQ,WAAW,SAAS;AAAA,EAC/B;AAGA,QAAM,qBAAiB;AAAA,IACrB,CAACA,YAAmB;AAClB,qBAAeA,OAAM;AACrB,kBAAYA,OAAM;AAAA,IACpB;AAAA,IACA,CAAC,gBAAgB,SAAS;AAAA,EAC5B;AAGA,+BAAU,MAAM;AACd,QAAI,gBAAgB,QAAQ;AAC1B,UAAI,gBAAgB,UAAa,WAAW,QAAW;AAErD,uBAAe,MAAM;AAAA,MACvB,WAAW,aAAa;AAEtB,oBAAY,WAAW;AAAA,MACzB;AAAA,IACF;AAAA,EACF,GAAG,CAAC,aAAa,QAAQ,gBAAgB,WAAW,cAAc,CAAC;AAEnE,SAAO,6CAAC,cAAc,UAAd,EAAuB,OAAO,EAAE,UAAU,MAAM,QAAQ,YAAY,WAAW,eAAe,GAAI,UAAS;AACrH;AAEO,IAAM,sBAAmE,CAAC,EAAE,iBAAiB,eAAe,GAAG,MAAM,MAAM;AAChI,SACE,6CAAC,wBAAqB,iBAAkC,eACtD,uDAAC,4BAA0B,GAAG,OAAO,GACvC;AAEJ;","names":["import_react","schemaList","import_react","import_react_shared","import_jsx_runtime","schema"]}
1
+ {"version":3,"sources":["../../../../src/contexts/Schema/index.ts","../../../../src/contexts/Schema/Context.ts","../../../../src/contexts/Schema/Provider/Memory.tsx","../../../../src/hooks/useSchemaStats.tsx","../../../../src/contexts/Schema/Provider/Route.tsx","../../../../src/contexts/Schema/use.ts"],"sourcesContent":["export * from './Context'\nexport * from './Provider'\nexport * from './State'\nexport * from './use'\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { SchemaContextState } from './State'\n\nexport const SchemaContext = createContextEx<SchemaContextState>()\n","import { compact } from '@xylabs/lodash'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { useEffect, useState } from 'react'\n\nimport { useSchemaStats } from '../../../hooks'\nimport { SchemaContext } from '../Context'\nimport { SchemaProviderProps } from './Props'\n\nexport const SchemaMemoryProvider: React.FC<WithChildren<SchemaProviderProps>> = ({ defaultSchema, knownSchemaList = [], ...props }) => {\n const [schema, setSchema] = useState(defaultSchema)\n const [schemaList, setSchemaList] = useState<string[] | undefined>(knownSchemaList)\n const [fetchedSchemaStats] = useSchemaStats()\n\n useEffect(() => {\n if (fetchedSchemaStats) {\n const schemaList = compact(fetchedSchemaStats.map(({ name }) => name))\n setSchemaList(schemaList)\n }\n }, [fetchedSchemaStats])\n\n return <SchemaContext.Provider value={{ provided: true, schema, schemaList: knownSchemaList ?? schemaList, setSchema, setSchemaList }} {...props} />\n}\n","import { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { isSchemaStatsPayload, SchemaStatsPayload, SchemaStatsQueryPayload, SchemaStatsQuerySchema } from '@xyo-network/diviner-schema-stats-model'\nimport { TYPES } from '@xyo-network/node-core-types'\nimport { useDivinerFromNode } from '@xyo-network/react-diviner'\nimport { Dispatch, SetStateAction, useMemo, useState } from 'react'\n\nexport const useSchemaStats = (\n statsAddress?: string,\n nameOrAddress = TYPES.SchemaStatsDiviner.description,\n): [SchemaStatsPayload[] | undefined, Error | undefined, Dispatch<SetStateAction<number>>] => {\n const [refresh, setRefresh] = useState(1)\n const [diviner, divinerError] = useDivinerFromNode(nameOrAddress)\n const [error, setError] = useState<Error>()\n const refreshHistory = () => setRefresh((previous) => previous + 1)\n\n const [schemaList, setSchemaList] = useState<SchemaStatsPayload[]>()\n\n const query: SchemaStatsQueryPayload = useMemo(\n () => ({\n address: statsAddress,\n schema: SchemaStatsQuerySchema,\n }),\n [statsAddress],\n )\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n if (diviner) {\n if (divinerError) {\n if (mounted()) {\n setError(divinerError)\n setSchemaList(undefined)\n }\n } else {\n try {\n const schemas = (await diviner.divine([query])).filter(isSchemaStatsPayload)\n if (mounted()) {\n setSchemaList(schemas)\n setError(undefined)\n }\n } catch (ex) {\n setError(ex as Error)\n setSchemaList(undefined)\n }\n }\n }\n },\n [diviner, refresh, divinerError, query],\n )\n\n return [schemaList, error, refreshHistory]\n}\n","import type { WithChildren } from '@xylabs/react-shared'\nimport { useCallback, useEffect } from 'react'\nimport { useSearchParams } from 'react-router-dom'\n\nimport { SchemaContext } from '../Context'\nimport { useSchema } from '../use'\nimport { SchemaMemoryProvider } from './Memory'\nimport { SchemaProviderProps } from './Props'\n\nconst SchemaRouteProviderInner: React.FC<WithChildren> = ({ children }) => {\n const { schema, setSchema, schemaList } = useSchema()\n\n const [params, setParams] = useSearchParams()\n\n const routeSchema = params.get('schema')\n\n //update the network stored in the route\n const setSchemaParam = useCallback(\n (schema?: string) => {\n if (schema) {\n params.set('schema', schema)\n setParams(params, { replace: true })\n setSchema?.(schema)\n } else {\n params.delete('network')\n }\n },\n [params, setParams, setSchema],\n )\n\n //if the network is actively changed, update both memory and route\n const setSchemaLocal = useCallback(\n (schema: string) => {\n setSchemaParam(schema)\n setSchema?.(schema)\n },\n [setSchemaParam, setSchema],\n )\n\n //sync memory and route storage of network\n useEffect(() => {\n if (routeSchema !== schema) {\n if (routeSchema === undefined && schema !== undefined) {\n //if the route does not have a network selected, use what is in the memory context\n setSchemaLocal(schema)\n } else if (routeSchema) {\n //if the route has a selection and it is different from memory, update memory\n setSchema?.(routeSchema)\n }\n }\n }, [routeSchema, schema, setSchemaParam, setSchema, setSchemaLocal])\n\n return <SchemaContext.Provider value={{ provided: true, schema, schemaList, setSchema: setSchemaLocal }}>{children}</SchemaContext.Provider>\n}\n\nexport const SchemaRouteProvider: React.FC<WithChildren<SchemaProviderProps>> = ({ knownSchemaList, defaultSchema, ...props }) => {\n return (\n <SchemaMemoryProvider knownSchemaList={knownSchemaList} defaultSchema={defaultSchema}>\n <SchemaRouteProviderInner {...props} />\n </SchemaMemoryProvider>\n )\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { SchemaContext } from './Context'\nimport { SchemaContextState } from './State'\n\nexport const useSchema = (required = false) => {\n return useContextEx<SchemaContextState>(SchemaContext, 'Schema', required)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,0BAAgC;AAIzB,IAAM,oBAAgB,qCAAoC;;;ACJjE,oBAAwB;AAExB,IAAAA,gBAAoC;;;ACFpC,gCAA+B;AAC/B,wCAA0G;AAC1G,6BAAsB;AACtB,2BAAmC;AACnC,mBAA4D;AAErD,IAAM,iBAAiB,CAC5B,cACA,gBAAgB,6BAAM,mBAAmB,gBACmD;AAC5F,QAAM,CAAC,SAAS,UAAU,QAAI,uBAAS,CAAC;AACxC,QAAM,CAAC,SAAS,YAAY,QAAI,yCAAmB,aAAa;AAChE,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAgB;AAC1C,QAAM,iBAAiB,MAAM,WAAW,CAAC,aAAa,WAAW,CAAC;AAElE,QAAM,CAAC,YAAY,aAAa,QAAI,uBAA+B;AAEnE,QAAM,YAAiC;AAAA,IACrC,OAAO;AAAA,MACL,SAAS;AAAA,MACT,QAAQ;AAAA,IACV;AAAA,IACA,CAAC,YAAY;AAAA,EACf;AAEA;AAAA;AAAA,IAEE,OAAO,YAAY;AACjB,UAAI,SAAS;AACX,YAAI,cAAc;AAChB,cAAI,QAAQ,GAAG;AACb,qBAAS,YAAY;AACrB,0BAAc,MAAS;AAAA,UACzB;AAAA,QACF,OAAO;AACL,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M,cAAc,OAAO,IAAI,QAAQ;AAGvC,QAAM,qBAAiB;AAAA,IACrB,CAACC,YAAoB;AACnB,UAAIA,SAAQ;AACV,eAAO,IAAI,UAAUA,OAAM;AAC3B,kBAAU,QAAQ,EAAE,SAAS,KAAK,CAAC;AACnC,oBAAYA,OAAM;AAAA,MACpB,OAAO;AACL,eAAO,OAAO,SAAS;AAAA,MACzB;AAAA,IACF;AAAA,IACA,CAAC,QAAQ,WAAW,SAAS;AAAA,EAC/B;AAGA,QAAM,qBAAiB;AAAA,IACrB,CAACA,YAAmB;AAClB,qBAAeA,OAAM;AACrB,kBAAYA,OAAM;AAAA,IACpB;AAAA,IACA,CAAC,gBAAgB,SAAS;AAAA,EAC5B;AAGA,+BAAU,MAAM;AACd,QAAI,gBAAgB,QAAQ;AAC1B,UAAI,gBAAgB,UAAa,WAAW,QAAW;AAErD,uBAAe,MAAM;AAAA,MACvB,WAAW,aAAa;AAEtB,oBAAY,WAAW;AAAA,MACzB;AAAA,IACF;AAAA,EACF,GAAG,CAAC,aAAa,QAAQ,gBAAgB,WAAW,cAAc,CAAC;AAEnE,SAAO,6CAAC,cAAc,UAAd,EAAuB,OAAO,EAAE,UAAU,MAAM,QAAQ,YAAY,WAAW,eAAe,GAAI,UAAS;AACrH;AAEO,IAAM,sBAAmE,CAAC,EAAE,iBAAiB,eAAe,GAAG,MAAM,MAAM;AAChI,SACE,6CAAC,wBAAqB,iBAAkC,eACtD,uDAAC,4BAA0B,GAAG,OAAO,GACvC;AAEJ;","names":["import_react","schemaList","import_react","import_react_shared","import_jsx_runtime","schema"]}
@@ -70,7 +70,7 @@ var SchemaMemoryProvider = ({ defaultSchema, knownSchemaList = [], ...props }) =
70
70
 
71
71
  // src/contexts/Schema/Provider/Route.tsx
72
72
  import { useCallback, useEffect as useEffect2 } from "react";
73
- import { useSearchParams } from "react-router-dom-6";
73
+ import { useSearchParams } from "react-router-dom";
74
74
 
75
75
  // src/contexts/Schema/use.ts
76
76
  import { useContextEx } from "@xyo-network/react-shared";
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/contexts/Schema/Context.ts","../../../../src/contexts/Schema/Provider/Memory.tsx","../../../../src/hooks/useSchemaStats.tsx","../../../../src/contexts/Schema/Provider/Route.tsx","../../../../src/contexts/Schema/use.ts"],"sourcesContent":["import { createContextEx } from '@xyo-network/react-shared'\n\nimport { SchemaContextState } from './State'\n\nexport const SchemaContext = createContextEx<SchemaContextState>()\n","import { compact } from '@xylabs/lodash'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { useEffect, useState } from 'react'\n\nimport { useSchemaStats } from '../../../hooks'\nimport { SchemaContext } from '../Context'\nimport { SchemaProviderProps } from './Props'\n\nexport const SchemaMemoryProvider: React.FC<WithChildren<SchemaProviderProps>> = ({ defaultSchema, knownSchemaList = [], ...props }) => {\n const [schema, setSchema] = useState(defaultSchema)\n const [schemaList, setSchemaList] = useState<string[] | undefined>(knownSchemaList)\n const [fetchedSchemaStats] = useSchemaStats()\n\n useEffect(() => {\n if (fetchedSchemaStats) {\n const schemaList = compact(fetchedSchemaStats.map(({ name }) => name))\n setSchemaList(schemaList)\n }\n }, [fetchedSchemaStats])\n\n return <SchemaContext.Provider value={{ provided: true, schema, schemaList: knownSchemaList ?? schemaList, setSchema, setSchemaList }} {...props} />\n}\n","import { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { isSchemaStatsPayload, SchemaStatsPayload, SchemaStatsQueryPayload, SchemaStatsQuerySchema } from '@xyo-network/diviner-schema-stats-model'\nimport { TYPES } from '@xyo-network/node-core-types'\nimport { useDivinerFromNode } from '@xyo-network/react-diviner'\nimport { Dispatch, SetStateAction, useMemo, useState } from 'react'\n\nexport const useSchemaStats = (\n statsAddress?: string,\n nameOrAddress = TYPES.SchemaStatsDiviner.description,\n): [SchemaStatsPayload[] | undefined, Error | undefined, Dispatch<SetStateAction<number>>] => {\n const [refresh, setRefresh] = useState(1)\n const [diviner, divinerError] = useDivinerFromNode(nameOrAddress)\n const [error, setError] = useState<Error>()\n const refreshHistory = () => setRefresh((previous) => previous + 1)\n\n const [schemaList, setSchemaList] = useState<SchemaStatsPayload[]>()\n\n const query: SchemaStatsQueryPayload = useMemo(\n () => ({\n address: statsAddress,\n schema: SchemaStatsQuerySchema,\n }),\n [statsAddress],\n )\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n if (diviner) {\n if (divinerError) {\n if (mounted()) {\n setError(divinerError)\n setSchemaList(undefined)\n }\n } else {\n try {\n const schemas = (await diviner.divine([query])).filter(isSchemaStatsPayload)\n if (mounted()) {\n setSchemaList(schemas)\n setError(undefined)\n }\n } catch (ex) {\n setError(ex as Error)\n setSchemaList(undefined)\n }\n }\n }\n },\n [diviner, refresh, divinerError, query],\n )\n\n return [schemaList, error, refreshHistory]\n}\n","import type { WithChildren } from '@xylabs/react-shared'\nimport { useCallback, useEffect } from 'react'\nimport { useSearchParams } from 'react-router-dom-6'\n\nimport { SchemaContext } from '../Context'\nimport { useSchema } from '../use'\nimport { SchemaMemoryProvider } from './Memory'\nimport { SchemaProviderProps } from './Props'\n\nconst SchemaRouteProviderInner: React.FC<WithChildren> = ({ children }) => {\n const { schema, setSchema, schemaList } = useSchema()\n\n const [params, setParams] = useSearchParams()\n\n const routeSchema = params.get('schema')\n\n //update the network stored in the route\n const setSchemaParam = useCallback(\n (schema?: string) => {\n if (schema) {\n params.set('schema', schema)\n setParams(params, { replace: true })\n setSchema?.(schema)\n } else {\n params.delete('network')\n }\n },\n [params, setParams, setSchema],\n )\n\n //if the network is actively changed, update both memory and route\n const setSchemaLocal = useCallback(\n (schema: string) => {\n setSchemaParam(schema)\n setSchema?.(schema)\n },\n [setSchemaParam, setSchema],\n )\n\n //sync memory and route storage of network\n useEffect(() => {\n if (routeSchema !== schema) {\n if (routeSchema === undefined && schema !== undefined) {\n //if the route does not have a network selected, use what is in the memory context\n setSchemaLocal(schema)\n } else if (routeSchema) {\n //if the route has a selection and it is different from memory, update memory\n setSchema?.(routeSchema)\n }\n }\n }, [routeSchema, schema, setSchemaParam, setSchema, setSchemaLocal])\n\n return <SchemaContext.Provider value={{ provided: true, schema, schemaList, setSchema: setSchemaLocal }}>{children}</SchemaContext.Provider>\n}\n\nexport const SchemaRouteProvider: React.FC<WithChildren<SchemaProviderProps>> = ({ knownSchemaList, defaultSchema, ...props }) => {\n return (\n <SchemaMemoryProvider knownSchemaList={knownSchemaList} defaultSchema={defaultSchema}>\n <SchemaRouteProviderInner {...props} />\n </SchemaMemoryProvider>\n )\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { SchemaContext } from './Context'\nimport { SchemaContextState } from './State'\n\nexport const useSchema = (required = false) => {\n return useContextEx<SchemaContextState>(SchemaContext, 'Schema', required)\n}\n"],"mappings":";AAAA,SAAS,uBAAuB;AAIzB,IAAM,gBAAgB,gBAAoC;;;ACJjE,SAAS,eAAe;AAExB,SAAS,WAAW,YAAAA,iBAAgB;;;ACFpC,SAAS,sBAAsB;AAC/B,SAAS,sBAAmE,8BAA8B;AAC1G,SAAS,aAAa;AACtB,SAAS,0BAA0B;AACnC,SAAmC,SAAS,gBAAgB;AAErD,IAAM,iBAAiB,CAC5B,cACA,gBAAgB,MAAM,mBAAmB,gBACmD;AAC5F,QAAM,CAAC,SAAS,UAAU,IAAI,SAAS,CAAC;AACxC,QAAM,CAAC,SAAS,YAAY,IAAI,mBAAmB,aAAa;AAChE,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAgB;AAC1C,QAAM,iBAAiB,MAAM,WAAW,CAAC,aAAa,WAAW,CAAC;AAElE,QAAM,CAAC,YAAY,aAAa,IAAI,SAA+B;AAEnE,QAAM,QAAiC;AAAA,IACrC,OAAO;AAAA,MACL,SAAS;AAAA,MACT,QAAQ;AAAA,IACV;AAAA,IACA,CAAC,YAAY;AAAA,EACf;AAEA;AAAA;AAAA,IAEE,OAAO,YAAY;AACjB,UAAI,SAAS;AACX,YAAI,cAAc;AAChB,cAAI,QAAQ,GA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AQ,WAAW,WAAW,IAAI,UAAU;AAEpD,QAAM,CAAC,QAAQ,SAAS,IAAI,gBAAgB;AAE5C,QAAM,cAAc,OAAO,IAAI,QAAQ;AAGvC,QAAM,iBAAiB;AAAA,IACrB,CAACC,YAAoB;AACnB,UAAIA,SAAQ;AACV,eAAO,IAAI,UAAUA,OAAM;AAC3B,kBAAU,QAAQ,EAAE,SAAS,KAAK,CAAC;AACnC,oBAAYA,OAAM;AAAA,MACpB,OAAO;AACL,eAAO,OAAO,SAAS;AAAA,MACzB;AAAA,IACF;AAAA,IACA,CAAC,QAAQ,WAAW,SAAS;AAAA,EAC/B;AAGA,QAAM,iBAAiB;AAAA,IACrB,CAACA,YAAmB;AAClB,qBAAeA,OAAM;AACrB,kBAAYA,OAAM;AAAA,IACpB;AAAA,IACA,CAAC,gBAAgB,SAAS;AAAA,EAC5B;AAGA,EAAAC,WAAU,MAAM;AACd,QAAI,gBAAgB,QAAQ;AAC1B,UAAI,gBAAgB,UAAa,WAAW,QAAW;AAErD,uBAAe,MAAM;AAAA,MACvB,WAAW,aAAa;AAEtB,oBAAY,WAAW;AAAA,MACzB;AAAA,IACF;AAAA,EACF,GAAG,CAAC,aAAa,QAAQ,gBAAgB,WAAW,cAAc,CAAC;AAEnE,SAAO,gBAAAF,KAAC,cAAc,UAAd,EAAuB,OAAO,EAAE,UAAU,MAAM,QAAQ,YAAY,WAAW,eAAe,GAAI,UAAS;AACrH;AAEO,IAAM,sBAAmE,CAAC,EAAE,iBAAiB,eAAe,GAAG,MAAM,MAAM;AAChI,SACE,gBAAAA,KAAC,wBAAqB,iBAAkC,eACtD,0BAAAA,KAAC,4BAA0B,GAAG,OAAO,GACvC;AAEJ;","names":["useState","useState","schemaList","useEffect","jsx","schema","useEffect"]}
1
+ {"version":3,"sources":["../../../../src/contexts/Schema/Context.ts","../../../../src/contexts/Schema/Provider/Memory.tsx","../../../../src/hooks/useSchemaStats.tsx","../../../../src/contexts/Schema/Provider/Route.tsx","../../../../src/contexts/Schema/use.ts"],"sourcesContent":["import { createContextEx } from '@xyo-network/react-shared'\n\nimport { SchemaContextState } from './State'\n\nexport const SchemaContext = createContextEx<SchemaContextState>()\n","import { compact } from '@xylabs/lodash'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { useEffect, useState } from 'react'\n\nimport { useSchemaStats } from '../../../hooks'\nimport { SchemaContext } from '../Context'\nimport { SchemaProviderProps } from './Props'\n\nexport const SchemaMemoryProvider: React.FC<WithChildren<SchemaProviderProps>> = ({ defaultSchema, knownSchemaList = [], ...props }) => {\n const [schema, setSchema] = useState(defaultSchema)\n const [schemaList, setSchemaList] = useState<string[] | undefined>(knownSchemaList)\n const [fetchedSchemaStats] = useSchemaStats()\n\n useEffect(() => {\n if (fetchedSchemaStats) {\n const schemaList = compact(fetchedSchemaStats.map(({ name }) => name))\n setSchemaList(schemaList)\n }\n }, [fetchedSchemaStats])\n\n return <SchemaContext.Provider value={{ provided: true, schema, schemaList: knownSchemaList ?? schemaList, setSchema, setSchemaList }} {...props} />\n}\n","import { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { isSchemaStatsPayload, SchemaStatsPayload, SchemaStatsQueryPayload, SchemaStatsQuerySchema } from '@xyo-network/diviner-schema-stats-model'\nimport { TYPES } from '@xyo-network/node-core-types'\nimport { useDivinerFromNode } from '@xyo-network/react-diviner'\nimport { Dispatch, SetStateAction, useMemo, useState } from 'react'\n\nexport const useSchemaStats = (\n statsAddress?: string,\n nameOrAddress = TYPES.SchemaStatsDiviner.description,\n): [SchemaStatsPayload[] | undefined, Error | undefined, Dispatch<SetStateAction<number>>] => {\n const [refresh, setRefresh] = useState(1)\n const [diviner, divinerError] = useDivinerFromNode(nameOrAddress)\n const [error, setError] = useState<Error>()\n const refreshHistory = () => setRefresh((previous) => previous + 1)\n\n const [schemaList, setSchemaList] = useState<SchemaStatsPayload[]>()\n\n const query: SchemaStatsQueryPayload = useMemo(\n () => ({\n address: statsAddress,\n schema: SchemaStatsQuerySchema,\n }),\n [statsAddress],\n )\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n if (diviner) {\n if (divinerError) {\n if (mounted()) {\n setError(divinerError)\n setSchemaList(undefined)\n }\n } else {\n try {\n const schemas = (await diviner.divine([query])).filter(isSchemaStatsPayload)\n if (mounted()) {\n setSchemaList(schemas)\n setError(undefined)\n }\n } catch (ex) {\n setError(ex as Error)\n setSchemaList(undefined)\n }\n }\n }\n },\n [diviner, refresh, divinerError, query],\n )\n\n return [schemaList, error, refreshHistory]\n}\n","import type { WithChildren } from '@xylabs/react-shared'\nimport { useCallback, useEffect } from 'react'\nimport { useSearchParams } from 'react-router-dom'\n\nimport { SchemaContext } from '../Context'\nimport { useSchema } from '../use'\nimport { SchemaMemoryProvider } from './Memory'\nimport { SchemaProviderProps } from './Props'\n\nconst SchemaRouteProviderInner: React.FC<WithChildren> = ({ children }) => {\n const { schema, setSchema, schemaList } = useSchema()\n\n const [params, setParams] = useSearchParams()\n\n const routeSchema = params.get('schema')\n\n //update the network stored in the route\n const setSchemaParam = useCallback(\n (schema?: string) => {\n if (schema) {\n params.set('schema', schema)\n setParams(params, { replace: true })\n setSchema?.(schema)\n } else {\n params.delete('network')\n }\n },\n [params, setParams, setSchema],\n )\n\n //if the network is actively changed, update both memory and route\n const setSchemaLocal = useCallback(\n (schema: string) => {\n setSchemaParam(schema)\n setSchema?.(schema)\n },\n [setSchemaParam, setSchema],\n )\n\n //sync memory and route storage of network\n useEffect(() => {\n if (routeSchema !== schema) {\n if (routeSchema === undefined && schema !== undefined) {\n //if the route does not have a network selected, use what is in the memory context\n setSchemaLocal(schema)\n } else if (routeSchema) {\n //if the route has a selection and it is different from memory, update memory\n setSchema?.(routeSchema)\n }\n }\n }, [routeSchema, schema, setSchemaParam, setSchema, setSchemaLocal])\n\n return <SchemaContext.Provider value={{ provided: true, schema, schemaList, setSchema: setSchemaLocal }}>{children}</SchemaContext.Provider>\n}\n\nexport const SchemaRouteProvider: React.FC<WithChildren<SchemaProviderProps>> = ({ knownSchemaList, defaultSchema, ...props }) => {\n return (\n <SchemaMemoryProvider knownSchemaList={knownSchemaList} defaultSchema={defaultSchema}>\n <SchemaRouteProviderInner {...props} />\n </SchemaMemoryProvider>\n )\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { SchemaContext } from './Context'\nimport { SchemaContextState } from './State'\n\nexport const useSchema = (required = false) => {\n return useContextEx<SchemaContextState>(SchemaContext, 'Schema', required)\n}\n"],"mappings":";AAAA,SAAS,uBAAuB;AAIzB,IAAM,gBAAgB,gBAAoC;;;ACJjE,SAAS,eAAe;AAExB,SAAS,WAAW,YAAAA,iBAAgB;;;ACFpC,SAAS,sBAAsB;AAC/B,SAAS,sBAAmE,8BAA8B;AAC1G,SAAS,aAAa;AACtB,SAAS,0BAA0B;AACnC,SAAmC,SAAS,gBAAgB;AAErD,IAAM,iBAAiB,CAC5B,cACA,gBAAgB,MAAM,mBAAmB,gBACmD;AAC5F,QAAM,CAAC,SAAS,UAAU,IAAI,SAAS,CAAC;AACxC,QAAM,CAAC,SAAS,YAAY,IAAI,mBAAmB,aAAa;AAChE,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAgB;AAC1C,QAAM,iBAAiB,MAAM,WAAW,CAAC,aAAa,WAAW,CAAC;AAElE,QAAM,CAAC,YAAY,aAAa,IAAI,SAA+B;AAEnE,QAAM,QAAiC;AAAA,IACrC,OAAO;AAAA,MACL,SAAS;AAAA,MACT,QAAQ;AAAA,IACV;AAAA,IACA,CAAC,YAAY;AAAA,EACf;AAEA;AAAA;AAAA,IAEE,OAAO,YAAY;AACjB,UAAI,SAAS;AACX,YAAI,cAAc;AAChB,cAAI,QAAQ,GAAG;AACb,qBAAS,YAAY;AACrB,0BAAc,MAAS;AAAA,UACzB;AAAA,QACF,OAAO;AACL,cAAI;AACF,kBAAM,WAAW,MAAM,QAAQ,OAAO,CAAC,KAAK,CAAC,GAAG,OAAO,oBAAoB;AAC3E,gBAAI,Q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A,SAAQ;AACV,eAAO,IAAI,UAAUA,OAAM;AAC3B,kBAAU,QAAQ,EAAE,SAAS,KAAK,CAAC;AACnC,oBAAYA,OAAM;AAAA,MACpB,OAAO;AACL,eAAO,OAAO,SAAS;AAAA,MACzB;AAAA,IACF;AAAA,IACA,CAAC,QAAQ,WAAW,SAAS;AAAA,EAC/B;AAGA,QAAM,iBAAiB;AAAA,IACrB,CAACA,YAAmB;AAClB,qBAAeA,OAAM;AACrB,kBAAYA,OAAM;AAAA,IACpB;AAAA,IACA,CAAC,gBAAgB,SAAS;AAAA,EAC5B;AAGA,EAAAC,WAAU,MAAM;AACd,QAAI,gBAAgB,QAAQ;AAC1B,UAAI,gBAAgB,UAAa,WAAW,QAAW;AAErD,uBAAe,MAAM;AAAA,MACvB,WAAW,aAAa;AAEtB,oBAAY,WAAW;AAAA,MACzB;AAAA,IACF;AAAA,EACF,GAAG,CAAC,aAAa,QAAQ,gBAAgB,WAAW,cAAc,CAAC;AAEnE,SAAO,gBAAAF,KAAC,cAAc,UAAd,EAAuB,OAAO,EAAE,UAAU,MAAM,QAAQ,YAAY,WAAW,eAAe,GAAI,UAAS;AACrH;AAEO,IAAM,sBAAmE,CAAC,EAAE,iBAAiB,eAAe,GAAG,MAAM,MAAM;AAChI,SACE,gBAAAA,KAAC,wBAAqB,iBAAkC,eACtD,0BAAAA,KAAC,4BAA0B,GAAG,OAAO,GACvC;AAEJ;","names":["useState","useState","schemaList","useEffect","jsx","schema","useEffect"]}
@@ -99,7 +99,7 @@ var SchemaMemoryProvider = ({ defaultSchema, knownSchemaList = [], ...props }) =
99
99
 
100
100
  // src/contexts/Schema/Provider/Route.tsx
101
101
  var import_react3 = require("react");
102
- var import_react_router_dom_6 = require("react-router-dom-6");
102
+ var import_react_router_dom = require("react-router-dom");
103
103
 
104
104
  // src/contexts/Schema/use.ts
105
105
  var import_react_shared2 = require("@xyo-network/react-shared");
@@ -111,7 +111,7 @@ var useSchema = (required = false) => {
111
111
  var import_jsx_runtime2 = require("react/jsx-runtime");
112
112
  var SchemaRouteProviderInner = ({ children }) => {
113
113
  const { schema, setSchema, schemaList } = useSchema();
114
- const [params, setParams] = (0, import_react_router_dom_6.useSearchParams)();
114
+ const [params, setParams] = (0, import_react_router_dom.useSearchParams)();
115
115
  const routeSchema = params.get("schema");
116
116
  const setSchemaParam = (0, import_react3.useCallback)(
117
117
  (schema2) => {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/contexts/index.ts","../../../src/contexts/Schema/Context.ts","../../../src/contexts/Schema/Provider/Memory.tsx","../../../src/hooks/useSchemaStats.tsx","../../../src/contexts/Schema/Provider/Route.tsx","../../../src/contexts/Schema/use.ts"],"sourcesContent":["export * from './Schema'\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { SchemaContextState } from './State'\n\nexport const SchemaContext = createContextEx<SchemaContextState>()\n","import { compact } from '@xylabs/lodash'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { useEffect, useState } from 'react'\n\nimport { useSchemaStats } from '../../../hooks'\nimport { SchemaContext } from '../Context'\nimport { SchemaProviderProps } from './Props'\n\nexport const SchemaMemoryProvider: React.FC<WithChildren<SchemaProviderProps>> = ({ defaultSchema, knownSchemaList = [], ...props }) => {\n const [schema, setSchema] = useState(defaultSchema)\n const [schemaList, setSchemaList] = useState<string[] | undefined>(knownSchemaList)\n const [fetchedSchemaStats] = useSchemaStats()\n\n useEffect(() => {\n if (fetchedSchemaStats) {\n const schemaList = compact(fetchedSchemaStats.map(({ name }) => name))\n setSchemaList(schemaList)\n }\n }, [fetchedSchemaStats])\n\n return <SchemaContext.Provider value={{ provided: true, schema, schemaList: knownSchemaList ?? schemaList, setSchema, setSchemaList }} {...props} />\n}\n","import { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { isSchemaStatsPayload, SchemaStatsPayload, SchemaStatsQueryPayload, SchemaStatsQuerySchema } from '@xyo-network/diviner-schema-stats-model'\nimport { TYPES } from '@xyo-network/node-core-types'\nimport { useDivinerFromNode } from '@xyo-network/react-diviner'\nimport { Dispatch, SetStateAction, useMemo, useState } from 'react'\n\nexport const useSchemaStats = (\n statsAddress?: string,\n nameOrAddress = TYPES.SchemaStatsDiviner.description,\n): [SchemaStatsPayload[] | undefined, Error | undefined, Dispatch<SetStateAction<number>>] => {\n const [refresh, setRefresh] = useState(1)\n const [diviner, divinerError] = useDivinerFromNode(nameOrAddress)\n const [error, setError] = useState<Error>()\n const refreshHistory = () => setRefresh((previous) => previous + 1)\n\n const [schemaList, setSchemaList] = useState<SchemaStatsPayload[]>()\n\n const query: SchemaStatsQueryPayload = useMemo(\n () => ({\n address: statsAddress,\n schema: SchemaStatsQuerySchema,\n }),\n [statsAddress],\n )\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n if (diviner) {\n if (divinerError) {\n if (mounted()) {\n setError(divinerError)\n setSchemaList(undefined)\n }\n } else {\n try {\n const schemas = (await diviner.divine([query])).filter(isSchemaStatsPayload)\n if (mounted()) {\n setSchemaList(schemas)\n setError(undefined)\n }\n } catch (ex) {\n setError(ex as Error)\n setSchemaList(undefined)\n }\n }\n }\n },\n [diviner, refresh, divinerError, query],\n )\n\n return [schemaList, error, refreshHistory]\n}\n","import type { WithChildren } from '@xylabs/react-shared'\nimport { useCallback, useEffect } from 'react'\nimport { useSearchParams } from 'react-router-dom-6'\n\nimport { SchemaContext } from '../Context'\nimport { useSchema } from '../use'\nimport { SchemaMemoryProvider } from './Memory'\nimport { SchemaProviderProps } from './Props'\n\nconst SchemaRouteProviderInner: React.FC<WithChildren> = ({ children }) => {\n const { schema, setSchema, schemaList } = useSchema()\n\n const [params, setParams] = useSearchParams()\n\n const routeSchema = params.get('schema')\n\n //update the network stored in the route\n const setSchemaParam = useCallback(\n (schema?: string) => {\n if (schema) {\n params.set('schema', schema)\n setParams(params, { replace: true })\n setSchema?.(schema)\n } else {\n params.delete('network')\n }\n },\n [params, setParams, setSchema],\n )\n\n //if the network is actively changed, update both memory and route\n const setSchemaLocal = useCallback(\n (schema: string) => {\n setSchemaParam(schema)\n setSchema?.(schema)\n },\n [setSchemaParam, setSchema],\n )\n\n //sync memory and route storage of network\n useEffect(() => {\n if (routeSchema !== schema) {\n if (routeSchema === undefined && schema !== undefined) {\n //if the route does not have a network selected, use what is in the memory context\n setSchemaLocal(schema)\n } else if (routeSchema) {\n //if the route has a selection and it is different from memory, update memory\n setSchema?.(routeSchema)\n }\n }\n }, [routeSchema, schema, setSchemaParam, setSchema, setSchemaLocal])\n\n return <SchemaContext.Provider value={{ provided: true, schema, schemaList, setSchema: setSchemaLocal }}>{children}</SchemaContext.Provider>\n}\n\nexport const SchemaRouteProvider: React.FC<WithChildren<SchemaProviderProps>> = ({ knownSchemaList, defaultSchema, ...props }) => {\n return (\n <SchemaMemoryProvider knownSchemaList={knownSchemaList} defaultSchema={defaultSchema}>\n <SchemaRouteProviderInner {...props} />\n </SchemaMemoryProvider>\n )\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { SchemaContext } from './Context'\nimport { SchemaContextState } from './State'\n\nexport const useSchema = (required = false) => {\n return useContextEx<SchemaContextState>(SchemaContext, 'Schema', required)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,0BAAgC;AAIzB,IAAM,oBAAgB,qCAAoC;;;ACJjE,oBAAwB;AAExB,IAAAA,gBAAoC;;;ACFpC,gCAA+B;AAC/B,wCAA0G;AAC1G,6BAAsB;AACtB,2BAAmC;AACnC,mBAA4D;AAErD,IAAM,iBAAiB,CAC5B,cACA,gBAAgB,6BAAM,mBAAmB,gBACmD;AAC5F,QAAM,CAAC,SAAS,UAAU,QAAI,uBAAS,CAAC;AACxC,QAAM,CAAC,SAAS,YAAY,QAAI,yCAAmB,aAAa;AAChE,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAgB;AAC1C,QAAM,iBAAiB,MAAM,WAAW,CAAC,aAAa,WA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D,uDAAC,4BAA0B,GAAG,OAAO,GACvC;AAEJ;","names":["import_react","schemaList","import_react","import_react_shared","import_jsx_runtime","schema"]}
1
+ {"version":3,"sources":["../../../src/contexts/index.ts","../../../src/contexts/Schema/Context.ts","../../../src/contexts/Schema/Provider/Memory.tsx","../../../src/hooks/useSchemaStats.tsx","../../../src/contexts/Schema/Provider/Route.tsx","../../../src/contexts/Schema/use.ts"],"sourcesContent":["export * from './Schema'\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { SchemaContextState } from './State'\n\nexport const SchemaContext = createContextEx<SchemaContextState>()\n","import { compact } from '@xylabs/lodash'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { useEffect, useState } from 'react'\n\nimport { useSchemaStats } from '../../../hooks'\nimport { SchemaContext } from '../Context'\nimport { SchemaProviderProps } from './Props'\n\nexport const SchemaMemoryProvider: React.FC<WithChildren<SchemaProviderProps>> = ({ defaultSchema, knownSchemaList = [], ...props }) => {\n const [schema, setSchema] = useState(defaultSchema)\n const [schemaList, setSchemaList] = useState<string[] | undefined>(knownSchemaList)\n const [fetchedSchemaStats] = useSchemaStats()\n\n useEffect(() => {\n if (fetchedSchemaStats) {\n const schemaList = compact(fetchedSchemaStats.map(({ name }) => name))\n setSchemaList(schemaList)\n }\n }, [fetchedSchemaStats])\n\n return <SchemaContext.Provider value={{ provided: true, schema, schemaList: knownSchemaList ?? schemaList, setSchema, setSchemaList }} {...props} />\n}\n","import { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { isSchemaStatsPayload, SchemaStatsPayload, SchemaStatsQueryPayload, SchemaStatsQuerySchema } from '@xyo-network/diviner-schema-stats-model'\nimport { TYPES } from '@xyo-network/node-core-types'\nimport { useDivinerFromNode } from '@xyo-network/react-diviner'\nimport { Dispatch, SetStateAction, useMemo, useState } from 'react'\n\nexport const useSchemaStats = (\n statsAddress?: string,\n nameOrAddress = TYPES.SchemaStatsDiviner.description,\n): [SchemaStatsPayload[] | undefined, Error | undefined, Dispatch<SetStateAction<number>>] => {\n const [refresh, setRefresh] = useState(1)\n const [diviner, divinerError] = useDivinerFromNode(nameOrAddress)\n const [error, setError] = useState<Error>()\n const refreshHistory = () => setRefresh((previous) => previous + 1)\n\n const [schemaList, setSchemaList] = useState<SchemaStatsPayload[]>()\n\n const query: SchemaStatsQueryPayload = useMemo(\n () => ({\n address: statsAddress,\n schema: SchemaStatsQuerySchema,\n }),\n [statsAddress],\n )\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n if (diviner) {\n if (divinerError) {\n if (mounted()) {\n setError(divinerError)\n setSchemaList(undefined)\n }\n } else {\n try {\n const schemas = (await diviner.divine([query])).filter(isSchemaStatsPayload)\n if (mounted()) {\n setSchemaList(schemas)\n setError(undefined)\n }\n } catch (ex) {\n setError(ex as Error)\n setSchemaList(undefined)\n }\n }\n }\n },\n [diviner, refresh, divinerError, query],\n )\n\n return [schemaList, error, refreshHistory]\n}\n","import type { WithChildren } from '@xylabs/react-shared'\nimport { useCallback, useEffect } from 'react'\nimport { useSearchParams } from 'react-router-dom'\n\nimport { SchemaContext } from '../Context'\nimport { useSchema } from '../use'\nimport { SchemaMemoryProvider } from './Memory'\nimport { SchemaProviderProps } from './Props'\n\nconst SchemaRouteProviderInner: React.FC<WithChildren> = ({ children }) => {\n const { schema, setSchema, schemaList } = useSchema()\n\n const [params, setParams] = useSearchParams()\n\n const routeSchema = params.get('schema')\n\n //update the network stored in the route\n const setSchemaParam = useCallback(\n (schema?: string) => {\n if (schema) {\n params.set('schema', schema)\n setParams(params, { replace: true })\n setSchema?.(schema)\n } else {\n params.delete('network')\n }\n },\n [params, setParams, setSchema],\n )\n\n //if the network is actively changed, update both memory and route\n const setSchemaLocal = useCallback(\n (schema: string) => {\n setSchemaParam(schema)\n setSchema?.(schema)\n },\n [setSchemaParam, setSchema],\n )\n\n //sync memory and route storage of network\n useEffect(() => {\n if (routeSchema !== schema) {\n if (routeSchema === undefined && schema !== undefined) {\n //if the route does not have a network selected, use what is in the memory context\n setSchemaLocal(schema)\n } else if (routeSchema) {\n //if the route has a selection and it is different from memory, update memory\n setSchema?.(routeSchema)\n }\n }\n }, [routeSchema, schema, setSchemaParam, setSchema, setSchemaLocal])\n\n return <SchemaContext.Provider value={{ provided: true, schema, schemaList, setSchema: setSchemaLocal }}>{children}</SchemaContext.Provider>\n}\n\nexport const SchemaRouteProvider: React.FC<WithChildren<SchemaProviderProps>> = ({ knownSchemaList, defaultSchema, ...props }) => {\n return (\n <SchemaMemoryProvider knownSchemaList={knownSchemaList} defaultSchema={defaultSchema}>\n <SchemaRouteProviderInner {...props} />\n </SchemaMemoryProvider>\n )\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { SchemaContext } from './Context'\nimport { SchemaContextState } from './State'\n\nexport const useSchema = (required = false) => {\n return useContextEx<SchemaContextState>(SchemaContext, 'Schema', required)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,0BAAgC;AAIzB,IAAM,oBAAgB,qCAAoC;;;ACJjE,oBAAwB;AAExB,IAAAA,gBAAoC;;;ACFpC,gCAA+B;AAC/B,wCAA0G;AAC1G,6BAAsB;AACtB,2BAAmC;AACnC,mBAA4D;AAErD,IAAM,iBAAiB,CAC5B,cACA,gBAAgB,6BAAM,mBAAmB,gBACmD;AAC5F,QAAM,CAAC,SAAS,UAAU,QAAI,uBAAS,CAAC;AACxC,QAAM,CAAC,SAAS,YAAY,QAAI,yCAAmB,aAAa;AAChE,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAgB;AAC1C,QAAM,iBAAiB,MAAM,WAAW,CAAC,aAAa,WAAW,CAAC;AAElE,QAAM,CAAC,YAAY,aAAa,QAAI,uBAA+B;AAEnE,QAAM,YAAiC;AAAA,IACrC,OAAO;AAAA,MACL,SAAS;AAAA,MACT,QAAQ;AAAA,IACV;AAAA,IACA,CAAC,YAAY;AAAA,E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CS,IAAAC,sBAAA;AA3CT,IAAM,2BAAmD,CAAC,EAAE,SAAS,MAAM;AACzE,QAAM,EAAE,QAAQ,WAAW,WAAW,IAAI,UAAU;AAEpD,QAAM,CAAC,QAAQ,SAAS,QAAI,yCAAgB;AAE5C,QAAM,cAAc,OAAO,IAAI,QAAQ;AAGvC,QAAM,qBAAiB;AAAA,IACrB,CAACC,YAAoB;AACnB,UAAIA,SAAQ;AACV,eAAO,IAAI,UAAUA,OAAM;AAC3B,kBAAU,QAAQ,EAAE,SAAS,KAAK,CAAC;AACnC,oBAAYA,OAAM;AAAA,MACpB,OAAO;AACL,eAAO,OAAO,SAAS;AAAA,MACzB;AAAA,IACF;AAAA,IACA,CAAC,QAAQ,WAAW,SAAS;AAAA,EAC/B;AAGA,QAAM,qBAAiB;AAAA,IACrB,CAACA,YAAmB;AAClB,qBAAeA,OAAM;AACrB,kBAAYA,OAAM;AAAA,IACpB;AAAA,IACA,CAAC,gBAAgB,SAAS;AAAA,EAC5B;AAGA,+BAAU,MAAM;AACd,QAAI,gBAAgB,QAAQ;AAC1B,UAAI,gBAAgB,UAAa,WAAW,QAAW;AAErD,uBAAe,MAAM;AAAA,MACvB,WAAW,aAAa;AAEtB,oBAAY,WAAW;AAAA,MACzB;AAAA,IACF;AAAA,EACF,GAAG,CAAC,aAAa,QAAQ,gBAAgB,WAAW,cAAc,CAAC;AAEnE,SAAO,6CAAC,cAAc,UAAd,EAAuB,OAAO,EAAE,UAAU,MAAM,QAAQ,YAAY,WAAW,eAAe,GAAI,UAAS;AACrH;AAEO,IAAM,sBAAmE,CAAC,EAAE,iBAAiB,eAAe,GAAG,MAAM,MAAM;AAChI,SACE,6CAAC,wBAAqB,iBAAkC,eACtD,uDAAC,4BAA0B,GAAG,OAAO,GACvC;AAEJ;","names":["import_react","schemaList","import_react","import_react_shared","import_jsx_runtime","schema"]}
@@ -70,7 +70,7 @@ var SchemaMemoryProvider = ({ defaultSchema, knownSchemaList = [], ...props }) =
70
70
 
71
71
  // src/contexts/Schema/Provider/Route.tsx
72
72
  import { useCallback, useEffect as useEffect2 } from "react";
73
- import { useSearchParams } from "react-router-dom-6";
73
+ import { useSearchParams } from "react-router-dom";
74
74
 
75
75
  // src/contexts/Schema/use.ts
76
76
  import { useContextEx } from "@xyo-network/react-shared";
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/contexts/Schema/Context.ts","../../../src/contexts/Schema/Provider/Memory.tsx","../../../src/hooks/useSchemaStats.tsx","../../../src/contexts/Schema/Provider/Route.tsx","../../../src/contexts/Schema/use.ts"],"sourcesContent":["import { createContextEx } from '@xyo-network/react-shared'\n\nimport { SchemaContextState } from './State'\n\nexport const SchemaContext = createContextEx<SchemaContextState>()\n","import { compact } from '@xylabs/lodash'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { useEffect, useState } from 'react'\n\nimport { useSchemaStats } from '../../../hooks'\nimport { SchemaContext } from '../Context'\nimport { SchemaProviderProps } from './Props'\n\nexport const SchemaMemoryProvider: React.FC<WithChildren<SchemaProviderProps>> = ({ defaultSchema, knownSchemaList = [], ...props }) => {\n const [schema, setSchema] = useState(defaultSchema)\n const [schemaList, setSchemaList] = useState<string[] | undefined>(knownSchemaList)\n const [fetchedSchemaStats] = useSchemaStats()\n\n useEffect(() => {\n if (fetchedSchemaStats) {\n const schemaList = compact(fetchedSchemaStats.map(({ name }) => name))\n setSchemaList(schemaList)\n }\n }, [fetchedSchemaStats])\n\n return <SchemaContext.Provider value={{ provided: true, schema, schemaList: knownSchemaList ?? schemaList, setSchema, setSchemaList }} {...props} />\n}\n","import { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { isSchemaStatsPayload, SchemaStatsPayload, SchemaStatsQueryPayload, SchemaStatsQuerySchema } from '@xyo-network/diviner-schema-stats-model'\nimport { TYPES } from '@xyo-network/node-core-types'\nimport { useDivinerFromNode } from '@xyo-network/react-diviner'\nimport { Dispatch, SetStateAction, useMemo, useState } from 'react'\n\nexport const useSchemaStats = (\n statsAddress?: string,\n nameOrAddress = TYPES.SchemaStatsDiviner.description,\n): [SchemaStatsPayload[] | undefined, Error | undefined, Dispatch<SetStateAction<number>>] => {\n const [refresh, setRefresh] = useState(1)\n const [diviner, divinerError] = useDivinerFromNode(nameOrAddress)\n const [error, setError] = useState<Error>()\n const refreshHistory = () => setRefresh((previous) => previous + 1)\n\n const [schemaList, setSchemaList] = useState<SchemaStatsPayload[]>()\n\n const query: SchemaStatsQueryPayload = useMemo(\n () => ({\n address: statsAddress,\n schema: SchemaStatsQuerySchema,\n }),\n [statsAddress],\n )\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n if (diviner) {\n if (divinerError) {\n if (mounted()) {\n setError(divinerError)\n setSchemaList(undefined)\n }\n } else {\n try {\n const schemas = (await diviner.divine([query])).filter(isSchemaStatsPayload)\n if (mounted()) {\n setSchemaList(schemas)\n setError(undefined)\n }\n } catch (ex) {\n setError(ex as Error)\n setSchemaList(undefined)\n }\n }\n }\n },\n [diviner, refresh, divinerError, query],\n )\n\n return [schemaList, error, refreshHistory]\n}\n","import type { WithChildren } from '@xylabs/react-shared'\nimport { useCallback, useEffect } from 'react'\nimport { useSearchParams } from 'react-router-dom-6'\n\nimport { SchemaContext } from '../Context'\nimport { useSchema } from '../use'\nimport { SchemaMemoryProvider } from './Memory'\nimport { SchemaProviderProps } from './Props'\n\nconst SchemaRouteProviderInner: React.FC<WithChildren> = ({ children }) => {\n const { schema, setSchema, schemaList } = useSchema()\n\n const [params, setParams] = useSearchParams()\n\n const routeSchema = params.get('schema')\n\n //update the network stored in the route\n const setSchemaParam = useCallback(\n (schema?: string) => {\n if (schema) {\n params.set('schema', schema)\n setParams(params, { replace: true })\n setSchema?.(schema)\n } else {\n params.delete('network')\n }\n },\n [params, setParams, setSchema],\n )\n\n //if the network is actively changed, update both memory and route\n const setSchemaLocal = useCallback(\n (schema: string) => {\n setSchemaParam(schema)\n setSchema?.(schema)\n },\n [setSchemaParam, setSchema],\n )\n\n //sync memory and route storage of network\n useEffect(() => {\n if (routeSchema !== schema) {\n if (routeSchema === undefined && schema !== undefined) {\n //if the route does not have a network selected, use what is in the memory context\n setSchemaLocal(schema)\n } else if (routeSchema) {\n //if the route has a selection and it is different from memory, update memory\n setSchema?.(routeSchema)\n }\n }\n }, [routeSchema, schema, setSchemaParam, setSchema, setSchemaLocal])\n\n return <SchemaContext.Provider value={{ provided: true, schema, schemaList, setSchema: setSchemaLocal }}>{children}</SchemaContext.Provider>\n}\n\nexport const SchemaRouteProvider: React.FC<WithChildren<SchemaProviderProps>> = ({ knownSchemaList, defaultSchema, ...props }) => {\n return (\n <SchemaMemoryProvider knownSchemaList={knownSchemaList} defaultSchema={defaultSchema}>\n <SchemaRouteProviderInner {...props} />\n </SchemaMemoryProvider>\n )\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { SchemaContext } from './Context'\nimport { SchemaContextState } from './State'\n\nexport const useSchema = (required = false) => {\n return useContextEx<SchemaContextState>(SchemaContext, 'Schema', required)\n}\n"],"mappings":";AAAA,SAAS,uBAAuB;AAIzB,IAAM,gBAAgB,gBAAoC;;;ACJjE,SAAS,eAAe;AAExB,SAAS,WAAW,YAAAA,iBAAgB;;;ACFpC,SAAS,sBAAsB;AAC/B,SAAS,sBAAmE,8BAA8B;AAC1G,SAAS,aAAa;AACtB,SAAS,0BAA0B;AACnC,SAAmC,SAAS,gBAAgB;AAErD,IAAM,iBAAiB,CAC5B,cACA,gBAAgB,MAAM,mBAAmB,gBACmD;AAC5F,QAAM,CAAC,SAAS,UAAU,IAAI,SAAS,CAAC;AACxC,QAAM,CAAC,SAAS,YAAY,IAAI,mBAAmB,aAAa;AAChE,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAgB;AAC1C,QAAM,iBAAiB,MAAM,WAAW,CAAC,aAAa,WAAW,CAAC;AAElE,QAAM,CAAC,YAAY,aAAa,IAAI,SAA+B;AAEnE,QAAM,QAAiC;AAAA,IACrC,OAAO;AAAA,M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","useEffect","jsx","schema","useEffect"]}
1
+ {"version":3,"sources":["../../../src/contexts/Schema/Context.ts","../../../src/contexts/Schema/Provider/Memory.tsx","../../../src/hooks/useSchemaStats.tsx","../../../src/contexts/Schema/Provider/Route.tsx","../../../src/contexts/Schema/use.ts"],"sourcesContent":["import { createContextEx } from '@xyo-network/react-shared'\n\nimport { SchemaContextState } from './State'\n\nexport const SchemaContext = createContextEx<SchemaContextState>()\n","import { compact } from '@xylabs/lodash'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { useEffect, useState } from 'react'\n\nimport { useSchemaStats } from '../../../hooks'\nimport { SchemaContext } from '../Context'\nimport { SchemaProviderProps } from './Props'\n\nexport const SchemaMemoryProvider: React.FC<WithChildren<SchemaProviderProps>> = ({ defaultSchema, knownSchemaList = [], ...props }) => {\n const [schema, setSchema] = useState(defaultSchema)\n const [schemaList, setSchemaList] = useState<string[] | undefined>(knownSchemaList)\n const [fetchedSchemaStats] = useSchemaStats()\n\n useEffect(() => {\n if (fetchedSchemaStats) {\n const schemaList = compact(fetchedSchemaStats.map(({ name }) => name))\n setSchemaList(schemaList)\n }\n }, [fetchedSchemaStats])\n\n return <SchemaContext.Provider value={{ provided: true, schema, schemaList: knownSchemaList ?? schemaList, setSchema, setSchemaList }} {...props} />\n}\n","import { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { isSchemaStatsPayload, SchemaStatsPayload, SchemaStatsQueryPayload, SchemaStatsQuerySchema } from '@xyo-network/diviner-schema-stats-model'\nimport { TYPES } from '@xyo-network/node-core-types'\nimport { useDivinerFromNode } from '@xyo-network/react-diviner'\nimport { Dispatch, SetStateAction, useMemo, useState } from 'react'\n\nexport const useSchemaStats = (\n statsAddress?: string,\n nameOrAddress = TYPES.SchemaStatsDiviner.description,\n): [SchemaStatsPayload[] | undefined, Error | undefined, Dispatch<SetStateAction<number>>] => {\n const [refresh, setRefresh] = useState(1)\n const [diviner, divinerError] = useDivinerFromNode(nameOrAddress)\n const [error, setError] = useState<Error>()\n const refreshHistory = () => setRefresh((previous) => previous + 1)\n\n const [schemaList, setSchemaList] = useState<SchemaStatsPayload[]>()\n\n const query: SchemaStatsQueryPayload = useMemo(\n () => ({\n address: statsAddress,\n schema: SchemaStatsQuerySchema,\n }),\n [statsAddress],\n )\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n if (diviner) {\n if (divinerError) {\n if (mounted()) {\n setError(divinerError)\n setSchemaList(undefined)\n }\n } else {\n try {\n const schemas = (await diviner.divine([query])).filter(isSchemaStatsPayload)\n if (mounted()) {\n setSchemaList(schemas)\n setError(undefined)\n }\n } catch (ex) {\n setError(ex as Error)\n setSchemaList(undefined)\n }\n }\n }\n },\n [diviner, refresh, divinerError, query],\n )\n\n return [schemaList, error, refreshHistory]\n}\n","import type { WithChildren } from '@xylabs/react-shared'\nimport { useCallback, useEffect } from 'react'\nimport { useSearchParams } from 'react-router-dom'\n\nimport { SchemaContext } from '../Context'\nimport { useSchema } from '../use'\nimport { SchemaMemoryProvider } from './Memory'\nimport { SchemaProviderProps } from './Props'\n\nconst SchemaRouteProviderInner: React.FC<WithChildren> = ({ children }) => {\n const { schema, setSchema, schemaList } = useSchema()\n\n const [params, setParams] = useSearchParams()\n\n const routeSchema = params.get('schema')\n\n //update the network stored in the route\n const setSchemaParam = useCallback(\n (schema?: string) => {\n if (schema) {\n params.set('schema', schema)\n setParams(params, { replace: true })\n setSchema?.(schema)\n } else {\n params.delete('network')\n }\n },\n [params, setParams, setSchema],\n )\n\n //if the network is actively changed, update both memory and route\n const setSchemaLocal = useCallback(\n (schema: string) => {\n setSchemaParam(schema)\n setSchema?.(schema)\n },\n [setSchemaParam, setSchema],\n )\n\n //sync memory and route storage of network\n useEffect(() => {\n if (routeSchema !== schema) {\n if (routeSchema === undefined && schema !== undefined) {\n //if the route does not have a network selected, use what is in the memory context\n setSchemaLocal(schema)\n } else if (routeSchema) {\n //if the route has a selection and it is different from memory, update memory\n setSchema?.(routeSchema)\n }\n }\n }, [routeSchema, schema, setSchemaParam, setSchema, setSchemaLocal])\n\n return <SchemaContext.Provider value={{ provided: true, schema, schemaList, setSchema: setSchemaLocal }}>{children}</SchemaContext.Provider>\n}\n\nexport const SchemaRouteProvider: React.FC<WithChildren<SchemaProviderProps>> = ({ knownSchemaList, defaultSchema, ...props }) => {\n return (\n <SchemaMemoryProvider knownSchemaList={knownSchemaList} defaultSchema={defaultSchema}>\n <SchemaRouteProviderInner {...props} />\n </SchemaMemoryProvider>\n )\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { SchemaContext } from './Context'\nimport { SchemaContextState } from './State'\n\nexport const useSchema = (required = false) => {\n return useContextEx<SchemaContextState>(SchemaContext, 'Schema', required)\n}\n"],"mappings":";AAAA,SAAS,uBAAuB;AAIzB,IAAM,gBAAgB,gBAAoC;;;ACJjE,SAAS,eAAe;AAExB,SAAS,WAAW,YAAAA,iBAAgB;;;ACFpC,SAAS,sBAAsB;AAC/B,SAAS,sBAAmE,8BAA8B;AAC1G,SAAS,aAAa;AACtB,SAAS,0BAA0B;AACnC,SAAmC,SAAS,gBAAgB;AAErD,IAAM,iBAAiB,CAC5B,cACA,gBAAgB,MAAM,mBAAmB,gBACmD;AAC5F,QAAM,CAAC,SAAS,UAAU,IAAI,SAAS,CAAC;AACxC,QAAM,CAAC,SAAS,YAAY,IAAI,mBAAmB,aAAa;AAChE,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAgB;AAC1C,QAAM,iBAAiB,MAAM,WAAW,CAAC,aAAa,WAAW,CAAC;AAElE,QAAM,CAAC,YAAY,aAAa,IAAI,SAA+B;AAEnE,QAAM,QAAiC;AAAA,IACrC,OAAO;AAAA,MACL,SAAS;AAAA,MACT,QAAQ;AAAA,IACV;AAAA,IACA,CAAC,YAAY;AAAA,EACf;AAEA;AAAA;AAAA,IAEE,OAAO,YAAY;AACjB,UAAI,SAAS;AACX,YAAI,cAAc;AAChB,cAAI,QAAQ,GAAG;AACb,qBAA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AW,IAAI,UAAU;AAEpD,QAAM,CAAC,QAAQ,SAAS,IAAI,gBAAgB;AAE5C,QAAM,cAAc,OAAO,IAAI,QAAQ;AAGvC,QAAM,iBAAiB;AAAA,IACrB,CAACC,YAAoB;AACnB,UAAIA,SAAQ;AACV,eAAO,IAAI,UAAUA,OAAM;AAC3B,kBAAU,QAAQ,EAAE,SAAS,KAAK,CAAC;AACnC,oBAAYA,OAAM;AAAA,MACpB,OAAO;AACL,eAAO,OAAO,SAAS;AAAA,MACzB;AAAA,IACF;AAAA,IACA,CAAC,QAAQ,WAAW,SAAS;AAAA,EAC/B;AAGA,QAAM,iBAAiB;AAAA,IACrB,CAACA,YAAmB;AAClB,qBAAeA,OAAM;AACrB,kBAAYA,OAAM;AAAA,IACpB;AAAA,IACA,CAAC,gBAAgB,SAAS;AAAA,EAC5B;AAGA,EAAAC,WAAU,MAAM;AACd,QAAI,gBAAgB,QAAQ;AAC1B,UAAI,gBAAgB,UAAa,WAAW,QAAW;AAErD,uBAAe,MAAM;AAAA,MACvB,WAAW,aAAa;AAEtB,oBAAY,WAAW;AAAA,MACzB;AAAA,IACF;AAAA,EACF,GAAG,CAAC,aAAa,QAAQ,gBAAgB,WAAW,cAAc,CAAC;AAEnE,SAAO,gBAAAF,KAAC,cAAc,UAAd,EAAuB,OAAO,EAAE,UAAU,MAAM,QAAQ,YAAY,WAAW,eAAe,GAAI,UAAS;AACrH;AAEO,IAAM,sBAAmE,CAAC,EAAE,iBAAiB,eAAe,GAAG,MAAM,MAAM;AAChI,SACE,gBAAAA,KAAC,wBAAqB,iBAAkC,eACtD,0BAAAA,KAAC,4BAA0B,GAAG,OAAO,GACvC;AAEJ;","names":["useState","useState","schemaList","useEffect","jsx","schema","useEffect"]}
@@ -274,7 +274,7 @@ var SchemaMemoryProvider = ({ defaultSchema, knownSchemaList = [], ...props }) =
274
274
 
275
275
  // src/contexts/Schema/Provider/Route.tsx
276
276
  var import_react7 = require("react");
277
- var import_react_router_dom_6 = require("react-router-dom-6");
277
+ var import_react_router_dom = require("react-router-dom");
278
278
 
279
279
  // src/contexts/Schema/use.ts
280
280
  var import_react_shared2 = require("@xyo-network/react-shared");
@@ -286,7 +286,7 @@ var useSchema = (required = false) => {
286
286
  var import_jsx_runtime3 = require("react/jsx-runtime");
287
287
  var SchemaRouteProviderInner = ({ children }) => {
288
288
  const { schema, setSchema, schemaList } = useSchema();
289
- const [params, setParams] = (0, import_react_router_dom_6.useSearchParams)();
289
+ const [params, setParams] = (0, import_react_router_dom.useSearchParams)();
290
290
  const routeSchema = params.get("schema");
291
291
  const setSchemaParam = (0, import_react7.useCallback)(
292
292
  (schema2) => {