@digi-frontend/dgate-api-documentation 4.1.1 → 4.1.5
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 +363 -221
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +363 -221
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -75,8 +75,10 @@ const useStore = create()(devtools(immer(createStore), { name: "dgate-docs-store
|
|
|
75
75
|
//#region src/hooks/useStyle.ts
|
|
76
76
|
function useStyle(componentName, stylesFn) {
|
|
77
77
|
const { token, theme: theme$1, hashId } = theme.useToken();
|
|
78
|
-
const
|
|
79
|
-
const
|
|
78
|
+
const tokenKey = token._tokenKey;
|
|
79
|
+
const themeId = tokenKey ? `tk-${tokenKey.slice(-6)}` : "tk-default";
|
|
80
|
+
const scope = (className) => `.${hashId}.${themeId}.${componentName}-${className}`;
|
|
81
|
+
const cx = (...classes) => classes.map((cls) => `${componentName}-${cls} ${hashId} ${themeId}`).join(" ");
|
|
80
82
|
return {
|
|
81
83
|
wrapSSR: useStyleRegister({
|
|
82
84
|
theme: theme$1,
|
|
@@ -1231,7 +1233,7 @@ const ApiCard = ({ api, viewStyle }) => {
|
|
|
1231
1233
|
border: `1px solid ${token.colorBorderSecondary}`,
|
|
1232
1234
|
minWidth: "6.25rem",
|
|
1233
1235
|
maxWidth: "fit-content",
|
|
1234
|
-
svg: { path: { fill:
|
|
1236
|
+
svg: { path: { fill: "#4D75D9" } }
|
|
1235
1237
|
},
|
|
1236
1238
|
[scope("list-title")]: {
|
|
1237
1239
|
color: token.colorTextHeading,
|
|
@@ -1279,7 +1281,7 @@ const ApiCard = ({ api, viewStyle }) => {
|
|
|
1279
1281
|
flexDirection: "row",
|
|
1280
1282
|
borderRadius: token.borderRadiusSM,
|
|
1281
1283
|
border: `1px solid ${token.colorBorderSecondary}`,
|
|
1282
|
-
svg: { path: { fill:
|
|
1284
|
+
svg: { path: { fill: "#4D75D9" } }
|
|
1283
1285
|
},
|
|
1284
1286
|
[scope("grid-path-name")]: {
|
|
1285
1287
|
color: token.colorText,
|
|
@@ -2124,7 +2126,7 @@ const ApiDocumentationBar = ({ apiName, mode, onModeChange, onReset, onSave, has
|
|
|
2124
2126
|
},
|
|
2125
2127
|
[scope("mobileWrapper")]: {
|
|
2126
2128
|
flexDirection: "column",
|
|
2127
|
-
gap:
|
|
2129
|
+
gap: 16
|
|
2128
2130
|
},
|
|
2129
2131
|
[scope("mobileTopRow")]: {
|
|
2130
2132
|
width: "100%",
|
|
@@ -2199,14 +2201,14 @@ const ApiDocumentationBar = ({ apiName, mode, onModeChange, onReset, onSave, has
|
|
|
2199
2201
|
[scope("actions")]: {
|
|
2200
2202
|
display: "flex",
|
|
2201
2203
|
alignItems: "center",
|
|
2202
|
-
gap:
|
|
2204
|
+
gap: 16,
|
|
2203
2205
|
flex: 1,
|
|
2204
2206
|
justifyContent: "flex-end"
|
|
2205
2207
|
},
|
|
2206
2208
|
[scope("mobileActions")]: {
|
|
2207
2209
|
display: "flex",
|
|
2208
2210
|
alignItems: "center",
|
|
2209
|
-
gap:
|
|
2211
|
+
gap: 16,
|
|
2210
2212
|
justifyContent: "flex-end"
|
|
2211
2213
|
}
|
|
2212
2214
|
}));
|
|
@@ -2603,42 +2605,6 @@ const EditTag = (props) => /* @__PURE__ */ jsxs("svg", {
|
|
|
2603
2605
|
]
|
|
2604
2606
|
});
|
|
2605
2607
|
//#endregion
|
|
2606
|
-
//#region src/assets/info-circle.tsx
|
|
2607
|
-
const InfoCircle = (props) => /* @__PURE__ */ jsxs("svg", {
|
|
2608
|
-
width: "24",
|
|
2609
|
-
height: "24",
|
|
2610
|
-
viewBox: "0 0 24 24",
|
|
2611
|
-
fill: "none",
|
|
2612
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
2613
|
-
...props,
|
|
2614
|
-
children: [
|
|
2615
|
-
/* @__PURE__ */ jsx("path", {
|
|
2616
|
-
d: "M12 22C17.5 22 22 17.5 22 12C22 6.5 17.5 2 12 2C6.5 2 2 6.5 2 12C2 17.5 6.5 22 12 22Z",
|
|
2617
|
-
stroke: "black",
|
|
2618
|
-
strokeOpacity: "0.45",
|
|
2619
|
-
strokeWidth: "1.5",
|
|
2620
|
-
strokeLinecap: "round",
|
|
2621
|
-
strokeLinejoin: "round"
|
|
2622
|
-
}),
|
|
2623
|
-
/* @__PURE__ */ jsx("path", {
|
|
2624
|
-
d: "M12 8V13",
|
|
2625
|
-
stroke: "black",
|
|
2626
|
-
strokeOpacity: "0.45",
|
|
2627
|
-
strokeWidth: "1.5",
|
|
2628
|
-
strokeLinecap: "round",
|
|
2629
|
-
strokeLinejoin: "round"
|
|
2630
|
-
}),
|
|
2631
|
-
/* @__PURE__ */ jsx("path", {
|
|
2632
|
-
d: "M11.9946 16H12.0036",
|
|
2633
|
-
stroke: "black",
|
|
2634
|
-
strokeOpacity: "0.45",
|
|
2635
|
-
strokeWidth: "1.5",
|
|
2636
|
-
strokeLinecap: "round",
|
|
2637
|
-
strokeLinejoin: "round"
|
|
2638
|
-
})
|
|
2639
|
-
]
|
|
2640
|
-
});
|
|
2641
|
-
//#endregion
|
|
2642
2608
|
//#region src/hooks/useDebounce.ts
|
|
2643
2609
|
function useDebounce(value, delay = 500) {
|
|
2644
2610
|
const [debouncedValue, setDebouncedValue] = useState(value);
|
|
@@ -2656,46 +2622,46 @@ function useDebounce(value, delay = 500) {
|
|
|
2656
2622
|
//#region src/view/components/ApiPage/components/AddParameterDrawer.tsx
|
|
2657
2623
|
const PARAM_IN_OPTIONS = [
|
|
2658
2624
|
{
|
|
2659
|
-
label: "
|
|
2625
|
+
label: "QUERY",
|
|
2660
2626
|
value: "query"
|
|
2661
2627
|
},
|
|
2662
2628
|
{
|
|
2663
|
-
label: "
|
|
2629
|
+
label: "HEADER",
|
|
2664
2630
|
value: "header"
|
|
2665
2631
|
},
|
|
2666
2632
|
{
|
|
2667
|
-
label: "
|
|
2633
|
+
label: "PATH",
|
|
2668
2634
|
value: "path"
|
|
2669
2635
|
}
|
|
2670
2636
|
];
|
|
2671
2637
|
const RESPONSE_PARAM_IN_OPTIONS = PARAM_IN_OPTIONS.filter((o) => o.value === "header");
|
|
2672
2638
|
const PARAM_TYPE_OPTIONS = [
|
|
2673
2639
|
{
|
|
2674
|
-
label: "
|
|
2640
|
+
label: "STRING",
|
|
2675
2641
|
value: "string"
|
|
2676
2642
|
},
|
|
2677
2643
|
{
|
|
2678
|
-
label: "
|
|
2644
|
+
label: "NUMBER",
|
|
2679
2645
|
value: "number"
|
|
2680
2646
|
},
|
|
2681
2647
|
{
|
|
2682
|
-
label: "
|
|
2648
|
+
label: "INTEGER",
|
|
2683
2649
|
value: "integer"
|
|
2684
2650
|
},
|
|
2685
2651
|
{
|
|
2686
|
-
label: "
|
|
2652
|
+
label: "BOOLEAN",
|
|
2687
2653
|
value: "boolean"
|
|
2688
2654
|
},
|
|
2689
2655
|
{
|
|
2690
|
-
label: "
|
|
2656
|
+
label: "ARRAY",
|
|
2691
2657
|
value: "array"
|
|
2692
2658
|
},
|
|
2693
2659
|
{
|
|
2694
|
-
label: "
|
|
2660
|
+
label: "OBJECT",
|
|
2695
2661
|
value: "object"
|
|
2696
2662
|
}
|
|
2697
2663
|
];
|
|
2698
|
-
const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initialValues, source }) => {
|
|
2664
|
+
const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initialValues, source, endpointName }) => {
|
|
2699
2665
|
const [form] = Form.useForm();
|
|
2700
2666
|
const [messageApi, contextHolder] = message.useMessage();
|
|
2701
2667
|
const [confirmModalOpen, setConfirmModalOpen] = useState(false);
|
|
@@ -2715,7 +2681,8 @@ const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initia
|
|
|
2715
2681
|
in: initialValues.in,
|
|
2716
2682
|
type: initialValues.type,
|
|
2717
2683
|
required: initialValues.required,
|
|
2718
|
-
description: initialValues.description
|
|
2684
|
+
description: initialValues.description,
|
|
2685
|
+
itemsType: initialValues.items?.type
|
|
2719
2686
|
});
|
|
2720
2687
|
setEnumValues(initialValues.enum ?? []);
|
|
2721
2688
|
} else {
|
|
@@ -2850,7 +2817,7 @@ const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initia
|
|
|
2850
2817
|
alignItems: "center",
|
|
2851
2818
|
position: "relative",
|
|
2852
2819
|
paddingTop: 20,
|
|
2853
|
-
paddingBottom:
|
|
2820
|
+
paddingBottom: 5,
|
|
2854
2821
|
paddingLeft: 24,
|
|
2855
2822
|
paddingRight: 24,
|
|
2856
2823
|
width: "100%"
|
|
@@ -2957,7 +2924,8 @@ const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initia
|
|
|
2957
2924
|
type: values.type,
|
|
2958
2925
|
required: values.required ?? true,
|
|
2959
2926
|
description: values.description || void 0,
|
|
2960
|
-
enum: enumValues.length > 0 ? enumValues : void 0
|
|
2927
|
+
enum: enumValues.length > 0 ? enumValues : void 0,
|
|
2928
|
+
...values.type === "array" && values.itemsType && { items: { type: values.itemsType } }
|
|
2961
2929
|
};
|
|
2962
2930
|
if (mode === "edit") {
|
|
2963
2931
|
onEdit?.(payload);
|
|
@@ -3089,6 +3057,25 @@ const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initia
|
|
|
3089
3057
|
options: PARAM_TYPE_OPTIONS
|
|
3090
3058
|
})
|
|
3091
3059
|
}),
|
|
3060
|
+
typeValue === "array" && /* @__PURE__ */ jsx(Form.Item, {
|
|
3061
|
+
name: "itemsType",
|
|
3062
|
+
label: /* @__PURE__ */ jsxs("span", {
|
|
3063
|
+
className: cx("label"),
|
|
3064
|
+
children: ["Items Type", /* @__PURE__ */ jsx("span", {
|
|
3065
|
+
className: cx("asterisk"),
|
|
3066
|
+
children: "*"
|
|
3067
|
+
})]
|
|
3068
|
+
}),
|
|
3069
|
+
rules: [{
|
|
3070
|
+
required: true,
|
|
3071
|
+
message: "Items Type is required"
|
|
3072
|
+
}],
|
|
3073
|
+
children: /* @__PURE__ */ jsx(Select, {
|
|
3074
|
+
size: "large",
|
|
3075
|
+
placeholder: "Select",
|
|
3076
|
+
options: PARAM_TYPE_OPTIONS
|
|
3077
|
+
})
|
|
3078
|
+
}),
|
|
3092
3079
|
/* @__PURE__ */ jsx(Form.Item, {
|
|
3093
3080
|
name: "required",
|
|
3094
3081
|
children: /* @__PURE__ */ jsxs("div", {
|
|
@@ -3198,14 +3185,9 @@ const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initia
|
|
|
3198
3185
|
children: [
|
|
3199
3186
|
/* @__PURE__ */ jsxs("div", {
|
|
3200
3187
|
className: cx("modalHead"),
|
|
3201
|
-
children: [/* @__PURE__ */
|
|
3188
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
3202
3189
|
className: cx("modalTitle"),
|
|
3203
|
-
children:
|
|
3204
|
-
mode === "edit" ? "Edit" : "Add",
|
|
3205
|
-
" ",
|
|
3206
|
-
paramName,
|
|
3207
|
-
" parameter"
|
|
3208
|
-
]
|
|
3190
|
+
children: mode === "edit" ? `Edit ${paramName} parameter` : `Add Parameter to ${endpointName} endpoint`
|
|
3209
3191
|
}), /* @__PURE__ */ jsx("button", {
|
|
3210
3192
|
className: cx("modalCloseBtn"),
|
|
3211
3193
|
onClick: () => setConfirmModalOpen(false),
|
|
@@ -3222,7 +3204,9 @@ const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initia
|
|
|
3222
3204
|
mode === "edit" ? "edit" : "add",
|
|
3223
3205
|
" ",
|
|
3224
3206
|
paramName,
|
|
3225
|
-
" parameter
|
|
3207
|
+
" parameter",
|
|
3208
|
+
mode === "add" ? ` to ${endpointName} endpoint` : "",
|
|
3209
|
+
"?"
|
|
3226
3210
|
]
|
|
3227
3211
|
})
|
|
3228
3212
|
}),
|
|
@@ -3280,7 +3264,7 @@ const buildViewParamRows = (params) => params.map((p, idx) => ({
|
|
|
3280
3264
|
description: p.description ?? "",
|
|
3281
3265
|
enum: p.enum ?? []
|
|
3282
3266
|
}));
|
|
3283
|
-
const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse, endpointNames, endpointDescs, endpointTags, availableTags, onEndpointNameChange, onEndpointDescChange, onEndpointTagsChange, endpointParams, onAddParameter, onEditParameter, onDeleteParameter, endpointResponseParams, onAddResponseParameter, onEditResponseParameter, onDeleteResponseParameter, onRequestContentChange, onResponseContentChange, requestBodySchemas, responseBodySchemas, mode = "edit", selectedEndpointKey }) => {
|
|
3267
|
+
const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse, endpointNames, endpointDescs, endpointTags, availableTags, onEndpointNameChange, onEndpointDescChange, onEndpointTagsChange, endpointParams, onAddParameter, onEditParameter, onDeleteParameter, endpointResponseParams, onAddResponseParameter, onEditResponseParameter, onDeleteResponseParameter, onRequestContentChange, onResponseContentChange, resetKey, requestBodySchemas, responseBodySchemas, mode = "edit", selectedEndpointKey }) => {
|
|
3284
3268
|
const [expandedId, setExpandedId] = useState(null);
|
|
3285
3269
|
const [activeTab, setActiveTab] = useState("general");
|
|
3286
3270
|
useEffect(() => {
|
|
@@ -3313,6 +3297,15 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
3313
3297
|
const [openResponsePanels, setOpenResponsePanels] = useState(/* @__PURE__ */ new Set());
|
|
3314
3298
|
const [selectedStatusCodes, setSelectedStatusCodes] = useState({});
|
|
3315
3299
|
const [drawerSource, setDrawerSource] = useState("request");
|
|
3300
|
+
const drawerEndpointName = useMemo(() => {
|
|
3301
|
+
if (!paramDrawerEndpointId) return "";
|
|
3302
|
+
const ep = Object.values(endpointsByTag).flat().find((e) => e.id === paramDrawerEndpointId);
|
|
3303
|
+
return endpointNames[paramDrawerEndpointId] ?? ep?.summary ?? "";
|
|
3304
|
+
}, [
|
|
3305
|
+
paramDrawerEndpointId,
|
|
3306
|
+
endpointsByTag,
|
|
3307
|
+
endpointNames
|
|
3308
|
+
]);
|
|
3316
3309
|
const [requestPages, setRequestPages] = useState(/* @__PURE__ */ new Map());
|
|
3317
3310
|
const [responsePages, setResponsePages] = useState(/* @__PURE__ */ new Map());
|
|
3318
3311
|
const [requestSearches, setRequestSearches] = useState({});
|
|
@@ -3323,6 +3316,30 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
3323
3316
|
const debouncedResponseSearches = useDebounce(responseSearches);
|
|
3324
3317
|
const [editableRequestContent, setEditableRequestContent] = useState({});
|
|
3325
3318
|
const [editableResponseContent, setEditableResponseContent] = useState({});
|
|
3319
|
+
useEffect(() => {
|
|
3320
|
+
openRequestPanels.forEach((epId) => {
|
|
3321
|
+
const val = requestBodySchemas?.[epId];
|
|
3322
|
+
const json = val ? JSON.stringify(val, null, 2) : "";
|
|
3323
|
+
setEditableRequestContent((prev) => ({
|
|
3324
|
+
...prev,
|
|
3325
|
+
[epId]: json
|
|
3326
|
+
}));
|
|
3327
|
+
});
|
|
3328
|
+
openResponsePanels.forEach((epId) => {
|
|
3329
|
+
const val = responseBodySchemas?.[epId];
|
|
3330
|
+
const json = val ? JSON.stringify(val, null, 2) : "";
|
|
3331
|
+
setEditableResponseContent((prev) => ({
|
|
3332
|
+
...prev,
|
|
3333
|
+
[epId]: json
|
|
3334
|
+
}));
|
|
3335
|
+
});
|
|
3336
|
+
}, [
|
|
3337
|
+
resetKey,
|
|
3338
|
+
openRequestPanels,
|
|
3339
|
+
openResponsePanels,
|
|
3340
|
+
requestBodySchemas,
|
|
3341
|
+
responseBodySchemas
|
|
3342
|
+
]);
|
|
3326
3343
|
useEffect(() => {
|
|
3327
3344
|
if (!openRequestPanels.size) return;
|
|
3328
3345
|
openRequestPanels.forEach((epId) => {
|
|
@@ -3388,10 +3405,29 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
3388
3405
|
flexDirection: "column",
|
|
3389
3406
|
width: "100%",
|
|
3390
3407
|
flexShrink: 0,
|
|
3408
|
+
flex: 1,
|
|
3409
|
+
minHeight: 0,
|
|
3410
|
+
"& .ant-tabs": {
|
|
3411
|
+
height: "100%",
|
|
3412
|
+
display: "flex",
|
|
3413
|
+
flexDirection: "column"
|
|
3414
|
+
},
|
|
3391
3415
|
"& .ant-tabs-content-holder": {
|
|
3416
|
+
flex: 1,
|
|
3417
|
+
display: "flex",
|
|
3418
|
+
flexDirection: "column",
|
|
3392
3419
|
background: token.colorBgElevated,
|
|
3393
3420
|
borderRadius: token.borderRadiusLG,
|
|
3394
3421
|
padding: `${token.paddingLG}px ${token.paddingLG}px 48px`
|
|
3422
|
+
},
|
|
3423
|
+
"& .ant-tabs-content": {
|
|
3424
|
+
flex: 1,
|
|
3425
|
+
minHeight: 0
|
|
3426
|
+
},
|
|
3427
|
+
"& .ant-tabs-tabpane-active": {
|
|
3428
|
+
height: "100%",
|
|
3429
|
+
display: "flex",
|
|
3430
|
+
flexDirection: "column"
|
|
3395
3431
|
}
|
|
3396
3432
|
},
|
|
3397
3433
|
[scope("head")]: {
|
|
@@ -3494,7 +3530,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
3494
3530
|
display: "flex",
|
|
3495
3531
|
alignItems: "center",
|
|
3496
3532
|
justifyContent: "space-between",
|
|
3497
|
-
paddingBottom:
|
|
3533
|
+
paddingBottom: "18.5px",
|
|
3498
3534
|
borderBottom: `1px solid ${token.colorBorder}`,
|
|
3499
3535
|
width: "100%"
|
|
3500
3536
|
},
|
|
@@ -3569,7 +3605,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
3569
3605
|
alignItems: "center",
|
|
3570
3606
|
justifyContent: "space-between",
|
|
3571
3607
|
width: "100%",
|
|
3572
|
-
padding: `12px
|
|
3608
|
+
padding: `12px 0px`,
|
|
3573
3609
|
borderBottom: `1px solid ${token.colorBorderSecondary}`,
|
|
3574
3610
|
background: token.colorBgContainer,
|
|
3575
3611
|
"&:last-child": { borderBottom: "none" }
|
|
@@ -3602,6 +3638,13 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
3602
3638
|
whiteSpace: "nowrap",
|
|
3603
3639
|
maxWidth: 160
|
|
3604
3640
|
},
|
|
3641
|
+
[scope("param-detail-value-name")]: {
|
|
3642
|
+
overflow: "hidden",
|
|
3643
|
+
textOverflow: "ellipsis",
|
|
3644
|
+
whiteSpace: "nowrap",
|
|
3645
|
+
maxWidth: 200,
|
|
3646
|
+
display: "block"
|
|
3647
|
+
},
|
|
3605
3648
|
[scope("param-enum-container")]: {
|
|
3606
3649
|
display: "inline-flex",
|
|
3607
3650
|
flexDirection: "row",
|
|
@@ -3740,7 +3783,6 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
3740
3783
|
alignItems: "center",
|
|
3741
3784
|
position: "relative",
|
|
3742
3785
|
paddingTop: 20,
|
|
3743
|
-
paddingBottom: 8,
|
|
3744
3786
|
paddingLeft: 24,
|
|
3745
3787
|
paddingRight: 24,
|
|
3746
3788
|
width: "100%"
|
|
@@ -3766,7 +3808,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
3766
3808
|
border: "none",
|
|
3767
3809
|
background: "transparent",
|
|
3768
3810
|
padding: 0,
|
|
3769
|
-
color: token.
|
|
3811
|
+
color: token.colorTextTertiary,
|
|
3770
3812
|
fontSize: 16,
|
|
3771
3813
|
lineHeight: 1,
|
|
3772
3814
|
"&:hover": {
|
|
@@ -3779,7 +3821,6 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
3779
3821
|
alignItems: "center",
|
|
3780
3822
|
paddingLeft: 24,
|
|
3781
3823
|
paddingRight: 24,
|
|
3782
|
-
paddingBottom: 12,
|
|
3783
3824
|
height: 56,
|
|
3784
3825
|
width: "100%"
|
|
3785
3826
|
},
|
|
@@ -3906,6 +3947,8 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
3906
3947
|
alignItems: "center",
|
|
3907
3948
|
justifyContent: "center",
|
|
3908
3949
|
width: "100%",
|
|
3950
|
+
flex: 1,
|
|
3951
|
+
minHeight: 0,
|
|
3909
3952
|
"& .ant-empty": {
|
|
3910
3953
|
margin: 0,
|
|
3911
3954
|
display: "flex",
|
|
@@ -4001,9 +4044,21 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
4001
4044
|
title: "Parameter",
|
|
4002
4045
|
key: "parameter",
|
|
4003
4046
|
render: (_, row) => /* @__PURE__ */ jsxs("span", { children: [
|
|
4004
|
-
/* @__PURE__ */ jsx(
|
|
4005
|
-
|
|
4006
|
-
|
|
4047
|
+
/* @__PURE__ */ jsx(Tooltip, {
|
|
4048
|
+
title: row.name,
|
|
4049
|
+
placement: "bottom",
|
|
4050
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
4051
|
+
className: cx("view-param-name"),
|
|
4052
|
+
style: {
|
|
4053
|
+
display: "inline-block",
|
|
4054
|
+
maxWidth: 200,
|
|
4055
|
+
overflow: "hidden",
|
|
4056
|
+
textOverflow: "ellipsis",
|
|
4057
|
+
whiteSpace: "nowrap",
|
|
4058
|
+
verticalAlign: "bottom"
|
|
4059
|
+
},
|
|
4060
|
+
children: row.name
|
|
4061
|
+
})
|
|
4007
4062
|
}),
|
|
4008
4063
|
row.type && /* @__PURE__ */ jsx("span", {
|
|
4009
4064
|
className: cx("view-param-type"),
|
|
@@ -4021,9 +4076,21 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
4021
4076
|
{
|
|
4022
4077
|
title: "Description",
|
|
4023
4078
|
key: "description",
|
|
4024
|
-
render: (_, row) => /* @__PURE__ */ jsx(
|
|
4025
|
-
|
|
4026
|
-
|
|
4079
|
+
render: (_, row) => /* @__PURE__ */ jsx(Tooltip, {
|
|
4080
|
+
title: row.description || "--",
|
|
4081
|
+
placement: "bottom",
|
|
4082
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
4083
|
+
className: cx("view-param-desc"),
|
|
4084
|
+
style: {
|
|
4085
|
+
display: "inline-block",
|
|
4086
|
+
maxWidth: 200,
|
|
4087
|
+
overflow: "hidden",
|
|
4088
|
+
textOverflow: "ellipsis",
|
|
4089
|
+
whiteSpace: "nowrap",
|
|
4090
|
+
verticalAlign: "bottom"
|
|
4091
|
+
},
|
|
4092
|
+
children: row.description || "--"
|
|
4093
|
+
})
|
|
4027
4094
|
})
|
|
4028
4095
|
},
|
|
4029
4096
|
{
|
|
@@ -4202,6 +4269,10 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
4202
4269
|
ghost: true,
|
|
4203
4270
|
type: "primary",
|
|
4204
4271
|
icon: /* @__PURE__ */ jsx(PlusOutlined, {}),
|
|
4272
|
+
style: {
|
|
4273
|
+
height: 32,
|
|
4274
|
+
paddingInline: 8
|
|
4275
|
+
},
|
|
4205
4276
|
onClick: () => {
|
|
4206
4277
|
setDrawerSource("request");
|
|
4207
4278
|
setParamDrawerMode("add");
|
|
@@ -4238,6 +4309,10 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
4238
4309
|
ghost: true,
|
|
4239
4310
|
type: "primary",
|
|
4240
4311
|
icon: /* @__PURE__ */ jsx(PlusOutlined, {}),
|
|
4312
|
+
style: {
|
|
4313
|
+
height: 32,
|
|
4314
|
+
paddingInline: 8
|
|
4315
|
+
},
|
|
4241
4316
|
onClick: () => {
|
|
4242
4317
|
setDrawerSource("request");
|
|
4243
4318
|
setParamDrawerMode("add");
|
|
@@ -4319,9 +4394,13 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
4319
4394
|
children: [/* @__PURE__ */ jsx("span", {
|
|
4320
4395
|
className: cx("param-detail-label"),
|
|
4321
4396
|
children: "Parameter Name"
|
|
4322
|
-
}), /* @__PURE__ */ jsx(
|
|
4323
|
-
|
|
4324
|
-
|
|
4397
|
+
}), /* @__PURE__ */ jsx(Tooltip, {
|
|
4398
|
+
title: param.name,
|
|
4399
|
+
placement: "bottom",
|
|
4400
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
4401
|
+
className: cx("param-detail-value", "param-detail-value-name"),
|
|
4402
|
+
children: param.name
|
|
4403
|
+
})
|
|
4325
4404
|
})]
|
|
4326
4405
|
}), /* @__PURE__ */ jsxs("div", {
|
|
4327
4406
|
className: cx("param-detail-cell"),
|
|
@@ -4397,9 +4476,13 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
4397
4476
|
children: [/* @__PURE__ */ jsx("span", {
|
|
4398
4477
|
className: cx("param-detail-label"),
|
|
4399
4478
|
children: "Parameter Name"
|
|
4400
|
-
}), /* @__PURE__ */ jsx(
|
|
4401
|
-
|
|
4402
|
-
|
|
4479
|
+
}), /* @__PURE__ */ jsx(Tooltip, {
|
|
4480
|
+
title: param.name,
|
|
4481
|
+
placement: "bottom",
|
|
4482
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
4483
|
+
className: cx("param-detail-value", "param-detail-value-name"),
|
|
4484
|
+
children: param.name
|
|
4485
|
+
})
|
|
4403
4486
|
})]
|
|
4404
4487
|
}),
|
|
4405
4488
|
/* @__PURE__ */ jsxs("div", {
|
|
@@ -4438,7 +4521,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
4438
4521
|
margin: 0,
|
|
4439
4522
|
paddingLeft: 16
|
|
4440
4523
|
},
|
|
4441
|
-
children: param.enum.map((e) => /* @__PURE__ */ jsx("li", { children: e }, e))
|
|
4524
|
+
children: param.enum.slice(1).map((e) => /* @__PURE__ */ jsx("li", { children: e }, e))
|
|
4442
4525
|
}),
|
|
4443
4526
|
placement: "bottom",
|
|
4444
4527
|
children: /* @__PURE__ */ jsxs("span", {
|
|
@@ -4466,9 +4549,13 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
4466
4549
|
children: [/* @__PURE__ */ jsx("span", {
|
|
4467
4550
|
className: cx("param-detail-label"),
|
|
4468
4551
|
children: "Description"
|
|
4469
|
-
}), /* @__PURE__ */ jsx(
|
|
4470
|
-
|
|
4471
|
-
|
|
4552
|
+
}), /* @__PURE__ */ jsx(Tooltip, {
|
|
4553
|
+
title: param.description || "—",
|
|
4554
|
+
placement: "bottom",
|
|
4555
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
4556
|
+
className: cx("param-detail-value", "param-detail-value--ellipsis"),
|
|
4557
|
+
children: param.description || "—"
|
|
4558
|
+
})
|
|
4472
4559
|
})]
|
|
4473
4560
|
})
|
|
4474
4561
|
]
|
|
@@ -4621,6 +4708,10 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
4621
4708
|
ghost: true,
|
|
4622
4709
|
type: "primary",
|
|
4623
4710
|
icon: /* @__PURE__ */ jsx(PlusOutlined, {}),
|
|
4711
|
+
style: {
|
|
4712
|
+
height: 32,
|
|
4713
|
+
paddingInline: 8
|
|
4714
|
+
},
|
|
4624
4715
|
onClick: () => {
|
|
4625
4716
|
setDrawerSource("response");
|
|
4626
4717
|
setParamDrawerMode("add");
|
|
@@ -4711,6 +4802,10 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
4711
4802
|
ghost: true,
|
|
4712
4803
|
type: "primary",
|
|
4713
4804
|
icon: /* @__PURE__ */ jsx(PlusOutlined, {}),
|
|
4805
|
+
style: {
|
|
4806
|
+
height: 32,
|
|
4807
|
+
paddingInline: 8
|
|
4808
|
+
},
|
|
4714
4809
|
onClick: () => {
|
|
4715
4810
|
setDrawerSource("response");
|
|
4716
4811
|
setParamDrawerMode("add");
|
|
@@ -4870,9 +4965,13 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
4870
4965
|
children: [/* @__PURE__ */ jsx("span", {
|
|
4871
4966
|
className: cx("param-detail-label"),
|
|
4872
4967
|
children: "Parameter Name"
|
|
4873
|
-
}), /* @__PURE__ */ jsx(
|
|
4874
|
-
|
|
4875
|
-
|
|
4968
|
+
}), /* @__PURE__ */ jsx(Tooltip, {
|
|
4969
|
+
title: param.name,
|
|
4970
|
+
placement: "bottom",
|
|
4971
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
4972
|
+
className: cx("param-detail-value", "param-detail-value-name"),
|
|
4973
|
+
children: param.name
|
|
4974
|
+
})
|
|
4876
4975
|
})]
|
|
4877
4976
|
}),
|
|
4878
4977
|
/* @__PURE__ */ jsxs("div", {
|
|
@@ -4911,7 +5010,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
4911
5010
|
margin: 0,
|
|
4912
5011
|
paddingLeft: 16
|
|
4913
5012
|
},
|
|
4914
|
-
children: param.enum.map((e) => /* @__PURE__ */ jsx("li", { children: e }, e))
|
|
5013
|
+
children: param.enum.slice(1).map((e) => /* @__PURE__ */ jsx("li", { children: e }, e))
|
|
4915
5014
|
}),
|
|
4916
5015
|
placement: "bottom",
|
|
4917
5016
|
children: /* @__PURE__ */ jsxs("span", {
|
|
@@ -4939,9 +5038,13 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
4939
5038
|
children: [/* @__PURE__ */ jsx("span", {
|
|
4940
5039
|
className: cx("param-detail-label"),
|
|
4941
5040
|
children: "Description"
|
|
4942
|
-
}), /* @__PURE__ */ jsx(
|
|
4943
|
-
|
|
4944
|
-
|
|
5041
|
+
}), /* @__PURE__ */ jsx(Tooltip, {
|
|
5042
|
+
title: param.description || "—",
|
|
5043
|
+
placement: "bottom",
|
|
5044
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
5045
|
+
className: cx("param-detail-value", "param-detail-value--ellipsis"),
|
|
5046
|
+
children: param.description || "—"
|
|
5047
|
+
})
|
|
4945
5048
|
})]
|
|
4946
5049
|
})
|
|
4947
5050
|
]
|
|
@@ -5004,20 +5107,13 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
5004
5107
|
className: cx("param-row", openResponsePanels.has(ep.id) ? "param-row--open" : ""),
|
|
5005
5108
|
style: { marginTop: token.margin },
|
|
5006
5109
|
onClick: () => toggleResponsePanel(ep.id),
|
|
5007
|
-
children: [
|
|
5008
|
-
|
|
5009
|
-
/* @__PURE__ */
|
|
5010
|
-
style: {
|
|
5011
|
-
children:
|
|
5012
|
-
|
|
5013
|
-
|
|
5014
|
-
})]
|
|
5015
|
-
}),
|
|
5016
|
-
/* @__PURE__ */ jsx(InfoCircle, { style: {
|
|
5017
|
-
width: 24,
|
|
5018
|
-
height: 24
|
|
5019
|
-
} })
|
|
5020
|
-
]
|
|
5110
|
+
children: [/* @__PURE__ */ jsx(DownOutlined, { className: cx("param-row-icon", openResponsePanels.has(ep.id) ? "param-row-icon--open" : "") }), /* @__PURE__ */ jsxs("span", {
|
|
5111
|
+
style: { fontSize: token.fontSize },
|
|
5112
|
+
children: ["Response ", /* @__PURE__ */ jsx("span", {
|
|
5113
|
+
style: { color: token.colorError },
|
|
5114
|
+
children: "*"
|
|
5115
|
+
})]
|
|
5116
|
+
})]
|
|
5021
5117
|
}),
|
|
5022
5118
|
openResponsePanels.has(ep.id) && /* @__PURE__ */ jsxs("div", {
|
|
5023
5119
|
className: cx("code-panel"),
|
|
@@ -5180,6 +5276,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
5180
5276
|
/* @__PURE__ */ jsx(AddParameterDrawer, {
|
|
5181
5277
|
open: paramDrawerOpen,
|
|
5182
5278
|
mode: paramDrawerMode,
|
|
5279
|
+
endpointName: drawerEndpointName,
|
|
5183
5280
|
initialValues: paramDrawerMode === "edit" && paramDrawerEndpointId && editParamIdx !== null ? drawerSource === "response" ? endpointResponseParams[paramDrawerEndpointId]?.[editParamIdx] : endpointParams[paramDrawerEndpointId]?.[editParamIdx] : void 0,
|
|
5184
5281
|
onClose: () => {
|
|
5185
5282
|
setParamDrawerOpen(false);
|
|
@@ -5467,6 +5564,10 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
5467
5564
|
ghost: true,
|
|
5468
5565
|
type: "primary",
|
|
5469
5566
|
icon: /* @__PURE__ */ jsx(PlusOutlined, {}),
|
|
5567
|
+
style: {
|
|
5568
|
+
height: 32,
|
|
5569
|
+
paddingInline: 8
|
|
5570
|
+
},
|
|
5470
5571
|
onClick: () => {
|
|
5471
5572
|
setDrawerSource("request");
|
|
5472
5573
|
setParamDrawerMode("add");
|
|
@@ -5503,6 +5604,10 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
5503
5604
|
ghost: true,
|
|
5504
5605
|
type: "primary",
|
|
5505
5606
|
icon: /* @__PURE__ */ jsx(PlusOutlined, {}),
|
|
5607
|
+
style: {
|
|
5608
|
+
height: 32,
|
|
5609
|
+
paddingInline: 8
|
|
5610
|
+
},
|
|
5506
5611
|
onClick: () => {
|
|
5507
5612
|
setDrawerSource("request");
|
|
5508
5613
|
setParamDrawerMode("add");
|
|
@@ -5884,6 +5989,10 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
5884
5989
|
ghost: true,
|
|
5885
5990
|
type: "primary",
|
|
5886
5991
|
icon: /* @__PURE__ */ jsx(PlusOutlined, {}),
|
|
5992
|
+
style: {
|
|
5993
|
+
height: 32,
|
|
5994
|
+
paddingInline: 8
|
|
5995
|
+
},
|
|
5887
5996
|
onClick: () => {
|
|
5888
5997
|
setDrawerSource("response");
|
|
5889
5998
|
setParamDrawerMode("add");
|
|
@@ -5974,6 +6083,10 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
5974
6083
|
ghost: true,
|
|
5975
6084
|
type: "primary",
|
|
5976
6085
|
icon: /* @__PURE__ */ jsx(PlusOutlined, {}),
|
|
6086
|
+
style: {
|
|
6087
|
+
height: 32,
|
|
6088
|
+
paddingInline: 8
|
|
6089
|
+
},
|
|
5977
6090
|
onClick: () => {
|
|
5978
6091
|
setDrawerSource("response");
|
|
5979
6092
|
setParamDrawerMode("add");
|
|
@@ -6267,20 +6380,13 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
6267
6380
|
className: cx("param-row", openResponsePanels.has(ep.id) ? "param-row--open" : ""),
|
|
6268
6381
|
style: { marginTop: token.margin },
|
|
6269
6382
|
onClick: () => toggleResponsePanel(ep.id),
|
|
6270
|
-
children: [
|
|
6271
|
-
|
|
6272
|
-
/* @__PURE__ */
|
|
6273
|
-
style: {
|
|
6274
|
-
children:
|
|
6275
|
-
|
|
6276
|
-
|
|
6277
|
-
})]
|
|
6278
|
-
}),
|
|
6279
|
-
/* @__PURE__ */ jsx(InfoCircle, { style: {
|
|
6280
|
-
width: 24,
|
|
6281
|
-
height: 24
|
|
6282
|
-
} })
|
|
6283
|
-
]
|
|
6383
|
+
children: [/* @__PURE__ */ jsx(DownOutlined, { className: cx("param-row-icon", openResponsePanels.has(ep.id) ? "param-row-icon--open" : "") }), /* @__PURE__ */ jsxs("span", {
|
|
6384
|
+
style: { fontSize: token.fontSize },
|
|
6385
|
+
children: ["Response ", /* @__PURE__ */ jsx("span", {
|
|
6386
|
+
style: { color: token.colorError },
|
|
6387
|
+
children: "*"
|
|
6388
|
+
})]
|
|
6389
|
+
})]
|
|
6284
6390
|
}),
|
|
6285
6391
|
openResponsePanels.has(ep.id) && /* @__PURE__ */ jsxs("div", {
|
|
6286
6392
|
className: cx("code-panel"),
|
|
@@ -6445,6 +6551,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
6445
6551
|
/* @__PURE__ */ jsx(AddParameterDrawer, {
|
|
6446
6552
|
open: paramDrawerOpen,
|
|
6447
6553
|
mode: paramDrawerMode,
|
|
6554
|
+
endpointName: drawerEndpointName,
|
|
6448
6555
|
initialValues: paramDrawerMode === "edit" && paramDrawerEndpointId && editParamIdx !== null ? drawerSource === "response" ? endpointResponseParams[paramDrawerEndpointId]?.[editParamIdx] : endpointParams[paramDrawerEndpointId]?.[editParamIdx] : void 0,
|
|
6449
6556
|
onClose: () => {
|
|
6450
6557
|
setParamDrawerOpen(false);
|
|
@@ -7482,7 +7589,8 @@ const EditModeSidebar = ({ selectedItem, onSelectItem, endpoints, hasGeneralErro
|
|
|
7482
7589
|
[scope("badge")]: {
|
|
7483
7590
|
minWidth: "3.75rem",
|
|
7484
7591
|
textAlign: "center",
|
|
7485
|
-
border: "none"
|
|
7592
|
+
border: "none",
|
|
7593
|
+
fontSize: 14
|
|
7486
7594
|
},
|
|
7487
7595
|
[scope("path")]: {
|
|
7488
7596
|
fontSize: token.fontSize,
|
|
@@ -8161,37 +8269,28 @@ const buildRequestData = (params, token) => [...params].sort((a, b) => a.require
|
|
|
8161
8269
|
if (p.schema?.type === "array" && p.schema?.items?.type) typeLabel = `${p.schema.type}_${p.schema.items.type}`;
|
|
8162
8270
|
return {
|
|
8163
8271
|
key: index,
|
|
8164
|
-
param: /* @__PURE__ */ jsxs("span", {
|
|
8165
|
-
|
|
8166
|
-
|
|
8167
|
-
|
|
8168
|
-
|
|
8169
|
-
|
|
8170
|
-
|
|
8171
|
-
|
|
8172
|
-
|
|
8173
|
-
|
|
8174
|
-
|
|
8175
|
-
|
|
8176
|
-
|
|
8177
|
-
|
|
8178
|
-
|
|
8179
|
-
|
|
8180
|
-
|
|
8181
|
-
|
|
8182
|
-
|
|
8183
|
-
|
|
8184
|
-
|
|
8185
|
-
})
|
|
8186
|
-
const buildHeaderData = (headers, token) => {
|
|
8187
|
-
if (!headers) return [];
|
|
8188
|
-
return Object.entries(headers).sort(([, a], [, b]) => a.required === b.required ? 0 : a.required ? -1 : 1).map(([name, header], idx) => {
|
|
8189
|
-
let typeLabel = header.schema?.type;
|
|
8190
|
-
if (header.schema?.type === "array" && header.schema?.items?.type) typeLabel = `${header.schema.type}_${header.schema.items.type}`;
|
|
8191
|
-
return {
|
|
8192
|
-
key: idx,
|
|
8193
|
-
param: /* @__PURE__ */ jsxs("span", { children: [
|
|
8194
|
-
name,
|
|
8272
|
+
param: /* @__PURE__ */ jsxs("span", {
|
|
8273
|
+
style: {
|
|
8274
|
+
display: "flex",
|
|
8275
|
+
alignItems: "center",
|
|
8276
|
+
gap: 4
|
|
8277
|
+
},
|
|
8278
|
+
children: [
|
|
8279
|
+
/* @__PURE__ */ jsx(Tooltip, {
|
|
8280
|
+
title: p.name,
|
|
8281
|
+
placement: "bottom",
|
|
8282
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
8283
|
+
style: {
|
|
8284
|
+
display: "inline-block",
|
|
8285
|
+
maxWidth: 200,
|
|
8286
|
+
overflow: "hidden",
|
|
8287
|
+
textOverflow: "ellipsis",
|
|
8288
|
+
whiteSpace: "nowrap",
|
|
8289
|
+
verticalAlign: "bottom"
|
|
8290
|
+
},
|
|
8291
|
+
children: p.name
|
|
8292
|
+
})
|
|
8293
|
+
}),
|
|
8195
8294
|
typeLabel && /* @__PURE__ */ jsx("span", {
|
|
8196
8295
|
style: {
|
|
8197
8296
|
color: token.colorTextTertiary,
|
|
@@ -8200,50 +8299,84 @@ const buildHeaderData = (headers, token) => {
|
|
|
8200
8299
|
},
|
|
8201
8300
|
children: typeLabel
|
|
8202
8301
|
}),
|
|
8203
|
-
|
|
8302
|
+
p.required ? /* @__PURE__ */ jsx("span", {
|
|
8204
8303
|
style: { color: token.colorError },
|
|
8205
8304
|
children: "*"
|
|
8206
8305
|
}) : /* @__PURE__ */ jsx("span", {
|
|
8207
8306
|
style: { color: token.colorSuccess },
|
|
8208
8307
|
children: "Optional"
|
|
8209
8308
|
})
|
|
8210
|
-
]
|
|
8309
|
+
]
|
|
8310
|
+
}),
|
|
8311
|
+
desc: /* @__PURE__ */ jsx(Tooltip, {
|
|
8312
|
+
title: p.description || "--",
|
|
8313
|
+
placement: "bottom",
|
|
8314
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
8315
|
+
style: {
|
|
8316
|
+
display: "inline-block",
|
|
8317
|
+
maxWidth: 300,
|
|
8318
|
+
overflow: "hidden",
|
|
8319
|
+
textOverflow: "ellipsis",
|
|
8320
|
+
whiteSpace: "nowrap",
|
|
8321
|
+
verticalAlign: "bottom"
|
|
8322
|
+
},
|
|
8323
|
+
children: p.description || "--"
|
|
8324
|
+
})
|
|
8325
|
+
}),
|
|
8326
|
+
enum: p.schema?.enum ? renderEnumTags(p.schema.enum, token) : "--"
|
|
8327
|
+
};
|
|
8328
|
+
});
|
|
8329
|
+
const buildHeaderData = (headers, token) => {
|
|
8330
|
+
if (!headers) return [];
|
|
8331
|
+
return Object.entries(headers).sort(([, a], [, b]) => a.required === b.required ? 0 : a.required ? -1 : 1).map(([name, header], idx) => {
|
|
8332
|
+
let typeLabel = header.schema?.type;
|
|
8333
|
+
if (header.schema?.type === "array" && header.schema?.items?.type) typeLabel = `${header.schema.type}_${header.schema.items.type}`;
|
|
8334
|
+
return {
|
|
8335
|
+
key: idx,
|
|
8336
|
+
param: /* @__PURE__ */ jsxs("span", {
|
|
8337
|
+
style: {
|
|
8338
|
+
display: "flex",
|
|
8339
|
+
alignItems: "center",
|
|
8340
|
+
gap: 4
|
|
8341
|
+
},
|
|
8342
|
+
children: [
|
|
8343
|
+
/* @__PURE__ */ jsx(Tooltip, {
|
|
8344
|
+
title: name,
|
|
8345
|
+
placement: "bottom",
|
|
8346
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
8347
|
+
style: {
|
|
8348
|
+
display: "inline-block",
|
|
8349
|
+
maxWidth: 200,
|
|
8350
|
+
overflow: "hidden",
|
|
8351
|
+
textOverflow: "ellipsis",
|
|
8352
|
+
whiteSpace: "nowrap",
|
|
8353
|
+
verticalAlign: "bottom"
|
|
8354
|
+
},
|
|
8355
|
+
children: name
|
|
8356
|
+
})
|
|
8357
|
+
}),
|
|
8358
|
+
typeLabel && /* @__PURE__ */ jsx("span", {
|
|
8359
|
+
style: {
|
|
8360
|
+
color: token.colorTextTertiary,
|
|
8361
|
+
marginLeft: "0.25rem",
|
|
8362
|
+
marginRight: "0.25rem"
|
|
8363
|
+
},
|
|
8364
|
+
children: typeLabel
|
|
8365
|
+
}),
|
|
8366
|
+
header.required ? /* @__PURE__ */ jsx("span", {
|
|
8367
|
+
style: { color: token.colorError },
|
|
8368
|
+
children: "*"
|
|
8369
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
8370
|
+
style: { color: token.colorSuccess },
|
|
8371
|
+
children: "Optional"
|
|
8372
|
+
})
|
|
8373
|
+
]
|
|
8374
|
+
}, idx),
|
|
8211
8375
|
desc: header.description || "--",
|
|
8212
8376
|
enum: header.schema?.enum ? renderEnumTags(header.schema.enum, token) : "--"
|
|
8213
8377
|
};
|
|
8214
8378
|
});
|
|
8215
8379
|
};
|
|
8216
|
-
const buildRequestBodyData = (requestBody, token) => {
|
|
8217
|
-
if (!requestBody?.content) return [];
|
|
8218
|
-
const contentType = Object.keys(requestBody.content)[0];
|
|
8219
|
-
const schema = requestBody.content[contentType]?.schema;
|
|
8220
|
-
if (!schema) return [];
|
|
8221
|
-
const properties = schema.properties ?? {};
|
|
8222
|
-
const required = schema.required ?? [];
|
|
8223
|
-
return Object.entries(properties).map(([name, prop], idx) => ({
|
|
8224
|
-
key: idx,
|
|
8225
|
-
param: /* @__PURE__ */ jsxs("span", { children: [
|
|
8226
|
-
name,
|
|
8227
|
-
prop.type && /* @__PURE__ */ jsx("span", {
|
|
8228
|
-
style: {
|
|
8229
|
-
color: token.colorTextTertiary,
|
|
8230
|
-
marginLeft: "0.25rem",
|
|
8231
|
-
marginRight: "0.25rem"
|
|
8232
|
-
},
|
|
8233
|
-
children: prop.type
|
|
8234
|
-
}),
|
|
8235
|
-
required.includes(name) ? /* @__PURE__ */ jsx("span", {
|
|
8236
|
-
style: { color: token.colorError },
|
|
8237
|
-
children: "*"
|
|
8238
|
-
}) : /* @__PURE__ */ jsx("span", {
|
|
8239
|
-
style: { color: token.colorSuccess },
|
|
8240
|
-
children: "Optional"
|
|
8241
|
-
})
|
|
8242
|
-
] }),
|
|
8243
|
-
desc: prop.description || "--",
|
|
8244
|
-
enum: prop.enum ? renderEnumTags(prop.enum, token) : "--"
|
|
8245
|
-
}));
|
|
8246
|
-
};
|
|
8247
8380
|
const EndpointPage = () => {
|
|
8248
8381
|
const { selectedEndpoint, selectedApi, selectedStatusCode, setSelectedNodeKey, setFocusedContent, setFocusedTag, setActiveRequestTab } = useStore(({ view }) => view);
|
|
8249
8382
|
const [activeTabKey, setActiveTabKey] = useState("header");
|
|
@@ -8292,7 +8425,6 @@ const EndpointPage = () => {
|
|
|
8292
8425
|
const headerParams = buildRequestData(selectedEndpoint?.parameters?.filter((p) => p.in === "header") || [], token);
|
|
8293
8426
|
const pathParams = buildRequestData(selectedEndpoint?.parameters?.filter((p) => p.in === "path") || [], token);
|
|
8294
8427
|
const queryParams = buildRequestData(selectedEndpoint?.parameters?.filter((p) => p.in === "query") || [], token);
|
|
8295
|
-
const requestBodyData = buildRequestBodyData(selectedEndpoint?.requestBody, token);
|
|
8296
8428
|
const requestTabs = [
|
|
8297
8429
|
{
|
|
8298
8430
|
key: "header",
|
|
@@ -8329,19 +8461,7 @@ const EndpointPage = () => {
|
|
|
8329
8461
|
size: "small",
|
|
8330
8462
|
rowClassName: (_, idx) => cx(idx % 2 === 0 ? "row-even" : "row-odd")
|
|
8331
8463
|
})
|
|
8332
|
-
}
|
|
8333
|
-
...requestBodyData.length > 0 ? [{
|
|
8334
|
-
key: "requestBody",
|
|
8335
|
-
label: "Request Body",
|
|
8336
|
-
children: /* @__PURE__ */ jsx(Table, {
|
|
8337
|
-
columns: requestColumns,
|
|
8338
|
-
dataSource: requestBodyData,
|
|
8339
|
-
pagination: false,
|
|
8340
|
-
bordered: true,
|
|
8341
|
-
size: "small",
|
|
8342
|
-
rowClassName: (_, idx) => cx(idx % 2 === 0 ? "row-even" : "row-odd")
|
|
8343
|
-
})
|
|
8344
|
-
}] : []
|
|
8464
|
+
}
|
|
8345
8465
|
].filter((t) => t !== null);
|
|
8346
8466
|
useEffect(() => {
|
|
8347
8467
|
const firstKey = requestTabs[0]?.key ?? "header";
|
|
@@ -9046,9 +9166,10 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
|
|
|
9046
9166
|
gap: token.marginLG,
|
|
9047
9167
|
height: "100%"
|
|
9048
9168
|
},
|
|
9049
|
-
[scope("section")]: {
|
|
9050
|
-
|
|
9051
|
-
|
|
9169
|
+
[scope("section")]: { flexShrink: 0 },
|
|
9170
|
+
[scope("section-grow")]: {
|
|
9171
|
+
flex: 1,
|
|
9172
|
+
minHeight: 0
|
|
9052
9173
|
},
|
|
9053
9174
|
[scope("docs-layout")]: {
|
|
9054
9175
|
display: "flex",
|
|
@@ -9181,7 +9302,8 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
|
|
|
9181
9302
|
type: schema?.type ?? "string",
|
|
9182
9303
|
required: Boolean(p.required ?? false),
|
|
9183
9304
|
description: p.description != null ? String(p.description) : void 0,
|
|
9184
|
-
enum: Array.isArray(schema?.enum) ? schema.enum : void 0
|
|
9305
|
+
enum: Array.isArray(schema?.enum) ? schema.enum : void 0,
|
|
9306
|
+
...schema?.items && { items: { type: schema.items.type ?? "string" } }
|
|
9185
9307
|
};
|
|
9186
9308
|
});
|
|
9187
9309
|
});
|
|
@@ -9211,7 +9333,8 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
|
|
|
9211
9333
|
type: schema?.type ?? "string",
|
|
9212
9334
|
required: Boolean(p.required ?? false),
|
|
9213
9335
|
description: p.description != null ? String(p.description) : void 0,
|
|
9214
|
-
enum: Array.isArray(schema?.enum) ? schema.enum : void 0
|
|
9336
|
+
enum: Array.isArray(schema?.enum) ? schema.enum : void 0,
|
|
9337
|
+
...schema?.items && { items: { type: schema.items.type ?? "string" } }
|
|
9215
9338
|
};
|
|
9216
9339
|
});
|
|
9217
9340
|
});
|
|
@@ -9229,7 +9352,7 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
|
|
|
9229
9352
|
const result = {};
|
|
9230
9353
|
Object.entries(rawFile.paths).forEach(([path, methods]) => {
|
|
9231
9354
|
Object.entries(methods).forEach(([method, operation]) => {
|
|
9232
|
-
const schema = operation.requestBody?.content?.["application/json"]?.
|
|
9355
|
+
const schema = operation.requestBody?.content?.["application/json"]?.example;
|
|
9233
9356
|
const epId = pathMethodToId[`${path}||${method}`];
|
|
9234
9357
|
if (epId && schema) result[epId] = schema;
|
|
9235
9358
|
});
|
|
@@ -9282,6 +9405,14 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
|
|
|
9282
9405
|
}
|
|
9283
9406
|
if (JSON.stringify(endpointParams) !== JSON.stringify(initialEndpointParams)) return true;
|
|
9284
9407
|
if (JSON.stringify(endpointResponseParams) !== JSON.stringify(initialEndpointResponseParams)) return true;
|
|
9408
|
+
if (JSON.stringify(endpointRequestBody) !== JSON.stringify(initialEndpointRequestBody)) {
|
|
9409
|
+
console.log("hasChanges: endpointRequestBody changed", {
|
|
9410
|
+
endpointRequestBody,
|
|
9411
|
+
initialEndpointRequestBody
|
|
9412
|
+
});
|
|
9413
|
+
return true;
|
|
9414
|
+
}
|
|
9415
|
+
if (JSON.stringify(endpointResponseBody) !== JSON.stringify(initialEndpointResponseBody)) return true;
|
|
9285
9416
|
return false;
|
|
9286
9417
|
}, [
|
|
9287
9418
|
selectedApi,
|
|
@@ -9296,7 +9427,11 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
|
|
|
9296
9427
|
endpointParams,
|
|
9297
9428
|
endpointResponseParams,
|
|
9298
9429
|
initialEndpointParams,
|
|
9299
|
-
initialEndpointResponseParams
|
|
9430
|
+
initialEndpointResponseParams,
|
|
9431
|
+
endpointRequestBody,
|
|
9432
|
+
initialEndpointRequestBody,
|
|
9433
|
+
endpointResponseBody,
|
|
9434
|
+
initialEndpointResponseBody
|
|
9300
9435
|
]);
|
|
9301
9436
|
useEffect(() => {
|
|
9302
9437
|
setBannerVisible(hasChanges);
|
|
@@ -9415,6 +9550,9 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
|
|
|
9415
9550
|
setEndpointTags({});
|
|
9416
9551
|
setEndpointParams(initialEndpointParams);
|
|
9417
9552
|
setEndpointResponseParams(initialEndpointResponseParams);
|
|
9553
|
+
setEndpointRequestBody(initialEndpointRequestBody);
|
|
9554
|
+
setEndpointResponseBody(initialEndpointResponseBody);
|
|
9555
|
+
setLocalTags(tagMetadata);
|
|
9418
9556
|
setResetKey((prev) => prev + 1);
|
|
9419
9557
|
messageApi.success("Changes have been reset successfully.");
|
|
9420
9558
|
};
|
|
@@ -9467,7 +9605,8 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
|
|
|
9467
9605
|
...param.description && { description: param.description },
|
|
9468
9606
|
schema: {
|
|
9469
9607
|
type: param.type,
|
|
9470
|
-
...param.enum && param.enum.length > 0 && { enum: param.enum }
|
|
9608
|
+
...param.enum && param.enum.length > 0 && { enum: param.enum },
|
|
9609
|
+
...param.type === "array" && param.items && { items: param.items }
|
|
9471
9610
|
}
|
|
9472
9611
|
}));
|
|
9473
9612
|
else delete methodObj.parameters;
|
|
@@ -9484,7 +9623,8 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
|
|
|
9484
9623
|
...param.description && { description: param.description },
|
|
9485
9624
|
schema: {
|
|
9486
9625
|
type: param.type,
|
|
9487
|
-
...param.enum && param.enum.length > 0 && { enum: param.enum }
|
|
9626
|
+
...param.enum && param.enum.length > 0 && { enum: param.enum },
|
|
9627
|
+
...param.type === "array" && param.items && { items: param.items }
|
|
9488
9628
|
}
|
|
9489
9629
|
}));
|
|
9490
9630
|
else delete methodObj["x-response-params"];
|
|
@@ -9501,7 +9641,7 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
|
|
|
9501
9641
|
if (!methodObjAny.requestBody) methodObjAny.requestBody = {};
|
|
9502
9642
|
const rb = methodObjAny.requestBody;
|
|
9503
9643
|
if (!rb.content) rb.content = {};
|
|
9504
|
-
rb.content["application/json"] = { schema };
|
|
9644
|
+
rb.content["application/json"] = { example: schema };
|
|
9505
9645
|
});
|
|
9506
9646
|
Object.entries(endpointResponseBody).forEach(([id, schema]) => {
|
|
9507
9647
|
const loc = idToPathMethod[id];
|
|
@@ -9531,10 +9671,9 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
|
|
|
9531
9671
|
setSelectedApi(newTransformed);
|
|
9532
9672
|
} catch (err) {
|
|
9533
9673
|
let messages = [];
|
|
9534
|
-
if (err && typeof err === "object" && "
|
|
9535
|
-
|
|
9536
|
-
|
|
9537
|
-
} else if (err instanceof Error) messages = err.message.split("\n").filter(Boolean);
|
|
9674
|
+
if (err && typeof err === "object" && "data" in err) messages = [err.data?.message ?? "Unknown error"];
|
|
9675
|
+
else if (err && typeof err === "object" && "message" in err) messages = [String(err.message)];
|
|
9676
|
+
else if (err instanceof Error) messages = err.message.split("\n").filter(Boolean);
|
|
9538
9677
|
else messages = [String(err)];
|
|
9539
9678
|
setSaveErrors(messages);
|
|
9540
9679
|
setSelectedEditItem({ type: "errors" });
|
|
@@ -9679,15 +9818,16 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
|
|
|
9679
9818
|
display: "flex",
|
|
9680
9819
|
alignItems: "center",
|
|
9681
9820
|
gap: 8,
|
|
9682
|
-
padding: "8px 12px",
|
|
9821
|
+
padding: mode === "view" ? "8px 12px" : "0 12px",
|
|
9683
9822
|
border: "none",
|
|
9684
9823
|
cursor: "pointer",
|
|
9685
|
-
borderRadius: 8,
|
|
9824
|
+
borderRadius: mode === "view" ? 8 : 12,
|
|
9686
9825
|
fontFamily: token.fontFamily,
|
|
9687
9826
|
background: mode === "view" ? token.colorBgContainer : "transparent",
|
|
9688
9827
|
boxShadow: mode === "view" ? "0px 2px 4px -2px rgba(17,12,34,0.12)" : "none",
|
|
9689
9828
|
fontWeight: mode === "view" ? 700 : 400,
|
|
9690
|
-
fontSize:
|
|
9829
|
+
fontSize: token.fontSize,
|
|
9830
|
+
lineHeight: "22px",
|
|
9691
9831
|
color: token.colorText
|
|
9692
9832
|
},
|
|
9693
9833
|
children: [/* @__PURE__ */ jsx(EyeOutlined, { style: { fontSize: 18 } }), "View"]
|
|
@@ -9789,10 +9929,11 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
|
|
|
9789
9929
|
})
|
|
9790
9930
|
}),
|
|
9791
9931
|
/* @__PURE__ */ jsx("div", {
|
|
9792
|
-
className: cx("section"),
|
|
9932
|
+
className: cx("section", "section-grow"),
|
|
9793
9933
|
children: /* @__PURE__ */ jsx(EndpointsSection, {
|
|
9794
9934
|
mode,
|
|
9795
9935
|
endpointsByTag: getEndpointsByTag(),
|
|
9936
|
+
resetKey,
|
|
9796
9937
|
collapsed: endpointsCollapsed,
|
|
9797
9938
|
onToggleCollapse: () => setEndpointsCollapsed((c) => !c),
|
|
9798
9939
|
endpointNames,
|
|
@@ -9886,7 +10027,7 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
|
|
|
9886
10027
|
},
|
|
9887
10028
|
requestBodySchemas: endpointRequestBody,
|
|
9888
10029
|
responseBodySchemas: endpointResponseBody
|
|
9889
|
-
}
|
|
10030
|
+
})
|
|
9890
10031
|
})
|
|
9891
10032
|
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
9892
10033
|
selectedEditItem.type === "errors" && errorBox && /* @__PURE__ */ jsx("div", {
|
|
@@ -10046,8 +10187,9 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
|
|
|
10046
10187
|
} catch {}
|
|
10047
10188
|
},
|
|
10048
10189
|
requestBodySchemas: endpointRequestBody,
|
|
10049
|
-
responseBodySchemas: endpointResponseBody
|
|
10050
|
-
|
|
10190
|
+
responseBodySchemas: endpointResponseBody,
|
|
10191
|
+
resetKey
|
|
10192
|
+
})
|
|
10051
10193
|
] })
|
|
10052
10194
|
})]
|
|
10053
10195
|
}) : /* @__PURE__ */ jsxs("div", {
|