@xyo-network/react-schema 2.41.14 → 2.41.16

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 (84) hide show
  1. package/dist/cjs/contexts/Schema/Provider/Memory.d.ts +5 -0
  2. package/dist/cjs/contexts/Schema/Provider/Memory.d.ts.map +1 -0
  3. package/dist/cjs/contexts/Schema/Provider/Memory.js +22 -0
  4. package/dist/cjs/contexts/Schema/Provider/Memory.js.map +1 -0
  5. package/dist/cjs/contexts/Schema/Provider/Props.d.ts +5 -0
  6. package/dist/cjs/contexts/Schema/Provider/Props.d.ts.map +1 -0
  7. package/dist/cjs/contexts/Schema/Provider/Props.js +3 -0
  8. package/dist/cjs/contexts/Schema/Provider/Props.js.map +1 -0
  9. package/dist/cjs/contexts/Schema/Provider/Route.d.ts +5 -0
  10. package/dist/cjs/contexts/Schema/Provider/Route.d.ts.map +1 -0
  11. package/dist/cjs/contexts/Schema/Provider/Route.js +51 -0
  12. package/dist/cjs/contexts/Schema/Provider/Route.js.map +1 -0
  13. package/dist/cjs/contexts/Schema/Provider/index.d.ts +4 -0
  14. package/dist/cjs/contexts/Schema/Provider/index.d.ts.map +1 -0
  15. package/dist/cjs/contexts/Schema/Provider/index.js +7 -0
  16. package/dist/cjs/contexts/Schema/Provider/index.js.map +1 -0
  17. package/dist/cjs/contexts/Schema/index.d.ts +1 -0
  18. package/dist/cjs/contexts/Schema/index.d.ts.map +1 -1
  19. package/dist/cjs/contexts/Schema/index.js +1 -0
  20. package/dist/cjs/contexts/Schema/index.js.map +1 -1
  21. package/dist/cjs/hooks/index.d.ts +1 -0
  22. package/dist/cjs/hooks/index.d.ts.map +1 -1
  23. package/dist/cjs/hooks/index.js +1 -0
  24. package/dist/cjs/hooks/index.js.map +1 -1
  25. package/dist/cjs/hooks/useSchemaDefinitions.d.ts +4 -0
  26. package/dist/cjs/hooks/useSchemaDefinitions.d.ts.map +1 -0
  27. package/dist/cjs/hooks/useSchemaDefinitions.js +25 -0
  28. package/dist/cjs/hooks/useSchemaDefinitions.js.map +1 -0
  29. package/dist/cjs/hooks/useSchemaStats.d.ts +2 -2
  30. package/dist/cjs/hooks/useSchemaStats.d.ts.map +1 -1
  31. package/dist/cjs/hooks/useSchemaStats.js +2 -2
  32. package/dist/cjs/hooks/useSchemaStats.js.map +1 -1
  33. package/dist/docs.json +449 -88
  34. package/dist/esm/contexts/Schema/Provider/Memory.d.ts +5 -0
  35. package/dist/esm/contexts/Schema/Provider/Memory.d.ts.map +1 -0
  36. package/dist/esm/contexts/Schema/Provider/Memory.js +16 -0
  37. package/dist/esm/contexts/Schema/Provider/Memory.js.map +1 -0
  38. package/dist/esm/contexts/Schema/Provider/Props.d.ts +5 -0
  39. package/dist/esm/contexts/Schema/Provider/Props.d.ts.map +1 -0
  40. package/dist/esm/contexts/Schema/Provider/Props.js +2 -0
  41. package/dist/esm/contexts/Schema/Provider/Props.js.map +1 -0
  42. package/dist/esm/contexts/Schema/Provider/Route.d.ts +5 -0
  43. package/dist/esm/contexts/Schema/Provider/Route.d.ts.map +1 -0
  44. package/dist/esm/contexts/Schema/Provider/Route.js +45 -0
  45. package/dist/esm/contexts/Schema/Provider/Route.js.map +1 -0
  46. package/dist/esm/contexts/Schema/Provider/index.d.ts +4 -0
  47. package/dist/esm/contexts/Schema/Provider/index.d.ts.map +1 -0
  48. package/dist/esm/contexts/Schema/Provider/index.js +4 -0
  49. package/dist/esm/contexts/Schema/Provider/index.js.map +1 -0
  50. package/dist/esm/contexts/Schema/index.d.ts +1 -0
  51. package/dist/esm/contexts/Schema/index.d.ts.map +1 -1
  52. package/dist/esm/contexts/Schema/index.js +1 -0
  53. package/dist/esm/contexts/Schema/index.js.map +1 -1
  54. package/dist/esm/hooks/index.d.ts +1 -0
  55. package/dist/esm/hooks/index.d.ts.map +1 -1
  56. package/dist/esm/hooks/index.js +1 -0
  57. package/dist/esm/hooks/index.js.map +1 -1
  58. package/dist/esm/hooks/useSchemaDefinitions.d.ts +4 -0
  59. package/dist/esm/hooks/useSchemaDefinitions.d.ts.map +1 -0
  60. package/dist/esm/hooks/useSchemaDefinitions.js +20 -0
  61. package/dist/esm/hooks/useSchemaDefinitions.js.map +1 -0
  62. package/dist/esm/hooks/useSchemaStats.d.ts +2 -2
  63. package/dist/esm/hooks/useSchemaStats.d.ts.map +1 -1
  64. package/dist/esm/hooks/useSchemaStats.js +2 -2
  65. package/dist/esm/hooks/useSchemaStats.js.map +1 -1
  66. package/package.json +14 -13
  67. package/src/contexts/Schema/Provider/Memory.tsx +20 -0
  68. package/src/contexts/Schema/Provider/Props.tsx +4 -0
  69. package/src/contexts/Schema/Provider/Route.tsx +62 -0
  70. package/src/contexts/Schema/Provider/index.ts +3 -0
  71. package/src/contexts/Schema/index.ts +1 -0
  72. package/src/hooks/index.ts +1 -0
  73. package/src/hooks/stories/TestSchemaHooks.stories.tsx +25 -4
  74. package/src/hooks/useSchemaDefinitions.tsx +26 -0
  75. package/src/hooks/useSchemaStats.tsx +4 -5
  76. package/dist/cjs/hooks/stories/TestSchemaHooks.d.ts +0 -3
  77. package/dist/cjs/hooks/stories/TestSchemaHooks.d.ts.map +0 -1
  78. package/dist/cjs/hooks/stories/TestSchemaHooks.js +0 -14
  79. package/dist/cjs/hooks/stories/TestSchemaHooks.js.map +0 -1
  80. package/dist/esm/hooks/stories/TestSchemaHooks.d.ts +0 -3
  81. package/dist/esm/hooks/stories/TestSchemaHooks.d.ts.map +0 -1
  82. package/dist/esm/hooks/stories/TestSchemaHooks.js +0 -10
  83. package/dist/esm/hooks/stories/TestSchemaHooks.js.map +0 -1
  84. package/src/hooks/stories/TestSchemaHooks.tsx +0 -18
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { WithChildren } from '@xylabs/react-shared';
3
+ import { SchemaProviderProps } from './Props';
4
+ export declare const SchemaMemoryProvider: React.FC<WithChildren<SchemaProviderProps>>;
5
+ //# sourceMappingURL=Memory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Memory.d.ts","sourceRoot":"","sources":["../../../../../src/contexts/Schema/Provider/Memory.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAKnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAE7C,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAY5E,CAAA"}
@@ -0,0 +1,16 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useEffect, useState } from 'react';
3
+ import { useSchemaList } from '../../../hooks';
4
+ import { SchemaContext } from '../Context';
5
+ export const SchemaMemoryProvider = ({ defaultSchema, knownSchemaList = [], ...props }) => {
6
+ const [schema, setSchema] = useState(defaultSchema);
7
+ const [schemaList, setSchemaList] = useState(knownSchemaList);
8
+ const [fetchedSchemaList] = useSchemaList();
9
+ useEffect(() => {
10
+ if (fetchedSchemaList) {
11
+ setSchemaList(fetchedSchemaList.map(({ name }) => name));
12
+ }
13
+ }, [fetchedSchemaList]);
14
+ return _jsx(SchemaContext.Provider, { value: { provided: true, schema, schemaList: knownSchemaList ?? schemaList, setSchema, setSchemaList }, ...props });
15
+ };
16
+ //# sourceMappingURL=Memory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Memory.js","sourceRoot":"","sources":["../../../../../src/contexts/Schema/Provider/Memory.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAE3C,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAG1C,MAAM,CAAC,MAAM,oBAAoB,GAAgD,CAAC,EAAE,aAAa,EAAE,eAAe,GAAG,EAAE,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE;IACrI,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAA;IACnD,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAuB,eAAe,CAAC,CAAA;IACnF,MAAM,CAAC,iBAAiB,CAAC,GAAG,aAAa,EAAE,CAAA;IAE3C,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,iBAAiB,EAAE;YACrB,aAAa,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAA;SACzD;IACH,CAAC,EAAE,CAAC,iBAAiB,CAAC,CAAC,CAAA;IAEvB,OAAO,KAAC,aAAa,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,eAAe,IAAI,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,KAAM,KAAK,GAAI,CAAA;AACtJ,CAAC,CAAA"}
@@ -0,0 +1,5 @@
1
+ export interface SchemaProviderProps {
2
+ defaultSchema?: string;
3
+ knownSchemaList?: string[];
4
+ }
5
+ //# sourceMappingURL=Props.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Props.d.ts","sourceRoot":"","sources":["../../../../../src/contexts/Schema/Provider/Props.tsx"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAA;CAC3B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Props.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Props.js","sourceRoot":"","sources":["../../../../../src/contexts/Schema/Provider/Props.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { WithChildren } from '@xylabs/react-shared';
3
+ import { SchemaProviderProps } from './Props';
4
+ export declare const SchemaRouteProvider: React.FC<WithChildren<SchemaProviderProps>>;
5
+ //# sourceMappingURL=Route.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Route.d.ts","sourceRoot":"","sources":["../../../../../src/contexts/Schema/Provider/Route.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAOnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAgD7C,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAM3E,CAAA"}
@@ -0,0 +1,45 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useCallback, useEffect } from 'react';
3
+ import { useSearchParams } from 'react-router-dom';
4
+ import { SchemaContext } from '../Context';
5
+ import { useSchema } from '../use';
6
+ import { SchemaMemoryProvider } from './Memory';
7
+ const SchemaRouteProviderInner = ({ children }) => {
8
+ const { schema, setSchema, schemaList } = useSchema();
9
+ const [params, setParams] = useSearchParams();
10
+ const routeSchema = params.get('schema');
11
+ //update the network stored in the route
12
+ const setSchemaParam = useCallback((schema) => {
13
+ if (schema) {
14
+ params.set('schema', schema);
15
+ setParams(params, { replace: true });
16
+ setSchema?.(schema);
17
+ }
18
+ else {
19
+ params.delete('network');
20
+ }
21
+ }, [params, setParams, setSchema]);
22
+ //if the network is actively changed, update both memory and route
23
+ const setSchemaLocal = useCallback((schema) => {
24
+ setSchemaParam(schema);
25
+ setSchema?.(schema);
26
+ }, [setSchemaParam, setSchema]);
27
+ //sync memory and route storage of network
28
+ useEffect(() => {
29
+ if (routeSchema !== schema) {
30
+ if (routeSchema === undefined && schema !== undefined) {
31
+ //if the route does not have a network selected, use what is in the memory context
32
+ setSchemaLocal(schema);
33
+ }
34
+ else if (routeSchema) {
35
+ //if the route has a selection and it is different from memory, update memory
36
+ setSchema?.(routeSchema);
37
+ }
38
+ }
39
+ }, [routeSchema, schema, setSchemaParam, setSchema, setSchemaLocal]);
40
+ return _jsx(SchemaContext.Provider, { value: { provided: true, schema, schemaList, setSchema: setSchemaLocal }, children: children });
41
+ };
42
+ export const SchemaRouteProvider = ({ knownSchemaList, defaultSchema, ...props }) => {
43
+ return (_jsx(SchemaMemoryProvider, { knownSchemaList: knownSchemaList, defaultSchema: defaultSchema, children: _jsx(SchemaRouteProviderInner, { ...props }) }));
44
+ };
45
+ //# sourceMappingURL=Route.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Route.js","sourceRoot":"","sources":["../../../../../src/contexts/Schema/Provider/Route.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAElD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAClC,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAG/C,MAAM,wBAAwB,GAA2B,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IACxE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,SAAS,EAAE,CAAA;IAErD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,eAAe,EAAE,CAAA;IAE7C,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;IAExC,wCAAwC;IACxC,MAAM,cAAc,GAAG,WAAW,CAChC,CAAC,MAAe,EAAE,EAAE;QAClB,IAAI,MAAM,EAAE;YACV,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;YAC5B,SAAS,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAA;YACpC,SAAS,EAAE,CAAC,MAAM,CAAC,CAAA;SACpB;aAAM;YACL,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;SACzB;IACH,CAAC,EACD,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,CAAC,CAC/B,CAAA;IAED,kEAAkE;IAClE,MAAM,cAAc,GAAG,WAAW,CAChC,CAAC,MAAc,EAAE,EAAE;QACjB,cAAc,CAAC,MAAM,CAAC,CAAA;QACtB,SAAS,EAAE,CAAC,MAAM,CAAC,CAAA;IACrB,CAAC,EACD,CAAC,cAAc,EAAE,SAAS,CAAC,CAC5B,CAAA;IAED,0CAA0C;IAC1C,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,WAAW,KAAK,MAAM,EAAE;YAC1B,IAAI,WAAW,KAAK,SAAS,IAAI,MAAM,KAAK,SAAS,EAAE;gBACrD,kFAAkF;gBAClF,cAAc,CAAC,MAAM,CAAC,CAAA;aACvB;iBAAM,IAAI,WAAW,EAAE;gBACtB,6EAA6E;gBAC7E,SAAS,EAAE,CAAC,WAAW,CAAC,CAAA;aACzB;SACF;IACH,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,cAAc,EAAE,SAAS,EAAE,cAAc,CAAC,CAAC,CAAA;IAEpE,OAAO,KAAC,aAAa,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,cAAc,EAAE,YAAG,QAAQ,GAA0B,CAAA;AAC9I,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,mBAAmB,GAAgD,CAAC,EAAE,eAAe,EAAE,aAAa,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE;IAC/H,OAAO,CACL,KAAC,oBAAoB,IAAC,eAAe,EAAE,eAAe,EAAE,aAAa,EAAE,aAAa,YAClF,KAAC,wBAAwB,OAAK,KAAK,GAAI,GAClB,CACxB,CAAA;AACH,CAAC,CAAA"}
@@ -0,0 +1,4 @@
1
+ export * from './Memory';
2
+ export * from './Props';
3
+ export * from './Route';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/contexts/Schema/Provider/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA"}
@@ -0,0 +1,4 @@
1
+ export * from './Memory';
2
+ export * from './Props';
3
+ export * from './Route';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/contexts/Schema/Provider/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA"}
@@ -1,4 +1,5 @@
1
1
  export * from './Context';
