@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 CHANGED
@@ -2724,7 +2724,7 @@ const PARAM_TYPE_OPTIONS = [
2724
2724
  value: "object"
2725
2725
  }
2726
2726
  ];
2727
- const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initialValues, source }) => {
2727
+ const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initialValues, source, endpointName }) => {
2728
2728
  const [form] = antd.Form.useForm();
2729
2729
  const [messageApi, contextHolder] = antd.message.useMessage();
2730
2730
  const [confirmModalOpen, setConfirmModalOpen] = (0, react$1.useState)(false);
@@ -2744,7 +2744,8 @@ const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initia
2744
2744
  in: initialValues.in,
2745
2745
  type: initialValues.type,
2746
2746
  required: initialValues.required,
2747
- description: initialValues.description
2747
+ description: initialValues.description,
2748
+ itemsType: initialValues.items?.type
2748
2749
  });
2749
2750
  setEnumValues(initialValues.enum ?? []);
2750
2751
  } else {
@@ -2879,7 +2880,7 @@ const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initia
2879
2880
  alignItems: "center",
2880
2881
  position: "relative",
2881
2882
  paddingTop: 20,
2882
- paddingBottom: 8,
2883
+ paddingBottom: 5,
2883
2884
  paddingLeft: 24,
2884
2885
  paddingRight: 24,
2885
2886
  width: "100%"
@@ -2986,7 +2987,8 @@ const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initia
2986
2987
  type: values.type,
2987
2988
  required: values.required ?? true,
2988
2989
  description: values.description || void 0,
2989
- enum: enumValues.length > 0 ? enumValues : void 0
2990
+ enum: enumValues.length > 0 ? enumValues : void 0,
2991
+ ...values.type === "array" && values.itemsType && { items: { type: values.itemsType } }
2990
2992
  };
2991
2993
  if (mode === "edit") {
2992
2994
  onEdit?.(payload);
@@ -3118,6 +3120,25 @@ const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initia
3118
3120
  options: PARAM_TYPE_OPTIONS
3119
3121
  })
3120
3122
  }),
3123
+ typeValue === "array" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Form.Item, {
3124
+ name: "itemsType",
3125
+ label: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
3126
+ className: cx("label"),
3127
+ children: ["Items Type", /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3128
+ className: cx("asterisk"),
3129
+ children: "*"
3130
+ })]
3131
+ }),
3132
+ rules: [{
3133
+ required: true,
3134
+ message: "Items Type is required"
3135
+ }],
3136
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Select, {
3137
+ size: "large",
3138
+ placeholder: "Select",
3139
+ options: PARAM_TYPE_OPTIONS
3140
+ })
3141
+ }),
3121
3142
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Form.Item, {
3122
3143
  name: "required",
3123
3144
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
@@ -3231,9 +3252,9 @@ const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initia
3231
3252
  className: cx("modalTitle"),
3232
3253
  children: [
3233
3254
  mode === "edit" ? "Edit" : "Add",
3234
- " ",
3235
- paramName,
3236
- " parameter"
3255
+ " Parameter to ",
3256
+ endpointName,
3257
+ " endpoint"
3237
3258
  ]
3238
3259
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
3239
3260
  className: cx("modalCloseBtn"),
@@ -3251,7 +3272,10 @@ const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initia
3251
3272
  mode === "edit" ? "edit" : "add",
3252
3273
  " ",
3253
3274
  paramName,
3254
- " parameter?"
3275
+ " parameter to",
3276
+ " ",
3277
+ endpointName,
3278
+ " endpoint?"
3255
3279
  ]
3256
3280
  })
3257
3281
  }),
@@ -3342,6 +3366,15 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
3342
3366
  const [openResponsePanels, setOpenResponsePanels] = (0, react$1.useState)(/* @__PURE__ */ new Set());
3343
3367
  const [selectedStatusCodes, setSelectedStatusCodes] = (0, react$1.useState)({});
3344
3368
  const [drawerSource, setDrawerSource] = (0, react$1.useState)("request");
3369
+ const drawerEndpointName = (0, react$1.useMemo)(() => {
3370
+ if (!paramDrawerEndpointId) return "";
3371
+ const ep = Object.values(endpointsByTag).flat().find((e) => e.id === paramDrawerEndpointId);
3372
+ return endpointNames[paramDrawerEndpointId] ?? ep?.summary ?? "";
3373
+ }, [
3374
+ paramDrawerEndpointId,
3375
+ endpointsByTag,
3376
+ endpointNames
3377
+ ]);
3345
3378
  const [requestPages, setRequestPages] = (0, react$1.useState)(/* @__PURE__ */ new Map());
3346
3379
  const [responsePages, setResponsePages] = (0, react$1.useState)(/* @__PURE__ */ new Map());
