@digi-frontend/dgate-api-documentation 4.2.1 → 4.2.4

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
@@ -3384,6 +3384,7 @@ const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initia
3384
3384
  //#endregion
3385
3385
  //#region src/view/components/ApiPage/components/EndpointsSection.tsx
3386
3386
  const { useBreakpoint: useBreakpoint$2 } = antd.Grid;
3387
+ const ucFirst = (s) => s.charAt(0).toUpperCase() + s.slice(1);
3387
3388
  const PAGE_SIZE = 4;
3388
3389
  const VIEW_PAGE_SIZE = 4;
3389
3390
  const getStatusCodeColor = (code, token) => {
@@ -3467,11 +3468,15 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
3467
3468
  }));
3468
3469
  });
3469
3470
  openResponsePanels.forEach((epId) => {
3470
- const val = responseBodySchemas?.[epId];
3471
- const json = val ? JSON.stringify(val, null, 2) : "";
3471
+ const statusCodes = responseBodySchemas?.[epId];
3472
+ if (!statusCodes) return;
3473
+ const allStatusCodeEntries = {};
3474
+ Object.entries(statusCodes).forEach(([code, val]) => {
3475
+ allStatusCodeEntries[code] = val ? JSON.stringify(val, null, 2) : "";
3476
+ });
3472
3477
  setEditableResponseContent((prev) => ({
3473
3478
  ...prev,
3474
- [epId]: json
3479
+ [epId]: allStatusCodeEntries
3475
3480
  }));
3476
3481
  });
3477
3482
  }, [
@@ -3497,11 +3502,15 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
3497
3502
  if (!openResponsePanels.size) return;
3498
3503
  openResponsePanels.forEach((epId) => {
3499
3504
  if (editableResponseContent[epId] !== void 0) return;
3500
- const val = responseBodySchemas?.[epId];
3501
- const json = val ? JSON.stringify(val, null, 2) : "";
3505
+ const statusCodes = responseBodySchemas?.[epId];
3506
+ if (!statusCodes) return;
3507
+ const allStatusCodeEntries = {};
3508
+ Object.entries(statusCodes).forEach(([code, val]) => {
3509
+ allStatusCodeEntries[code] = val ? JSON.stringify(val, null, 2) : "";
3510
+ });
3502
3511
  setEditableResponseContent((prev) => ({
3503
3512
  ...prev,
3504
- [epId]: json
3513
+ [epId]: allStatusCodeEntries
3505
3514
  }));
3506
3515
  });
3507
3516
  }, [openResponsePanels, responseBodySchemas]);
@@ -3746,6 +3755,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
3746
3755
  alignItems: "center",
3747
3756
  justifyContent: "space-between",
3748
3757
  width: "100%",
3758
+ gap: 16,
3749
3759
  padding: `12px 0px`,
3750
3760
  borderBottom: `1px solid ${token.colorBorderSecondary}`,
3751
3761
  background: token.colorBgContainer,
@@ -4081,7 +4091,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
4081
4091
  background: token.colorBgElevated,
4082
4092
  borderRadius: token.borderRadius,
4083
4093
  paddingTop: 16,
4084
- paddingBottom: 16,
4094
+ paddingBottom: 32,
4085
4095
  gap: 8,
4086
4096
  display: "flex",
4087
4097
  flexDirection: "column",
@@ -4553,7 +4563,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
4553
4563
  children: "Parameter In"
4554
4564
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4555
4565
  className: cx("param-detail-value"),
4556
- children: param.in
4566
+ children: ucFirst(param.in)
4557
4567
  })]
4558
4568
  })]
4559
4569
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
@@ -4632,7 +4642,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
4632
4642
  children: "Parameter In"
4633
4643
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4634
4644
  className: cx("param-detail-value"),
4635
- children: param.in
4645
+ children: ucFirst(param.in)
4636
4646
  })]
4637
4647
  }),