2
+ export * from './Provider';
2
3
  export * from './State';
3
4
  export * from './use';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/contexts/Schema/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,SAAS,CAAA;AACvB,cAAc,OAAO,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/contexts/Schema/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA;AACvB,cAAc,OAAO,CAAA"}
@@ -1,4 +1,5 @@
1
1
  export * from './Context';
2
+ export * from './Provider';
2
3
  export * from './State';
3
4
  export * from './use';
4
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/contexts/Schema/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,SAAS,CAAA;AACvB,cAAc,OAAO,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/contexts/Schema/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA;AACvB,cAAc,OAAO,CAAA"}
@@ -1,4 +1,5 @@
1
1
  export * from './useGetSchema';
2
+ export * from './useSchemaDefinitions';
2
3
  export * from './useSchemaList';
3
4
  export * from './useSchemaStats';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,wBAAwB,CAAA;AACtC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA"}
@@ -1,4 +1,5 @@
1
1
  export * from './useGetSchema';
2
+ export * from './useSchemaDefinitions';
2
3
  export * from './useSchemaList';
3
4
  export * from './useSchemaStats';
4
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,wBAAwB,CAAA;AACtC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { SchemaList } from '@xyo-network/api';
2
+ import { XyoSchemaPayload } from '@xyo-network/schema-payload-plugin';
3
+ export declare const useSchemaDefinitions: (schemaList?: SchemaList[]) => XyoSchemaPayload[] | undefined;
4
+ //# sourceMappingURL=useSchemaDefinitions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSchemaDefinitions.d.ts","sourceRoot":"","sources":["../../../src/hooks/useSchemaDefinitions.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAA;AAIrE,eAAO,MAAM,oBAAoB,gBAAiB,UAAU,EAAE,KAAG,gBAAgB,EAAE,GAAG,SAmBrF,CAAA"}
@@ -0,0 +1,20 @@
1
+ import { useAsyncEffect } from '@xylabs/react-shared';
2
+ import { XyoSchemaCache } from '@xyo-network/utils';
3
+ import { useState } from 'react';
4
+ export const useSchemaDefinitions = (schemaList) => {
5
+ const [schemaPayloads, setSchemaPayloads] = useState();
6
+ useAsyncEffect(
7
+ // eslint-disable-next-line react-hooks/exhaustive-deps
8
+ async (mounted) => {
9
+ if (schemaList) {
10
+ const promiseResults = await Promise.allSettled(schemaList?.map(({ name }) => XyoSchemaCache.instance.get(name)));
11
+ if (mounted()) {
12
+ setSchemaPayloads(promiseResults
13
+ .map((result) => (result.status === 'fulfilled' ? result.value?.payload : undefined))
14
+ .filter((item) => item !== undefined && item !== null));
15
+ }
16
+ }
17
+ }, [schemaList]);
18
+ return schemaPayloads;
19
+ };
20
+ //# sourceMappingURL=useSchemaDefinitions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSchemaDefinitions.js","sourceRoot":"","sources":["../../../src/hooks/useSchemaDefinitions.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAGrD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEhC,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,UAAyB,EAAkC,EAAE;IAChG,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,EAAsB,CAAA;IAC1E,cAAc;IACZ,uDAAuD;IACvD,KAAK,EAAE,OAAO,EAAE,EAAE;QAChB,IAAI,UAAU,EAAE;YACd,MAAM,cAAc,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,cAAc,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;YACjH,IAAI,OAAO,EAAE,EAAE;gBACb,iBAAiB,CACf,cAAc;qBACX,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;qBACpF,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,IAAI,CAAuB,CAC/E,CAAA;aACF;SACF;IACH,CAAC,EACD,CAAC,UAAU,CAAC,CACb,CAAA;IACD,OAAO,cAAc,CAAA;AACvB,CAAC,CAAA"}
@@ -1,4 +1,4 @@
1
- import { SchemaStats } from '@xyo-network/api';
1
+ import { SchemaStatsPayload } from '@xyo-network/node-core-model';
2
2
  import { Dispatch, SetStateAction } from 'react';