3347
3380
  const [requestSearches, setRequestSearches] = (0, react$1.useState)({});
@@ -5209,6 +5242,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
5209
5242
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AddParameterDrawer, {
5210
5243
  open: paramDrawerOpen,
5211
5244
  mode: paramDrawerMode,
5245
+ endpointName: drawerEndpointName,
5212
5246
  initialValues: paramDrawerMode === "edit" && paramDrawerEndpointId && editParamIdx !== null ? drawerSource === "response" ? endpointResponseParams[paramDrawerEndpointId]?.[editParamIdx] : endpointParams[paramDrawerEndpointId]?.[editParamIdx] : void 0,
5213
5247
  onClose: () => {
5214
5248
  setParamDrawerOpen(false);
@@ -6474,6 +6508,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
6474
6508
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AddParameterDrawer, {
6475
6509
  open: paramDrawerOpen,
6476
6510
  mode: paramDrawerMode,
6511
+ endpointName: drawerEndpointName,
6477
6512
  initialValues: paramDrawerMode === "edit" && paramDrawerEndpointId && editParamIdx !== null ? drawerSource === "response" ? endpointResponseParams[paramDrawerEndpointId]?.[editParamIdx] : endpointParams[paramDrawerEndpointId]?.[editParamIdx] : void 0,
6478
6513
  onClose: () => {
6479
6514
  setParamDrawerOpen(false);
@@ -9210,7 +9245,8 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
9210
9245
  type: schema?.type ?? "string",
9211
9246
  required: Boolean(p.required ?? false),
9212
9247
  description: p.description != null ? String(p.description) : void 0,
9213
- enum: Array.isArray(schema?.enum) ? schema.enum : void 0
9248
+ enum: Array.isArray(schema?.enum) ? schema.enum : void 0,
9249
+ ...schema?.items && { items: { type: schema.items.type ?? "string" } }
9214
9250
  };
9215
9251
  });
9216
9252
  });
@@ -9240,7 +9276,8 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
9240
9276
  type: schema?.type ?? "string",
9241
9277
  required: Boolean(p.required ?? false),
9242
9278
  description: p.description != null ? String(p.description) : void 0,
9243
- enum: Array.isArray(schema?.enum) ? schema.enum : void 0
9279
+ enum: Array.isArray(schema?.enum) ? schema.enum : void 0,
9280
+ ...schema?.items && { items: { type: schema.items.type ?? "string" } }
9244
9281
  };
9245
9282
  });
9246
9283
  });
@@ -9444,6 +9481,7 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
9444
9481
  setEndpointTags({});
9445
9482
  setEndpointParams(initialEndpointParams);
9446
9483
  setEndpointResponseParams(initialEndpointResponseParams);
9484
+ setLocalTags(tagMetadata);
9447
9485
  setResetKey((prev) => prev + 1);
9448
9486
  messageApi.success("Changes have been reset successfully.");
9449
9487
  };
@@ -9496,7 +9534,8 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
9496
9534
  ...param.description && { description: param.description },
9497
9535
  schema: {
9498
9536
  type: param.type,
9499
- ...param.enum && param.enum.length > 0 && { enum: param.enum }
9537
+ ...param.enum && param.enum.length > 0 && { enum: param.enum },
9538
+ ...param.type === "array" && param.items && { items: param.items }
9500
9539
  }
9501
9540
  }));
9502
9541
  else delete methodObj.parameters;
@@ -9513,7 +9552,8 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
9513
9552
  ...param.description && { description: param.description },
9514
9553
  schema: {
9515
9554
  type: param.type,
9516
- ...param.enum && param.enum.length > 0 && { enum: param.enum }
9555
+ ...param.enum && param.enum.length > 0 && { enum: param.enum },
9556
+ ...param.type === "array" && param.items && { items: param.items }
9517
9557
  }
9518
9558
  }));
9519
9559
  else delete methodObj["x-response-params"];
@@ -9560,10 +9600,9 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
9560
9600
  setSelectedApi(newTransformed);
9561
9601
  } catch (err) {
9562
9602
  let messages = [];
9563
- if (err && typeof err === "object" && "errors" in err) {
9564
- const e = err;
9565
- messages = Array.isArray(e.errors) ? e.errors : [e.errors];
9566
- } else if (err instanceof Error) messages = err.message.split("\n").filter(Boolean);
9603
+ if (err && typeof err === "object" && "data" in err) messages = [err.data?.message ?? "Unknown error"];
9604
+ else if (err && typeof err === "object" && "message" in err) messages = [String(err.message)];
9605
+ else if (err instanceof Error) messages = err.message.split("\n").filter(Boolean);
9567
9606
  else messages = [String(err)];
9568
9607
  setSaveErrors(messages);
9569
9608
  setSelectedEditItem({ type: "errors" });