4638
4648
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
@@ -4642,7 +4652,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
4642
4652
  children: "Parameter Type"
4643
4653
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4644
4654
  className: cx("param-detail-value"),
4645
- children: param.type
4655
+ children: ucFirst(param.type)
4646
4656
  })]
4647
4657
  }),
4648
4658
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
@@ -5040,7 +5050,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
5040
5050
  children: "Parameter In"
5041
5051
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5042
5052
  className: cx("param-detail-value"),
5043
- children: param.in
5053
+ children: ucFirst(param.in)
5044
5054
  })]
5045
5055
  })]
5046
5056
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
@@ -5119,7 +5129,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
5119
5129
  children: "Parameter In"
5120
5130
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5121
5131
  className: cx("param-detail-value"),
5122
- children: param.in
5132
+ children: ucFirst(param.in)
5123
5133
  })]
5124
5134
  }),
5125
5135
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
@@ -5129,7 +5139,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
5129
5139
  children: "Parameter Type"
5130
5140
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5131
5141
  className: cx("param-detail-value"),
5132
- children: param.type
5142
+ children: ucFirst(param.type)
5133
5143
  })]
5134
5144
  }),
5135
5145
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
@@ -5254,15 +5264,19 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
5254
5264
  openResponsePanels.has(ep.id) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5255
5265
  className: cx("code-panel"),
5256
5266
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Input.TextArea, {
5257
- value: editableResponseContent[ep.id] ?? "",
5267
+ value: editableResponseContent[ep.id]?.[selectedStatusCodes[ep.id]] ?? "",
5258
5268
  onChange: (e) => {
5269
+ const statusCode = selectedStatusCodes[ep.id];
5259
5270
  setEditableResponseContent((prev) => ({
5260
5271
  ...prev,
5261
- [ep.id]: e.target.value
5272
+ [ep.id]: {
5273
+ ...prev[ep.id],
5274
+ [statusCode]: e.target.value
5275
+ }
5262
5276
  }));
5263
- onResponseContentChange?.(ep.id, e.target.value);
5277
+ onResponseContentChange?.(ep.id, selectedStatusCodes[ep.id], e.target.value);
5264
5278
  },
5265
- rows: Math.max(3, (editableResponseContent[ep.id] ?? "").split("\n").length),
5279
+ rows: Math.max(3, (editableResponseContent[ep.id]?.[selectedStatusCodes[ep.id]] ?? "").split("\n").length),
5266
5280
  style: {
5267
5281
  fontFamily: "monospace",
5268
5282
  fontSize: "0.75rem",
@@ -5278,16 +5292,22 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
5278
5292
  ghost: true,
5279
5293
  size: "small",
5280
5294
  className: cx("code-btn"),
5281
- onClick: () => handleValidate(editableResponseContent[ep.id] ?? ""),
5295
+ onClick: () => handleValidate(editableResponseContent[ep.id]?.[selectedStatusCodes[ep.id]] ?? ""),
5282
5296
  children: "Validate"
5283
5297
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Button, {
5284
5298
  ghost: true,
5285
5299
  size: "small",
5286
5300
  className: cx("code-btn"),
5287
- onClick: () => handleBeautify(editableResponseContent[ep.id] ?? "", (v) => setEditableResponseContent((prev) => ({
5288
- ...prev,
5289
- [ep.id]: v
5290
- }))),
5301
+ onClick: () => handleBeautify(editableResponseContent[ep.id]?.[selectedStatusCodes[ep.id]] ?? "", (v) => {
5302
+ const statusCode = selectedStatusCodes[ep.id];
5303
+ setEditableResponseContent((prev) => ({
5304
+ ...prev,
5305
+ [ep.id]: {
5306
+ ...prev[ep.id],
5307
+ [statusCode]: v
5308
+ }
5309
+ }));
5310
+ }),
5291
5311
  children: "Beautify"
5292
5312
  })]
5293
5313
  })]
@@ -5850,7 +5870,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
5850
5870
  children: "Parameter In"