3
- export declare const useSchemaStats: (archive?: string) => [SchemaStats | undefined, Error | undefined, Dispatch<SetStateAction<number>>];
3
+ export declare const useSchemaStats: (archive?: string) => [SchemaStatsPayload | undefined, Error | undefined, Dispatch<SetStateAction<number>>];
4
4
  //# sourceMappingURL=useSchemaStats.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useSchemaStats.d.ts","sourceRoot":"","sources":["../../../src/hooks/useSchemaStats.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAK9C,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAuB,MAAM,OAAO,CAAA;AAErE,eAAO,MAAM,cAAc,aAAc,MAAM,KAAG,CAAC,WAAW,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,EAAE,SAAS,eAAe,MAAM,CAAC,CAAC,CAc9H,CAAA"}
1
+ {"version":3,"file":"useSchemaStats.d.ts","sourceRoot":"","sources":["../../../src/hooks/useSchemaStats.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAA0B,MAAM,8BAA8B,CAAA;AAIzF,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAuB,MAAM,OAAO,CAAA;AAErE,eAAO,MAAM,cAAc,aAAc,MAAM,KAAG,CAAC,kBAAkB,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,EAAE,SAAS,eAAe,MAAM,CAAC,CAAC,CAcrI,CAAA"}
@@ -5,7 +5,7 @@ import { useNodeQueryDiviner } from '@xyo-network/react-node';
5
5
  import { useEffect, useState } from 'react';
6
6
  export const useSchemaStats = (archive) => {
7
7
  const [refresh, setRefresh] = useState(1);
8
- const refreshHistory = () => setRefresh((previous) => previous + 1);
8
+ const refreshStats = () => setRefresh((previous) => previous + 1);
9
9
  const [query, setQuery] = useState();
10
10
  const [schemaStats, error] = useNodeQueryDiviner(TYPES.SchemaStatsDiviner.description, query);
11
11
  useEffect(() => {
@@ -13,6 +13,6 @@ export const useSchemaStats = (archive) => {
13
13
  setQuery(new XyoPayloadBuilder({ schema: SchemaStatsQuerySchema }).fields({ archive }).build());
14
14
  }
15
15
  }, [archive, refresh]);
16
- return [schemaStats?.[0], error, refreshHistory];
16
+ return [schemaStats?.[0], error, refreshStats];
17
17
  };
18
18
  //# sourceMappingURL=useSchemaStats.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useSchemaStats.js","sourceRoot":"","sources":["../../../src/hooks/useSchemaStats.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAA;AACrE,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAA;AACpD,OAAO,EAAc,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAC7D,OAAO,EAA4B,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAErE,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,OAAgB,EAAkF,EAAE;IACjI,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAA;IACzC,MAAM,cAAc,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAA;IAEnE,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,EAAc,CAAA;IAChD,MAAM,CAAC,WAAW,EAAE,KAAK,CAAC,GAAG,mBAAmB,CAAC,KAAK,CAAC,kBAAkB,CAAC,WAAW,EAAE,KAAK,CAAC,CAAA;IAE7F,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,OAAO,EAAE;YACX,QAAQ,CAAC,IAAI,iBAAiB,CAAC,EAAE,MAAM,EAAE,sBAAsB,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAAA;SAChG;IACH,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAA;IAEtB,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,CAAgB,EAAE,KAAK,EAAE,cAAc,CAAC,CAAA;AACjE,CAAC,CAAA"}
1
+ {"version":3,"file":"useSchemaStats.js","sourceRoot":"","sources":["../../../src/hooks/useSchemaStats.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAsB,sBAAsB,EAAE,MAAM,8BAA8B,CAAA;AACzF,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAA;AACpD,OAAO,EAAc,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAC7D,OAAO,EAA4B,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAErE,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,OAAgB,EAAyF,EAAE;IACxI,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAA;IACzC,MAAM,YAAY,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAA;IAEjE,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,EAAc,CAAA;IAChD,MAAM,CAAC,WAAW,EAAE,KAAK,CAAC,GAAG,mBAAmB,CAAC,KAAK,CAAC,kBAAkB,CAAC,WAAW,EAAE,KAAK,CAAC,CAAA;IAE7F,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,OAAO,EAAE;YACX,QAAQ,CAAC,IAAI,iBAAiB,CAAC,EAAE,MAAM,EAAE,sBAAsB,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAAA;SAChG;IACH,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAA;IAEtB,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,CAAuB,EAAE,KAAK,EAAE,YAAY,CAAC,CAAA;AACtE,CAAC,CAAA"}
package/package.json CHANGED
@@ -10,18 +10,19 @@
10
10
  "url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/issues"
11
11
  },
12
12
  "dependencies": {
13
- "@xylabs/react-common": "^2.15.6",
14
- "@xylabs/react-link": "^2.15.6",
15
- "@xylabs/react-shared": "^2.15.6",
16
- "@xyo-network/api": "^2.43.0",
17
- "@xyo-network/module": "^2.43.0",
18
- "@xyo-network/node-core-model": "^2.43.0",
19
- "@xyo-network/node-core-types": "^2.43.0",
20
- "@xyo-network/payload": "^2.43.0",
21
- "@xyo-network/react-property": "^2.41.14",
22
- "@xyo-network/react-shared": "^2.41.14",
23
- "@xyo-network/schema-payload-plugin": "^2.43.0",
24
- "@xyo-network/utils": "^2.43.0"
13
+ "@xylabs/react-common": "^2.15.7",
14
+ "@xylabs/react-link": "^2.15.7",
15
+ "@xylabs/react-shared": "^2.15.7",
16
+ "@xyo-network/api": "^2.43.2",
17
+ "@xyo-network/module": "^2.43.2",
18
+ "@xyo-network/node-core-model": "^2.43.2",
19
+ "@xyo-network/node-core-types": "^2.43.2",
20
+ "@xyo-network/payload": "^2.43.2",
21
+ "@xyo-network/react-node": "^2.41.16",
22
+ "@xyo-network/react-property": "^2.41.16",
23
+ "@xyo-network/react-shared": "^2.41.16",
24
+ "@xyo-network/schema-payload-plugin": "^2.43.2",
25
+ "@xyo-network/utils": "^2.43.2"
25
26
  },
26
27
  "devDependencies": {
27
28
  "@xylabs/ts-scripts-yarn3": "2.11.16"
@@ -81,5 +82,5 @@
81
82
  },
82
83
  "sideEffects": false,
83
84
  "types": "dist/esm/index.d.ts",
84
- "version": "2.41.14"
85
+ "version": "2.41.16"
85
86
  }
