zudoku 0.9.0 → 0.11.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/config.d.ts +2 -6
- package/dist/config/validators/InputSidebarSchema.d.ts +1 -0
- package/dist/config/validators/validate.d.ts +151 -37
- package/dist/config/validators/validate.js +14 -11
- package/dist/config/validators/validate.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/lib/authentication/state.d.ts +16 -0
- package/dist/lib/authentication/state.js +5 -0
- package/dist/lib/authentication/state.js.map +1 -1
- package/dist/lib/components/InlineCode.d.ts +2 -1
- package/dist/lib/components/InlineCode.js +9 -1
- package/dist/lib/components/InlineCode.js.map +1 -1
- package/dist/lib/components/Layout.js +1 -1
- package/dist/lib/components/Layout.js.map +1 -1
- package/dist/lib/oas/graphql/index.d.ts +2 -1
- package/dist/lib/oas/graphql/index.js +22 -10
- package/dist/lib/oas/graphql/index.js.map +1 -1
- package/dist/lib/oas/parser/index.d.ts +1 -0
- package/dist/lib/oas/parser/index.js.map +1 -1
- package/dist/lib/plugins/markdown/MdxPage.js +2 -2
- package/dist/lib/plugins/markdown/MdxPage.js.map +1 -1
- package/dist/lib/plugins/markdown/generateRoutes.d.ts +1 -1
- package/dist/lib/plugins/markdown/generateRoutes.js +8 -6
- package/dist/lib/plugins/markdown/generateRoutes.js.map +1 -1
- package/dist/lib/plugins/markdown/index.d.ts +2 -1
- package/dist/lib/plugins/markdown/index.js +2 -2
- package/dist/lib/plugins/markdown/index.js.map +1 -1
- package/dist/lib/plugins/openapi/Endpoint.d.ts +1 -3
- package/dist/lib/plugins/openapi/Endpoint.js +46 -8
- package/dist/lib/plugins/openapi/Endpoint.js.map +1 -1
- package/dist/lib/plugins/openapi/OperationList.js +1 -1
- package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
- package/dist/lib/plugins/openapi/OperationListItem.js +1 -1
- package/dist/lib/plugins/openapi/OperationListItem.js.map +1 -1
- package/dist/lib/plugins/openapi/PlaygroundDialogWrapper.d.ts +2 -1
- package/dist/lib/plugins/openapi/PlaygroundDialogWrapper.js +2 -2
- package/dist/lib/plugins/openapi/PlaygroundDialogWrapper.js.map +1 -1
- package/dist/lib/plugins/openapi/Sidecar.js +14 -3
- package/dist/lib/plugins/openapi/Sidecar.js.map +1 -1
- package/dist/lib/plugins/openapi/SimpleSelect.d.ts +2 -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 +10 -2
- package/dist/lib/plugins/openapi/graphql/gql.js +2 -1
- package/dist/lib/plugins/openapi/graphql/gql.js.map +1 -1
- package/dist/lib/plugins/openapi/graphql/graphql.d.ts +29 -3
- package/dist/lib/plugins/openapi/graphql/graphql.js +87 -0
- package/dist/lib/plugins/openapi/graphql/graphql.js.map +1 -1
- package/dist/lib/plugins/openapi/interfaces.d.ts +3 -0
- package/dist/lib/plugins/openapi/playground/Playground.d.ts +2 -1
- package/dist/lib/plugins/openapi/playground/Playground.js +12 -4
- package/dist/lib/plugins/openapi/playground/Playground.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/createUrl.js +3 -1
- package/dist/lib/plugins/openapi/playground/createUrl.js.map +1 -1
- package/dist/vite/config.d.ts +1 -1
- package/dist/vite/config.js +7 -3
- package/dist/vite/config.js.map +1 -1
- package/dist/vite/dev-server.d.ts +1 -0
- package/dist/vite/dev-server.js +7 -13
- package/dist/vite/dev-server.js.map +1 -1
- package/dist/vite/plugin-api.js +4 -7
- package/dist/vite/plugin-api.js.map +1 -1
- package/dist/vite/plugin-config-reload.js +9 -4
- package/dist/vite/plugin-config-reload.js.map +1 -1
- package/dist/vite/plugin-docs.js +7 -5
- package/dist/vite/plugin-docs.js.map +1 -1
- package/dist/vite/plugin-frontmatter.d.ts +2 -0
- package/dist/vite/plugin-frontmatter.js +30 -0
- package/dist/vite/plugin-frontmatter.js.map +1 -0
- package/dist/vite/plugin-sidebar.js +14 -1
- package/dist/vite/plugin-sidebar.js.map +1 -1
- package/dist/vite/plugin.js +2 -2
- package/dist/vite/plugin.js.map +1 -1
- package/lib/{CategoryHeading-XnFqN2lJ.js → CategoryHeading-ovR-zHRq.js} +2 -2
- package/lib/{CategoryHeading-XnFqN2lJ.js.map → CategoryHeading-ovR-zHRq.js.map} +1 -1
- package/lib/{DeveloperHint-FBb2uXJe.js → DeveloperHint-YeWHKvyr.js} +2 -2
- package/lib/{DeveloperHint-FBb2uXJe.js.map → DeveloperHint-YeWHKvyr.js.map} +1 -1
- package/lib/{ErrorPage-knunPbKI.js → ErrorPage-Dri5_2lr.js} +3 -3
- package/lib/{ErrorPage-knunPbKI.js.map → ErrorPage-Dri5_2lr.js.map} +1 -1
- package/lib/{Input-BEDZAKw0.js → Input-CtVUl3eT.js} +3 -3
- package/lib/{Input-BEDZAKw0.js.map → Input-CtVUl3eT.js.map} +1 -1
- package/lib/{Markdown-B4aR03g6.js → Markdown-DapSf3wG.js} +795 -793
- package/lib/Markdown-DapSf3wG.js.map +1 -0
- package/lib/{MdxPage-BZyQsH8Z.js → MdxPage-BqBWsXZ1.js} +23 -23
- package/lib/MdxPage-BqBWsXZ1.js.map +1 -0
- package/lib/{OperationList-2NeWEM0u.js → OperationList-JAQF5-tn.js} +151 -109
- package/lib/OperationList-JAQF5-tn.js.map +1 -0
- package/lib/{Route-BZPewmrN.js → Route-DSANUy5e.js} +2 -2
- package/lib/{Route-BZPewmrN.js.map → Route-DSANUy5e.js.map} +1 -1
- package/lib/{SidebarBadge-COz0hgfa.js → SidebarBadge-Dx7jtnoA.js} +3 -3
- package/lib/{SidebarBadge-COz0hgfa.js.map → SidebarBadge-Dx7jtnoA.js.map} +1 -1
- package/lib/{SlotletProvider-DJMaOUDs.js → SlotletProvider-D3UD5Go3.js} +4 -4
- package/lib/{SlotletProvider-DJMaOUDs.js.map → SlotletProvider-D3UD5Go3.js.map} +1 -1
- package/lib/assets/{worker-BvD7B6MG.js → worker-Bcj4NA2p.js} +3430 -1351
- package/lib/assets/worker-Bcj4NA2p.js.map +1 -0
- package/lib/index-Bn6Lc9tq.js +9 -0
- package/lib/index-Bn6Lc9tq.js.map +1 -0
- package/lib/{index-1EDgIO6b.js → index-BngPzhKn.js} +3 -3
- package/lib/{index-1EDgIO6b.js.map → index-BngPzhKn.js.map} +1 -1
- package/lib/{index-Zezcv0xb.js → index-Dolisrci.js} +3 -3
- package/lib/{index-Zezcv0xb.js.map → index-Dolisrci.js.map} +1 -1
- package/lib/{index-Dv2KZuEw.js → index-DyJyULzS.js} +1774 -1643
- package/lib/index-DyJyULzS.js.map +1 -0
- package/lib/index-LNp6rxyU.js +2094 -0
- package/lib/index-LNp6rxyU.js.map +1 -0
- package/lib/state-hNe1dw4B.js +548 -0
- package/lib/state-hNe1dw4B.js.map +1 -0
- package/lib/zudoku.auth-auth0.js +1 -1
- package/lib/zudoku.auth-clerk.js +1 -1
- package/lib/zudoku.auth-openid.js +4 -4
- package/lib/zudoku.components.js +6 -6
- package/lib/zudoku.components.js.map +1 -1
- package/lib/zudoku.openapi-worker.js +497 -489
- package/lib/zudoku.openapi-worker.js.map +1 -1
- package/lib/zudoku.plugin-api-keys.js +5 -5
- package/lib/zudoku.plugin-custom-page.js +1 -1
- package/lib/zudoku.plugin-markdown.js +18 -15
- package/lib/zudoku.plugin-markdown.js.map +1 -1
- package/lib/zudoku.plugin-openapi.js +4 -4
- package/package.json +14 -4
- package/src/lib/authentication/state.ts +17 -0
- package/src/lib/components/InlineCode.tsx +10 -0
- package/src/lib/components/Layout.tsx +1 -1
- package/src/lib/oas/graphql/index.ts +33 -13
- package/src/lib/oas/parser/index.ts +1 -0
- package/src/lib/plugins/markdown/MdxPage.tsx +2 -2
- package/src/lib/plugins/markdown/generateRoutes.tsx +8 -5
- package/src/lib/plugins/markdown/index.tsx +3 -1
- package/src/lib/plugins/openapi/Endpoint.tsx +86 -22
- package/src/lib/plugins/openapi/OperationList.tsx +3 -1
- package/src/lib/plugins/openapi/OperationListItem.tsx +1 -1
- package/src/lib/plugins/openapi/PlaygroundDialogWrapper.tsx +3 -0
- package/src/lib/plugins/openapi/Sidecar.tsx +17 -2
- package/src/lib/plugins/openapi/SimpleSelect.tsx +10 -2
- package/src/lib/plugins/openapi/graphql/gql.ts +11 -3
- package/src/lib/plugins/openapi/graphql/graphql.ts +116 -4
- package/src/lib/plugins/openapi/interfaces.ts +4 -1
- package/src/lib/plugins/openapi/playground/Playground.tsx +38 -4
- package/src/lib/plugins/openapi/playground/createUrl.ts +6 -1
- package/dist/lib/util/slugify.d.ts +0 -2
- package/dist/lib/util/slugify.js +0 -3
- package/dist/lib/util/slugify.js.map +0 -1
- package/dist/vite/plugin-icons.d.ts +0 -3
- package/dist/vite/plugin-icons.js +0 -47
- package/dist/vite/plugin-icons.js.map +0 -1
- package/lib/Markdown-B4aR03g6.js.map +0 -1
- package/lib/MdxPage-BZyQsH8Z.js.map +0 -1
- package/lib/OperationList-2NeWEM0u.js.map +0 -1
- package/lib/assets/worker-BvD7B6MG.js.map +0 -1
- package/lib/index-Dv2KZuEw.js.map +0 -1
- package/lib/slugify-DbLhpSPt.js +0 -28
- package/lib/slugify-DbLhpSPt.js.map +0 -1
- package/lib/state-lIwt9isb.js +0 -288
- package/lib/state-lIwt9isb.js.map +0 -1
- package/src/lib/util/slugify.ts +0 -3
|
@@ -7,6 +7,7 @@ export const SimpleSelect = ({
|
|
|
7
7
|
onChange,
|
|
8
8
|
className,
|
|
9
9
|
options,
|
|
10
|
+
showChevrons = true,
|
|
10
11
|
}: {
|
|
11
12
|
value: string;
|
|
12
13
|
onChange: ChangeEventHandler<HTMLSelectElement>;
|
|
@@ -15,12 +16,14 @@ export const SimpleSelect = ({
|
|
|
15
16
|
value: string;
|
|
16
17
|
label: string;
|
|
17
18
|
}[];
|
|
19
|
+
showChevrons?: boolean;
|
|
18
20
|
}) => (
|
|
19
|
-
<div className=
|
|
21
|
+
<div className="grid">
|
|
20
22
|
<select
|
|
21
23
|
className={cn(
|
|
22
24
|
"row-start-1 col-start-1 border border-input text-foreground px-2 py-1 pe-6",
|
|
23
25
|
"rounded-md appearance-none bg-zinc-50 hover:bg-white dark:bg-zinc-800 hover:dark:bg-zinc-800/75",
|
|
26
|
+
className,
|
|
24
27
|
)}
|
|
25
28
|
value={value}
|
|
26
29
|
onChange={onChange}
|
|
@@ -31,7 +34,12 @@ export const SimpleSelect = ({
|
|
|
31
34
|
</option>
|
|
32
35
|
))}
|
|
33
36
|
</select>
|
|
34
|
-
<div
|
|
37
|
+
<div
|
|
38
|
+
className={cn(
|
|
39
|
+
!showChevrons && "hidden",
|
|
40
|
+
"row-start-1 col-start-1 self-center justify-self-end relative end-2 pointer-events-none",
|
|
41
|
+
)}
|
|
42
|
+
>
|
|
35
43
|
<ChevronsUpDownIcon size={14} />
|
|
36
44
|
</div>
|
|
37
45
|
</div>
|
|
@@ -13,11 +13,13 @@ import * as types from "./graphql.js";
|
|
|
13
13
|
* Therefore it is highly recommended to use the babel or swc plugin for production.
|
|
14
14
|
*/
|
|
15
15
|
const documents = {
|
|
16
|
+
"\n query ServersQuery($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n url\n servers {\n url\n }\n }\n }\n":
|
|
17
|
+
types.ServersQueryDocument,
|
|
16
18
|
"\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 schema\n }\n description\n required\n }\n responses {\n statusCode\n links\n description\n content {\n mediaType\n encoding {\n name\n }\n schema\n }\n }\n }\n":
|
|
17
19
|
types.OperationsFragmentFragmentDoc,
|
|
18
20
|
"\n query AllOperations($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n description\n title\n url\n version\n tags {\n name\n description\n operations {\n slug\n ...OperationsFragment\n }\n }\n }\n }\n":
|
|
19
21
|
types.AllOperationsDocument,
|
|
20
|
-
"\n query getServerQuery($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n url\n }\n }\n":
|
|
22
|
+
"\n query getServerQuery($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n url\n servers {\n url\n }\n }\n }\n":
|
|
21
23
|
types.GetServerQueryDocument,
|
|
22
24
|
"\n query GetCategories($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n tags {\n __typename\n name\n operations {\n __typename\n slug\n deprecated\n method\n summary\n operationId\n path\n }\n }\n }\n }\n":
|
|
23
25
|
types.GetCategoriesDocument,
|
|
@@ -37,6 +39,12 @@ const documents = {
|
|
|
37
39
|
*/
|
|
38
40
|
export function graphql(source: string): unknown;
|
|
39
41
|
|
|
42
|
+
/**
|
|
43
|
+
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
44
|
+
*/
|
|
45
|
+
export function graphql(
|
|
46
|
+
source: "\n query ServersQuery($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n url\n servers {\n url\n }\n }\n }\n",
|
|
47
|
+
): (typeof documents)["\n query ServersQuery($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n url\n servers {\n url\n }\n }\n }\n"];
|
|
40
48
|
/**
|
|
41
49
|
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
42
50
|
*/
|
|
@@ -53,8 +61,8 @@ export function graphql(
|
|
|
53
61
|
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
54
62
|
*/
|
|
55
63
|
export function graphql(
|
|
56
|
-
source: "\n query getServerQuery($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n url\n }\n }\n",
|
|
57
|
-
): (typeof documents)["\n query getServerQuery($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n url\n }\n }\n"];
|
|
64
|
+
source: "\n query getServerQuery($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n url\n servers {\n url\n }\n }\n }\n",
|
|
65
|
+
): (typeof documents)["\n query getServerQuery($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n url\n servers {\n url\n }\n }\n }\n"];
|
|
58
66
|
/**
|
|
59
67
|
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
60
68
|
*/
|
|
@@ -119,7 +119,7 @@ export type RequestBodyObject = {
|
|
|
119
119
|
export type ResponseItem = {
|
|
120
120
|
__typename?: "ResponseItem";
|
|
121
121
|
content?: Maybe<Array<MediaTypeObject>>;
|
|
122
|
-
description
|
|
122
|
+
description?: Maybe<Scalars["String"]["output"]>;
|
|
123
123
|
headers?: Maybe<Scalars["JSON"]["output"]>;
|
|
124
124
|
links?: Maybe<Scalars["JSON"]["output"]>;
|
|
125
125
|
statusCode: Scalars["String"]["output"];
|
|
@@ -131,6 +131,7 @@ export type Schema = {
|
|
|
131
131
|
openapi: Scalars["String"]["output"];
|
|
132
132
|
operations: Array<OperationItem>;
|
|
133
133
|
paths: Array<PathItem>;
|
|
134
|
+
servers: Array<Server>;
|
|
134
135
|
tags: Array<SchemaTag>;
|
|
135
136
|
title: Scalars["String"]["output"];
|
|
136
137
|
url: Scalars["String"]["output"];
|
|
@@ -155,7 +156,13 @@ export type SchemaTag = {
|
|
|
155
156
|
operations: Array<OperationItem>;
|
|
156
157
|
};
|
|
157
158
|
|
|
158
|
-
export type SchemaType = "file" | "url";
|
|
159
|
+
export type SchemaType = "file" | "raw" | "url";
|
|
160
|
+
|
|
161
|
+
export type Server = {
|
|
162
|
+
__typename?: "Server";
|
|
163
|
+
description?: Maybe<Scalars["String"]["output"]>;
|
|
164
|
+
url: Scalars["String"]["output"];
|
|
165
|
+
};
|
|
159
166
|
|
|
160
167
|
export type TagItem = {
|
|
161
168
|
__typename?: "TagItem";
|
|
@@ -163,6 +170,20 @@ export type TagItem = {
|
|
|
163
170
|
name: Scalars["String"]["output"];
|
|
164
171
|
};
|
|
165
172
|
|
|
173
|
+
export type ServersQueryQueryVariables = Exact<{
|
|
174
|
+
input: Scalars["JSON"]["input"];
|
|
175
|
+
type: SchemaType;
|
|
176
|
+
}>;
|
|
177
|
+
|
|
178
|
+
export type ServersQueryQuery = {
|
|
179
|
+
__typename?: "Query";
|
|
180
|
+
schema: {
|
|
181
|
+
__typename?: "Schema";
|
|
182
|
+
url: string;
|
|
183
|
+
servers: Array<{ __typename?: "Server"; url: string }>;
|
|
184
|
+
};
|
|
185
|
+
};
|
|
186
|
+
|
|
166
187
|
export type OperationsFragmentFragment = {
|
|
167
188
|
__typename?: "OperationItem";
|
|
168
189
|
slug: string;
|
|
@@ -204,7 +225,7 @@ export type OperationsFragmentFragment = {
|
|
|
204
225
|
__typename?: "ResponseItem";
|
|
205
226
|
statusCode: string;
|
|
206
227
|
links?: any | null;
|
|
207
|
-
description
|
|
228
|
+
description?: string | null;
|
|
208
229
|
content?: Array<{
|
|
209
230
|
__typename?: "MediaTypeObject";
|
|
210
231
|
mediaType: string;
|
|
@@ -249,7 +270,11 @@ export type GetServerQueryQueryVariables = Exact<{
|
|
|
249
270
|
|
|
250
271
|
export type GetServerQueryQuery = {
|
|
251
272
|
__typename?: "Query";
|
|
252
|
-
schema: {
|
|
273
|
+
schema: {
|
|
274
|
+
__typename?: "Schema";
|
|
275
|
+
url: string;
|
|
276
|
+
servers: Array<{ __typename?: "Server"; url: string }>;
|
|
277
|
+
};
|
|
253
278
|
};
|
|
254
279
|
|
|
255
280
|
export type GetCategoriesQueryVariables = Exact<{
|
|
@@ -423,6 +448,83 @@ export const OperationsFragmentFragmentDoc = {
|
|
|
423
448
|
},
|
|
424
449
|
],
|
|
425
450
|
} as unknown as DocumentNode<OperationsFragmentFragment, unknown>;
|
|
451
|
+
export const ServersQueryDocument = {
|
|
452
|
+
kind: "Document",
|
|
453
|
+
definitions: [
|
|
454
|
+
{
|
|
455
|
+
kind: "OperationDefinition",
|
|
456
|
+
operation: "query",
|
|
457
|
+
name: { kind: "Name", value: "ServersQuery" },
|
|
458
|
+
variableDefinitions: [
|
|
459
|
+
{
|
|
460
|
+
kind: "VariableDefinition",
|
|
461
|
+
variable: {
|
|
462
|
+
kind: "Variable",
|
|
463
|
+
name: { kind: "Name", value: "input" },
|
|
464
|
+
},
|
|
465
|
+
type: {
|
|
466
|
+
kind: "NonNullType",
|
|
467
|
+
type: { kind: "NamedType", name: { kind: "Name", value: "JSON" } },
|
|
468
|
+
},
|
|
469
|
+
},
|
|
470
|
+
{
|
|
471
|
+
kind: "VariableDefinition",
|
|
472
|
+
variable: { kind: "Variable", name: { kind: "Name", value: "type" } },
|
|
473
|
+
type: {
|
|
474
|
+
kind: "NonNullType",
|
|
475
|
+
type: {
|
|
476
|
+
kind: "NamedType",
|
|
477
|
+
name: { kind: "Name", value: "SchemaType" },
|
|
478
|
+
},
|
|
479
|
+
},
|
|
480
|
+
},
|
|
481
|
+
],
|
|
482
|
+
selectionSet: {
|
|
483
|
+
kind: "SelectionSet",
|
|
484
|
+
selections: [
|
|
485
|
+
{
|
|
486
|
+
kind: "Field",
|
|
487
|
+
name: { kind: "Name", value: "schema" },
|
|
488
|
+
arguments: [
|
|
489
|
+
{
|
|
490
|
+
kind: "Argument",
|
|
491
|
+
name: { kind: "Name", value: "input" },
|
|
492
|
+
value: {
|
|
493
|
+
kind: "Variable",
|
|
494
|
+
name: { kind: "Name", value: "input" },
|
|
495
|
+
},
|
|
496
|
+
},
|
|
497
|
+
{
|
|
498
|
+
kind: "Argument",
|
|
499
|
+
name: { kind: "Name", value: "type" },
|
|
500
|
+
value: {
|
|
501
|
+
kind: "Variable",
|
|
502
|
+
name: { kind: "Name", value: "type" },
|
|
503
|
+
},
|
|
504
|
+
},
|
|
505
|
+
],
|
|
506
|
+
selectionSet: {
|
|
507
|
+
kind: "SelectionSet",
|
|
508
|
+
selections: [
|
|
509
|
+
{ kind: "Field", name: { kind: "Name", value: "url" } },
|
|
510
|
+
{
|
|
511
|
+
kind: "Field",
|
|
512
|
+
name: { kind: "Name", value: "servers" },
|
|
513
|
+
selectionSet: {
|
|
514
|
+
kind: "SelectionSet",
|
|
515
|
+
selections: [
|
|
516
|
+
{ kind: "Field", name: { kind: "Name", value: "url" } },
|
|
517
|
+
],
|
|
518
|
+
},
|
|
519
|
+
},
|
|
520
|
+
],
|
|
521
|
+
},
|
|
522
|
+
},
|
|
523
|
+
],
|
|
524
|
+
},
|
|
525
|
+
},
|
|
526
|
+
],
|
|
527
|
+
} as unknown as DocumentNode<ServersQueryQuery, ServersQueryQueryVariables>;
|
|
426
528
|
export const AllOperationsDocument = {
|
|
427
529
|
kind: "Document",
|
|
428
530
|
definitions: [
|
|
@@ -727,6 +829,16 @@ export const GetServerQueryDocument = {
|
|
|
727
829
|
kind: "SelectionSet",
|
|
728
830
|
selections: [
|
|
729
831
|
{ kind: "Field", name: { kind: "Name", value: "url" } },
|
|
832
|
+
{
|
|
833
|
+
kind: "Field",
|
|
834
|
+
name: { kind: "Name", value: "servers" },
|
|
835
|
+
selectionSet: {
|
|
836
|
+
kind: "SelectionSet",
|
|
837
|
+
selections: [
|
|
838
|
+
{ kind: "Field", name: { kind: "Name", value: "url" } },
|
|
839
|
+
],
|
|
840
|
+
},
|
|
841
|
+
},
|
|
730
842
|
],
|
|
731
843
|
},
|
|
732
844
|
},
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useMutation } from "@tanstack/react-query";
|
|
2
|
-
import { Fragment, useEffect, useRef } from "react";
|
|
2
|
+
import { Fragment, useEffect, useRef, useTransition } from "react";
|
|
3
3
|
import { FormProvider, useForm } from "react-hook-form";
|
|
4
|
+
import { useSelectedServerStore } from "../../../authentication/state.js";
|
|
4
5
|
import { useApiIdentities } from "../../../components/context/ZudokuContext.js";
|
|
5
6
|
import {
|
|
6
7
|
Select,
|
|
@@ -62,6 +63,7 @@ export type PlaygroundForm = {
|
|
|
62
63
|
|
|
63
64
|
export type PlaygroundContentProps = {
|
|
64
65
|
server: string;
|
|
66
|
+
servers?: string[];
|
|
65
67
|
url: string;
|
|
66
68
|
method: string;
|
|
67
69
|
headers?: Header[];
|
|
@@ -72,6 +74,7 @@ export type PlaygroundContentProps = {
|
|
|
72
74
|
|
|
73
75
|
export const Playground = ({
|
|
74
76
|
server,
|
|
77
|
+
servers,
|
|
75
78
|
url,
|
|
76
79
|
method,
|
|
77
80
|
headers = [],
|
|
@@ -79,6 +82,8 @@ export const Playground = ({
|
|
|
79
82
|
pathParams = [],
|
|
80
83
|
defaultBody = "",
|
|
81
84
|
}: PlaygroundContentProps) => {
|
|
85
|
+
const { selectedServer, setSelectedServer } = useSelectedServerStore();
|
|
86
|
+
const [, startTransition] = useTransition();
|
|
82
87
|
const { register, control, handleSubmit, watch, setValue, ...form } =
|
|
83
88
|
useForm<PlaygroundForm>({
|
|
84
89
|
defaultValues: {
|
|
@@ -114,7 +119,7 @@ export const Playground = ({
|
|
|
114
119
|
|
|
115
120
|
const queryMutation = useMutation({
|
|
116
121
|
mutationFn: async (data: PlaygroundForm) => {
|
|
117
|
-
const requestUrl = createUrl(server, url, data);
|
|
122
|
+
const requestUrl = createUrl(selectedServer ?? server, url, data);
|
|
118
123
|
const start = performance.now();
|
|
119
124
|
|
|
120
125
|
const request = new Request(requestUrl, {
|
|
@@ -200,19 +205,48 @@ export const Playground = ({
|
|
|
200
205
|
</Fragment>
|
|
201
206
|
));
|
|
202
207
|
|
|
208
|
+
const serverSelect = (
|
|
209
|
+
<div className="inline-block opacity-50 hover:opacity-100 transition">
|
|
210
|
+
{servers && servers.length > 1 ? (
|
|
211
|
+
<Select
|
|
212
|
+
onValueChange={(value) => {
|
|
213
|
+
startTransition(() => {
|
|
214
|
+
setSelectedServer(value);
|
|
215
|
+
});
|
|
216
|
+
}}
|
|
217
|
+
value={selectedServer}
|
|
218
|
+
>
|
|
219
|
+
<SelectTrigger className="p-0 border-none flex-row-reverse bg-transparent text-xs gap-0.5 h-auto">
|
|
220
|
+
<SelectValue />
|
|
221
|
+
</SelectTrigger>
|
|
222
|
+
<SelectContent>
|
|
223
|
+
{servers.map((s) => (
|
|
224
|
+
<SelectItem key={s} value={s}>
|
|
225
|
+
{s.replace(/^https?:\/\//, "")}
|
|
226
|
+
</SelectItem>
|
|
227
|
+
))}
|
|
228
|
+
</SelectContent>
|
|
229
|
+
</Select>
|
|
230
|
+
) : (
|
|
231
|
+
<span>{server.replace(/^https?:\/\//, "")}</span>
|
|
232
|
+
)}
|
|
233
|
+
</div>
|
|
234
|
+
);
|
|
235
|
+
|
|
203
236
|
return (
|
|
204
237
|
<FormProvider
|
|
205
238
|
{...{ register, control, handleSubmit, watch, setValue, ...form }}
|
|
206
239
|
>
|
|
207
240
|
<form onSubmit={handleSubmit((data) => queryMutation.mutateAsync(data))}>
|
|
208
|
-
<div className="grid grid-cols-
|
|
241
|
+
<div className="grid grid-cols-[8fr_7fr] text-sm h-full">
|
|
209
242
|
<div className="flex flex-col gap-4 p-8 bg-muted/50 after:bg-muted-foreground/20 relative after:absolute after:w-px after:inset-0 after:left-auto">
|
|
210
243
|
<div className="flex gap-2 items-stretch">
|
|
211
244
|
<div className="flex flex-1 items-center w-full border rounded-md">
|
|
212
245
|
<div className="border-r p-2 bg-muted rounded-l-md self-stretch font-semibold font-mono">
|
|
213
246
|
{method.toUpperCase()}
|
|
214
247
|
</div>
|
|
215
|
-
<div className="p-2 font-mono text-xs">
|
|
248
|
+
<div className="flex items-center flex-wrap p-2 font-mono text-xs">
|
|
249
|
+
{serverSelect}
|
|
216
250
|
{path}
|
|
217
251
|
{urlQueryParams.length > 0 ? "?" : ""}
|
|
218
252
|
{urlQueryParams}
|
|
@@ -8,7 +8,12 @@ export const createUrl = (host: string, path: string, data: PlaygroundForm) => {
|
|
|
8
8
|
return value ?? match;
|
|
9
9
|
});
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
// Ensure host ends with a slash and path doesn't start with one,
|
|
12
|
+
// so they form a correct URL, without overriding the host's path.
|
|
13
|
+
const url = new URL(
|
|
14
|
+
filledPath.replace(/^\//, ""),
|
|
15
|
+
host.endsWith("/") ? host : `${host}/`,
|
|
16
|
+
);
|
|
12
17
|
|
|
13
18
|
data.queryParams
|
|
14
19
|
.filter((param) => param.active)
|
package/dist/lib/util/slugify.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"slugify.js","sourceRoot":"","sources":["../../../src/lib/util/slugify.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,eAAe,OAAO,CAAC"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import matter from "gray-matter";
|
|
2
|
-
import { readFile } from "node:fs/promises";
|
|
3
|
-
const matchIconAnnotation = /"icon":\s*"(.*?)"/g;
|
|
4
|
-
const toPascalCase = (str) => str.replace(/(^\w|-\w)/g, (match) => match.replace("-", "").toUpperCase());
|
|
5
|
-
export const replaceSidebarIcons = (code) => {
|
|
6
|
-
const collectedIcons = new Set();
|
|
7
|
-
let match;
|
|
8
|
-
while ((match = matchIconAnnotation.exec(code)) !== null) {
|
|
9
|
-
collectedIcons.add(match[1]);
|
|
10
|
-
}
|
|
11
|
-
const importStatement = `import { ${[...collectedIcons].map(toPascalCase).join(", ")} } from "zudoku/icons";`;
|
|
12
|
-
const replacedString = code.replaceAll(matchIconAnnotation,
|
|
13
|
-
// The element will be created by the implementers side
|
|
14
|
-
(_, iconName) => `"icon": ${toPascalCase(iconName)}`);
|
|
15
|
-
return `${importStatement}export const configuredSidebar = ${replacedString};`;
|
|
16
|
-
};
|
|
17
|
-
// This plugin is responsible to restart the dev server when a sidebar icon is changed inside a markdown file.
|
|
18
|
-
export const viteIconsPlugin = () => {
|
|
19
|
-
const iconMap = new Map();
|
|
20
|
-
return {
|
|
21
|
-
enforce: "pre",
|
|
22
|
-
name: "zudoku-icons-plugin",
|
|
23
|
-
configureServer: ({ watcher, restart }) => {
|
|
24
|
-
watcher.on("change", async (filePath) => {
|
|
25
|
-
if (/\.mdx?$/.test(filePath)) {
|
|
26
|
-
const code = await readFile(filePath, "utf-8");
|
|
27
|
-
const { sidebar_icon: sidebarIcon } = matter(code).data;
|
|
28
|
-
const previousIcon = iconMap.get(filePath);
|
|
29
|
-
if ((!previousIcon && sidebarIcon) ||
|
|
30
|
-
(previousIcon && !sidebarIcon) ||
|
|
31
|
-
previousIcon !== sidebarIcon) {
|
|
32
|
-
await restart();
|
|
33
|
-
}
|
|
34
|
-
iconMap.set(filePath, sidebarIcon);
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
},
|
|
38
|
-
async load(id) {
|
|
39
|
-
if (/\.mdx?$/.test(id)) {
|
|
40
|
-
const code = await readFile(id, "utf-8");
|
|
41
|
-
const { sidebar_icon: sidebarIcon } = matter(code).data;
|
|
42
|
-
iconMap.set(id, sidebarIcon);
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
//# sourceMappingURL=plugin-icons.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-icons.js","sourceRoot":"","sources":["../../src/vite/plugin-icons.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG5C,MAAM,mBAAmB,GAAG,oBAAoB,CAAC;AAEjD,MAAM,YAAY,GAAG,CAAC,GAAW,EAAE,EAAE,CACnC,GAAG,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;AAE7E,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,IAAY,EAAE,EAAE;IAClD,MAAM,cAAc,GAAG,IAAI,GAAG,EAAU,CAAC;IAEzC,IAAI,KAAK,CAAC;IACV,OAAO,CAAC,KAAK,GAAG,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QACzD,cAAc,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/B,CAAC;IAED,MAAM,eAAe,GAAG,YAAY,CAAC,GAAG,cAAc,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,yBAAyB,CAAC;IAC9G,MAAM,cAAc,GAAG,IAAI,CAAC,UAAU,CACpC,mBAAmB;IACnB,uDAAuD;IACvD,CAAC,CAAC,EAAE,QAAQ,EAAE,EAAE,CAAC,WAAW,YAAY,CAAC,QAAQ,CAAC,EAAE,CACrD,CAAC;IAEF,OAAO,GAAG,eAAe,oCAAoC,cAAc,GAAG,CAAC;AACjF,CAAC,CAAC;AAEF,8GAA8G;AAC9G,MAAM,CAAC,MAAM,eAAe,GAAG,GAAW,EAAE;IAC1C,MAAM,OAAO,GAAG,IAAI,GAAG,EAAyB,CAAC;IAEjD,OAAO;QACL,OAAO,EAAE,KAAK;QACd,IAAI,EAAE,qBAAqB;QAC3B,eAAe,EAAE,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE;YACxC,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE;gBACtC,IAAI,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;oBAC7B,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;oBAC/C,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC;oBACxD,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;oBAE3C,IACE,CAAC,CAAC,YAAY,IAAI,WAAW,CAAC;wBAC9B,CAAC,YAAY,IAAI,CAAC,WAAW,CAAC;wBAC9B,YAAY,KAAK,WAAW,EAC5B,CAAC;wBACD,MAAM,OAAO,EAAE,CAAC;oBAClB,CAAC;oBAED,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;gBACrC,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,EAAE;YACX,IAAI,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;gBACvB,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;gBACzC,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC;gBACxD,OAAO,CAAC,GAAG,CAAC,EAAE,EAAE,WAAW,CAAC,CAAC;YAC/B,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC,CAAC"}
|