zudoku 0.3.1-dev.0 → 0.3.1-dev.10

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.
Files changed (55) hide show
  1. package/LICENSE.md +21 -0
  2. package/dist/lib/plugins/openapi/OperationList.js +3 -4
  3. package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
  4. package/dist/lib/plugins/openapi/OperationListItem.js +2 -3
  5. package/dist/lib/plugins/openapi/OperationListItem.js.map +1 -1
  6. package/dist/lib/plugins/openapi/ParameterListItem.js +1 -1
  7. package/dist/lib/plugins/openapi/ParameterListItem.js.map +1 -1
  8. package/dist/lib/plugins/openapi/playground/PlaygroundDialog.js +2 -2
  9. package/dist/lib/plugins/openapi/playground/PlaygroundDialog.js.map +1 -1
  10. package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroup.d.ts +9 -0
  11. package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroup.js +14 -0
  12. package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroup.js.map +1 -0
  13. package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroupConnector.d.ts +6 -0
  14. package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroupConnector.js +17 -0
  15. package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroupConnector.js.map +1 -0
  16. package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroupItem.d.ts +7 -0
  17. package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroupItem.js +10 -0
  18. package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroupItem.js.map +1 -0
  19. package/dist/lib/plugins/openapi/schema/SchemaComponents.d.ts +3 -3
  20. package/dist/lib/plugins/openapi/schema/SchemaComponents.js +15 -15
  21. package/dist/lib/plugins/openapi/schema/SchemaComponents.js.map +1 -1
  22. package/dist/lib/plugins/openapi/schema/SchemaView.js +1 -1
  23. package/dist/lib/plugins/openapi/schema/SchemaView.js.map +1 -1
  24. package/dist/lib/plugins/openapi/schema/utils.d.ts +6 -0
  25. package/dist/lib/plugins/openapi/schema/utils.js +5 -0
  26. package/dist/lib/plugins/openapi/schema/utils.js.map +1 -1
  27. package/lib/{Input-DB9VROFR.js → Input-CzXNm7xb.js} +2 -1
  28. package/lib/{Input-DB9VROFR.js.map → Input-CzXNm7xb.js.map} +1 -1
  29. package/lib/OperationList-CYyaboNz.js +589 -0
  30. package/lib/OperationList-CYyaboNz.js.map +1 -0
  31. package/lib/{Route-DfAFiR7v.js → Route-C3Jb0axy.js} +2 -2
  32. package/lib/{Route-DfAFiR7v.js.map → Route-C3Jb0axy.js.map} +1 -1
  33. package/lib/{index-D-9zqIOh.js → index-B1he6g8N.js} +532 -514
  34. package/lib/index-B1he6g8N.js.map +1 -0
  35. package/lib/zudoku.plugin-api-keys.js +1 -1
  36. package/lib/zudoku.plugin-openapi.js +1 -1
  37. package/package.json +79 -99
  38. package/src/app/main.css +26 -1
  39. package/src/lib/plugins/openapi/OperationList.tsx +3 -7
  40. package/src/lib/plugins/openapi/OperationListItem.tsx +3 -4
  41. package/src/lib/plugins/openapi/ParameterListItem.tsx +1 -1
  42. package/src/lib/plugins/openapi/playground/PlaygroundDialog.tsx +27 -5
  43. package/src/lib/plugins/openapi/schema/LogicalGroup/LogicalGroup.tsx +47 -0
  44. package/src/lib/plugins/openapi/schema/LogicalGroup/LogicalGroupConnector.tsx +54 -0
  45. package/src/lib/plugins/openapi/schema/LogicalGroup/LogicalGroupItem.tsx +30 -0
  46. package/src/lib/plugins/openapi/schema/SchemaComponents.tsx +41 -41
  47. package/src/lib/plugins/openapi/schema/SchemaView.tsx +4 -4
  48. package/src/lib/plugins/openapi/schema/utils.ts +8 -0
  49. package/dist/lib/plugins/openapi/util/prose.d.ts +0 -1
  50. package/dist/lib/plugins/openapi/util/prose.js +0 -4
  51. package/dist/lib/plugins/openapi/util/prose.js.map +0 -1
  52. package/lib/OperationList-Cxiw2Z-v.js +0 -457
  53. package/lib/OperationList-Cxiw2Z-v.js.map +0 -1
  54. package/lib/index-D-9zqIOh.js.map +0 -1
  55. package/src/lib/plugins/openapi/util/prose.ts +0 -7
