@digi-frontend/dgate-api-documentation 4.0.0-beta.3 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1529 -528
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -4
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +5 -4
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1510 -509
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3,16 +3,16 @@ import { devtools } from "zustand/middleware";
|
|
|
3
3
|
import { immer } from "zustand/middleware/immer";
|
|
4
4
|
import { useEffect, useMemo, useRef, useState } from "react";
|
|
5
5
|
import { Alert, Breadcrumb, Button, Card, Divider, Drawer, Empty, Flex, Form, Grid, Input, Modal, Pagination, Select, Switch, Table, Tabs, Tag, Tooltip, Tree, Typography, message, theme } from "antd";
|
|
6
|
-
import { AppstoreOutlined, BarsOutlined, CheckCircleOutlined, DownOutlined, EditOutlined, ExclamationCircleFilled, EyeOutlined, InfoCircleOutlined, LeftOutlined, MinusSquareOutlined, PlusOutlined, PlusSquareOutlined, RightOutlined, SafetyOutlined, SearchOutlined, UpCircleOutlined } from "@ant-design/icons";
|
|
7
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
6
|
import { useStyleRegister } from "@ant-design/cssinjs";
|
|
9
|
-
import
|
|
7
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import Text from "antd/es/typography/Text.js";
|
|
9
|
+
import { AppstoreOutlined, BarsOutlined, CheckCircleOutlined, DownOutlined, EditOutlined, ExclamationCircleFilled, EyeOutlined, InfoCircleOutlined, LeftOutlined, MinusSquareOutlined, PlusOutlined, PlusSquareOutlined, RightOutlined, SafetyOutlined, SearchOutlined, UpCircleOutlined } from "@ant-design/icons";
|
|
10
10
|
import { Resizable } from "re-resizable";
|
|
11
|
-
import Title from "antd/es/typography/Title";
|
|
12
|
-
import { nanoid } from "nanoid";
|
|
11
|
+
import Title from "antd/es/typography/Title.js";
|
|
13
12
|
import { Light } from "react-syntax-highlighter";
|
|
14
13
|
import json from "react-syntax-highlighter/dist/esm/languages/hljs/json.js";
|
|
15
14
|
import * as hljs from "react-syntax-highlighter/dist/esm/styles/hljs/index.js";
|
|
15
|
+
import { nanoid } from "nanoid";
|
|
16
16
|
//#region src/store/slices/view.ts
|
|
17
17
|
const createViewSlice = (set) => ({ view: {
|
|
18
18
|
selectedNodeKey: null,
|
|
@@ -422,41 +422,41 @@ var token = {
|
|
|
422
422
|
};
|
|
423
423
|
//#endregion
|
|
424
424
|
//#region src/view/helper/sidebar.utils.ts
|
|
425
|
-
const methodColors = {
|
|
425
|
+
const methodColors$1 = {
|
|
426
426
|
GET: {
|
|
427
|
-
bg:
|
|
427
|
+
bg: token.colorPrimaryBgHover,
|
|
428
428
|
color: token.colorPrimary
|
|
429
429
|
},
|
|
430
430
|
POST: {
|
|
431
|
-
bg: "
|
|
431
|
+
bg: token["green.1"],
|
|
432
432
|
color: token.colorSuccess
|
|
433
433
|
},
|
|
434
434
|
DELETE: {
|
|
435
|
-
bg:
|
|
435
|
+
bg: token.colorErrorBg,
|
|
436
436
|
color: token.colorError
|
|
437
437
|
},
|
|
438
438
|
PUT: {
|
|
439
|
-
bg:
|
|
439
|
+
bg: token.colorWarningBg,
|
|
440
440
|
color: token.colorWarning
|
|
441
441
|
},
|
|
442
442
|
PATCH: {
|
|
443
|
-
bg: "
|
|
443
|
+
bg: token["volcano.1"],
|
|
444
444
|
color: token["volcano.5"]
|
|
445
445
|
},
|
|
446
446
|
OPTIONS: {
|
|
447
|
-
bg: "
|
|
447
|
+
bg: token["geekblue.2"],
|
|
448
448
|
color: token["geekblue.6"]
|
|
449
449
|
},
|
|
450
450
|
HEAD: {
|
|
451
|
-
bg: "
|
|
451
|
+
bg: token["purple.1"],
|
|
452
452
|
color: token["purple.5"]
|
|
453
453
|
},
|
|
454
454
|
TRACE: {
|
|
455
|
-
bg: "
|
|
456
|
-
color: token["
|
|
455
|
+
bg: token["cyan.1"],
|
|
456
|
+
color: token["cyan.5"]
|
|
457
457
|
}
|
|
458
458
|
};
|
|
459
|
-
const darkerMethodColors = {
|
|
459
|
+
const darkerMethodColors$1 = {
|
|
460
460
|
GET: {
|
|
461
461
|
bg: token.colorPrimary,
|
|
462
462
|
color: "#FFFFFF"
|
|
@@ -490,70 +490,18 @@ const darkerMethodColors = {
|
|
|
490
490
|
color: "#FFFFFF"
|
|
491
491
|
}
|
|
492
492
|
};
|
|
493
|
-
const
|
|
494
|
-
GET: {
|
|
495
|
-
bg: token.colorPrimaryBgHover,
|
|
496
|
-
color: token.colorPrimary
|
|
497
|
-
},
|
|
498
|
-
POST: {
|
|
499
|
-
bg: token.colorSuccessBg,
|
|
500
|
-
color: token.colorSuccess
|
|
501
|
-
},
|
|
502
|
-
DELETE: {
|
|
503
|
-
bg: token.colorErrorBg,
|
|
504
|
-
color: token.colorError
|
|
505
|
-
},
|
|
506
|
-
PUT: {
|
|
507
|
-
bg: token.colorWarningBg,
|
|
508
|
-
color: token.colorWarning
|
|
509
|
-
},
|
|
510
|
-
PATCH: {
|
|
511
|
-
bg: token["volcano.1"],
|
|
512
|
-
color: token["volcano.5"]
|
|
513
|
-
},
|
|
514
|
-
OPTIONS: {
|
|
515
|
-
bg: token["geekblue.2"],
|
|
516
|
-
color: token["geekblue.6"]
|
|
517
|
-
},
|
|
518
|
-
HEAD: {
|
|
519
|
-
bg: token["purple.1"],
|
|
520
|
-
color: token["purple.5"]
|
|
521
|
-
},
|
|
522
|
-
TRACE: {
|
|
523
|
-
bg: token["volcano.1"],
|
|
524
|
-
color: token["volcano.4"]
|
|
525
|
-
}
|
|
526
|
-
};
|
|
527
|
-
const buildTreeDataStructure = (data) => {
|
|
493
|
+
const buildTreeDataStructure$1 = (data) => {
|
|
528
494
|
if (!data) return [];
|
|
529
495
|
return data.map((api) => {
|
|
530
496
|
const tagEntries = Object.entries(api.tags);
|
|
531
|
-
const
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
key: endpoint.id,
|
|
536
|
-
isLeaf: true,
|
|
497
|
+
const hasOnlyDefaultTag = tagEntries.length === 1 && tagEntries[0][0] === "default";
|
|
498
|
+
return {
|
|
499
|
+
title: api.title,
|
|
500
|
+
key: api.id,
|
|
537
501
|
selectable: true,
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
api,
|
|
542
|
-
tagName: "default",
|
|
543
|
-
parentApiId: api.id
|
|
544
|
-
}
|
|
545
|
-
})) : [];
|
|
546
|
-
const tagNodes = nonDefaultTags.map(([tag, endpoints]) => {
|
|
547
|
-
const tagId = `tag-${api.id}-${tag.replace(/\s+/g, "-").toLowerCase()}`;
|
|
548
|
-
return {
|
|
549
|
-
title: tag,
|
|
550
|
-
key: tagId,
|
|
551
|
-
selectable: true,
|
|
552
|
-
data: {
|
|
553
|
-
tagName: tag,
|
|
554
|
-
apiData: api
|
|
555
|
-
},
|
|
556
|
-
children: endpoints.map((endpoint) => ({
|
|
502
|
+
data: api,
|
|
503
|
+
children: hasOnlyDefaultTag ? tagEntries[0][1].map((endpoint) => {
|
|
504
|
+
return {
|
|
557
505
|
title: endpoint.summary,
|
|
558
506
|
key: endpoint.id,
|
|
559
507
|
isLeaf: true,
|
|
@@ -562,19 +510,38 @@ const buildTreeDataStructure = (data) => {
|
|
|
562
510
|
data: {
|
|
563
511
|
endpoint,
|
|
564
512
|
api,
|
|
565
|
-
tagName:
|
|
566
|
-
parentApiId: api.id
|
|
567
|
-
tagId
|
|
513
|
+
tagName: "default",
|
|
514
|
+
parentApiId: api.id
|
|
568
515
|
}
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
516
|
+
};
|
|
517
|
+
}) : tagEntries.map(([tag, endpoints]) => {
|
|
518
|
+
const tagId = `tag-${api.id}-${tag.replace(/\s+/g, "-").toLowerCase()}`;
|
|
519
|
+
return {
|
|
520
|
+
title: tag,
|
|
521
|
+
key: tagId,
|
|
522
|
+
selectable: true,
|
|
523
|
+
data: {
|
|
524
|
+
tagName: tag,
|
|
525
|
+
apiData: api
|
|
526
|
+
},
|
|
527
|
+
children: endpoints.map((endpoint) => {
|
|
528
|
+
return {
|
|
529
|
+
title: endpoint.summary,
|
|
530
|
+
key: endpoint.id,
|
|
531
|
+
isLeaf: true,
|
|
532
|
+
selectable: true,
|
|
533
|
+
method: endpoint.method,
|
|
534
|
+
data: {
|
|
535
|
+
endpoint,
|
|
536
|
+
api,
|
|
537
|
+
tagName: tag,
|
|
538
|
+
parentApiId: api.id,
|
|
539
|
+
tagId
|
|
540
|
+
}
|
|
541
|
+
};
|
|
542
|
+
})
|
|
543
|
+
};
|
|
544
|
+
})
|
|
578
545
|
};
|
|
579
546
|
});
|
|
580
547
|
};
|
|
@@ -588,7 +555,11 @@ const findNodeByKey = (nodes, targetKey) => {
|
|
|
588
555
|
}
|
|
589
556
|
return null;
|
|
590
557
|
};
|
|
591
|
-
const
|
|
558
|
+
const isApiSectionHighlighted = (apiKey, selectedEndpoint) => {
|
|
559
|
+
if (!selectedEndpoint) return false;
|
|
560
|
+
return selectedEndpoint.parentApiId === apiKey;
|
|
561
|
+
};
|
|
562
|
+
const getAllTreeKeys$1 = (data) => {
|
|
592
563
|
const keys = [];
|
|
593
564
|
const traverse = (nodes) => {
|
|
594
565
|
nodes.forEach((node) => {
|
|
@@ -599,7 +570,7 @@ const getAllTreeKeys = (data) => {
|
|
|
599
570
|
traverse(data);
|
|
600
571
|
return keys;
|
|
601
572
|
};
|
|
602
|
-
const filterTreeData = (data, searchText) => {
|
|
573
|
+
const filterTreeData$1 = (data, searchText) => {
|
|
603
574
|
if (!searchText) return data;
|
|
604
575
|
const findOriginalNode = (nodes, key) => {
|
|
605
576
|
for (const node of nodes) {
|
|
@@ -632,12 +603,12 @@ const filterTreeData = (data, searchText) => {
|
|
|
632
603
|
};
|
|
633
604
|
return data.map((node) => filterNode(node)).filter((node) => node !== null);
|
|
634
605
|
};
|
|
635
|
-
const getSidebarStyles = (token, scope) => ({
|
|
606
|
+
const getSidebarStyles$1 = (token, scope) => ({
|
|
636
607
|
[scope("sider")]: {
|
|
637
|
-
backgroundColor: token.
|
|
608
|
+
backgroundColor: token.colorBgContainer,
|
|
609
|
+
overflowY: "auto",
|
|
638
610
|
overflowX: "clip",
|
|
639
|
-
borderRadius: token.borderRadius
|
|
640
|
-
height: "auto"
|
|
611
|
+
borderRadius: token.borderRadius
|
|
641
612
|
},
|
|
642
613
|
[scope("content")]: { padding: token.padding },
|
|
643
614
|
[scope("controls")]: {
|
|
@@ -648,15 +619,11 @@ const getSidebarStyles = (token, scope) => ({
|
|
|
648
619
|
[scope("search-input")]: { flex: 1 },
|
|
649
620
|
[scope("tree")]: {
|
|
650
621
|
backgroundColor: "transparent",
|
|
651
|
-
width: "100%",
|
|
652
|
-
"& .ant-tree-list": { width: "100%" },
|
|
653
|
-
"& .ant-tree-list-holder-inner": { width: "100%" },
|
|
654
622
|
"& .ant-tree-node-content-wrapper": {
|
|
655
623
|
overflow: "hidden",
|
|
656
|
-
|
|
624
|
+
width: "100%",
|
|
657
625
|
display: "flex",
|
|
658
|
-
alignItems: "center"
|
|
659
|
-
padding: "0 !important"
|
|
626
|
+
alignItems: "center"
|
|
660
627
|
},
|
|
661
628
|
"& .ant-tree-title": {
|
|
662
629
|
width: "100%",
|
|
@@ -669,7 +636,7 @@ const getSidebarStyles = (token, scope) => ({
|
|
|
669
636
|
width: "100%",
|
|
670
637
|
padding: 0
|
|
671
638
|
},
|
|
672
|
-
"& .ant-tree-
|
|
639
|
+
"& .ant-tree-node-content-wrapper:hover": { backgroundColor: token.colorFillTertiary }
|
|
673
640
|
},
|
|
674
641
|
[scope("endpoint-item")]: {
|
|
675
642
|
display: "flex",
|
|
@@ -677,28 +644,16 @@ const getSidebarStyles = (token, scope) => ({
|
|
|
677
644
|
gap: token.marginXS,
|
|
678
645
|
width: "100%",
|
|
679
646
|
maxWidth: "100%",
|
|
680
|
-
minWidth: "100%"
|
|
681
|
-
paddingLeft: token.marginXS,
|
|
682
|
-
paddingRight: token.marginXS
|
|
647
|
+
minWidth: "100%"
|
|
683
648
|
},
|
|
684
649
|
[scope("method-tag")]: {
|
|
685
|
-
|
|
686
|
-
height: 16,
|
|
687
|
-
lineHeight: "16px",
|
|
688
|
-
fontSize: 12,
|
|
650
|
+
minWidth: "3.75rem",
|
|
689
651
|
textAlign: "center",
|
|
690
|
-
border: "none"
|
|
691
|
-
borderRadius: 6,
|
|
692
|
-
padding: "0 8px",
|
|
693
|
-
display: "inline-flex",
|
|
694
|
-
alignItems: "center",
|
|
695
|
-
justifyContent: "center"
|
|
652
|
+
border: "none"
|
|
696
653
|
},
|
|
697
654
|
[scope("endpoint-text")]: {
|
|
698
655
|
flex: 1,
|
|
699
656
|
maxWidth: "100%",
|
|
700
|
-
minWidth: 0,
|
|
701
|
-
overflow: "hidden",
|
|
702
657
|
display: "block"
|
|
703
658
|
},
|
|
704
659
|
[scope("tag-title")]: {
|
|
@@ -712,29 +667,27 @@ const getSidebarStyles = (token, scope) => ({
|
|
|
712
667
|
color: token.colorText,
|
|
713
668
|
maxWidth: "100%",
|
|
714
669
|
display: "block",
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
670
|
+
padding: 0,
|
|
671
|
+
margin: 0,
|
|
672
|
+
"&.highlighted": { color: token.colorPrimary }
|
|
718
673
|
}
|
|
719
674
|
});
|
|
720
675
|
//#endregion
|
|
721
676
|
//#region src/view/helper/sidebar.components.tsx
|
|
722
|
-
const { Text: Text$
|
|
723
|
-
const EndpointItem = ({ method, title, cx, isSelected = false }) => {
|
|
724
|
-
const methodStyle = (isSelected ? darkerMethodColors :
|
|
725
|
-
const isPost = method?.toUpperCase() === "POST";
|
|
677
|
+
const { Text: Text$2 } = Typography;
|
|
678
|
+
const EndpointItem$1 = ({ method, title, cx, isSelected = false }) => {
|
|
679
|
+
const methodStyle = (isSelected ? darkerMethodColors$1 : methodColors$1)[method];
|
|
726
680
|
return /* @__PURE__ */ jsxs("div", {
|
|
727
|
-
className:
|
|
681
|
+
className: cx("endpoint-item"),
|
|
728
682
|
children: [/* @__PURE__ */ jsx(Tag, {
|
|
729
683
|
className: cx("method-tag"),
|
|
730
684
|
style: {
|
|
731
685
|
backgroundColor: methodStyle?.bg,
|
|
732
686
|
color: methodStyle?.color,
|
|
733
|
-
border: "none"
|
|
734
|
-
...isPost ? { borderRadius: 4 } : {}
|
|
687
|
+
border: "none"
|
|
735
688
|
},
|
|
736
689
|
children: method
|
|
737
|
-
}), /* @__PURE__ */ jsx(Text$
|
|
690
|
+
}), /* @__PURE__ */ jsx(Text$2, {
|
|
738
691
|
className: cx("endpoint-text"),
|
|
739
692
|
ellipsis: { tooltip: title },
|
|
740
693
|
style: { flex: 1 },
|
|
@@ -742,23 +695,25 @@ const EndpointItem = ({ method, title, cx, isSelected = false }) => {
|
|
|
742
695
|
})]
|
|
743
696
|
});
|
|
744
697
|
};
|
|
745
|
-
const convertToRenderableTreeData = (treeDataStructure, selectedEndpoint, cx) => {
|
|
698
|
+
const convertToRenderableTreeData$1 = (treeDataStructure, selectedEndpoint, cx) => {
|
|
746
699
|
const renderNode = (node) => {
|
|
747
700
|
let title;
|
|
748
701
|
if (node.isLeaf && node.method) {
|
|
749
702
|
const isSelected = selectedEndpoint && "data" in node && node.data && "endpoint" in node.data ? node.data.endpoint?.id === selectedEndpoint?.id : false;
|
|
750
|
-
title = /* @__PURE__ */ jsx(EndpointItem, {
|
|
703
|
+
title = /* @__PURE__ */ jsx(EndpointItem$1, {
|
|
751
704
|
method: node.method,
|
|
752
705
|
title: typeof node.title === "string" ? node.title : "Endpoint Name",
|
|
753
706
|
cx,
|
|
754
707
|
isSelected
|
|
755
708
|
});
|
|
756
|
-
} else if (node.data && "id" in node.data && "tags" in node.data && !("endpoint" in node.data) && !("tagName" in node.data))
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
709
|
+
} else if (node.data && "id" in node.data && "tags" in node.data && !("endpoint" in node.data) && !("tagName" in node.data)) {
|
|
710
|
+
const isHighlighted = isApiSectionHighlighted(node.key, selectedEndpoint);
|
|
711
|
+
title = /* @__PURE__ */ jsx(Text$2, {
|
|
712
|
+
className: cx("api-title") + (isHighlighted ? " highlighted" : ""),
|
|
713
|
+
ellipsis: { tooltip: typeof node.title === "string" ? node.title : "API Name" },
|
|
714
|
+
children: node.title
|
|
715
|
+
});
|
|
716
|
+
} else title = /* @__PURE__ */ jsx(Text$2, {
|
|
762
717
|
className: cx("tag-title"),
|
|
763
718
|
ellipsis: { tooltip: typeof node.title === "string" ? node.title : "" },
|
|
764
719
|
children: node.title
|
|
@@ -1062,17 +1017,15 @@ const NoDataIcon = ({ width = 298, height = 237, fill = "#F1F5FD", stroke = "#E0
|
|
|
1062
1017
|
};
|
|
1063
1018
|
//#endregion
|
|
1064
1019
|
//#region src/view/components/Sidebar.tsx
|
|
1065
|
-
const {
|
|
1066
|
-
const Sidebar = ({ searchValue, setSearchValue, onNodeSelect }) => {
|
|
1020
|
+
const Sidebar$1 = ({ searchValue, setSearchValue }) => {
|
|
1067
1021
|
const expandedKeys = useStore((state) => state.view.expandedKeys);
|
|
1068
1022
|
const { selectedNodeKey, selectedEndpoint, builtTreeData, setExpandedKeys, setSelectedNodeKey } = useStore(({ view }) => view);
|
|
1069
1023
|
const { selectNodeByKey, clearSelection } = useNodeSelection();
|
|
1070
1024
|
const [autoExpandParent, setAutoExpandParent] = useState(true);
|
|
1071
|
-
const
|
|
1072
|
-
const { wrapSSR, cx, token } = useStyle("Sidebar", getSidebarStyles);
|
|
1025
|
+
const { wrapSSR, cx, token } = useStyle("Sidebar", getSidebarStyles$1);
|
|
1073
1026
|
const handleSearch = (value) => {
|
|
1074
1027
|
if (value && builtTreeData) {
|
|
1075
|
-
setExpandedKeys(getAllTreeKeys(builtTreeData));
|
|
1028
|
+
setExpandedKeys(getAllTreeKeys$1(builtTreeData));
|
|
1076
1029
|
setSearchValue(value);
|
|
1077
1030
|
setAutoExpandParent(true);
|
|
1078
1031
|
} else {
|
|
@@ -1083,7 +1036,7 @@ const Sidebar = ({ searchValue, setSearchValue, onNodeSelect }) => {
|
|
|
1083
1036
|
};
|
|
1084
1037
|
const renderTreeData = useMemo(() => {
|
|
1085
1038
|
if (!builtTreeData) return [];
|
|
1086
|
-
return convertToRenderableTreeData(builtTreeData, selectedEndpoint, cx);
|
|
1039
|
+
return convertToRenderableTreeData$1(builtTreeData, selectedEndpoint, cx);
|
|
1087
1040
|
}, [
|
|
1088
1041
|
builtTreeData,
|
|
1089
1042
|
selectedEndpoint,
|
|
@@ -1092,7 +1045,7 @@ const Sidebar = ({ searchValue, setSearchValue, onNodeSelect }) => {
|
|
|
1092
1045
|
const filteredTreeData = useMemo(() => {
|
|
1093
1046
|
if (!searchValue) return renderTreeData;
|
|
1094
1047
|
if (!builtTreeData) return [];
|
|
1095
|
-
return convertToRenderableTreeData(filterTreeData(builtTreeData, searchValue), selectedEndpoint, cx);
|
|
1048
|
+
return convertToRenderableTreeData$1(filterTreeData$1(builtTreeData, searchValue), selectedEndpoint, cx);
|
|
1096
1049
|
}, [
|
|
1097
1050
|
builtTreeData,
|
|
1098
1051
|
searchValue,
|
|
@@ -1113,96 +1066,9 @@ const Sidebar = ({ searchValue, setSearchValue, onNodeSelect }) => {
|
|
|
1113
1066
|
selectNodeByKey(selectedKey);
|
|
1114
1067
|
setSelectedNodeKey(selectedKey);
|
|
1115
1068
|
};
|
|
1116
|
-
const inner = /* @__PURE__ */ jsxs("div", {
|
|
1117
|
-
className: cx("content"),
|
|
1118
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
1119
|
-
className: cx("controls"),
|
|
1120
|
-
children: [/* @__PURE__ */ jsx(Tooltip, {
|
|
1121
|
-
title: "Search by APIs or Endpoints",
|
|
1122
|
-
placement: "bottom",
|
|
1123
|
-
children: /* @__PURE__ */ jsx(Input, {
|
|
1124
|
-
placeholder: "Search by APIs or Endpoints",
|
|
1125
|
-
value: searchValue,
|
|
1126
|
-
onChange: (e) => handleSearch(e.target.value),
|
|
1127
|
-
allowClear: true,
|
|
1128
|
-
className: cx("search-input"),
|
|
1129
|
-
addonAfter: /* @__PURE__ */ jsx(SearchOutlined, {})
|
|
1130
|
-
})
|
|
1131
|
-
}), /* @__PURE__ */ jsx(Tooltip, {
|
|
1132
|
-
title: "Collapse All",
|
|
1133
|
-
placement: "bottom",
|
|
1134
|
-
children: /* @__PURE__ */ jsx(Button, {
|
|
1135
|
-
onClick: collapseAll,
|
|
1136
|
-
title: "Collapse All",
|
|
1137
|
-
icon: /* @__PURE__ */ jsx(Minify, {})
|
|
1138
|
-
})
|
|
1139
|
-
})]
|
|
1140
|
-
}), filteredTreeData?.length ? /* @__PURE__ */ jsx(Tree, {
|
|
1141
|
-
showLine: { showLeafIcon: false },
|
|
1142
|
-
showIcon: false,
|
|
1143
|
-
switcherIcon: (nodeProps) => nodeProps.isLeaf ? null : nodeProps.expanded ? /* @__PURE__ */ jsx(MinusSquareOutlined, { style: { fontSize: 12 } }) : /* @__PURE__ */ jsx(PlusSquareOutlined, { style: { fontSize: 12 } }),
|
|
1144
|
-
expandedKeys,
|
|
1145
|
-
autoExpandParent,
|
|
1146
|
-
selectedKeys: [selectedNodeKey || ""],
|
|
1147
|
-
onSelect: (selectedKeys) => {
|
|
1148
|
-
if (!selectedKeys?.length) return;
|
|
1149
|
-
onTreeNodeSelect(selectedKeys);
|
|
1150
|
-
setSelectedNodeKey(selectedKeys[0]);
|
|
1151
|
-
onNodeSelect?.();
|
|
1152
|
-
},
|
|
1153
|
-
onExpand: (expandedKeysValue) => {
|
|
1154
|
-
setExpandedKeys(expandedKeysValue);
|
|
1155
|
-
setAutoExpandParent(false);
|
|
1156
|
-
},
|
|
1157
|
-
treeData: filteredTreeData,
|
|
1158
|
-
className: cx("tree")
|
|
1159
|
-
}) : /* @__PURE__ */ jsxs(Flex, {
|
|
1160
|
-
justify: "center",
|
|
1161
|
-
align: "center",
|
|
1162
|
-
gap: token.marginSM,
|
|
1163
|
-
vertical: true,
|
|
1164
|
-
style: { marginTop: token.paddingXL },
|
|
1165
|
-
children: [/* @__PURE__ */ jsx(NoDataIcon, {
|
|
1166
|
-
stroke: token.colorPrimaryHover,
|
|
1167
|
-
fill: token.colorPrimaryBg,
|
|
1168
|
-
width: "10.375rem",
|
|
1169
|
-
height: "8.1875rem"
|
|
1170
|
-
}), searchValue.length ? /* @__PURE__ */ jsx(Text, {
|
|
1171
|
-
style: {
|
|
1172
|
-
textAlign: "center",
|
|
1173
|
-
fontFamily: token.fontFamily,
|
|
1174
|
-
fontWeight: 400,
|
|
1175
|
-
fontSize: token.fontSizeLG,
|
|
1176
|
-
color: token.colorTextTertiary
|
|
1177
|
-
},
|
|
1178
|
-
children: "No results found"
|
|
1179
|
-
}) : /* @__PURE__ */ jsxs(Text, {
|
|
1180
|
-
style: {
|
|
1181
|
-
textAlign: "center",
|
|
1182
|
-
fontFamily: token.fontFamily,
|
|
1183
|
-
fontWeight: 400,
|
|
1184
|
-
fontSize: token.fontSizeLG,
|
|
1185
|
-
color: token.colorTextTertiary
|
|
1186
|
-
},
|
|
1187
|
-
children: [
|
|
1188
|
-
"No API",
|
|
1189
|
-
/* @__PURE__ */ jsx("br", {}),
|
|
1190
|
-
"Documentation Found"
|
|
1191
|
-
]
|
|
1192
|
-
})]
|
|
1193
|
-
})]
|
|
1194
|
-
});
|
|
1195
|
-
if (isMobile) return wrapSSR(/* @__PURE__ */ jsx("aside", {
|
|
1196
|
-
className: cx("sider"),
|
|
1197
|
-
style: {
|
|
1198
|
-
width: "100%",
|
|
1199
|
-
height: "100%"
|
|
1200
|
-
},
|
|
1201
|
-
children: inner
|
|
1202
|
-
}));
|
|
1203
1069
|
return wrapSSR(/* @__PURE__ */ jsx(Resizable, {
|
|
1204
1070
|
as: "aside",
|
|
1205
|
-
minWidth:
|
|
1071
|
+
minWidth: 300,
|
|
1206
1072
|
maxWidth: 386,
|
|
1207
1073
|
enable: {
|
|
1208
1074
|
top: false,
|
|
@@ -1215,15 +1081,91 @@ const Sidebar = ({ searchValue, setSearchValue, onNodeSelect }) => {
|
|
|
1215
1081
|
topLeft: false
|
|
1216
1082
|
},
|
|
1217
1083
|
defaultSize: {
|
|
1218
|
-
width:
|
|
1219
|
-
height: "
|
|
1084
|
+
width: 333,
|
|
1085
|
+
height: "100%"
|
|
1220
1086
|
},
|
|
1221
1087
|
className: cx("sider"),
|
|
1222
|
-
children:
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1088
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
1089
|
+
className: cx("content"),
|
|
1090
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
1091
|
+
className: cx("controls"),
|
|
1092
|
+
children: [/* @__PURE__ */ jsx(Tooltip, {
|
|
1093
|
+
title: "Search by APIs or Endpoints",
|
|
1094
|
+
placement: "bottom",
|
|
1095
|
+
children: /* @__PURE__ */ jsx(Input, {
|
|
1096
|
+
placeholder: "Search by APIs or Endpoints",
|
|
1097
|
+
value: searchValue,
|
|
1098
|
+
onChange: (e) => handleSearch(e.target.value),
|
|
1099
|
+
allowClear: true,
|
|
1100
|
+
className: cx("search-input"),
|
|
1101
|
+
addonAfter: /* @__PURE__ */ jsx(SearchOutlined, {})
|
|
1102
|
+
})
|
|
1103
|
+
}), /* @__PURE__ */ jsx(Tooltip, {
|
|
1104
|
+
title: "Collapse All",
|
|
1105
|
+
placement: "bottom",
|
|
1106
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
1107
|
+
onClick: collapseAll,
|
|
1108
|
+
title: "Collapse All",
|
|
1109
|
+
icon: /* @__PURE__ */ jsx(Minify, {})
|
|
1110
|
+
})
|
|
1111
|
+
})]
|
|
1112
|
+
}), filteredTreeData?.length ? /* @__PURE__ */ jsx(Tree, {
|
|
1113
|
+
showLine: { showLeafIcon: false },
|
|
1114
|
+
showIcon: false,
|
|
1115
|
+
expandedKeys,
|
|
1116
|
+
autoExpandParent,
|
|
1117
|
+
selectedKeys: [selectedNodeKey || ""],
|
|
1118
|
+
onSelect: (selectedKeys) => {
|
|
1119
|
+
if (!selectedKeys?.length) return;
|
|
1120
|
+
onTreeNodeSelect(selectedKeys);
|
|
1121
|
+
setSelectedNodeKey(selectedKeys[0]);
|
|
1122
|
+
},
|
|
1123
|
+
onExpand: (expandedKeysValue) => {
|
|
1124
|
+
setExpandedKeys(expandedKeysValue);
|
|
1125
|
+
setAutoExpandParent(false);
|
|
1126
|
+
},
|
|
1127
|
+
treeData: filteredTreeData,
|
|
1128
|
+
className: cx("tree")
|
|
1129
|
+
}) : /* @__PURE__ */ jsxs(Flex, {
|
|
1130
|
+
justify: "center",
|
|
1131
|
+
align: "center",
|
|
1132
|
+
gap: token.marginSM,
|
|
1133
|
+
vertical: true,
|
|
1134
|
+
style: { marginTop: token.paddingXL },
|
|
1135
|
+
children: [/* @__PURE__ */ jsx(NoDataIcon, {
|
|
1136
|
+
stroke: token.colorPrimaryHover,
|
|
1137
|
+
fill: token.colorPrimaryBg,
|
|
1138
|
+
width: "10.375rem",
|
|
1139
|
+
height: "8.1875rem"
|
|
1140
|
+
}), searchValue.length ? /* @__PURE__ */ jsx(Text, {
|
|
1141
|
+
style: {
|
|
1142
|
+
textAlign: "center",
|
|
1143
|
+
fontFamily: token.fontFamily,
|
|
1144
|
+
fontWeight: 400,
|
|
1145
|
+
fontSize: token.fontSizeLG,
|
|
1146
|
+
color: "rgba(0,0,0,0.45)"
|
|
1147
|
+
},
|
|
1148
|
+
children: "No results found"
|
|
1149
|
+
}) : /* @__PURE__ */ jsxs(Text, {
|
|
1150
|
+
style: {
|
|
1151
|
+
textAlign: "center",
|
|
1152
|
+
fontFamily: token.fontFamily,
|
|
1153
|
+
fontWeight: 400,
|
|
1154
|
+
fontSize: token.fontSizeLG,
|
|
1155
|
+
color: "rgba(0,0,0,0.45)"
|
|
1156
|
+
},
|
|
1157
|
+
children: [
|
|
1158
|
+
"No API",
|
|
1159
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
1160
|
+
"Documentation Found"
|
|
1161
|
+
]
|
|
1162
|
+
})]
|
|
1163
|
+
})]
|
|
1164
|
+
})
|
|
1165
|
+
}));
|
|
1166
|
+
};
|
|
1167
|
+
//#endregion
|
|
1168
|
+
//#region src/assets/link.tsx
|
|
1227
1169
|
const Link = (props) => /* @__PURE__ */ jsxs("svg", {
|
|
1228
1170
|
width: "12",
|
|
1229
1171
|
height: "12",
|
|
@@ -1373,7 +1315,7 @@ const ApiCard = ({ api, viewStyle }) => {
|
|
|
1373
1315
|
});
|
|
1374
1316
|
};
|
|
1375
1317
|
const MethodChip = ({ method }) => {
|
|
1376
|
-
const methodStyle = methodColors[method];
|
|
1318
|
+
const methodStyle = methodColors$1[method];
|
|
1377
1319
|
return /* @__PURE__ */ jsx("div", {
|
|
1378
1320
|
className: cx("method-chip"),
|
|
1379
1321
|
style: {
|
|
@@ -1760,8 +1702,8 @@ const handleStatusColor = (code) => {
|
|
|
1760
1702
|
};
|
|
1761
1703
|
//#endregion
|
|
1762
1704
|
//#region src/view/components/EndpointPage/EndpointPage.tsx
|
|
1763
|
-
const { Title: Title$
|
|
1764
|
-
const requestColumns = [
|
|
1705
|
+
const { Title: Title$3, Paragraph: Paragraph$1 } = Typography;
|
|
1706
|
+
const requestColumns$1 = [
|
|
1765
1707
|
{
|
|
1766
1708
|
title: "Parameter",
|
|
1767
1709
|
dataIndex: "param",
|
|
@@ -1778,8 +1720,8 @@ const requestColumns = [
|
|
|
1778
1720
|
key: "enum"
|
|
1779
1721
|
}
|
|
1780
1722
|
];
|
|
1781
|
-
const responseColumns = [...requestColumns];
|
|
1782
|
-
const buildRequestData = (params
|
|
1723
|
+
const responseColumns$1 = [...requestColumns$1];
|
|
1724
|
+
const buildRequestData$1 = (params) => [...params].sort((a, b) => a.required === b.required ? 0 : a.required ? -1 : 1).map((p, index) => {
|
|
1783
1725
|
let typeLabel = p.schema?.type;
|
|
1784
1726
|
if (p.schema?.type === "array" && p.schema?.items?.type) typeLabel = `${p.schema.type}_${p.schema.items.type}`;
|
|
1785
1727
|
return {
|
|
@@ -1788,17 +1730,17 @@ const buildRequestData = (params, token) => [...params].sort((a, b) => a.require
|
|
|
1788
1730
|
p.name,
|
|
1789
1731
|
typeLabel && /* @__PURE__ */ jsx("span", {
|
|
1790
1732
|
style: {
|
|
1791
|
-
color:
|
|
1733
|
+
color: "rgba(0,0,0,0.45)",
|
|
1792
1734
|
marginLeft: "0.25rem",
|
|
1793
1735
|
marginRight: "0.25rem"
|
|
1794
1736
|
},
|
|
1795
1737
|
children: typeLabel
|
|
1796
1738
|
}),
|
|
1797
1739
|
p.required ? /* @__PURE__ */ jsx("span", {
|
|
1798
|
-
style: { color:
|
|
1740
|
+
style: { color: "red" },
|
|
1799
1741
|
children: "*"
|
|
1800
1742
|
}) : /* @__PURE__ */ jsx("span", {
|
|
1801
|
-
style: { color:
|
|
1743
|
+
style: { color: "#52C41A" },
|
|
1802
1744
|
children: "Optional"
|
|
1803
1745
|
})
|
|
1804
1746
|
] }),
|
|
@@ -1806,7 +1748,7 @@ const buildRequestData = (params, token) => [...params].sort((a, b) => a.require
|
|
|
1806
1748
|
enum: p.schema?.enum ? p.schema.enum.map((e) => /* @__PURE__ */ jsx(Tag, { children: e }, e)) : "--"
|
|
1807
1749
|
};
|
|
1808
1750
|
});
|
|
1809
|
-
const buildHeaderData = (headers
|
|
1751
|
+
const buildHeaderData$1 = (headers) => {
|
|
1810
1752
|
if (!headers) return [];
|
|
1811
1753
|
return Object.entries(headers).sort(([, a], [, b]) => a.required === b.required ? 0 : a.required ? -1 : 1).map(([name, header], idx) => {
|
|
1812
1754
|
let typeLabel = header.schema?.type;
|
|
@@ -1817,17 +1759,17 @@ const buildHeaderData = (headers, token) => {
|
|
|
1817
1759
|
name,
|
|
1818
1760
|
typeLabel && /* @__PURE__ */ jsx("span", {
|
|
1819
1761
|
style: {
|
|
1820
|
-
color:
|
|
1762
|
+
color: "rgba(0,0,0,0.45)",
|
|
1821
1763
|
marginLeft: "0.25rem",
|
|
1822
1764
|
marginRight: "0.25rem"
|
|
1823
1765
|
},
|
|
1824
1766
|
children: typeLabel
|
|
1825
1767
|
}),
|
|
1826
1768
|
header.required ? /* @__PURE__ */ jsx("span", {
|
|
1827
|
-
style: { color:
|
|
1769
|
+
style: { color: "red" },
|
|
1828
1770
|
children: "*"
|
|
1829
1771
|
}) : /* @__PURE__ */ jsx("span", {
|
|
1830
|
-
style: { color:
|
|
1772
|
+
style: { color: "#52C41A" },
|
|
1831
1773
|
children: "Optional"
|
|
1832
1774
|
})
|
|
1833
1775
|
] }, idx),
|
|
@@ -1836,41 +1778,10 @@ const buildHeaderData = (headers, token) => {
|
|
|
1836
1778
|
};
|
|
1837
1779
|
});
|
|
1838
1780
|
};
|
|
1839
|
-
const
|
|
1840
|
-
|
|
1841
|
-
const
|
|
1842
|
-
const
|
|
1843
|
-
if (!schema) return [];
|
|
1844
|
-
const properties = schema.properties ?? {};
|
|
1845
|
-
const required = schema.required ?? [];
|
|
1846
|
-
return Object.entries(properties).map(([name, prop], idx) => ({
|
|
1847
|
-
key: idx,
|
|
1848
|
-
param: /* @__PURE__ */ jsxs("span", { children: [
|
|
1849
|
-
name,
|
|
1850
|
-
prop.type && /* @__PURE__ */ jsx("span", {
|
|
1851
|
-
style: {
|
|
1852
|
-
color: token.colorTextTertiary,
|
|
1853
|
-
marginLeft: "0.25rem",
|
|
1854
|
-
marginRight: "0.25rem"
|
|
1855
|
-
},
|
|
1856
|
-
children: prop.type
|
|
1857
|
-
}),
|
|
1858
|
-
required.includes(name) ? /* @__PURE__ */ jsx("span", {
|
|
1859
|
-
style: { color: token.colorError },
|
|
1860
|
-
children: "*"
|
|
1861
|
-
}) : /* @__PURE__ */ jsx("span", {
|
|
1862
|
-
style: { color: token.colorSuccess },
|
|
1863
|
-
children: "Optional"
|
|
1864
|
-
})
|
|
1865
|
-
] }),
|
|
1866
|
-
desc: prop.description || "--",
|
|
1867
|
-
enum: prop.enum ? prop.enum.map((e) => /* @__PURE__ */ jsx(Tag, { children: e }, e)) : "--"
|
|
1868
|
-
}));
|
|
1869
|
-
};
|
|
1870
|
-
const EndpointPage = () => {
|
|
1871
|
-
const { selectedEndpoint, selectedApi, selectedStatusCode, setSelectedNodeKey, setFocusedContent, setFocusedTag, setActiveRequestTab } = useStore(({ view }) => view);
|
|
1872
|
-
const [activeTabKey, setActiveTabKey] = useState("header");
|
|
1873
|
-
const { token } = theme.useToken();
|
|
1781
|
+
const EndpointPage$1 = () => {
|
|
1782
|
+
const { selectedEndpoint, selectedApi, selectedStatusCode, setSelectedNodeKey, setFocusedContent, setFocusedTag } = useStore(({ view }) => view);
|
|
1783
|
+
const [endpointTooltip, setEndpointTooltip] = useState("Copy endpoint");
|
|
1784
|
+
const [selectedServer, setSelectedServer] = useState(0);
|
|
1874
1785
|
const { cx } = useStyle("EndpointPage", (token, scope) => ({
|
|
1875
1786
|
[scope("docs-endpoint-container")]: {
|
|
1876
1787
|
display: "flex",
|
|
@@ -1896,88 +1807,62 @@ const EndpointPage = () => {
|
|
|
1896
1807
|
marginBottom: token.marginLG
|
|
1897
1808
|
},
|
|
1898
1809
|
[scope("request-card")]: {
|
|
1899
|
-
borderRadius: token.borderRadius,
|
|
1900
|
-
backgroundColor: token.colorBgBase,
|
|
1901
1810
|
".ant-card-head": {
|
|
1902
1811
|
minHeight: "unset",
|
|
1903
1812
|
borderBottom: "unset",
|
|
1904
|
-
padding: "0.75rem"
|
|
1905
|
-
backgroundColor: token.colorBgBase
|
|
1813
|
+
padding: "0.75rem"
|
|
1906
1814
|
},
|
|
1907
1815
|
".ant-card-body": {
|
|
1908
1816
|
padding: "0px 0.75rem 0.75rem 0.75rem",
|
|
1909
|
-
backgroundColor: token.colorBgBase,
|
|
1910
1817
|
".ant-tabs-tab": { paddingTop: "0" }
|
|
1911
|
-
}
|
|
1912
|
-
|
|
1913
|
-
"& .ant-table-thead > tr > th": { backgroundColor: `${token.colorBgBase} !important` },
|
|
1914
|
-
"& .ant-table-tbody > tr > td": { backgroundColor: `${token.colorBgBase} !important` }
|
|
1915
|
-
},
|
|
1916
|
-
[scope("row-odd")]: { "& > td": { background: `${token.colorBgElevated} !important` } },
|
|
1917
|
-
[scope("row-even")]: { "& > td": { background: `${token.colorBgLayout} !important` } }
|
|
1818
|
+
}
|
|
1819
|
+
}
|
|
1918
1820
|
}));
|
|
1919
|
-
const methodStyle =
|
|
1920
|
-
const headerParams = buildRequestData(selectedEndpoint?.parameters?.filter((p) => p.in === "header") || []
|
|
1921
|
-
const pathParams = buildRequestData(selectedEndpoint?.parameters?.filter((p) => p.in === "path") || []
|
|
1922
|
-
const queryParams = buildRequestData(selectedEndpoint?.parameters?.filter((p) => p.in === "query") || []
|
|
1923
|
-
const requestBodyData = buildRequestBodyData(selectedEndpoint?.requestBody, token);
|
|
1821
|
+
const methodStyle = methodColors$1[selectedEndpoint?.method];
|
|
1822
|
+
const headerParams = buildRequestData$1(selectedEndpoint?.parameters?.filter((p) => p.in === "header") || []);
|
|
1823
|
+
const pathParams = buildRequestData$1(selectedEndpoint?.parameters?.filter((p) => p.in === "path") || []);
|
|
1824
|
+
const queryParams = buildRequestData$1(selectedEndpoint?.parameters?.filter((p) => p.in === "query") || []);
|
|
1924
1825
|
const requestTabs = [
|
|
1925
1826
|
{
|
|
1926
1827
|
key: "header",
|
|
1927
1828
|
label: "Header",
|
|
1928
1829
|
children: /* @__PURE__ */ jsx(Table, {
|
|
1929
|
-
columns: requestColumns,
|
|
1830
|
+
columns: requestColumns$1,
|
|
1930
1831
|
dataSource: headerParams,
|
|
1931
1832
|
pagination: false,
|
|
1932
1833
|
bordered: true,
|
|
1933
|
-
size: "small"
|
|
1934
|
-
rowClassName: (_, idx) => cx(idx % 2 === 0 ? "row-even" : "row-odd")
|
|
1834
|
+
size: "small"
|
|
1935
1835
|
})
|
|
1936
1836
|
},
|
|
1937
1837
|
{
|
|
1938
1838
|
key: "path",
|
|
1939
1839
|
label: "Path",
|
|
1940
1840
|
children: /* @__PURE__ */ jsx(Table, {
|
|
1941
|
-
columns: requestColumns,
|
|
1841
|
+
columns: requestColumns$1,
|
|
1942
1842
|
dataSource: pathParams,
|
|
1943
1843
|
pagination: false,
|
|
1944
1844
|
bordered: true,
|
|
1945
|
-
size: "small"
|
|
1946
|
-
rowClassName: (_, idx) => cx(idx % 2 === 0 ? "row-even" : "row-odd")
|
|
1845
|
+
size: "small"
|
|
1947
1846
|
})
|
|
1948
1847
|
},
|
|
1949
1848
|
{
|
|
1950
1849
|
key: "query",
|
|
1951
1850
|
label: "Query",
|
|
1952
1851
|
children: /* @__PURE__ */ jsx(Table, {
|
|
1953
|
-
columns: requestColumns,
|
|
1852
|
+
columns: requestColumns$1,
|
|
1954
1853
|
dataSource: queryParams,
|
|
1955
1854
|
pagination: false,
|
|
1956
1855
|
bordered: true,
|
|
1957
|
-
size: "small"
|
|
1958
|
-
rowClassName: (_, idx) => cx(idx % 2 === 0 ? "row-even" : "row-odd")
|
|
1959
|
-
})
|
|
1960
|
-
},
|
|
1961
|
-
...requestBodyData.length > 0 ? [{
|
|
1962
|
-
key: "requestBody",
|
|
1963
|
-
label: "Request Body",
|
|
1964
|
-
children: /* @__PURE__ */ jsx(Table, {
|
|
1965
|
-
columns: requestColumns,
|
|
1966
|
-
dataSource: requestBodyData,
|
|
1967
|
-
pagination: false,
|
|
1968
|
-
bordered: true,
|
|
1969
|
-
size: "small",
|
|
1970
|
-
rowClassName: (_, idx) => cx(idx % 2 === 0 ? "row-even" : "row-odd")
|
|
1856
|
+
size: "small"
|
|
1971
1857
|
})
|
|
1972
|
-
}
|
|
1858
|
+
}
|
|
1973
1859
|
].filter((t) => t !== null);
|
|
1974
|
-
useEffect(() => {
|
|
1975
|
-
const firstKey = requestTabs[0]?.key ?? "header";
|
|
1976
|
-
setActiveTabKey(firstKey);
|
|
1977
|
-
setActiveRequestTab(firstKey);
|
|
1978
|
-
}, [selectedEndpoint?.id]);
|
|
1979
1860
|
const responseHeaders = (selectedEndpoint?.responses?.[selectedStatusCode || 200])?.headers;
|
|
1980
|
-
const responseHeaderData = buildHeaderData(responseHeaders
|
|
1861
|
+
const responseHeaderData = buildHeaderData$1(responseHeaders);
|
|
1862
|
+
selectedApi?.servers?.map((server, index) => ({
|
|
1863
|
+
value: index,
|
|
1864
|
+
label: `${server.url}${selectedEndpoint?.path || ""}`
|
|
1865
|
+
}));
|
|
1981
1866
|
return /* @__PURE__ */ jsx("div", {
|
|
1982
1867
|
className: cx("docs-endpoint-container"),
|
|
1983
1868
|
children: /* @__PURE__ */ jsxs("div", {
|
|
@@ -2017,61 +1902,42 @@ const EndpointPage = () => {
|
|
|
2017
1902
|
display: "flex",
|
|
2018
1903
|
flexDirection: "row",
|
|
2019
1904
|
alignItems: "center",
|
|
2020
|
-
color:
|
|
1905
|
+
color: "rgba(0,0,0,0.45)",
|
|
2021
1906
|
gap: "0.25rem"
|
|
2022
1907
|
},
|
|
2023
1908
|
children: /* @__PURE__ */ jsx("span", { children: selectedEndpoint?.tagName || "default" })
|
|
2024
1909
|
})
|
|
2025
1910
|
},
|
|
2026
|
-
{ title: /* @__PURE__ */ jsx(
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
whiteSpace: "nowrap",
|
|
2033
|
-
display: "block",
|
|
2034
|
-
maxWidth: "300px"
|
|
2035
|
-
},
|
|
2036
|
-
children: selectedEndpoint?.summary || "Endpoint Name"
|
|
2037
|
-
})
|
|
1911
|
+
{ title: /* @__PURE__ */ jsx("span", {
|
|
1912
|
+
style: {
|
|
1913
|
+
display: "flex",
|
|
1914
|
+
gap: "1rem"
|
|
1915
|
+
},
|
|
1916
|
+
children: selectedEndpoint?.summary || "Endpoint Name"
|
|
2038
1917
|
}) }
|
|
2039
1918
|
] })]
|
|
2040
1919
|
}),
|
|
2041
|
-
/* @__PURE__ */ jsxs(Title$
|
|
1920
|
+
/* @__PURE__ */ jsxs(Title$3, {
|
|
2042
1921
|
level: 3,
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
alignItems: "center",
|
|
2046
|
-
gap: 12,
|
|
2047
|
-
margin: 0
|
|
2048
|
-
},
|
|
2049
|
-
children: [/* @__PURE__ */ jsx(Tag, {
|
|
2050
|
-
style: {
|
|
2051
|
-
backgroundColor: methodStyle?.bg,
|
|
2052
|
-
color: methodStyle?.color,
|
|
2053
|
-
border: "none",
|
|
2054
|
-
width: "4.375rem",
|
|
2055
|
-
height: "1.375rem",
|
|
2056
|
-
textAlign: "center",
|
|
2057
|
-
flexShrink: 0
|
|
2058
|
-
},
|
|
2059
|
-
children: selectedEndpoint?.method
|
|
2060
|
-
}), /* @__PURE__ */ jsx(Tooltip, {
|
|
2061
|
-
title: selectedEndpoint?.summary ?? "--",
|
|
2062
|
-
children: /* @__PURE__ */ jsx("span", {
|
|
1922
|
+
children: [
|
|
1923
|
+
/* @__PURE__ */ jsx(Tag, {
|
|
2063
1924
|
style: {
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
1925
|
+
backgroundColor: methodStyle?.bg,
|
|
1926
|
+
color: methodStyle?.color,
|
|
1927
|
+
border: "none",
|
|
1928
|
+
width: "4.375rem",
|
|
1929
|
+
height: "1.375rem",
|
|
1930
|
+
textAlign: "center"
|
|
2067
1931
|
},
|
|
2068
|
-
children: selectedEndpoint?.
|
|
2069
|
-
})
|
|
2070
|
-
|
|
1932
|
+
children: selectedEndpoint?.method
|
|
1933
|
+
}),
|
|
1934
|
+
" ",
|
|
1935
|
+
selectedEndpoint?.summary?.replace(selectedEndpoint?.method, "") ?? "--"
|
|
1936
|
+
]
|
|
2071
1937
|
}),
|
|
2072
|
-
/* @__PURE__ */ jsx(Paragraph, {
|
|
1938
|
+
/* @__PURE__ */ jsx(Paragraph$1, {
|
|
2073
1939
|
style: {
|
|
2074
|
-
color:
|
|
1940
|
+
color: "rgba(0,0,0,0.45)",
|
|
2075
1941
|
marginBottom: "1.5rem"
|
|
2076
1942
|
},
|
|
2077
1943
|
children: selectedEndpoint?.description ?? "--"
|
|
@@ -2079,17 +1945,9 @@ const EndpointPage = () => {
|
|
|
2079
1945
|
requestTabs.length > 0 && /* @__PURE__ */ jsx(Card, {
|
|
2080
1946
|
title: "Request",
|
|
2081
1947
|
className: cx("request-card"),
|
|
2082
|
-
style: {
|
|
2083
|
-
marginBottom: "1.5rem",
|
|
2084
|
-
backgroundColor: token.colorBgBase
|
|
2085
|
-
},
|
|
2086
|
-
styles: { body: { backgroundColor: token.colorBgBase } },
|
|
1948
|
+
style: { marginBottom: "1.5rem" },
|
|
2087
1949
|
children: /* @__PURE__ */ jsx(Tabs, {
|
|
2088
|
-
|
|
2089
|
-
onChange: (key) => {
|
|
2090
|
-
setActiveTabKey(key);
|
|
2091
|
-
setActiveRequestTab(key);
|
|
2092
|
-
},
|
|
1950
|
+
defaultActiveKey: requestTabs[0].key,
|
|
2093
1951
|
items: requestTabs
|
|
2094
1952
|
})
|
|
2095
1953
|
}),
|
|
@@ -2105,12 +1963,11 @@ const EndpointPage = () => {
|
|
|
2105
1963
|
marginRight: "0.5rem"
|
|
2106
1964
|
} }), /* @__PURE__ */ jsx("span", { children: selectedStatusCode })] }),
|
|
2107
1965
|
children: /* @__PURE__ */ jsx(Table, {
|
|
2108
|
-
columns: responseColumns,
|
|
1966
|
+
columns: responseColumns$1,
|
|
2109
1967
|
dataSource: responseHeaderData,
|
|
2110
1968
|
pagination: false,
|
|
2111
1969
|
bordered: true,
|
|
2112
|
-
size: "small"
|
|
2113
|
-
rowClassName: (_, idx) => cx(idx % 2 === 0 ? "row-even" : "row-odd")
|
|
1970
|
+
size: "small"
|
|
2114
1971
|
})
|
|
2115
1972
|
})
|
|
2116
1973
|
]
|
|
@@ -2142,16 +1999,17 @@ const MouseSquare = (props) => /* @__PURE__ */ jsxs("svg", {
|
|
|
2142
1999
|
});
|
|
2143
2000
|
//#endregion
|
|
2144
2001
|
//#region src/view/components/MainContent.tsx
|
|
2145
|
-
const MainContent = ({ searchEnabled, handleResetSearch, handleVisitLandingPage }) => {
|
|
2002
|
+
const MainContent$1 = ({ searchEnabled, handleResetSearch, handleVisitLandingPage }) => {
|
|
2146
2003
|
const { focusedContent, transformedData } = useStore(({ view }) => view);
|
|
2147
2004
|
const { wrapSSR, cx, token } = useStyle("MainContent", (token, scope) => ({
|
|
2148
2005
|
[scope("inner-doc-container")]: {
|
|
2006
|
+
backgroundColor: token.colorBgContainer,
|
|
2007
|
+
height: "100%",
|
|
2149
2008
|
width: "100%",
|
|
2150
|
-
|
|
2009
|
+
maxHeight: "100%",
|
|
2010
|
+
overflow: "auto",
|
|
2151
2011
|
borderRadius: token.borderRadius,
|
|
2152
|
-
padding: token.paddingXL
|
|
2153
|
-
overflow: "hidden",
|
|
2154
|
-
minWidth: 0
|
|
2012
|
+
padding: token.paddingXL
|
|
2155
2013
|
},
|
|
2156
2014
|
[scope("centered")]: {
|
|
2157
2015
|
display: "flex",
|
|
@@ -2165,10 +2023,10 @@ const MainContent = ({ searchEnabled, handleResetSearch, handleVisitLandingPage
|
|
|
2165
2023
|
fontFamily: token.fontFamily,
|
|
2166
2024
|
fontWeight: 600,
|
|
2167
2025
|
fontSize: token.fontSizeHeading4,
|
|
2168
|
-
color:
|
|
2026
|
+
color: "rgba(0, 0, 0, 0.88)"
|
|
2169
2027
|
},
|
|
2170
2028
|
[scope("text")]: {
|
|
2171
|
-
color:
|
|
2029
|
+
color: "rgba(0, 0, 0, 0.88)",
|
|
2172
2030
|
fontFamily: token.fontFamily
|
|
2173
2031
|
},
|
|
2174
2032
|
[scope("visit-landing-button")]: {
|
|
@@ -2186,7 +2044,6 @@ const MainContent = ({ searchEnabled, handleResetSearch, handleVisitLandingPage
|
|
|
2186
2044
|
}));
|
|
2187
2045
|
return wrapSSR(/* @__PURE__ */ jsx("div", {
|
|
2188
2046
|
className: cx("inner-doc-container", !transformedData?.length ? "centered" : ""),
|
|
2189
|
-
style: { backgroundColor: focusedContent === "ENDPOINT" ? token.colorBgBase : token.colorBgElevated },
|
|
2190
2047
|
children: !transformedData?.length ? /* @__PURE__ */ jsxs(Flex, {
|
|
2191
2048
|
justify: "center",
|
|
2192
2049
|
align: "center",
|
|
@@ -2228,15 +2085,15 @@ const MainContent = ({ searchEnabled, handleResetSearch, handleVisitLandingPage
|
|
|
2228
2085
|
children: "Reset Search"
|
|
2229
2086
|
})
|
|
2230
2087
|
]
|
|
2231
|
-
}) : focusedContent === "ENDPOINT" ? /* @__PURE__ */ jsx(EndpointPage, {}) : /* @__PURE__ */ jsx(APIPage, {})
|
|
2088
|
+
}) : focusedContent === "ENDPOINT" ? /* @__PURE__ */ jsx(EndpointPage$1, {}) : /* @__PURE__ */ jsx(APIPage, {})
|
|
2232
2089
|
}));
|
|
2233
2090
|
};
|
|
2234
2091
|
//#endregion
|
|
2235
2092
|
//#region src/view/components/ApiPage/components/ApiDocumentationBar.tsx
|
|
2236
|
-
const { useBreakpoint: useBreakpoint$
|
|
2237
|
-
const { Title: Title$
|
|
2093
|
+
const { useBreakpoint: useBreakpoint$4 } = Grid;
|
|
2094
|
+
const { Title: Title$2 } = Typography;
|
|
2238
2095
|
const ApiDocumentationBar = ({ apiName, mode, onModeChange, onReset, onSave, hasChanges = false, switcherNode }) => {
|
|
2239
|
-
const isMobile = !useBreakpoint$
|
|
2096
|
+
const isMobile = !useBreakpoint$4().md;
|
|
2240
2097
|
const { wrapSSR, cx, token } = useStyle("ApiDocumentationBar", (token, scope) => ({
|
|
2241
2098
|
[scope("root")]: {
|
|
2242
2099
|
display: "flex",
|
|
@@ -2347,7 +2204,7 @@ const ApiDocumentationBar = ({ apiName, mode, onModeChange, onReset, onSave, has
|
|
|
2347
2204
|
className: cx("title-section"),
|
|
2348
2205
|
children: [/* @__PURE__ */ jsx(Tooltip, {
|
|
2349
2206
|
title: apiName,
|
|
2350
|
-
children: /* @__PURE__ */ jsx(Title$
|
|
2207
|
+
children: /* @__PURE__ */ jsx(Title$2, {
|
|
2351
2208
|
level: 3,
|
|
2352
2209
|
ellipsis: true,
|
|
2353
2210
|
style: {
|
|
@@ -2385,7 +2242,7 @@ const ApiDocumentationBar = ({ apiName, mode, onModeChange, onReset, onSave, has
|
|
|
2385
2242
|
className: cx("title-section"),
|
|
2386
2243
|
children: /* @__PURE__ */ jsx(Tooltip, {
|
|
2387
2244
|
title: `${apiName} API Documentation`,
|
|
2388
|
-
children: /* @__PURE__ */ jsxs(Title$
|
|
2245
|
+
children: /* @__PURE__ */ jsxs(Title$2, {
|
|
2389
2246
|
level: 3,
|
|
2390
2247
|
style: {
|
|
2391
2248
|
margin: 0,
|
|
@@ -2439,9 +2296,9 @@ const ApiDocumentationBar = ({ apiName, mode, onModeChange, onReset, onSave, has
|
|
|
2439
2296
|
};
|
|
2440
2297
|
//#endregion
|
|
2441
2298
|
//#region src/view/components/ApiPage/components/GeneralSection.tsx
|
|
2442
|
-
const { useBreakpoint: useBreakpoint$
|
|
2299
|
+
const { useBreakpoint: useBreakpoint$3 } = Grid;
|
|
2443
2300
|
const GeneralSection = ({ apiName, authType, version, description, onApiNameChange, onDescriptionChange, collapsed = false, onToggleCollapse, onChangeDetected }) => {
|
|
2444
|
-
const isMobile = !useBreakpoint$
|
|
2301
|
+
const isMobile = !useBreakpoint$3().md;
|
|
2445
2302
|
const { wrapSSR, cx, token } = useStyle("GeneralSection", (token, scope) => ({
|
|
2446
2303
|
[scope("root")]: {
|
|
2447
2304
|
display: "flex",
|
|
@@ -3309,7 +3166,7 @@ const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initia
|
|
|
3309
3166
|
};
|
|
3310
3167
|
//#endregion
|
|
3311
3168
|
//#region src/view/components/ApiPage/components/EndpointsSection.tsx
|
|
3312
|
-
const { useBreakpoint: useBreakpoint$
|
|
3169
|
+
const { useBreakpoint: useBreakpoint$2 } = Grid;
|
|
3313
3170
|
const PAGE_SIZE = 5;
|
|
3314
3171
|
const getStatusCodeColor = (code, token) => {
|
|
3315
3172
|
const n = parseInt(code, 10);
|
|
@@ -3357,7 +3214,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
3357
3214
|
const debouncedResponseSearches = useDebounce(responseSearches);
|
|
3358
3215
|
const { selectNodeByKey } = useNodeSelection();
|
|
3359
3216
|
const { token: antdToken } = theme.useToken();
|
|
3360
|
-
const isMobile = !useBreakpoint$
|
|
3217
|
+
const isMobile = !useBreakpoint$2().md;
|
|
3361
3218
|
const toggleRequestPanel = (epId) => {
|
|
3362
3219
|
setOpenRequestPanels((prev) => {
|
|
3363
3220
|
const next = new Set(prev);
|
|
@@ -4058,7 +3915,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
4058
3915
|
className: cx("body"),
|
|
4059
3916
|
children: Object.values(endpointsByTag).flat().map((ep) => {
|
|
4060
3917
|
const isExpanded = expandedId === ep.id;
|
|
4061
|
-
const methodColor = methodColors[ep.method];
|
|
3918
|
+
const methodColor = methodColors$1[ep.method];
|
|
4062
3919
|
return /* @__PURE__ */ jsxs("div", { children: [
|
|
4063
3920
|
/* @__PURE__ */ jsxs("div", {
|
|
4064
3921
|
className: cx("endpoint-row"),
|
|
@@ -5216,9 +5073,9 @@ const UnsavedChangesBanner = ({ onClose }) => {
|
|
|
5216
5073
|
};
|
|
5217
5074
|
//#endregion
|
|
5218
5075
|
//#region src/view/components/ApiPage/components/TagsSection.tsx
|
|
5219
|
-
const { useBreakpoint } = Grid;
|
|
5076
|
+
const { useBreakpoint: useBreakpoint$1 } = Grid;
|
|
5220
5077
|
const TagsSection = ({ tags, collapsed = false, onToggleCollapse, onAddTag, onEditTag, onDeleteTag }) => {
|
|
5221
|
-
const isMobile = !useBreakpoint().md;
|
|
5078
|
+
const isMobile = !useBreakpoint$1().md;
|
|
5222
5079
|
const { wrapSSR, cx, token } = useStyle("TagsSection", (token, scope) => ({
|
|
5223
5080
|
[scope("root")]: {
|
|
5224
5081
|
display: "flex",
|
|
@@ -6016,89 +5873,923 @@ const AddTagDrawer = ({ open, onClose, mode, initialValues, onAddTag, onEditTag
|
|
|
6016
5873
|
})
|
|
6017
5874
|
] }));
|
|
6018
5875
|
};
|
|
6019
|
-
|
|
6020
|
-
|
|
6021
|
-
|
|
6022
|
-
|
|
6023
|
-
|
|
6024
|
-
|
|
6025
|
-
|
|
6026
|
-
|
|
6027
|
-
|
|
5876
|
+
token.colorPrimary, token.colorSuccess, token.colorError, token.colorWarning, token["volcano.5"], token["geekblue.6"], token["purple.5"], token["volcano.4"];
|
|
5877
|
+
const darkerMethodColors = {
|
|
5878
|
+
GET: {
|
|
5879
|
+
bg: token.colorPrimary,
|
|
5880
|
+
color: "#FFFFFF"
|
|
5881
|
+
},
|
|
5882
|
+
POST: {
|
|
5883
|
+
bg: token.colorSuccess,
|
|
5884
|
+
color: "#FFFFFF"
|
|
5885
|
+
},
|
|
5886
|
+
DELETE: {
|
|
5887
|
+
bg: token.colorError,
|
|
5888
|
+
color: "#FFFFFF"
|
|
5889
|
+
},
|
|
5890
|
+
PUT: {
|
|
5891
|
+
bg: token.colorWarning,
|
|
5892
|
+
color: "#FFFFFF"
|
|
5893
|
+
},
|
|
5894
|
+
PATCH: {
|
|
5895
|
+
bg: token["volcano.5"],
|
|
5896
|
+
color: "#FFFFFF"
|
|
5897
|
+
},
|
|
5898
|
+
OPTIONS: {
|
|
5899
|
+
bg: token["geekblue.6"],
|
|
5900
|
+
color: "#FFFFFF"
|
|
5901
|
+
},
|
|
5902
|
+
HEAD: {
|
|
5903
|
+
bg: token["purple.5"],
|
|
5904
|
+
color: "#FFFFFF"
|
|
5905
|
+
},
|
|
5906
|
+
TRACE: {
|
|
5907
|
+
bg: token["cyan.5"],
|
|
5908
|
+
color: "#FFFFFF"
|
|
5909
|
+
}
|
|
6028
5910
|
};
|
|
6029
|
-
const
|
|
6030
|
-
|
|
6031
|
-
|
|
6032
|
-
|
|
6033
|
-
|
|
6034
|
-
|
|
6035
|
-
|
|
6036
|
-
|
|
6037
|
-
|
|
6038
|
-
|
|
6039
|
-
|
|
5911
|
+
const sidebarMethodColors = {
|
|
5912
|
+
GET: {
|
|
5913
|
+
bg: token.colorPrimaryBgHover,
|
|
5914
|
+
color: token.colorPrimary
|
|
5915
|
+
},
|
|
5916
|
+
POST: {
|
|
5917
|
+
bg: token.colorSuccessBg,
|
|
5918
|
+
color: token.colorSuccess
|
|
5919
|
+
},
|
|
5920
|
+
DELETE: {
|
|
5921
|
+
bg: token.colorErrorBg,
|
|
5922
|
+
color: token.colorError
|
|
5923
|
+
},
|
|
5924
|
+
PUT: {
|
|
5925
|
+
bg: token.colorWarningBg,
|
|
5926
|
+
color: token.colorWarning
|
|
5927
|
+
},
|
|
5928
|
+
PATCH: {
|
|
5929
|
+
bg: token["volcano.1"],
|
|
5930
|
+
color: token["volcano.5"]
|
|
5931
|
+
},
|
|
5932
|
+
OPTIONS: {
|
|
5933
|
+
bg: token["geekblue.2"],
|
|
5934
|
+
color: token["geekblue.6"]
|
|
5935
|
+
},
|
|
5936
|
+
HEAD: {
|
|
5937
|
+
bg: token["purple.1"],
|
|
5938
|
+
color: token["purple.5"]
|
|
5939
|
+
},
|
|
5940
|
+
TRACE: {
|
|
5941
|
+
bg: token["volcano.1"],
|
|
5942
|
+
color: token["volcano.4"]
|
|
5943
|
+
}
|
|
5944
|
+
};
|
|
5945
|
+
const buildTreeDataStructure = (data) => {
|
|
5946
|
+
if (!data) return [];
|
|
5947
|
+
return data.map((api) => {
|
|
5948
|
+
const tagEntries = Object.entries(api.tags);
|
|
5949
|
+
const defaultTag = tagEntries.find(([tag]) => tag.toLowerCase() === "default");
|
|
5950
|
+
const nonDefaultTags = tagEntries.filter(([tag]) => tag.toLowerCase() !== "default");
|
|
5951
|
+
const defaultEndpoints = defaultTag ? defaultTag[1].map((endpoint) => ({
|
|
5952
|
+
title: endpoint.summary,
|
|
5953
|
+
key: endpoint.id,
|
|
5954
|
+
isLeaf: true,
|
|
5955
|
+
selectable: true,
|
|
5956
|
+
method: endpoint.method,
|
|
5957
|
+
data: {
|
|
5958
|
+
endpoint,
|
|
5959
|
+
api,
|
|
5960
|
+
tagName: "default",
|
|
5961
|
+
parentApiId: api.id
|
|
5962
|
+
}
|
|
5963
|
+
})) : [];
|
|
5964
|
+
const tagNodes = nonDefaultTags.map(([tag, endpoints]) => {
|
|
5965
|
+
const tagId = `tag-${api.id}-${tag.replace(/\s+/g, "-").toLowerCase()}`;
|
|
5966
|
+
return {
|
|
5967
|
+
title: tag,
|
|
5968
|
+
key: tagId,
|
|
5969
|
+
selectable: true,
|
|
5970
|
+
data: {
|
|
5971
|
+
tagName: tag,
|
|
5972
|
+
apiData: api
|
|
5973
|
+
},
|
|
5974
|
+
children: endpoints.map((endpoint) => ({
|
|
5975
|
+
title: endpoint.summary,
|
|
5976
|
+
key: endpoint.id,
|
|
5977
|
+
isLeaf: true,
|
|
5978
|
+
selectable: true,
|
|
5979
|
+
method: endpoint.method,
|
|
5980
|
+
data: {
|
|
5981
|
+
endpoint,
|
|
5982
|
+
api,
|
|
5983
|
+
tagName: tag,
|
|
5984
|
+
parentApiId: api.id,
|
|
5985
|
+
tagId
|
|
5986
|
+
}
|
|
5987
|
+
}))
|
|
5988
|
+
};
|
|
5989
|
+
});
|
|
5990
|
+
return {
|
|
5991
|
+
title: api.title,
|
|
5992
|
+
key: api.id,
|
|
5993
|
+
selectable: true,
|
|
5994
|
+
data: api,
|
|
5995
|
+
children: [...tagNodes, ...defaultEndpoints]
|
|
5996
|
+
};
|
|
5997
|
+
});
|
|
5998
|
+
};
|
|
5999
|
+
const getAllTreeKeys = (data) => {
|
|
6000
|
+
const keys = [];
|
|
6001
|
+
const traverse = (nodes) => {
|
|
6002
|
+
nodes.forEach((node) => {
|
|
6003
|
+
keys.push(node.key);
|
|
6004
|
+
if (node.children && node.children.length > 0) traverse(node.children);
|
|
6005
|
+
});
|
|
6006
|
+
};
|
|
6007
|
+
traverse(data);
|
|
6008
|
+
return keys;
|
|
6009
|
+
};
|
|
6010
|
+
const filterTreeData = (data, searchText) => {
|
|
6011
|
+
if (!searchText) return data;
|
|
6012
|
+
const findOriginalNode = (nodes, key) => {
|
|
6013
|
+
for (const node of nodes) {
|
|
6014
|
+
if (node.key === key) return node;
|
|
6015
|
+
if (node.children) {
|
|
6016
|
+
const found = findOriginalNode(node.children, key);
|
|
6017
|
+
if (found) return found;
|
|
6018
|
+
}
|
|
6019
|
+
}
|
|
6020
|
+
return null;
|
|
6021
|
+
};
|
|
6022
|
+
const filterNode = (node) => {
|
|
6023
|
+
let titleText = "";
|
|
6024
|
+
const originalNode = findOriginalNode(data, node.key);
|
|
6025
|
+
if (originalNode && typeof originalNode.title === "string") titleText = originalNode.title;
|
|
6026
|
+
else if (typeof node.title === "string") titleText = node.title;
|
|
6027
|
+
let searchableText = titleText;
|
|
6028
|
+
if (node.isLeaf && node.method) searchableText = `${node.method} ${titleText}`.toLowerCase();
|
|
6029
|
+
else searchableText = titleText.toLowerCase();
|
|
6030
|
+
const searchLower = searchText.toLowerCase();
|
|
6031
|
+
const matchesSearch = searchableText.includes(searchLower);
|
|
6032
|
+
if (node.children) {
|
|
6033
|
+
const filteredChildren = node.children.map((child) => filterNode(child)).filter((child) => child !== null);
|
|
6034
|
+
if (matchesSearch || filteredChildren.length > 0) return {
|
|
6035
|
+
...node,
|
|
6036
|
+
children: filteredChildren
|
|
6037
|
+
};
|
|
6038
|
+
} else if (matchesSearch) return node;
|
|
6039
|
+
return null;
|
|
6040
|
+
};
|
|
6041
|
+
return data.map((node) => filterNode(node)).filter((node) => node !== null);
|
|
6042
|
+
};
|
|
6043
|
+
const getSidebarStyles = (token, scope) => ({
|
|
6044
|
+
[scope("sider")]: {
|
|
6045
|
+
backgroundColor: token.colorBgElevated,
|
|
6046
|
+
overflowX: "clip",
|
|
6047
|
+
borderRadius: token.borderRadius,
|
|
6048
|
+
height: "auto"
|
|
6049
|
+
},
|
|
6050
|
+
[scope("content")]: { padding: token.padding },
|
|
6051
|
+
[scope("controls")]: {
|
|
6052
|
+
display: "flex",
|
|
6053
|
+
gap: token.marginXS,
|
|
6054
|
+
marginBottom: token.marginSM
|
|
6055
|
+
},
|
|
6056
|
+
[scope("search-input")]: { flex: 1 },
|
|
6057
|
+
[scope("tree")]: {
|
|
6058
|
+
backgroundColor: "transparent",
|
|
6059
|
+
width: "100%",
|
|
6060
|
+
"& .ant-tree-list": { width: "100%" },
|
|
6061
|
+
"& .ant-tree-list-holder-inner": { width: "100%" },
|
|
6062
|
+
"& .ant-tree-node-content-wrapper": {
|
|
6063
|
+
overflow: "hidden",
|
|
6064
|
+
flex: 1,
|
|
6065
|
+
display: "flex",
|
|
6066
|
+
alignItems: "center",
|
|
6067
|
+
padding: "0 !important"
|
|
6068
|
+
},
|
|
6069
|
+
"& .ant-tree-title": {
|
|
6070
|
+
width: "100%",
|
|
6071
|
+
overflow: "hidden",
|
|
6072
|
+
display: "flex",
|
|
6073
|
+
alignItems: "center",
|
|
6074
|
+
marginBlock: "auto"
|
|
6075
|
+
},
|
|
6076
|
+
"& .ant-tree-treenode": {
|
|
6077
|
+
width: "100%",
|
|
6078
|
+
padding: 0
|
|
6079
|
+
},
|
|
6080
|
+
"& .ant-tree-switcher": { backgroundColor: token.colorBgElevated }
|
|
6081
|
+
},
|
|
6082
|
+
[scope("endpoint-item")]: {
|
|
6083
|
+
display: "flex",
|
|
6084
|
+
alignItems: "center",
|
|
6085
|
+
gap: token.marginXS,
|
|
6086
|
+
width: "100%",
|
|
6087
|
+
maxWidth: "100%",
|
|
6088
|
+
minWidth: "100%",
|
|
6089
|
+
paddingLeft: token.marginXS,
|
|
6090
|
+
paddingRight: token.marginXS
|
|
6091
|
+
},
|
|
6092
|
+
[scope("method-tag")]: {
|
|
6093
|
+
width: 51,
|
|
6094
|
+
height: 16,
|
|
6095
|
+
lineHeight: "16px",
|
|
6096
|
+
fontSize: 12,
|
|
6097
|
+
textAlign: "center",
|
|
6098
|
+
border: "none",
|
|
6099
|
+
borderRadius: 6,
|
|
6100
|
+
padding: "0 8px",
|
|
6101
|
+
display: "inline-flex",
|
|
6102
|
+
alignItems: "center",
|
|
6103
|
+
justifyContent: "center"
|
|
6104
|
+
},
|
|
6105
|
+
[scope("endpoint-text")]: {
|
|
6106
|
+
flex: 1,
|
|
6107
|
+
maxWidth: "100%",
|
|
6108
|
+
minWidth: 0,
|
|
6109
|
+
overflow: "hidden",
|
|
6110
|
+
display: "block"
|
|
6111
|
+
},
|
|
6112
|
+
[scope("tag-title")]: {
|
|
6113
|
+
color: token.colorText,
|
|
6114
|
+
maxWidth: "100%",
|
|
6115
|
+
display: "block",
|
|
6116
|
+
flex: 1
|
|
6117
|
+
},
|
|
6118
|
+
[scope("api-title")]: {
|
|
6119
|
+
flex: 1,
|
|
6120
|
+
color: token.colorText,
|
|
6121
|
+
maxWidth: "100%",
|
|
6122
|
+
display: "block",
|
|
6123
|
+
paddingLeft: "4px",
|
|
6124
|
+
paddingRight: "4px",
|
|
6125
|
+
margin: 0
|
|
6126
|
+
}
|
|
6127
|
+
});
|
|
6128
|
+
//#endregion
|
|
6129
|
+
//#region src/view/console/helper/sidebar.components.tsx
|
|
6130
|
+
const { Text: Text$1 } = Typography;
|
|
6131
|
+
const EndpointItem = ({ method, title, cx, isSelected = false }) => {
|
|
6132
|
+
const methodStyle = (isSelected ? darkerMethodColors : sidebarMethodColors)[method];
|
|
6133
|
+
const isPost = method?.toUpperCase() === "POST";
|
|
6134
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
6135
|
+
className: `${cx("endpoint-item")}${isSelected ? ` ${cx("endpoint-item-selected")}` : ""}`,
|
|
6136
|
+
children: [/* @__PURE__ */ jsx(Tag, {
|
|
6137
|
+
className: cx("method-tag"),
|
|
6138
|
+
style: {
|
|
6139
|
+
backgroundColor: methodStyle?.bg,
|
|
6140
|
+
color: methodStyle?.color,
|
|
6141
|
+
border: "none",
|
|
6142
|
+
...isPost ? { borderRadius: 4 } : {}
|
|
6143
|
+
},
|
|
6144
|
+
children: method
|
|
6145
|
+
}), /* @__PURE__ */ jsx(Text$1, {
|
|
6146
|
+
className: cx("endpoint-text"),
|
|
6147
|
+
ellipsis: { tooltip: title },
|
|
6148
|
+
style: { flex: 1 },
|
|
6149
|
+
children: title
|
|
6150
|
+
})]
|
|
6151
|
+
});
|
|
6152
|
+
};
|
|
6153
|
+
const convertToRenderableTreeData = (treeDataStructure, selectedEndpoint, cx) => {
|
|
6154
|
+
const renderNode = (node) => {
|
|
6155
|
+
let title;
|
|
6156
|
+
if (node.isLeaf && node.method) {
|
|
6157
|
+
const isSelected = selectedEndpoint && "data" in node && node.data && "endpoint" in node.data ? node.data.endpoint?.id === selectedEndpoint?.id : false;
|
|
6158
|
+
title = /* @__PURE__ */ jsx(EndpointItem, {
|
|
6159
|
+
method: node.method,
|
|
6160
|
+
title: typeof node.title === "string" ? node.title : "Endpoint Name",
|
|
6161
|
+
cx,
|
|
6162
|
+
isSelected
|
|
6163
|
+
});
|
|
6164
|
+
} else if (node.data && "id" in node.data && "tags" in node.data && !("endpoint" in node.data) && !("tagName" in node.data)) title = /* @__PURE__ */ jsx(Text$1, {
|
|
6165
|
+
className: cx("api-title"),
|
|
6166
|
+
ellipsis: { tooltip: typeof node.title === "string" ? node.title : "API Name" },
|
|
6167
|
+
children: node.title
|
|
6168
|
+
});
|
|
6169
|
+
else title = /* @__PURE__ */ jsx(Text$1, {
|
|
6170
|
+
className: cx("tag-title"),
|
|
6171
|
+
ellipsis: { tooltip: typeof node.title === "string" ? node.title : "" },
|
|
6172
|
+
children: node.title
|
|
6173
|
+
});
|
|
6174
|
+
return {
|
|
6175
|
+
...node,
|
|
6176
|
+
title,
|
|
6177
|
+
children: node.children ? node.children.map(renderNode) : void 0
|
|
6178
|
+
};
|
|
6179
|
+
};
|
|
6180
|
+
return treeDataStructure.map(renderNode);
|
|
6181
|
+
};
|
|
6182
|
+
//#endregion
|
|
6183
|
+
//#region src/view/console/Sidebar.tsx
|
|
6184
|
+
const { useBreakpoint } = Grid;
|
|
6185
|
+
const Sidebar = ({ searchValue, setSearchValue, onNodeSelect }) => {
|
|
6186
|
+
const expandedKeys = useStore((state) => state.view.expandedKeys);
|
|
6187
|
+
const { selectedNodeKey, selectedEndpoint, builtTreeData, setExpandedKeys, setSelectedNodeKey } = useStore(({ view }) => view);
|
|
6188
|
+
const { selectNodeByKey, clearSelection } = useNodeSelection();
|
|
6189
|
+
const [autoExpandParent, setAutoExpandParent] = useState(true);
|
|
6190
|
+
const isMobile = !useBreakpoint().md;
|
|
6191
|
+
const { wrapSSR, cx, token } = useStyle("Sidebar", getSidebarStyles);
|
|
6192
|
+
const handleSearch = (value) => {
|
|
6193
|
+
if (value && builtTreeData) {
|
|
6194
|
+
setExpandedKeys(getAllTreeKeys(builtTreeData));
|
|
6195
|
+
setSearchValue(value);
|
|
6196
|
+
setAutoExpandParent(true);
|
|
6197
|
+
} else {
|
|
6198
|
+
setSearchValue(value);
|
|
6199
|
+
setExpandedKeys([]);
|
|
6200
|
+
setAutoExpandParent(false);
|
|
6201
|
+
}
|
|
6202
|
+
};
|
|
6203
|
+
const renderTreeData = useMemo(() => {
|
|
6204
|
+
if (!builtTreeData) return [];
|
|
6205
|
+
return convertToRenderableTreeData(builtTreeData, selectedEndpoint, cx);
|
|
6206
|
+
}, [
|
|
6207
|
+
builtTreeData,
|
|
6208
|
+
selectedEndpoint,
|
|
6209
|
+
cx
|
|
6210
|
+
]);
|
|
6211
|
+
const filteredTreeData = useMemo(() => {
|
|
6212
|
+
if (!searchValue) return renderTreeData;
|
|
6213
|
+
if (!builtTreeData) return [];
|
|
6214
|
+
return convertToRenderableTreeData(filterTreeData(builtTreeData, searchValue), selectedEndpoint, cx);
|
|
6215
|
+
}, [
|
|
6216
|
+
builtTreeData,
|
|
6217
|
+
searchValue,
|
|
6218
|
+
selectedEndpoint,
|
|
6219
|
+
cx
|
|
6220
|
+
]);
|
|
6221
|
+
const collapseAll = () => {
|
|
6222
|
+
setExpandedKeys([]);
|
|
6223
|
+
};
|
|
6224
|
+
const onTreeNodeSelect = (selectedKeys) => {
|
|
6225
|
+
const stringKeys = selectedKeys.map((key) => String(key));
|
|
6226
|
+
if (stringKeys.length === 0) {
|
|
6227
|
+
clearSelection();
|
|
6228
|
+
return;
|
|
6229
|
+
}
|
|
6230
|
+
if (!builtTreeData) return;
|
|
6231
|
+
const selectedKey = stringKeys[0];
|
|
6232
|
+
selectNodeByKey(selectedKey);
|
|
6233
|
+
setSelectedNodeKey(selectedKey);
|
|
6234
|
+
};
|
|
6235
|
+
const inner = /* @__PURE__ */ jsxs("div", {
|
|
6236
|
+
className: cx("content"),
|
|
6237
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
6238
|
+
className: cx("controls"),
|
|
6239
|
+
children: [/* @__PURE__ */ jsx(Tooltip, {
|
|
6240
|
+
title: "Search by APIs or Endpoints",
|
|
6241
|
+
placement: "bottom",
|
|
6242
|
+
children: /* @__PURE__ */ jsx(Input, {
|
|
6243
|
+
placeholder: "Search by APIs or Endpoints",
|
|
6244
|
+
value: searchValue,
|
|
6245
|
+
onChange: (e) => handleSearch(e.target.value),
|
|
6246
|
+
allowClear: true,
|
|
6247
|
+
className: cx("search-input"),
|
|
6248
|
+
addonAfter: /* @__PURE__ */ jsx(SearchOutlined, {})
|
|
6249
|
+
})
|
|
6250
|
+
}), /* @__PURE__ */ jsx(Tooltip, {
|
|
6251
|
+
title: "Collapse All",
|
|
6252
|
+
placement: "bottom",
|
|
6253
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
6254
|
+
onClick: collapseAll,
|
|
6255
|
+
title: "Collapse All",
|
|
6256
|
+
icon: /* @__PURE__ */ jsx(Minify, {})
|
|
6257
|
+
})
|
|
6258
|
+
})]
|
|
6259
|
+
}), filteredTreeData?.length ? /* @__PURE__ */ jsx(Tree, {
|
|
6260
|
+
showLine: { showLeafIcon: false },
|
|
6261
|
+
showIcon: false,
|
|
6262
|
+
switcherIcon: (nodeProps) => nodeProps.isLeaf ? null : nodeProps.expanded ? /* @__PURE__ */ jsx(MinusSquareOutlined, { style: { fontSize: 12 } }) : /* @__PURE__ */ jsx(PlusSquareOutlined, { style: { fontSize: 12 } }),
|
|
6263
|
+
expandedKeys,
|
|
6264
|
+
autoExpandParent,
|
|
6265
|
+
selectedKeys: [selectedNodeKey || ""],
|
|
6266
|
+
onSelect: (selectedKeys) => {
|
|
6267
|
+
if (!selectedKeys?.length) return;
|
|
6268
|
+
onTreeNodeSelect(selectedKeys);
|
|
6269
|
+
setSelectedNodeKey(selectedKeys[0]);
|
|
6270
|
+
onNodeSelect?.();
|
|
6271
|
+
},
|
|
6272
|
+
onExpand: (expandedKeysValue) => {
|
|
6273
|
+
setExpandedKeys(expandedKeysValue);
|
|
6274
|
+
setAutoExpandParent(false);
|
|
6275
|
+
},
|
|
6276
|
+
treeData: filteredTreeData,
|
|
6277
|
+
className: cx("tree")
|
|
6278
|
+
}) : /* @__PURE__ */ jsxs(Flex, {
|
|
6279
|
+
justify: "center",
|
|
6280
|
+
align: "center",
|
|
6281
|
+
gap: token.marginSM,
|
|
6282
|
+
vertical: true,
|
|
6283
|
+
style: { marginTop: token.paddingXL },
|
|
6284
|
+
children: [/* @__PURE__ */ jsx(NoDataIcon, {
|
|
6285
|
+
stroke: token.colorPrimaryHover,
|
|
6286
|
+
fill: token.colorPrimaryBg,
|
|
6287
|
+
width: "10.375rem",
|
|
6288
|
+
height: "8.1875rem"
|
|
6289
|
+
}), searchValue.length ? /* @__PURE__ */ jsx(Text, {
|
|
6290
|
+
style: {
|
|
6291
|
+
textAlign: "center",
|
|
6292
|
+
fontFamily: token.fontFamily,
|
|
6293
|
+
fontWeight: 400,
|
|
6294
|
+
fontSize: token.fontSizeLG,
|
|
6295
|
+
color: token.colorTextTertiary
|
|
6296
|
+
},
|
|
6297
|
+
children: "No results found"
|
|
6298
|
+
}) : /* @__PURE__ */ jsxs(Text, {
|
|
6299
|
+
style: {
|
|
6300
|
+
textAlign: "center",
|
|
6301
|
+
fontFamily: token.fontFamily,
|
|
6302
|
+
fontWeight: 400,
|
|
6303
|
+
fontSize: token.fontSizeLG,
|
|
6304
|
+
color: token.colorTextTertiary
|
|
6305
|
+
},
|
|
6306
|
+
children: [
|
|
6307
|
+
"No API",
|
|
6308
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
6309
|
+
"Documentation Found"
|
|
6310
|
+
]
|
|
6311
|
+
})]
|
|
6312
|
+
})]
|
|
6313
|
+
});
|
|
6314
|
+
if (isMobile) return wrapSSR(/* @__PURE__ */ jsx("aside", {
|
|
6315
|
+
className: cx("sider"),
|
|
6316
|
+
style: {
|
|
6317
|
+
width: "100%",
|
|
6318
|
+
height: "100%"
|
|
6319
|
+
},
|
|
6320
|
+
children: inner
|
|
6321
|
+
}));
|
|
6322
|
+
return wrapSSR(/* @__PURE__ */ jsx(Resizable, {
|
|
6323
|
+
as: "aside",
|
|
6324
|
+
minWidth: isMobile ? 180 : 300,
|
|
6325
|
+
maxWidth: 386,
|
|
6326
|
+
enable: {
|
|
6327
|
+
top: false,
|
|
6328
|
+
right: true,
|
|
6329
|
+
bottom: false,
|
|
6330
|
+
left: false,
|
|
6331
|
+
topRight: false,
|
|
6332
|
+
bottomRight: false,
|
|
6333
|
+
bottomLeft: false,
|
|
6334
|
+
topLeft: false
|
|
6335
|
+
},
|
|
6336
|
+
defaultSize: {
|
|
6337
|
+
width: isMobile ? 225 : 333,
|
|
6338
|
+
height: "auto"
|
|
6339
|
+
},
|
|
6340
|
+
className: cx("sider"),
|
|
6341
|
+
children: inner
|
|
6342
|
+
}));
|
|
6343
|
+
};
|
|
6344
|
+
//#endregion
|
|
6345
|
+
//#region src/view/console/EndpointPage/EndpointPage.tsx
|
|
6346
|
+
const { Title: Title$1, Paragraph } = Typography;
|
|
6347
|
+
const requestColumns = [
|
|
6348
|
+
{
|
|
6349
|
+
title: "Parameter",
|
|
6350
|
+
dataIndex: "param",
|
|
6351
|
+
key: "param"
|
|
6352
|
+
},
|
|
6353
|
+
{
|
|
6354
|
+
title: "Description",
|
|
6355
|
+
dataIndex: "desc",
|
|
6356
|
+
key: "desc"
|
|
6357
|
+
},
|
|
6358
|
+
{
|
|
6359
|
+
title: "Enum",
|
|
6360
|
+
dataIndex: "enum",
|
|
6361
|
+
key: "enum"
|
|
6362
|
+
}
|
|
6363
|
+
];
|
|
6364
|
+
const responseColumns = [...requestColumns];
|
|
6365
|
+
const buildRequestData = (params, token) => [...params].sort((a, b) => a.required === b.required ? 0 : a.required ? -1 : 1).map((p, index) => {
|
|
6366
|
+
let typeLabel = p.schema?.type;
|
|
6367
|
+
if (p.schema?.type === "array" && p.schema?.items?.type) typeLabel = `${p.schema.type}_${p.schema.items.type}`;
|
|
6368
|
+
return {
|
|
6369
|
+
key: index,
|
|
6370
|
+
param: /* @__PURE__ */ jsxs("span", { children: [
|
|
6371
|
+
p.name,
|
|
6372
|
+
typeLabel && /* @__PURE__ */ jsx("span", {
|
|
6373
|
+
style: {
|
|
6374
|
+
color: token.colorTextTertiary,
|
|
6375
|
+
marginLeft: "0.25rem",
|
|
6376
|
+
marginRight: "0.25rem"
|
|
6377
|
+
},
|
|
6378
|
+
children: typeLabel
|
|
6379
|
+
}),
|
|
6380
|
+
p.required ? /* @__PURE__ */ jsx("span", {
|
|
6381
|
+
style: { color: token.colorError },
|
|
6382
|
+
children: "*"
|
|
6383
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
6384
|
+
style: { color: token.colorSuccess },
|
|
6385
|
+
children: "Optional"
|
|
6386
|
+
})
|
|
6387
|
+
] }),
|
|
6388
|
+
desc: p.description || "--",
|
|
6389
|
+
enum: p.schema?.enum ? p.schema.enum.map((e) => /* @__PURE__ */ jsx(Tag, { children: e }, e)) : "--"
|
|
6390
|
+
};
|
|
6391
|
+
});
|
|
6392
|
+
const buildHeaderData = (headers, token) => {
|
|
6393
|
+
if (!headers) return [];
|
|
6394
|
+
return Object.entries(headers).sort(([, a], [, b]) => a.required === b.required ? 0 : a.required ? -1 : 1).map(([name, header], idx) => {
|
|
6395
|
+
let typeLabel = header.schema?.type;
|
|
6396
|
+
if (header.schema?.type === "array" && header.schema?.items?.type) typeLabel = `${header.schema.type}_${header.schema.items.type}`;
|
|
6397
|
+
return {
|
|
6398
|
+
key: idx,
|
|
6399
|
+
param: /* @__PURE__ */ jsxs("span", { children: [
|
|
6400
|
+
name,
|
|
6401
|
+
typeLabel && /* @__PURE__ */ jsx("span", {
|
|
6402
|
+
style: {
|
|
6403
|
+
color: token.colorTextTertiary,
|
|
6404
|
+
marginLeft: "0.25rem",
|
|
6405
|
+
marginRight: "0.25rem"
|
|
6406
|
+
},
|
|
6407
|
+
children: typeLabel
|
|
6408
|
+
}),
|
|
6409
|
+
header.required ? /* @__PURE__ */ jsx("span", {
|
|
6410
|
+
style: { color: token.colorError },
|
|
6411
|
+
children: "*"
|
|
6412
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
6413
|
+
style: { color: token.colorSuccess },
|
|
6414
|
+
children: "Optional"
|
|
6415
|
+
})
|
|
6416
|
+
] }, idx),
|
|
6417
|
+
desc: header.description || "--",
|
|
6418
|
+
enum: header.schema?.enum ? header.schema.enum.map((e) => /* @__PURE__ */ jsx(Tag, { children: e }, e)) : "--"
|
|
6419
|
+
};
|
|
6420
|
+
});
|
|
6421
|
+
};
|
|
6422
|
+
const buildRequestBodyData = (requestBody, token) => {
|
|
6423
|
+
if (!requestBody?.content) return [];
|
|
6424
|
+
const contentType = Object.keys(requestBody.content)[0];
|
|
6425
|
+
const schema = requestBody.content[contentType]?.schema;
|
|
6426
|
+
if (!schema) return [];
|
|
6427
|
+
const properties = schema.properties ?? {};
|
|
6428
|
+
const required = schema.required ?? [];
|
|
6429
|
+
return Object.entries(properties).map(([name, prop], idx) => ({
|
|
6430
|
+
key: idx,
|
|
6431
|
+
param: /* @__PURE__ */ jsxs("span", { children: [
|
|
6432
|
+
name,
|
|
6433
|
+
prop.type && /* @__PURE__ */ jsx("span", {
|
|
6434
|
+
style: {
|
|
6435
|
+
color: token.colorTextTertiary,
|
|
6436
|
+
marginLeft: "0.25rem",
|
|
6437
|
+
marginRight: "0.25rem"
|
|
6438
|
+
},
|
|
6439
|
+
children: prop.type
|
|
6440
|
+
}),
|
|
6441
|
+
required.includes(name) ? /* @__PURE__ */ jsx("span", {
|
|
6442
|
+
style: { color: token.colorError },
|
|
6443
|
+
children: "*"
|
|
6444
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
6445
|
+
style: { color: token.colorSuccess },
|
|
6446
|
+
children: "Optional"
|
|
6447
|
+
})
|
|
6448
|
+
] }),
|
|
6449
|
+
desc: prop.description || "--",
|
|
6450
|
+
enum: prop.enum ? prop.enum.map((e) => /* @__PURE__ */ jsx(Tag, { children: e }, e)) : "--"
|
|
6451
|
+
}));
|
|
6452
|
+
};
|
|
6453
|
+
const EndpointPage = () => {
|
|
6454
|
+
const { selectedEndpoint, selectedApi, selectedStatusCode, setSelectedNodeKey, setFocusedContent, setFocusedTag, setActiveRequestTab } = useStore(({ view }) => view);
|
|
6455
|
+
const [activeTabKey, setActiveTabKey] = useState("header");
|
|
6456
|
+
const { token } = theme.useToken();
|
|
6457
|
+
const { cx } = useStyle("EndpointPage", (token, scope) => ({
|
|
6458
|
+
[scope("docs-endpoint-container")]: {
|
|
6459
|
+
display: "flex",
|
|
6460
|
+
flexDirection: "column",
|
|
6461
|
+
gap: token.marginLG,
|
|
6462
|
+
height: "100%"
|
|
6463
|
+
},
|
|
6464
|
+
[scope("content")]: {
|
|
6465
|
+
width: "100%",
|
|
6466
|
+
height: "100%"
|
|
6467
|
+
},
|
|
6468
|
+
[scope("code")]: {
|
|
6469
|
+
background: "unset",
|
|
6470
|
+
borderRadius: token.borderRadius,
|
|
6471
|
+
padding: token.paddingSM,
|
|
6472
|
+
fontFamily: "monospace",
|
|
6473
|
+
whiteSpace: "pre-wrap"
|
|
6474
|
+
},
|
|
6475
|
+
[scope("breadcrumb")]: {
|
|
6476
|
+
display: "flex",
|
|
6477
|
+
gap: token.marginLG,
|
|
6478
|
+
alignItems: "center",
|
|
6479
|
+
marginBottom: token.marginLG
|
|
6480
|
+
},
|
|
6481
|
+
[scope("request-card")]: {
|
|
6482
|
+
borderRadius: token.borderRadius,
|
|
6483
|
+
backgroundColor: token.colorBgBase,
|
|
6484
|
+
".ant-card-head": {
|
|
6485
|
+
minHeight: "unset",
|
|
6486
|
+
borderBottom: "unset",
|
|
6487
|
+
padding: "0.75rem",
|
|
6488
|
+
backgroundColor: token.colorBgBase
|
|
6489
|
+
},
|
|
6490
|
+
".ant-card-body": {
|
|
6491
|
+
padding: "0px 0.75rem 0.75rem 0.75rem",
|
|
6492
|
+
backgroundColor: token.colorBgBase,
|
|
6493
|
+
".ant-tabs-tab": { paddingTop: "0" }
|
|
6494
|
+
},
|
|
6495
|
+
"& .ant-table": { backgroundColor: `${token.colorBgBase} !important` },
|
|
6496
|
+
"& .ant-table-thead > tr > th": { backgroundColor: `${token.colorBgBase} !important` },
|
|
6497
|
+
"& .ant-table-tbody > tr > td": { backgroundColor: `${token.colorBgBase} !important` }
|
|
6498
|
+
},
|
|
6499
|
+
[scope("row-odd")]: { "& > td": { background: `${token.colorBgElevated} !important` } },
|
|
6500
|
+
[scope("row-even")]: { "& > td": { background: `${token.colorBgLayout} !important` } }
|
|
6501
|
+
}));
|
|
6502
|
+
const methodStyle = sidebarMethodColors[selectedEndpoint?.method];
|
|
6503
|
+
const headerParams = buildRequestData(selectedEndpoint?.parameters?.filter((p) => p.in === "header") || [], token);
|
|
6504
|
+
const pathParams = buildRequestData(selectedEndpoint?.parameters?.filter((p) => p.in === "path") || [], token);
|
|
6505
|
+
const queryParams = buildRequestData(selectedEndpoint?.parameters?.filter((p) => p.in === "query") || [], token);
|
|
6506
|
+
const requestBodyData = buildRequestBodyData(selectedEndpoint?.requestBody, token);
|
|
6507
|
+
const requestTabs = [
|
|
6508
|
+
{
|
|
6509
|
+
key: "header",
|
|
6510
|
+
label: "Header",
|
|
6511
|
+
children: /* @__PURE__ */ jsx(Table, {
|
|
6512
|
+
columns: requestColumns,
|
|
6513
|
+
dataSource: headerParams,
|
|
6514
|
+
pagination: false,
|
|
6515
|
+
bordered: true,
|
|
6516
|
+
size: "small",
|
|
6517
|
+
rowClassName: (_, idx) => cx(idx % 2 === 0 ? "row-even" : "row-odd")
|
|
6518
|
+
})
|
|
6519
|
+
},
|
|
6520
|
+
{
|
|
6521
|
+
key: "path",
|
|
6522
|
+
label: "Path",
|
|
6523
|
+
children: /* @__PURE__ */ jsx(Table, {
|
|
6524
|
+
columns: requestColumns,
|
|
6525
|
+
dataSource: pathParams,
|
|
6526
|
+
pagination: false,
|
|
6527
|
+
bordered: true,
|
|
6528
|
+
size: "small",
|
|
6529
|
+
rowClassName: (_, idx) => cx(idx % 2 === 0 ? "row-even" : "row-odd")
|
|
6530
|
+
})
|
|
6531
|
+
},
|
|
6532
|
+
{
|
|
6533
|
+
key: "query",
|
|
6534
|
+
label: "Query",
|
|
6535
|
+
children: /* @__PURE__ */ jsx(Table, {
|
|
6536
|
+
columns: requestColumns,
|
|
6537
|
+
dataSource: queryParams,
|
|
6538
|
+
pagination: false,
|
|
6539
|
+
bordered: true,
|
|
6540
|
+
size: "small",
|
|
6541
|
+
rowClassName: (_, idx) => cx(idx % 2 === 0 ? "row-even" : "row-odd")
|
|
6542
|
+
})
|
|
6543
|
+
},
|
|
6544
|
+
...requestBodyData.length > 0 ? [{
|
|
6545
|
+
key: "requestBody",
|
|
6546
|
+
label: "Request Body",
|
|
6547
|
+
children: /* @__PURE__ */ jsx(Table, {
|
|
6548
|
+
columns: requestColumns,
|
|
6549
|
+
dataSource: requestBodyData,
|
|
6550
|
+
pagination: false,
|
|
6551
|
+
bordered: true,
|
|
6552
|
+
size: "small",
|
|
6553
|
+
rowClassName: (_, idx) => cx(idx % 2 === 0 ? "row-even" : "row-odd")
|
|
6554
|
+
})
|
|
6555
|
+
}] : []
|
|
6556
|
+
].filter((t) => t !== null);
|
|
6557
|
+
useEffect(() => {
|
|
6558
|
+
const firstKey = requestTabs[0]?.key ?? "header";
|
|
6559
|
+
setActiveTabKey(firstKey);
|
|
6560
|
+
setActiveRequestTab(firstKey);
|
|
6561
|
+
}, [selectedEndpoint?.id]);
|
|
6562
|
+
const responseHeaders = (selectedEndpoint?.responses?.[selectedStatusCode || 200])?.headers;
|
|
6563
|
+
const responseHeaderData = buildHeaderData(responseHeaders, token);
|
|
6564
|
+
return /* @__PURE__ */ jsx("div", {
|
|
6565
|
+
className: cx("docs-endpoint-container"),
|
|
6566
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
6567
|
+
className: cx("content"),
|
|
6568
|
+
children: [
|
|
6569
|
+
/* @__PURE__ */ jsxs("div", {
|
|
6570
|
+
className: cx("breadcrumb"),
|
|
6571
|
+
children: [/* @__PURE__ */ jsx(Button, {
|
|
6572
|
+
color: "default",
|
|
6573
|
+
variant: "outlined",
|
|
6574
|
+
icon: /* @__PURE__ */ jsx(LeftOutlined, {}),
|
|
6575
|
+
onClick: (e) => {
|
|
6576
|
+
e.preventDefault();
|
|
6577
|
+
setSelectedNodeKey(selectedApi?.id);
|
|
6578
|
+
setFocusedContent("API");
|
|
6579
|
+
}
|
|
6580
|
+
}), /* @__PURE__ */ jsx(Breadcrumb, { items: [
|
|
6581
|
+
{
|
|
6582
|
+
href: "",
|
|
6583
|
+
title: /* @__PURE__ */ jsx("span", { children: selectedApi?.title || "API Name" }),
|
|
6584
|
+
onClick: (e) => {
|
|
6585
|
+
e.preventDefault();
|
|
6586
|
+
setSelectedNodeKey(selectedApi?.id);
|
|
6587
|
+
setFocusedContent("API");
|
|
6588
|
+
}
|
|
6589
|
+
},
|
|
6590
|
+
{
|
|
6591
|
+
href: ``,
|
|
6592
|
+
onClick: (e) => {
|
|
6593
|
+
e.preventDefault();
|
|
6594
|
+
setSelectedNodeKey(selectedApi?.id);
|
|
6595
|
+
setFocusedContent("API");
|
|
6596
|
+
setFocusedTag(selectedEndpoint?.tagName || "default");
|
|
6597
|
+
},
|
|
6598
|
+
title: /* @__PURE__ */ jsx("p", {
|
|
6599
|
+
style: {
|
|
6600
|
+
display: "flex",
|
|
6601
|
+
flexDirection: "row",
|
|
6602
|
+
alignItems: "center",
|
|
6603
|
+
color: token.colorTextTertiary,
|
|
6604
|
+
gap: "0.25rem"
|
|
6605
|
+
},
|
|
6606
|
+
children: /* @__PURE__ */ jsx("span", { children: selectedEndpoint?.tagName || "default" })
|
|
6607
|
+
})
|
|
6608
|
+
},
|
|
6609
|
+
{ title: /* @__PURE__ */ jsx(Tooltip, {
|
|
6610
|
+
title: selectedEndpoint?.summary || "Endpoint Name",
|
|
6611
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
6612
|
+
style: {
|
|
6613
|
+
overflow: "hidden",
|
|
6614
|
+
textOverflow: "ellipsis",
|
|
6615
|
+
whiteSpace: "nowrap",
|
|
6616
|
+
display: "block",
|
|
6617
|
+
maxWidth: "300px"
|
|
6618
|
+
},
|
|
6619
|
+
children: selectedEndpoint?.summary || "Endpoint Name"
|
|
6620
|
+
})
|
|
6621
|
+
}) }
|
|
6622
|
+
] })]
|
|
6623
|
+
}),
|
|
6624
|
+
/* @__PURE__ */ jsxs(Title$1, {
|
|
6625
|
+
level: 3,
|
|
6626
|
+
style: {
|
|
6627
|
+
display: "flex",
|
|
6628
|
+
alignItems: "center",
|
|
6629
|
+
gap: 12,
|
|
6630
|
+
margin: 0
|
|
6631
|
+
},
|
|
6632
|
+
children: [/* @__PURE__ */ jsx(Tag, {
|
|
6633
|
+
style: {
|
|
6634
|
+
backgroundColor: methodStyle?.bg,
|
|
6635
|
+
color: methodStyle?.color,
|
|
6636
|
+
border: "none",
|
|
6637
|
+
width: "4.375rem",
|
|
6638
|
+
height: "1.375rem",
|
|
6639
|
+
textAlign: "center",
|
|
6640
|
+
flexShrink: 0
|
|
6641
|
+
},
|
|
6642
|
+
children: selectedEndpoint?.method
|
|
6643
|
+
}), /* @__PURE__ */ jsx(Tooltip, {
|
|
6644
|
+
title: selectedEndpoint?.summary ?? "--",
|
|
6645
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
6646
|
+
style: {
|
|
6647
|
+
overflow: "hidden",
|
|
6648
|
+
textOverflow: "ellipsis",
|
|
6649
|
+
whiteSpace: "nowrap"
|
|
6650
|
+
},
|
|
6651
|
+
children: selectedEndpoint?.summary?.replace(selectedEndpoint?.method, "") ?? "--"
|
|
6652
|
+
})
|
|
6653
|
+
})]
|
|
6654
|
+
}),
|
|
6655
|
+
/* @__PURE__ */ jsx(Paragraph, {
|
|
6656
|
+
style: {
|
|
6657
|
+
color: token.colorTextTertiary,
|
|
6658
|
+
marginBottom: "1.5rem"
|
|
6659
|
+
},
|
|
6660
|
+
children: selectedEndpoint?.description ?? "--"
|
|
6661
|
+
}),
|
|
6662
|
+
requestTabs.length > 0 && /* @__PURE__ */ jsx(Card, {
|
|
6663
|
+
title: "Request",
|
|
6664
|
+
className: cx("request-card"),
|
|
6665
|
+
style: {
|
|
6666
|
+
marginBottom: "1.5rem",
|
|
6667
|
+
backgroundColor: token.colorBgBase
|
|
6668
|
+
},
|
|
6669
|
+
styles: { body: { backgroundColor: token.colorBgBase } },
|
|
6670
|
+
children: /* @__PURE__ */ jsx(Tabs, {
|
|
6671
|
+
activeKey: activeTabKey,
|
|
6672
|
+
onChange: (key) => {
|
|
6673
|
+
setActiveTabKey(key);
|
|
6674
|
+
setActiveRequestTab(key);
|
|
6675
|
+
},
|
|
6676
|
+
items: requestTabs
|
|
6677
|
+
})
|
|
6678
|
+
}),
|
|
6679
|
+
/* @__PURE__ */ jsx(Card, {
|
|
6680
|
+
title: "Response",
|
|
6681
|
+
className: cx("request-card"),
|
|
6682
|
+
extra: responseHeaderData.length > 0 && /* @__PURE__ */ jsxs(Tag, { children: [/* @__PURE__ */ jsx("span", { style: {
|
|
6683
|
+
background: handleStatusColor(selectedStatusCode),
|
|
6684
|
+
borderRadius: "50%",
|
|
6685
|
+
display: "inline-block",
|
|
6686
|
+
width: "0.5rem",
|
|
6687
|
+
height: "0.5rem",
|
|
6688
|
+
marginRight: "0.5rem"
|
|
6689
|
+
} }), /* @__PURE__ */ jsx("span", { children: selectedStatusCode })] }),
|
|
6690
|
+
children: /* @__PURE__ */ jsx(Table, {
|
|
6691
|
+
columns: responseColumns,
|
|
6692
|
+
dataSource: responseHeaderData,
|
|
6693
|
+
pagination: false,
|
|
6694
|
+
bordered: true,
|
|
6695
|
+
size: "small",
|
|
6696
|
+
rowClassName: (_, idx) => cx(idx % 2 === 0 ? "row-even" : "row-odd")
|
|
6697
|
+
})
|
|
6698
|
+
})
|
|
6699
|
+
]
|
|
6700
|
+
})
|
|
6040
6701
|
});
|
|
6041
|
-
|
|
6042
|
-
|
|
6043
|
-
|
|
6044
|
-
|
|
6045
|
-
|
|
6046
|
-
|
|
6047
|
-
|
|
6048
|
-
|
|
6049
|
-
|
|
6050
|
-
|
|
6051
|
-
|
|
6052
|
-
|
|
6053
|
-
|
|
6054
|
-
|
|
6055
|
-
|
|
6056
|
-
|
|
6057
|
-
|
|
6058
|
-
|
|
6059
|
-
|
|
6060
|
-
|
|
6061
|
-
|
|
6062
|
-
|
|
6063
|
-
|
|
6064
|
-
|
|
6065
|
-
|
|
6066
|
-
|
|
6067
|
-
|
|
6068
|
-
|
|
6069
|
-
|
|
6070
|
-
|
|
6071
|
-
|
|
6072
|
-
|
|
6073
|
-
|
|
6074
|
-
|
|
6075
|
-
|
|
6076
|
-
|
|
6077
|
-
|
|
6078
|
-
|
|
6079
|
-
|
|
6702
|
+
};
|
|
6703
|
+
//#endregion
|
|
6704
|
+
//#region src/view/console/MainContent.tsx
|
|
6705
|
+
const MainContent = ({ searchEnabled, handleResetSearch, handleVisitLandingPage }) => {
|
|
6706
|
+
const { focusedContent, transformedData } = useStore(({ view }) => view);
|
|
6707
|
+
const { wrapSSR, cx, token } = useStyle("MainContent", (token, scope) => ({
|
|
6708
|
+
[scope("inner-doc-container")]: {
|
|
6709
|
+
width: "100%",
|
|
6710
|
+
height: "auto",
|
|
6711
|
+
borderRadius: token.borderRadius,
|
|
6712
|
+
padding: token.paddingXL,
|
|
6713
|
+
overflow: "hidden",
|
|
6714
|
+
minWidth: 0
|
|
6715
|
+
},
|
|
6716
|
+
[scope("centered")]: {
|
|
6717
|
+
display: "flex",
|
|
6718
|
+
justifyContent: "center"
|
|
6719
|
+
},
|
|
6720
|
+
[scope("no-space")]: {
|
|
6721
|
+
margin: 0,
|
|
6722
|
+
padding: 0
|
|
6723
|
+
},
|
|
6724
|
+
[scope("title")]: {
|
|
6725
|
+
fontFamily: token.fontFamily,
|
|
6726
|
+
fontWeight: 600,
|
|
6727
|
+
fontSize: token.fontSizeHeading4,
|
|
6728
|
+
color: token.colorText
|
|
6729
|
+
},
|
|
6730
|
+
[scope("text")]: {
|
|
6731
|
+
color: token.colorText,
|
|
6732
|
+
fontFamily: token.fontFamily
|
|
6733
|
+
},
|
|
6734
|
+
[scope("visit-landing-button")]: {
|
|
6735
|
+
width: "12.25rem",
|
|
6736
|
+
height: "2.5rem",
|
|
6737
|
+
borderRadius: token.borderRadiusLG
|
|
6738
|
+
},
|
|
6739
|
+
[scope("reset-button")]: {
|
|
6740
|
+
width: "8.125rem",
|
|
6741
|
+
height: "2.5rem",
|
|
6742
|
+
borderRadius: token.borderRadiusLG,
|
|
6743
|
+
backgroundColor: token?.Button?.primaryColor,
|
|
6744
|
+
fontSize: token.Button?.contentFontSizeLG
|
|
6080
6745
|
}
|
|
6081
|
-
}
|
|
6082
|
-
|
|
6083
|
-
|
|
6084
|
-
|
|
6085
|
-
|
|
6086
|
-
|
|
6087
|
-
|
|
6088
|
-
|
|
6089
|
-
|
|
6090
|
-
|
|
6091
|
-
|
|
6092
|
-
|
|
6093
|
-
|
|
6094
|
-
|
|
6095
|
-
|
|
6096
|
-
|
|
6097
|
-
|
|
6098
|
-
|
|
6099
|
-
|
|
6100
|
-
|
|
6101
|
-
|
|
6746
|
+
}));
|
|
6747
|
+
return wrapSSR(/* @__PURE__ */ jsx("div", {
|
|
6748
|
+
className: cx("inner-doc-container", !transformedData?.length ? "centered" : ""),
|
|
6749
|
+
style: { backgroundColor: focusedContent === "ENDPOINT" ? token.colorBgBase : token.colorBgElevated },
|
|
6750
|
+
children: !transformedData?.length ? /* @__PURE__ */ jsxs(Flex, {
|
|
6751
|
+
justify: "center",
|
|
6752
|
+
align: "center",
|
|
6753
|
+
gap: "1.5rem",
|
|
6754
|
+
vertical: true,
|
|
6755
|
+
flex: 1,
|
|
6756
|
+
children: [
|
|
6757
|
+
/* @__PURE__ */ jsx(NoDataIcon, {
|
|
6758
|
+
stroke: token.colorPrimaryHover,
|
|
6759
|
+
fill: token.colorPrimaryBg,
|
|
6760
|
+
width: "18.625rem",
|
|
6761
|
+
height: "14.75rem"
|
|
6762
|
+
}),
|
|
6763
|
+
/* @__PURE__ */ jsxs(Flex, {
|
|
6764
|
+
justify: "center",
|
|
6765
|
+
align: "center",
|
|
6766
|
+
gap: "0.5rem",
|
|
6767
|
+
vertical: true,
|
|
6768
|
+
children: [/* @__PURE__ */ jsx(Title, {
|
|
6769
|
+
className: cx("no-space", "title"),
|
|
6770
|
+
level: 4,
|
|
6771
|
+
children: !searchEnabled ? "No API Documentation Found" : "No results found"
|
|
6772
|
+
}), /* @__PURE__ */ jsx(Text, {
|
|
6773
|
+
className: cx("no-space", "text"),
|
|
6774
|
+
children: !searchEnabled ? "No API Documentation has been added yet. Contact admin for support." : "Adjust your Search and try again"
|
|
6775
|
+
})]
|
|
6776
|
+
}),
|
|
6777
|
+
!searchEnabled ? /* @__PURE__ */ jsx(Button, {
|
|
6778
|
+
type: "primary",
|
|
6779
|
+
onClick: handleVisitLandingPage,
|
|
6780
|
+
icon: /* @__PURE__ */ jsx(MouseSquare, {}),
|
|
6781
|
+
iconPosition: "start",
|
|
6782
|
+
className: cx("visit-landing-button"),
|
|
6783
|
+
children: "Visit Landing Page"
|
|
6784
|
+
}) : /* @__PURE__ */ jsx(Button, {
|
|
6785
|
+
type: "default",
|
|
6786
|
+
className: cx("reset-button"),
|
|
6787
|
+
onClick: handleResetSearch,
|
|
6788
|
+
children: "Reset Search"
|
|
6789
|
+
})
|
|
6790
|
+
]
|
|
6791
|
+
}) : focusedContent === "ENDPOINT" ? /* @__PURE__ */ jsx(EndpointPage, {}) : /* @__PURE__ */ jsx(APIPage, {})
|
|
6792
|
+
}));
|
|
6102
6793
|
};
|
|
6103
6794
|
//#endregion
|
|
6104
6795
|
//#region src/assets/copy.tsx
|
|
@@ -6118,9 +6809,9 @@ const Copy = (props) => /* @__PURE__ */ jsxs("svg", {
|
|
|
6118
6809
|
})]
|
|
6119
6810
|
});
|
|
6120
6811
|
//#endregion
|
|
6121
|
-
//#region src/view/
|
|
6812
|
+
//#region src/view/console/EndpointPage/Codebox/Codebox.tsx
|
|
6122
6813
|
Light.registerLanguage("json", json);
|
|
6123
|
-
const Codebox = ({ code, language, wrapLongLines }) => {
|
|
6814
|
+
const Codebox$1 = ({ code, language, wrapLongLines }) => {
|
|
6124
6815
|
const [appTheme] = useState("DARK");
|
|
6125
6816
|
const { token, theme: themeConfig } = theme.useToken();
|
|
6126
6817
|
const bodyBg = themeConfig.id == 1 ? token.colorBgContainer : "#1d2856";
|
|
@@ -6153,8 +6844,8 @@ const Codebox = ({ code, language, wrapLongLines }) => {
|
|
|
6153
6844
|
});
|
|
6154
6845
|
};
|
|
6155
6846
|
//#endregion
|
|
6156
|
-
//#region src/view/
|
|
6157
|
-
function CodeboxSidebar() {
|
|
6847
|
+
//#region src/view/console/CodeboxSidebar.tsx
|
|
6848
|
+
function CodeboxSidebar$1() {
|
|
6158
6849
|
const { selectedEndpoint, selectedApi, activeRequestTab, selectedStatusCode, statusCodeOptions, setSelectedStatusCode } = useStore(({ view }) => view);
|
|
6159
6850
|
const httpStatusOptions = useMemo(() => statusCodeOptions.map((code) => ({
|
|
6160
6851
|
value: code,
|
|
@@ -6194,14 +6885,14 @@ function CodeboxSidebar() {
|
|
|
6194
6885
|
const headerBg = isDark ? antdToken.colorBgElevated : "#1d2856";
|
|
6195
6886
|
const bodyBg = isDark ? antdToken.colorBgContainer : "#1d2856";
|
|
6196
6887
|
const codeTextColor = isDark ? "rgba(255,255,255,0.85)" : "#ffffff";
|
|
6197
|
-
const { cx } = useStyle("CodeboxSidebar", (token$
|
|
6888
|
+
const { cx } = useStyle("CodeboxSidebar", (token$2, scope) => ({
|
|
6198
6889
|
[scope("container")]: {
|
|
6199
6890
|
display: "flex",
|
|
6200
6891
|
flexDirection: "column",
|
|
6201
|
-
gap: token$
|
|
6202
|
-
background: token$
|
|
6203
|
-
borderRadius: token$
|
|
6204
|
-
padding: token$
|
|
6892
|
+
gap: token$2.marginMD,
|
|
6893
|
+
background: token$2.colorBgElevated,
|
|
6894
|
+
borderRadius: token$2.borderRadiusLG,
|
|
6895
|
+
padding: token$2.paddingLG,
|
|
6205
6896
|
height: "auto",
|
|
6206
6897
|
width: "23.625rem",
|
|
6207
6898
|
minWidth: "23.625rem",
|
|
@@ -6213,24 +6904,24 @@ function CodeboxSidebar() {
|
|
|
6213
6904
|
display: "flex",
|
|
6214
6905
|
flexDirection: "column",
|
|
6215
6906
|
backgroundColor: headerBg,
|
|
6216
|
-
border: `1px solid ${token$
|
|
6907
|
+
border: `1px solid ${token$2.colorBorder}`,
|
|
6217
6908
|
".CodeboxSidebar-copyButton": { ".isolated-btn-icon": { path: { fill: "white" } } },
|
|
6218
6909
|
".isolated-card-body": {
|
|
6219
6910
|
padding: " .125rem 0 0 0 !important",
|
|
6220
6911
|
borderTop: ".125rem solid #33419A"
|
|
6221
6912
|
},
|
|
6222
6913
|
".ant-card-head": { flex: "0 0 auto" },
|
|
6223
|
-
borderRadius: token$
|
|
6914
|
+
borderRadius: token$2.borderRadius,
|
|
6224
6915
|
overflow: "hidden"
|
|
6225
6916
|
},
|
|
6226
6917
|
[scope("rightCardRequest")]: { minHeight: "8.125rem" },
|
|
6227
|
-
[scope("rightCardHeaderResponse")]: { padding: `0 ${token$
|
|
6918
|
+
[scope("rightCardHeaderResponse")]: { padding: `0 ${token$2.margin}px ${token$2.marginXS}px ${token$2.margin}px` },
|
|
6228
6919
|
[scope("rightCardResponse")]: {
|
|
6229
6920
|
height: "fit-content",
|
|
6230
6921
|
overflow: "hidden",
|
|
6231
6922
|
".isolated-card-body": {
|
|
6232
6923
|
display: "flex",
|
|
6233
|
-
padding: `0 ${token$
|
|
6924
|
+
padding: `0 ${token$2.margin}px`,
|
|
6234
6925
|
flexDirection: "column",
|
|
6235
6926
|
alignItems: "flex-start",
|
|
6236
6927
|
gap: "10px",
|
|
@@ -6241,8 +6932,8 @@ function CodeboxSidebar() {
|
|
|
6241
6932
|
display: "flex",
|
|
6242
6933
|
alignItems: "center",
|
|
6243
6934
|
justifyContent: "space-between",
|
|
6244
|
-
padding: `${token$
|
|
6245
|
-
borderBottom: `1px solid ${token$
|
|
6935
|
+
padding: `${token$2.marginXS}px ${token$2.margin}px`,
|
|
6936
|
+
borderBottom: `1px solid ${token$2.colorBorderSecondary}`,
|
|
6246
6937
|
height: "3.125rem",
|
|
6247
6938
|
backgroundColor: headerBg
|
|
6248
6939
|
},
|
|
@@ -6359,13 +7050,97 @@ function CodeboxSidebar() {
|
|
|
6359
7050
|
open: httpStatusOptions.length === 1 ? false : void 0,
|
|
6360
7051
|
suffixIcon: httpStatusOptions.length > 1 ? void 0 : false
|
|
6361
7052
|
})]
|
|
6362
|
-
}), /* @__PURE__ */ jsx(Codebox, { code: JSON.stringify(selectedEndpoint?.responses[selectedStatusCode], null, 2) || "" })]
|
|
7053
|
+
}), /* @__PURE__ */ jsx(Codebox$1, { code: JSON.stringify(selectedEndpoint?.responses[selectedStatusCode], null, 2) || "" })]
|
|
6363
7054
|
})]
|
|
6364
7055
|
});
|
|
6365
|
-
}
|
|
7056
|
+
}
|
|
7057
|
+
//#endregion
|
|
7058
|
+
//#region src/view/helper/mutate.ts
|
|
7059
|
+
const resolveSchema = (schema, components) => {
|
|
7060
|
+
if (!schema) return void 0;
|
|
7061
|
+
if (!schema.$ref) return schema;
|
|
7062
|
+
const refName = schema.$ref.split("/").pop();
|
|
7063
|
+
const resolved = components?.schemas?.[refName];
|
|
7064
|
+
if (!resolved) return schema;
|
|
7065
|
+
return resolveSchema(resolved, components);
|
|
7066
|
+
};
|
|
7067
|
+
const transformOpenApiToDocs = (api) => {
|
|
7068
|
+
const groupedPathsByTags = {};
|
|
7069
|
+
const validTags = new Set(api?.tags?.map(({ name }) => name) || []);
|
|
7070
|
+
const contextPath = Object.keys(api.paths)[0];
|
|
7071
|
+
const relatedVersions = "x-related-versions" in api ? Object.entries(api["x-related-versions"]).map(([apiId, version]) => ({
|
|
7072
|
+
apiId,
|
|
7073
|
+
version
|
|
7074
|
+
})) : [];
|
|
7075
|
+
relatedVersions.unshift({
|
|
7076
|
+
apiId: api["x-current-version"],
|
|
7077
|
+
version: `${api.info.version}`
|
|
7078
|
+
});
|
|
7079
|
+
const currentVersion = "x-current-version" in api ? api["x-current-version"] : "";
|
|
7080
|
+
const authScheme = api.components?.securitySchemes;
|
|
7081
|
+
let authType;
|
|
7082
|
+
if (authScheme && Object.keys(authScheme)?.[0]) {
|
|
7083
|
+
authType = Object.keys(authScheme)[0];
|
|
7084
|
+
if (authType && authType.toLowerCase() === "public") authType = "KEYLESS";
|
|
7085
|
+
if (authType && (authType.toLowerCase() === "oauth" || authType.toLowerCase() === "oauth2")) authType = "OAUTH2";
|
|
7086
|
+
authType = authType.toUpperCase();
|
|
7087
|
+
} else authType = "x-auth-type" in api ? api["x-auth-type"] : "";
|
|
7088
|
+
const curl = "x-curls" in api ? api["x-curls"] : "";
|
|
7089
|
+
const jwsEnabled = api["x-jws-enabled"] === true;
|
|
7090
|
+
for (const [path, methods] of Object.entries(api.paths)) for (const [method, methodData] of Object.entries(methods)) {
|
|
7091
|
+
const entry = {
|
|
7092
|
+
...methodData,
|
|
7093
|
+
method: method?.toUpperCase(),
|
|
7094
|
+
path
|
|
7095
|
+
};
|
|
7096
|
+
if (entry.requestBody?.content) {
|
|
7097
|
+
const resolvedContent = {};
|
|
7098
|
+
for (const [contentType, contentValue] of Object.entries(entry.requestBody.content)) resolvedContent[contentType] = { schema: resolveSchema(contentValue.schema, api.components) ?? contentValue.schema };
|
|
7099
|
+
entry.requestBody = {
|
|
7100
|
+
...entry.requestBody,
|
|
7101
|
+
content: resolvedContent
|
|
7102
|
+
};
|
|
7103
|
+
}
|
|
7104
|
+
const matchedTags = (methodData.tags ?? []).filter((tag) => validTags.has(tag));
|
|
7105
|
+
if (matchedTags.length > 0) matchedTags.forEach((tag) => {
|
|
7106
|
+
if (!groupedPathsByTags[tag]) groupedPathsByTags[tag] = [];
|
|
7107
|
+
groupedPathsByTags[tag].push({
|
|
7108
|
+
...entry,
|
|
7109
|
+
id: `endpoint-${nanoid(8)}`
|
|
7110
|
+
});
|
|
7111
|
+
});
|
|
7112
|
+
else {
|
|
7113
|
+
if (!groupedPathsByTags.default) groupedPathsByTags.default = [];
|
|
7114
|
+
groupedPathsByTags.default.push({
|
|
7115
|
+
...entry,
|
|
7116
|
+
id: `endpoint-${nanoid(8)}`
|
|
7117
|
+
});
|
|
7118
|
+
}
|
|
7119
|
+
}
|
|
7120
|
+
const sortedGroupedPathsByTags = Object.keys(groupedPathsByTags).sort((a, b) => {
|
|
7121
|
+
if (a === "default") return 1;
|
|
7122
|
+
if (b === "default") return -1;
|
|
7123
|
+
return a.localeCompare(b);
|
|
7124
|
+
}).reduce((acc, key) => {
|
|
7125
|
+
acc[key] = groupedPathsByTags[key];
|
|
7126
|
+
return acc;
|
|
7127
|
+
}, {});
|
|
7128
|
+
return {
|
|
7129
|
+
...api.info,
|
|
7130
|
+
id: `api-${nanoid(8)}`,
|
|
7131
|
+
contextPath,
|
|
7132
|
+
tags: sortedGroupedPathsByTags,
|
|
7133
|
+
servers: api.servers,
|
|
7134
|
+
relatedVersions,
|
|
7135
|
+
currentVersion,
|
|
7136
|
+
authType,
|
|
7137
|
+
jwsEnabled,
|
|
7138
|
+
curl
|
|
7139
|
+
};
|
|
7140
|
+
};
|
|
6366
7141
|
//#endregion
|
|
6367
7142
|
//#region src/view/layout.tsx
|
|
6368
|
-
const
|
|
7143
|
+
const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPage, onSave }) => {
|
|
6369
7144
|
const [searchValue, setSearchValue] = useState("");
|
|
6370
7145
|
const [mode, setMode] = useState("edit");
|
|
6371
7146
|
const [hasChanges, setHasChanges] = useState(false);
|
|
@@ -7006,7 +7781,7 @@ const DocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPage, onS
|
|
|
7006
7781
|
handleResetSearch,
|
|
7007
7782
|
searchEnabled: !!searchValue
|
|
7008
7783
|
}),
|
|
7009
|
-
!isMobile && focusedContent === "ENDPOINT" && /* @__PURE__ */ jsx(CodeboxSidebar, {})
|
|
7784
|
+
!isMobile && focusedContent === "ENDPOINT" && /* @__PURE__ */ jsx(CodeboxSidebar$1, {})
|
|
7010
7785
|
]
|
|
7011
7786
|
}),
|
|
7012
7787
|
/* @__PURE__ */ jsx(AddTagDrawer, {
|
|
@@ -7107,8 +7882,234 @@ const DocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPage, onS
|
|
|
7107
7882
|
});
|
|
7108
7883
|
};
|
|
7109
7884
|
//#endregion
|
|
7885
|
+
//#region src/view/components/EndpointPage/Codebox/Codebox.tsx
|
|
7886
|
+
Light.registerLanguage("json", json);
|
|
7887
|
+
const Codebox = ({ code, language }) => {
|
|
7888
|
+
const [theme] = useState("DARK");
|
|
7889
|
+
const { cx } = useStyle("codeBox", (token, scope) => ({ [scope("codebox")]: {
|
|
7890
|
+
borderRadius: token.borderRadius,
|
|
7891
|
+
height: "100%",
|
|
7892
|
+
maxHeight: "100%",
|
|
7893
|
+
overflow: "auto",
|
|
7894
|
+
pre: { height: "100%" }
|
|
7895
|
+
} }));
|
|
7896
|
+
return /* @__PURE__ */ jsx("div", {
|
|
7897
|
+
className: cx("codebox"),
|
|
7898
|
+
children: /* @__PURE__ */ jsx(Light, {
|
|
7899
|
+
language: language || "json",
|
|
7900
|
+
style: theme === "LIGHT" ? hljs.stackoverflowLight : hljs.stackoverflowDark,
|
|
7901
|
+
showLineNumbers: true,
|
|
7902
|
+
wrapLines: true,
|
|
7903
|
+
customStyle: {
|
|
7904
|
+
margin: 0,
|
|
7905
|
+
minHeight: "3rem",
|
|
7906
|
+
overflowY: "auto",
|
|
7907
|
+
padding: "0.75rem 1rem 0.75rem 1.5rem",
|
|
7908
|
+
backgroundColor: theme === "DARK" ? "#20264B" : "#20264B",
|
|
7909
|
+
fontSize: "0.75rem"
|
|
7910
|
+
},
|
|
7911
|
+
lineProps: { style: { fontFamily: "Cascadia Code, sans-serif" } },
|
|
7912
|
+
children: code
|
|
7913
|
+
})
|
|
7914
|
+
});
|
|
7915
|
+
};
|
|
7916
|
+
//#endregion
|
|
7917
|
+
//#region src/view/components/CodeboxSidebar.tsx
|
|
7918
|
+
function CodeboxSidebar() {
|
|
7919
|
+
const { selectedEndpoint, selectedStatusCode, statusCodeOptions, setSelectedStatusCode } = useStore(({ view }) => view);
|
|
7920
|
+
const httpStatusOptions = useMemo(() => statusCodeOptions.map((code) => ({
|
|
7921
|
+
value: code,
|
|
7922
|
+
label: /* @__PURE__ */ jsxs("span", {
|
|
7923
|
+
style: {
|
|
7924
|
+
display: "flex",
|
|
7925
|
+
alignItems: "center",
|
|
7926
|
+
gap: "0.5rem"
|
|
7927
|
+
},
|
|
7928
|
+
children: [/* @__PURE__ */ jsx("span", { style: {
|
|
7929
|
+
background: handleStatusColor(code),
|
|
7930
|
+
borderRadius: "50%",
|
|
7931
|
+
display: "inline-block",
|
|
7932
|
+
width: "0.5rem",
|
|
7933
|
+
height: "0.5rem",
|
|
7934
|
+
minWidth: "0.5rem",
|
|
7935
|
+
minHeight: "0.5rem"
|
|
7936
|
+
} }), code]
|
|
7937
|
+
})
|
|
7938
|
+
})), [statusCodeOptions]);
|
|
7939
|
+
const { originalData } = useStore(({ view }) => view);
|
|
7940
|
+
const [curlTooltip, setCurlTooltip] = useState("Copy Request");
|
|
7941
|
+
const findCurlForEndpoint = () => {
|
|
7942
|
+
if (!selectedEndpoint || !originalData) return "";
|
|
7943
|
+
const api = originalData.find((apiData) => {
|
|
7944
|
+
const paths = apiData.paths || {};
|
|
7945
|
+
return Object.keys(paths).some((path) => {
|
|
7946
|
+
const methods = paths[path] || {};
|
|
7947
|
+
return Object.keys(methods).some((method) => {
|
|
7948
|
+
const endpointMethod = method.toUpperCase();
|
|
7949
|
+
return path === selectedEndpoint.path && endpointMethod === selectedEndpoint.method;
|
|
7950
|
+
});
|
|
7951
|
+
});
|
|
7952
|
+
});
|
|
7953
|
+
if (!api || !api["x-curls"]) return "";
|
|
7954
|
+
const matchingCurls = api["x-curls"].filter((curlObj) => curlObj.path === selectedEndpoint.path && curlObj.method === selectedEndpoint.method);
|
|
7955
|
+
const sdbCurl = matchingCurls.find((curl) => curl.serverUrl.includes("sdb") || curl.serverUrl.includes("SDB"));
|
|
7956
|
+
return sdbCurl ? sdbCurl.curlCommand : matchingCurls[0]?.curlCommand || "";
|
|
7957
|
+
};
|
|
7958
|
+
const curlCommand = findCurlForEndpoint();
|
|
7959
|
+
const formatCurlCommand = (cmd) => {
|
|
7960
|
+
if (!cmd) return "";
|
|
7961
|
+
return cmd.replace(/ -X /g, " \\\n -X ").replace(/ -H /g, " \\\n -H ").replace(/ -d /g, " \\\n -d ").replace(/ (https?:\/\/[^\s'"]+)/g, " \\\n $1");
|
|
7962
|
+
};
|
|
7963
|
+
const { cx } = useStyle("CodeboxSidebar", (token$1, scope) => ({
|
|
7964
|
+
[scope("container")]: {
|
|
7965
|
+
display: "flex",
|
|
7966
|
+
flexDirection: "column",
|
|
7967
|
+
gap: token$1.marginMD,
|
|
7968
|
+
background: token$1.colorBgContainer,
|
|
7969
|
+
borderRadius: token$1.borderRadiusLG,
|
|
7970
|
+
padding: token$1.paddingLG,
|
|
7971
|
+
overflow: "hidden",
|
|
7972
|
+
height: "100%",
|
|
7973
|
+
maxHeight: "100%",
|
|
7974
|
+
width: "23.625rem",
|
|
7975
|
+
minWidth: "23.625rem",
|
|
7976
|
+
".ant-card-body": { padding: 0 },
|
|
7977
|
+
".ant-card-head-title": { color: "white" },
|
|
7978
|
+
".ant-card-head": { borderBottom: ".125rem solid #33419A" }
|
|
7979
|
+
},
|
|
7980
|
+
[scope("rightCard")]: {
|
|
7981
|
+
display: "flex",
|
|
7982
|
+
flexDirection: "column",
|
|
7983
|
+
backgroundColor: "#20264B",
|
|
7984
|
+
".CodeboxSidebar-copyButton": { ".isolated-btn-icon": { path: { fill: "white" } } },
|
|
7985
|
+
".isolated-card-body": {
|
|
7986
|
+
padding: " .125rem 0 0 0 !important",
|
|
7987
|
+
borderTop: ".125rem solid #33419A"
|
|
7988
|
+
},
|
|
7989
|
+
".ant-card-head": { flex: "0 0 auto" },
|
|
7990
|
+
borderRadius: token$1.borderRadius,
|
|
7991
|
+
overflow: "hidden"
|
|
7992
|
+
},
|
|
7993
|
+
[scope("rightCardRequest")]: {
|
|
7994
|
+
maxHeight: "50%",
|
|
7995
|
+
minHeight: "8.125rem"
|
|
7996
|
+
},
|
|
7997
|
+
[scope("rightCardResponse")]: {
|
|
7998
|
+
height: "fit-content",
|
|
7999
|
+
overflow: "hidden"
|
|
8000
|
+
},
|
|
8001
|
+
[scope("rightCardHeader")]: {
|
|
8002
|
+
display: "flex",
|
|
8003
|
+
alignItems: "center",
|
|
8004
|
+
justifyContent: "space-between",
|
|
8005
|
+
padding: `${token$1.marginXS}px ${token$1.margin}px`,
|
|
8006
|
+
borderBottom: ".125rem solid #33419A",
|
|
8007
|
+
height: "3.125rem"
|
|
8008
|
+
},
|
|
8009
|
+
[scope("rightCardFlex")]: {
|
|
8010
|
+
display: "flex",
|
|
8011
|
+
flexDirection: "column",
|
|
8012
|
+
height: "fit-content",
|
|
8013
|
+
overflow: "auto",
|
|
8014
|
+
backgroundColor: "#20264B",
|
|
8015
|
+
".ant-card-head": { flex: "0 0 auto" },
|
|
8016
|
+
".ant-card-body": {
|
|
8017
|
+
flex: "1 1 auto",
|
|
8018
|
+
overflowY: "auto",
|
|
8019
|
+
padding: ".125rem 0 0 0 !important"
|
|
8020
|
+
},
|
|
8021
|
+
".isolated-card-body": {
|
|
8022
|
+
padding: " .125rem 0 0 0 !important",
|
|
8023
|
+
height: "fit-content",
|
|
8024
|
+
overflow: "auto",
|
|
8025
|
+
borderTop: ".125rem solid #33419A",
|
|
8026
|
+
".codebox": {
|
|
8027
|
+
height: "fit-content",
|
|
8028
|
+
overflow: "auto"
|
|
8029
|
+
}
|
|
8030
|
+
}
|
|
8031
|
+
},
|
|
8032
|
+
[scope("customSelect")]: {
|
|
8033
|
+
width: "5.5rem",
|
|
8034
|
+
maxWidth: "5.5rem",
|
|
8035
|
+
".ant-select-selector": {
|
|
8036
|
+
backgroundColor: "#fff",
|
|
8037
|
+
borderColor: "#fff",
|
|
8038
|
+
borderRadius: ".375rem",
|
|
8039
|
+
color: "#101010"
|
|
8040
|
+
},
|
|
8041
|
+
".ant-select-selection-item": {
|
|
8042
|
+
color: "#101010",
|
|
8043
|
+
fontWeight: 400
|
|
8044
|
+
},
|
|
8045
|
+
".ant-select-selection-placeholder": { color: "rgba(255, 255, 255, 0.65)" },
|
|
8046
|
+
".ant-select-arrow": { color: "#101010" },
|
|
8047
|
+
"&:hover .ant-select-selector": {
|
|
8048
|
+
borderColor: `${token["brnadColor.7"]}`,
|
|
8049
|
+
color: "white"
|
|
8050
|
+
},
|
|
8051
|
+
"&:focus .ant-select-selector, &.ant-select-focused .ant-select-selector": {
|
|
8052
|
+
borderColor: `${token["brnadColor.7"]}`,
|
|
8053
|
+
color: "white"
|
|
8054
|
+
}
|
|
8055
|
+
}
|
|
8056
|
+
}));
|
|
8057
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
8058
|
+
className: cx("container"),
|
|
8059
|
+
children: [curlCommand && /* @__PURE__ */ jsxs("div", {
|
|
8060
|
+
className: cx("rightCard", "rightCardRequest"),
|
|
8061
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
8062
|
+
className: cx("rightCardHeader"),
|
|
8063
|
+
children: [/* @__PURE__ */ jsx(Typography.Text, {
|
|
8064
|
+
strong: true,
|
|
8065
|
+
style: { color: "#fff" },
|
|
8066
|
+
children: "Request"
|
|
8067
|
+
}), /* @__PURE__ */ jsx(Tooltip, {
|
|
8068
|
+
title: curlTooltip,
|
|
8069
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
8070
|
+
color: "default",
|
|
8071
|
+
variant: "link",
|
|
8072
|
+
className: cx("copyButton"),
|
|
8073
|
+
onClick: () => {
|
|
8074
|
+
const cleaned = curlCommand.replace(/\\"/g, "\"").replace(/\\\\/g, "\\");
|
|
8075
|
+
navigator.clipboard.writeText(formatCurlCommand(cleaned));
|
|
8076
|
+
setCurlTooltip("Copied!");
|
|
8077
|
+
setTimeout(() => setCurlTooltip("Copy cURL"), 1500);
|
|
8078
|
+
},
|
|
8079
|
+
icon: /* @__PURE__ */ jsx(Copy, { style: { color: "white" } })
|
|
8080
|
+
})
|
|
8081
|
+
})]
|
|
8082
|
+
}), /* @__PURE__ */ jsx(Codebox, {
|
|
8083
|
+
language: "bash",
|
|
8084
|
+
code: formatCurlCommand(curlCommand.replace(/\\"/g, "\"").replace(/\\\\/g, "\\"))
|
|
8085
|
+
})]
|
|
8086
|
+
}), selectedEndpoint?.responses && httpStatusOptions.length > 0 && /* @__PURE__ */ jsxs("div", {
|
|
8087
|
+
className: cx("rightCard", "rightCardResponse"),
|
|
8088
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
8089
|
+
className: cx("rightCardHeader", "rightCardHeaderResponse"),
|
|
8090
|
+
children: [/* @__PURE__ */ jsx(Typography.Text, {
|
|
8091
|
+
strong: true,
|
|
8092
|
+
style: { color: "#fff" },
|
|
8093
|
+
children: "Response"
|
|
8094
|
+
}), /* @__PURE__ */ jsx(Select, {
|
|
8095
|
+
defaultActiveFirstOption: true,
|
|
8096
|
+
defaultValue: 200,
|
|
8097
|
+
className: cx("customSelect"),
|
|
8098
|
+
prefix: false,
|
|
8099
|
+
style: { width: "100%" },
|
|
8100
|
+
value: selectedStatusCode,
|
|
8101
|
+
onChange: setSelectedStatusCode,
|
|
8102
|
+
options: httpStatusOptions,
|
|
8103
|
+
open: httpStatusOptions.length === 1 ? false : void 0,
|
|
8104
|
+
suffixIcon: httpStatusOptions.length > 1 ? void 0 : false
|
|
8105
|
+
})]
|
|
8106
|
+
}), /* @__PURE__ */ jsx(Codebox, { code: JSON.stringify(selectedEndpoint?.responses[selectedStatusCode], null, 2) || "" })]
|
|
8107
|
+
})]
|
|
8108
|
+
});
|
|
8109
|
+
}
|
|
8110
|
+
//#endregion
|
|
7110
8111
|
//#region src/view/devportal-layout.tsx
|
|
7111
|
-
const
|
|
8112
|
+
const DocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPage }) => {
|
|
7112
8113
|
const [searchValue, setSearchValue] = useState("");
|
|
7113
8114
|
const { focusedContent, selectedNodeKey, selectedApi, builtTreeData, setOriginalData, setTransformedData, setBuiltTreeData, setFocusedContent, setExpandedKeys } = useStore(({ view }) => view);
|
|
7114
8115
|
const { selectFirstApi, selectPreSelectedApi, clearSelection } = useNodeSelection();
|
|
@@ -7133,7 +8134,7 @@ const DevportalDocumentationLayout = ({ data, preSelectedApi, handleVisitLanding
|
|
|
7133
8134
|
setOriginalData(data);
|
|
7134
8135
|
const transformedData = data.map(transformOpenApiToDocs).sort((a, b) => a.title.localeCompare(b.title));
|
|
7135
8136
|
setTransformedData(transformedData);
|
|
7136
|
-
setBuiltTreeData(buildTreeDataStructure(transformedData));
|
|
8137
|
+
setBuiltTreeData(buildTreeDataStructure$1(transformedData));
|
|
7137
8138
|
hasInitializedRef.current = true;
|
|
7138
8139
|
}
|
|
7139
8140
|
}, [
|
|
@@ -7187,11 +8188,11 @@ const DevportalDocumentationLayout = ({ data, preSelectedApi, handleVisitLanding
|
|
|
7187
8188
|
children: /* @__PURE__ */ jsxs("div", {
|
|
7188
8189
|
className: cx("docs-layout"),
|
|
7189
8190
|
children: [
|
|
7190
|
-
/* @__PURE__ */ jsx(Sidebar, {
|
|
8191
|
+
/* @__PURE__ */ jsx(Sidebar$1, {
|
|
7191
8192
|
searchValue,
|
|
7192
8193
|
setSearchValue
|
|
7193
8194
|
}),
|
|
7194
|
-
/* @__PURE__ */ jsx(MainContent, {
|
|
8195
|
+
/* @__PURE__ */ jsx(MainContent$1, {
|
|
7195
8196
|
handleVisitLandingPage: _handleVisitLandingPage,
|
|
7196
8197
|
handleResetSearch,
|
|
7197
8198
|
searchEnabled: !!searchValue
|
|
@@ -7202,6 +8203,6 @@ const DevportalDocumentationLayout = ({ data, preSelectedApi, handleVisitLanding
|
|
|
7202
8203
|
});
|
|
7203
8204
|
};
|
|
7204
8205
|
//#endregion
|
|
7205
|
-
export { ApiDocumentationBar,
|
|
8206
|
+
export { ApiDocumentationBar, ConsoleDocumentationLayout, DocumentationLayout, useStore };
|
|
7206
8207
|
|
|
7207
8208
|
//# sourceMappingURL=index.mjs.map
|