@digi-frontend/dgate-api-documentation 4.1.1 → 4.1.3
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 +55 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +55 -16
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2695,7 +2695,7 @@ const PARAM_TYPE_OPTIONS = [
|
|
|
2695
2695
|
value: "object"
|
|
2696
2696
|
}
|
|
2697
2697
|
];
|
|
2698
|
-
const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initialValues, source }) => {
|
|
2698
|
+
const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initialValues, source, endpointName }) => {
|
|
2699
2699
|
const [form] = Form.useForm();
|
|
2700
2700
|
const [messageApi, contextHolder] = message.useMessage();
|
|
2701
2701
|
const [confirmModalOpen, setConfirmModalOpen] = useState(false);
|
|
@@ -2715,7 +2715,8 @@ const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initia
|
|
|
2715
2715
|
in: initialValues.in,
|
|
2716
2716
|
type: initialValues.type,
|
|
2717
2717
|
required: initialValues.required,
|
|
2718
|
-
description: initialValues.description
|
|
2718
|
+
description: initialValues.description,
|
|
2719
|
+
itemsType: initialValues.items?.type
|
|
2719
2720
|
});
|
|
2720
2721
|
setEnumValues(initialValues.enum ?? []);
|
|
2721
2722
|
} else {
|
|
@@ -2850,7 +2851,7 @@ const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initia
|
|
|
2850
2851
|
alignItems: "center",
|
|
2851
2852
|
position: "relative",
|
|
2852
2853
|
paddingTop: 20,
|
|
2853
|
-
paddingBottom:
|
|
2854
|
+
paddingBottom: 5,
|
|
2854
2855
|
paddingLeft: 24,
|
|
2855
2856
|
paddingRight: 24,
|
|
2856
2857
|
width: "100%"
|
|
@@ -2957,7 +2958,8 @@ const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initia
|
|
|
2957
2958
|
type: values.type,
|
|
2958
2959
|
required: values.required ?? true,
|
|
2959
2960
|
description: values.description || void 0,
|
|
2960
|
-
enum: enumValues.length > 0 ? enumValues : void 0
|
|
2961
|
+
enum: enumValues.length > 0 ? enumValues : void 0,
|
|
2962
|
+
...values.type === "array" && values.itemsType && { items: { type: values.itemsType } }
|
|
2961
2963
|
};
|
|
2962
2964
|
if (mode === "edit") {
|
|
2963
2965
|
onEdit?.(payload);
|
|
@@ -3089,6 +3091,25 @@ const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initia
|
|
|
3089
3091
|
options: PARAM_TYPE_OPTIONS
|
|
3090
3092
|
})
|
|
3091
3093
|
}),
|
|
3094
|
+
typeValue === "array" && /* @__PURE__ */ jsx(Form.Item, {
|
|
3095
|
+
name: "itemsType",
|
|
3096
|
+
label: /* @__PURE__ */ jsxs("span", {
|
|
3097
|
+
className: cx("label"),
|
|
3098
|
+
children: ["Items Type", /* @__PURE__ */ jsx("span", {
|
|
3099
|
+
className: cx("asterisk"),
|
|
3100
|
+
children: "*"
|
|
3101
|
+
})]
|
|
3102
|
+
}),
|
|
3103
|
+
rules: [{
|
|
3104
|
+
required: true,
|
|
3105
|
+
message: "Items Type is required"
|
|
3106
|
+
}],
|
|
3107
|
+
children: /* @__PURE__ */ jsx(Select, {
|
|
3108
|
+
size: "large",
|
|
3109
|
+
placeholder: "Select",
|
|
3110
|
+
options: PARAM_TYPE_OPTIONS
|
|
3111
|
+
})
|
|
3112
|
+
}),
|
|
3092
3113
|
/* @__PURE__ */ jsx(Form.Item, {
|
|
3093
3114
|
name: "required",
|
|
3094
3115
|
children: /* @__PURE__ */ jsxs("div", {
|
|
@@ -3202,9 +3223,9 @@ const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initia
|
|
|
3202
3223
|
className: cx("modalTitle"),
|
|
3203
3224
|
children: [
|
|
3204
3225
|
mode === "edit" ? "Edit" : "Add",
|
|
3205
|
-
" ",
|
|
3206
|
-
|
|
3207
|
-
"
|
|
3226
|
+
" Parameter to ",
|
|
3227
|
+
endpointName,
|
|
3228
|
+
" endpoint"
|
|
3208
3229
|
]
|
|
3209
3230
|
}), /* @__PURE__ */ jsx("button", {
|
|
3210
3231
|
className: cx("modalCloseBtn"),
|
|
@@ -3222,7 +3243,10 @@ const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initia
|
|
|
3222
3243
|
mode === "edit" ? "edit" : "add",
|
|
3223
3244
|
" ",
|
|
3224
3245
|
paramName,
|
|
3225
|
-
" parameter
|
|
3246
|
+
" parameter to",
|
|
3247
|
+
" ",
|
|
3248
|
+
endpointName,
|
|
3249
|
+
" endpoint?"
|
|
3226
3250
|
]
|
|
3227
3251
|
})
|
|
3228
3252
|
}),
|
|
@@ -3313,6 +3337,15 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
3313
3337
|
const [openResponsePanels, setOpenResponsePanels] = useState(/* @__PURE__ */ new Set());
|
|
3314
3338
|
const [selectedStatusCodes, setSelectedStatusCodes] = useState({});
|
|
3315
3339
|
const [drawerSource, setDrawerSource] = useState("request");
|
|
3340
|
+
const drawerEndpointName = useMemo(() => {
|
|
3341
|
+
if (!paramDrawerEndpointId) return "";
|
|
3342
|
+
const ep = Object.values(endpointsByTag).flat().find((e) => e.id === paramDrawerEndpointId);
|
|
3343
|
+
return endpointNames[paramDrawerEndpointId] ?? ep?.summary ?? "";
|
|
3344
|
+
}, [
|
|
3345
|
+
paramDrawerEndpointId,
|
|
3346
|
+
endpointsByTag,
|
|
3347
|
+
endpointNames
|
|
3348
|
+
]);
|
|
3316
3349
|
const [requestPages, setRequestPages] = useState(/* @__PURE__ */ new Map());
|
|
3317
3350
|
const [responsePages, setResponsePages] = useState(/* @__PURE__ */ new Map());
|
|
3318
3351
|
const [requestSearches, setRequestSearches] = useState({});
|
|
@@ -5180,6 +5213,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
5180
5213
|
/* @__PURE__ */ jsx(AddParameterDrawer, {
|
|
5181
5214
|
open: paramDrawerOpen,
|
|
5182
5215
|
mode: paramDrawerMode,
|
|
5216
|
+
endpointName: drawerEndpointName,
|
|
5183
5217
|
initialValues: paramDrawerMode === "edit" && paramDrawerEndpointId && editParamIdx !== null ? drawerSource === "response" ? endpointResponseParams[paramDrawerEndpointId]?.[editParamIdx] : endpointParams[paramDrawerEndpointId]?.[editParamIdx] : void 0,
|
|
5184
5218
|
onClose: () => {
|
|
5185
5219
|
setParamDrawerOpen(false);
|
|
@@ -6445,6 +6479,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
|
|
|
6445
6479
|
/* @__PURE__ */ jsx(AddParameterDrawer, {
|
|
6446
6480
|
open: paramDrawerOpen,
|
|
6447
6481
|
mode: paramDrawerMode,
|
|
6482
|
+
endpointName: drawerEndpointName,
|
|
6448
6483
|
initialValues: paramDrawerMode === "edit" && paramDrawerEndpointId && editParamIdx !== null ? drawerSource === "response" ? endpointResponseParams[paramDrawerEndpointId]?.[editParamIdx] : endpointParams[paramDrawerEndpointId]?.[editParamIdx] : void 0,
|
|
6449
6484
|
onClose: () => {
|
|
6450
6485
|
setParamDrawerOpen(false);
|
|
@@ -9181,7 +9216,8 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
|
|
|
9181
9216
|
type: schema?.type ?? "string",
|
|
9182
9217
|
required: Boolean(p.required ?? false),
|
|
9183
9218
|
description: p.description != null ? String(p.description) : void 0,
|
|
9184
|
-
enum: Array.isArray(schema?.enum) ? schema.enum : void 0
|
|
9219
|
+
enum: Array.isArray(schema?.enum) ? schema.enum : void 0,
|
|
9220
|
+
...schema?.items && { items: { type: schema.items.type ?? "string" } }
|
|
9185
9221
|
};
|
|
9186
9222
|
});
|
|
9187
9223
|
});
|
|
@@ -9211,7 +9247,8 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
|
|
|
9211
9247
|
type: schema?.type ?? "string",
|
|
9212
9248
|
required: Boolean(p.required ?? false),
|
|
9213
9249
|
description: p.description != null ? String(p.description) : void 0,
|
|
9214
|
-
enum: Array.isArray(schema?.enum) ? schema.enum : void 0
|
|
9250
|
+
enum: Array.isArray(schema?.enum) ? schema.enum : void 0,
|
|
9251
|
+
...schema?.items && { items: { type: schema.items.type ?? "string" } }
|
|
9215
9252
|
};
|
|
9216
9253
|
});
|
|
9217
9254
|
});
|
|
@@ -9415,6 +9452,7 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
|
|
|
9415
9452
|
setEndpointTags({});
|
|
9416
9453
|
setEndpointParams(initialEndpointParams);
|
|
9417
9454
|
setEndpointResponseParams(initialEndpointResponseParams);
|
|
9455
|
+
setLocalTags(tagMetadata);
|
|
9418
9456
|
setResetKey((prev) => prev + 1);
|
|
9419
9457
|
messageApi.success("Changes have been reset successfully.");
|
|
9420
9458
|
};
|
|
@@ -9467,7 +9505,8 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
|
|
|
9467
9505
|
...param.description && { description: param.description },
|
|
9468
9506
|
schema: {
|
|
9469
9507
|
type: param.type,
|
|
9470
|
-
...param.enum && param.enum.length > 0 && { enum: param.enum }
|
|
9508
|
+
...param.enum && param.enum.length > 0 && { enum: param.enum },
|
|
9509
|
+
...param.type === "array" && param.items && { items: param.items }
|
|
9471
9510
|
}
|
|
9472
9511
|
}));
|
|
9473
9512
|
else delete methodObj.parameters;
|
|
@@ -9484,7 +9523,8 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
|
|
|
9484
9523
|
...param.description && { description: param.description },
|
|
9485
9524
|
schema: {
|
|
9486
9525
|
type: param.type,
|
|
9487
|
-
...param.enum && param.enum.length > 0 && { enum: param.enum }
|
|
9526
|
+
...param.enum && param.enum.length > 0 && { enum: param.enum },
|
|
9527
|
+
...param.type === "array" && param.items && { items: param.items }
|
|
9488
9528
|
}
|
|
9489
9529
|
}));
|
|
9490
9530
|
else delete methodObj["x-response-params"];
|
|
@@ -9531,10 +9571,9 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
|
|
|
9531
9571
|
setSelectedApi(newTransformed);
|
|
9532
9572
|
} catch (err) {
|
|
9533
9573
|
let messages = [];
|
|
9534
|
-
if (err && typeof err === "object" && "
|
|
9535
|
-
|
|
9536
|
-
|
|
9537
|
-
} else if (err instanceof Error) messages = err.message.split("\n").filter(Boolean);
|
|
9574
|
+
if (err && typeof err === "object" && "data" in err) messages = [err.data?.message ?? "Unknown error"];
|
|
9575
|
+
else if (err && typeof err === "object" && "message" in err) messages = [String(err.message)];
|
|
9576
|
+
else if (err instanceof Error) messages = err.message.split("\n").filter(Boolean);
|
|
9538
9577
|
else messages = [String(err)];
|
|
9539
9578
|
setSaveErrors(messages);
|
|
9540
9579
|
setSelectedEditItem({ type: "errors" });
|