@xyo-network/react-node 2.42.6 → 2.42.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,24 +2,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import CloseIcon from '@mui/icons-material/Close';
3
3
  import { ClickAwayListener, Drawer, IconButton } from '@mui/material';
4
4
  import { FlexGrowCol, FlexRow } from '@xylabs/react-flexbox';
5
- import { useAsyncEffect } from '@xylabs/react-shared';
6
- import { NodeWrapper } from '@xyo-network/node';
7
- import { useState } from 'react';
8
5
  import { useNode, useNodeDrawer } from '../contexts';
9
6
  import { ModuleDescriptionBox } from './render';
10
7
  export const NodeDrawer = ({ children, ...props }) => {
11
8
  const { open, setOpen } = useNodeDrawer();
12
9
  const [node] = useNode();
13
- const [moduleDescription, setModuleDescription] = useState();
14
- useAsyncEffect(
15
- // eslint-disable-next-line react-hooks/exhaustive-deps
16
- async () => {
17
- if (node) {
18
- const wrapper = node ? NodeWrapper.wrap(node) : undefined;
19
- const nodeDescription = await wrapper?.describe();
20
- setModuleDescription(nodeDescription);
21
- }
22
- }, [node]);
23
- return (_jsx(Drawer, { open: open ?? false, anchor: "right", ...props, children: _jsx(ClickAwayListener, { onClickAway: () => setOpen?.(false), children: _jsxs(FlexGrowCol, { role: "presentation", justifyContent: "start", p: 2, rowGap: 2, minWidth: "33vw", children: [_jsx(FlexRow, { alignContent: "start", justifyContent: "start", width: "100%", children: _jsx(IconButton, { onClick: () => setOpen?.(false), children: _jsx(CloseIcon, {}) }) }), _jsx(ModuleDescriptionBox, { moduleDescription: moduleDescription }), children] }) }) }));
10
+ return (_jsx(Drawer, { open: open ?? false, anchor: "right", ...props, children: _jsx(ClickAwayListener, { onClickAway: () => setOpen?.(false), children: _jsxs(FlexGrowCol, { role: "presentation", justifyContent: "start", p: 2, rowGap: 2, minWidth: "33vw", children: [_jsx(FlexRow, { alignContent: "start", justifyContent: "start", width: "100%", children: _jsx(IconButton, { onClick: () => setOpen?.(false), children: _jsx(CloseIcon, {}) }) }), _jsx(ModuleDescriptionBox, { module: node }), children] }) }) }));
24
11
  };
25
12
  //# sourceMappingURL=NodeDrawer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"NodeDrawer.js","sourceRoot":"","sources":["../../../src/components/NodeDrawer.tsx"],"names":[],"mappings":";AAAA,OAAO,SAAS,MAAM,2BAA2B,CAAA;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAe,UAAU,EAAE,MAAM,eAAe,CAAA;AAClF,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,EAAE,cAAc,EAAgB,MAAM,sBAAsB,CAAA;AAEnE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEhC,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAI/C,MAAM,CAAC,MAAM,UAAU,GAA8B,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE;IAC9E,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,aAAa,EAAE,CAAA;IACzC,MAAM,CAAC,IAAI,CAAC,GAAG,OAAO,EAAE,CAAA;IACxB,MAAM,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,GAAG,QAAQ,EAAqB,CAAA;IAE/E,cAAc;IACZ,uDAAuD;IACvD,KAAK,IAAI,EAAE;QACT,IAAI,IAAI,EAAE;YACR,MAAM,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;YACzD,MAAM,eAAe,GAAG,MAAM,OAAO,EAAE,QAAQ,EAAE,CAAA;YACjD,oBAAoB,CA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,aAAa,EAAE,CAAA;IACzC,MAAM,CAAC,IAAI,CAAC,GAAG,OAAO,EAAE,CAAA;IAExB,OAAO,CACL,KAAC,MAAM,IAAC,IAAI,EAAE,IAAI,IAAI,KAAK,EAAE,MAAM,EAAC,OAAO,KAAK,KAAK,YACnD,KAAC,iBAAiB,IAAC,WAAW,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,YACpD,MAAC,WAAW,IAAC,IAAI,EAAC,cAAc,EAAC,cAAc,EAAC,OAAO,EAAC,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,QAAQ,EAAC,MAAM,aACtF,KAAC,OAAO,IAAC,YAAY,EAAC,OAAO,EAAC,cAAc,EAAC,OAAO,EAAC,KAAK,EAAC,MAAM,YAC/D,KAAC,UAAU,IAAC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,YACzC,KAAC,SAAS,KAAG,GACF,GACL,EACV,KAAC,oBAAoB,IAAC,MAAM,EAAE,IAAI,GAAI,EACrC,QAAQ,IACG,GACI,GACb,CACV,CAAA;AACH,CAAC,CAAA"}