@@ -0,0 +1,20 @@
1
+ import { WithChildren } from '@xylabs/react-shared'
2
+ import { useEffect, useState } from 'react'
3
+
4
+ import { useSchemaList } from '../../../hooks'
5
+ import { SchemaContext } from '../Context'
6
+ import { SchemaProviderProps } from './Props'
7
+
8
+ export const SchemaMemoryProvider: React.FC<WithChildren<SchemaProviderProps>> = ({ defaultSchema, knownSchemaList = [], ...props }) => {
9
+ const [schema, setSchema] = useState(defaultSchema)
10
+ const [schemaList, setSchemaList] = useState<string[] | undefined>(knownSchemaList)
11
+ const [fetchedSchemaList] = useSchemaList()
12
+
13
+ useEffect(() => {
14
+ if (fetchedSchemaList) {
15
+ setSchemaList(fetchedSchemaList.map(({ name }) => name))
16
+ }
17
+ }, [fetchedSchemaList])
18
+
19
+ return <SchemaContext.Provider value={{ provided: true, schema, schemaList: knownSchemaList ?? schemaList, setSchema, setSchemaList }} {...props} />
20
+ }
@@ -0,0 +1,4 @@
1
+ export interface SchemaProviderProps {
2
+ defaultSchema?: string
3
+ knownSchemaList?: string[]
4
+ }
@@ -0,0 +1,62 @@
1
+ import { WithChildren } from '@xylabs/react-shared'
2
+ import { useCallback, useEffect } from 'react'
3
+ import { useSearchParams } from 'react-router-dom'
4
+
5
+ import { SchemaContext } from '../Context'
6
+ import { useSchema } from '../use'
7
+ import { SchemaMemoryProvider } from './Memory'
8
+ import { SchemaProviderProps } from './Props'
9
+
10
+ const SchemaRouteProviderInner: React.FC<WithChildren> = ({ children }) => {
11
+ const { schema, setSchema, schemaList } = useSchema()
12
+
13
+ const [params, setParams] = useSearchParams()
14
+
15
+ const routeSchema = params.get('schema')
16
+
17
+ //update the network stored in the route
18
+ const setSchemaParam = useCallback(
19
+ (schema?: string) => {
20
+ if (schema) {
21
+ params.set('schema', schema)
22
+ setParams(params, { replace: true })
23
+ setSchema?.(schema)
24
+ } else {
25
+ params.delete('network')
26
+ }
27
+ },
28
+ [params, setParams, setSchema],
29
+ )
30
+
31
+ //if the network is actively changed, update both memory and route
32
+ const setSchemaLocal = useCallback(
33
+ (schema: string) => {
34
+ setSchemaParam(schema)
35
+ setSchema?.(schema)
36
+ },
37
+ [setSchemaParam, setSchema],
38
+ )
39
+
40
+ //sync memory and route storage of network
41
+ useEffect(() => {
42
+ if (routeSchema !== schema) {
43
+ if (routeSchema === undefined && schema !== undefined) {
44
+ //if the route does not have a network selected, use what is in the memory context
45
+ setSchemaLocal(schema)
46
+ } else if (routeSchema) {
47
+ //if the route has a selection and it is different from memory, update memory
48
+ setSchema?.(routeSchema)
49
+ }
50
+ }
51
+ }, [routeSchema, schema, setSchemaParam, setSchema, setSchemaLocal])
52
+
53
+ return <SchemaContext.Provider value={{ provided: true, schema, schemaList, setSchema: setSchemaLocal }}>{children}</SchemaContext.Provider>
54
+ }
55
+
56
+ export const SchemaRouteProvider: React.FC<WithChildren<SchemaProviderProps>> = ({ knownSchemaList, defaultSchema, ...props }) => {
57
+ return (
58
+ <SchemaMemoryProvider knownSchemaList={knownSchemaList} defaultSchema={defaultSchema}>
59
+ <SchemaRouteProviderInner {...props} />
60
+ </SchemaMemoryProvider>
61
+ )
62
+ }
@@ -0,0 +1,3 @@
1
+ export * from './Memory'
2
+ export * from './Props'
3
+ export * from './Route'
@@ -1,3 +1,4 @@
1
1
  export * from './Context'
