zudoku 0.34.4 → 0.35.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/dist/config/config.d.ts +13 -8
- package/dist/config/validators/common.d.ts +977 -111
- package/dist/config/validators/common.js +26 -1
- package/dist/config/validators/common.js.map +1 -1
- package/dist/config/validators/validate.d.ts +357 -42
- package/dist/lib/authentication/providers/clerk.d.ts +2 -2
- package/dist/lib/authentication/providers/supabase.d.ts +4 -0
- package/dist/lib/authentication/providers/supabase.js +112 -0
- package/dist/lib/authentication/providers/supabase.js.map +1 -0
- package/dist/lib/components/Header.js +3 -3
- package/dist/lib/components/Header.js.map +1 -1
- package/dist/lib/components/InlineCode.js +1 -1
- package/dist/lib/components/InlineCode.js.map +1 -1
- package/dist/lib/components/Layout.js +4 -10
- package/dist/lib/components/Layout.js.map +1 -1
- package/dist/lib/components/Main.d.ts +2 -0
- package/dist/lib/components/Main.js +15 -0
- package/dist/lib/components/Main.js.map +1 -0
- package/dist/lib/components/context/ViewportAnchorContext.d.ts +2 -4
- package/dist/lib/components/context/ViewportAnchorContext.js +2 -4
- package/dist/lib/components/context/ViewportAnchorContext.js.map +1 -1
- package/dist/lib/components/index.d.ts +2 -1
- package/dist/lib/components/navigation/Sidebar.d.ts +3 -1
- package/dist/lib/components/navigation/Sidebar.js +2 -4
- package/dist/lib/components/navigation/Sidebar.js.map +1 -1
- package/dist/lib/components/navigation/SidebarWrapper.d.ts +8 -6
- package/dist/lib/components/navigation/SidebarWrapper.js +1 -2
- package/dist/lib/components/navigation/SidebarWrapper.js.map +1 -1
- package/dist/lib/core/RouteGuard.js +2 -1
- package/dist/lib/core/RouteGuard.js.map +1 -1
- package/dist/lib/oas/graphql/index.js +34 -0
- package/dist/lib/oas/graphql/index.js.map +1 -1
- package/dist/lib/plugins/markdown/MdxPage.d.ts +1 -1
- package/dist/lib/plugins/markdown/MdxPage.js +1 -1
- package/dist/lib/plugins/markdown/MdxPage.js.map +1 -1
- package/dist/lib/plugins/openapi/OperationList.js +2 -1
- package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
- package/dist/lib/plugins/openapi/Sidecar.js +9 -4
- package/dist/lib/plugins/openapi/Sidecar.js.map +1 -1
- package/dist/lib/plugins/openapi/SimpleSelect.js +1 -1
- package/dist/lib/plugins/openapi/SimpleSelect.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 +6 -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/index.d.ts +1 -1
- package/dist/lib/plugins/openapi/index.js +8 -8
- package/dist/lib/plugins/openapi/index.js.map +1 -1
- package/dist/lib/plugins/openapi/interfaces.d.ts +7 -10
- package/dist/lib/ui/Callout.d.ts +2 -1
- package/dist/lib/ui/Callout.js +3 -2
- package/dist/lib/ui/Callout.js.map +1 -1
- package/dist/lib/util/MdxComponents.d.ts +2 -1
- package/dist/vite/plugin-api.js +5 -9
- package/dist/vite/plugin-api.js.map +1 -1
- package/lib/{Callout-B_sEhkYd.js → Callout-B2vsR09t.js} +70 -52
- package/lib/{Callout-B_sEhkYd.js.map → Callout-B2vsR09t.js.map} +1 -1
- package/lib/Drawer-kDAfOq_2.js +1133 -0
- package/lib/Drawer-kDAfOq_2.js.map +1 -0
- package/lib/{Markdown-DZXjQjpH.js → Markdown-D1Y3cd9l.js} +4471 -3315
- package/lib/Markdown-D1Y3cd9l.js.map +1 -0
- package/lib/{MdxPage-52vRwa_7.js → MdxPage-CUL_SQzW.js} +9 -9
- package/lib/MdxPage-CUL_SQzW.js.map +1 -0
- package/lib/{OasProvider-CDyf845G.js → OasProvider-DEL8ulKm.js} +2 -2
- package/lib/{OasProvider-CDyf845G.js.map → OasProvider-DEL8ulKm.js.map} +1 -1
- package/lib/{OperationList-DdCWaqeE.js → OperationList-D6goKbzX.js} +179 -179
- package/lib/OperationList-D6goKbzX.js.map +1 -0
- package/lib/{SlotletProvider-TydSHROc.js → SlotletProvider-iDmNlxD5.js} +2 -2
- package/lib/{SlotletProvider-TydSHROc.js.map → SlotletProvider-iDmNlxD5.js.map} +1 -1
- package/lib/{createServer-DmusVVsi.js → createServer-BNBGpbLa.js} +1764 -1734
- package/lib/{createServer-DmusVVsi.js.map → createServer-BNBGpbLa.js.map} +1 -1
- package/lib/{index-BO-sA1cw.js → index-PKytqmuw.js} +348 -346
- package/lib/index-PKytqmuw.js.map +1 -0
- package/lib/prism-bash.min-HHIMdNJ_.js.map +1 -1
- package/lib/prism-csharp.min-bQAo2pmx.js.map +1 -1
- package/lib/prism-java.min-BpvsOuIa.js.map +1 -1
- package/lib/prism-javascript.min-CEqHqgbm.js.map +1 -1
- package/lib/prism-json.min-B1GJqK1k.js.map +1 -1
- package/lib/prism-markdown.min-C0Qn0m-5.js.map +1 -1
- package/lib/prism-markup-BNGj0Tvm.js.map +1 -1
- package/lib/prism-objectivec.min-BXSWqpJJ.js.map +1 -1
- package/lib/prism-ruby.min-Dx9KO9ds.js.map +1 -1
- package/lib/prism-typescript.min-CD7H2IYQ.js.map +1 -1
- package/lib/ui/Callout.js +39 -21
- package/lib/ui/Callout.js.map +1 -1
- package/lib/ui/Drawer.js +14 -1129
- package/lib/ui/Drawer.js.map +1 -1
- package/lib/zudoku.auth-clerk.js.map +1 -1
- package/lib/zudoku.components.js +675 -621
- package/lib/zudoku.components.js.map +1 -1
- package/lib/zudoku.plugin-api-catalog.js +1 -1
- package/lib/zudoku.plugin-api-keys.js +1 -1
- package/lib/zudoku.plugin-custom-pages.js +1 -1
- package/lib/zudoku.plugin-markdown.js +1 -1
- package/lib/zudoku.plugin-openapi.js +1 -1
- package/lib/zudoku.plugin-search-pagefind.js +1 -1
- package/package.json +11 -6
- package/src/app/main.css +5 -3
- package/src/lib/authentication/providers/clerk.tsx +2 -2
- package/src/lib/authentication/providers/supabase.tsx +151 -0
- package/src/lib/components/Header.tsx +10 -6
- package/src/lib/components/InlineCode.tsx +1 -1
- package/src/lib/components/Layout.tsx +5 -40
- package/src/lib/components/Main.tsx +47 -0
- package/src/lib/components/context/ViewportAnchorContext.tsx +3 -9
- package/src/lib/components/navigation/Sidebar.tsx +7 -9
- package/src/lib/components/navigation/SidebarWrapper.tsx +13 -15
- package/src/lib/core/RouteGuard.tsx +2 -1
- package/src/lib/oas/graphql/index.ts +35 -0
- package/src/lib/plugins/markdown/MdxPage.tsx +2 -2
- package/src/lib/plugins/openapi/OperationList.tsx +3 -2
- package/src/lib/plugins/openapi/Sidecar.tsx +11 -4
- package/src/lib/plugins/openapi/SimpleSelect.tsx +1 -1
- package/src/lib/plugins/openapi/graphql/gql.ts +3 -3
- package/src/lib/plugins/openapi/graphql/graphql.ts +8 -0
- package/src/lib/plugins/openapi/index.tsx +10 -11
- package/src/lib/plugins/openapi/interfaces.ts +11 -15
- package/src/lib/ui/Callout.tsx +28 -10
- package/lib/Markdown-DZXjQjpH.js.map +0 -1
- package/lib/MdxPage-52vRwa_7.js.map +0 -1
- package/lib/OperationList-DdCWaqeE.js.map +0 -1
- package/lib/index-BO-sA1cw.js.map +0 -1
|
@@ -88,6 +88,16 @@ const JSONScalar = builder.addScalarType("JSON", GraphQLJSON);
|
|
|
88
88
|
const JSONObjectScalar = builder.addScalarType("JSONObject", GraphQLJSONObject);
|
|
89
89
|
const JSONSchemaScalar = builder.addScalarType("JSONSchema", GraphQLJSONSchema);
|
|
90
90
|
|
|
91
|
+
const resolveExtensions = (obj: Record<string, any>) => {
|
|
92
|
+
const extensions: Record<string, any> = {};
|
|
93
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
94
|
+
if (key.startsWith("x-")) {
|
|
95
|
+
extensions[key] = value;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return extensions;
|
|
99
|
+
};
|
|
100
|
+
|
|
91
101
|
export const getAllTags = (schema: OpenAPIDocument): TagObject[] => {
|
|
92
102
|
const rootTags = schema.tags ?? [];
|
|
93
103
|
const operationTags = new Set(
|
|
@@ -191,6 +201,11 @@ const TagItem = builder.objectRef<TagObject>("TagItem").implement({
|
|
|
191
201
|
fields: (t) => ({
|
|
192
202
|
name: t.exposeString("name"),
|
|
193
203
|
description: t.exposeString("description", { nullable: true }),
|
|
204
|
+
extensions: t.field({
|
|
205
|
+
type: JSONObjectScalar,
|
|
206
|
+
resolve: (parent) => resolveExtensions(parent),
|
|
207
|
+
nullable: true,
|
|
208
|
+
}),
|
|
194
209
|
}),
|
|
195
210
|
});
|
|
196
211
|
|
|
@@ -249,6 +264,11 @@ const ParameterItem = builder
|
|
|
249
264
|
nullable: true,
|
|
250
265
|
}),
|
|
251
266
|
schema: t.expose("schema", { type: JSONSchemaScalar, nullable: true }),
|
|
267
|
+
extensions: t.field({
|
|
268
|
+
type: JSONObjectScalar,
|
|
269
|
+
resolve: (parent) => resolveExtensions(parent),
|
|
270
|
+
nullable: true,
|
|
271
|
+
}),
|
|
252
272
|
}),
|
|
253
273
|
});
|
|
254
274
|
|
|
@@ -306,6 +326,11 @@ const ResponseItem = builder
|
|
|
306
326
|
content: t.expose("content", { type: [MediaTypeItem], nullable: true }),
|
|
307
327
|
headers: t.expose("headers", { type: JSONScalar, nullable: true }),
|
|
308
328
|
links: t.expose("links", { type: JSONScalar, nullable: true }),
|
|
329
|
+
extensions: t.field({
|
|
330
|
+
type: JSONObjectScalar,
|
|
331
|
+
resolve: (parent) => resolveExtensions(parent),
|
|
332
|
+
nullable: true,
|
|
333
|
+
}),
|
|
309
334
|
}),
|
|
310
335
|
});
|
|
311
336
|
|
|
@@ -399,6 +424,11 @@ const OperationItem = builder
|
|
|
399
424
|
nullable: true,
|
|
400
425
|
}),
|
|
401
426
|
deprecated: t.exposeBoolean("deprecated", { nullable: true }),
|
|
427
|
+
extensions: t.field({
|
|
428
|
+
type: JSONObjectScalar,
|
|
429
|
+
resolve: (parent) => resolveExtensions(parent),
|
|
430
|
+
nullable: true,
|
|
431
|
+
}),
|
|
402
432
|
}),
|
|
403
433
|
});
|
|
404
434
|
|
|
@@ -462,6 +492,11 @@ const Schema = builder.objectRef<OpenAPIDocument>("Schema").implement({
|
|
|
462
492
|
);
|
|
463
493
|
}),
|
|
464
494
|
}),
|
|
495
|
+
extensions: t.field({
|
|
496
|
+
type: JSONObjectScalar,
|
|
497
|
+
resolve: (root) => resolveExtensions(root),
|
|
498
|
+
nullable: true,
|
|
499
|
+
}),
|
|
465
500
|
}),
|
|
466
501
|
});
|
|
467
502
|
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
import type { MdxComponentsType } from "../../util/MdxComponents.js";
|
|
14
14
|
import { cn } from "../../util/cn.js";
|
|
15
15
|
import { Toc } from "./Toc.js";
|
|
16
|
-
import { MarkdownPluginDefaultOptions, MDXImport } from "./index.js";
|
|
16
|
+
import { type MarkdownPluginDefaultOptions, type MDXImport } from "./index.js";
|
|
17
17
|
|
|
18
18
|
declare global {
|
|
19
19
|
interface Window {
|
|
@@ -91,7 +91,7 @@ export const MdxPage = ({
|
|
|
91
91
|
|
|
92
92
|
return (
|
|
93
93
|
<div
|
|
94
|
-
className="
|
|
94
|
+
className="grid grid-cols-1 xl:grid-cols-[--sidecar-grid-cols] gap-8 justify-between"
|
|
95
95
|
data-pagefind-filter="section:markdown"
|
|
96
96
|
data-pagefind-meta="section:markdown"
|
|
97
97
|
>
|
|
@@ -38,6 +38,7 @@ export const OperationsFragment = graphql(/* GraphQL */ `
|
|
|
38
38
|
contentTypes
|
|
39
39
|
path
|
|
40
40
|
deprecated
|
|
41
|
+
extensions
|
|
41
42
|
parameters {
|
|
42
43
|
name
|
|
43
44
|
in
|
|
@@ -248,14 +249,14 @@ export const OperationList = ({
|
|
|
248
249
|
)}
|
|
249
250
|
</Collapsible>
|
|
250
251
|
{tagDescription && (
|
|
251
|
-
<
|
|
252
|
+
<div
|
|
252
253
|
className={cn(
|
|
253
254
|
ProseClasses,
|
|
254
255
|
"my-4 max-w-full prose-img:max-w-prose",
|
|
255
256
|
)}
|
|
256
257
|
>
|
|
257
258
|
<Markdown content={tagDescription} />
|
|
258
|
-
</
|
|
259
|
+
</div>
|
|
259
260
|
)}
|
|
260
261
|
</div>
|
|
261
262
|
<hr />
|
|
@@ -111,7 +111,7 @@ export const Sidecar = ({
|
|
|
111
111
|
const [selectedExample, setSelectedExample] = useState<unknown>();
|
|
112
112
|
|
|
113
113
|
const selectedLang =
|
|
114
|
-
searchParams.get("lang") ?? options?.
|
|
114
|
+
searchParams.get("lang") ?? options?.examplesLanguage ?? "shell";
|
|
115
115
|
|
|
116
116
|
const requestBodyContent = operation.requestBody?.content;
|
|
117
117
|
|
|
@@ -151,7 +151,7 @@ export const Sidecar = ({
|
|
|
151
151
|
mimeType: "application/json",
|
|
152
152
|
}
|
|
153
153
|
: ({} as any),
|
|
154
|
-
headers: [],
|
|
154
|
+
headers: [{ name: "Content-Type", value: "application/json" }],
|
|
155
155
|
queryString: [],
|
|
156
156
|
httpVersion: "",
|
|
157
157
|
cookies: [],
|
|
@@ -166,11 +166,18 @@ export const Sidecar = ({
|
|
|
166
166
|
operation.method,
|
|
167
167
|
operation.path,
|
|
168
168
|
selectedServer,
|
|
169
|
-
result.data.schema.url,
|
|
170
169
|
selectedLang,
|
|
171
170
|
]);
|
|
172
171
|
const [ref, isOnScreen] = useOnScreen({ rootMargin: "200px 0px 200px 0px" });
|
|
173
172
|
|
|
173
|
+
const showPlayground =
|
|
174
|
+
isOnScreen &&
|
|
175
|
+
(operation.extensions["x-explorer-enabled"] === true ||
|
|
176
|
+
operation.extensions["x-playground-enabled"] === true ||
|
|
177
|
+
(operation.extensions["x-explorer-enabled"] === undefined &&
|
|
178
|
+
operation.extensions["x-playground-enabled"] === undefined &&
|
|
179
|
+
!options?.disablePlayground));
|
|
180
|
+
|
|
174
181
|
return (
|
|
175
182
|
<aside
|
|
176
183
|
ref={ref}
|
|
@@ -186,7 +193,7 @@ export const Sidecar = ({
|
|
|
186
193
|
|
|
187
194
|
{path}
|
|
188
195
|
</span>
|
|
189
|
-
{
|
|
196
|
+
{showPlayground && (
|
|
190
197
|
<PlaygroundDialogWrapper
|
|
191
198
|
servers={result.data.schema.servers.map((server) => server.url)}
|
|
192
199
|
operation={operation}
|
|
@@ -21,7 +21,7 @@ export const SimpleSelect = ({
|
|
|
21
21
|
<div className="grid">
|
|
22
22
|
<select
|
|
23
23
|
className={cn(
|
|
24
|
-
"row-start-1 col-start-1 border border-input text-foreground px-2 py-1 pe-6",
|
|
24
|
+
"w-full row-start-1 col-start-1 border border-input text-foreground px-2 py-1 pe-6",
|
|
25
25
|
"rounded-md appearance-none bg-zinc-50 hover:bg-white dark:bg-zinc-800 hover:dark:bg-zinc-800/75",
|
|
26
26
|
className,
|
|
27
27
|
)}
|
|
@@ -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 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;
|
|
17
|
+
"\n fragment OperationsFragment on OperationItem {\n slug\n summary\n method\n description\n operationId\n contentTypes\n path\n deprecated\n extensions\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 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":
|
|
26
|
+
"\n fragment OperationsFragment on OperationItem {\n slug\n summary\n method\n description\n operationId\n contentTypes\n path\n deprecated\n extensions\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 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",
|
|
48
|
+
source: "\n fragment OperationsFragment on OperationItem {\n slug\n summary\n method\n description\n operationId\n contentTypes\n path\n deprecated\n extensions\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.
|
|
@@ -67,6 +67,7 @@ export type OperationItem = {
|
|
|
67
67
|
contentTypes: Array<Scalars["String"]["output"]>;
|
|
68
68
|
deprecated?: Maybe<Scalars["Boolean"]["output"]>;
|
|
69
69
|
description?: Maybe<Scalars["String"]["output"]>;
|
|
70
|
+
extensions?: Maybe<Scalars["JSONObject"]["output"]>;
|
|
70
71
|
method: Scalars["String"]["output"];
|
|
71
72
|
operationId?: Maybe<Scalars["String"]["output"]>;
|
|
72
73
|
parameters?: Maybe<Array<ParameterItem>>;
|
|
@@ -88,6 +89,7 @@ export type ParameterItem = {
|
|
|
88
89
|
description?: Maybe<Scalars["String"]["output"]>;
|
|
89
90
|
examples?: Maybe<Array<ExampleItem>>;
|
|
90
91
|
explode?: Maybe<Scalars["Boolean"]["output"]>;
|
|
92
|
+
extensions?: Maybe<Scalars["JSONObject"]["output"]>;
|
|
91
93
|
in: ParameterIn;
|
|
92
94
|
name: Scalars["String"]["output"];
|
|
93
95
|
required?: Maybe<Scalars["Boolean"]["output"]>;
|
|
@@ -122,6 +124,7 @@ export type ResponseItem = {
|
|
|
122
124
|
__typename?: "ResponseItem";
|
|
123
125
|
content?: Maybe<Array<MediaTypeObject>>;
|
|
124
126
|
description?: Maybe<Scalars["String"]["output"]>;
|
|
127
|
+
extensions?: Maybe<Scalars["JSONObject"]["output"]>;
|
|
125
128
|
headers?: Maybe<Scalars["JSON"]["output"]>;
|
|
126
129
|
links?: Maybe<Scalars["JSON"]["output"]>;
|
|
127
130
|
statusCode: Scalars["String"]["output"];
|
|
@@ -130,6 +133,7 @@ export type ResponseItem = {
|
|
|
130
133
|
export type Schema = {
|
|
131
134
|
__typename?: "Schema";
|
|
132
135
|
description?: Maybe<Scalars["String"]["output"]>;
|
|
136
|
+
extensions?: Maybe<Scalars["JSONObject"]["output"]>;
|
|
133
137
|
openapi: Scalars["String"]["output"];
|
|
134
138
|
operations: Array<OperationItem>;
|
|
135
139
|
paths: Array<PathItem>;
|
|
@@ -171,6 +175,7 @@ export type Server = {
|
|
|
171
175
|
export type TagItem = {
|
|
172
176
|
__typename?: "TagItem";
|
|
173
177
|
description?: Maybe<Scalars["String"]["output"]>;
|
|
178
|
+
extensions?: Maybe<Scalars["JSONObject"]["output"]>;
|
|
174
179
|
name: Scalars["String"]["output"];
|
|
175
180
|
};
|
|
176
181
|
|
|
@@ -198,6 +203,7 @@ export type OperationsFragmentFragment = {
|
|
|
198
203
|
contentTypes: Array<string>;
|
|
199
204
|
path: string;
|
|
200
205
|
deprecated?: boolean | null;
|
|
206
|
+
extensions?: any | null;
|
|
201
207
|
parameters?: Array<{
|
|
202
208
|
__typename?: "ParameterItem";
|
|
203
209
|
name: string;
|
|
@@ -376,6 +382,7 @@ export const OperationsFragmentFragmentDoc = new TypedDocumentString(
|
|
|
376
382
|
contentTypes
|
|
377
383
|
path
|
|
378
384
|
deprecated
|
|
385
|
+
extensions
|
|
379
386
|
parameters {
|
|
380
387
|
name
|
|
381
388
|
in
|
|
@@ -475,6 +482,7 @@ export const AllOperationsDocument = new TypedDocumentString(`
|
|
|
475
482
|
contentTypes
|
|
476
483
|
path
|
|
477
484
|
deprecated
|
|
485
|
+
extensions
|
|
478
486
|
parameters {
|
|
479
487
|
name
|
|
480
488
|
in
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ResultOf } from "@graphql-typed-document-node/core";
|
|
2
2
|
import slugify from "@sindresorhus/slugify";
|
|
3
3
|
import { CirclePlayIcon, LogInIcon } from "lucide-react";
|
|
4
|
-
import { ReactNode } from "react";
|
|
4
|
+
import { type ReactNode } from "react";
|
|
5
5
|
import { matchPath } from "react-router";
|
|
6
6
|
import { useAuth } from "../../authentication/hook.js";
|
|
7
7
|
import { type ZudokuPlugin } from "../../core/plugins.js";
|
|
@@ -10,7 +10,7 @@ import { Button } from "../../ui/Button.js";
|
|
|
10
10
|
import { joinUrl } from "../../util/joinUrl.js";
|
|
11
11
|
import { GraphQLClient } from "./client/GraphQLClient.js";
|
|
12
12
|
import { graphql } from "./graphql/index.js";
|
|
13
|
-
import { OasPluginConfig } from "./interfaces.js";
|
|
13
|
+
import { type OasPluginConfig } from "./interfaces.js";
|
|
14
14
|
import type { PlaygroundContentProps } from "./playground/Playground.js";
|
|
15
15
|
import { PlaygroundDialog } from "./playground/PlaygroundDialog.js";
|
|
16
16
|
import { createSidebarCategory } from "./util/createSidebarCategory.js";
|
|
@@ -147,12 +147,11 @@ export const openApiPlugin = (config: OpenApiPluginOptions): ZudokuPlugin => {
|
|
|
147
147
|
try {
|
|
148
148
|
const versionParam = match?.params.version;
|
|
149
149
|
const version = versionParam ?? getVersions(config).at(0);
|
|
150
|
-
const type = config
|
|
151
|
-
const input =
|
|
152
|
-
config.type === "file" ? config.input[version!] : config.input;
|
|
150
|
+
const { type, options } = config;
|
|
151
|
+
const input = type === "file" ? config.input[version!] : config.input;
|
|
153
152
|
|
|
154
|
-
const collapsible =
|
|
155
|
-
const collapsed = !
|
|
153
|
+
const collapsible = options?.loadTags === true || config.type === "url";
|
|
154
|
+
const collapsed = !options?.loadTags && config.type !== "url";
|
|
156
155
|
|
|
157
156
|
// find tag name by slug in config.tagPages
|
|
158
157
|
const tagName = config.tagPages?.find(
|
|
@@ -164,7 +163,7 @@ export const openApiPlugin = (config: OpenApiPluginOptions): ZudokuPlugin => {
|
|
|
164
163
|
client.fetch(GetOperationsQuery, {
|
|
165
164
|
type,
|
|
166
165
|
input,
|
|
167
|
-
tag: !
|
|
166
|
+
tag: !options?.loadTags ? tagName : undefined,
|
|
168
167
|
}),
|
|
169
168
|
]);
|
|
170
169
|
|
|
@@ -182,7 +181,7 @@ export const openApiPlugin = (config: OpenApiPluginOptions): ZudokuPlugin => {
|
|
|
182
181
|
);
|
|
183
182
|
|
|
184
183
|
// skip empty categories
|
|
185
|
-
if (
|
|
184
|
+
if (options?.loadTags && operations.length === 0) {
|
|
186
185
|
return [];
|
|
187
186
|
}
|
|
188
187
|
|
|
@@ -190,7 +189,7 @@ export const openApiPlugin = (config: OpenApiPluginOptions): ZudokuPlugin => {
|
|
|
190
189
|
label: tag.name,
|
|
191
190
|
path: categoryPath,
|
|
192
191
|
operations:
|
|
193
|
-
match?.params.tag !== UNTAGGED_PATH ||
|
|
192
|
+
match?.params.tag !== UNTAGGED_PATH || options?.loadTags
|
|
194
193
|
? operations
|
|
195
194
|
: [],
|
|
196
195
|
collapsible,
|
|
@@ -204,7 +203,7 @@ export const openApiPlugin = (config: OpenApiPluginOptions): ZudokuPlugin => {
|
|
|
204
203
|
label: "Other endpoints",
|
|
205
204
|
path: joinUrl(basePath, versionParam, UNTAGGED_PATH),
|
|
206
205
|
operations:
|
|
207
|
-
match?.params.tag === UNTAGGED_PATH ||
|
|
206
|
+
match?.params.tag === UNTAGGED_PATH || options?.loadTags
|
|
208
207
|
? operationsData.schema.untagged
|
|
209
208
|
: [],
|
|
210
209
|
collapsible,
|
|
@@ -10,26 +10,22 @@ export type ContextOasSource =
|
|
|
10
10
|
| { type: "file"; input: DynamicInput }
|
|
11
11
|
| { type: "raw"; input: string };
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
type BaseOasConfig = {
|
|
14
14
|
server?: string;
|
|
15
15
|
navigationId?: string;
|
|
16
16
|
skipPreload?: boolean;
|
|
17
17
|
tagPages?: Array<string>;
|
|
18
|
-
loadTags?: boolean;
|
|
19
|
-
} & OasPluginConfigOptions &
|
|
20
|
-
OasSource;
|
|
21
|
-
|
|
22
|
-
export type OasPluginConfigOptions = {
|
|
23
18
|
options?: {
|
|
24
|
-
|
|
19
|
+
examplesLanguage?: string;
|
|
20
|
+
disablePlayground?: boolean;
|
|
21
|
+
loadTags?: boolean;
|
|
25
22
|
};
|
|
26
23
|
};
|
|
27
24
|
|
|
28
|
-
export type
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
OasPluginConfigOptions;
|
|
25
|
+
export type OasPluginConfig = BaseOasConfig & OasSource;
|
|
26
|
+
|
|
27
|
+
export type OasPluginContext = BaseOasConfig &
|
|
28
|
+
ContextOasSource & {
|
|
29
|
+
version?: string;
|
|
30
|
+
versions: Record<string, string>;
|
|
31
|
+
};
|
package/src/lib/ui/Callout.tsx
CHANGED
|
@@ -56,31 +56,49 @@ type CalloutProps = {
|
|
|
56
56
|
title?: string;
|
|
57
57
|
children: ReactNode;
|
|
58
58
|
className?: string;
|
|
59
|
+
icon?: boolean;
|
|
59
60
|
};
|
|
60
61
|
|
|
61
|
-
export const Callout = ({
|
|
62
|
+
export const Callout = ({
|
|
63
|
+
type,
|
|
64
|
+
children,
|
|
65
|
+
title,
|
|
66
|
+
className,
|
|
67
|
+
icon = true,
|
|
68
|
+
}: CalloutProps) => {
|
|
62
69
|
const { border, bg, iconColor, titleColor, textColor, Icon } =
|
|
63
70
|
stylesMap[type];
|
|
64
71
|
|
|
65
72
|
return (
|
|
66
73
|
<div
|
|
67
74
|
className={cn(
|
|
68
|
-
"not-prose
|
|
75
|
+
"not-prose rounded-md border p-4 text-md my-2",
|
|
76
|
+
icon &&
|
|
77
|
+
"grid grid-cols-[min-content_1fr] items-baseline grid-rows-[fit-content_1fr] gap-x-4 gap-y-2",
|
|
78
|
+
!icon && title && "flex flex-col gap-2",
|
|
69
79
|
"[&_a]:underline [&_a]:decoration-current [&_a]:decoration-from-font [&_a]:underline-offset-4 hover:[&_a]:decoration-1",
|
|
70
|
-
"[&_code]:!bg-gray-50 [&_code]:dark:!bg-gray-800 [&_code]:!border-none
|
|
71
|
-
title && "items-center",
|
|
80
|
+
"[&_code]:!bg-gray-50 [&_code]:dark:!bg-gray-800 [&_code]:!border-none",
|
|
81
|
+
icon && title && "items-center",
|
|
72
82
|
border,
|
|
73
83
|
bg,
|
|
74
84
|
className,
|
|
75
85
|
)}
|
|
76
86
|
>
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
87
|
+
{icon && (
|
|
88
|
+
<Icon
|
|
89
|
+
className={cn(!title ? "translate-y-1" : "align-middle", iconColor)}
|
|
90
|
+
size={20}
|
|
91
|
+
aria-hidden="true"
|
|
92
|
+
/>
|
|
93
|
+
)}
|
|
82
94
|
{title && <h3 className={cn("font-medium", titleColor)}>{title}</h3>}
|
|
83
|
-
<div
|
|
95
|
+
<div
|
|
96
|
+
className={cn(
|
|
97
|
+
icon && "col-start-2",
|
|
98
|
+
!title && icon && "row-start-1",
|
|
99
|
+
textColor,
|
|
100
|
+
)}
|
|
101
|
+
>
|
|
84
102
|
{children}
|
|
85
103
|
</div>
|
|
86
104
|
</div>
|