@@ -3,12 +3,11 @@ import ChevronRightIcon from '@mui/icons-material/ChevronRight';
3
3
  import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
4
4
  import { TreeView } from '@mui/lab';
5
5
  import { styled, Typography } from '@mui/material';
6
- import isEmpty from 'lodash/isEmpty';
7
6
  import { useRef } from 'react';
8
7
  import { RenderModule } from './RenderModule';
9
- export const ModuleDescriptionBox = ({ moduleDescription }) => {
8
+ export const ModuleDescriptionBox = ({ module }) => {
10
9
  const idRef = useRef({ idIncrementor: 0, ids: [] });
11
- return (_jsxs(_Fragment, { children: [moduleDescription === undefined ? _jsx(Typography, { variant: "h4", children: "Node not found" }) : null, isEmpty(moduleDescription) ? _jsx(Typography, { children: "Node has no modules" }) : null, !isEmpty(moduleDescription) ? (_jsxs(_Fragment, { children: [_jsx(Typography, { variant: "h4", children: "Node Configuration" }), _jsx(StyledTreeView, { "aria-label": "file system navigator", defaultCollapseIcon: _jsx(ExpandMoreIcon, {}), defaultExpandIcon: _jsx(ChevronRightIcon, {}), sx: { flexGrow: 1 }, children: _jsx(RenderModule, { module: moduleDescription, idRef: idRef }) })] })) : null] }));
10
+ return (_jsx(_Fragment, { children: module === undefined ? (_jsx(Typography, { variant: "h4", children: "Node not found" })) : (_jsxs(_Fragment, { children: [_jsx(Typography, { variant: "h4", children: "Node Configuration" }), _jsx(StyledTreeView, { "aria-label": "file system navigator", defaultCollapseIcon: _jsx(ExpandMoreIcon, {}), defaultExpandIcon: _jsx(ChevronRightIcon, {}), sx: { flexGrow: 1 }, children: _jsx(RenderModule, { module: module, idRef: idRef }) })] })) }));
12
11
  };
13
12
  const StyledTreeView = styled(TreeView, { name: 'StyledTreeView' })(() => ({
14
13
  height: 'auto',
@@ -1 +1 @@
1
- {"version":3,"file":"ModuleDescriptionBox.js","sourceRoot":"","sources":["../../../../src/components/render/ModuleDescriptionBox.tsx"],"names":[],"mappings":";AAAA,OAAO,gBAAgB,MAAM,kCAAkC,CAAA;AAC/D,OAAO,cAAc,MAAM,gCAAgC,CAAA;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACnC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAGlD,OAAO,OAAO,MAAM,gBAAgB,CAAA;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAK7C,MAAM,CAAC,MAAM,oBAAoB,GAAqC,CAAC,EAAE,iBAAiB,EAAE,EAAE,EAAE;IAC9F,MAAM,KAAK,GAAG,MAAM,CAA2C,EAAE,aAAa,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAA;IAE7F,OAAO,CACL,8BACG,iBAAiB,KAAK,SAAS,CAAC,CAAC,CAAC,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AAE,EAAE,EAAE;IACnF,MAAM,KAAK,GAAG,MAAM,CAA2C,EAAE,aAAa,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAA;IAE7F,OAAO,CACL,4BACG,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,CACtB,KAAC,UAAU,IAAC,OAAO,EAAC,IAAI,+BAA4B,CACrD,CAAC,CAAC,CAAC,CACF,8BACE,KAAC,UAAU,IAAC,OAAO,EAAC,IAAI,mCAAgC,EACxD,KAAC,cAAc,kBACF,uBAAuB,EAClC,mBAAmB,EAAE,KAAC,cAAc,KAAG,EACvC,iBAAiB,EAAE,KAAC,gBAAgB,KAAG,EACvC,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,YAEnB,KAAC,YAAY,IAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAI,GAC/B,IAChB,CACJ,GACA,CACJ,CAAA;AACH,CAAC,CAAA;AAED,MAAM,cAAc,GAAG,MAAM,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;IACzE,MAAM,EAAE,MAAM;IACd,QAAQ,EAAE,MAAM;CACjB,CAAC,CAAC,CAAA"}
@@ -1,8 +1,21 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { TreeItem } from '@mui/lab';
3
3
  import { styled } from '@mui/material';
4
+ import { useAsyncEffect } from '@xylabs/react-shared';
5
+ import { ModuleWrapper } from '@xyo-network/module';
6
+ import { useState } from 'react';
4
7
  export const RenderModule = ({ module, idRef }) => {
5
- const { address, queries, children: moduleChildren } = module;
8
+ const { address, queries } = module;
9
+ const [childModules, setChildModules] = useState();
10
+ useAsyncEffect(
11
+ // eslint-disable-next-line react-hooks/exhaustive-deps
12
+ async (mounted) => {
13
+ const wrapper = ModuleWrapper.wrap(module);
14
+ const children = (await wrapper.resolve()).filter((childModule) => childModule.address !== address);
15
+ if (mounted()) {
16
+ setChildModules(children);
17
+ }
18
+ }, [module, address]);
6
19
  const increment = () => {
7
20
  const newId = (idRef.current.idIncrementor++).toString();
8
21
  idRef.current.ids.push(newId);
@@ -10,7 +23,7 @@ export const RenderModule = ({ module, idRef }) => {
10
23
  };
11
24
  return (_jsxs(StyledAddressTreeItem, { nodeId: increment(), label: `address: ${address}`, children: [queries.map((query, index) => {
12
25
  return _jsx(TreeItem, { nodeId: increment(), label: `query : ${query}`, sx: { mb: index === queries.length - 1 ? 1.5 : 0.5 } }, query);
13
- }), moduleChildren && moduleChildren.length > 0 ? (_jsx(TreeItem, { nodeId: increment(), label: 'children', sx: { mb: 0.5 }, children: moduleChildren.map((module) => (_jsx(RenderModule, { module: module, idRef: idRef }, module.address))) })) : null] }));
26
+ }), childModules && childModules.length > 0 ? (_jsx(TreeItem, { nodeId: increment(), label: 'children', sx: { mb: 0.5 }, children: childModules.map((childModule) => (_jsx(RenderModule, { module: childModule, idRef: idRef }, childModule.address))) })) : null] }));
14
27
  };
