zudoku 0.26.1 → 0.28.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/app/main.d.ts +1 -1
- package/dist/app/main.js +19 -7
- package/dist/app/main.js.map +1 -1
- package/dist/config/loader.js +1 -1
- package/dist/config/loader.js.map +1 -1
- package/dist/config/validators/InputSidebarSchema.d.ts +2 -2
- package/dist/config/validators/common.d.ts +67 -0
- package/dist/config/validators/common.js +5 -0
- package/dist/config/validators/common.js.map +1 -1
- package/dist/config/validators/validate.d.ts +29 -0
- package/dist/lib/components/AnchorLink.js +5 -2
- package/dist/lib/components/AnchorLink.js.map +1 -1
- package/dist/lib/components/Header.js +1 -1
- package/dist/lib/components/Header.js.map +1 -1
- package/dist/lib/components/Heading.d.ts +1 -1
- package/dist/lib/components/Markdown.d.ts +2 -2
- package/dist/lib/components/Markdown.js +3 -1
- package/dist/lib/components/Markdown.js.map +1 -1
- package/dist/lib/components/StatusPage.d.ts +7 -0
- package/dist/lib/components/StatusPage.js +71 -0
- package/dist/lib/components/StatusPage.js.map +1 -0
- package/dist/lib/components/SyntaxHighlight.d.ts +2 -1
- package/dist/lib/components/SyntaxHighlight.js +2 -2
- package/dist/lib/components/SyntaxHighlight.js.map +1 -1
- package/dist/lib/components/ThemeSwitch.js +4 -4
- package/dist/lib/components/ThemeSwitch.js.map +1 -1
- package/dist/lib/components/cache.d.ts +6 -0
- package/dist/lib/components/cache.js +13 -0
- package/dist/lib/components/cache.js.map +1 -0
- package/dist/lib/components/context/ViewportAnchorContext.js +16 -4
- package/dist/lib/components/context/ViewportAnchorContext.js.map +1 -1
- package/dist/lib/components/context/ZudokuContext.js +2 -1
- package/dist/lib/components/context/ZudokuContext.js.map +1 -1
- package/dist/lib/components/index.d.ts +9 -2
- package/dist/lib/components/index.js +3 -0
- package/dist/lib/components/index.js.map +1 -1
- package/dist/lib/components/navigation/SidebarCategory.js +3 -3
- package/dist/lib/components/navigation/SidebarCategory.js.map +1 -1
- package/dist/lib/core/RouteGuard.d.ts +1 -0
- package/dist/lib/core/RouteGuard.js +28 -0
- package/dist/lib/core/RouteGuard.js.map +1 -0
- package/dist/lib/core/ZudokuContext.d.ts +4 -2
- package/dist/lib/core/ZudokuContext.js +9 -7
- package/dist/lib/core/ZudokuContext.js.map +1 -1
- package/dist/lib/oas/graphql/circular.d.ts +3 -0
- package/dist/lib/oas/graphql/circular.js +27 -0
- package/dist/lib/oas/graphql/circular.js.map +1 -0
- package/dist/lib/oas/graphql/index.d.ts +1 -0
- package/dist/lib/oas/graphql/index.js +46 -29
- package/dist/lib/oas/graphql/index.js.map +1 -1
- package/dist/lib/oas/parser/dereference/index.d.ts +0 -1
- package/dist/lib/oas/parser/dereference/index.js +1 -1
- package/dist/lib/oas/parser/dereference/index.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 +1 -1
- 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 +3 -3
- 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 +101 -65
- package/dist/lib/plugins/openapi/index.js.map +1 -1
- package/dist/lib/plugins/openapi/interfaces.d.ts +8 -2
- 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 +19 -31
- 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 +1 -1
- package/dist/lib/plugins/openapi/schema/SchemaComponents.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/MdxComponents.js +2 -2
- package/dist/lib/util/MdxComponents.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/lib/util/useScrollToAnchor.d.ts +1 -0
- package/dist/lib/util/useScrollToAnchor.js +26 -15
- package/dist/lib/util/useScrollToAnchor.js.map +1 -1
- package/dist/vite/plugin-api.js +15 -3
- package/dist/vite/plugin-api.js.map +1 -1
- package/dist/vite/prerender.js +1 -0
- package/dist/vite/prerender.js.map +1 -1
- package/dist/zuplo/enrich-with-zuplo.js +1 -1
- package/dist/zuplo/enrich-with-zuplo.js.map +1 -1
- package/dist/zuplo/with-zuplo.d.ts +2 -1
- package/dist/zuplo/with-zuplo.js +3 -1
- package/dist/zuplo/with-zuplo.js.map +1 -1
- package/lib/{AuthenticationPlugin-C9SwOxkc.js → AuthenticationPlugin-Du8cLBSr.js} +3 -3
- package/lib/{AuthenticationPlugin-C9SwOxkc.js.map → AuthenticationPlugin-Du8cLBSr.js.map} +1 -1
- package/lib/{Markdown-DFN6p0J-.js → Markdown-Cyrx_JrO.js} +1195 -1185
- package/lib/{Markdown-DFN6p0J-.js.map → Markdown-Cyrx_JrO.js.map} +1 -1
- package/lib/{MdxPage-D9c4z09Q.js → MdxPage-DewragjB.js} +6 -6
- package/lib/{MdxPage-D9c4z09Q.js.map → MdxPage-DewragjB.js.map} +1 -1
- package/lib/OpenApiRoute-UrC_t0e5.js +36 -0
- package/lib/OpenApiRoute-UrC_t0e5.js.map +1 -0
- package/lib/{OperationList-DGJWDx1G.js → OperationList-D_ejrepA.js} +1970 -1957
- package/lib/OperationList-D_ejrepA.js.map +1 -0
- package/lib/{Select-D3O7wISy.js → Select-CnCZ4WhS.js} +61 -61
- package/lib/Select-CnCZ4WhS.js.map +1 -0
- package/lib/{SlotletProvider-_3zzX_g_.js → SlotletProvider-mQiPDQIH.js} +4 -4
- package/lib/{SlotletProvider-_3zzX_g_.js.map → SlotletProvider-mQiPDQIH.js.map} +1 -1
- package/lib/{SyntaxHighlight-CJCSPG1F.js → SyntaxHighlight-B0L4SC_N.js} +309 -298
- package/lib/SyntaxHighlight-B0L4SC_N.js.map +1 -0
- package/lib/{ZudokuContext-DeQZEp-x.js → ZudokuContext-BTUJPpQl.js} +257 -246
- package/lib/ZudokuContext-BTUJPpQl.js.map +1 -0
- package/lib/{chunk-SYFQ2XB5-BF5IDYrB.js → chunk-SYFQ2XB5-BPvC-soB.js} +5 -5
- package/lib/{chunk-SYFQ2XB5-BF5IDYrB.js.map → chunk-SYFQ2XB5-BPvC-soB.js.map} +1 -1
- package/lib/circular-Dgpd6AN-.js +15397 -0
- package/lib/circular-Dgpd6AN-.js.map +1 -0
- package/lib/{createServer-BcaswoFO.js → createServer-BydbkTsd.js} +3487 -5601
- package/lib/createServer-BydbkTsd.js.map +1 -0
- package/lib/{hook-BRQEDRbn.js → hook-FT3SJLe_.js} +2 -2
- package/lib/{hook-BRQEDRbn.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-DGugJOLc.js +1974 -0
- package/lib/index-DGugJOLc.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/{useExposedProps-CetwhZpP.js → useExposedProps-BLKFBylA.js} +2 -2
- package/lib/{useExposedProps-CetwhZpP.js.map → useExposedProps-BLKFBylA.js.map} +1 -1
- package/lib/useScrollToAnchor-eRM9tVvD.js +289 -0
- package/lib/useScrollToAnchor-eRM9tVvD.js.map +1 -0
- package/lib/zudoku.auth-clerk.js +1 -1
- package/lib/zudoku.auth-openid.js +4 -4
- package/lib/zudoku.components.js +740 -979
- package/lib/zudoku.components.js.map +1 -1
- package/lib/zudoku.plugin-api-catalog.js +4 -4
- package/lib/zudoku.plugin-api-keys.js +5 -5
- package/lib/zudoku.plugin-custom-pages.js +2 -2
- 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/lib/zudoku.plugin-redirect.js +1 -1
- package/package.json +2 -2
- package/src/app/main.tsx +26 -7
- package/src/lib/components/AnchorLink.tsx +5 -2
- package/src/lib/components/Header.tsx +1 -1
- package/src/lib/components/Markdown.tsx +14 -15
- package/src/lib/components/StatusPage.tsx +91 -0
- package/src/lib/components/SyntaxHighlight.tsx +14 -0
- package/src/lib/components/ThemeSwitch.tsx +14 -15
- package/src/lib/components/cache.ts +15 -0
- package/src/lib/components/context/ViewportAnchorContext.tsx +20 -6
- package/src/lib/components/context/ZudokuContext.ts +3 -1
- package/src/lib/components/index.ts +7 -0
- package/src/lib/components/navigation/SidebarCategory.tsx +3 -2
- package/src/lib/core/RouteGuard.tsx +35 -0
- package/src/lib/core/ZudokuContext.ts +9 -8
- package/src/lib/oas/graphql/circular.ts +29 -0
- package/src/lib/oas/graphql/index.ts +72 -44
- package/src/lib/oas/parser/dereference/index.ts +1 -2
- 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 +0 -2
- package/src/lib/plugins/openapi/ParameterListItem.tsx +1 -0
- package/src/lib/plugins/openapi/RequestBodySidecarBox.tsx +2 -0
- package/src/lib/plugins/openapi/Sidecar.tsx +4 -3
- 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 +134 -82
- package/src/lib/plugins/openapi/interfaces.ts +11 -2
- 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 +64 -116
- 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 +1 -1
- package/src/lib/ui/Command.tsx +1 -1
- package/src/lib/ui/Select.tsx +1 -1
- package/src/lib/util/MdxComponents.tsx +2 -1
- package/src/lib/util/joinUrl.test.ts +62 -0
- package/src/lib/util/joinUrl.ts +1 -1
- package/src/lib/util/useScrollToAnchor.ts +32 -15
- 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/lib/AnchorLink-bObQitZv.js +0 -34
- package/lib/AnchorLink-bObQitZv.js.map +0 -1
- package/lib/OperationList-DGJWDx1G.js.map +0 -1
- package/lib/Route-VdmEyOD0.js +0 -35
- package/lib/Route-VdmEyOD0.js.map +0 -1
- package/lib/Select-D3O7wISy.js.map +0 -1
- package/lib/StaggeredRender-DgsamH_G.js +0 -17
- package/lib/StaggeredRender-DgsamH_G.js.map +0 -1
- package/lib/SyntaxHighlight-CJCSPG1F.js.map +0 -1
- package/lib/ZudokuContext-DeQZEp-x.js.map +0 -1
- package/lib/createServer-BcaswoFO.js.map +0 -1
- package/lib/index-Bn6Lc9tq.js +0 -9
- package/lib/index-Bn6Lc9tq.js.map +0 -1
- package/lib/index-CXRrqOIl.js +0 -1750
- package/lib/index-CXRrqOIl.js.map +0 -1
- package/lib/index-TaRXY2w1.js +0 -43
- package/lib/index-TaRXY2w1.js.map +0 -1
- package/lib/joinUrl-BTy9bvoK.js.map +0 -1
- package/src/lib/plugins/openapi/playground/ResponseTab.tsx +0 -76
|
@@ -31,6 +31,8 @@ export type Scalars = {
|
|
|
31
31
|
JSON: { input: any; output: any };
|
|
32
32
|
/** The `JSONObject` scalar type represents JSON objects as specified by [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf). */
|
|
33
33
|
JSONObject: { input: any; output: any };
|
|
34
|
+
/** OpenAPI schema scalar type that handles circular references */
|
|
35
|
+
JSONSchema: { input: any; output: any };
|
|
34
36
|
};
|
|
35
37
|
|
|
36
38
|
export type EncodingItem = {
|
|
@@ -57,7 +59,7 @@ export type MediaTypeObject = {
|
|
|
57
59
|
encoding?: Maybe<Array<EncodingItem>>;
|
|
58
60
|
examples?: Maybe<Array<ExampleItem>>;
|
|
59
61
|
mediaType: Scalars["String"]["output"];
|
|
60
|
-
schema?: Maybe<Scalars["
|
|
62
|
+
schema?: Maybe<Scalars["JSONSchema"]["output"]>;
|
|
61
63
|
};
|
|
62
64
|
|
|
63
65
|
export type OperationItem = {
|
|
@@ -89,7 +91,7 @@ export type ParameterItem = {
|
|
|
89
91
|
in: ParameterIn;
|
|
90
92
|
name: Scalars["String"]["output"];
|
|
91
93
|
required?: Maybe<Scalars["Boolean"]["output"]>;
|
|
92
|
-
schema?: Maybe<Scalars["
|
|
94
|
+
schema?: Maybe<Scalars["JSONSchema"]["output"]>;
|
|
93
95
|
style?: Maybe<Scalars["String"]["output"]>;
|
|
94
96
|
};
|
|
95
97
|
|
|
@@ -132,11 +134,11 @@ export type Schema = {
|
|
|
132
134
|
operations: Array<OperationItem>;
|
|
133
135
|
paths: Array<PathItem>;
|
|
134
136
|
servers: Array<Server>;
|
|
137
|
+
summary?: Maybe<Scalars["String"]["output"]>;
|
|
135
138
|
tags: Array<SchemaTag>;
|
|
136
139
|
title: Scalars["String"]["output"];
|
|
137
|
-
url
|
|
140
|
+
url?: Maybe<Scalars["String"]["output"]>;
|
|
138
141
|
version: Scalars["String"]["output"];
|
|
139
|
-
summary?: Maybe<Scalars["String"]["output"]>;
|
|
140
142
|
};
|
|
141
143
|
|
|
142
144
|
export type SchemaOperationsArgs = {
|
|
@@ -144,6 +146,7 @@ export type SchemaOperationsArgs = {
|
|
|
144
146
|
operationId?: InputMaybe<Scalars["String"]["input"]>;
|
|
145
147
|
path?: InputMaybe<Scalars["String"]["input"]>;
|
|
146
148
|
tag?: InputMaybe<Scalars["String"]["input"]>;
|
|
149
|
+
untagged?: InputMaybe<Scalars["Boolean"]["input"]>;
|
|
147
150
|
};
|
|
148
151
|
|
|
149
152
|
export type SchemaTagsArgs = {
|
|
@@ -180,7 +183,7 @@ export type ServersQueryQuery = {
|
|
|
180
183
|
__typename?: "Query";
|
|
181
184
|
schema: {
|
|
182
185
|
__typename?: "Schema";
|
|
183
|
-
url
|
|
186
|
+
url?: string | null;
|
|
184
187
|
servers: Array<{ __typename?: "Server"; url: string }>;
|
|
185
188
|
};
|
|
186
189
|
};
|
|
@@ -255,6 +258,8 @@ export type OperationsFragmentFragment = {
|
|
|
255
258
|
export type AllOperationsQueryVariables = Exact<{
|
|
256
259
|
input: Scalars["JSON"]["input"];
|
|
257
260
|
type: SchemaType;
|
|
261
|
+
tag?: InputMaybe<Scalars["String"]["input"]>;
|
|
262
|
+
untagged?: InputMaybe<Scalars["Boolean"]["input"]>;
|
|
258
263
|
}>;
|
|
259
264
|
|
|
260
265
|
export type AllOperationsQuery = {
|
|
@@ -264,20 +269,20 @@ export type AllOperationsQuery = {
|
|
|
264
269
|
description?: string | null;
|
|
265
270
|
summary?: string | null;
|
|
266
271
|
title: string;
|
|
267
|
-
url
|
|
272
|
+
url?: string | null;
|
|
268
273
|
version: string;
|
|
269
274
|
tags: Array<{
|
|
270
275
|
__typename?: "SchemaTag";
|
|
271
276
|
name?: string | null;
|
|
272
277
|
description?: string | null;
|
|
273
|
-
operations: Array<
|
|
274
|
-
{ __typename?: "OperationItem"; slug: string } & {
|
|
275
|
-
" $fragmentRefs"?: {
|
|
276
|
-
OperationsFragmentFragment: OperationsFragmentFragment;
|
|
277
|
-
};
|
|
278
|
-
}
|
|
279
|
-
>;
|
|
280
278
|
}>;
|
|
279
|
+
operations: Array<
|
|
280
|
+
{ __typename?: "OperationItem"; slug: string } & {
|
|
281
|
+
" $fragmentRefs"?: {
|
|
282
|
+
OperationsFragmentFragment: OperationsFragmentFragment;
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
>;
|
|
281
286
|
};
|
|
282
287
|
};
|
|
283
288
|
|
|
@@ -290,7 +295,7 @@ export type GetServerQueryQuery = {
|
|
|
290
295
|
__typename?: "Query";
|
|
291
296
|
schema: {
|
|
292
297
|
__typename?: "Schema";
|
|
293
|
-
url
|
|
298
|
+
url?: string | null;
|
|
294
299
|
servers: Array<{ __typename?: "Server"; url: string }>;
|
|
295
300
|
};
|
|
296
301
|
};
|
|
@@ -304,19 +309,30 @@ export type GetCategoriesQuery = {
|
|
|
304
309
|
__typename?: "Query";
|
|
305
310
|
schema: {
|
|
306
311
|
__typename?: "Schema";
|
|
307
|
-
url
|
|
308
|
-
tags: Array<{
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
312
|
+
url?: string | null;
|
|
313
|
+
tags: Array<{ __typename?: "SchemaTag"; name?: string | null }>;
|
|
314
|
+
};
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
export type GetOperationsQueryVariables = Exact<{
|
|
318
|
+
input: Scalars["JSON"]["input"];
|
|
319
|
+
type: SchemaType;
|
|
320
|
+
tag?: InputMaybe<Scalars["String"]["input"]>;
|
|
321
|
+
untagged?: InputMaybe<Scalars["Boolean"]["input"]>;
|
|
322
|
+
}>;
|
|
323
|
+
|
|
324
|
+
export type GetOperationsQuery = {
|
|
325
|
+
__typename?: "Query";
|
|
326
|
+
schema: {
|
|
327
|
+
__typename?: "Schema";
|
|
328
|
+
operations: Array<{
|
|
329
|
+
__typename?: "OperationItem";
|
|
330
|
+
slug: string;
|
|
331
|
+
deprecated?: boolean | null;
|
|
332
|
+
method: string;
|
|
333
|
+
summary?: string | null;
|
|
334
|
+
operationId?: string | null;
|
|
335
|
+
path: string;
|
|
320
336
|
}>;
|
|
321
337
|
};
|
|
322
338
|
};
|
|
@@ -418,20 +434,20 @@ export const ServersQueryDocument = new TypedDocumentString(`
|
|
|
418
434
|
ServersQueryQueryVariables
|
|
419
435
|
>;
|
|
420
436
|
export const AllOperationsDocument = new TypedDocumentString(`
|
|
421
|
-
query AllOperations($input: JSON!, $type: SchemaType
|
|
437
|
+
query AllOperations($input: JSON!, $type: SchemaType!, $tag: String, $untagged: Boolean) {
|
|
422
438
|
schema(input: $input, type: $type) {
|
|
423
439
|
description
|
|
424
440
|
summary
|
|
425
441
|
title
|
|
426
442
|
url
|
|
427
443
|
version
|
|
428
|
-
tags {
|
|
444
|
+
tags(name: $tag) {
|
|
429
445
|
name
|
|
430
446
|
description
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
447
|
+
}
|
|
448
|
+
operations(tag: $tag, untagged: $untagged) {
|
|
449
|
+
slug
|
|
450
|
+
...OperationsFragment
|
|
435
451
|
}
|
|
436
452
|
}
|
|
437
453
|
}
|
|
@@ -517,17 +533,7 @@ export const GetCategoriesDocument = new TypedDocumentString(`
|
|
|
517
533
|
schema(input: $input, type: $type) {
|
|
518
534
|
url
|
|
519
535
|
tags {
|
|
520
|
-
__typename
|
|
521
536
|
name
|
|
522
|
-
operations {
|
|
523
|
-
__typename
|
|
524
|
-
slug
|
|
525
|
-
deprecated
|
|
526
|
-
method
|
|
527
|
-
summary
|
|
528
|
-
operationId
|
|
529
|
-
path
|
|
530
|
-
}
|
|
531
537
|
}
|
|
532
538
|
}
|
|
533
539
|
}
|
|
@@ -535,3 +541,20 @@ export const GetCategoriesDocument = new TypedDocumentString(`
|
|
|
535
541
|
GetCategoriesQuery,
|
|
536
542
|
GetCategoriesQueryVariables
|
|
537
543
|
>;
|
|
544
|
+
export const GetOperationsDocument = new TypedDocumentString(`
|
|
545
|
+
query GetOperations($input: JSON!, $type: SchemaType!, $tag: String, $untagged: Boolean) {
|
|
546
|
+
schema(input: $input, type: $type) {
|
|
547
|
+
operations(tag: $tag, untagged: $untagged) {
|
|
548
|
+
slug
|
|
549
|
+
deprecated
|
|
550
|
+
method
|
|
551
|
+
summary
|
|
552
|
+
operationId
|
|
553
|
+
path
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
`) as unknown as TypedDocumentString<
|
|
558
|
+
GetOperationsQuery,
|
|
559
|
+
GetOperationsQueryVariables
|
|
560
|
+
>;
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { type ZudokuPlugin } from "../../core/plugins.js";
|
|
3
|
-
import { graphql } from "./graphql/index.js";
|
|
4
|
-
|
|
5
|
-
import { useQuery } from "@tanstack/react-query";
|
|
1
|
+
import slugify from "@sindresorhus/slugify";
|
|
6
2
|
import { CirclePlayIcon, LogInIcon } from "lucide-react";
|
|
3
|
+
import { matchPath, redirect, RouteObject } from "react-router";
|
|
7
4
|
import type { SidebarItem } from "../../../config/validators/SidebarSchema.js";
|
|
8
5
|
import { useAuth } from "../../authentication/hook.js";
|
|
9
6
|
import { ColorMap } from "../../components/navigation/SidebarBadge.js";
|
|
7
|
+
import { type ZudokuPlugin } from "../../core/plugins.js";
|
|
10
8
|
import type { SchemaImports } from "../../oas/graphql/index.js";
|
|
11
9
|
import { Button } from "../../ui/Button.js";
|
|
12
|
-
import {
|
|
10
|
+
import { joinUrl } from "../../util/joinUrl.js";
|
|
13
11
|
import { GraphQLClient } from "./client/GraphQLClient.js";
|
|
12
|
+
import { graphql } from "./graphql/index.js";
|
|
14
13
|
import { OasPluginConfig } from "./interfaces.js";
|
|
15
14
|
import type { PlaygroundContentProps } from "./playground/Playground.js";
|
|
16
15
|
import { PlaygroundDialog } from "./playground/PlaygroundDialog.js";
|
|
@@ -20,17 +19,27 @@ const GetCategoriesQuery = graphql(`
|
|
|
20
19
|
schema(input: $input, type: $type) {
|
|
21
20
|
url
|
|
22
21
|
tags {
|
|
23
|
-
__typename
|
|
24
22
|
name
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
`);
|
|
27
|
+
|
|
28
|
+
const GetOperationsQuery = graphql(`
|
|
29
|
+
query GetOperations(
|
|
30
|
+
$input: JSON!
|
|
31
|
+
$type: SchemaType!
|
|
32
|
+
$tag: String
|
|
33
|
+
$untagged: Boolean
|
|
34
|
+
) {
|
|
35
|
+
schema(input: $input, type: $type) {
|
|
36
|
+
operations(tag: $tag, untagged: $untagged) {
|
|
37
|
+
slug
|
|
38
|
+
deprecated
|
|
39
|
+
method
|
|
40
|
+
summary
|
|
41
|
+
operationId
|
|
42
|
+
path
|
|
34
43
|
}
|
|
35
44
|
}
|
|
36
45
|
}
|
|
@@ -50,9 +59,10 @@ const MethodColorMap: Record<string, keyof typeof ColorMap> = {
|
|
|
50
59
|
|
|
51
60
|
export type OpenApiPluginOptions = OasPluginConfig & InternalOasPluginConfig;
|
|
52
61
|
|
|
53
|
-
|
|
54
|
-
const basePath = joinPath(config.navigationId ?? "/reference");
|
|
62
|
+
const UNTAGGED_PATH = "~endpoints";
|
|
55
63
|
|
|
64
|
+
export const openApiPlugin = (config: OpenApiPluginOptions): ZudokuPlugin => {
|
|
65
|
+
const basePath = joinUrl(config.navigationId ?? "/reference");
|
|
56
66
|
const versions = config.type === "file" ? Object.keys(config.input) : [];
|
|
57
67
|
|
|
58
68
|
const client = new GraphQLClient(config);
|
|
@@ -81,18 +91,15 @@ export const openApiPlugin = (config: OpenApiPluginOptions): ZudokuPlugin => {
|
|
|
81
91
|
method,
|
|
82
92
|
url,
|
|
83
93
|
...props
|
|
84
|
-
}: Partial<PlaygroundContentProps> &
|
|
94
|
+
}: Partial<PlaygroundContentProps> &
|
|
95
|
+
Pick<PlaygroundContentProps, "server"> & {
|
|
96
|
+
requireAuth: boolean;
|
|
97
|
+
}) => {
|
|
85
98
|
const auth = useAuth();
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
type: config.type,
|
|
91
|
-
input: config.input,
|
|
92
|
-
}),
|
|
93
|
-
enabled: !server,
|
|
94
|
-
queryKey: ["playground-server"],
|
|
95
|
-
});
|
|
99
|
+
|
|
100
|
+
if (!server) {
|
|
101
|
+
throw new Error("Server is required");
|
|
102
|
+
}
|
|
96
103
|
|
|
97
104
|
if (requireAuth && !auth.isAuthenticated) {
|
|
98
105
|
return (
|
|
@@ -110,9 +117,7 @@ export const openApiPlugin = (config: OpenApiPluginOptions): ZudokuPlugin => {
|
|
|
110
117
|
<PlaygroundDialog
|
|
111
118
|
url={url ?? "/"}
|
|
112
119
|
method={method ?? "get"}
|
|
113
|
-
server={
|
|
114
|
-
server ?? serverQuery.data?.schema.url ?? "https://example.com"
|
|
115
|
-
}
|
|
120
|
+
server={server}
|
|
116
121
|
{...props}
|
|
117
122
|
>
|
|
118
123
|
<Button className="gap-2 items-center" variant="outline">
|
|
@@ -128,41 +133,60 @@ export const openApiPlugin = (config: OpenApiPluginOptions): ZudokuPlugin => {
|
|
|
128
133
|
}
|
|
129
134
|
|
|
130
135
|
try {
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
|
|
136
|
+
const urlVersion = versions.find((v) =>
|
|
137
|
+
path.startsWith(joinUrl(basePath, v)),
|
|
138
|
+
);
|
|
139
|
+
const version = urlVersion ?? Object.keys(config.input).at(0);
|
|
134
140
|
|
|
135
141
|
const data = await client.fetch(GetCategoriesQuery, {
|
|
136
142
|
type: config.type,
|
|
137
143
|
input: config.type === "file" ? config.input[version!] : config.input,
|
|
138
|
-
version,
|
|
139
144
|
});
|
|
140
145
|
|
|
141
|
-
const
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
type: "category",
|
|
145
|
-
label: tag.name || "Other endpoints",
|
|
146
|
-
collapsible: true,
|
|
147
|
-
collapsed: false,
|
|
148
|
-
items: tag.operations.map((operation) => ({
|
|
149
|
-
type: "link",
|
|
150
|
-
label: operation.summary ?? operation.path,
|
|
151
|
-
href: `#${operation.slug}`,
|
|
152
|
-
badge: {
|
|
153
|
-
label: operation.method,
|
|
154
|
-
color: MethodColorMap[operation.method.toLowerCase()]!,
|
|
155
|
-
invert: true,
|
|
156
|
-
},
|
|
157
|
-
})),
|
|
158
|
-
}));
|
|
146
|
+
const tag = config.tagPages?.find(
|
|
147
|
+
(tag) => path.split("/").at(-1) === slugify(tag),
|
|
148
|
+
);
|
|
159
149
|
|
|
160
|
-
|
|
161
|
-
type:
|
|
162
|
-
|
|
163
|
-
|
|
150
|
+
const operationsData = await client.fetch(GetOperationsQuery, {
|
|
151
|
+
type: config.type,
|
|
152
|
+
input: config.type === "file" ? config.input[version!] : config.input,
|
|
153
|
+
tag,
|
|
154
|
+
untagged: tag === undefined,
|
|
164
155
|
});
|
|
165
156
|
|
|
157
|
+
const items = operationsData.schema.operations.map((operation) => ({
|
|
158
|
+
type: "link" as const,
|
|
159
|
+
label: operation.summary ?? operation.path,
|
|
160
|
+
href: `#${operation.slug}`,
|
|
161
|
+
badge: {
|
|
162
|
+
label: operation.method,
|
|
163
|
+
color: MethodColorMap[operation.method.toLowerCase()]!,
|
|
164
|
+
invert: true,
|
|
165
|
+
} as const,
|
|
166
|
+
}));
|
|
167
|
+
|
|
168
|
+
const categories = data.schema.tags
|
|
169
|
+
// .filter((tag) => tag.operations.length > 0)
|
|
170
|
+
.map<SidebarItem>((tag) => {
|
|
171
|
+
const categoryLink = joinUrl(
|
|
172
|
+
basePath,
|
|
173
|
+
urlVersion,
|
|
174
|
+
tag.name ? slugify(tag.name) : UNTAGGED_PATH,
|
|
175
|
+
);
|
|
176
|
+
return {
|
|
177
|
+
type: "category",
|
|
178
|
+
label: tag.name || "Other endpoints",
|
|
179
|
+
link: {
|
|
180
|
+
type: "doc" as const,
|
|
181
|
+
id: categoryLink,
|
|
182
|
+
label: tag.name!,
|
|
183
|
+
},
|
|
184
|
+
collapsible: false,
|
|
185
|
+
collapsed: true,
|
|
186
|
+
items: path === categoryLink ? items : [],
|
|
187
|
+
};
|
|
188
|
+
});
|
|
189
|
+
|
|
166
190
|
return categories;
|
|
167
191
|
} catch {
|
|
168
192
|
return [];
|
|
@@ -171,31 +195,59 @@ export const openApiPlugin = (config: OpenApiPluginOptions): ZudokuPlugin => {
|
|
|
171
195
|
getRoutes: () => {
|
|
172
196
|
const versionsInPath = [null, ...versions];
|
|
173
197
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
const { OpenApiRoute } = await import("./Route.js");
|
|
178
|
-
return {
|
|
179
|
-
element: (
|
|
180
|
-
<OpenApiRoute
|
|
181
|
-
basePath={basePath}
|
|
182
|
-
versions={versions}
|
|
183
|
-
client={client}
|
|
184
|
-
config={config}
|
|
185
|
-
/>
|
|
186
|
-
),
|
|
187
|
-
};
|
|
188
|
-
},
|
|
189
|
-
children: [
|
|
190
|
-
{
|
|
191
|
-
index: true,
|
|
192
|
-
async lazy() {
|
|
193
|
-
const { OperationList } = await import("./OperationList.js");
|
|
194
|
-
return { element: <OperationList /> };
|
|
195
|
-
},
|
|
196
|
-
},
|
|
197
|
-
],
|
|
198
|
+
const tagPages = (config.tagPages ?? []).map((tag) => ({
|
|
199
|
+
tag,
|
|
200
|
+
path: slugify(tag),
|
|
198
201
|
}));
|
|
202
|
+
|
|
203
|
+
return versionsInPath.map((version) => {
|
|
204
|
+
const versionPath = joinUrl(basePath, version ? `/${version}` : "");
|
|
205
|
+
|
|
206
|
+
return {
|
|
207
|
+
path: versionPath,
|
|
208
|
+
async lazy() {
|
|
209
|
+
const { OpenApiRoute } = await import("./OpenApiRoute.js");
|
|
210
|
+
return {
|
|
211
|
+
element: (
|
|
212
|
+
<OpenApiRoute
|
|
213
|
+
version={version ?? undefined}
|
|
214
|
+
basePath={basePath}
|
|
215
|
+
versions={versions}
|
|
216
|
+
client={client}
|
|
217
|
+
config={config}
|
|
218
|
+
/>
|
|
219
|
+
),
|
|
220
|
+
};
|
|
221
|
+
},
|
|
222
|
+
children: [
|
|
223
|
+
{
|
|
224
|
+
index: true,
|
|
225
|
+
loader: () =>
|
|
226
|
+
redirect(
|
|
227
|
+
joinUrl(versionPath, tagPages.at(0)?.path ?? UNTAGGED_PATH),
|
|
228
|
+
),
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
path: joinUrl(versionPath, UNTAGGED_PATH),
|
|
232
|
+
async lazy() {
|
|
233
|
+
const { OperationList } = await import("./OperationList.js");
|
|
234
|
+
return { element: <OperationList untagged={true} /> };
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
...tagPages.map<RouteObject>((tag) => {
|
|
238
|
+
return {
|
|
239
|
+
path: joinUrl(versionPath, tag.path),
|
|
240
|
+
async lazy() {
|
|
241
|
+
const { OperationList } = await import("./OperationList.js");
|
|
242
|
+
return {
|
|
243
|
+
element: <OperationList tag={tag.tag} />,
|
|
244
|
+
};
|
|
245
|
+
},
|
|
246
|
+
};
|
|
247
|
+
}),
|
|
248
|
+
],
|
|
249
|
+
};
|
|
250
|
+
});
|
|
199
251
|
},
|
|
200
252
|
};
|
|
201
253
|
};
|
|
@@ -20,7 +20,15 @@ export type OasPluginConfig = {
|
|
|
20
20
|
server?: string;
|
|
21
21
|
navigationId?: string;
|
|
22
22
|
skipPreload?: boolean;
|
|
23
|
-
|
|
23
|
+
tagPages?: Array<string>;
|
|
24
|
+
} & OasPluginConfigOptions &
|
|
25
|
+
OasSource;
|
|
26
|
+
|
|
27
|
+
export type OasPluginConfigOptions = {
|
|
28
|
+
options?: {
|
|
29
|
+
examplesDefaultLanguage?: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
24
32
|
|
|
25
33
|
export type OasPluginContext = {
|
|
26
34
|
server?: string;
|
|
@@ -28,4 +36,5 @@ export type OasPluginContext = {
|
|
|
28
36
|
skipPreload?: boolean;
|
|
29
37
|
version?: string;
|
|
30
38
|
versions: Record<string, string>;
|
|
31
|
-
} & ContextOasSource
|
|
39
|
+
} & ContextOasSource &
|
|
40
|
+
OasPluginConfigOptions;
|
|
@@ -18,33 +18,36 @@ const ExamplesDropdown = ({
|
|
|
18
18
|
onSelect: (example: Example) => void;
|
|
19
19
|
}) => {
|
|
20
20
|
return (
|
|
21
|
-
<
|
|
22
|
-
<
|
|
23
|
-
<
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
<
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
21
|
+
<div className="flex flex-col gap-2 mt-2 items-end">
|
|
22
|
+
<DropdownMenu>
|
|
23
|
+
<DropdownMenuTrigger asChild>
|
|
24
|
+
<Button variant="outline">Use Example</Button>
|
|
25
|
+
</DropdownMenuTrigger>
|
|
26
|
+
<DropdownMenuContent className="w-56">
|
|
27
|
+
{examples.map((example) => {
|
|
28
|
+
return (
|
|
29
|
+
<div key={example.mediaType}>
|
|
30
|
+
<DropdownMenuLabel>{example.mediaType}</DropdownMenuLabel>
|
|
31
|
+
<DropdownMenuSeparator />
|
|
32
|
+
<DropdownMenuGroup>
|
|
33
|
+
{example.examples?.map((example) => {
|
|
34
|
+
return (
|
|
35
|
+
<DropdownMenuItem
|
|
36
|
+
key={example.name}
|
|
37
|
+
onSelect={() => onSelect(example)}
|
|
38
|
+
className="line-clamp-1"
|
|
39
|
+
>
|
|
40
|
+
{example.summary ?? example.name}
|
|
41
|
+
</DropdownMenuItem>
|
|
42
|
+
);
|
|
43
|
+
})}
|
|
44
|
+
</DropdownMenuGroup>
|
|
45
|
+
</div>
|
|
46
|
+
);
|
|
47
|
+
})}
|
|
48
|
+
</DropdownMenuContent>
|
|
49
|
+
</DropdownMenu>
|
|
50
|
+
</div>
|
|
48
51
|
);
|
|
49
52
|
};
|
|
50
53
|
|