@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.cjs
CHANGED
|
@@ -104,8 +104,10 @@ const useStore = (0, zustand.create)()((0, zustand_middleware.devtools)((0, zust
|
|
|
104
104
|
//#region src/hooks/useStyle.ts
|
|
105
105
|
function useStyle(componentName, stylesFn) {
|
|
106
106
|
const { token, theme, hashId } = antd.theme.useToken();
|
|
107
|
-
const
|
|
108
|
-
const
|
|
107
|
+
const tokenKey = token._tokenKey;
|
|
108
|
+
const themeId = tokenKey ? `tk-${tokenKey.slice(-6)}` : "tk-default";
|
|
109
|
+
const scope = (className) => `.${hashId}.${themeId}.${componentName}-${className}`;
|
|
110
|
+
const cx = (...classes) => classes.map((cls) => `${componentName}-${cls} ${hashId} ${themeId}`).join(" ");
|
|
109
111
|
return {
|
|
110
112
|
wrapSSR: (0, _ant_design_cssinjs.useStyleRegister)({
|
|
111
113
|
theme,
|
|
@@ -1260,7 +1262,7 @@ const ApiCard = ({ api, viewStyle }) => {
|
|
|
1260
1262
|
border: `1px solid ${token.colorBorderSecondary}`,
|
|
1261
1263
|
minWidth: "6.25rem",
|
|
1262
1264
|
maxWidth: "fit-content",
|
|
1263
|
-
svg: { path: { fill:
|
|
1265
|
+
svg: { path: { fill: "#4D75D9" } }
|
|
1264
1266
|
},
|
|
1265
1267
|
[scope("list-title")]: {
|
|
1266
1268
|
color: token.colorTextHeading,
|
|
@@ -1308,7 +1310,7 @@ const ApiCard = ({ api, viewStyle }) => {
|
|
|
1308
1310
|
flexDirection: "row",
|
|
1309
1311
|
borderRadius: token.borderRadiusSM,
|
|
1310
1312
|
border: `1px solid ${token.colorBorderSecondary}`,
|
|
1311
|
-
svg: { path: { fill:
|
|
1313
|
+
svg: { path: { fill: "#4D75D9" } }
|
|
1312
1314
|
},
|
|
1313
1315
|
[scope("grid-path-name")]: {
|
|
1314
1316
|
color: token.colorText,
|
|
@@ -2153,7 +2155,7 @@ const ApiDocumentationBar = ({ apiName, mode, onModeChange, onReset, onSave, has
|
|
|
2153
2155
|
},
|
|
2154
2156
|
[scope("mobileWrapper")]: {
|
|
2155
2157
|
flexDirection: "column",
|
|
2156
|
-
gap:
|
|
2158
|
+
gap: 16
|
|
2157
2159
|
},
|
|
2158
2160
|
[scope("mobileTopRow")]: {
|
|
2159
2161
|
width: "100%",
|
|
@@ -2228,14 +2230,14 @@ const ApiDocumentationBar = ({ apiName, mode, onModeChange, onReset, onSave, has
|
|
|
2228
2230
|
[scope("actions")]: {
|
|
2229
2231
|
display: "flex",
|
|
2230
2232
|
alignItems: "center",
|
|
2231
|
-
gap:
|
|
2233
|
+
gap: 16,
|
|
2232
2234
|
flex: 1,
|
|
2233
2235
|
justifyContent: "flex-end"
|
|
2234
2236
|
},
|
|
2235
2237
|
[scope("mobileActions")]: {
|
|
2236
2238
|
display: "flex",
|
|
2237
2239
|
alignItems: "center",
|
|
2238
|
-
gap:
|
|
2240
|
+
gap: 16,
|
|
2239
2241
|
justifyContent: "flex-end"
|
|
2240
2242
|
}
|
|
2241
2243
|
}));
|
|
@@ -2632,42 +2634,6 @@ const EditTag = (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
|
2632
2634
|
]
|
|
2633
2635
|
});
|
|
2634
2636
|
//#endregion
|
|
2635
|
-
//#region src/assets/info-circle.tsx
|
|
2636
|
-
const InfoCircle = (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
2637
|
-
width: "24",
|
|
2638
|
-
height: "24",
|
|
2639
|
-
viewBox: "0 0 24 24",
|
|
2640
|
-
fill: "none",
|
|
2641
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
2642
|
-
...props,
|
|
2643
|
-
children: [
|
|
2644
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
2645
|
-
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",
|
|
2646
|
-
stroke: "black",
|
|
2647
|
-
strokeOpacity: "0.45",
|
|
2648
|
-
strokeWidth: "1.5",
|
|
2649
|
-
strokeLinecap: "round",
|
|
2650
|
-
strokeLinejoin: "round"
|
|
2651
|
-
}),
|
|
2652
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
2653
|
-
d: "M12 8V13",
|
|
2654
|
-
stroke: "black",
|
|
2655
|
-
strokeOpacity: "0.45",
|
|
2656
|
-
strokeWidth: "1.5",
|
|
2657
|
-
strokeLinecap: "round",
|
|
2658
|
-
strokeLinejoin: "round"
|
|
2659
|
-
}),
|
|
2660
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
2661
|
-
d: "M11.9946 16H12.0036",
|
|
2662
|
-
stroke: "black",
|
|
2663
|
-
strokeOpacity: "0.45",
|
|
2664
|
-
strokeWidth: "1.5",
|
|
2665
|
-
strokeLinecap: "round",
|
|
2666
|
-
strokeLinejoin: "round"
|
|
2667
|
-
})
|
|
2668
|
-
]
|
|
2669
|
-
});
|
|
2670
|
-
//#endregion
|
|
2671
2637
|
//#region src/hooks/useDebounce.ts
|
|
2672
2638
|
function useDebounce(value, delay = 500) {
|
|
2673
2639
|
const [debouncedValue, setDebouncedValue] = (0, react.useState)(value);
|
|
@@ -2685,46 +2651,46 @@ function useDebounce(value, delay = 500) {
|
|
|
2685
2651
|
//#region src/view/components/ApiPage/components/AddParameterDrawer.tsx
|
|
2686
2652
|
const PARAM_IN_OPTIONS = [
|
|
2687
2653
|
{
|
|
2688
|
-
label: "
|
|
2654
|
+
label: "QUERY",
|
|
2689
2655
|
value: "query"
|
|
2690
2656
|
},
|
|
2691
2657
|
{
|
|
2692
|
-
label: "
|
|
2658
|
+
label: "HEADER",
|
|
2693
2659
|
value: "header"
|
|
2694
2660
|
},
|
|
2695
2661
|
{
|
|
2696
|
-
label: "
|
|
2662
|
+
label: "PATH",
|
|
2697
2663
|
value: "path"
|
|
2698
2664
|
}
|
|
2699
2665
|
];
|
|
2700
2666
|
const RESPONSE_PARAM_IN_OPTIONS = PARAM_IN_OPTIONS.filter((o) => o.value === "header");
|
|
2701
2667
|
const PARAM_TYPE_OPTIONS = [
|
|
2702
2668
|
{
|
|
2703
|
-
label: "
|
|
2669
|
+
label: "STRING",
|
|
2704
2670
|
value: "string"
|
|
2705
2671
|
},
|
|
2706
2672
|
{
|
|
2707
|
-
label: "
|
|
2673
|
+
label: "NUMBER",
|
|
2708
2674
|
value: "number"
|
|
2709
2675
|
},
|
|
2710
2676
|
{
|
|
2711
|
-
label: "
|
|
2677
|
+
label: "INTEGER",
|
|
2712
2678
|
value: "integer"
|
|
2713
2679
|
},
|
|
2714
2680
|
{
|
|
2715
|
-
label: "
|
|
2681
|
+
label: "BOOLEAN",
|
|
2716
2682
|
value: "boolean"
|
|
2717
2683
|
},
|
|
2718
2684
|
{
|
|
2719
|
-
label: "
|
|
2685
|
+
label: "ARRAY",
|
|
2720
2686
|
value: "array"
|
|
2721
2687
|
},
|
|
2722
2688
|
{
|
|
2723
|
-
label: "
|
|
2689
|
+
label: "OBJECT",
|
|
2724
2690
|
value: "object"
|
|
2725
2691
|
}
|
|
2726
2692
|
];
|
|
2727
|
-
const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initialValues, source }) => {
|
|
2693
|
+
const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initialValues, source, endpointName }) => {
|
|
2728
2694
|
const [form] = antd.Form.useForm();
|
|
2729
2695
|
const [messageApi, contextHolder] = antd.message.useMessage();
|
|
2730
2696
|
const [confirmModalOpen, setConfirmModalOpen] = (0, react$1.useState)(false);
|
|
@@ -2744,7 +2710,8 @@ const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initia
|
|
|
2744
2710
|
in: initialValues.in,
|
|
2745
2711
|
type: initialValues.type,
|
|
2746
2712
|
required: initialValues.required,
|
|
2747
|
-
description: initialValues.description
|
|
2713
|
+
description: initialValues.description,
|
|
2714
|
+
itemsType: initialValues.items?.type
|
|
2748
2715
|
});
|
|
2749
2716
|
setEnumValues(initialValues.enum ?? []);
|
|
2750
2717
|
} else {
|
|
@@ -2879,7 +2846,7 @@ const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initia
|
|
|
2879
2846
|
alignItems: "center",
|
|
2880
2847
|
position: "relative",
|
|
2881
2848
|
paddingTop: 20,
|
|
2882
|
-
paddingBottom:
|
|
2849
|
+
paddingBottom: 5,
|
|
2883
2850
|
paddingLeft: 24,
|
|
2884
2851
|
paddingRight: 24,
|
|
2885
2852
|
width: "100%"
|
|
@@ -2986,7 +2953,8 @@ const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initia
|
|
|
2986
2953
|
type: values.type,
|
|
2987
2954
|
required: values.required ?? true,
|
|
2988
2955
|
description: values.description || void 0,
|
|
2989
|
-
enum: enumValues.length > 0 ? enumValues : void 0
|
|
2956
|
+
enum: enumValues.length > 0 ? enumValues : void 0,
|
|
2957
|
+
...values.type === "array" && values.itemsType && { items: { type: values.itemsType } }
|
|
2990
2958
|
};
|
|
2991
2959
|
if (mode === "edit") {
|
|
2992
2960
|
onEdit?.(payload);
|
|
@@ -3118,6 +3086,25 @@ const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initia
|
|
|
3118
3086
|
options: PARAM_TYPE_OPTIONS
|
|
3119
3087
|
})
|
|
3120
3088
|
}),
|
|
3089
|
+
typeValue === "array" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Form.Item, {
|
|
3090
|
+
name: "itemsType",
|
|
3091
|
+
label: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
3092
|
+
className: cx("label"),
|
|
3093
|
+
children: ["Items Type", /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3094
|
+
className: cx("asterisk"),
|
|
3095
|
+
children: "*"
|
|
3096
|
+
})]
|
|
3097
|
+
}),
|
|
3098
|
+
rules: [{
|
|
3099
|
+
required: true,
|
|
3100
|
+
message: "Items Type is required"
|
|
3101
|
+
}],
|
|
3102
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Select, {
|
|
3103
|
+
size: "large",
|
|
3104
|
+
placeholder: "Select",
|
|
3105
|
+
options: PARAM_TYPE_OPTIONS
|
|
3106
|
+
})
|
|
3107
|
+
}),
|
|
3121
3108
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Form.Item, {
|
|
3122
3109
|
name: "required",
|
|
3123
3110
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -3227,14 +3214,9 @@ const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initia
|
|
|
3227
3214
|
children: [
|
|
3228
3215
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3229
3216
|
className: cx("modalHead"),
|
|
3230
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.
|
|
3217
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3231
3218
|
className: cx("modalTitle"),
|
|
3232
|
-
children:
|
|
3233
|
-
mode === "edit" ? "Edit" : "Add",
|
|
3234
|
-
" ",
|
|
3235
|
-
paramName,
|
|
3236
|
-
" parameter"
|
|
3237
|
-
]
|
|
3219
|
+
children: mode === "edit" ? `Edit ${paramName} parameter` : `Add Parameter to ${endpointName} endpoint`
|
|
3238
3220
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
3239
3221
|
className: cx("modalCloseBtn"),
|
|
3240
3222
|
onClick: () => setConfirmModalOpen(false),
|
|
@@ -3251,7 +3233,9 @@ const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initia
|
|
|
3251
3233
|
mode === "edit" ? "edit" : "add",
|
|
3252
3234
|
" ",
|
|
3253
3235
|
paramName,
|
|
3254
|
-
" parameter
|
|
3236
|
+
" parameter",
|
|
3237
|
+
mode === "add" ? ` to ${endpointName} endpoint` : "",
|
|
3238
|
+
"?"
|
|
3255
3239
|
]
|
|
3256
3240
|
})
|
|
3257
3241
|
}),
|
|
@@ -3309,7 +3293,7 @@ const buildViewParamRows = (params) => params.map((p, idx) => ({
|
|
|
3309
3293
|
description: p.description ?? "",
|
|
3310
3294
|
enum: p.enum ?? []
|
|
3311
3295
|
}));
|
|
3312
|
-
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 }) => {
|
|
3296
|
+
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 }) => {
|
|
3313
3297
|
const [expandedId, setExpandedId] = (0, react$1.useState)(null);
|
|
3314
3298
|
const [activeTab, setActiveTab] = (0, react$1.useState)("general");
|
|
3315
3299
|
(0, react$1.useEffect)(() => {
|
|
@@ -3342,6 +3326,15 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
3342
3326
|
const [openResponsePanels, setOpenResponsePanels] = (0, react$1.useState)(/* @__PURE__ */ new Set());
|
|
3343
3327
|
const [selectedStatusCodes, setSelectedStatusCodes] = (0, react$1.useState)({});
|
|
3344
3328
|
const [drawerSource, setDrawerSource] = (0, react$1.useState)("request");
|
|
3329
|
+
const drawerEndpointName = (0, react$1.useMemo)(() => {
|
|
3330
|
+
if (!paramDrawerEndpointId) return "";
|
|
3331
|
+
const ep = Object.values(endpointsByTag).flat().find((e) => e.id === paramDrawerEndpointId);
|
|
3332
|
+
return endpointNames[paramDrawerEndpointId] ?? ep?.summary ?? "";
|
|
3333
|
+
}, [
|
|
3334
|
+
paramDrawerEndpointId,
|
|
3335
|
+
endpointsByTag,
|
|
3336
|
+
endpointNames
|
|
3337
|
+
]);
|
|
3345
3338
|
const [requestPages, setRequestPages] = (0, react$1.useState)(/* @__PURE__ */ new Map());
|
|
3346
3339
|
const [responsePages, setResponsePages] = (0, react$1.useState)(/* @__PURE__ */ new Map());
|
|
3347
3340
|
const [requestSearches, setRequestSearches] = (0, react$1.useState)({});
|
|
@@ -3352,6 +3345,30 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
3352
3345
|
const debouncedResponseSearches = useDebounce(responseSearches);
|
|
3353
3346
|
const [editableRequestContent, setEditableRequestContent] = (0, react$1.useState)({});
|
|
3354
3347
|
const [editableResponseContent, setEditableResponseContent] = (0, react$1.useState)({});
|
|
3348
|
+
(0, react$1.useEffect)(() => {
|
|
3349
|
+
openRequestPanels.forEach((epId) => {
|
|
3350
|
+
const val = requestBodySchemas?.[epId];
|
|
3351
|
+
const json = val ? JSON.stringify(val, null, 2) : "";
|
|
3352
|
+
setEditableRequestContent((prev) => ({
|
|
3353
|
+
...prev,
|
|
3354
|
+
[epId]: json
|
|
3355
|
+
}));
|
|
3356
|
+
});
|
|
3357
|
+
openResponsePanels.forEach((epId) => {
|
|
3358
|
+
const val = responseBodySchemas?.[epId];
|
|
3359
|
+
const json = val ? JSON.stringify(val, null, 2) : "";
|
|
3360
|
+
setEditableResponseContent((prev) => ({
|
|
3361
|
+
...prev,
|
|
3362
|
+
[epId]: json
|
|
3363
|
+
}));
|
|
3364
|
+
});
|
|
3365
|
+
}, [
|
|
3366
|
+
resetKey,
|
|
3367
|
+
openRequestPanels,
|
|
3368
|
+
openResponsePanels,
|
|
3369
|
+
requestBodySchemas,
|
|
3370
|
+
responseBodySchemas
|
|
3371
|
+
]);
|
|
3355
3372
|
(0, react$1.useEffect)(() => {
|
|
3356
3373
|
if (!openRequestPanels.size) return;
|
|
3357
3374
|
openRequestPanels.forEach((epId) => {
|
|
@@ -3417,10 +3434,29 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
3417
3434
|
flexDirection: "column",
|
|
3418
3435
|
width: "100%",
|
|
3419
3436
|
flexShrink: 0,
|
|
3437
|
+
flex: 1,
|
|
3438
|
+
minHeight: 0,
|
|
3439
|
+
"& .ant-tabs": {
|
|
3440
|
+
height: "100%",
|
|
3441
|
+
display: "flex",
|
|
3442
|
+
flexDirection: "column"
|
|
3443
|
+
},
|
|
3420
3444
|
"& .ant-tabs-content-holder": {
|
|
3445
|
+
flex: 1,
|
|
3446
|
+
display: "flex",
|
|
3447
|
+
flexDirection: "column",
|
|
3421
3448
|
background: token.colorBgElevated,
|
|
3422
3449
|
borderRadius: token.borderRadiusLG,
|
|
3423
3450
|
padding: `${token.paddingLG}px ${token.paddingLG}px 48px`
|
|
3451
|
+
},
|
|
3452
|
+
"& .ant-tabs-content": {
|
|
3453
|
+
flex: 1,
|
|
3454
|
+
minHeight: 0
|
|
3455
|
+
},
|
|
3456
|
+
"& .ant-tabs-tabpane-active": {
|
|
3457
|
+
height: "100%",
|
|
3458
|
+
display: "flex",
|
|
3459
|
+
flexDirection: "column"
|
|
3424
3460
|
}
|
|
3425
3461
|
},
|
|
3426
3462
|
[scope("head")]: {
|
|
@@ -3523,7 +3559,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
3523
3559
|
display: "flex",
|
|
3524
3560
|
alignItems: "center",
|
|
3525
3561
|
justifyContent: "space-between",
|
|
3526
|
-
paddingBottom:
|
|
3562
|
+
paddingBottom: "18.5px",
|
|
3527
3563
|
borderBottom: `1px solid ${token.colorBorder}`,
|
|
3528
3564
|
width: "100%"
|
|
3529
3565
|
},
|
|
@@ -3598,7 +3634,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
3598
3634
|
alignItems: "center",
|
|
3599
3635
|
justifyContent: "space-between",
|
|
3600
3636
|
width: "100%",
|
|
3601
|
-
padding: `12px
|
|
3637
|
+
padding: `12px 0px`,
|
|
3602
3638
|
borderBottom: `1px solid ${token.colorBorderSecondary}`,
|
|
3603
3639
|
background: token.colorBgContainer,
|
|
3604
3640
|
"&:last-child": { borderBottom: "none" }
|
|
@@ -3631,6 +3667,13 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
3631
3667
|
whiteSpace: "nowrap",
|
|
3632
3668
|
maxWidth: 160
|
|
3633
3669
|
},
|
|
3670
|
+
[scope("param-detail-value-name")]: {
|
|
3671
|
+
overflow: "hidden",
|
|
3672
|
+
textOverflow: "ellipsis",
|
|
3673
|
+
whiteSpace: "nowrap",
|
|
3674
|
+
maxWidth: 200,
|
|
3675
|
+
display: "block"
|
|
3676
|
+
},
|
|
3634
3677
|
[scope("param-enum-container")]: {
|
|
3635
3678
|
display: "inline-flex",
|
|
3636
3679
|
flexDirection: "row",
|
|
@@ -3769,7 +3812,6 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
3769
3812
|
alignItems: "center",
|
|
3770
3813
|
position: "relative",
|
|
3771
3814
|
paddingTop: 20,
|
|
3772
|
-
paddingBottom: 8,
|
|
3773
3815
|
paddingLeft: 24,
|
|
3774
3816
|
paddingRight: 24,
|
|
3775
3817
|
width: "100%"
|
|
@@ -3795,7 +3837,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
3795
3837
|
border: "none",
|
|
3796
3838
|
background: "transparent",
|
|
3797
3839
|
padding: 0,
|
|
3798
|
-
color: token.
|
|
3840
|
+
color: token.colorTextTertiary,
|
|
3799
3841
|
fontSize: 16,
|
|
3800
3842
|
lineHeight: 1,
|
|
3801
3843
|
"&:hover": {
|
|
@@ -3808,7 +3850,6 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
3808
3850
|
alignItems: "center",
|
|
3809
3851
|
paddingLeft: 24,
|
|
3810
3852
|
paddingRight: 24,
|
|
3811
|
-
paddingBottom: 12,
|
|
3812
3853
|
height: 56,
|
|
3813
3854
|
width: "100%"
|
|
3814
3855
|
},
|
|
@@ -3935,6 +3976,8 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
3935
3976
|
alignItems: "center",
|
|
3936
3977
|
justifyContent: "center",
|
|
3937
3978
|
width: "100%",
|
|
3979
|
+
flex: 1,
|
|
3980
|
+
minHeight: 0,
|
|
3938
3981
|
"& .ant-empty": {
|
|
3939
3982
|
margin: 0,
|
|
3940
3983
|
display: "flex",
|
|
@@ -4030,9 +4073,21 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
4030
4073
|
title: "Parameter",
|
|
4031
4074
|
key: "parameter",
|
|
4032
4075
|
render: (_, row) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [
|
|
4033
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
4034
|
-
|
|
4035
|
-
|
|
4076
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tooltip, {
|
|
4077
|
+
title: row.name,
|
|
4078
|
+
placement: "bottom",
|
|
4079
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4080
|
+
className: cx("view-param-name"),
|
|
4081
|
+
style: {
|
|
4082
|
+
display: "inline-block",
|
|
4083
|
+
maxWidth: 200,
|
|
4084
|
+
overflow: "hidden",
|
|
4085
|
+
textOverflow: "ellipsis",
|
|
4086
|
+
whiteSpace: "nowrap",
|
|
4087
|
+
verticalAlign: "bottom"
|
|
4088
|
+
},
|
|
4089
|
+
children: row.name
|
|
4090
|
+
})
|
|
4036
4091
|
}),
|
|
4037
4092
|
row.type && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4038
4093
|
className: cx("view-param-type"),
|
|
@@ -4050,9 +4105,21 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
4050
4105
|
{
|
|
4051
4106
|
title: "Description",
|
|
4052
4107
|
key: "description",
|
|
4053
|
-
render: (_, row) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
4054
|
-
|
|
4055
|
-
|
|
4108
|
+
render: (_, row) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tooltip, {
|
|
4109
|
+
title: row.description || "--",
|
|
4110
|
+
placement: "bottom",
|
|
4111
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4112
|
+
className: cx("view-param-desc"),
|
|
4113
|
+
style: {
|
|
4114
|
+
display: "inline-block",
|
|
4115
|
+
maxWidth: 200,
|
|
4116
|
+
overflow: "hidden",
|
|
4117
|
+
textOverflow: "ellipsis",
|
|
4118
|
+
whiteSpace: "nowrap",
|
|
4119
|
+
verticalAlign: "bottom"
|
|
4120
|
+
},
|
|
4121
|
+
children: row.description || "--"
|
|
4122
|
+
})
|
|
4056
4123
|
})
|
|
4057
4124
|
},
|
|
4058
4125
|
{
|
|
@@ -4231,6 +4298,10 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
4231
4298
|
ghost: true,
|
|
4232
4299
|
type: "primary",
|
|
4233
4300
|
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ant_design_icons.PlusOutlined, {}),
|
|
4301
|
+
style: {
|
|
4302
|
+
height: 32,
|
|
4303
|
+
paddingInline: 8
|
|
4304
|
+
},
|
|
4234
4305
|
onClick: () => {
|
|
4235
4306
|
setDrawerSource("request");
|
|
4236
4307
|
setParamDrawerMode("add");
|
|
@@ -4267,6 +4338,10 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
4267
4338
|
ghost: true,
|
|
4268
4339
|
type: "primary",
|
|
4269
4340
|
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ant_design_icons.PlusOutlined, {}),
|
|
4341
|
+
style: {
|
|
4342
|
+
height: 32,
|
|
4343
|
+
paddingInline: 8
|
|
4344
|
+
},
|
|
4270
4345
|
onClick: () => {
|
|
4271
4346
|
setDrawerSource("request");
|
|
4272
4347
|
setParamDrawerMode("add");
|
|
@@ -4348,9 +4423,13 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
4348
4423
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4349
4424
|
className: cx("param-detail-label"),
|
|
4350
4425
|
children: "Parameter Name"
|
|
4351
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
4352
|
-
|
|
4353
|
-
|
|
4426
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tooltip, {
|
|
4427
|
+
title: param.name,
|
|
4428
|
+
placement: "bottom",
|
|
4429
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4430
|
+
className: cx("param-detail-value", "param-detail-value-name"),
|
|
4431
|
+
children: param.name
|
|
4432
|
+
})
|
|
4354
4433
|
})]
|
|
4355
4434
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
4356
4435
|
className: cx("param-detail-cell"),
|
|
@@ -4426,9 +4505,13 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
4426
4505
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4427
4506
|
className: cx("param-detail-label"),
|
|
4428
4507
|
children: "Parameter Name"
|
|
4429
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
4430
|
-
|
|
4431
|
-
|
|
4508
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tooltip, {
|
|
4509
|
+
title: param.name,
|
|
4510
|
+
placement: "bottom",
|
|
4511
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4512
|
+
className: cx("param-detail-value", "param-detail-value-name"),
|
|
4513
|
+
children: param.name
|
|
4514
|
+
})
|
|
4432
4515
|
})]
|
|
4433
4516
|
}),
|
|
4434
4517
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -4467,7 +4550,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
4467
4550
|
margin: 0,
|
|
4468
4551
|
paddingLeft: 16
|
|
4469
4552
|
},
|
|
4470
|
-
children: param.enum.map((e) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", { children: e }, e))
|
|
4553
|
+
children: param.enum.slice(1).map((e) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", { children: e }, e))
|
|
4471
4554
|
}),
|
|
4472
4555
|
placement: "bottom",
|
|
4473
4556
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
@@ -4495,9 +4578,13 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
4495
4578
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4496
4579
|
className: cx("param-detail-label"),
|
|
4497
4580
|
children: "Description"
|
|
4498
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
4499
|
-
|
|
4500
|
-
|
|
4581
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tooltip, {
|
|
4582
|
+
title: param.description || "—",
|
|
4583
|
+
placement: "bottom",
|
|
4584
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4585
|
+
className: cx("param-detail-value", "param-detail-value--ellipsis"),
|
|
4586
|
+
children: param.description || "—"
|
|
4587
|
+
})
|
|
4501
4588
|
})]
|
|
4502
4589
|
})
|
|
4503
4590
|
]
|
|
@@ -4650,6 +4737,10 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
4650
4737
|
ghost: true,
|
|
4651
4738
|
type: "primary",
|
|
4652
4739
|
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ant_design_icons.PlusOutlined, {}),
|
|
4740
|
+
style: {
|
|
4741
|
+
height: 32,
|
|
4742
|
+
paddingInline: 8
|
|
4743
|
+
},
|
|
4653
4744
|
onClick: () => {
|
|
4654
4745
|
setDrawerSource("response");
|
|
4655
4746
|
setParamDrawerMode("add");
|
|
@@ -4740,6 +4831,10 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
4740
4831
|
ghost: true,
|
|
4741
4832
|
type: "primary",
|
|
4742
4833
|
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ant_design_icons.PlusOutlined, {}),
|
|
4834
|
+
style: {
|
|
4835
|
+
height: 32,
|
|
4836
|
+
paddingInline: 8
|
|
4837
|
+
},
|
|
4743
4838
|
onClick: () => {
|
|
4744
4839
|
setDrawerSource("response");
|
|
4745
4840
|
setParamDrawerMode("add");
|
|
@@ -4899,9 +4994,13 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
4899
4994
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4900
4995
|
className: cx("param-detail-label"),
|
|
4901
4996
|
children: "Parameter Name"
|
|
4902
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
4903
|
-
|
|
4904
|
-
|
|
4997
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tooltip, {
|
|
4998
|
+
title: param.name,
|
|
4999
|
+
placement: "bottom",
|
|
5000
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
5001
|
+
className: cx("param-detail-value", "param-detail-value-name"),
|
|
5002
|
+
children: param.name
|
|
5003
|
+
})
|
|
4905
5004
|
})]
|
|
4906
5005
|
}),
|
|
4907
5006
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -4940,7 +5039,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
4940
5039
|
margin: 0,
|
|
4941
5040
|
paddingLeft: 16
|
|
4942
5041
|
},
|
|
4943
|
-
children: param.enum.map((e) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", { children: e }, e))
|
|
5042
|
+
children: param.enum.slice(1).map((e) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", { children: e }, e))
|
|
4944
5043
|
}),
|
|
4945
5044
|
placement: "bottom",
|
|
4946
5045
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
@@ -4968,9 +5067,13 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
4968
5067
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4969
5068
|
className: cx("param-detail-label"),
|
|
4970
5069
|
children: "Description"
|
|
4971
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
4972
|
-
|
|
4973
|
-
|
|
5070
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tooltip, {
|
|
5071
|
+
title: param.description || "—",
|
|
5072
|
+
placement: "bottom",
|
|
5073
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
5074
|
+
className: cx("param-detail-value", "param-detail-value--ellipsis"),
|
|
5075
|
+
children: param.description || "—"
|
|
5076
|
+
})
|
|
4974
5077
|
})]
|
|
4975
5078
|
})
|
|
4976
5079
|
]
|
|
@@ -5033,20 +5136,13 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
5033
5136
|
className: cx("param-row", openResponsePanels.has(ep.id) ? "param-row--open" : ""),
|
|
5034
5137
|
style: { marginTop: token.margin },
|
|
5035
5138
|
onClick: () => toggleResponsePanel(ep.id),
|
|
5036
|
-
children: [
|
|
5037
|
-
|
|
5038
|
-
/* @__PURE__ */ (0, react_jsx_runtime.
|
|
5039
|
-
style: {
|
|
5040
|
-
children:
|
|
5041
|
-
|
|
5042
|
-
|
|
5043
|
-
})]
|
|
5044
|
-
}),
|
|
5045
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(InfoCircle, { style: {
|
|
5046
|
-
width: 24,
|
|
5047
|
-
height: 24
|
|
5048
|
-
} })
|
|
5049
|
-
]
|
|
5139
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ant_design_icons.DownOutlined, { className: cx("param-row-icon", openResponsePanels.has(ep.id) ? "param-row-icon--open" : "") }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
5140
|
+
style: { fontSize: token.fontSize },
|
|
5141
|
+
children: ["Response ", /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
5142
|
+
style: { color: token.colorError },
|
|
5143
|
+
children: "*"
|
|
5144
|
+
})]
|
|
5145
|
+
})]
|
|
5050
5146
|
}),
|
|
5051
5147
|
openResponsePanels.has(ep.id) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
5052
5148
|
className: cx("code-panel"),
|
|
@@ -5209,6 +5305,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
5209
5305
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(AddParameterDrawer, {
|
|
5210
5306
|
open: paramDrawerOpen,
|
|
5211
5307
|
mode: paramDrawerMode,
|
|
5308
|
+
endpointName: drawerEndpointName,
|
|
5212
5309
|
initialValues: paramDrawerMode === "edit" && paramDrawerEndpointId && editParamIdx !== null ? drawerSource === "response" ? endpointResponseParams[paramDrawerEndpointId]?.[editParamIdx] : endpointParams[paramDrawerEndpointId]?.[editParamIdx] : void 0,
|
|
5213
5310
|
onClose: () => {
|
|
5214
5311
|
setParamDrawerOpen(false);
|
|
@@ -5496,6 +5593,10 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
5496
5593
|
ghost: true,
|
|
5497
5594
|
type: "primary",
|
|
5498
5595
|
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ant_design_icons.PlusOutlined, {}),
|
|
5596
|
+
style: {
|
|
5597
|
+
height: 32,
|
|
5598
|
+
paddingInline: 8
|
|
5599
|
+
},
|
|
5499
5600
|
onClick: () => {
|
|
5500
5601
|
setDrawerSource("request");
|
|
5501
5602
|
setParamDrawerMode("add");
|
|
@@ -5532,6 +5633,10 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
5532
5633
|
ghost: true,
|
|
5533
5634
|
type: "primary",
|
|
5534
5635
|
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ant_design_icons.PlusOutlined, {}),
|
|
5636
|
+
style: {
|
|
5637
|
+
height: 32,
|
|
5638
|
+
paddingInline: 8
|
|
5639
|
+
},
|
|
5535
5640
|
onClick: () => {
|
|
5536
5641
|
setDrawerSource("request");
|
|
5537
5642
|
setParamDrawerMode("add");
|
|
@@ -5913,6 +6018,10 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
5913
6018
|
ghost: true,
|
|
5914
6019
|
type: "primary",
|
|
5915
6020
|
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ant_design_icons.PlusOutlined, {}),
|
|
6021
|
+
style: {
|
|
6022
|
+
height: 32,
|
|
6023
|
+
paddingInline: 8
|
|
6024
|
+
},
|
|
5916
6025
|
onClick: () => {
|
|
5917
6026
|
setDrawerSource("response");
|
|
5918
6027
|
setParamDrawerMode("add");
|
|
@@ -6003,6 +6112,10 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
6003
6112
|
ghost: true,
|
|
6004
6113
|
type: "primary",
|
|
6005
6114
|
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ant_design_icons.PlusOutlined, {}),
|
|
6115
|
+
style: {
|
|
6116
|
+
height: 32,
|
|
6117
|
+
paddingInline: 8
|
|
6118
|
+
},
|
|
6006
6119
|
onClick: () => {
|
|
6007
6120
|
setDrawerSource("response");
|
|
6008
6121
|
setParamDrawerMode("add");
|
|
@@ -6296,20 +6409,13 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
6296
6409
|
className: cx("param-row", openResponsePanels.has(ep.id) ? "param-row--open" : ""),
|
|
6297
6410
|
style: { marginTop: token.margin },
|
|
6298
6411
|
onClick: () => toggleResponsePanel(ep.id),
|
|
6299
|
-
children: [
|
|
6300
|
-
|
|
6301
|
-
/* @__PURE__ */ (0, react_jsx_runtime.
|
|
6302
|
-
style: {
|
|
6303
|
-
children:
|
|
6304
|
-
|
|
6305
|
-
|
|
6306
|
-
})]
|
|
6307
|
-
}),
|
|
6308
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(InfoCircle, { style: {
|
|
6309
|
-
width: 24,
|
|
6310
|
-
height: 24
|
|
6311
|
-
} })
|
|
6312
|
-
]
|
|
6412
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ant_design_icons.DownOutlined, { className: cx("param-row-icon", openResponsePanels.has(ep.id) ? "param-row-icon--open" : "") }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
6413
|
+
style: { fontSize: token.fontSize },
|
|
6414
|
+
children: ["Response ", /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
6415
|
+
style: { color: token.colorError },
|
|
6416
|
+
children: "*"
|
|
6417
|
+
})]
|
|
6418
|
+
})]
|
|
6313
6419
|
}),
|
|
6314
6420
|
openResponsePanels.has(ep.id) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
6315
6421
|
className: cx("code-panel"),
|
|
@@ -6474,6 +6580,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
6474
6580
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(AddParameterDrawer, {
|
|
6475
6581
|
open: paramDrawerOpen,
|
|
6476
6582
|
mode: paramDrawerMode,
|
|
6583
|
+
endpointName: drawerEndpointName,
|
|
6477
6584
|
initialValues: paramDrawerMode === "edit" && paramDrawerEndpointId && editParamIdx !== null ? drawerSource === "response" ? endpointResponseParams[paramDrawerEndpointId]?.[editParamIdx] : endpointParams[paramDrawerEndpointId]?.[editParamIdx] : void 0,
|
|
6478
6585
|
onClose: () => {
|
|
6479
6586
|
setParamDrawerOpen(false);
|
|
@@ -7511,7 +7618,8 @@ const EditModeSidebar = ({ selectedItem, onSelectItem, endpoints, hasGeneralErro
|
|
|
7511
7618
|
[scope("badge")]: {
|
|
7512
7619
|
minWidth: "3.75rem",
|
|
7513
7620
|
textAlign: "center",
|
|
7514
|
-
border: "none"
|
|
7621
|
+
border: "none",
|
|
7622
|
+
fontSize: 14
|
|
7515
7623
|
},
|
|
7516
7624
|
[scope("path")]: {
|
|
7517
7625
|
fontSize: token.fontSize,
|
|
@@ -8190,37 +8298,28 @@ const buildRequestData = (params, token) => [...params].sort((a, b) => a.require
|
|
|
8190
8298
|
if (p.schema?.type === "array" && p.schema?.items?.type) typeLabel = `${p.schema.type}_${p.schema.items.type}`;
|
|
8191
8299
|
return {
|
|
8192
8300
|
key: index,
|
|
8193
|
-
param: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
8194
|
-
|
|
8195
|
-
|
|
8196
|
-
|
|
8197
|
-
|
|
8198
|
-
|
|
8199
|
-
|
|
8200
|
-
|
|
8201
|
-
|
|
8202
|
-
|
|
8203
|
-
|
|
8204
|
-
|
|
8205
|
-
|
|
8206
|
-
|
|
8207
|
-
|
|
8208
|
-
|
|
8209
|
-
|
|
8210
|
-
|
|
8211
|
-
|
|
8212
|
-
|
|
8213
|
-
|
|
8214
|
-
})
|
|
8215
|
-
const buildHeaderData = (headers, token) => {
|
|
8216
|
-
if (!headers) return [];
|
|
8217
|
-
return Object.entries(headers).sort(([, a], [, b]) => a.required === b.required ? 0 : a.required ? -1 : 1).map(([name, header], idx) => {
|
|
8218
|
-
let typeLabel = header.schema?.type;
|
|
8219
|
-
if (header.schema?.type === "array" && header.schema?.items?.type) typeLabel = `${header.schema.type}_${header.schema.items.type}`;
|
|
8220
|
-
return {
|
|
8221
|
-
key: idx,
|
|
8222
|
-
param: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [
|
|
8223
|
-
name,
|
|
8301
|
+
param: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
8302
|
+
style: {
|
|
8303
|
+
display: "flex",
|
|
8304
|
+
alignItems: "center",
|
|
8305
|
+
gap: 4
|
|
8306
|
+
},
|
|
8307
|
+
children: [
|
|
8308
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tooltip, {
|
|
8309
|
+
title: p.name,
|
|
8310
|
+
placement: "bottom",
|
|
8311
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
8312
|
+
style: {
|
|
8313
|
+
display: "inline-block",
|
|
8314
|
+
maxWidth: 200,
|
|
8315
|
+
overflow: "hidden",
|
|
8316
|
+
textOverflow: "ellipsis",
|
|
8317
|
+
whiteSpace: "nowrap",
|
|
8318
|
+
verticalAlign: "bottom"
|
|
8319
|
+
},
|
|
8320
|
+
children: p.name
|
|
8321
|
+
})
|
|
8322
|
+
}),
|
|
8224
8323
|
typeLabel && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
8225
8324
|
style: {
|
|
8226
8325
|
color: token.colorTextTertiary,
|
|
@@ -8229,50 +8328,84 @@ const buildHeaderData = (headers, token) => {
|
|
|
8229
8328
|
},
|
|
8230
8329
|
children: typeLabel
|
|
8231
8330
|
}),
|
|
8232
|
-
|
|
8331
|
+
p.required ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
8233
8332
|
style: { color: token.colorError },
|
|
8234
8333
|
children: "*"
|
|
8235
8334
|
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
8236
8335
|
style: { color: token.colorSuccess },
|
|
8237
8336
|
children: "Optional"
|
|
8238
8337
|
})
|
|
8239
|
-
]
|
|
8338
|
+
]
|
|
8339
|
+
}),
|
|
8340
|
+
desc: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tooltip, {
|
|
8341
|
+
title: p.description || "--",
|
|
8342
|
+
placement: "bottom",
|
|
8343
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
8344
|
+
style: {
|
|
8345
|
+
display: "inline-block",
|
|
8346
|
+
maxWidth: 300,
|
|
8347
|
+
overflow: "hidden",
|
|
8348
|
+
textOverflow: "ellipsis",
|
|
8349
|
+
whiteSpace: "nowrap",
|
|
8350
|
+
verticalAlign: "bottom"
|
|
8351
|
+
},
|
|
8352
|
+
children: p.description || "--"
|
|
8353
|
+
})
|
|
8354
|
+
}),
|
|
8355
|
+
enum: p.schema?.enum ? renderEnumTags(p.schema.enum, token) : "--"
|
|
8356
|
+
};
|
|
8357
|
+
});
|
|
8358
|
+
const buildHeaderData = (headers, token) => {
|
|
8359
|
+
if (!headers) return [];
|
|
8360
|
+
return Object.entries(headers).sort(([, a], [, b]) => a.required === b.required ? 0 : a.required ? -1 : 1).map(([name, header], idx) => {
|
|
8361
|
+
let typeLabel = header.schema?.type;
|
|
8362
|
+
if (header.schema?.type === "array" && header.schema?.items?.type) typeLabel = `${header.schema.type}_${header.schema.items.type}`;
|
|
8363
|
+
return {
|
|
8364
|
+
key: idx,
|
|
8365
|
+
param: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
8366
|
+
style: {
|
|
8367
|
+
display: "flex",
|
|
8368
|
+
alignItems: "center",
|
|
8369
|
+
gap: 4
|
|
8370
|
+
},
|
|
8371
|
+
children: [
|
|
8372
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tooltip, {
|
|
8373
|
+
title: name,
|
|
8374
|
+
placement: "bottom",
|
|
8375
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
8376
|
+
style: {
|
|
8377
|
+
display: "inline-block",
|
|
8378
|
+
maxWidth: 200,
|
|
8379
|
+
overflow: "hidden",
|
|
8380
|
+
textOverflow: "ellipsis",
|
|
8381
|
+
whiteSpace: "nowrap",
|
|
8382
|
+
verticalAlign: "bottom"
|
|
8383
|
+
},
|
|
8384
|
+
children: name
|
|
8385
|
+
})
|
|
8386
|
+
}),
|
|
8387
|
+
typeLabel && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
8388
|
+
style: {
|
|
8389
|
+
color: token.colorTextTertiary,
|
|
8390
|
+
marginLeft: "0.25rem",
|
|
8391
|
+
marginRight: "0.25rem"
|
|
8392
|
+
},
|
|
8393
|
+
children: typeLabel
|
|
8394
|
+
}),
|
|
8395
|
+
header.required ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
8396
|
+
style: { color: token.colorError },
|
|
8397
|
+
children: "*"
|
|
8398
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
8399
|
+
style: { color: token.colorSuccess },
|
|
8400
|
+
children: "Optional"
|
|
8401
|
+
})
|
|
8402
|
+
]
|
|
8403
|
+
}, idx),
|
|
8240
8404
|
desc: header.description || "--",
|
|
8241
8405
|
enum: header.schema?.enum ? renderEnumTags(header.schema.enum, token) : "--"
|
|
8242
8406
|
};
|
|
8243
8407
|
});
|
|
8244
8408
|
};
|
|
8245
|
-
const buildRequestBodyData = (requestBody, token) => {
|
|
8246
|
-
if (!requestBody?.content) return [];
|
|
8247
|
-
const contentType = Object.keys(requestBody.content)[0];
|
|
8248
|
-
const schema = requestBody.content[contentType]?.schema;
|
|
8249
|
-
if (!schema) return [];
|
|
8250
|
-
const properties = schema.properties ?? {};
|
|
8251
|
-
const required = schema.required ?? [];
|
|
8252
|
-
return Object.entries(properties).map(([name, prop], idx) => ({
|
|
8253
|
-
key: idx,
|
|
8254
|
-
param: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [
|
|
8255
|
-
name,
|
|
8256
|
-
prop.type && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
8257
|
-
style: {
|
|
8258
|
-
color: token.colorTextTertiary,
|
|
8259
|
-
marginLeft: "0.25rem",
|
|
8260
|
-
marginRight: "0.25rem"
|
|
8261
|
-
},
|
|
8262
|
-
children: prop.type
|
|
8263
|
-
}),
|
|
8264
|
-
required.includes(name) ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
8265
|
-
style: { color: token.colorError },
|
|
8266
|
-
children: "*"
|
|
8267
|
-
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
8268
|
-
style: { color: token.colorSuccess },
|
|
8269
|
-
children: "Optional"
|
|
8270
|
-
})
|
|
8271
|
-
] }),
|
|
8272
|
-
desc: prop.description || "--",
|
|
8273
|
-
enum: prop.enum ? renderEnumTags(prop.enum, token) : "--"
|
|
8274
|
-
}));
|
|
8275
|
-
};
|
|
8276
8409
|
const EndpointPage = () => {
|
|
8277
8410
|
const { selectedEndpoint, selectedApi, selectedStatusCode, setSelectedNodeKey, setFocusedContent, setFocusedTag, setActiveRequestTab } = useStore(({ view }) => view);
|
|
8278
8411
|
const [activeTabKey, setActiveTabKey] = (0, react$1.useState)("header");
|
|
@@ -8321,7 +8454,6 @@ const EndpointPage = () => {
|
|
|
8321
8454
|
const headerParams = buildRequestData(selectedEndpoint?.parameters?.filter((p) => p.in === "header") || [], token);
|
|
8322
8455
|
const pathParams = buildRequestData(selectedEndpoint?.parameters?.filter((p) => p.in === "path") || [], token);
|
|
8323
8456
|
const queryParams = buildRequestData(selectedEndpoint?.parameters?.filter((p) => p.in === "query") || [], token);
|
|
8324
|
-
const requestBodyData = buildRequestBodyData(selectedEndpoint?.requestBody, token);
|
|
8325
8457
|
const requestTabs = [
|
|
8326
8458
|
{
|
|
8327
8459
|
key: "header",
|
|
@@ -8358,19 +8490,7 @@ const EndpointPage = () => {
|
|
|
8358
8490
|
size: "small",
|
|
8359
8491
|
rowClassName: (_, idx) => cx(idx % 2 === 0 ? "row-even" : "row-odd")
|
|
8360
8492
|
})
|
|
8361
|
-
}
|
|
8362
|
-
...requestBodyData.length > 0 ? [{
|
|
8363
|
-
key: "requestBody",
|
|
8364
|
-
label: "Request Body",
|
|
8365
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Table, {
|
|
8366
|
-
columns: requestColumns,
|
|
8367
|
-
dataSource: requestBodyData,
|
|
8368
|
-
pagination: false,
|
|
8369
|
-
bordered: true,
|
|
8370
|
-
size: "small",
|
|
8371
|
-
rowClassName: (_, idx) => cx(idx % 2 === 0 ? "row-even" : "row-odd")
|
|
8372
|
-
})
|
|
8373
|
-
}] : []
|
|
8493
|
+
}
|
|
8374
8494
|
].filter((t) => t !== null);
|
|
8375
8495
|
(0, react$1.useEffect)(() => {
|
|
8376
8496
|
const firstKey = requestTabs[0]?.key ?? "header";
|
|
@@ -9075,9 +9195,10 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
|
|
|
9075
9195
|
gap: token.marginLG,
|
|
9076
9196
|
height: "100%"
|
|
9077
9197
|
},
|
|
9078
|
-
[scope("section")]: {
|
|
9079
|
-
|
|
9080
|
-
|
|
9198
|
+
[scope("section")]: { flexShrink: 0 },
|
|
9199
|
+
[scope("section-grow")]: {
|
|
9200
|
+
flex: 1,
|
|
9201
|
+
minHeight: 0
|
|
9081
9202
|
},
|
|
9082
9203
|
[scope("docs-layout")]: {
|
|
9083
9204
|
display: "flex",
|
|
@@ -9210,7 +9331,8 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
|
|
|
9210
9331
|
type: schema?.type ?? "string",
|
|
9211
9332
|
required: Boolean(p.required ?? false),
|
|
9212
9333
|
description: p.description != null ? String(p.description) : void 0,
|
|
9213
|
-
enum: Array.isArray(schema?.enum) ? schema.enum : void 0
|
|
9334
|
+
enum: Array.isArray(schema?.enum) ? schema.enum : void 0,
|
|
9335
|
+
...schema?.items && { items: { type: schema.items.type ?? "string" } }
|
|
9214
9336
|
};
|
|
9215
9337
|
});
|
|
9216
9338
|
});
|
|
@@ -9240,7 +9362,8 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
|
|
|
9240
9362
|
type: schema?.type ?? "string",
|
|
9241
9363
|
required: Boolean(p.required ?? false),
|
|
9242
9364
|
description: p.description != null ? String(p.description) : void 0,
|
|
9243
|
-
enum: Array.isArray(schema?.enum) ? schema.enum : void 0
|
|
9365
|
+
enum: Array.isArray(schema?.enum) ? schema.enum : void 0,
|
|
9366
|
+
...schema?.items && { items: { type: schema.items.type ?? "string" } }
|
|
9244
9367
|
};
|
|
9245
9368
|
});
|
|
9246
9369
|
});
|
|
@@ -9258,7 +9381,7 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
|
|
|
9258
9381
|
const result = {};
|
|
9259
9382
|
Object.entries(rawFile.paths).forEach(([path, methods]) => {
|
|
9260
9383
|
Object.entries(methods).forEach(([method, operation]) => {
|
|
9261
|
-
const schema = operation.requestBody?.content?.["application/json"]?.
|
|
9384
|
+
const schema = operation.requestBody?.content?.["application/json"]?.example;
|
|
9262
9385
|
const epId = pathMethodToId[`${path}||${method}`];
|
|
9263
9386
|
if (epId && schema) result[epId] = schema;
|
|
9264
9387
|
});
|
|
@@ -9311,6 +9434,14 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
|
|
|
9311
9434
|
}
|
|
9312
9435
|
if (JSON.stringify(endpointParams) !== JSON.stringify(initialEndpointParams)) return true;
|
|
9313
9436
|
if (JSON.stringify(endpointResponseParams) !== JSON.stringify(initialEndpointResponseParams)) return true;
|
|
9437
|
+
if (JSON.stringify(endpointRequestBody) !== JSON.stringify(initialEndpointRequestBody)) {
|
|
9438
|
+
console.log("hasChanges: endpointRequestBody changed", {
|
|
9439
|
+
endpointRequestBody,
|
|
9440
|
+
initialEndpointRequestBody
|
|
9441
|
+
});
|
|
9442
|
+
return true;
|
|
9443
|
+
}
|
|
9444
|
+
if (JSON.stringify(endpointResponseBody) !== JSON.stringify(initialEndpointResponseBody)) return true;
|
|
9314
9445
|
return false;
|
|
9315
9446
|
}, [
|
|
9316
9447
|
selectedApi,
|
|
@@ -9325,7 +9456,11 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
|
|
|
9325
9456
|
endpointParams,
|
|
9326
9457
|
endpointResponseParams,
|
|
9327
9458
|
initialEndpointParams,
|
|
9328
|
-
initialEndpointResponseParams
|
|
9459
|
+
initialEndpointResponseParams,
|
|
9460
|
+
endpointRequestBody,
|
|
9461
|
+
initialEndpointRequestBody,
|
|
9462
|
+
endpointResponseBody,
|
|
9463
|
+
initialEndpointResponseBody
|
|
9329
9464
|
]);
|
|
9330
9465
|
(0, react$1.useEffect)(() => {
|
|
9331
9466
|
setBannerVisible(hasChanges);
|
|
@@ -9444,6 +9579,9 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
|
|
|
9444
9579
|
setEndpointTags({});
|
|
9445
9580
|
setEndpointParams(initialEndpointParams);
|
|
9446
9581
|
setEndpointResponseParams(initialEndpointResponseParams);
|
|
9582
|
+
setEndpointRequestBody(initialEndpointRequestBody);
|
|
9583
|
+
setEndpointResponseBody(initialEndpointResponseBody);
|
|
9584
|
+
setLocalTags(tagMetadata);
|
|
9447
9585
|
setResetKey((prev) => prev + 1);
|
|
9448
9586
|
messageApi.success("Changes have been reset successfully.");
|
|
9449
9587
|
};
|
|
@@ -9496,7 +9634,8 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
|
|
|
9496
9634
|
...param.description && { description: param.description },
|
|
9497
9635
|
schema: {
|
|
9498
9636
|
type: param.type,
|
|
9499
|
-
...param.enum && param.enum.length > 0 && { enum: param.enum }
|
|
9637
|
+
...param.enum && param.enum.length > 0 && { enum: param.enum },
|
|
9638
|
+
...param.type === "array" && param.items && { items: param.items }
|
|
9500
9639
|
}
|
|
9501
9640
|
}));
|
|
9502
9641
|
else delete methodObj.parameters;
|
|
@@ -9513,7 +9652,8 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
|
|
|
9513
9652
|
...param.description && { description: param.description },
|
|
9514
9653
|
schema: {
|
|
9515
9654
|
type: param.type,
|
|
9516
|
-
...param.enum && param.enum.length > 0 && { enum: param.enum }
|
|
9655
|
+
...param.enum && param.enum.length > 0 && { enum: param.enum },
|
|
9656
|
+
...param.type === "array" && param.items && { items: param.items }
|
|
9517
9657
|
}
|
|
9518
9658
|
}));
|
|
9519
9659
|
else delete methodObj["x-response-params"];
|
|
@@ -9530,7 +9670,7 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
|
|
|
9530
9670
|
if (!methodObjAny.requestBody) methodObjAny.requestBody = {};
|
|
9531
9671
|
const rb = methodObjAny.requestBody;
|
|
9532
9672
|
if (!rb.content) rb.content = {};
|
|
9533
|
-
rb.content["application/json"] = { schema };
|
|
9673
|
+
rb.content["application/json"] = { example: schema };
|
|
9534
9674
|
});
|
|
9535
9675
|
Object.entries(endpointResponseBody).forEach(([id, schema]) => {
|
|
9536
9676
|
const loc = idToPathMethod[id];
|
|
@@ -9560,10 +9700,9 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
|
|
|
9560
9700
|
setSelectedApi(newTransformed);
|
|
9561
9701
|
} catch (err) {
|
|
9562
9702
|
let messages = [];
|
|
9563
|
-
if (err && typeof err === "object" && "
|
|
9564
|
-
|
|
9565
|
-
|
|
9566
|
-
} else if (err instanceof Error) messages = err.message.split("\n").filter(Boolean);
|
|
9703
|
+
if (err && typeof err === "object" && "data" in err) messages = [err.data?.message ?? "Unknown error"];
|
|
9704
|
+
else if (err && typeof err === "object" && "message" in err) messages = [String(err.message)];
|
|
9705
|
+
else if (err instanceof Error) messages = err.message.split("\n").filter(Boolean);
|
|
9567
9706
|
else messages = [String(err)];
|
|
9568
9707
|
setSaveErrors(messages);
|
|
9569
9708
|
setSelectedEditItem({ type: "errors" });
|
|
@@ -9708,15 +9847,16 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
|
|
|
9708
9847
|
display: "flex",
|
|
9709
9848
|
alignItems: "center",
|
|
9710
9849
|
gap: 8,
|
|
9711
|
-
padding: "8px 12px",
|
|
9850
|
+
padding: mode === "view" ? "8px 12px" : "0 12px",
|
|
9712
9851
|
border: "none",
|
|
9713
9852
|
cursor: "pointer",
|
|
9714
|
-
borderRadius: 8,
|
|
9853
|
+
borderRadius: mode === "view" ? 8 : 12,
|
|
9715
9854
|
fontFamily: token.fontFamily,
|
|
9716
9855
|
background: mode === "view" ? token.colorBgContainer : "transparent",
|
|
9717
9856
|
boxShadow: mode === "view" ? "0px 2px 4px -2px rgba(17,12,34,0.12)" : "none",
|
|
9718
9857
|
fontWeight: mode === "view" ? 700 : 400,
|
|
9719
|
-
fontSize:
|
|
9858
|
+
fontSize: token.fontSize,
|
|
9859
|
+
lineHeight: "22px",
|
|
9720
9860
|
color: token.colorText
|
|
9721
9861
|
},
|
|
9722
9862
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ant_design_icons.EyeOutlined, { style: { fontSize: 18 } }), "View"]
|
|
@@ -9818,10 +9958,11 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
|
|
|
9818
9958
|
})
|
|
9819
9959
|
}),
|
|
9820
9960
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
9821
|
-
className: cx("section"),
|
|
9961
|
+
className: cx("section", "section-grow"),
|
|
9822
9962
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EndpointsSection, {
|
|
9823
9963
|
mode,
|
|
9824
9964
|
endpointsByTag: getEndpointsByTag(),
|
|
9965
|
+
resetKey,
|
|
9825
9966
|
collapsed: endpointsCollapsed,
|
|
9826
9967
|
onToggleCollapse: () => setEndpointsCollapsed((c) => !c),
|
|
9827
9968
|
endpointNames,
|
|
@@ -9915,7 +10056,7 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
|
|
|
9915
10056
|
},
|
|
9916
10057
|
requestBodySchemas: endpointRequestBody,
|
|
9917
10058
|
responseBodySchemas: endpointResponseBody
|
|
9918
|
-
}
|
|
10059
|
+
})
|
|
9919
10060
|
})
|
|
9920
10061
|
] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
9921
10062
|
selectedEditItem.type === "errors" && errorBox && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
@@ -10075,8 +10216,9 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
|
|
|
10075
10216
|
} catch {}
|
|
10076
10217
|
},
|
|
10077
10218
|
requestBodySchemas: endpointRequestBody,
|
|
10078
|
-
responseBodySchemas: endpointResponseBody
|
|
10079
|
-
|
|
10219
|
+
responseBodySchemas: endpointResponseBody,
|
|
10220
|
+
resetKey
|
|
10221
|
+
})
|
|
10080
10222
|
] })
|
|
10081
10223
|
})]
|
|
10082
10224
|
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|