15
28
  const StyledAddressTreeItem = styled(TreeItem, { name: 'StyledAddressTreeItem' })(({ theme }) => ({
16
29
  '& .MuiTreeItem-content': {
@@ -1 +1 @@
1
- {"version":3,"file":"RenderModule.js","sourceRoot":"","sources":["../../../../src/components/render/RenderModule.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAYtC,MAAM,CAAC,MAAM,YAAY,GAAgC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE;IAC7E,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,GAAG,MAAM,CAAA;IAE7D,MAAM,SAAS,GAAG,GAAG,EAAE;QACrB,MAAM,KAAK,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC,QAAQ,EAAE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Ae,CAAA;AAElF,OAAO,EAAkB,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAQnE,MAAM,WAAW,eAAgB,SAAQ,YAAY,EAAE,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC;CAAG;AAEnF,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAgChD,CAAA"}
1
+ {"version":3,"file":"NodeDrawer.d.ts","sourceRoot":"","sources":["../../../src/components/NodeDrawer.tsx"],"names":[],"mappings":";AACA,OAAO,EAA6B,WAAW,EAAc,MAAM,eAAe,CAAA;AAElF,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAKnD,MAAM,WAAW,eAAgB,SAAQ,YAAY,EAAE,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC;CAAG;AAEnF,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAmBhD,CAAA"}
@@ -1,8 +1,8 @@
1
1
  /// <reference types="react" />
2
2
  import { FlexBoxProps } from '@xylabs/react-flexbox';
3
- import { ModuleDescription } from '@xyo-network/module';
3
+ import { Module } from '@xyo-network/module';
4
4
  export interface ModuleDescriptionProps extends FlexBoxProps {
5
- moduleDescription?: ModuleDescription;
5
+ module?: Module;
6
6
  }
7
7
  export declare const ModuleDescriptionBox: React.FC<ModuleDescriptionProps>;
8
8
  //# sourceMappingURL=ModuleDescriptionBox.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ModuleDescriptionBox.d.ts","sourceRoot":"","sources":["../../../../src/components/render/ModuleDescriptionBox.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAMvD,MAAM,WAAW,sBAAuB,SAAQ,YAAY;IAC1D,iBAAiB,CAAC,EAAE,iBAAiB,CAAA;CACtC;AACD,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAsBjE,CAAA"}
1
+ {"version":3,"file":"ModuleDescriptionBox.d.ts","sourceRoot":"","sources":["../../../../src/components/render/ModuleDescriptionBox.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAK5C,MAAM,WAAW,sBAAuB,SAAQ,YAAY;IAC1D,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AACD,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAsBjE,CAAA"}
@@ -1,11 +1,11 @@
1
- import { ModuleDescription } from '@xyo-network/module';
1
+ import { Module } from '@xyo-network/module';
2
2
  import { MutableRefObject } from 'react';
3
3
  interface RenderModuleProps {
4
4
  idRef: MutableRefObject<{
5
5
  idIncrementor: number;
6
6
  ids: string[];
7
7
  }>;
8
- module: ModuleDescription;
8
+ module: Module;
9
9
  }
10
10
  export declare const RenderModule: React.FC<RenderModuleProps>;
11
11
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"RenderModule.d.ts","sourceRoot":"","sources":["../../../../src/components/render/RenderModule.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAA;AAExC,UAAU,iBAAiB;IACzB,KAAK,EAAE,gBAAgB,CAAC;QACtB,aAAa,EAAE,MAAM,CAAA;QACrB,GAAG,EAAE,MAAM,EAAE,CAAA;KACd,CAAC,CAAA;IACF,MAAM,EAAE,iBAAiB,CAAA;CAC1B;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAuBpD,CAAA"}
1
+ {"version":3,"file":"RenderModule.d.ts","sourceRoot":"","sources":["../../../../src/components/render/RenderModule.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAiB,MAAM,qBAAqB,CAAA;AAC3D,OAAO,EAAE,gBAAgB,EAAY,MAAM,OAAO,CAAA;AAElD,UAAU,iBAAiB;IACzB,KAAK,EAAE,gBAAgB,CAAC;QACtB,aAAa,EAAE,MAAM,CAAA;QACrB,GAAG,EAAE,MAAM,EAAE,CAAA;KACd,CAAC,CAAA;IACF,MAAM,EAAE,MAAM,CAAA;CACf;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAoCpD,CAAA"}
@@ -1,31 +1,4 @@
1
1
  import { NodeModule } from '@xyo-network/node';
2
2
  import { Dispatch } from 'react';
3
- export declare const useNode: <T extends NodeModule<import("@xyo-network/module-model").Module<import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & {
4
- name?: string | undefined;
5
- security?: {
6
- allowAnonymous?: boolean | undefined;
7
- allowed?: Record<string, (string | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
8
- disallowed?: Record<string, string[]> | undefined;
9
- } | undefined;
10
- } & {
11
- schema: string;
12
- }>> = NodeModule<import("@xyo-network/module-model").Module<import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & {
13
- name?: string | undefined;
14
- security?: {
15
- allowAnonymous?: boolean | undefined;
16
- allowed?: Record<string, (string | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
17
- disallowed?: Record<string, string[]> | undefined;
18
- } | undefined;
19
- } & {
20
- schema: string;
21
- }>>>(required?: boolean) => [T | undefined, Dispatch<NodeModule<import("@xyo-network/module-model").Module<import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & {
22
- name?: string | undefined;
23
- security?: {
24
- allowAnonymous?: boolean | undefined;
25
- allowed?: Record<string, (string | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
26
- disallowed?: Record<string, string[]> | undefined;
27
- } | undefined;
28
- } & {
29
- schema: string;
30
- }>>> | undefined];
3
+ export declare const useNode: <T extends NodeModule = NodeModule>(required?: boolean) => [T | undefined, Dispatch<NodeModule> | undefined];
31
4
  //# sourceMappingURL=useNode.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useNode.d.ts","sourceRoot":"","sources":["../../../src/contexts/useNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAE9C,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAIhC,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAInB,CAAA"}
1
+ {"version":3,"file":"useNode.d.ts","sourceRoot":"","sources":["../../../src/contexts/useNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAE9C,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAIhC,eAAO,MAAM,OAAO,8GAInB,CAAA"}
package/package.json CHANGED
@@ -13,16 +13,15 @@
13
13
  "@mui/lab": "^5.0.0-alpha.120",
14
14
  "@xylabs/react-flexbox": "^2.16.8",
15
15
  "@xylabs/react-shared": "^2.16.8",
16
- "@xyo-network/archivist": "^2.47.0",
17
- "@xyo-network/diviner-model": "^2.47.0",
18
- "@xyo-network/diviner-wrapper": "^2.47.0",
19
- "@xyo-network/module": "^2.47.0",
20
- "@xyo-network/module-model": "^2.47.0",
21
- "@xyo-network/node": "^2.47.0",
22
- "@xyo-network/payload-model": "^2.47.0",
23
- "@xyo-network/react-shared": "^2.42.6",
24
- "@xyo-network/witness": "^2.47.0",
25
- "lodash": "^4.17.21"
16
+ "@xyo-network/archivist": "^2.47.1",
17
+ "@xyo-network/diviner-model": "^2.47.1",
18
+ "@xyo-network/diviner-wrapper": "^2.47.1",
19
+ "@xyo-network/module": "^2.47.1",
20
+ "@xyo-network/module-model": "^2.47.1",
21
+ "@xyo-network/node": "^2.47.1",
22
+ "@xyo-network/payload-model": "^2.47.1",
23
+ "@xyo-network/react-shared": "^2.42.8",
24
+ "@xyo-network/witness": "^2.47.1"
26
25
  },
27
26
  "devDependencies": {
28
27
  "@storybook/react": "^6.5.16",
@@ -83,5 +82,5 @@
83
82
  },
84
83
  "sideEffects": false,
85
84
  "types": "dist/types/index.d.ts",
86
- "version": "2.42.6"
85
+ "version": "2.42.8"
87
86
  }
@@ -1,10 +1,7 @@
1
1
  import CloseIcon from '@mui/icons-material/Close'
2
2
  import { ClickAwayListener, Drawer, DrawerProps, IconButton } from '@mui/material'
3
3
  import { FlexGrowCol, FlexRow } from '@xylabs/react-flexbox'
4
- import { useAsyncEffect, WithChildren } from '@xylabs/react-shared'
5
- import { ModuleDescription } from '@xyo-network/module'
6
- import { NodeWrapper } from '@xyo-network/node'
7
- import { useState } from 'react'
4
+ import { WithChildren } from '@xylabs/react-shared'
8
5
 
9
6
  import { useNode, useNodeDrawer } from '../contexts'
10
7
  import { ModuleDescriptionBox } from './render'
@@ -14,19 +11,6 @@ export interface NodeDrawerProps extends WithChildren, Omit<DrawerProps, 'open'>
14
11
  export const NodeDrawer: React.FC<NodeDrawerProps> = ({ children, ...props }) => {
15
12
  const { open, setOpen } = useNodeDrawer()
16
13
  const [node] = useNode()
17
- const [moduleDescription, setModuleDescription] = useState<ModuleDescription>()
18
-
19
- useAsyncEffect(
20
- // eslint-disable-next-line react-hooks/exhaustive-deps
21
- async () => {
22
- if (node) {
23
- const wrapper = node ? NodeWrapper.wrap(node) : undefined
24
- const nodeDescription = await wrapper?.describe()
25
- setModuleDescription(nodeDescription)
26
- }
27
- },
28
- [node],
29
- )
30
14
 
31
15
  return (
32
16
  <Drawer open={open ?? false} anchor="right" {...props}>
@@ -37,7 +21,7 @@ export const NodeDrawer: React.FC<NodeDrawerProps> = ({ children, ...props }) =>
37
21
  <CloseIcon />
38
22
  </IconButton>
39
23
  </FlexRow>
40
- <ModuleDescriptionBox moduleDescription={moduleDescription} />
24
+ <ModuleDescriptionBox module={node} />
41
25
  {children}
42
26
  </FlexGrowCol>
43
27
  </ClickAwayListener>
@@ -3,23 +3,22 @@ import ExpandMoreIcon from '@mui/icons-material/ExpandMore'
3
3
  import { TreeView } from '@mui/lab'
4
4
  import { styled, Typography } from '@mui/material'
5
5
  import { FlexBoxProps } from '@xylabs/react-flexbox'
6
- import { ModuleDescription } from '@xyo-network/module'
7
- import isEmpty from 'lodash/isEmpty'
6
+ import { Module } from '@xyo-network/module'
8
7
  import { useRef } from 'react'
9
8
 
10
9
  import { RenderModule } from './RenderModule'
11
10
 
12
11
  export interface ModuleDescriptionProps extends FlexBoxProps {
13
- moduleDescription?: ModuleDescription
12
+ module?: Module
14
13
  }
15
- export const ModuleDescriptionBox: React.FC<ModuleDescriptionProps> = ({ moduleDescription }) => {
14
+ export const ModuleDescriptionBox: React.FC<ModuleDescriptionProps> = ({ module }) => {
16
15
  const idRef = useRef<{ idIncrementor: number; ids: string[] }>({ idIncrementor: 0, ids: [] })
17
16
 
18
17
  return (
19
18
  <>
20
- {moduleDescription === undefined ? <Typography variant="h4">Node not found</Typography> : null}
21
- {isEmpty(moduleDescription) ? <Typography>Node has no modules</Typography> : null}
22
- {!isEmpty(moduleDescription) ? (
19
+ {module === undefined ? (
20
+ <Typography variant="h4">Node not found</Typography>
21
+ ) : (
23
22
  <>
24
23
  <Typography variant="h4">Node Configuration</Typography>
25
24
  <StyledTreeView
@@ -28,10 +27,10 @@ export const ModuleDescriptionBox: React.FC<ModuleDescriptionProps> = ({ moduleD
28
27
  defaultExpandIcon={<ChevronRightIcon />}
29
28
  sx={{ flexGrow: 1 }}
30
29
  >
31
- <RenderModule module={moduleDescription} idRef={idRef} />
30
+ <RenderModule module={module} idRef={idRef} />
32
31
  </StyledTreeView>
33
32
  </>
34
- ) : null}
33
+ )}
35
34
  </>
36
35
  )
37
36
  }
@@ -1,18 +1,32 @@
1
1
  import { TreeItem } from '@mui/lab'
2
2
  import { styled } from '@mui/material'
3
- import { ModuleDescription } from '@xyo-network/module'
4
- import { MutableRefObject } from 'react'
3
+ import { useAsyncEffect } from '@xylabs/react-shared'
4
+ import { Module, ModuleWrapper } from '@xyo-network/module'
5
+ import { MutableRefObject, useState } from 'react'
5
6
 
6
7
  interface RenderModuleProps {
7
8
  idRef: MutableRefObject<{
8
9
  idIncrementor: number
9
10
  ids: string[]
10
11
  }>
11
- module: ModuleDescription
12
+ module: Module
12
13
  }
13
14
 
14
15
  export const RenderModule: React.FC<RenderModuleProps> = ({ module, idRef }) => {
15
- const { address, queries, children: moduleChildren } = module
16
+ const { address, queries } = module
17
+ const [childModules, setChildModules] = useState<Module[]>()
18
+
19
+ useAsyncEffect(
20
+ // eslint-disable-next-line react-hooks/exhaustive-deps
21
+ async (mounted) => {
22
+ const wrapper = ModuleWrapper.wrap(module)
23
+ const children = (await wrapper.resolve()).filter((childModule) => childModule.address !== address)
24
+ if (mounted()) {
25
+ setChildModules(children)
26
+ }
27
+ },
28
+ [module, address],
29
+ )
16
30
 
17
31
  const increment = () => {
18
32
  const newId = (idRef.current.idIncrementor++).toString()
@@ -25,10 +39,10 @@ export const RenderModule: React.FC<RenderModuleProps> = ({ module, idRef }) =>
25
39
  {queries.map((query, index) => {
26
40
  return <TreeItem key={query} nodeId={increment()} label={`query : ${query}`} sx={{ mb: index === queries.length - 1 ? 1.5 : 0.5 }} />
27
41
  })}
28
- {moduleChildren && moduleChildren.length > 0 ? (
42
+ {childModules && childModules.length > 0 ? (
29
43
  <TreeItem nodeId={increment()} label={'children'} sx={{ mb: 0.5 }}>
30
- {moduleChildren.map((module) => (
31
- <RenderModule key={module.address} module={module} idRef={idRef} />
44
+ {childModules.map((childModule) => (
45
+ <RenderModule key={childModule.address} module={childModule} idRef={idRef} />
32
46
  ))}
33
47
  </TreeItem>
34
48
  ) : null}