zudoku 0.33.2-local.4 → 0.34.0
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/README.md +121 -0
- package/dist/config/validators/common.d.ts +346 -346
- package/dist/config/validators/validate.d.ts +165 -165
- package/dist/lib/components/AnchorLink.d.ts +2 -2
- package/dist/lib/components/AnchorLink.js +4 -4
- package/dist/lib/components/AnchorLink.js.map +1 -1
- package/dist/lib/components/Heading.d.ts +1 -1
- package/dist/lib/components/context/ZudokuContext.d.ts +1 -1
- package/dist/lib/components/navigation/SidebarItem.js +6 -5
- package/dist/lib/components/navigation/SidebarItem.js.map +1 -1
- package/dist/lib/core/ZudokuContext.d.ts +4 -0
- package/dist/lib/core/ZudokuContext.js.map +1 -1
- package/dist/lib/plugins/openapi/OperationList.js +4 -1
- package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
- package/dist/lib/plugins/openapi/OperationListItem.d.ts +1 -1
- package/dist/lib/plugins/openapi/OperationListItem.js +5 -3
- package/dist/lib/plugins/openapi/OperationListItem.js.map +1 -1
- package/dist/lib/plugins/openapi/graphql/gql.d.ts +1 -1
- package/dist/lib/plugins/openapi/graphql/gql.js +1 -1
- package/dist/lib/plugins/openapi/graphql/gql.js.map +1 -1
- package/dist/lib/plugins/openapi/graphql/graphql.d.ts +1 -0
- package/dist/lib/plugins/openapi/graphql/graphql.js +2 -0
- package/dist/lib/plugins/openapi/graphql/graphql.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/ExamplesDropdown.d.ts +2 -2
- package/dist/lib/plugins/openapi/playground/ExamplesDropdown.js +1 -5
- package/dist/lib/plugins/openapi/playground/ExamplesDropdown.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/Headers.js +1 -1
- package/dist/lib/plugins/openapi/playground/Headers.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/IdentityDialog.d.ts +11 -0
- package/dist/lib/plugins/openapi/playground/IdentityDialog.js +14 -0
- package/dist/lib/plugins/openapi/playground/IdentityDialog.js.map +1 -0
- package/dist/lib/plugins/openapi/playground/IdentitySelector.d.ts +7 -0
- package/dist/lib/plugins/openapi/playground/IdentitySelector.js +10 -0
- package/dist/lib/plugins/openapi/playground/IdentitySelector.js.map +1 -0
- package/dist/lib/plugins/openapi/playground/Playground.d.ts +9 -1
- package/dist/lib/plugins/openapi/playground/Playground.js +75 -24
- package/dist/lib/plugins/openapi/playground/Playground.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/QueryParams.js +1 -1
- package/dist/lib/plugins/openapi/playground/QueryParams.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/RequestLoginDialog.d.ts +7 -0
- package/dist/lib/plugins/openapi/playground/RequestLoginDialog.js +8 -0
- package/dist/lib/plugins/openapi/playground/RequestLoginDialog.js.map +1 -0
- package/dist/lib/plugins/openapi/playground/rememberedIdentity.d.ts +17 -0
- package/dist/lib/plugins/openapi/playground/rememberedIdentity.js +11 -0
- package/dist/lib/plugins/openapi/playground/rememberedIdentity.js.map +1 -0
- package/dist/lib/plugins/openapi/playground/result-panel/ResponseTab.js +19 -13
- package/dist/lib/plugins/openapi/playground/result-panel/ResponseTab.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/result-panel/ResultPanel.d.ts +6 -4
- package/dist/lib/plugins/openapi/playground/result-panel/ResultPanel.js +4 -3
- package/dist/lib/plugins/openapi/playground/result-panel/ResultPanel.js.map +1 -1
- package/dist/lib/ui/Checkbox.d.ts +2 -8
- package/dist/lib/ui/Checkbox.js +1 -13
- package/dist/lib/ui/Checkbox.js.map +1 -1
- package/dist/lib/ui/Command.d.ts +6 -6
- package/dist/lib/ui/Select.js +1 -1
- package/dist/lib/ui/Select.js.map +1 -1
- package/dist/lib/ui/SyntaxHighlight.d.ts +2 -1
- package/dist/lib/ui/SyntaxHighlight.js +19 -15
- package/dist/lib/ui/SyntaxHighlight.js.map +1 -1
- package/dist/lib/util/MdxComponents.d.ts +1 -1
- package/dist/lib/util/MdxComponents.js +2 -2
- package/dist/lib/util/MdxComponents.js.map +1 -1
- package/lib/{AuthenticationPlugin-BCYuduZ9.js → AuthenticationPlugin-4ip08maU.js} +3 -3
- package/lib/{AuthenticationPlugin-BCYuduZ9.js.map → AuthenticationPlugin-4ip08maU.js.map} +1 -1
- package/lib/Callout-B_sEhkYd.js +211 -0
- package/lib/Callout-B_sEhkYd.js.map +1 -0
- package/lib/{Dialog-mi6BrnrM.js → Dialog-sbgekbjb.js} +48 -33
- package/lib/{Dialog-mi6BrnrM.js.map → Dialog-sbgekbjb.js.map} +1 -1
- package/lib/{Markdown-DofXBcqg.js → Markdown-DZXjQjpH.js} +4099 -3848
- package/lib/Markdown-DZXjQjpH.js.map +1 -0
- package/lib/{MdxPage-KJcNWIgt.js → MdxPage-52vRwa_7.js} +13 -13
- package/lib/{MdxPage-KJcNWIgt.js.map → MdxPage-52vRwa_7.js.map} +1 -1
- package/lib/{OasProvider-HcqBeC4H.js → OasProvider-CR2nG1Eg.js} +4 -4
- package/lib/{OasProvider-HcqBeC4H.js.map → OasProvider-CR2nG1Eg.js.map} +1 -1
- package/lib/{OperationList-C3wnbFxp.js → OperationList-DndcCJUG.js} +1097 -1052
- package/lib/{OperationList-C3wnbFxp.js.map → OperationList-DndcCJUG.js.map} +1 -1
- package/lib/{Select-Co6MuS4j.js → Select-FAYHOYTy.js} +35 -35
- package/lib/{Select-Co6MuS4j.js.map → Select-FAYHOYTy.js.map} +1 -1
- package/lib/{SlotletProvider-CYFNHuok.js → SlotletProvider-TydSHROc.js} +4 -4
- package/lib/{SlotletProvider-CYFNHuok.js.map → SlotletProvider-TydSHROc.js.map} +1 -1
- package/lib/{chunk-IR6S3I6Y-CRDBmIgK.js → chunk-HA7DTUK3-ZGg2W6yV.js} +276 -276
- package/lib/chunk-HA7DTUK3-ZGg2W6yV.js.map +1 -0
- package/lib/{hook-LTe5qHSc.js → hook-CfCFKZ-2.js} +10 -7
- package/lib/{hook-LTe5qHSc.js.map → hook-CfCFKZ-2.js.map} +1 -1
- package/lib/index-DK7IuUyR.js +2201 -0
- package/lib/index-DK7IuUyR.js.map +1 -0
- package/lib/index.esm-CltAN0Tf.js +711 -0
- package/lib/index.esm-CltAN0Tf.js.map +1 -0
- package/lib/objectEntries-BS7aAgOm.js +12 -0
- package/lib/objectEntries-BS7aAgOm.js.map +1 -0
- package/lib/ui/Checkbox.js +15 -25
- package/lib/ui/Checkbox.js.map +1 -1
- package/lib/ui/Command.js +1 -1
- package/lib/ui/Select.js +1 -1
- package/lib/ui/Select.js.map +1 -1
- package/lib/ui/SyntaxHighlight.js +483 -502
- package/lib/ui/SyntaxHighlight.js.map +1 -1
- package/lib/{useExposedProps-D76yras4.js → useExposedProps-BslIn-FE.js} +2 -2
- package/lib/{useExposedProps-D76yras4.js.map → useExposedProps-BslIn-FE.js.map} +1 -1
- package/lib/zudoku.auth-auth0.js +1 -1
- package/lib/zudoku.auth-clerk.js +2 -2
- package/lib/zudoku.auth-openid.js +3 -3
- package/lib/zudoku.components.js +1390 -32
- package/lib/zudoku.components.js.map +1 -1
- package/lib/zudoku.hooks.js +1 -1
- package/lib/zudoku.plugin-api-catalog.js +5 -5
- package/lib/zudoku.plugin-api-keys.js +4 -4
- package/lib/zudoku.plugin-custom-pages.js +2 -2
- package/lib/zudoku.plugin-markdown.js +1 -1
- package/lib/zudoku.plugin-openapi.js +3 -3
- package/lib/zudoku.plugin-redirect.js +1 -1
- package/lib/zudoku.plugin-search-pagefind.js +84 -154
- package/lib/zudoku.plugin-search-pagefind.js.map +1 -1
- package/package.json +3 -3
- package/src/lib/components/AnchorLink.tsx +7 -7
- package/src/lib/components/navigation/SidebarItem.tsx +8 -23
- package/src/lib/core/ZudokuContext.ts +4 -0
- package/src/lib/plugins/openapi/OperationList.tsx +73 -33
- package/src/lib/plugins/openapi/OperationListItem.tsx +105 -92
- package/src/lib/plugins/openapi/graphql/gql.ts +3 -3
- package/src/lib/plugins/openapi/graphql/graphql.ts +3 -0
- package/src/lib/plugins/openapi/playground/ExamplesDropdown.tsx +30 -32
- package/src/lib/plugins/openapi/playground/Headers.tsx +0 -1
- package/src/lib/plugins/openapi/playground/IdentityDialog.tsx +74 -0
- package/src/lib/plugins/openapi/playground/IdentitySelector.tsx +54 -0
- package/src/lib/plugins/openapi/playground/Playground.tsx +164 -133
- package/src/lib/plugins/openapi/playground/QueryParams.tsx +0 -1
- package/src/lib/plugins/openapi/playground/RequestLoginDialog.tsx +51 -0
- package/src/lib/plugins/openapi/playground/rememberedIdentity.ts +26 -0
- package/src/lib/plugins/openapi/playground/result-panel/ResponseTab.tsx +24 -4
- package/src/lib/plugins/openapi/playground/result-panel/ResultPanel.tsx +66 -45
- package/src/lib/ui/Checkbox.tsx +8 -24
- package/src/lib/ui/Select.tsx +1 -1
- package/src/lib/ui/SyntaxHighlight.tsx +94 -96
- package/src/lib/util/MdxComponents.tsx +2 -2
- package/lib/Command-CrTA1FX0.js +0 -140
- package/lib/Command-CrTA1FX0.js.map +0 -1
- package/lib/Markdown-DofXBcqg.js.map +0 -1
- package/lib/chunk-IR6S3I6Y-CRDBmIgK.js.map +0 -1
- package/lib/index-CtkRMvMw.js +0 -2052
- package/lib/index-CtkRMvMw.js.map +0 -1
- package/lib/index-vn5bsvmU.js +0 -1399
- package/lib/index-vn5bsvmU.js.map +0 -1
- package/lib/useScrollToAnchor-DKyrbZoy.js +0 -977
- package/lib/useScrollToAnchor-DKyrbZoy.js.map +0 -1
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { type ResultOf } from "@graphql-typed-document-node/core";
|
|
2
2
|
import { useSuspenseQuery } from "@tanstack/react-query";
|
|
3
3
|
import { Helmet } from "@zudoku/react-helmet-async";
|
|
4
|
+
import { ChevronsDownUpIcon, ChevronsUpDownIcon } from "lucide-react";
|
|
4
5
|
import { useNavigate } from "react-router";
|
|
6
|
+
import {
|
|
7
|
+
Collapsible,
|
|
8
|
+
CollapsibleContent,
|
|
9
|
+
CollapsibleTrigger,
|
|
10
|
+
} from "zudoku/ui/Collapsible.js";
|
|
5
11
|
import {
|
|
6
12
|
Select,
|
|
7
13
|
SelectContent,
|
|
@@ -31,6 +37,7 @@ export const OperationsFragment = graphql(/* GraphQL */ `
|
|
|
31
37
|
operationId
|
|
32
38
|
contentTypes
|
|
33
39
|
path
|
|
40
|
+
deprecated
|
|
34
41
|
parameters {
|
|
35
42
|
name
|
|
36
43
|
in
|
|
@@ -166,43 +173,76 @@ export const OperationList = ({
|
|
|
166
173
|
<meta name="description" content={metaDescription} />
|
|
167
174
|
)}
|
|
168
175
|
</Helmet>
|
|
169
|
-
<div
|
|
170
|
-
className=
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
176
|
+
<div className="mb-8">
|
|
177
|
+
<Collapsible className="w-full">
|
|
178
|
+
<div className="flex flex-col gap-y-4 sm:flex-row justify-around items-start sm:items-end">
|
|
179
|
+
<div className="flex-1">
|
|
180
|
+
<CategoryHeading>{title}</CategoryHeading>
|
|
181
|
+
<Heading
|
|
182
|
+
level={1}
|
|
183
|
+
id="description"
|
|
184
|
+
registerSidebarAnchor
|
|
185
|
+
className="mb-0"
|
|
186
|
+
>
|
|
187
|
+
{tag}
|
|
188
|
+
{showVersions && (
|
|
189
|
+
<span className="text-xl text-muted-foreground ml-1.5">
|
|
190
|
+
{" "}
|
|
191
|
+
({version})
|
|
192
|
+
</span>
|
|
193
|
+
)}
|
|
194
|
+
</Heading>
|
|
195
|
+
</div>
|
|
196
|
+
<div className="flex flex-col gap-4 sm:items-end">
|
|
177
197
|
{showVersions && (
|
|
178
|
-
<
|
|
179
|
-
{
|
|
180
|
-
|
|
181
|
-
|
|
198
|
+
<Select
|
|
199
|
+
onValueChange={(version) => navigate(versions[version]!)}
|
|
200
|
+
defaultValue={version}
|
|
201
|
+
>
|
|
202
|
+
<SelectTrigger className="w-[180px]">
|
|
203
|
+
<SelectValue placeholder="Select version" />
|
|
204
|
+
</SelectTrigger>
|
|
205
|
+
<SelectContent>
|
|
206
|
+
{Object.entries(versions).map(([version]) => (
|
|
207
|
+
<SelectItem key={version} value={version}>
|
|
208
|
+
{version}
|
|
209
|
+
</SelectItem>
|
|
210
|
+
))}
|
|
211
|
+
</SelectContent>
|
|
212
|
+
</Select>
|
|
213
|
+
)}
|
|
214
|
+
{schema.description && (
|
|
215
|
+
<CollapsibleTrigger className="flex items-center gap-1 text-sm font-medium text-muted-foreground group">
|
|
216
|
+
<span>Schema description</span>
|
|
217
|
+
|
|
218
|
+
<ChevronsUpDownIcon
|
|
219
|
+
className="group-data-[state=open]:hidden translate-y-px"
|
|
220
|
+
size={14}
|
|
221
|
+
/>
|
|
222
|
+
<ChevronsDownUpIcon
|
|
223
|
+
className="group-data-[state=closed]:hidden translate-y-px"
|
|
224
|
+
size={13}
|
|
225
|
+
/>
|
|
226
|
+
</CollapsibleTrigger>
|
|
182
227
|
)}
|
|
183
|
-
</
|
|
228
|
+
</div>
|
|
184
229
|
</div>
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
<
|
|
188
|
-
|
|
189
|
-
|
|
230
|
+
{schema.description && (
|
|
231
|
+
<CollapsibleContent className="CollapsibleContent">
|
|
232
|
+
<div
|
|
233
|
+
className={cn(
|
|
234
|
+
ProseClasses,
|
|
235
|
+
"pt-4 max-w-full prose-img:max-w-prose",
|
|
236
|
+
)}
|
|
190
237
|
>
|
|
191
|
-
<
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
))}
|
|
200
|
-
</SelectContent>
|
|
201
|
-
</Select>
|
|
202
|
-
)}
|
|
203
|
-
</div>
|
|
204
|
-
</div>
|
|
205
|
-
<Markdown content={schema.description ?? ""} />
|
|
238
|
+
<Markdown
|
|
239
|
+
className="border rounded bg-muted/25 border-border px-2.5 md:px-4"
|
|
240
|
+
content={schema.description}
|
|
241
|
+
/>
|
|
242
|
+
</div>
|
|
243
|
+
</CollapsibleContent>
|
|
244
|
+
)}
|
|
245
|
+
</Collapsible>
|
|
206
246
|
</div>
|
|
207
247
|
<hr />
|
|
208
248
|
<div className="my-4 flex items-center justify-end gap-4">
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { VisuallyHidden } from "@radix-ui/react-visually-hidden";
|
|
2
2
|
import { useRef, useState } from "react";
|
|
3
|
+
import { Badge } from "zudoku/ui/Badge.js";
|
|
3
4
|
import { Heading } from "../../components/Heading.js";
|
|
4
5
|
import { Markdown, ProseClasses } from "../../components/Markdown.js";
|
|
5
6
|
import { Tabs, TabsContent, TabsList, TabsTrigger } from "../../ui/Tabs.js";
|
|
7
|
+
import { cn } from "../../util/cn.js";
|
|
6
8
|
import { groupBy } from "../../util/groupBy.js";
|
|
7
9
|
import { renderIf } from "../../util/renderIf.js";
|
|
8
10
|
import { OperationsFragment } from "./OperationList.js";
|
|
9
11
|
import { ParameterList } from "./ParameterList.js";
|
|
10
12
|
import { Sidecar } from "./Sidecar.js";
|
|
11
|
-
import { FragmentType, useFragment } from "./graphql/index.js";
|
|
13
|
+
import { type FragmentType, useFragment } from "./graphql/index.js";
|
|
12
14
|
import { SchemaView } from "./schema/SchemaView.js";
|
|
13
15
|
import { methodForColor } from "./util/methodToColor.js";
|
|
14
16
|
|
|
@@ -33,11 +35,19 @@ export const OperationListItem = ({
|
|
|
33
35
|
const [selectedResponse, setSelectedResponse] = useState(first?.statusCode);
|
|
34
36
|
|
|
35
37
|
return (
|
|
36
|
-
<div
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
<div className="border-b-2 mb-16 pb-16">
|
|
39
|
+
{operation.deprecated && (
|
|
40
|
+
<Badge variant="muted" className="text-xs mb-4">
|
|
41
|
+
deprecated
|
|
42
|
+
</Badge>
|
|
43
|
+
)}
|
|
44
|
+
<div
|
|
45
|
+
key={operation.operationId}
|
|
46
|
+
className={cn(
|
|
47
|
+
"grid grid-cols-1 lg:grid-cols-[minmax(0,4fr)_minmax(0,3fr)] gap-x-8 gap-y-4 items-start",
|
|
48
|
+
operation.deprecated && "opacity-50 transition hover:opacity-100",
|
|
49
|
+
)}
|
|
50
|
+
>
|
|
41
51
|
<Heading
|
|
42
52
|
level={2}
|
|
43
53
|
id={operation.slug}
|
|
@@ -46,7 +56,7 @@ export const OperationListItem = ({
|
|
|
46
56
|
>
|
|
47
57
|
{operation.summary}
|
|
48
58
|
</Heading>
|
|
49
|
-
<div className="text-sm flex gap-2 font-mono">
|
|
59
|
+
<div className="text-sm flex gap-2 font-mono col-span-full">
|
|
50
60
|
<span className={methodForColor(operation.method)}>
|
|
51
61
|
{operation.method.toUpperCase()}
|
|
52
62
|
</span>
|
|
@@ -73,98 +83,101 @@ export const OperationListItem = ({
|
|
|
73
83
|
</div>
|
|
74
84
|
</div>
|
|
75
85
|
</div>
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
)}
|
|
99
|
-
{renderIf(operation.requestBody?.content?.at(0)?.schema, (schema) => (
|
|
100
|
-
<div className="mt-4 flex flex-col gap-4">
|
|
101
|
-
<Heading
|
|
102
|
-
level={3}
|
|
103
|
-
className="capitalize"
|
|
104
|
-
id={`${operation.slug}/request-body`}
|
|
105
|
-
>
|
|
106
|
-
{operation.summary && (
|
|
107
|
-
<VisuallyHidden>{operation.summary} › </VisuallyHidden>
|
|
108
|
-
)}
|
|
109
|
-
Request Body
|
|
110
|
-
</Heading>
|
|
111
|
-
<SchemaView schema={schema} />
|
|
112
|
-
</div>
|
|
113
|
-
))}
|
|
114
|
-
{operation.responses.length > 0 && (
|
|
115
|
-
<>
|
|
116
|
-
<Heading
|
|
117
|
-
level={3}
|
|
118
|
-
className="capitalize mt-8 pt-8 border-t"
|
|
119
|
-
id={`${operation.slug}/responses`}
|
|
120
|
-
>
|
|
121
|
-
{operation.summary && (
|
|
122
|
-
<VisuallyHidden>{operation.summary} › </VisuallyHidden>
|
|
86
|
+
|
|
87
|
+
<div className="flex flex-col gap-4">
|
|
88
|
+
{operation.description && (
|
|
89
|
+
<Markdown
|
|
90
|
+
className={`${ProseClasses} max-w-full prose-img:max-w-prose`}
|
|
91
|
+
content={operation.description}
|
|
92
|
+
/>
|
|
93
|
+
)}
|
|
94
|
+
{operation.parameters && operation.parameters.length > 0 && (
|
|
95
|
+
<>
|
|
96
|
+
{PARAM_GROUPS.flatMap((group) =>
|
|
97
|
+
groupedParameters[group]?.length ? (
|
|
98
|
+
<ParameterList
|
|
99
|
+
key={group}
|
|
100
|
+
summary={operation.summary ?? undefined}
|
|
101
|
+
id={operation.slug}
|
|
102
|
+
parameters={groupedParameters[group]}
|
|
103
|
+
group={group}
|
|
104
|
+
/>
|
|
105
|
+
) : (
|
|
106
|
+
[]
|
|
107
|
+
),
|
|
123
108
|
)}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
109
|
+
</>
|
|
110
|
+
)}
|
|
111
|
+
{renderIf(operation.requestBody?.content?.at(0)?.schema, (schema) => (
|
|
112
|
+
<div className="mt-4 flex flex-col gap-4">
|
|
113
|
+
<Heading
|
|
114
|
+
level={3}
|
|
115
|
+
className="capitalize"
|
|
116
|
+
id={`${operation.slug}/request-body`}
|
|
117
|
+
>
|
|
118
|
+
{operation.summary && (
|
|
119
|
+
<VisuallyHidden>{operation.summary} › </VisuallyHidden>
|
|
120
|
+
)}
|
|
121
|
+
Request Body
|
|
122
|
+
</Heading>
|
|
123
|
+
<SchemaView schema={schema} />
|
|
124
|
+
</div>
|
|
125
|
+
))}
|
|
126
|
+
{operation.responses.length > 0 && (
|
|
127
|
+
<>
|
|
128
|
+
<Heading
|
|
129
|
+
level={3}
|
|
130
|
+
className="capitalize mt-8 pt-8 border-t"
|
|
131
|
+
id={`${operation.slug}/responses`}
|
|
132
|
+
>
|
|
133
|
+
{operation.summary && (
|
|
134
|
+
<VisuallyHidden>{operation.summary} › </VisuallyHidden>
|
|
135
|
+
)}
|
|
136
|
+
Responses
|
|
137
|
+
</Heading>
|
|
138
|
+
<Tabs
|
|
139
|
+
onValueChange={(value) => setSelectedResponse(value)}
|
|
140
|
+
value={selectedResponse}
|
|
141
|
+
>
|
|
142
|
+
{operation.responses.length > 1 && (
|
|
143
|
+
<TabsList>
|
|
144
|
+
{operation.responses.map((response) => (
|
|
145
|
+
<TabsTrigger
|
|
146
|
+
value={response.statusCode}
|
|
147
|
+
key={response.statusCode}
|
|
148
|
+
title={response.description ?? undefined}
|
|
149
|
+
>
|
|
150
|
+
{response.statusCode}
|
|
151
|
+
</TabsTrigger>
|
|
152
|
+
))}
|
|
153
|
+
</TabsList>
|
|
154
|
+
)}
|
|
155
|
+
<ul className="list-none m-0 px-0">
|
|
132
156
|
{operation.responses.map((response) => (
|
|
133
|
-
<
|
|
157
|
+
<TabsContent
|
|
134
158
|
value={response.statusCode}
|
|
135
159
|
key={response.statusCode}
|
|
136
|
-
title={response.description ?? undefined}
|
|
137
160
|
>
|
|
138
|
-
|
|
139
|
-
|
|
161
|
+
<SchemaView
|
|
162
|
+
schema={
|
|
163
|
+
response.content?.find((content) => content.schema)
|
|
164
|
+
?.schema
|
|
165
|
+
}
|
|
166
|
+
/>
|
|
167
|
+
</TabsContent>
|
|
140
168
|
))}
|
|
141
|
-
</
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
value={response.statusCode}
|
|
147
|
-
key={response.statusCode}
|
|
148
|
-
>
|
|
149
|
-
<SchemaView
|
|
150
|
-
schema={
|
|
151
|
-
response.content?.find((content) => content.schema)
|
|
152
|
-
?.schema
|
|
153
|
-
}
|
|
154
|
-
/>
|
|
155
|
-
</TabsContent>
|
|
156
|
-
))}
|
|
157
|
-
</ul>
|
|
158
|
-
</Tabs>
|
|
159
|
-
</>
|
|
160
|
-
)}
|
|
161
|
-
</div>
|
|
169
|
+
</ul>
|
|
170
|
+
</Tabs>
|
|
171
|
+
</>
|
|
172
|
+
)}
|
|
173
|
+
</div>
|
|
162
174
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
175
|
+
<Sidecar
|
|
176
|
+
selectedResponse={selectedResponse}
|
|
177
|
+
onSelectResponse={setSelectedResponse}
|
|
178
|
+
operation={operation}
|
|
179
|
+
/>
|
|
180
|
+
</div>
|
|
168
181
|
</div>
|
|
169
182
|
);
|
|
170
183
|
};
|
|
@@ -14,7 +14,7 @@ import * as types from "./graphql.js";
|
|
|
14
14
|
*/
|
|
15
15
|
type Documents = {
|
|
16
16
|
"\n query ServersQuery($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n url\n servers {\n url\n }\n }\n }\n": typeof types.ServersQueryDocument;
|
|
17
|
-
"\n fragment OperationsFragment on OperationItem {\n slug\n summary\n method\n description\n operationId\n contentTypes\n path\n parameters {\n name\n in\n description\n required\n schema\n style\n examples {\n name\n description\n externalValue\n value\n summary\n }\n }\n requestBody {\n content {\n mediaType\n encoding {\n name\n }\n examples {\n name\n description\n externalValue\n value\n summary\n }\n schema\n }\n description\n required\n }\n responses {\n statusCode\n links\n description\n content {\n examples {\n name\n description\n externalValue\n value\n summary\n }\n mediaType\n encoding {\n name\n }\n schema\n }\n }\n }\n": typeof types.OperationsFragmentFragmentDoc;
|
|
17
|
+
"\n fragment OperationsFragment on OperationItem {\n slug\n summary\n method\n description\n operationId\n contentTypes\n path\n deprecated\n parameters {\n name\n in\n description\n required\n schema\n style\n examples {\n name\n description\n externalValue\n value\n summary\n }\n }\n requestBody {\n content {\n mediaType\n encoding {\n name\n }\n examples {\n name\n description\n externalValue\n value\n summary\n }\n schema\n }\n description\n required\n }\n responses {\n statusCode\n links\n description\n content {\n examples {\n name\n description\n externalValue\n value\n summary\n }\n mediaType\n encoding {\n name\n }\n schema\n }\n }\n }\n": typeof types.OperationsFragmentFragmentDoc;
|
|
18
18
|
"\n query AllOperations(\n $input: JSON!\n $type: SchemaType!\n $tag: String\n $untagged: Boolean\n ) {\n schema(input: $input, type: $type) {\n servers {\n url\n }\n description\n summary\n title\n url\n version\n tags(name: $tag) {\n name\n description\n }\n operations(tag: $tag, untagged: $untagged) {\n slug\n ...OperationsFragment\n }\n }\n }\n": typeof types.AllOperationsDocument;
|
|
19
19
|
"\n query getServerQuery($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n url\n servers {\n url\n }\n }\n }\n": typeof types.GetServerQueryDocument;
|
|
20
20
|
"\n query GetCategories($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n url\n tags {\n name\n }\n }\n }\n": typeof types.GetCategoriesDocument;
|
|
@@ -23,7 +23,7 @@ type Documents = {
|
|
|
23
23
|
const documents: Documents = {
|
|
24
24
|
"\n query ServersQuery($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n url\n servers {\n url\n }\n }\n }\n":
|
|
25
25
|
types.ServersQueryDocument,
|
|
26
|
-
"\n fragment OperationsFragment on OperationItem {\n slug\n summary\n method\n description\n operationId\n contentTypes\n path\n parameters {\n name\n in\n description\n required\n schema\n style\n examples {\n name\n description\n externalValue\n value\n summary\n }\n }\n requestBody {\n content {\n mediaType\n encoding {\n name\n }\n examples {\n name\n description\n externalValue\n value\n summary\n }\n schema\n }\n description\n required\n }\n responses {\n statusCode\n links\n description\n content {\n examples {\n name\n description\n externalValue\n value\n summary\n }\n mediaType\n encoding {\n name\n }\n schema\n }\n }\n }\n":
|
|
26
|
+
"\n fragment OperationsFragment on OperationItem {\n slug\n summary\n method\n description\n operationId\n contentTypes\n path\n deprecated\n parameters {\n name\n in\n description\n required\n schema\n style\n examples {\n name\n description\n externalValue\n value\n summary\n }\n }\n requestBody {\n content {\n mediaType\n encoding {\n name\n }\n examples {\n name\n description\n externalValue\n value\n summary\n }\n schema\n }\n description\n required\n }\n responses {\n statusCode\n links\n description\n content {\n examples {\n name\n description\n externalValue\n value\n summary\n }\n mediaType\n encoding {\n name\n }\n schema\n }\n }\n }\n":
|
|
27
27
|
types.OperationsFragmentFragmentDoc,
|
|
28
28
|
"\n query AllOperations(\n $input: JSON!\n $type: SchemaType!\n $tag: String\n $untagged: Boolean\n ) {\n schema(input: $input, type: $type) {\n servers {\n url\n }\n description\n summary\n title\n url\n version\n tags(name: $tag) {\n name\n description\n }\n operations(tag: $tag, untagged: $untagged) {\n slug\n ...OperationsFragment\n }\n }\n }\n":
|
|
29
29
|
types.AllOperationsDocument,
|
|
@@ -45,7 +45,7 @@ export function graphql(
|
|
|
45
45
|
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
46
46
|
*/
|
|
47
47
|
export function graphql(
|
|
48
|
-
source: "\n fragment OperationsFragment on OperationItem {\n slug\n summary\n method\n description\n operationId\n contentTypes\n path\n parameters {\n name\n in\n description\n required\n schema\n style\n examples {\n name\n description\n externalValue\n value\n summary\n }\n }\n requestBody {\n content {\n mediaType\n encoding {\n name\n }\n examples {\n name\n description\n externalValue\n value\n summary\n }\n schema\n }\n description\n required\n }\n responses {\n statusCode\n links\n description\n content {\n examples {\n name\n description\n externalValue\n value\n summary\n }\n mediaType\n encoding {\n name\n }\n schema\n }\n }\n }\n",
|
|
48
|
+
source: "\n fragment OperationsFragment on OperationItem {\n slug\n summary\n method\n description\n operationId\n contentTypes\n path\n deprecated\n parameters {\n name\n in\n description\n required\n schema\n style\n examples {\n name\n description\n externalValue\n value\n summary\n }\n }\n requestBody {\n content {\n mediaType\n encoding {\n name\n }\n examples {\n name\n description\n externalValue\n value\n summary\n }\n schema\n }\n description\n required\n }\n responses {\n statusCode\n links\n description\n content {\n examples {\n name\n description\n externalValue\n value\n summary\n }\n mediaType\n encoding {\n name\n }\n schema\n }\n }\n }\n",
|
|
49
49
|
): typeof import("./graphql.js").OperationsFragmentFragmentDoc;
|
|
50
50
|
/**
|
|
51
51
|
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
@@ -197,6 +197,7 @@ export type OperationsFragmentFragment = {
|
|
|
197
197
|
operationId?: string | null;
|
|
198
198
|
contentTypes: Array<string>;
|
|
199
199
|
path: string;
|
|
200
|
+
deprecated?: boolean | null;
|
|
200
201
|
parameters?: Array<{
|
|
201
202
|
__typename?: "ParameterItem";
|
|
202
203
|
name: string;
|
|
@@ -374,6 +375,7 @@ export const OperationsFragmentFragmentDoc = new TypedDocumentString(
|
|
|
374
375
|
operationId
|
|
375
376
|
contentTypes
|
|
376
377
|
path
|
|
378
|
+
deprecated
|
|
377
379
|
parameters {
|
|
378
380
|
name
|
|
379
381
|
in
|
|
@@ -472,6 +474,7 @@ export const AllOperationsDocument = new TypedDocumentString(`
|
|
|
472
474
|
operationId
|
|
473
475
|
contentTypes
|
|
474
476
|
path
|
|
477
|
+
deprecated
|
|
475
478
|
parameters {
|
|
476
479
|
name
|
|
477
480
|
in
|
|
@@ -8,46 +8,44 @@ import {
|
|
|
8
8
|
DropdownMenuSeparator,
|
|
9
9
|
DropdownMenuTrigger,
|
|
10
10
|
} from "zudoku/ui/DropdownMenu.js";
|
|
11
|
-
import { Content, Example } from "../SidecarExamples.js";
|
|
11
|
+
import type { Content, Example } from "../SidecarExamples.js";
|
|
12
12
|
|
|
13
13
|
const ExamplesDropdown = ({
|
|
14
14
|
examples,
|
|
15
15
|
onSelect,
|
|
16
16
|
}: {
|
|
17
17
|
examples: Content;
|
|
18
|
-
onSelect: (example: Example) => void;
|
|
18
|
+
onSelect: (example: Example, mediaType: string) => void;
|
|
19
19
|
}) => {
|
|
20
20
|
return (
|
|
21
|
-
<
|
|
22
|
-
<
|
|
23
|
-
<
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
{
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
<
|
|
33
|
-
{example.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
</DropdownMenu>
|
|
50
|
-
</div>
|
|
21
|
+
<DropdownMenu>
|
|
22
|
+
<DropdownMenuTrigger asChild>
|
|
23
|
+
<Button variant="outline">Use Example</Button>
|
|
24
|
+
</DropdownMenuTrigger>
|
|
25
|
+
<DropdownMenuContent className="max-w-72">
|
|
26
|
+
{examples.map((mediaTypeObject) => (
|
|
27
|
+
<div key={mediaTypeObject.mediaType}>
|
|
28
|
+
<DropdownMenuLabel>{mediaTypeObject.mediaType}</DropdownMenuLabel>
|
|
29
|
+
<DropdownMenuSeparator />
|
|
30
|
+
<DropdownMenuGroup>
|
|
31
|
+
{mediaTypeObject.examples?.map((example) => (
|
|
32
|
+
<DropdownMenuItem
|
|
33
|
+
key={example.name}
|
|
34
|
+
onSelect={() => onSelect(example, mediaTypeObject.mediaType)}
|
|
35
|
+
>
|
|
36
|
+
<span
|
|
37
|
+
className="line-clamp-1"
|
|
38
|
+
title={example.summary ?? example.name}
|
|
39
|
+
>
|
|
40
|
+
{example.summary ?? example.name}
|
|
41
|
+
</span>
|
|
42
|
+
</DropdownMenuItem>
|
|
43
|
+
))}
|
|
44
|
+
</DropdownMenuGroup>
|
|
45
|
+
</div>
|
|
46
|
+
))}
|
|
47
|
+
</DropdownMenuContent>
|
|
48
|
+
</DropdownMenu>
|
|
51
49
|
);
|
|
52
50
|
};
|
|
53
51
|
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { Button } from "zudoku/ui/Button.js";
|
|
3
|
+
import { Checkbox } from "zudoku/ui/Checkbox.js";
|
|
4
|
+
import {
|
|
5
|
+
Dialog,
|
|
6
|
+
DialogContent,
|
|
7
|
+
DialogDescription,
|
|
8
|
+
DialogFooter,
|
|
9
|
+
DialogTitle,
|
|
10
|
+
} from "zudoku/ui/Dialog.js";
|
|
11
|
+
import { Label } from "zudoku/ui/Label.js";
|
|
12
|
+
import { type ApiIdentity } from "../../../core/ZudokuContext.js";
|
|
13
|
+
import IdentitySelector from "./IdentitySelector.js";
|
|
14
|
+
|
|
15
|
+
const IdentityDialog = ({
|
|
16
|
+
onSubmit,
|
|
17
|
+
identities,
|
|
18
|
+
open,
|
|
19
|
+
onOpenChange,
|
|
20
|
+
}: {
|
|
21
|
+
open: boolean;
|
|
22
|
+
onOpenChange: (open: boolean) => void;
|
|
23
|
+
onSubmit: ({
|
|
24
|
+
rememberedIdentity,
|
|
25
|
+
identity,
|
|
26
|
+
}: {
|
|
27
|
+
rememberedIdentity: boolean;
|
|
28
|
+
identity?: string;
|
|
29
|
+
}) => void;
|
|
30
|
+
identities: ApiIdentity[];
|
|
31
|
+
}) => {
|
|
32
|
+
const [identity, setIdentity] = useState<string | undefined>(undefined);
|
|
33
|
+
const [rememberedIdentity, setRememberedIdentity] = useState<boolean>(false);
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<Dialog open={open} onOpenChange={onOpenChange}>
|
|
37
|
+
<DialogContent>
|
|
38
|
+
<DialogTitle>Select an auth identity</DialogTitle>
|
|
39
|
+
<DialogDescription>
|
|
40
|
+
Please select an identity for this request.
|
|
41
|
+
</DialogDescription>
|
|
42
|
+
<div className="max-h-80 overflow-auto">
|
|
43
|
+
<IdentitySelector
|
|
44
|
+
identities={identities}
|
|
45
|
+
setValue={setIdentity}
|
|
46
|
+
value={identity}
|
|
47
|
+
/>
|
|
48
|
+
</div>
|
|
49
|
+
<DialogFooter className="flex flex-col gap-2">
|
|
50
|
+
<div className="flex items-center gap-2">
|
|
51
|
+
<Checkbox
|
|
52
|
+
id="remember"
|
|
53
|
+
checked={rememberedIdentity}
|
|
54
|
+
onCheckedChange={(checked) =>
|
|
55
|
+
setRememberedIdentity(
|
|
56
|
+
checked === "indeterminate" ? false : !!checked,
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
/>
|
|
60
|
+
<Label htmlFor="remember">Remember my choice</Label>
|
|
61
|
+
</div>
|
|
62
|
+
|
|
63
|
+
<Button
|
|
64
|
+
onClick={() => onSubmit({ identity: identity, rememberedIdentity })}
|
|
65
|
+
>
|
|
66
|
+
Send
|
|
67
|
+
</Button>
|
|
68
|
+
</DialogFooter>
|
|
69
|
+
</DialogContent>
|
|
70
|
+
</Dialog>
|
|
71
|
+
);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export { IdentityDialog };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Card } from "zudoku/ui/Card.js";
|
|
2
|
+
import { Label } from "zudoku/ui/Label.js";
|
|
3
|
+
import { RadioGroup, RadioGroupItem } from "zudoku/ui/RadioGroup.js";
|
|
4
|
+
import { type ApiIdentity } from "../../../core/ZudokuContext.js";
|
|
5
|
+
import { NO_IDENTITY } from "./Playground.js";
|
|
6
|
+
|
|
7
|
+
const IdentitySelector = ({
|
|
8
|
+
identities,
|
|
9
|
+
setValue,
|
|
10
|
+
value,
|
|
11
|
+
}: {
|
|
12
|
+
identities?: ApiIdentity[];
|
|
13
|
+
setValue: (value: string) => void;
|
|
14
|
+
value?: string;
|
|
15
|
+
}) => {
|
|
16
|
+
return (
|
|
17
|
+
<Card className="w-full overflow-hidden">
|
|
18
|
+
<RadioGroup
|
|
19
|
+
onValueChange={(value) => setValue(value)}
|
|
20
|
+
value={value}
|
|
21
|
+
defaultValue={NO_IDENTITY}
|
|
22
|
+
className="gap-0"
|
|
23
|
+
disabled={identities?.length === 0}
|
|
24
|
+
>
|
|
25
|
+
<Label
|
|
26
|
+
className="h-12 border-b items-center flex p-4 cursor-pointer hover:bg-accent"
|
|
27
|
+
htmlFor="none"
|
|
28
|
+
>
|
|
29
|
+
<RadioGroupItem value={NO_IDENTITY} id="none">
|
|
30
|
+
None
|
|
31
|
+
</RadioGroupItem>
|
|
32
|
+
<Label htmlFor="none" className="ml-2">
|
|
33
|
+
None
|
|
34
|
+
</Label>
|
|
35
|
+
</Label>
|
|
36
|
+
{identities?.map((identity) => (
|
|
37
|
+
<Label
|
|
38
|
+
key={identity.id}
|
|
39
|
+
className="h-12 border-b items-center flex p-4 cursor-pointer hover:bg-accent"
|
|
40
|
+
>
|
|
41
|
+
<RadioGroupItem value={identity.id} id={identity.id}>
|
|
42
|
+
{identity.label}
|
|
43
|
+
</RadioGroupItem>
|
|
44
|
+
<Label htmlFor={identity.id} className="ml-2">
|
|
45
|
+
{identity.label}
|
|
46
|
+
</Label>
|
|
47
|
+
</Label>
|
|
48
|
+
))}
|
|
49
|
+
</RadioGroup>
|
|
50
|
+
</Card>
|
|
51
|
+
);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export default IdentitySelector;
|