@digi-frontend/dgate-api-documentation 2.0.1-test.1 → 2.0.1-test.11
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 +579 -380
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +50 -46
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +50 -46
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +598 -381
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -5,6 +5,15 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __esm = (fn, res) => function() {
|
|
9
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
10
|
+
};
|
|
11
|
+
var __export = (target, all) => {
|
|
12
|
+
for (var name in all) __defProp(target, name, {
|
|
13
|
+
get: all[name],
|
|
14
|
+
enumerable: true
|
|
15
|
+
});
|
|
16
|
+
};
|
|
8
17
|
var __copyProps = (to, from, except, desc) => {
|
|
9
18
|
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
19
|
key = keys[i];
|
|
@@ -19,6 +28,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
19
28
|
value: mod,
|
|
20
29
|
enumerable: true
|
|
21
30
|
}) : target, mod));
|
|
31
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
32
|
|
|
23
33
|
//#endregion
|
|
24
34
|
const zustand = __toESM(require("zustand"));
|
|
@@ -35,8 +45,8 @@ const __ant_design_nextjs_registry = __toESM(require("@ant-design/nextjs-registr
|
|
|
35
45
|
const createViewSlice = (set) => ({ view: {
|
|
36
46
|
selectedNodeKey: null,
|
|
37
47
|
expandedKeys: ["custom-auth", "api-name-01"],
|
|
38
|
-
originalData:
|
|
39
|
-
transformedData:
|
|
48
|
+
originalData: [],
|
|
49
|
+
transformedData: [],
|
|
40
50
|
selectedApi: null,
|
|
41
51
|
selectedEndpoint: null,
|
|
42
52
|
setSelectedNode: (key) => set((state) => {
|
|
@@ -112,6 +122,7 @@ const createStore = (set) => ({
|
|
|
112
122
|
...createEditorSlice(set)
|
|
113
123
|
});
|
|
114
124
|
const useStore = (0, zustand.create)()((0, zustand_middleware.devtools)((0, zustand_middleware_immer.immer)(createStore), { name: "dgate-docs-store" }));
|
|
125
|
+
var store_default = useStore;
|
|
115
126
|
|
|
116
127
|
//#endregion
|
|
117
128
|
//#region src/hooks/useStyle.ts
|
|
@@ -503,391 +514,563 @@ var token = {
|
|
|
503
514
|
|
|
504
515
|
//#endregion
|
|
505
516
|
//#region src/view/helper/sidebar.utils.ts
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
const buildTreeDataStructure = (data) => {
|
|
541
|
-
if (!data) return [];
|
|
542
|
-
return data.map((api) => {
|
|
543
|
-
return {
|
|
544
|
-
title: api.title,
|
|
545
|
-
key: api.id,
|
|
546
|
-
selectable: true,
|
|
547
|
-
data: api,
|
|
548
|
-
children: Object.entries(api.tags).map(([tag, endpoints]) => {
|
|
549
|
-
const tagId = `tag-${(0, nanoid.nanoid)(8)}`;
|
|
550
|
-
return {
|
|
551
|
-
title: tag,
|
|
552
|
-
key: tagId,
|
|
553
|
-
selectable: false,
|
|
554
|
-
data: {
|
|
555
|
-
tagName: tag,
|
|
556
|
-
apiData: api
|
|
557
|
-
},
|
|
558
|
-
children: endpoints.map((endpoint) => {
|
|
559
|
-
return {
|
|
560
|
-
title: endpoint.summary,
|
|
561
|
-
key: endpoint.id,
|
|
562
|
-
isLeaf: true,
|
|
563
|
-
selectable: true,
|
|
564
|
-
method: endpoint.method,
|
|
565
|
-
data: {
|
|
566
|
-
endpoint,
|
|
567
|
-
api,
|
|
568
|
-
tagName: tag
|
|
569
|
-
}
|
|
570
|
-
};
|
|
571
|
-
})
|
|
572
|
-
};
|
|
573
|
-
})
|
|
574
|
-
};
|
|
575
|
-
});
|
|
576
|
-
};
|
|
577
|
-
const findNodeByKey = (nodes, targetKey) => {
|
|
578
|
-
for (const node of nodes) {
|
|
579
|
-
if (node.key === targetKey) return node;
|
|
580
|
-
if (node.children && node.children.length > 0) {
|
|
581
|
-
const found = findNodeByKey(node.children, targetKey);
|
|
582
|
-
if (found) return found;
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
return null;
|
|
586
|
-
};
|
|
587
|
-
const isApiSectionHighlighted = (apiKey, selectedNode, treeDataStructure) => {
|
|
588
|
-
if (!selectedNode || selectedNode.length === 0) return false;
|
|
589
|
-
const selectedKey = selectedNode[0];
|
|
590
|
-
if (selectedKey === apiKey) return false;
|
|
591
|
-
const findNodeParentApi = (nodes, targetKey) => {
|
|
592
|
-
for (const node of nodes) if (node.data && "id" in node.data && "tags" in node.data && !("endpoint" in node.data) && !("tagName" in node.data)) {
|
|
593
|
-
const apiId = node.key;
|
|
594
|
-
if (node.children) for (const child of node.children) {
|
|
595
|
-
if (child.key === targetKey) return apiId;
|
|
596
|
-
if (child.children) {
|
|
597
|
-
for (const grandChild of child.children) if (grandChild.key === targetKey) return apiId;
|
|
598
|
-
}
|
|
599
|
-
}
|
|
517
|
+
var methodColors, buildTreeDataStructure, findNodeByKey, isApiSectionHighlighted, getAllTreeKeys, filterTreeData, getParentKey, getSidebarStyles;
|
|
518
|
+
var init_sidebar_utils = __esm({ "src/view/helper/sidebar.utils.ts": (() => {
|
|
519
|
+
methodColors = {
|
|
520
|
+
GET: {
|
|
521
|
+
bg: token.colorPrimaryBgHover,
|
|
522
|
+
color: token.colorPrimary
|
|
523
|
+
},
|
|
524
|
+
POST: {
|
|
525
|
+
bg: token["green.1"],
|
|
526
|
+
color: token.colorSuccess
|
|
527
|
+
},
|
|
528
|
+
DELETE: {
|
|
529
|
+
bg: token.colorErrorBg,
|
|
530
|
+
color: token.colorError
|
|
531
|
+
},
|
|
532
|
+
PUT: {
|
|
533
|
+
bg: token.colorWarningBg,
|
|
534
|
+
color: token.colorWarning
|
|
535
|
+
},
|
|
536
|
+
PATCH: {
|
|
537
|
+
bg: token["volcano.5"],
|
|
538
|
+
color: token.colorWhite
|
|
539
|
+
},
|
|
540
|
+
OPTIONS: {
|
|
541
|
+
bg: token["geekblue.2"],
|
|
542
|
+
color: token["geekblue.6"]
|
|
543
|
+
},
|
|
544
|
+
HEAD: {
|
|
545
|
+
bg: token["purple.1"],
|
|
546
|
+
color: token["purple.5"]
|
|
547
|
+
},
|
|
548
|
+
TRACE: {
|
|
549
|
+
bg: token["cyan.1"],
|
|
550
|
+
color: token["cyan.5"]
|
|
600
551
|
}
|
|
601
|
-
return null;
|
|
602
552
|
};
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
553
|
+
buildTreeDataStructure = (data) => {
|
|
554
|
+
if (!data) return [];
|
|
555
|
+
return data.map((api) => {
|
|
556
|
+
return {
|
|
557
|
+
title: api.title,
|
|
558
|
+
key: api.id,
|
|
559
|
+
selectable: true,
|
|
560
|
+
data: api,
|
|
561
|
+
children: Object.entries(api.tags).map(([tag, endpoints]) => {
|
|
562
|
+
const tagId = `tag-${(0, nanoid.nanoid)(8)}`;
|
|
563
|
+
return {
|
|
564
|
+
title: tag,
|
|
565
|
+
key: tagId,
|
|
566
|
+
selectable: false,
|
|
567
|
+
data: {
|
|
568
|
+
tagName: tag,
|
|
569
|
+
apiData: api
|
|
570
|
+
},
|
|
571
|
+
children: endpoints.map((endpoint) => {
|
|
572
|
+
return {
|
|
573
|
+
title: endpoint.summary,
|
|
574
|
+
key: endpoint.id,
|
|
575
|
+
isLeaf: true,
|
|
576
|
+
selectable: true,
|
|
577
|
+
method: endpoint.method,
|
|
578
|
+
data: {
|
|
579
|
+
endpoint,
|
|
580
|
+
api,
|
|
581
|
+
tagName: tag
|
|
582
|
+
}
|
|
583
|
+
};
|
|
584
|
+
})
|
|
585
|
+
};
|
|
586
|
+
})
|
|
587
|
+
};
|
|
612
588
|
});
|
|
613
589
|
};
|
|
614
|
-
|
|
615
|
-
return keys;
|
|
616
|
-
};
|
|
617
|
-
const filterTreeData = (data, searchText) => {
|
|
618
|
-
if (!searchText) return data;
|
|
619
|
-
const findOriginalNode = (nodes, key) => {
|
|
590
|
+
findNodeByKey = (nodes, targetKey) => {
|
|
620
591
|
for (const node of nodes) {
|
|
621
|
-
if (node.key ===
|
|
622
|
-
if (node.children) {
|
|
623
|
-
const found =
|
|
592
|
+
if (node.key === targetKey) return node;
|
|
593
|
+
if (node.children && node.children.length > 0) {
|
|
594
|
+
const found = findNodeByKey(node.children, targetKey);
|
|
624
595
|
if (found) return found;
|
|
625
596
|
}
|
|
626
597
|
}
|
|
627
598
|
return null;
|
|
628
599
|
};
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
const
|
|
632
|
-
if (
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
600
|
+
isApiSectionHighlighted = (apiKey, selectedNode, treeDataStructure) => {
|
|
601
|
+
if (!selectedNode || selectedNode.length === 0) return false;
|
|
602
|
+
const selectedKey = selectedNode[0];
|
|
603
|
+
if (selectedKey === apiKey) return false;
|
|
604
|
+
const findNodeParentApi = (nodes, targetKey) => {
|
|
605
|
+
for (const node of nodes) if (node.data && "id" in node.data && "tags" in node.data && !("endpoint" in node.data) && !("tagName" in node.data)) {
|
|
606
|
+
const apiId = node.key;
|
|
607
|
+
if (node.children) for (const child of node.children) {
|
|
608
|
+
if (child.key === targetKey) return apiId;
|
|
609
|
+
if (child.children) {
|
|
610
|
+
for (const grandChild of child.children) if (grandChild.key === targetKey) return apiId;
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
return null;
|
|
615
|
+
};
|
|
616
|
+
const parentApiKey = findNodeParentApi(treeDataStructure, selectedKey);
|
|
617
|
+
return parentApiKey === apiKey;
|
|
618
|
+
};
|
|
619
|
+
getAllTreeKeys = (data) => {
|
|
620
|
+
const keys = [];
|
|
621
|
+
const traverse = (nodes) => {
|
|
622
|
+
nodes.forEach((node) => {
|
|
623
|
+
keys.push(node.key);
|
|
624
|
+
if (node.children && node.children.length > 0) traverse(node.children);
|
|
625
|
+
});
|
|
626
|
+
};
|
|
627
|
+
traverse(data);
|
|
628
|
+
return keys;
|
|
629
|
+
};
|
|
630
|
+
filterTreeData = (data, searchText) => {
|
|
631
|
+
if (!searchText) return data;
|
|
632
|
+
const findOriginalNode = (nodes, key) => {
|
|
633
|
+
for (const node of nodes) {
|
|
634
|
+
if (node.key === key) return node;
|
|
635
|
+
if (node.children) {
|
|
636
|
+
const found = findOriginalNode(node.children, key);
|
|
637
|
+
if (found) return found;
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
return null;
|
|
641
|
+
};
|
|
642
|
+
const filterNode = (node) => {
|
|
643
|
+
let titleText = "";
|
|
644
|
+
const originalNode = findOriginalNode(data, node.key);
|
|
645
|
+
if (originalNode && typeof originalNode.title === "string") titleText = originalNode.title;
|
|
646
|
+
else if (typeof node.title === "string") titleText = node.title;
|
|
647
|
+
let searchableText = titleText;
|
|
648
|
+
if (node.isLeaf && node.method) searchableText = `${node.method} ${titleText}`.toLowerCase();
|
|
649
|
+
else searchableText = titleText.toLowerCase();
|
|
650
|
+
const searchLower = searchText.toLowerCase();
|
|
651
|
+
const matchesSearch = searchableText.includes(searchLower);
|
|
652
|
+
if (node.children) {
|
|
653
|
+
const filteredChildren = node.children.map((child) => filterNode(child)).filter((child) => child !== null);
|
|
654
|
+
if (matchesSearch || filteredChildren.length > 0) return {
|
|
655
|
+
...node,
|
|
656
|
+
children: filteredChildren
|
|
657
|
+
};
|
|
658
|
+
} else if (matchesSearch) return node;
|
|
659
|
+
return null;
|
|
660
|
+
};
|
|
661
|
+
return data.map((node) => filterNode(node)).filter((node) => node !== null);
|
|
662
|
+
};
|
|
663
|
+
getParentKey = (key, tree) => {
|
|
664
|
+
for (let i = 0; i < tree.length; i++) {
|
|
665
|
+
const node = tree[i];
|
|
666
|
+
if (node.children) {
|
|
667
|
+
if (node.children.some((item) => item.key === key)) return node.key;
|
|
668
|
+
const parent = getParentKey(key, node.children);
|
|
669
|
+
if (parent) return parent;
|
|
670
|
+
}
|
|
671
|
+
}
|
|
646
672
|
return null;
|
|
647
673
|
};
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
[scope("content")]: { padding: token$1.padding },
|
|
658
|
-
[scope("controls")]: {
|
|
659
|
-
display: "flex",
|
|
660
|
-
gap: token$1.marginXS,
|
|
661
|
-
marginBottom: token$1.marginSM
|
|
662
|
-
},
|
|
663
|
-
[scope("search-input")]: { flex: 1 },
|
|
664
|
-
[scope("tree")]: {
|
|
665
|
-
backgroundColor: "transparent",
|
|
666
|
-
"& .ant-tree-node-content-wrapper": {
|
|
667
|
-
overflow: "hidden",
|
|
668
|
-
width: "100%",
|
|
674
|
+
getSidebarStyles = (token$1, scope) => ({
|
|
675
|
+
[scope("sider")]: {
|
|
676
|
+
backgroundColor: token$1.colorBgContainer,
|
|
677
|
+
maxWidth: "17.5rem",
|
|
678
|
+
overflowY: "auto",
|
|
679
|
+
overflowX: "clip"
|
|
680
|
+
},
|
|
681
|
+
[scope("content")]: { padding: token$1.padding },
|
|
682
|
+
[scope("controls")]: {
|
|
669
683
|
display: "flex",
|
|
670
|
-
|
|
684
|
+
gap: token$1.marginXS,
|
|
685
|
+
marginBottom: token$1.marginSM
|
|
671
686
|
},
|
|
672
|
-
"
|
|
673
|
-
|
|
674
|
-
|
|
687
|
+
[scope("search-input")]: { flex: 1 },
|
|
688
|
+
[scope("tree")]: {
|
|
689
|
+
backgroundColor: "transparent",
|
|
690
|
+
"& .ant-tree-node-content-wrapper": {
|
|
691
|
+
overflow: "hidden",
|
|
692
|
+
width: "100%",
|
|
693
|
+
display: "flex",
|
|
694
|
+
alignItems: "center"
|
|
695
|
+
},
|
|
696
|
+
"& .ant-tree-title": {
|
|
697
|
+
width: "100%",
|
|
698
|
+
overflow: "hidden",
|
|
699
|
+
display: "flex",
|
|
700
|
+
alignItems: "center",
|
|
701
|
+
marginBlock: "auto"
|
|
702
|
+
},
|
|
703
|
+
"& .ant-tree-treenode": {
|
|
704
|
+
width: "100%",
|
|
705
|
+
padding: 0
|
|
706
|
+
},
|
|
707
|
+
"& .ant-tree-node-content-wrapper:hover": { backgroundColor: token$1.colorFillTertiary }
|
|
708
|
+
},
|
|
709
|
+
[scope("endpoint-item")]: {
|
|
675
710
|
display: "flex",
|
|
676
711
|
alignItems: "center",
|
|
677
|
-
|
|
678
|
-
},
|
|
679
|
-
"& .ant-tree-treenode": {
|
|
712
|
+
gap: token$1.marginXS,
|
|
680
713
|
width: "100%",
|
|
681
|
-
|
|
714
|
+
maxWidth: "100%",
|
|
715
|
+
minWidth: "100%"
|
|
682
716
|
},
|
|
683
|
-
"
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
}
|
|
707
|
-
|
|
708
|
-
color: token$1.colorText,
|
|
709
|
-
maxWidth: "100%",
|
|
710
|
-
display: "block",
|
|
711
|
-
padding: 0,
|
|
712
|
-
margin: 0,
|
|
713
|
-
"&.highlighted": { color: token$1.colorPrimary }
|
|
714
|
-
},
|
|
715
|
-
[scope("create-text")]: { color: token$1.colorTextSecondary }
|
|
716
|
-
});
|
|
717
|
+
[scope("method-tag")]: {
|
|
718
|
+
minWidth: "3.75rem",
|
|
719
|
+
textAlign: "center",
|
|
720
|
+
border: "none"
|
|
721
|
+
},
|
|
722
|
+
[scope("endpoint-text")]: {
|
|
723
|
+
flex: 1,
|
|
724
|
+
maxWidth: "100%"
|
|
725
|
+
},
|
|
726
|
+
[scope("tag-title")]: {
|
|
727
|
+
color: token$1.colorText,
|
|
728
|
+
maxWidth: "100%",
|
|
729
|
+
display: "block"
|
|
730
|
+
},
|
|
731
|
+
[scope("api-title")]: {
|
|
732
|
+
color: token$1.colorText,
|
|
733
|
+
maxWidth: "100%",
|
|
734
|
+
display: "block",
|
|
735
|
+
padding: 0,
|
|
736
|
+
margin: 0,
|
|
737
|
+
"&.highlighted": { color: token$1.colorPrimary }
|
|
738
|
+
},
|
|
739
|
+
[scope("create-text")]: { color: token$1.colorTextSecondary }
|
|
740
|
+
});
|
|
741
|
+
}) });
|
|
717
742
|
|
|
718
743
|
//#endregion
|
|
719
744
|
//#region src/view/helper/sidebar.components.tsx
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
const renderNode = (node) => {
|
|
743
|
-
let title;
|
|
744
|
-
if (node.isLeaf && node.method) title = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EndpointItem, {
|
|
745
|
-
method: node.method,
|
|
746
|
-
title: typeof node.title === "string" ? node.title.replace(`${node.method} `, "") : "",
|
|
747
|
-
cx
|
|
745
|
+
var Text, EndpointItem, convertToRenderableTreeData;
|
|
746
|
+
var init_sidebar_components = __esm({ "src/view/helper/sidebar.components.tsx": (() => {
|
|
747
|
+
init_sidebar_utils();
|
|
748
|
+
({Text} = antd.Typography);
|
|
749
|
+
EndpointItem = ({ method, title, cx }) => {
|
|
750
|
+
const methodStyle = methodColors[method];
|
|
751
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
752
|
+
className: cx("endpoint-item"),
|
|
753
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tag, {
|
|
754
|
+
className: cx("method-tag"),
|
|
755
|
+
style: {
|
|
756
|
+
backgroundColor: methodStyle?.bg,
|
|
757
|
+
color: methodStyle?.color,
|
|
758
|
+
border: "none"
|
|
759
|
+
},
|
|
760
|
+
children: method
|
|
761
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Text, {
|
|
762
|
+
className: cx("endpoint-text"),
|
|
763
|
+
ellipsis: { tooltip: title },
|
|
764
|
+
style: { flex: 1 },
|
|
765
|
+
children: title
|
|
766
|
+
})]
|
|
748
767
|
});
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
768
|
+
};
|
|
769
|
+
convertToRenderableTreeData = (treeDataStructure, selectedNode, cx) => {
|
|
770
|
+
const renderNode = (node) => {
|
|
771
|
+
let title;
|
|
772
|
+
if (node.isLeaf && node.method) title = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EndpointItem, {
|
|
773
|
+
method: node.method,
|
|
774
|
+
title: typeof node.title === "string" ? node.title.replace(`${node.method} `, "") : "",
|
|
775
|
+
cx
|
|
776
|
+
});
|
|
777
|
+
else if (node.data && "id" in node.data && "tags" in node.data && !("endpoint" in node.data) && !("tagName" in node.data)) {
|
|
778
|
+
const isHighlighted = isApiSectionHighlighted(node.key, selectedNode, treeDataStructure);
|
|
779
|
+
title = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Text, {
|
|
780
|
+
className: cx("api-title") + (isHighlighted ? " highlighted" : ""),
|
|
781
|
+
ellipsis: { tooltip: typeof node.title === "string" ? node.title : "" },
|
|
782
|
+
children: node.title
|
|
783
|
+
});
|
|
784
|
+
} else title = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Text, {
|
|
785
|
+
className: cx("tag-title"),
|
|
753
786
|
ellipsis: { tooltip: typeof node.title === "string" ? node.title : "" },
|
|
754
787
|
children: node.title
|
|
755
788
|
});
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
return {
|
|
762
|
-
...node,
|
|
763
|
-
title,
|
|
764
|
-
children: node.children ? node.children.map(renderNode) : void 0
|
|
789
|
+
return {
|
|
790
|
+
...node,
|
|
791
|
+
title,
|
|
792
|
+
children: node.children ? node.children.map(renderNode) : void 0
|
|
793
|
+
};
|
|
765
794
|
};
|
|
795
|
+
return treeDataStructure.map(renderNode);
|
|
766
796
|
};
|
|
767
|
-
|
|
768
|
-
|
|
797
|
+
}) });
|
|
798
|
+
|
|
799
|
+
//#endregion
|
|
800
|
+
//#region src/view/helper/index.ts
|
|
801
|
+
var helper_exports = {};
|
|
802
|
+
__export(helper_exports, {
|
|
803
|
+
EndpointItem: () => EndpointItem,
|
|
804
|
+
buildTreeDataStructure: () => buildTreeDataStructure,
|
|
805
|
+
convertToRenderableTreeData: () => convertToRenderableTreeData,
|
|
806
|
+
filterTreeData: () => filterTreeData,
|
|
807
|
+
findNodeByKey: () => findNodeByKey,
|
|
808
|
+
getAllTreeKeys: () => getAllTreeKeys,
|
|
809
|
+
getParentKey: () => getParentKey,
|
|
810
|
+
getSidebarStyles: () => getSidebarStyles,
|
|
811
|
+
isApiSectionHighlighted: () => isApiSectionHighlighted,
|
|
812
|
+
methodColors: () => methodColors
|
|
813
|
+
});
|
|
814
|
+
var init_helper = __esm({ "src/view/helper/index.ts": (() => {
|
|
815
|
+
init_sidebar_utils();
|
|
816
|
+
init_sidebar_components();
|
|
817
|
+
}) });
|
|
769
818
|
|
|
770
819
|
//#endregion
|
|
771
820
|
//#region src/view/components/Sidebar.tsx
|
|
772
821
|
const { Sider } = antd.Layout;
|
|
773
|
-
const
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
const [selectedNode, setSelectedNodeState] = (0, react.useState)();
|
|
779
|
-
const transformedData = useStore((state) => state.view.transformedData);
|
|
780
|
-
const builtTreeData = (0, react.useMemo)(() => buildTreeDataStructure(transformedData), [transformedData]);
|
|
781
|
-
const [searchValue, setSearchValue] = (0, react.useState)("");
|
|
782
|
-
const [autoExpandParent, setAutoExpandParent] = (0, react.useState)(true);
|
|
783
|
-
const { wrapSSR, cx } = useStyle("Sidebar", getSidebarStyles);
|
|
784
|
-
const handleSearch = (value) => {
|
|
785
|
-
if (value) {
|
|
786
|
-
const allKeys = getAllTreeKeys(builtTreeData);
|
|
787
|
-
setExpandedKeys(allKeys);
|
|
788
|
-
setSearchValue(value);
|
|
789
|
-
setAutoExpandParent(true);
|
|
790
|
-
} else {
|
|
791
|
-
setSearchValue(value);
|
|
792
|
-
setAutoExpandParent(false);
|
|
822
|
+
const safeHelperCall = (fn, args, functionName) => {
|
|
823
|
+
try {
|
|
824
|
+
if (!fn) {
|
|
825
|
+
console.error(`[Sidebar] Function ${functionName} is not available`);
|
|
826
|
+
return null;
|
|
793
827
|
}
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
return
|
|
797
|
-
}
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
api: tagData.apiData
|
|
841
|
-
};
|
|
828
|
+
const result = fn(...args);
|
|
829
|
+
console.log(`[Sidebar] ${functionName} executed successfully`);
|
|
830
|
+
return result;
|
|
831
|
+
} catch (error) {
|
|
832
|
+
console.error(`[Sidebar] Error in ${functionName}:`, error);
|
|
833
|
+
return null;
|
|
834
|
+
}
|
|
835
|
+
};
|
|
836
|
+
const Sidebar = () => {
|
|
837
|
+
try {
|
|
838
|
+
let getAllTreeKeys$1, filterTreeData$1, getSidebarStyles$1, convertToRenderableTreeData$1, buildTreeDataStructure$1, findNodeByKey$1;
|
|
839
|
+
try {
|
|
840
|
+
const helperImports = (init_helper(), __toCommonJS(helper_exports));
|
|
841
|
+
getAllTreeKeys$1 = helperImports.getAllTreeKeys;
|
|
842
|
+
filterTreeData$1 = helperImports.filterTreeData;
|
|
843
|
+
getSidebarStyles$1 = helperImports.getSidebarStyles;
|
|
844
|
+
convertToRenderableTreeData$1 = helperImports.convertToRenderableTreeData;
|
|
845
|
+
buildTreeDataStructure$1 = helperImports.buildTreeDataStructure;
|
|
846
|
+
findNodeByKey$1 = helperImports.findNodeByKey;
|
|
847
|
+
console.log("[Sidebar] Helper functions imported successfully");
|
|
848
|
+
} catch (error) {
|
|
849
|
+
console.error("[Sidebar] Error importing helper functions:", error);
|
|
850
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Sider, {
|
|
851
|
+
width: 280,
|
|
852
|
+
style: {
|
|
853
|
+
backgroundColor: "#f5f5f5",
|
|
854
|
+
border: "1px solid orange"
|
|
855
|
+
},
|
|
856
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
857
|
+
style: { padding: 16 },
|
|
858
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h4", {
|
|
859
|
+
style: {
|
|
860
|
+
color: "#fa8c16",
|
|
861
|
+
margin: 0
|
|
862
|
+
},
|
|
863
|
+
children: "Import Error"
|
|
864
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
865
|
+
style: {
|
|
866
|
+
fontSize: "12px",
|
|
867
|
+
color: "#666",
|
|
868
|
+
margin: "8px 0 0 0"
|
|
869
|
+
},
|
|
870
|
+
children: "Could not import helper functions. Check console."
|
|
871
|
+
})]
|
|
872
|
+
})
|
|
873
|
+
});
|
|
842
874
|
}
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
const
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
875
|
+
const expandedKeys = useStore((state) => state.view.expandedKeys);
|
|
876
|
+
const setExpandedKeys = useStore((state) => state.view.setExpandedKeys);
|
|
877
|
+
const setSelectedApi = useStore((state) => state.view.setSelectedApi);
|
|
878
|
+
const setSelectedEndpoint = useStore((state) => state.view.setSelectedEndpoint);
|
|
879
|
+
const [selectedNode, setSelectedNodeState] = (0, react.useState)();
|
|
880
|
+
const transformedData = useStore((state) => state.view.transformedData);
|
|
881
|
+
console.log("[Sidebar] Store access successful, transformedData:", transformedData);
|
|
882
|
+
const builtTreeData = (0, react.useMemo)(() => {
|
|
883
|
+
console.log("[Sidebar] Building tree data...");
|
|
884
|
+
return safeHelperCall(buildTreeDataStructure$1, [transformedData], "buildTreeDataStructure") || [];
|
|
885
|
+
}, [transformedData, buildTreeDataStructure$1]);
|
|
886
|
+
const [searchValue, setSearchValue] = (0, react.useState)("");
|
|
887
|
+
const [autoExpandParent, setAutoExpandParent] = (0, react.useState)(true);
|
|
888
|
+
let wrapSSR, cx;
|
|
889
|
+
try {
|
|
890
|
+
const styleResult = useStyle("Sidebar", getSidebarStyles$1);
|
|
891
|
+
wrapSSR = styleResult.wrapSSR;
|
|
892
|
+
cx = styleResult.cx;
|
|
893
|
+
console.log("[Sidebar] useStyle executed successfully");
|
|
894
|
+
} catch (error) {
|
|
895
|
+
console.error("[Sidebar] Error in useStyle:", error);
|
|
896
|
+
wrapSSR = (children) => children;
|
|
897
|
+
cx = (className) => className;
|
|
851
898
|
}
|
|
852
|
-
const
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
className: cx("content"),
|
|
862
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
863
|
-
className: cx("controls"),
|
|
864
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Input, {
|
|
865
|
-
placeholder: "Search by APIs or Endpoints",
|
|
866
|
-
value: searchValue,
|
|
867
|
-
onChange: (e) => handleSearch(e.target.value),
|
|
868
|
-
allowClear: true,
|
|
869
|
-
className: cx("search-input")
|
|
870
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Button, {
|
|
871
|
-
onClick: collapseAll,
|
|
872
|
-
title: "Collapse All",
|
|
873
|
-
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Minify_default, {})
|
|
874
|
-
})]
|
|
875
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tree, {
|
|
876
|
-
showLine: { showLeafIcon: false },
|
|
877
|
-
showIcon: false,
|
|
878
|
-
expandedKeys,
|
|
879
|
-
autoExpandParent,
|
|
880
|
-
selectedKeys: selectedNode,
|
|
881
|
-
onSelect: onTreeNodeSelect,
|
|
882
|
-
onExpand: (expandedKeysValue) => {
|
|
883
|
-
setExpandedKeys(expandedKeysValue);
|
|
899
|
+
const handleSearch = (value) => {
|
|
900
|
+
try {
|
|
901
|
+
if (value) {
|
|
902
|
+
const allKeys = safeHelperCall(getAllTreeKeys$1, [builtTreeData], "getAllTreeKeys") || [];
|
|
903
|
+
setExpandedKeys(allKeys);
|
|
904
|
+
setSearchValue(value);
|
|
905
|
+
setAutoExpandParent(true);
|
|
906
|
+
} else {
|
|
907
|
+
setSearchValue(value);
|
|
884
908
|
setAutoExpandParent(false);
|
|
885
|
-
}
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
}
|
|
889
|
-
}
|
|
890
|
-
|
|
909
|
+
}
|
|
910
|
+
} catch (error) {
|
|
911
|
+
console.error("[Sidebar] Error in handleSearch:", error);
|
|
912
|
+
}
|
|
913
|
+
};
|
|
914
|
+
const renderTreeData = (0, react.useMemo)(() => {
|
|
915
|
+
console.log("[Sidebar] Converting to renderable tree data...");
|
|
916
|
+
return safeHelperCall(convertToRenderableTreeData$1, [
|
|
917
|
+
builtTreeData,
|
|
918
|
+
selectedNode,
|
|
919
|
+
cx
|
|
920
|
+
], "convertToRenderableTreeData") || [];
|
|
921
|
+
}, [
|
|
922
|
+
builtTreeData,
|
|
923
|
+
selectedNode,
|
|
924
|
+
cx,
|
|
925
|
+
convertToRenderableTreeData$1
|
|
926
|
+
]);
|
|
927
|
+
const filteredTreeData = (0, react.useMemo)(() => {
|
|
928
|
+
try {
|
|
929
|
+
if (!searchValue) return renderTreeData;
|
|
930
|
+
console.log("[Sidebar] Filtering tree data...");
|
|
931
|
+
const filteredOriginal = safeHelperCall(filterTreeData$1, [builtTreeData, searchValue], "filterTreeData") || [];
|
|
932
|
+
return safeHelperCall(convertToRenderableTreeData$1, [
|
|
933
|
+
filteredOriginal,
|
|
934
|
+
selectedNode,
|
|
935
|
+
cx
|
|
936
|
+
], "convertToRenderableTreeData for filtered") || [];
|
|
937
|
+
} catch (error) {
|
|
938
|
+
console.error("[Sidebar] Error in filteredTreeData:", error);
|
|
939
|
+
return [];
|
|
940
|
+
}
|
|
941
|
+
}, [
|
|
942
|
+
builtTreeData,
|
|
943
|
+
searchValue,
|
|
944
|
+
selectedNode,
|
|
945
|
+
cx,
|
|
946
|
+
renderTreeData,
|
|
947
|
+
filterTreeData$1,
|
|
948
|
+
convertToRenderableTreeData$1
|
|
949
|
+
]);
|
|
950
|
+
const collapseAll = () => {
|
|
951
|
+
try {
|
|
952
|
+
setExpandedKeys([]);
|
|
953
|
+
} catch (error) {
|
|
954
|
+
console.error("[Sidebar] Error in collapseAll:", error);
|
|
955
|
+
}
|
|
956
|
+
};
|
|
957
|
+
const handleNodeSelection = (nodeData, nodeKey) => {
|
|
958
|
+
try {
|
|
959
|
+
if (!nodeData) return null;
|
|
960
|
+
if (nodeKey.startsWith("endpoint-")) {
|
|
961
|
+
const endpointNodeData = nodeData;
|
|
962
|
+
setSelectedEndpoint(endpointNodeData.endpoint);
|
|
963
|
+
setSelectedApi(endpointNodeData.api);
|
|
964
|
+
return {
|
|
965
|
+
type: "endpoint",
|
|
966
|
+
endpoint: endpointNodeData.endpoint,
|
|
967
|
+
api: endpointNodeData.api,
|
|
968
|
+
tag: endpointNodeData.tagName
|
|
969
|
+
};
|
|
970
|
+
} else if (nodeKey.startsWith("api-") || nodeKey === "custom-auth") {
|
|
971
|
+
const apiData = nodeData;
|
|
972
|
+
setSelectedApi(apiData);
|
|
973
|
+
setSelectedEndpoint(null);
|
|
974
|
+
return {
|
|
975
|
+
type: "api",
|
|
976
|
+
api: apiData
|
|
977
|
+
};
|
|
978
|
+
} else {
|
|
979
|
+
const tagData = nodeData;
|
|
980
|
+
return {
|
|
981
|
+
type: "tag",
|
|
982
|
+
tag: tagData.tagName,
|
|
983
|
+
api: tagData.apiData
|
|
984
|
+
};
|
|
985
|
+
}
|
|
986
|
+
} catch (error) {
|
|
987
|
+
console.error("[Sidebar] Error in handleNodeSelection:", error);
|
|
988
|
+
return null;
|
|
989
|
+
}
|
|
990
|
+
};
|
|
991
|
+
const onTreeNodeSelect = (selectedKeys) => {
|
|
992
|
+
try {
|
|
993
|
+
const stringKeys = selectedKeys.map((key) => String(key));
|
|
994
|
+
console.log("[Sidebar] onTreeNodeSelect called with:", stringKeys);
|
|
995
|
+
if (stringKeys.length === 0) {
|
|
996
|
+
setSelectedNodeState([]);
|
|
997
|
+
setSelectedApi(null);
|
|
998
|
+
setSelectedEndpoint(null);
|
|
999
|
+
return;
|
|
1000
|
+
}
|
|
1001
|
+
const selectedKey = stringKeys[0];
|
|
1002
|
+
const selectedNode$1 = safeHelperCall(findNodeByKey$1, [builtTreeData, selectedKey], "findNodeByKey");
|
|
1003
|
+
if (selectedNode$1) handleNodeSelection(selectedNode$1.data, selectedKey);
|
|
1004
|
+
setSelectedNodeState(stringKeys);
|
|
1005
|
+
} catch (error) {
|
|
1006
|
+
console.error("[Sidebar] Error in onTreeNodeSelect:", error);
|
|
1007
|
+
}
|
|
1008
|
+
};
|
|
1009
|
+
return wrapSSR(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Sider, {
|
|
1010
|
+
width: 280,
|
|
1011
|
+
className: cx("sider"),
|
|
1012
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1013
|
+
className: cx("content"),
|
|
1014
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1015
|
+
className: cx("controls"),
|
|
1016
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Input, {
|
|
1017
|
+
placeholder: "Search by APIs or Endpoints",
|
|
1018
|
+
value: searchValue,
|
|
1019
|
+
onChange: (e) => handleSearch(e.target.value),
|
|
1020
|
+
allowClear: true,
|
|
1021
|
+
className: cx("search-input")
|
|
1022
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Button, {
|
|
1023
|
+
onClick: collapseAll,
|
|
1024
|
+
title: "Collapse All",
|
|
1025
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Minify_default, {})
|
|
1026
|
+
})]
|
|
1027
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tree, {
|
|
1028
|
+
showLine: { showLeafIcon: false },
|
|
1029
|
+
showIcon: false,
|
|
1030
|
+
expandedKeys,
|
|
1031
|
+
autoExpandParent,
|
|
1032
|
+
selectedKeys: selectedNode,
|
|
1033
|
+
onSelect: onTreeNodeSelect,
|
|
1034
|
+
onExpand: (expandedKeysValue) => {
|
|
1035
|
+
try {
|
|
1036
|
+
setExpandedKeys(expandedKeysValue);
|
|
1037
|
+
setAutoExpandParent(false);
|
|
1038
|
+
} catch (error) {
|
|
1039
|
+
console.error("[Sidebar] Error in onExpand:", error);
|
|
1040
|
+
}
|
|
1041
|
+
},
|
|
1042
|
+
treeData: filteredTreeData,
|
|
1043
|
+
className: cx("tree")
|
|
1044
|
+
})]
|
|
1045
|
+
})
|
|
1046
|
+
}));
|
|
1047
|
+
} catch (error) {
|
|
1048
|
+
console.error("[Sidebar] Critical error in Sidebar component:", error);
|
|
1049
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Sider, {
|
|
1050
|
+
width: 280,
|
|
1051
|
+
style: {
|
|
1052
|
+
backgroundColor: "#f5f5f5",
|
|
1053
|
+
border: "1px solid red"
|
|
1054
|
+
},
|
|
1055
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1056
|
+
style: { padding: 16 },
|
|
1057
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h4", {
|
|
1058
|
+
style: {
|
|
1059
|
+
color: "#ff4d4f",
|
|
1060
|
+
margin: 0
|
|
1061
|
+
},
|
|
1062
|
+
children: "Sidebar Error"
|
|
1063
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1064
|
+
style: {
|
|
1065
|
+
fontSize: "12px",
|
|
1066
|
+
color: "#666",
|
|
1067
|
+
margin: "8px 0 0 0"
|
|
1068
|
+
},
|
|
1069
|
+
children: "Critical error occurred. Check console."
|
|
1070
|
+
})]
|
|
1071
|
+
})
|
|
1072
|
+
});
|
|
1073
|
+
}
|
|
891
1074
|
};
|
|
892
1075
|
|
|
893
1076
|
//#endregion
|
|
@@ -906,34 +1089,50 @@ const MainContent = () => {
|
|
|
906
1089
|
};
|
|
907
1090
|
|
|
908
1091
|
//#endregion
|
|
909
|
-
//#region src/view/
|
|
910
|
-
|
|
911
|
-
const
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
}
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
return this.props.children;
|
|
1092
|
+
//#region src/view/helper/mutate.ts
|
|
1093
|
+
const transformOpenApiToDocs = (api) => {
|
|
1094
|
+
const groupedPathsByTags = { default: [] };
|
|
1095
|
+
const validTags = new Set(api?.tags?.map(({ name }) => name) || []);
|
|
1096
|
+
const contextPath = Object.keys(api.paths)[0];
|
|
1097
|
+
for (const [path, methods] of Object.entries(api.paths)) for (const [method, methodData] of Object.entries(methods)) {
|
|
1098
|
+
const entry = {
|
|
1099
|
+
...methodData,
|
|
1100
|
+
method: method?.toUpperCase(),
|
|
1101
|
+
path
|
|
1102
|
+
};
|
|
1103
|
+
const resourceTags = methodData.tags ?? [];
|
|
1104
|
+
const matchedTags = resourceTags.filter((tag) => validTags.has(tag));
|
|
1105
|
+
if (matchedTags.length > 0) matchedTags.forEach((tag) => {
|
|
1106
|
+
if (!groupedPathsByTags[tag]) groupedPathsByTags[tag] = [];
|
|
1107
|
+
groupedPathsByTags[tag].push({
|
|
1108
|
+
...entry,
|
|
1109
|
+
id: `endpoint-${(0, nanoid.nanoid)(8)}`
|
|
1110
|
+
});
|
|
1111
|
+
});
|
|
1112
|
+
else groupedPathsByTags.default.push({
|
|
1113
|
+
...entry,
|
|
1114
|
+
id: `endpoint-${(0, nanoid.nanoid)(8)}`
|
|
1115
|
+
});
|
|
934
1116
|
}
|
|
1117
|
+
return {
|
|
1118
|
+
...api.info,
|
|
1119
|
+
id: `api-${(0, nanoid.nanoid)(8)}`,
|
|
1120
|
+
contextPath,
|
|
1121
|
+
tags: groupedPathsByTags,
|
|
1122
|
+
servers: api.servers
|
|
1123
|
+
};
|
|
935
1124
|
};
|
|
936
|
-
|
|
1125
|
+
|
|
1126
|
+
//#endregion
|
|
1127
|
+
//#region src/view/layout.tsx
|
|
1128
|
+
const DocumentationLayout = ({ data }) => {
|
|
1129
|
+
const { setOriginalData } = store_default(({ view }) => view);
|
|
1130
|
+
const { setTransformedData } = store_default(({ view }) => view);
|
|
1131
|
+
(0, react.useEffect)(() => {
|
|
1132
|
+
setOriginalData(data);
|
|
1133
|
+
const transformedData = data.map(transformOpenApiToDocs);
|
|
1134
|
+
setTransformedData(transformedData);
|
|
1135
|
+
}, [data]);
|
|
937
1136
|
const { cx } = useStyle("DocumentationLayout", (token$1, scope) => ({
|
|
938
1137
|
[scope("container")]: {
|
|
939
1138
|
display: "flex",
|
|
@@ -951,13 +1150,13 @@ const DocumentationLayout = () => {
|
|
|
951
1150
|
gap: token$1.marginLG
|
|
952
1151
|
}
|
|
953
1152
|
}));
|
|
954
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
1153
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ant_design_nextjs_registry.AntdRegistry, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
955
1154
|
className: cx("container"),
|
|
956
1155
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Header, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
957
1156
|
className: cx("layout"),
|
|
958
1157
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Sidebar, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MainContent, {})]
|
|
959
1158
|
})]
|
|
960
|
-
}) })
|
|
1159
|
+
}) });
|
|
961
1160
|
};
|
|
962
1161
|
|
|
963
1162
|
//#endregion
|