2
+ export * from './Provider'
2
3
  export * from './State'
3
4
  export * from './use'
@@ -1,3 +1,4 @@
1
1
  export * from './useGetSchema'
2
+ export * from './useSchemaDefinitions'
2
3
  export * from './useSchemaList'
3
4
  export * from './useSchemaStats'
@@ -1,9 +1,15 @@
1
+ import { Typography } from '@mui/material'
1
2
  import { ComponentStory, DecoratorFn, Meta } from '@storybook/react'
2
3
  import { NodeConfigSchema } from '@xyo-network/node'
3
4
  import { TYPES } from '@xyo-network/node-core-types'
4
5
  import { MemoryNodeProvider, useAddNamedModules } from '@xyo-network/react-node'
6
+ import { XyoSchemaCache } from '@xyo-network/utils'
5
7
 
6
- import { TestSchemaHooks } from './TestSchemaHooks'
8
+ import { useSchemaDefinitions } from '../useSchemaDefinitions'
9
+ import { useSchemaList } from '../useSchemaList'
10
+ import { useSchemaStats } from '../useSchemaStats'
11
+
12
+ const apiDomain = 'https://beta.api.archivist.xyo.network'
7
13
 
8
14
  const MemoryNodeDecorator: DecoratorFn = (Story, args) => (
9
15
  <MemoryNodeProvider config={{ schema: NodeConfigSchema }}>
@@ -13,18 +19,33 @@ const MemoryNodeDecorator: DecoratorFn = (Story, args) => (
13
19
 
14
20
  const AddModulesDecorator: DecoratorFn = (Story, args) => {
15
21
  const list = { SchemaStatsDiviner: TYPES.SchemaStatsDiviner }
16
- useAddNamedModules(list, { apiDomain: 'http://localhost:8080' })
22
+ useAddNamedModules(list, { apiDomain })
17
23
  return <Story {...args} />
18
24
  }
19
25
 
20
26
  // eslint-disable-next-line import/no-default-export
21
27
  export default {
22
- component: TestSchemaHooks,
23
28
  decorators: [AddModulesDecorator, MemoryNodeDecorator],
24
29
  title: 'schema/Hooks',
25
30
  } as Meta
26
31
 
27
- const Template: ComponentStory<typeof TestSchemaHooks> = (args) => <TestSchemaHooks {...args} />
32
+ const Template: ComponentStory<React.FC> = () => {
33
+ XyoSchemaCache.instance.proxy = `${apiDomain}/domain`
34
+ const [schemaStats] = useSchemaStats('temp')
35
+ const [schemaList] = useSchemaList('temp')
36
+ const schemaDefinitions = useSchemaDefinitions(schemaList)
37
+
38
+ return (
39
+ <div style={{ display: 'flex', flexDirection: 'column', rowGap: '16px' }}>
40
+ <Typography variant={'h2'}>Schema Stats</Typography>
41
+ <code>{JSON.stringify(schemaStats, null, 2)}</code>
42
+ <Typography variant={'h2'}>Schema List</Typography>
43
+ <code>{JSON.stringify(schemaList, null, 2)}</code>
44
+ <Typography variant={'h2'}>Schema Definitions</Typography>
45
+ <code>{JSON.stringify(schemaDefinitions, null, 2)}</code>
46
+ </div>
47
+ )
48
+ }
28
49
 
29
50
  const Default = Template.bind({})
30
51
  Default.args = {}
@@ -0,0 +1,26 @@
1
+ import { useAsyncEffect } from '@xylabs/react-shared'
2
+ import { SchemaList } from '@xyo-network/api'
3
+ import { XyoSchemaPayload } from '@xyo-network/schema-payload-plugin'
4
+ import { XyoSchemaCache } from '@xyo-network/utils'
5
+ import { useState } from 'react'
6
+
7
+ export const useSchemaDefinitions = (schemaList?: SchemaList[]): XyoSchemaPayload[] | undefined => {
8
+ const [schemaPayloads, setSchemaPayloads] = useState<XyoSchemaPayload[]>()
9
+ useAsyncEffect(
10
+ // eslint-disable-next-line react-hooks/exhaustive-deps
11
+ async (mounted) => {
12
+ if (schemaList) {
13
+ const promiseResults = await Promise.allSettled(schemaList?.map(({ name }) => XyoSchemaCache.instance.get(name)))
14
+ if (mounted()) {
15
+ setSchemaPayloads(
16
+ promiseResults
17
+ .map((result) => (result.status === 'fulfilled' ? result.value?.payload : undefined))
18
+ .filter((item) => item !== undefined && item !== null) as XyoSchemaPayload[],
19
+ )
20
+ }
21
+ }
22
+ },
23
+ [schemaList],
24
+ )
25
+ return schemaPayloads
26
+ }
@@ -1,13 +1,12 @@
1
- import { SchemaStats } from '@xyo-network/api'
2
- import { SchemaStatsQuerySchema } from '@xyo-network/node-core-model'
1
+ import { SchemaStatsPayload, SchemaStatsQuerySchema } from '@xyo-network/node-core-model'
3
2
  import { TYPES } from '@xyo-network/node-core-types'
4
3
  import { XyoPayload, XyoPayloadBuilder } from '@xyo-network/payload'
5
4
  import { useNodeQueryDiviner } from '@xyo-network/react-node'
6
5
  import { Dispatch, SetStateAction, useEffect, useState } from 'react'
7
6
 
8
- export const useSchemaStats = (archive?: string): [SchemaStats | undefined, Error | undefined, Dispatch<SetStateAction<number>>] => {
7
+ export const useSchemaStats = (archive?: string): [SchemaStatsPayload | undefined, Error | undefined, Dispatch<SetStateAction<number>>] => {
9
8
  const [refresh, setRefresh] = useState(1)
10
- const refreshHistory = () => setRefresh((previous) => previous + 1)
9
+ const refreshStats = () => setRefresh((previous) => previous + 1)
11
10
 
12
11
  const [query, setQuery] = useState<XyoPayload>()
13
12
  const [schemaStats, error] = useNodeQueryDiviner(TYPES.SchemaStatsDiviner.description, query)
@@ -18,5 +17,5 @@ export const useSchemaStats = (archive?: string): [SchemaStats | undefined, Erro
18
17
  }
19
18
  }, [archive, refresh])
20
19
 
21
- return [schemaStats?.[0] as SchemaStats, error, refreshHistory]
20
+ return [schemaStats?.[0] as SchemaStatsPayload, error, refreshStats]
22
21
  }
@@ -1,3 +0,0 @@
1
- /// <reference types="react" />
2
- export declare const TestSchemaHooks: React.FC;
3
- //# sourceMappingURL=TestSchemaHooks.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TestSchemaHooks.d.ts","sourceRoot":"","sources":["../../../../src/hooks/stories/TestSchemaHooks.tsx"],"names":[],"mappings":";AAKA,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAYnC,CAAA"}
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TestSchemaHooks = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const material_1 = require("@mui/material");
6
- const useSchemaList_1 = require("../useSchemaList");
7
- const useSchemaStats_1 = require("../useSchemaStats");
8
- const TestSchemaHooks = () => {
9
- const [schemaStats] = (0, useSchemaStats_1.useSchemaStats)('temp');
10
- const [schemaList] = (0, useSchemaList_1.useSchemaList)('temp');
11
- return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ style: { display: 'flex', flexDirection: 'column', rowGap: '16px' } }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: 'h2' }, { children: "Schema Stats" })), (0, jsx_runtime_1.jsx)("code", { children: JSON.stringify(schemaStats, null, 2) }), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: 'h2' }, { children: "Schema List" })), (0, jsx_runtime_1.jsx)("code", { children: JSON.stringify(schemaList, null, 2) })] })));
12
- };
13
- exports.TestSchemaHooks = TestSchemaHooks;
14
- //# sourceMappingURL=TestSchemaHooks.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TestSchemaHooks.js","sourceRoot":"","sources":["../../../../src/hooks/stories/TestSchemaHooks.tsx"],"names":[],"mappings":";;;;AAAA,4CAA0C;AAE1C,oDAAgD;AAChD,sDAAkD;AAE3C,MAAM,eAAe,GAAa,GAAG,EAAE;IAC5C,MAAM,CAAC,WAAW,CAAC,GAAG,IAAA,+BAAc,EAAC,MAAM,CAAC,CAAA;IAC5C,MAAM,CAAC,UAAU,CAAC,GAAG,IAAA,6BAAa,EAAC,MAAM,CAAC,CAAA;IAE1C,OAAO,CACL,+CAAK,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,iBACtE,uBAAC,qBAAU,kBAAC,OAAO,EAAE,IAAI,kCAA2B,EACpD,2CAAO,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,GAAQ,EACnD,uBAAC,qBAAU,kBAAC,OAAO,EAAE,IAAI,iCAA0B,EACnD,2CAAO,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,GAAQ,KAC9C,CACP,CAAA;AACH,CAAC,CAAA;AAZY,QAAA,eAAe,mBAY3B"}
@@ -1,3 +0,0 @@
1
- /// <reference types="react" />
2
- export declare const TestSchemaHooks: React.FC;
3
- //# sourceMappingURL=TestSchemaHooks.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TestSchemaHooks.d.ts","sourceRoot":"","sources":["../../../../src/hooks/stories/TestSchemaHooks.tsx"],"names":[],"mappings":";AAKA,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAYnC,CAAA"}
@@ -1,10 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Typography } from '@mui/material';
3
- import { useSchemaList } from '../useSchemaList';
4
- import { useSchemaStats } from '../useSchemaStats';
5
- export const TestSchemaHooks = () => {
6
- const [schemaStats] = useSchemaStats('temp');
7
- const [schemaList] = useSchemaList('temp');
8
- return (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', rowGap: '16px' }, children: [_jsx(Typography, { variant: 'h2', children: "Schema Stats" }), _jsx("code", { children: JSON.stringify(schemaStats, null, 2) }), _jsx(Typography, { variant: 'h2', children: "Schema List" }), _jsx("code", { children: JSON.stringify(schemaList, null, 2) })] }));
9
- };
10
- //# sourceMappingURL=TestSchemaHooks.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TestSchemaHooks.js","sourceRoot":"","sources":["../../../../src/hooks/stories/TestSchemaHooks.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAE1C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAElD,MAAM,CAAC,MAAM,eAAe,GAAa,GAAG,EAAE;IAC5C,MAAM,CAAC,WAAW,CAAC,GAAG,cAAc,CAAC,MAAM,CAAC,CAAA;IAC5C,MAAM,CAAC,UAAU,CAAC,GAAG,aAAa,CAAC,MAAM,CAAC,CAAA;IAE1C,OAAO,CACL,eAAK,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,aACtE,KAAC,UAAU,IAAC,OAAO,EAAE,IAAI,6BAA2B,EACpD,yBAAO,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,GAAQ,EACnD,KAAC,UAAU,IAAC,OAAO,EAAE,IAAI,4BAA0B,EACnD,yBAAO,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,GAAQ,IAC9C,CACP,CAAA;AACH,CAAC,CAAA"}
@@ -1,18 +0,0 @@
1
- import { Typography } from '@mui/material'
2
-
3
- import { useSchemaList } from '../useSchemaList'
4
- import { useSchemaStats } from '../useSchemaStats'
5
-
6
- export const TestSchemaHooks: React.FC = () => {
7
- const [schemaStats] = useSchemaStats('temp')
8
- const [schemaList] = useSchemaList('temp')
9
-
10
- return (
11
- <div style={{ display: 'flex', flexDirection: 'column', rowGap: '16px' }}>
12
- <Typography variant={'h2'}>Schema Stats</Typography>
13
- <code>{JSON.stringify(schemaStats, null, 2)}</code>
14
- <Typography variant={'h2'}>Schema List</Typography>
15
- <code>{JSON.stringify(schemaList, null, 2)}</code>
16
- </div>
17
- )
18
- }