5851
5871
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5852
5872
  className: cx("param-detail-value"),
5853
- children: param.in
5873
+ children: ucFirst(param.in)
5854
5874
  })]
5855
5875
  })]
5856
5876
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
@@ -5925,7 +5945,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
5925
5945
  children: "Parameter In"
5926
5946
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5927
5947
  className: cx("param-detail-value"),
5928
- children: param.in
5948
+ children: ucFirst(param.in)
5929
5949
  })]
5930
5950
  }),
5931
5951
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
@@ -5935,7 +5955,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
5935
5955
  children: "Parameter Type"
5936
5956
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5937
5957
  className: cx("param-detail-value"),
5938
- children: param.type
5958
+ children: ucFirst(param.type)
5939
5959
  })]
5940
5960
  }),
5941
5961
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
@@ -6329,7 +6349,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
6329
6349
  children: "Parameter In"
6330
6350
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6331
6351
  className: cx("param-detail-value"),
6332
- children: param.in
6352
+ children: ucFirst(param.in)
6333
6353
  })]
6334
6354
  })]
6335
6355
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
@@ -6404,7 +6424,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
6404
6424
  children: "Parameter In"
6405
6425
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6406
6426
  className: cx("param-detail-value"),
6407
- children: param.in
6427
+ children: ucFirst(param.in)
6408
6428
  })]
6409
6429
  }),
6410
6430
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
@@ -6414,7 +6434,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
6414
6434
  children: "Parameter Type"
6415
6435
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6416
6436
  className: cx("param-detail-value"),
6417
- children: param.type
6437
+ children: ucFirst(param.type)
6418
6438
  })]
6419
6439
  }),
6420
6440
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
@@ -6537,15 +6557,19 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
6537
6557
  openResponsePanels.has(ep.id) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
6538
6558
  className: cx("code-panel"),
6539
6559
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Input.TextArea, {
6540
- value: editableResponseContent[ep.id] ?? "",
6560
+ value: editableResponseContent[ep.id]?.[selectedStatusCodes[ep.id]] ?? "",
6541
6561
  onChange: (e) => {
6562
+ const statusCode = selectedStatusCodes[ep.id];
6542
6563
  setEditableResponseContent((prev) => ({
6543
6564
  ...prev,
6544
- [ep.id]: e.target.value
6565
+ [ep.id]: {
6566
+ ...prev[ep.id],
6567
+ [statusCode]: e.target.value
6568
+ }
6545
6569
  }));
6546
- onResponseContentChange?.(ep.id, e.target.value);
6570
+ onResponseContentChange?.(ep.id, selectedStatusCodes[ep.id], e.target.value);
6547
6571
  },
6548
- rows: Math.max(3, (editableResponseContent[ep.id] ?? "").split("\n").length),
6572
+ rows: Math.max(3, (editableResponseContent[ep.id]?.[selectedStatusCodes[ep.id]] ?? "").split("\n").length),
6549
6573
  style: {
6550
6574
  fontFamily: "monospace",
6551
6575
  fontSize: "0.75rem",
@@ -6561,16 +6585,22 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
6561
6585
  ghost: true,
6562
6586
  size: "small",
6563
6587
  className: cx("code-btn"),
6564
- onClick: () => handleValidate(editableResponseContent[ep.id] ?? ""),
6588
+ onClick: () => handleValidate(editableResponseContent[ep.id]?.[selectedStatusCodes[ep.id]] ?? ""),
6565
6589
  children: "Validate"
6566
6590
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Button, {
6567
6591
  ghost: true,
6568
6592
  size: "small",
6569
6593
  className: cx("code-btn"),
6570
- onClick: () => handleBeautify(editableResponseContent[ep.id] ?? "", (v) => setEditableResponseContent((prev) => ({
6571
- ...prev,
6572
- [ep.id]: v
6573
- }))),
6594
+ onClick: () => handleBeautify(editableResponseContent[ep.id]?.[selectedStatusCodes[ep.id]] ?? "", (v) => {
6595
+ const statusCode = selectedStatusCodes[ep.id];
6596
+ setEditableResponseContent((prev) => ({
6597
+ ...prev,
6598
+ [ep.id]: {
6599
+ ...prev[ep.id],
6600
+ [statusCode]: v
6601
+ }
6602
+ }));
6603
+ }),
6574
6604
  children: "Beautify"
6575
6605
  })]