@@ -1,12 +1,18 @@
1
1
  import * as Collapsible from "@radix-ui/react-collapsible";
2
2
  import { ListPlusIcon } from "lucide-react";
3
- import { useState } from "react";
3
+ import { useCallback, useState } from "react";
4
4
  import { Markdown, ProseClasses } from "../../../components/Markdown.js";
5
5
  import type { SchemaObject } from "../../../oas/parser/index.js";
6
6
  import { Button } from "../../../ui/Button.js";
7
7
  import { cn } from "../../../util/cn.js";
8
+ import { objectEntries } from "../../../util/objectEntries.js";
9
+ import { LogicalGroup } from "./LogicalGroup/LogicalGroup.js";
8
10
  import { SchemaView } from "./SchemaView.js";
9
- import { hasLogicalGroupings, isComplexType } from "./utils.js";
11
+ import {
12
+ hasLogicalGroupings,
13
+ isComplexType,
14
+ LogicalSchemaTypeMap,
15
+ } from "./utils.js";
10
16
 
11
17
  export const SchemaLogicalGroup = ({
12
18
  schema,
@@ -15,41 +21,34 @@ export const SchemaLogicalGroup = ({
15
21
  schema: SchemaObject;
16
22
  level: number;
17
23
  }) => {
18
- const renderLogicalGroup = (
19
- group: SchemaObject[],
20
- groupName: string,
21
- separator: string,
22
- ) => {
23
- return group.map((subSchema, index) => (
24
- <div key={index} className="my-2">
25
- <strong>{groupName}</strong>
26
- <div className="mt-2">
27
- <SchemaView schema={subSchema} level={level + 1} />
28
- {index < group.length - 1 && (
29
- <div className="text-center my-2">{separator}</div>
30
- )}
31
- </div>
32
- </div>
33
- ));
34
- };
24
+ const [isOpen, setIsOpen] = useState(true);
25
+ const toggleOpen = useCallback(() => setIsOpen((prev) => !prev), []);
35
26
 
36
- if (schema.oneOf) return renderLogicalGroup(schema.oneOf, "One of", "OR");
37
- if (schema.allOf) return renderLogicalGroup(schema.allOf, "All of", "AND");
38
- if (schema.anyOf) return renderLogicalGroup(schema.anyOf, "Any of", "OR");
27
+ for (const [key, type] of objectEntries(LogicalSchemaTypeMap)) {
28
+ if (!schema[key]) continue;
39
29
 
40
- return null;
30
+ return (
31
+ <LogicalGroup
32
+ schemas={schema[key]}
33
+ type={type}
34
+ isOpen={isOpen}
35
+ toggleOpen={toggleOpen}
36
+ level={level}
37
+ />
38
+ );
39
+ }
41
40
  };
42
41
 
43
42
  export const SchemaPropertyItem = ({
44
43
  name,
45
- value,
44
+ schema,
46
45
  group,
47
46
  level,
48
47
  defaultOpen = false,
49
48
  showCollapseButton = true,
50
49
  }: {
51
50
  name: string;
52
- value: SchemaObject;
51
+ schema: SchemaObject;
53
52
  group: "required" | "optional" | "deprecated";
54
53
  level: number;
55
54
  defaultOpen?: boolean;
@@ -63,12 +62,12 @@ export const SchemaPropertyItem = ({
63
62
  <div className="flex gap-2 items-center">
64
63
  <code>{name}</code>
65
64
  <span className="text-muted-foreground">
66
- {value.type === "array" && value.items?.type ? (
67
- <span>{value.items.type}[]</span>
68
- ) : Array.isArray(value.type) ? (
69
- <span>{value.type.join(" | ")}</span>
65
+ {schema.type === "array" && schema.items?.type ? (
66
+ <span>{schema.items.type}[]</span>
67
+ ) : Array.isArray(schema.type) ? (
68
+ <span>{schema.type.join(" | ")}</span>
70
69
  ) : (
71
- <span>{value.type}</span>
70
+ <span>{schema.type}</span>
72
71
  )}
73
72
  </span>
74
73
  {group === "optional" && (
@@ -78,14 +77,14 @@ export const SchemaPropertyItem = ({
78
77
  )}
79
78
  </div>
80
79
 
81
- {value.description && (
80
+ {schema.description && (
82
81
  <Markdown
83
82
  className={cn(ProseClasses, "text-sm leading-normal line-clamp-4")}
84
- content={value.description}
83
+ content={schema.description}
85
84
  />
86
85
  )}
87
86
 
88
- {(hasLogicalGroupings(value) || isComplexType(value)) && (
87
+ {(hasLogicalGroupings(schema) || isComplexType(schema)) && (
89
88
  <Collapsible.Root
90
89
  defaultOpen={defaultOpen}
91
90
  open={isOpen}
@@ -107,14 +106,15 @@ export const SchemaPropertyItem = ({
107
106
  )}
108
107
  <Collapsible.Content>
109
108
  <div className="mt-2">
110
- {hasLogicalGroupings(value) && (
111
- <SchemaLogicalGroup schema={value} level={level + 1} />
112
- )}
113
- {value.type === "object" && (
114
- <SchemaView schema={value} level={level + 1} />
115
- )}
116
- {value.type === "array" && typeof value.items === "object" && (
117
- <SchemaView schema={value.items} level={level + 1} />
109
+ {hasLogicalGroupings(schema) ? (
110
+ <SchemaLogicalGroup schema={schema} level={level + 1} />
111
+ ) : schema.type === "object" ? (
112
+ <SchemaView schema={schema} level={level + 1} />
113
+ ) : (
114
+ schema.type === "array" &&
115
+ typeof schema.items === "object" && (
116
+ <SchemaView schema={schema.items} level={level + 1} />
117
+ )
118
118
  )}
119
119
  </div>
120
120
  </Collapsible.Content>
@@ -111,11 +111,11 @@ export const SchemaView = ({
111
111
  (group) =>
112
112
  groupedProperties[group] && (
113
113
  <ul key={group} className="divide-y">
114
- {groupedProperties[group].map(([key, value]) => (
114
+ {groupedProperties[group].map(([name, schema]) => (
115
115
  <SchemaPropertyItem
116
- key={key}
117
- name={key}
118
- value={value}
116
+ key={name}
117
+ name={name}
118
+ schema={schema}
119
119
  group={group}
120
120
  level={level}
121
121
  defaultOpen={isTopLevelSingleItem || defaultOpen}
@@ -8,3 +8,11 @@ export const isComplexType = (value: SchemaObject) =>
8
8
 
9
9
  export const hasLogicalGroupings = (value: SchemaObject) =>
10
10
  Boolean(value.oneOf ?? value.allOf ?? value.anyOf);
11
+
12
+ export const LogicalSchemaTypeMap = {
13
+ allOf: "AND",
14
+ anyOf: "OR",
15
+ oneOf: "ONE",
16
+ } as const;
17
+
18
+ export type LogicalGroupType = "AND" | "OR" | "ONE";
@@ -1 +0,0 @@
1
- export declare const SchemaProseClasses: string;
@@ -1,4 +0,0 @@
1
- import { ProseClasses } from "../../../components/Markdown.js";
2
- import { cn } from "../../../util/cn.js";
3
- export const SchemaProseClasses = cn(ProseClasses, "max-w-full prose-img:max-w-prose");
4
- //# sourceMappingURL=prose.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"prose.js","sourceRoot":"","sources":["../../../../../src/lib/plugins/openapi/util/prose.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,EAAE,EAAE,MAAM,qBAAqB,CAAC;AAEzC,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,CAClC,YAAY,EACZ,kCAAkC,CACnC,CAAC"}
@@ -1,457 +0,0 @@
1
- import { j as e } from "./jsx-runtime-B6kdoens.js";
2
- import { C as b } from "./CategoryHeading-z15xh7Jb.js";
3
- import { D as T } from "./DeveloperHint-BQSFXH01.js";
4
- import { C as v, a as p, b as A, c as I, d as R, T as k, e as H, f as F, g as $, S as B, h as S, u as M, E as z } from "./index-D-9zqIOh.js";
5
- import { c as E, h as m, H as h, a as u, P as g, I as O, S as G } from "./Markdown-CEccPMI_.js";
6
- import { useState as P } from "react";
7
- import { R as D, T as Q, C as V, a as _ } from "./index-Dz4LyXZI.js";
8
- import { u as J } from "./urql-DrBfkb92.js";
9
- import { B as K } from "./Combination-DTfV-c98.js";
10
- /**
11
- * @license lucide-react v0.378.0 - ISC
12
- *
13
- * This source code is licensed under the ISC license.
14
- * See the LICENSE file in the root directory of this source tree.
15
- */
16
- const U = E("ListPlus", [
17
- ["path", { d: "M11 12H3", key: "51ecnj" }],
18
- ["path", { d: "M16 6H3", key: "1wxfjs" }],
19
- ["path", { d: "M16 18H3", key: "12xzn7" }],
20
- ["path", { d: "M18 9v6", key: "1twb98" }],
21
- ["path", { d: "M21 12h-6", key: "bt1uis" }]
22
- ]);
23
- function Z(s, t) {
24
- return t;
25
- }
26
- const q = (s, t) => s.reduce(
27
- (i, r) => {
28
- const n = t(r);
29
- return i[n] || (i[n] = []), i[n].push(r), i;
30
- },
31
- {}
32
- ), W = (s, t) => s ? t(s) : void 0, C = (s) => s.schema != null && typeof s.schema == "object" ? s.schema : {
33
- type: "string"
34
- }, X = ({
35
- parameter: s,
36
- group: t,
37
- id: i
38
- }) => /* @__PURE__ */ e.jsxs("li", { className: "p-4 bg-border/20 text-sm flex flex-col gap-1", children: [
39
- /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
40
- /* @__PURE__ */ e.jsx("code", { children: t === "path" ? /* @__PURE__ */ e.jsx(
41
- v,
42
- {
43
- name: s.name,
44
- backgroundOpacity: "15%",
45
- slug: i + "-" + s.name.toLocaleLowerCase()
46
- }
47
- ) : s.name }),
48
- s.required && /* @__PURE__ */ e.jsx("span", { className: "py-px px-1.5 font-medium bg-primary/75 text-muted rounded-lg", children: "required" }),
49
- C(s).type && /* @__PURE__ */ e.jsx("span", { className: "text-muted-foreground", children: C(s).type })
50
- ] }),
51
- s.description && /* @__PURE__ */ e.jsx(
52
- m,
53
- {
54
- content: s.description,
55
- className: "text-sm prose-p:my-1"
56
- }
57
- )
58
- ] }), Y = ({
59
- group: s,
60
- parameters: t,
61
- id: i
62
- }) => /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
63
- /* @__PURE__ */ e.jsx(h, { level: 3, id: `${i}/${s}-parameters`, className: "capitalize", children: s === "header" ? "Headers" : `${s} Parameters` }),
64
- /* @__PURE__ */ e.jsx(p, { children: /* @__PURE__ */ e.jsx("ul", { className: "list-none m-0 px-0 divide-y ", children: t.sort((r, n) => r.required === n.required ? 0 : r.required ? -1 : 1).map((r) => /* @__PURE__ */ e.jsx(
65
- X,
66
- {
67
- parameter: r,
68
- id: i,
69
- group: s
70
- },
71
- `${r.name}-${r.in}`
72
- )) }) })
73
- ] }), ee = (s) => s.type === "object" || s.type === "array" && typeof s.items == "object" && (!s.items.type || s.items.type === "object"), y = (s) => !!(s.oneOf ?? s.allOf ?? s.anyOf), w = ({
74
- schema: s,
75
- level: t
76
- }) => {
77
- const i = (r, n, l) => r.map((o, c) => /* @__PURE__ */ e.jsxs("div", { className: "my-2", children: [
78
- /* @__PURE__ */ e.jsx("strong", { children: n }),
79
- /* @__PURE__ */ e.jsxs("div", { className: "mt-2", children: [
80
- /* @__PURE__ */ e.jsx(f, { schema: o, level: t + 1 }),
81
- c < r.length - 1 && /* @__PURE__ */ e.jsx("div", { className: "text-center my-2", children: l })
82
- ] })
83
- ] }, c));
84
- return s.oneOf ? i(s.oneOf, "One of", "OR") : s.allOf ? i(s.allOf, "All of", "AND") : s.anyOf ? i(s.anyOf, "Any of", "OR") : null;
85
- }, se = ({
86
- name: s,
87
- value: t,
88
- group: i,
89
- level: r,
90
- defaultOpen: n = !1,
91
- showCollapseButton: l = !0
92
- }) => {
93
- var x;
94
- const [o, c] = P(n);
95
- return /* @__PURE__ */ e.jsx("li", { className: "p-4 bg-border/20 hover:bg-border/30", children: /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-1 justify-between text-sm", children: [
96
- /* @__PURE__ */ e.jsxs("div", { className: "flex gap-2 items-center", children: [
97
- /* @__PURE__ */ e.jsx("code", { children: s }),
98
- /* @__PURE__ */ e.jsx("span", { className: "text-muted-foreground", children: t.type === "array" && ((x = t.items) != null && x.type) ? /* @__PURE__ */ e.jsxs("span", { children: [
99
- t.items.type,
100
- "[]"
101
- ] }) : Array.isArray(t.type) ? /* @__PURE__ */ e.jsx("span", { children: t.type.join(" | ") }) : /* @__PURE__ */ e.jsx("span", { children: t.type }) }),
102
- i === "optional" && /* @__PURE__ */ e.jsx("span", { className: "py-px px-1.5 font-medium border rounded-lg", children: "optional" })
103
- ] }),
104
- t.description && /* @__PURE__ */ e.jsx(
105
- m,
106
- {
107
- className: u(g, "text-sm leading-normal line-clamp-4"),
108
- content: t.description
109
- }
110
- ),
111
- (y(t) || ee(t)) && /* @__PURE__ */ e.jsxs(
112
- D,
113
- {
114
- defaultOpen: n,
115
- open: o,
116
- onOpenChange: () => c(!o),
117
- children: [
118
- l && /* @__PURE__ */ e.jsx(Q, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
119
- K,
120
- {
121
- variant: "outline",
122
- size: "sm",
123
- className: "mt-2 flex gap-1.5",
124
- children: [
125
- /* @__PURE__ */ e.jsx(U, { size: 18 }),
126
- o ? "Hide nested properties" : "Show nested properties"
127
- ]
128
- }
129
- ) }),
130
- /* @__PURE__ */ e.jsx(V, { children: /* @__PURE__ */ e.jsxs("div", { className: "mt-2", children: [
131
- y(t) && /* @__PURE__ */ e.jsx(w, { schema: t, level: r + 1 }),
132
- t.type === "object" && /* @__PURE__ */ e.jsx(f, { schema: t, level: r + 1 }),
133
- t.type === "array" && typeof t.items == "object" && /* @__PURE__ */ e.jsx(f, { schema: t.items, level: r + 1 })
134
- ] }) })
135
- ]
136
- }
137
- )
138
- ] }) });
139
- }, f = ({
140
- schema: s,
141
- level: t = 0,
142
- defaultOpen: i = !1
143
- }) => {
144
- if (!s || Object.keys(s).length === 0)
145
- return /* @__PURE__ */ e.jsx(p, { className: "p-4", children: /* @__PURE__ */ e.jsx("span", { className: "text-sm text-muted-foreground italic", children: "No response specified" }) });
146
- const r = (n, l) => {
147
- if (n.oneOf || n.allOf || n.anyOf)
148
- return /* @__PURE__ */ e.jsx(w, { schema: n, level: l });
149
- if (n.type === "array" && n.items) {
150
- const o = n.items;
151
- return typeof o.type == "string" && ["string", "number", "boolean", "integer"].includes(o.type) ? /* @__PURE__ */ e.jsxs(p, { className: "p-4", children: [
152
- /* @__PURE__ */ e.jsxs("span", { className: "text-sm text-muted-foreground", children: [
153
- o.type,
154
- "[]"
155
- ] }),
156
- n.description && /* @__PURE__ */ e.jsx(
157
- m,
158
- {
159
- className: u(
160
- g,
161
- "text-sm leading-normal line-clamp-4"
162
- ),
163
- content: n.description
164
- }
165
- )
166
- ] }) : o.type === "object" || y(o) ? /* @__PURE__ */ e.jsxs(p, { className: "flex flex-col gap-2 bg-border/30 p-4", children: [
167
- /* @__PURE__ */ e.jsx("span", { className: "text-sm text-muted-foreground", children: "object[]" }),
168
- r(o, l + 1)
169
- ] }) : r(o, l + 1);
170
- }
171
- if (n.type === "object" && !n.properties)
172
- return /* @__PURE__ */ e.jsxs(p, { className: "p-4 flex gap-2 items-center", children: [
173
- "name" in n && /* @__PURE__ */ e.jsx(e.Fragment, { children: n.name }),
174
- /* @__PURE__ */ e.jsx("span", { className: "text-sm text-muted-foreground", children: "object" }),
175
- n.description && /* @__PURE__ */ e.jsx(
176
- m,
177
- {
178
- className: u(
179
- g,
180
- "text-sm leading-normal line-clamp-4"
181
- ),
182
- content: n.description
183
- }
184
- )
185
- ] });
186
- if (n.properties) {
187
- const o = q(
188
- Object.entries(n.properties),
189
- ([a, d]) => {
190
- var j;
191
- return d.deprecated ? "deprecated" : (j = n.required) != null && j.includes(a) ? "required" : "optional";
192
- }
193
- ), c = l === 0 && Object.keys(o).length === 1, x = ["required", "optional", "deprecated"];
194
- return /* @__PURE__ */ e.jsx(p, { className: "divide-y overflow-hidden", children: x.map(
195
- (a) => o[a] && /* @__PURE__ */ e.jsx("ul", { className: "divide-y", children: o[a].map(([d, j]) => /* @__PURE__ */ e.jsx(
196
- se,
197
- {
198
- name: d,
199
- value: j,
200
- group: a,
201
- level: l,
202
- defaultOpen: c || i,
203
- showCollapseButton: !c
204
- },
205
- d
206
- )) }, a)
207
- ) });
208
- }
209
- return typeof n.type == "string" && ["string", "number", "boolean", "integer", "null"].includes(n.type) ? /* @__PURE__ */ e.jsxs(p, { className: "p-4", children: [
210
- /* @__PURE__ */ e.jsx("span", { className: "text-sm text-muted-foreground", children: n.type }),
211
- n.description && /* @__PURE__ */ e.jsx(
212
- m,
213
- {
214
- className: u(
215
- g,
216
- "text-sm leading-normal line-clamp-4"
217
- ),
218
- content: n.description
219
- }
220
- )
221
- ] }) : n.additionalProperties ? /* @__PURE__ */ e.jsxs(p, { className: "my-2", children: [
222
- /* @__PURE__ */ e.jsx(A, { children: /* @__PURE__ */ e.jsx(I, { children: "Additional Properties:" }) }),
223
- /* @__PURE__ */ e.jsx(R, { children: r(
224
- n.additionalProperties,
225
- l + 1
226
- ) })
227
- ] }) : null;
228
- };
229
- return r(s, t);
230
- }, N = u(
231
- g,
232
- "max-w-full prose-img:max-w-prose"
233
- ), te = ["path", "query", "header", "cookie"], ne = ({
234
- operationFragment: s
235
- }) => {
236
- var o, c, x;
237
- const t = Z(re, s), i = q(
238
- t.parameters ?? [],
239
- (a) => a.in
240
- ), r = t.responses.at(0), [n, l] = P(r == null ? void 0 : r.statusCode);
241
- return /* @__PURE__ */ e.jsxs(
242
- "div",
243
- {
244
- className: "grid grid-cols-1 lg:grid-cols-[4fr_3fr] gap-8 items-start border-b-2 mb-16 pb-16",
245
- children: [
246
- /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-4", children: [
247
- /* @__PURE__ */ e.jsx(h, { level: 2, id: t.slug, registerSidebarAnchor: !0, children: t.summary }),
248
- t.description && /* @__PURE__ */ e.jsx(
249
- m,
250
- {
251
- className: N,
252
- content: t.description
253
- }
254
- ),
255
- t.parameters && t.parameters.length > 0 && /* @__PURE__ */ e.jsx(e.Fragment, { children: te.flatMap(
256
- (a) => {
257
- var d;
258
- return (d = i[a]) != null && d.length ? /* @__PURE__ */ e.jsx(
259
- Y,
260
- {
261
- id: t.slug,
262
- parameters: i[a],
263
- group: a
264
- },
265
- a
266
- ) : [];
267
- }
268
- ) }),
269
- W((x = (c = (o = t.requestBody) == null ? void 0 : o.content) == null ? void 0 : c.at(0)) == null ? void 0 : x.schema, (a) => /* @__PURE__ */ e.jsxs("div", { className: "mt-4 flex flex-col gap-4", children: [
270
- /* @__PURE__ */ e.jsx(h, { level: 3, className: "capitalize", children: "Request Body" }),
271
- /* @__PURE__ */ e.jsx(f, { schema: a })
272
- ] })),
273
- t.responses.length > 0 && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
274
- /* @__PURE__ */ e.jsx(h, { level: 3, className: "capitalize mt-8 pt-8 border-t", children: "Responses" }),
275
- /* @__PURE__ */ e.jsxs(
276
- k,
277
- {
278
- onValueChange: (a) => l(a),
279
- value: n,
280
- children: [
281
- t.responses.length > 1 && /* @__PURE__ */ e.jsx(H, { children: t.responses.map((a) => /* @__PURE__ */ e.jsx(
282
- F,
283
- {
284
- value: a.statusCode,
285
- title: a.description,
286
- children: a.statusCode
287
- },
288
- a.statusCode
289
- )) }),
290
- /* @__PURE__ */ e.jsx("ul", { className: "list-none m-0 px-0 overflow-hidden", children: t.responses.map((a) => {
291
- var d, j;
292
- return /* @__PURE__ */ e.jsx(
293
- $,
294
- {
295
- value: a.statusCode,
296
- children: /* @__PURE__ */ e.jsx(
297
- f,
298
- {
299
- schema: (j = (d = a.content) == null ? void 0 : d.find((L) => L.schema)) == null ? void 0 : j.schema
300
- }
301
- )
302
- },
303
- a.statusCode
304
- );
305
- }) })
306
- ]
307
- }
308
- )
309
- ] })
310
- ] }),
311
- /* @__PURE__ */ e.jsx(
312
- B,
313
- {
314
- selectedResponse: n,
315
- onSelectResponse: l,
316
- operation: t
317
- }
318
- )
319
- ]
320
- },
321
- t.operationId
322
- );
323
- }, re = S(
324
- /* GraphQL */
325
- `
326
- fragment OperationsFragment on OperationItem {
327
- slug
328
- summary
329
- method
330
- description
331
- operationId
332
- contentTypes
333
- path
334
- parameters {
335
- name
336
- in
337
- description
338
- required
339
- schema
340
- style
341
- examples {
342
- name
343
- description
344
- externalValue
345
- value
346
- summary
347
- }
348
- }
349
- requestBody {
350
- content {
351
- mediaType
352
- encoding {
353
- name
354
- }
355
- schema
356
- }
357
- description
358
- required
359
- }
360
- responses {
361
- statusCode
362
- links
363
- description
364
- content {
365
- mediaType
366
- encoding {
367
- name
368
- }
369
- schema
370
- }
371
- }
372
- }
373
- `
374
- ), ie = S(
375
- /* GraphQL */
376
- `
377
- query AllOperations($input: JSON!, $type: SchemaType!) {
378
- schema(input: $input, type: $type) {
379
- description
380
- title
381
- url
382
- version
383
- tags {
384
- name
385
- description
386
- operations {
387
- slug
388
- ...OperationsFragment
389
- }
390
- }
391
- }
392
- }
393
- `
394
- ), ae = { suspense: !0 }, he = () => {
395
- var n;
396
- const { type: s, input: t } = M(), [i] = J({
397
- query: ie,
398
- variables: { type: s, input: t },
399
- context: ae
400
- }), r = (n = i.error) == null ? void 0 : n.graphQLErrors.at(0);
401
- return r ? /* @__PURE__ */ e.jsx(
402
- z,
403
- {
404
- category: "Error",
405
- title: "Schema cannot be displayed",
406
- message: /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
407
- /* @__PURE__ */ e.jsxs(T, { className: "mb-4", children: [
408
- "Check your configuration value ",
409
- /* @__PURE__ */ e.jsx(O, { children: "apis.type" }),
410
- " ",
411
- "and ",
412
- /* @__PURE__ */ e.jsx(O, { children: "apis.input" }),
413
- " in the Zudoku config."
414
- ] }),
415
- "An error occurred while trying to fetch the API reference:",
416
- /* @__PURE__ */ e.jsx(G, { code: r.toString(), language: "plain" })
417
- ] })
418
- }
419
- ) : i.data ? /* @__PURE__ */ e.jsxs("div", { className: "pt-[--padding-content-top]", children: [
420
- /* @__PURE__ */ e.jsxs(
421
- "div",
422
- {
423
- className: u(
424
- N,
425
- "mb-16 max-w-full prose-img:max-w-prose"
426
- ),
427
- children: [
428
- /* @__PURE__ */ e.jsx(b, { children: "Overview" }),
429
- /* @__PURE__ */ e.jsx(h, { level: 1, id: "description", registerSidebarAnchor: !0, children: i.data.schema.title }),
430
- /* @__PURE__ */ e.jsx(m, { content: i.data.schema.description ?? "" })
431
- ]
432
- }
433
- ),
434
- i.data.schema.tags.filter((l) => l.operations.length > 0).map((l) => /* @__PURE__ */ e.jsxs("div", { children: [
435
- l.name && /* @__PURE__ */ e.jsx(b, { children: l.name }),
436
- l.description && /* @__PURE__ */ e.jsx(
437
- m,
438
- {
439
- className: `${N} mt-2 mb-12`,
440
- content: l.description
441
- }
442
- ),
443
- /* @__PURE__ */ e.jsx("div", { className: "operation mb-12", children: /* @__PURE__ */ e.jsx(_, { children: l.operations.map((o) => /* @__PURE__ */ e.jsx(
444
- ne,
445
- {
446
- operationFragment: o
447
- },
448
- o.slug
449
- )) }) })
450
- ] }, l.name))
451
- ] }) : null;
452
- };
453
- export {
454
- he as OperationList,
455
- re as OperationsFragment
456
- };
457
- //# sourceMappingURL=OperationList-Cxiw2Z-v.js.map