zudoku 0.0.0-f3786a4 → 0.0.0-f3f6db5
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/app/main.js +1 -2
- package/dist/app/main.js.map +1 -1
- package/dist/config/validators/InputSidebarSchema.d.ts +2 -2
- package/dist/lib/components/PathRenderer.d.ts +11 -0
- package/dist/lib/components/PathRenderer.js +25 -0
- package/dist/lib/components/PathRenderer.js.map +1 -0
- package/dist/lib/components/ThemeSwitch.js +4 -4
- package/dist/lib/components/ThemeSwitch.js.map +1 -1
- package/dist/lib/components/index.d.ts +1 -0
- package/dist/lib/components/index.js +4 -2
- package/dist/lib/components/index.js.map +1 -1
- package/dist/lib/components/navigation/SidebarCategory.js +17 -15
- package/dist/lib/components/navigation/SidebarCategory.js.map +1 -1
- package/dist/lib/oas/graphql/circular.js +17 -6
- package/dist/lib/oas/graphql/circular.js.map +1 -1
- package/dist/lib/oas/graphql/index.d.ts +1 -0
- package/dist/lib/oas/graphql/index.js +41 -23
- package/dist/lib/oas/graphql/index.js.map +1 -1
- package/dist/lib/plugins/openapi/ColorizedParam.js +3 -1
- package/dist/lib/plugins/openapi/ColorizedParam.js.map +1 -1
- package/dist/lib/plugins/openapi/Endpoint.js +2 -2
- package/dist/lib/plugins/openapi/Endpoint.js.map +1 -1
- package/dist/lib/plugins/openapi/{Route.d.ts → OpenApiRoute.d.ts} +2 -1
- package/dist/lib/plugins/openapi/{Route.js → OpenApiRoute.js} +3 -4
- package/dist/lib/plugins/openapi/OpenApiRoute.js.map +1 -0
- package/dist/lib/plugins/openapi/OperationList.d.ts +4 -1
- package/dist/lib/plugins/openapi/OperationList.js +20 -14
- 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/ParameterListItem.js +2 -2
- package/dist/lib/plugins/openapi/ParameterListItem.js.map +1 -1
- package/dist/lib/plugins/openapi/RequestBodySidecarBox.d.ts +1 -1
- package/dist/lib/plugins/openapi/RequestBodySidecarBox.js +2 -0
- package/dist/lib/plugins/openapi/RequestBodySidecarBox.js.map +1 -1
- package/dist/lib/plugins/openapi/Sidecar.js +6 -11
- package/dist/lib/plugins/openapi/Sidecar.js.map +1 -1
- package/dist/lib/plugins/openapi/SidecarExamples.js +17 -14
- package/dist/lib/plugins/openapi/SidecarExamples.js.map +1 -1
- package/dist/lib/plugins/openapi/graphql/gql.d.ts +6 -2
- package/dist/lib/plugins/openapi/graphql/gql.js +3 -2
- package/dist/lib/plugins/openapi/graphql/gql.js.map +1 -1
- package/dist/lib/plugins/openapi/graphql/graphql.d.ts +47 -26
- package/dist/lib/plugins/openapi/graphql/graphql.js +20 -16
- package/dist/lib/plugins/openapi/graphql/graphql.js.map +1 -1
- package/dist/lib/plugins/openapi/index.js +97 -54
- package/dist/lib/plugins/openapi/index.js.map +1 -1
- package/dist/lib/plugins/openapi/interfaces.d.ts +1 -0
- package/dist/lib/plugins/openapi/playground/ExamplesDropdown.js +5 -5
- package/dist/lib/plugins/openapi/playground/ExamplesDropdown.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/Headers.js +17 -16
- package/dist/lib/plugins/openapi/playground/Headers.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/ParamsGrid.d.ts +5 -0
- package/dist/lib/plugins/openapi/playground/ParamsGrid.js +4 -0
- package/dist/lib/plugins/openapi/playground/ParamsGrid.js.map +1 -0
- package/dist/lib/plugins/openapi/playground/PathParams.js +4 -12
- package/dist/lib/plugins/openapi/playground/PathParams.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/Playground.d.ts +13 -0
- package/dist/lib/plugins/openapi/playground/Playground.js +25 -45
- package/dist/lib/plugins/openapi/playground/Playground.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/PlaygroundDialog.js +1 -1
- package/dist/lib/plugins/openapi/playground/PlaygroundDialog.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/QueryParams.js +4 -3
- package/dist/lib/plugins/openapi/playground/QueryParams.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/SubmitButton.d.ts +7 -0
- package/dist/lib/plugins/openapi/playground/SubmitButton.js +22 -0
- package/dist/lib/plugins/openapi/playground/SubmitButton.js.map +1 -0
- package/dist/lib/plugins/openapi/playground/result-panel/RequestTab.d.ts +7 -0
- package/dist/lib/plugins/openapi/playground/result-panel/RequestTab.js +11 -0
- package/dist/lib/plugins/openapi/playground/result-panel/RequestTab.js.map +1 -0
- package/dist/lib/plugins/openapi/playground/result-panel/ResponseTab.d.ts +8 -0
- package/dist/lib/plugins/openapi/playground/result-panel/ResponseTab.js +95 -0
- package/dist/lib/plugins/openapi/playground/result-panel/ResponseTab.js.map +1 -0
- package/dist/lib/plugins/openapi/playground/result-panel/ResultPanel.d.ts +7 -0
- package/dist/lib/plugins/openapi/playground/result-panel/ResultPanel.js +16 -0
- package/dist/lib/plugins/openapi/playground/result-panel/ResultPanel.js.map +1 -0
- package/dist/lib/plugins/openapi/playground/result-panel/convertToTypes.d.ts +10 -0
- package/dist/lib/plugins/openapi/playground/result-panel/convertToTypes.js +32 -0
- package/dist/lib/plugins/openapi/playground/result-panel/convertToTypes.js.map +1 -0
- package/dist/lib/plugins/openapi/playground/result-panel/convertToTypes.test.d.ts +1 -0
- package/dist/lib/plugins/openapi/playground/result-panel/convertToTypes.test.js +56 -0
- package/dist/lib/plugins/openapi/playground/result-panel/convertToTypes.test.js.map +1 -0
- package/dist/lib/plugins/openapi/schema/{SchemaComponents.js → SchemaPropertyItem.js} +10 -8
- package/dist/lib/plugins/openapi/schema/SchemaPropertyItem.js.map +1 -0
- package/dist/lib/plugins/openapi/schema/SchemaView.js +1 -1
- package/dist/lib/plugins/openapi/schema/SchemaView.js.map +1 -1
- package/dist/lib/plugins/openapi/schema/utils.d.ts +1 -0
- package/dist/lib/plugins/openapi/schema/utils.js +2 -0
- package/dist/lib/plugins/openapi/schema/utils.js.map +1 -1
- package/dist/lib/ui/Command.js +1 -1
- package/dist/lib/ui/Command.js.map +1 -1
- package/dist/lib/ui/Select.js +2 -2
- package/dist/lib/ui/Select.js.map +1 -1
- package/dist/lib/util/joinUrl.js +1 -1
- package/dist/lib/util/joinUrl.js.map +1 -1
- package/dist/lib/util/joinUrl.test.d.ts +1 -0
- package/dist/lib/util/joinUrl.test.js +43 -0
- package/dist/lib/util/joinUrl.test.js.map +1 -0
- package/dist/vite/plugin-api.js +9 -1
- package/dist/vite/plugin-api.js.map +1 -1
- package/dist/vite/prerender.js +0 -1
- package/dist/vite/prerender.js.map +1 -1
- package/lib/{AuthenticationPlugin-CvwlQWjV.js → AuthenticationPlugin-Du8cLBSr.js} +2 -2
- package/lib/{AuthenticationPlugin-CvwlQWjV.js.map → AuthenticationPlugin-Du8cLBSr.js.map} +1 -1
- package/lib/{Markdown-B8o9Qz4q.js → Markdown-Cyrx_JrO.js} +8 -9
- package/lib/{Markdown-B8o9Qz4q.js.map → Markdown-Cyrx_JrO.js.map} +1 -1
- package/lib/{MdxPage-DiWukCrZ.js → MdxPage-BuG8Tuwc.js} +5 -5
- package/lib/{MdxPage-DiWukCrZ.js.map → MdxPage-BuG8Tuwc.js.map} +1 -1
- package/lib/OpenApiRoute-UrC_t0e5.js +36 -0
- package/lib/OpenApiRoute-UrC_t0e5.js.map +1 -0
- package/lib/{OperationList-CyNwMHMV.js → OperationList-CDt1xdc4.js} +1925 -1902
- package/lib/OperationList-CDt1xdc4.js.map +1 -0
- package/lib/{Select-4kIgJ1bc.js → Select-CnCZ4WhS.js} +61 -61
- package/lib/Select-CnCZ4WhS.js.map +1 -0
- package/lib/{SlotletProvider-CtIp8rP3.js → SlotletProvider-mQiPDQIH.js} +2 -2
- package/lib/{SlotletProvider-CtIp8rP3.js.map → SlotletProvider-mQiPDQIH.js.map} +1 -1
- package/lib/{SyntaxHighlight-C1w1QPdY.js → SyntaxHighlight-B0L4SC_N.js} +11 -5
- package/lib/SyntaxHighlight-B0L4SC_N.js.map +1 -0
- package/lib/{ZudokuContext-Bp2uQx1d.js → ZudokuContext-BTUJPpQl.js} +36 -35
- package/lib/{ZudokuContext-Bp2uQx1d.js.map → ZudokuContext-BTUJPpQl.js.map} +1 -1
- package/lib/{circular-Dgpd6AN-.js → circular-DxaIIlWD.js} +251 -239
- package/lib/{circular-Dgpd6AN-.js.map → circular-DxaIIlWD.js.map} +1 -1
- package/lib/{createServer-BV0tHzLK.js → createServer-CjNktZzL.js} +821 -808
- package/lib/{createServer-BV0tHzLK.js.map → createServer-CjNktZzL.js.map} +1 -1
- package/lib/{hook-BDmay56y.js → hook-FT3SJLe_.js} +2 -2
- package/lib/{hook-BDmay56y.js.map → hook-FT3SJLe_.js.map} +1 -1
- package/lib/{index-LNp6rxyU.js → index-CjJS0l4l.js} +2 -2
- package/lib/{index-LNp6rxyU.js.map → index-CjJS0l4l.js.map} +1 -1
- package/lib/index-Eb1oiHbM.js +1997 -0
- package/lib/index-Eb1oiHbM.js.map +1 -0
- package/lib/{joinUrl-BTy9bvoK.js → joinUrl-nLx9pD-Z.js} +2 -2
- package/lib/joinUrl-nLx9pD-Z.js.map +1 -0
- package/lib/ui/Command.js +27 -27
- package/lib/ui/Command.js.map +1 -1
- package/lib/ui/Select.js +2 -2
- package/lib/ui/Select.js.map +1 -1
- package/lib/{useScrollToAnchor-S-NbG5Za.js → useScrollToAnchor-BZsGmBng.js} +86 -90
- package/lib/useScrollToAnchor-BZsGmBng.js.map +1 -0
- package/lib/zudoku.auth-clerk.js +1 -1
- package/lib/zudoku.auth-openid.js +3 -3
- package/lib/zudoku.components.js +364 -348
- package/lib/zudoku.components.js.map +1 -1
- package/lib/zudoku.plugin-api-catalog.js +3 -3
- package/lib/zudoku.plugin-api-keys.js +4 -4
- package/lib/zudoku.plugin-custom-pages.js +1 -1
- package/lib/zudoku.plugin-markdown.js +1 -1
- package/lib/zudoku.plugin-openapi.js +6 -5
- package/lib/zudoku.plugin-openapi.js.map +1 -1
- package/package.json +1 -1
- package/src/app/main.tsx +1 -2
- package/src/lib/components/PathRenderer.tsx +59 -0
- package/src/lib/components/ThemeSwitch.tsx +15 -14
- package/src/lib/components/index.ts +7 -5
- package/src/lib/components/navigation/SidebarCategory.tsx +44 -41
- package/src/lib/oas/graphql/circular.ts +27 -6
- package/src/lib/oas/graphql/index.ts +63 -35
- package/src/lib/plugins/openapi/ColorizedParam.tsx +3 -3
- package/src/lib/plugins/openapi/Endpoint.tsx +2 -2
- package/src/lib/plugins/openapi/{Route.tsx → OpenApiRoute.tsx} +3 -3
- package/src/lib/plugins/openapi/OperationList.tsx +34 -12
- package/src/lib/plugins/openapi/OperationListItem.tsx +6 -1
- package/src/lib/plugins/openapi/ParameterListItem.tsx +2 -1
- package/src/lib/plugins/openapi/RequestBodySidecarBox.tsx +2 -0
- package/src/lib/plugins/openapi/Sidecar.tsx +18 -27
- package/src/lib/plugins/openapi/SidecarExamples.tsx +24 -24
- package/src/lib/plugins/openapi/graphql/gql.ts +12 -4
- package/src/lib/plugins/openapi/graphql/graphql.ts +66 -43
- package/src/lib/plugins/openapi/index.tsx +125 -67
- package/src/lib/plugins/openapi/interfaces.ts +1 -0
- package/src/lib/plugins/openapi/playground/ExamplesDropdown.tsx +30 -27
- package/src/lib/plugins/openapi/playground/Headers.tsx +65 -65
- package/src/lib/plugins/openapi/playground/ParamsGrid.tsx +8 -0
- package/src/lib/plugins/openapi/playground/PathParams.tsx +34 -74
- package/src/lib/plugins/openapi/playground/Playground.tsx +86 -148
- package/src/lib/plugins/openapi/playground/PlaygroundDialog.tsx +1 -1
- package/src/lib/plugins/openapi/playground/QueryParams.tsx +46 -45
- package/src/lib/plugins/openapi/playground/SubmitButton.tsx +75 -0
- package/src/lib/plugins/openapi/playground/result-panel/RequestTab.tsx +73 -0
- package/src/lib/plugins/openapi/playground/result-panel/ResponseTab.tsx +210 -0
- package/src/lib/plugins/openapi/playground/result-panel/ResultPanel.tsx +101 -0
- package/src/lib/plugins/openapi/playground/result-panel/convertToTypes.test.ts +64 -0
- package/src/lib/plugins/openapi/playground/result-panel/convertToTypes.ts +36 -0
- package/src/lib/plugins/openapi/schema/{SchemaComponents.tsx → SchemaPropertyItem.tsx} +10 -6
- package/src/lib/plugins/openapi/schema/SchemaView.tsx +4 -1
- package/src/lib/plugins/openapi/schema/utils.ts +4 -0
- package/src/lib/ui/Command.tsx +1 -1
- package/src/lib/ui/Select.tsx +1 -1
- package/src/lib/util/joinUrl.test.ts +62 -0
- package/src/lib/util/joinUrl.ts +1 -1
- package/dist/lib/plugins/openapi/Route.js.map +0 -1
- package/dist/lib/plugins/openapi/playground/ResponseTab.d.ts +0 -4
- package/dist/lib/plugins/openapi/playground/ResponseTab.js +0 -42
- package/dist/lib/plugins/openapi/playground/ResponseTab.js.map +0 -1
- package/dist/lib/plugins/openapi/schema/SchemaComponents.js.map +0 -1
- package/lib/OperationList-CyNwMHMV.js.map +0 -1
- package/lib/Route-DH64hIrR.js +0 -35
- package/lib/Route-DH64hIrR.js.map +0 -1
- package/lib/Select-4kIgJ1bc.js.map +0 -1
- package/lib/StaggeredRender-DgsamH_G.js +0 -17
- package/lib/StaggeredRender-DgsamH_G.js.map +0 -1
- package/lib/SyntaxHighlight-C1w1QPdY.js.map +0 -1
- package/lib/index-Bn6Lc9tq.js +0 -9
- package/lib/index-Bn6Lc9tq.js.map +0 -1
- package/lib/index-BtNudmKQ.js +0 -1744
- package/lib/index-BtNudmKQ.js.map +0 -1
- package/lib/joinUrl-BTy9bvoK.js.map +0 -1
- package/lib/useScrollToAnchor-S-NbG5Za.js.map +0 -1
- package/src/lib/plugins/openapi/playground/ResponseTab.tsx +0 -76
- /package/dist/lib/plugins/openapi/schema/{SchemaComponents.d.ts → SchemaPropertyItem.d.ts} +0 -0
|
@@ -85,20 +85,20 @@ export const ServersQueryDocument = new TypedDocumentString(`
|
|
|
85
85
|
}
|
|
86
86
|
`);
|
|
87
87
|
export const AllOperationsDocument = new TypedDocumentString(`
|
|
88
|
-
query AllOperations($input: JSON!, $type: SchemaType
|
|
88
|
+
query AllOperations($input: JSON!, $type: SchemaType!, $tag: String, $untagged: Boolean) {
|
|
89
89
|
schema(input: $input, type: $type) {
|
|
90
90
|
description
|
|
91
91
|
summary
|
|
92
92
|
title
|
|
93
93
|
url
|
|
94
94
|
version
|
|
95
|
-
tags {
|
|
95
|
+
tags(name: $tag) {
|
|
96
96
|
name
|
|
97
97
|
description
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
98
|
+
}
|
|
99
|
+
operations(tag: $tag, untagged: $untagged) {
|
|
100
|
+
slug
|
|
101
|
+
...OperationsFragment
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
}
|
|
@@ -178,17 +178,21 @@ export const GetCategoriesDocument = new TypedDocumentString(`
|
|
|
178
178
|
schema(input: $input, type: $type) {
|
|
179
179
|
url
|
|
180
180
|
tags {
|
|
181
|
-
__typename
|
|
182
181
|
name
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
`);
|
|
186
|
+
export const GetOperationsDocument = new TypedDocumentString(`
|
|
187
|
+
query GetOperations($input: JSON!, $type: SchemaType!, $tag: String, $untagged: Boolean) {
|
|
188
|
+
schema(input: $input, type: $type) {
|
|
189
|
+
operations(tag: $tag, untagged: $untagged) {
|
|
190
|
+
slug
|
|
191
|
+
deprecated
|
|
192
|
+
method
|
|
193
|
+
summary
|
|
194
|
+
operationId
|
|
195
|
+
path
|
|
192
196
|
}
|
|
193
197
|
}
|
|
194
198
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphql.js","sourceRoot":"","sources":["../../../../../src/lib/plugins/openapi/graphql/graphql.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"graphql.js","sourceRoot":"","sources":["../../../../../src/lib/plugins/openapi/graphql/graphql.ts"],"names":[],"mappings":"AAmVA,MAAM,OAAO,mBACX,SAAQ,MAAM;IAMJ;IACD;IAJT,SAAS,CAA4D;IAErE,YACU,KAAa,EACd,QAA0C;QAEjD,KAAK,CAAC,KAAK,CAAC,CAAC;QAHL,UAAK,GAAL,KAAK,CAAQ;QACd,aAAQ,GAAR,QAAQ,CAAkC;IAGnD,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;CACF;AACD,MAAM,CAAC,MAAM,6BAA6B,GAAG,IAAI,mBAAmB,CAClE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA8DG,EACH,EAAE,YAAY,EAAE,oBAAoB,EAAE,CACgC,CAAC;AACzE,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,mBAAmB,CAAC;;;;;;;;;KASvD,CAGJ,CAAC;AACF,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,mBAAmB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8E3D,CAGD,CAAC;AACF,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,mBAAmB,CAAC;;;;;;;;;KASzD,CAGJ,CAAC;AACF,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,mBAAmB,CAAC;;;;;;;;;KASxD,CAGJ,CAAC;AACF,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,mBAAmB,CAAC;;;;;;;;;;;;;KAaxD,CAGJ,CAAC"}
|
|
@@ -1,28 +1,38 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import { graphql } from "./graphql/index.js";
|
|
2
|
+
import slugify from "@sindresorhus/slugify";
|
|
4
3
|
import { CirclePlayIcon, LogInIcon } from "lucide-react";
|
|
4
|
+
import { matchPath, redirect } from "react-router";
|
|
5
5
|
import { useAuth } from "../../authentication/hook.js";
|
|
6
6
|
import { Button } from "../../ui/Button.js";
|
|
7
|
-
import {
|
|
7
|
+
import { joinUrl } from "../../util/joinUrl.js";
|
|
8
8
|
import { GraphQLClient } from "./client/GraphQLClient.js";
|
|
9
|
+
import { graphql } from "./graphql/index.js";
|
|
9
10
|
import { PlaygroundDialog } from "./playground/PlaygroundDialog.js";
|
|
10
11
|
const GetCategoriesQuery = graphql(`
|
|
11
12
|
query GetCategories($input: JSON!, $type: SchemaType!) {
|
|
12
13
|
schema(input: $input, type: $type) {
|
|
13
14
|
url
|
|
14
15
|
tags {
|
|
15
|
-
__typename
|
|
16
16
|
name
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
`);
|
|
21
|
+
const GetOperationsQuery = graphql(`
|
|
22
|
+
query GetOperations(
|
|
23
|
+
$input: JSON!
|
|
24
|
+
$type: SchemaType!
|
|
25
|
+
$tag: String
|
|
26
|
+
$untagged: Boolean
|
|
27
|
+
) {
|
|
28
|
+
schema(input: $input, type: $type) {
|
|
29
|
+
operations(tag: $tag, untagged: $untagged) {
|
|
30
|
+
slug
|
|
31
|
+
deprecated
|
|
32
|
+
method
|
|
33
|
+
summary
|
|
34
|
+
operationId
|
|
35
|
+
path
|
|
26
36
|
}
|
|
27
37
|
}
|
|
28
38
|
}
|
|
@@ -36,8 +46,9 @@ const MethodColorMap = {
|
|
|
36
46
|
options: "gray",
|
|
37
47
|
head: "gray",
|
|
38
48
|
};
|
|
49
|
+
const UNTAGGED_PATH = "~endpoints";
|
|
39
50
|
export const openApiPlugin = (config) => {
|
|
40
|
-
const basePath =
|
|
51
|
+
const basePath = joinUrl(config.navigationId ?? "/reference");
|
|
41
52
|
const versions = config.type === "file" ? Object.keys(config.input) : [];
|
|
42
53
|
const client = new GraphQLClient(config);
|
|
43
54
|
return {
|
|
@@ -66,35 +77,45 @@ export const openApiPlugin = (config) => {
|
|
|
66
77
|
return [];
|
|
67
78
|
}
|
|
68
79
|
try {
|
|
69
|
-
const
|
|
70
|
-
|
|
80
|
+
const urlVersion = versions.find((v) => path.startsWith(joinUrl(basePath, v)));
|
|
81
|
+
const version = urlVersion ?? Object.keys(config.input).at(0);
|
|
71
82
|
const data = await client.fetch(GetCategoriesQuery, {
|
|
72
83
|
type: config.type,
|
|
73
84
|
input: config.type === "file" ? config.input[version] : config.input,
|
|
74
|
-
version,
|
|
75
85
|
});
|
|
86
|
+
const tag = config.tagPages?.find((tag) => path.split("/").at(-1) === slugify(tag));
|
|
87
|
+
const operationsData = await client.fetch(GetOperationsQuery, {
|
|
88
|
+
type: config.type,
|
|
89
|
+
input: config.type === "file" ? config.input[version] : config.input,
|
|
90
|
+
tag,
|
|
91
|
+
untagged: tag === undefined,
|
|
92
|
+
});
|
|
93
|
+
const items = operationsData.schema.operations.map((operation) => ({
|
|
94
|
+
type: "link",
|
|
95
|
+
label: operation.summary ?? operation.path,
|
|
96
|
+
href: `#${operation.slug}`,
|
|
97
|
+
badge: {
|
|
98
|
+
label: operation.method,
|
|
99
|
+
color: MethodColorMap[operation.method.toLowerCase()],
|
|
100
|
+
invert: true,
|
|
101
|
+
},
|
|
102
|
+
}));
|
|
76
103
|
const categories = data.schema.tags
|
|
77
|
-
.filter((tag) => tag.operations.length > 0)
|
|
78
|
-
.map((tag) =>
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
badge: {
|
|
88
|
-
label: operation.method,
|
|
89
|
-
color: MethodColorMap[operation.method.toLowerCase()],
|
|
90
|
-
invert: true,
|
|
104
|
+
// .filter((tag) => tag.operations.length > 0)
|
|
105
|
+
.map((tag) => {
|
|
106
|
+
const categoryLink = joinUrl(basePath, urlVersion, tag.name ? slugify(tag.name) : UNTAGGED_PATH);
|
|
107
|
+
return {
|
|
108
|
+
type: "category",
|
|
109
|
+
label: tag.name || "Other endpoints",
|
|
110
|
+
link: {
|
|
111
|
+
type: "doc",
|
|
112
|
+
id: categoryLink,
|
|
113
|
+
label: tag.name,
|
|
91
114
|
},
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
label: "Overview",
|
|
97
|
-
href: "#description",
|
|
115
|
+
collapsible: false,
|
|
116
|
+
collapsed: true,
|
|
117
|
+
items: path === categoryLink ? items : [],
|
|
118
|
+
};
|
|
98
119
|
});
|
|
99
120
|
return categories;
|
|
100
121
|
}
|
|
@@ -104,24 +125,46 @@ export const openApiPlugin = (config) => {
|
|
|
104
125
|
},
|
|
105
126
|
getRoutes: () => {
|
|
106
127
|
const versionsInPath = [null, ...versions];
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
const { OpenApiRoute } = await import("./Route.js");
|
|
111
|
-
return {
|
|
112
|
-
element: (_jsx(OpenApiRoute, { basePath: basePath, versions: versions, client: client, config: config })),
|
|
113
|
-
};
|
|
114
|
-
},
|
|
115
|
-
children: [
|
|
116
|
-
{
|
|
117
|
-
index: true,
|
|
118
|
-
async lazy() {
|
|
119
|
-
const { OperationList } = await import("./OperationList.js");
|
|
120
|
-
return { element: _jsx(OperationList, {}) };
|
|
121
|
-
},
|
|
122
|
-
},
|
|
123
|
-
],
|
|
128
|
+
const tagPages = (config.tagPages ?? []).map((tag) => ({
|
|
129
|
+
tag,
|
|
130
|
+
path: slugify(tag),
|
|
124
131
|
}));
|
|
132
|
+
return versionsInPath.map((version) => {
|
|
133
|
+
const versionPath = joinUrl(basePath, version ? `/${version}` : "");
|
|
134
|
+
return {
|
|
135
|
+
path: versionPath,
|
|
136
|
+
async lazy() {
|
|
137
|
+
const { OpenApiRoute } = await import("./OpenApiRoute.js");
|
|
138
|
+
return {
|
|
139
|
+
element: (_jsx(OpenApiRoute, { version: version ?? undefined, basePath: basePath, versions: versions, client: client, config: config })),
|
|
140
|
+
};
|
|
141
|
+
},
|
|
142
|
+
children: [
|
|
143
|
+
{
|
|
144
|
+
index: true,
|
|
145
|
+
loader: () => redirect(joinUrl(versionPath, tagPages.at(0)?.path ?? UNTAGGED_PATH)),
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
path: joinUrl(versionPath, UNTAGGED_PATH),
|
|
149
|
+
async lazy() {
|
|
150
|
+
const { OperationList } = await import("./OperationList.js");
|
|
151
|
+
return { element: _jsx(OperationList, { untagged: true }) };
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
...tagPages.map((tag) => {
|
|
155
|
+
return {
|
|
156
|
+
path: joinUrl(versionPath, tag.path),
|
|
157
|
+
async lazy() {
|
|
158
|
+
const { OperationList } = await import("./OperationList.js");
|
|
159
|
+
return {
|
|
160
|
+
element: _jsx(OperationList, { tag: tag.tag }),
|
|
161
|
+
};
|
|
162
|
+
},
|
|
163
|
+
};
|
|
164
|
+
}),
|
|
165
|
+
],
|
|
166
|
+
};
|
|
167
|
+
});
|
|
125
168
|
},
|
|
126
169
|
};
|
|
127
170
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/plugins/openapi/index.tsx"],"names":[],"mappings":";AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/plugins/openapi/index.tsx"],"names":[],"mappings":";AAAA,OAAO,OAAO,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAe,MAAM,cAAc,CAAC;AAEhE,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAIvD,OAA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AAI,EAAE,OAAO,CAAC,WAAW,EAAE,GAAG,CAAC,IAAI,CAAC;gCACpC,KAAK,CAAC,IAAI;oCACR,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,MAAM,CAAC,oBAAoB,CAAC,CAAC;oCAC7D,OAAO;wCACL,OAAO,EAAE,KAAC,aAAa,IAAC,GAAG,EAAE,GAAG,CAAC,GAAG,GAAI;qCACzC,CAAC;gCACJ,CAAC;6BACF,CAAC;wBACJ,CAAC,CAAC;qBACH;iBACF,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -2,11 +2,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Button } from "zudoku/ui/Button.js";
|
|
3
3
|
import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, } from "zudoku/ui/DropdownMenu.js";
|
|
4
4
|
const ExamplesDropdown = ({ examples, onSelect, }) => {
|
|
5
|
-
return (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "outline", children: "Use Example" }) }), _jsx(DropdownMenuContent, { className: "w-56", children: examples.map((example) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
return (_jsx("div", { className: "flex flex-col gap-2 mt-2 items-end", children: _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "outline", children: "Use Example" }) }), _jsx(DropdownMenuContent, { className: "w-56", children: examples.map((example) => {
|
|
6
|
+
return (_jsxs("div", { children: [_jsx(DropdownMenuLabel, { children: example.mediaType }), _jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuGroup, { children: example.examples?.map((example) => {
|
|
7
|
+
return (_jsx(DropdownMenuItem, { onSelect: () => onSelect(example), className: "line-clamp-1", children: example.summary ?? example.name }, example.name));
|
|
8
|
+
}) })] }, example.mediaType));
|
|
9
|
+
}) })] }) }));
|
|
10
10
|
};
|
|
11
11
|
export default ExamplesDropdown;
|
|
12
12
|
//# sourceMappingURL=ExamplesDropdown.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExamplesDropdown.js","sourceRoot":"","sources":["../../../../../src/lib/plugins/openapi/playground/ExamplesDropdown.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,2BAA2B,CAAC;AAGnC,MAAM,gBAAgB,GAAG,CAAC,EACxB,QAAQ,EACR,QAAQ,GAIT,EAAE,EAAE;IACH,OAAO,CACL,MAAC,YAAY,eACX,KAAC,mBAAmB,IAAC,OAAO,kBAC1B,KAAC,MAAM,IAAC,OAAO,EAAC,SAAS,4BAAqB,GAC1B,EACtB,KAAC,mBAAmB,IAAC,SAAS,EAAC,MAAM,YAClC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;
|
|
1
|
+
{"version":3,"file":"ExamplesDropdown.js","sourceRoot":"","sources":["../../../../../src/lib/plugins/openapi/playground/ExamplesDropdown.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,2BAA2B,CAAC;AAGnC,MAAM,gBAAgB,GAAG,CAAC,EACxB,QAAQ,EACR,QAAQ,GAIT,EAAE,EAAE;IACH,OAAO,CACL,cAAK,SAAS,EAAC,oCAAoC,YACjD,MAAC,YAAY,eACX,KAAC,mBAAmB,IAAC,OAAO,kBAC1B,KAAC,MAAM,IAAC,OAAO,EAAC,SAAS,4BAAqB,GAC1B,EACtB,KAAC,mBAAmB,IAAC,SAAS,EAAC,MAAM,YAClC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;wBACxB,OAAO,CACL,0BACE,KAAC,iBAAiB,cAAE,OAAO,CAAC,SAAS,GAAqB,EAC1D,KAAC,qBAAqB,KAAG,EACzB,KAAC,iBAAiB,cACf,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;wCACjC,OAAO,CACL,KAAC,gBAAgB,IAEf,QAAQ,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,EACjC,SAAS,EAAC,cAAc,YAEvB,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,IAAI,IAJ3B,OAAO,CAAC,IAAI,CAKA,CACpB,CAAC;oCACJ,CAAC,CAAC,GACgB,KAfZ,OAAO,CAAC,SAAS,CAgBrB,CACP,CAAC;oBACJ,CAAC,CAAC,GACkB,IACT,GACX,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -7,6 +7,7 @@ import { Checkbox } from "zudoku/ui/Checkbox.js";
|
|
|
7
7
|
import { Autocomplete } from "../../../components/Autocomplete.js";
|
|
8
8
|
import { Button } from "../../../ui/Button.js";
|
|
9
9
|
import { Input } from "../../../ui/Input.js";
|
|
10
|
+
import ParamsGrid from "./ParamsGrid.js";
|
|
10
11
|
const headerOptions = Object.freeze([
|
|
11
12
|
"Accept",
|
|
12
13
|
"Accept-Encoding",
|
|
@@ -57,21 +58,21 @@ export const Headers = ({ control, register, }) => {
|
|
|
57
58
|
addNewHeader();
|
|
58
59
|
requestAnimationFrame(() => nameRefs.current[index + 1]?.focus());
|
|
59
60
|
};
|
|
60
|
-
return (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Card, { className: "
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
61
|
+
return (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Card, { className: "overflow-hidden", children: _jsx(ParamsGrid, { children: fields.map((header, i) => (_jsxs("div", { className: "group grid col-span-full grid-cols-subgrid", children: [_jsxs("div", { className: "flex items-center gap-2 ", children: [_jsx(Controller, { control: control, name: `headers.${i}.active`, render: ({ field }) => (_jsx(Checkbox, { variant: "outline", id: `headers.${i}.active`, checked: field.value, onCheckedChange: (checked) => {
|
|
62
|
+
field.onChange(checked);
|
|
63
|
+
} })) }), _jsx(Controller, { control: control, name: `headers.${i}.name`, render: ({ field }) => (_jsx(Autocomplete, { ...field, placeholder: "Name", className: "border-0 shadow-none bg-transparent text-xs font-mono", options: headerOptions, onEnterPress: () => handleHeaderEnter(i), onChange: (e) => {
|
|
64
|
+
field.onChange(e);
|
|
65
|
+
setValue(`headers.${i}.active`, true);
|
|
66
|
+
}, ref: (el) => {
|
|
67
|
+
nameRefs.current[i] = el;
|
|
68
|
+
} })) })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Controller, { control: control, name: `headers.${i}.value`, render: ({ field }) => (_jsx(Input, { placeholder: "Value", className: "w-full border-0 shadow-none text-xs font-mono focus-visible:ring-0", ...field, ref: (el) => {
|
|
69
|
+
valueRefs.current[i] = el;
|
|
70
|
+
}, onKeyDown: (e) => {
|
|
71
|
+
if (e.key === "Enter" && e.currentTarget.value.trim()) {
|
|
72
|
+
handleValueEnter(i);
|
|
73
|
+
}
|
|
74
|
+
}, autoComplete: "off" })) }), _jsx(Button, { size: "icon", variant: "ghost", className: "text-muted-foreground opacity-0 group-hover:opacity-100 rounded-full w-8 h-7", onClick: () => {
|
|
75
|
+
remove(i);
|
|
76
|
+
}, type: "button", children: _jsx(XIcon, { size: 16 }) })] })] }, i))) }) }), _jsx("div", { className: "text-end", children: _jsx(Button, { className: "", onClick: addNewHeader, type: "button", variant: "secondary", children: "Add header" }) })] }));
|
|
76
77
|
};
|
|
77
78
|
//# sourceMappingURL=Headers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Headers.js","sourceRoot":"","sources":["../../../../../src/lib/plugins/openapi/playground/Headers.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC/B,OAAO,EAEL,UAAU,EACV,aAAa,EACb,cAAc,GAEf,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"Headers.js","sourceRoot":"","sources":["../../../../../src/lib/plugins/openapi/playground/Headers.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC/B,OAAO,EAEL,UAAU,EACV,aAAa,EACb,cAAc,GAEf,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AA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ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
|
|
2
|
+
className?: import("clsx").ClassValue;
|
|
3
|
+
asChild?: boolean;
|
|
4
|
+
}, "ref"> & import("react").RefAttributes<HTMLElement>>;
|
|
5
|
+
export default ParamsGrid;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ParamsGrid.js","sourceRoot":"","sources":["../../../../../src/lib/plugins/openapi/playground/ParamsGrid.tsx"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,MAAM,yCAAyC,CAAC;AAE7E,MAAM,UAAU,GAAG,sBAAsB,CACvC,KAAK,EACL,qEAAqE,CACtE,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -1,22 +1,14 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { EraserIcon } from "lucide-react";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
2
|
import { Controller, useFieldArray } from "react-hook-form";
|
|
4
3
|
import { Card } from "zudoku/ui/Card.js";
|
|
5
|
-
import { Button } from "../../../ui/Button.js";
|
|
6
4
|
import { Input } from "../../../ui/Input.js";
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
const PathParamLabel = ({ name }) => {
|
|
10
|
-
const color = useParamColor(name);
|
|
11
|
-
return (_jsxs("div", { className: "flex items-center", children: [_jsx("div", { className: "w-2 h-2 rounded-full", style: { backgroundColor: `hsl(${color})` } }), _jsx(ColorizedParam, { slug: name, name: name, className: "font-mono text-xs m-2 px-1" })] }));
|
|
12
|
-
};
|
|
5
|
+
import { ColorizedParam } from "../ColorizedParam.js";
|
|
6
|
+
import ParamsGrid from "./ParamsGrid.js";
|
|
13
7
|
export const PathParams = ({ control, }) => {
|
|
14
8
|
const { fields } = useFieldArray({
|
|
15
9
|
control,
|
|
16
10
|
name: "pathParams",
|
|
17
11
|
});
|
|
18
|
-
return (_jsx(Card, { className: "rounded-lg", children: _jsx(
|
|
19
|
-
? "opacity-0 pointer-events-none"
|
|
20
|
-
: "opacity-100"), title: "Clear value", onClick: () => field.onChange(""), children: _jsx(EraserIcon, { size: 16 }) })) })] }) })] }, part.id))) }) }) }));
|
|
12
|
+
return (_jsx(Card, { className: "rounded-lg", children: _jsx(ParamsGrid, { children: fields.map((part, i) => (_jsxs(_Fragment, { children: [_jsx(Controller, { control: control, name: `pathParams.${i}.name`, render: () => (_jsx("div", { children: _jsx(ColorizedParam, { slug: part.name, name: part.name, className: "font-mono text-xs px-2" }) })) }), _jsx("div", { className: "flex justify-between items-center", children: _jsx(Controller, { control: control, name: `pathParams.${i}.value`, render: ({ field }) => (_jsx(Input, { ...field, required: true, placeholder: "Enter value", className: "w-full border-0 shadow-none text-xs font-mono hover:bg-accent" })) }) })] }))) }) }));
|
|
21
13
|
};
|
|
22
14
|
//# sourceMappingURL=PathParams.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PathParams.js","sourceRoot":"","sources":["../../../../../src/lib/plugins/openapi/playground/PathParams.tsx"],"names":[],"mappings":";AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"PathParams.js","sourceRoot":"","sources":["../../../../../src/lib/plugins/openapi/playground/PathParams.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAW,UAAU,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,UAAU,MAAM,iBAAiB,CAAC;AAGzC,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,EACzB,OAAO,GAGR,EAAE,EAAE;IACH,MAAM,EAAE,MAAM,EAAE,GAAG,aAAa,CAAiB;QAC/C,OAAO;QACP,IAAI,EAAE,YAAY;KACnB,CAAC,CAAC;IAEH,OAAO,CACL,KAAC,IAAI,IAAC,SAAS,EAAC,YAAY,YAC1B,KAAC,UAAU,cACR,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CACvB,8BACE,KAAC,UAAU,IACT,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,cAAc,CAAC,OAAO,EAC5B,MAAM,EAAE,GAAG,EAAE,CAAC,CACZ,wBACE,KAAC,cAAc,IACb,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,SAAS,EAAC,wBAAwB,GAClC,GACE,CACP,GACD,EAEF,cAAK,SAAS,EAAC,mCAAmC,YAChD,KAAC,UAAU,IACT,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,cAAc,CAAC,QAAQ,EAC7B,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CACrB,KAAC,KAAK,OACA,KAAK,EACT,QAAQ,QACR,WAAW,EAAC,aAAa,EACzB,SAAS,EAAC,+DAA+D,GACzE,CACH,GACD,GACE,IACL,CACJ,CAAC,GACS,GACR,CACR,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -37,6 +37,19 @@ export type PlaygroundForm = {
|
|
|
37
37
|
}>;
|
|
38
38
|
identity?: string;
|
|
39
39
|
};
|
|
40
|
+
export type PlaygroundResult = {
|
|
41
|
+
status: number;
|
|
42
|
+
headers: Array<[string, string]>;
|
|
43
|
+
size: number;
|
|
44
|
+
body: string;
|
|
45
|
+
time: number;
|
|
46
|
+
request: {
|
|
47
|
+
method: string;
|
|
48
|
+
url: string;
|
|
49
|
+
headers: Array<[string, string]>;
|
|
50
|
+
body?: string;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
40
53
|
export type PlaygroundContentProps = {
|
|
41
54
|
server: string;
|
|
42
55
|
servers?: string[];
|