6576
6606
  })]
@@ -9076,8 +9106,7 @@ function CodeboxSidebar$1() {
9076
9106
  const firstKey = Object.keys(contentEntry.examples)[0];
9077
9107
  const firstExample = contentEntry.examples[firstKey];
9078
9108
  displayData = firstExample?.value ?? firstExample;
9079
- } else if (contentEntry?.schema && hasAnyExample(contentEntry.schema)) displayData = generateExampleFromSchema(contentEntry.schema);
9080
- else if (contentEntry?.schema) displayData = contentEntry.schema;
9109
+ } else if (contentEntry?.schema) displayData = generateExampleFromSchema(contentEntry.schema);
9081
9110
  else displayData = responseObj;
9082
9111
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Codebox$1, { code: JSON.stringify(displayData, null, 2) || "" });
9083
9112
  })()]
@@ -9519,9 +9548,15 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
9519
9548
  Object.entries(methods).forEach(([method, operation]) => {
9520
9549
  const responses = operation.responses;
9521
9550
  if (!responses) return;
9522
- const schema = responses["200" in responses ? "200" : Object.keys(responses)[0]]?.content?.["application/json"]?.example;
9523
9551
  const epId = pathMethodToId[`${path}||${method}`];
9524
- if (epId && schema) result[epId] = schema;
9552
+ if (!epId) return;
9553
+ result[epId] = {};
9554
+ Object.entries(responses).forEach(([statusCode, responseValue]) => {
9555
+ const content = responseValue?.content?.["application/json"];
9556
+ if (!content) return;
9557
+ const resolved = content?.example !== void 0 ? content.example : content?.examples !== void 0 ? Object.values(content.examples)[0]?.value ?? Object.values(content.examples)[0] : content?.schema != null ? generateExampleFromSchema(content.schema) : void 0;
9558
+ if (resolved !== void 0) result[epId][statusCode] = resolved;
9559
+ });
9525
9560
  });
9526
9561
  });
9527
9562
  return result;
@@ -10168,12 +10203,15 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
10168
10203
  setBannerVisible(true);
10169
10204
  } catch {}
10170
10205
  },
10171
- onResponseContentChange: (endpointId, jsonString) => {
10206
+ onResponseContentChange: (endpointId, statusCode, jsonString) => {
10172
10207
  try {
10173
10208
  const schema = JSON.parse(jsonString);
10174
10209
  setEndpointResponseBody((prev) => ({
10175
10210
  ...prev,
10176
- [endpointId]: schema
10211
+ [endpointId]: {
10212
+ ...prev[endpointId],
10213
+ [statusCode]: schema
10214
+ }
10177
10215
  }));
10178
10216
  setBannerVisible(true);
10179
10217
  } catch {}
@@ -10329,12 +10367,15 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
10329
10367
  setBannerVisible(true);
10330
10368
  } catch {}
10331
10369
  },
10332
- onResponseContentChange: (endpointId, jsonString) => {
10370
+ onResponseContentChange: (endpointId, statusCode, jsonString) => {
10333
10371
  try {
10334
10372
  const schema = JSON.parse(jsonString);
10335
10373
  setEndpointResponseBody((prev) => ({
10336
10374
  ...prev,
10337
- [endpointId]: schema
10375
+ [endpointId]: {
10376
+ ...prev[endpointId],
10377
+ [statusCode]: schema
10378
+ }
10338
10379
  }));
10339
10380
  setBannerVisible(true);
10340
10381
  } catch {}