zudoku 0.35.6 → 0.37.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.
Files changed (190) hide show
  1. package/README.md +1 -1
  2. package/dist/app/entry.server.js +5 -1
  3. package/dist/app/entry.server.js.map +1 -1
  4. package/dist/config/validators/common.d.ts +428 -428
  5. package/dist/config/validators/common.js +12 -7
  6. package/dist/config/validators/common.js.map +1 -1
  7. package/dist/config/validators/validate.d.ts +158 -158
  8. package/dist/lib/components/InlineCode.d.ts +2 -1
  9. package/dist/lib/components/InlineCode.js +1 -1
  10. package/dist/lib/components/InlineCode.js.map +1 -1
  11. package/dist/lib/components/Layout.js +3 -14
  12. package/dist/lib/components/Layout.js.map +1 -1
  13. package/dist/lib/components/MobileTopNavigation.js +1 -1
  14. package/dist/lib/components/MobileTopNavigation.js.map +1 -1
  15. package/dist/lib/components/TopNavigation.d.ts +2 -2
  16. package/dist/lib/components/TopNavigation.js +9 -12
  17. package/dist/lib/components/TopNavigation.js.map +1 -1
  18. package/dist/lib/components/Zudoku.js +3 -1
  19. package/dist/lib/components/Zudoku.js.map +1 -1
  20. package/dist/lib/components/cache.d.ts +7 -0
  21. package/dist/lib/components/cache.js +7 -0
  22. package/dist/lib/components/cache.js.map +1 -1
  23. package/dist/lib/components/context/ViewportAnchorContext.js +3 -6
  24. package/dist/lib/components/context/ViewportAnchorContext.js.map +1 -1
  25. package/dist/lib/components/context/ZudokuContext.d.ts +2 -2
  26. package/dist/lib/components/context/ZudokuContext.js +13 -7
  27. package/dist/lib/components/context/ZudokuContext.js.map +1 -1
  28. package/dist/lib/components/navigation/SidebarCategory.d.ts +2 -2
  29. package/dist/lib/components/navigation/SidebarCategory.js +10 -6
  30. package/dist/lib/components/navigation/SidebarCategory.js.map +1 -1
  31. package/dist/lib/components/navigation/SidebarItem.js +2 -2
  32. package/dist/lib/components/navigation/SidebarItem.js.map +1 -1
  33. package/dist/lib/components/navigation/SidebarWrapper.js +1 -1
  34. package/dist/lib/components/navigation/SidebarWrapper.js.map +1 -1
  35. package/dist/lib/core/ZudokuContext.d.ts +8 -6
  36. package/dist/lib/core/ZudokuContext.js +4 -2
  37. package/dist/lib/core/ZudokuContext.js.map +1 -1
  38. package/dist/lib/core/plugins.d.ts +3 -3
  39. package/dist/lib/hooks/useEvent.test.js +1 -1
  40. package/dist/lib/hooks/useEvent.test.js.map +1 -1
  41. package/dist/lib/oas/graphql/index.d.ts +13 -2
  42. package/dist/lib/oas/graphql/index.js +59 -39
  43. package/dist/lib/oas/graphql/index.js.map +1 -1
  44. package/dist/lib/plugins/openapi/OperationList.js +19 -5
  45. package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
  46. package/dist/lib/plugins/openapi/OperationListItem.js +1 -1
  47. package/dist/lib/plugins/openapi/OperationListItem.js.map +1 -1
  48. package/dist/lib/plugins/openapi/ParamInfos.js +12 -4
  49. package/dist/lib/plugins/openapi/ParamInfos.js.map +1 -1
  50. package/dist/lib/plugins/openapi/ParameterListItem.js +1 -1
  51. package/dist/lib/plugins/openapi/ParameterListItem.js.map +1 -1
  52. package/dist/lib/plugins/openapi/Sidecar.js +2 -2
  53. package/dist/lib/plugins/openapi/Sidecar.js.map +1 -1
  54. package/dist/lib/plugins/openapi/client/useCreateQuery.d.ts +1 -1
  55. package/dist/lib/plugins/openapi/client/useCreateQuery.js +2 -1
  56. package/dist/lib/plugins/openapi/client/useCreateQuery.js.map +1 -1
  57. package/dist/lib/plugins/openapi/graphql/gql.d.ts +4 -4
  58. package/dist/lib/plugins/openapi/graphql/gql.js +3 -3
  59. package/dist/lib/plugins/openapi/graphql/gql.js.map +1 -1
  60. package/dist/lib/plugins/openapi/graphql/graphql.d.ts +33 -44
  61. package/dist/lib/plugins/openapi/graphql/graphql.js +19 -29
  62. package/dist/lib/plugins/openapi/graphql/graphql.js.map +1 -1
  63. package/dist/lib/plugins/openapi/index.d.ts +5 -10
  64. package/dist/lib/plugins/openapi/index.js +29 -60
  65. package/dist/lib/plugins/openapi/index.js.map +1 -1
  66. package/dist/lib/plugins/openapi/interfaces.d.ts +3 -1
  67. package/dist/lib/plugins/openapi/schema/SchemaPropertyItem.js +3 -3
  68. package/dist/lib/plugins/openapi/schema/SchemaPropertyItem.js.map +1 -1
  69. package/dist/lib/plugins/openapi/schema/SchemaView.js +13 -6
  70. package/dist/lib/plugins/openapi/schema/SchemaView.js.map +1 -1
  71. package/dist/lib/plugins/openapi/util/createSidebarCategory.js +5 -7
  72. package/dist/lib/plugins/openapi/util/createSidebarCategory.js.map +1 -1
  73. package/dist/lib/ui/Badge.d.ts +1 -1
  74. package/dist/lib/ui/Button.d.ts +1 -1
  75. package/dist/lib/ui/Button.js +1 -1
  76. package/dist/lib/ui/Button.js.map +1 -1
  77. package/dist/lib/ui/Command.d.ts +6 -6
  78. package/dist/lib/util/joinPath.d.ts +3 -0
  79. package/dist/lib/util/joinPath.js +3 -0
  80. package/dist/lib/util/joinPath.js.map +1 -1
  81. package/dist/lib/util/traverse.js +2 -2
  82. package/dist/lib/util/traverse.js.map +1 -1
  83. package/dist/lib/util/useScrollToAnchor.js +2 -0
  84. package/dist/lib/util/useScrollToAnchor.js.map +1 -1
  85. package/dist/vite/api/schema-codegen.js +19 -4
  86. package/dist/vite/api/schema-codegen.js.map +1 -1
  87. package/dist/vite/api/schema-codegen.test.js +61 -0
  88. package/dist/vite/api/schema-codegen.test.js.map +1 -1
  89. package/dist/vite/config.js +1 -1
  90. package/dist/vite/config.js.map +1 -1
  91. package/dist/vite/plugin-api.js +4 -12
  92. package/dist/vite/plugin-api.js.map +1 -1
  93. package/dist/vite/plugin-docs.d.ts +1 -1
  94. package/dist/vite/plugin-docs.js +18 -1
  95. package/dist/vite/plugin-docs.js.map +1 -1
  96. package/lib/{AuthenticationPlugin-4ip08maU.js → AuthenticationPlugin-Cij2tPWa.js} +2 -2
  97. package/lib/{AuthenticationPlugin-4ip08maU.js.map → AuthenticationPlugin-Cij2tPWa.js.map} +1 -1
  98. package/lib/{Spinner-C6n4eOvh.js → Button-Fp19CMUr.js} +15 -18
  99. package/lib/Button-Fp19CMUr.js.map +1 -0
  100. package/lib/{Markdown-C0eXdzGn.js → Markdown-DT5Rrq8_.js} +3526 -3264
  101. package/lib/Markdown-DT5Rrq8_.js.map +1 -0
  102. package/lib/{MdxPage-BKkG1cm1.js → MdxPage-D2rD1vC4.js} +3 -3
  103. package/lib/{MdxPage-BKkG1cm1.js.map → MdxPage-D2rD1vC4.js.map} +1 -1
  104. package/lib/{OasProvider-CwhKwrwl.js → OasProvider-DdEBf2qS.js} +3 -3
  105. package/lib/{OasProvider-CwhKwrwl.js.map → OasProvider-DdEBf2qS.js.map} +1 -1
  106. package/lib/{OperationList-DGYoFitT.js → OperationList-DT4-gm_S.js} +1122 -1093
  107. package/lib/OperationList-DT4-gm_S.js.map +1 -0
  108. package/lib/{Select-FAYHOYTy.js → Select-z1Lwl0-J.js} +3 -3
  109. package/lib/{Select-FAYHOYTy.js.map → Select-z1Lwl0-J.js.map} +1 -1
  110. package/lib/{SlotletProvider-BJC58V32.js → SlotletProvider-D8OBnr77.js} +2 -2
  111. package/lib/{SlotletProvider-BJC58V32.js.map → SlotletProvider-D8OBnr77.js.map} +1 -1
  112. package/lib/Spinner-CE68iCm0.js +7 -0
  113. package/lib/Spinner-CE68iCm0.js.map +1 -0
  114. package/lib/{circular-v7K6lDDh.js → circular-ByJI6Mci.js} +4887 -4419
  115. package/lib/circular-ByJI6Mci.js.map +1 -0
  116. package/lib/{createServer-CbL1Uh2Q.js → createServer-DjgKDpGV.js} +3301 -3747
  117. package/lib/createServer-DjgKDpGV.js.map +1 -0
  118. package/lib/{hook-CfCFKZ-2.js → hook-DzQC8PzJ.js} +78 -73
  119. package/lib/hook-DzQC8PzJ.js.map +1 -0
  120. package/lib/{index-Dm1QJHVl.js → index-DdQSV2RF.js} +593 -633
  121. package/lib/index-DdQSV2RF.js.map +1 -0
  122. package/lib/{useQuery-CQUwWR9i.js → joinUrl-BjDooT-T.js} +240 -223
  123. package/lib/joinUrl-BjDooT-T.js.map +1 -0
  124. package/lib/{mutation-B81DztCT.js → mutation-_Z5C2wFZ.js} +2 -2
  125. package/lib/{mutation-B81DztCT.js.map → mutation-_Z5C2wFZ.js.map} +1 -1
  126. package/lib/post-processors/traverse.js +2 -2
  127. package/lib/post-processors/traverse.js.map +1 -1
  128. package/lib/ui/ActionButton.js +11 -10
  129. package/lib/ui/ActionButton.js.map +1 -1
  130. package/lib/ui/Button.js +1 -1
  131. package/lib/ui/Button.js.map +1 -1
  132. package/lib/zudoku.auth-auth0.js +1 -1
  133. package/lib/zudoku.auth-clerk.js +2 -2
  134. package/lib/zudoku.auth-openid.js +3 -3
  135. package/lib/zudoku.components.js +438 -444
  136. package/lib/zudoku.components.js.map +1 -1
  137. package/lib/zudoku.hooks.js +1 -1
  138. package/lib/zudoku.plugin-api-catalog.js +3 -3
  139. package/lib/zudoku.plugin-api-keys.js +4 -4
  140. package/lib/zudoku.plugin-custom-pages.js +1 -1
  141. package/lib/zudoku.plugin-markdown.js +1 -1
  142. package/lib/zudoku.plugin-openapi.js +5 -6
  143. package/lib/zudoku.plugin-openapi.js.map +1 -1
  144. package/lib/zudoku.plugin-search-pagefind.js +15 -16
  145. package/lib/zudoku.plugin-search-pagefind.js.map +1 -1
  146. package/lib/zudoku.plugins.js.map +1 -1
  147. package/package.json +3 -1
  148. package/src/app/entry.server.tsx +7 -1
  149. package/src/lib/components/InlineCode.tsx +3 -1
  150. package/src/lib/components/Layout.tsx +3 -16
  151. package/src/lib/components/MobileTopNavigation.tsx +1 -1
  152. package/src/lib/components/TopNavigation.tsx +12 -16
  153. package/src/lib/components/Zudoku.tsx +5 -1
  154. package/src/lib/components/cache.ts +8 -0
  155. package/src/lib/components/context/ViewportAnchorContext.tsx +3 -6
  156. package/src/lib/components/context/ZudokuContext.ts +17 -8
  157. package/src/lib/components/navigation/SidebarCategory.tsx +15 -12
  158. package/src/lib/components/navigation/SidebarItem.tsx +2 -2
  159. package/src/lib/components/navigation/SidebarWrapper.tsx +2 -2
  160. package/src/lib/core/ZudokuContext.ts +11 -8
  161. package/src/lib/core/plugins.ts +4 -4
  162. package/src/lib/hooks/useEvent.test.tsx +1 -1
  163. package/src/lib/oas/graphql/index.ts +104 -64
  164. package/src/lib/plugins/openapi/OperationList.tsx +30 -36
  165. package/src/lib/plugins/openapi/OperationListItem.tsx +1 -1
  166. package/src/lib/plugins/openapi/ParamInfos.tsx +27 -4
  167. package/src/lib/plugins/openapi/ParameterListItem.tsx +5 -1
  168. package/src/lib/plugins/openapi/Sidecar.tsx +2 -2
  169. package/src/lib/plugins/openapi/client/useCreateQuery.ts +2 -1
  170. package/src/lib/plugins/openapi/graphql/gql.ts +17 -17
  171. package/src/lib/plugins/openapi/graphql/graphql.ts +57 -75
  172. package/src/lib/plugins/openapi/index.tsx +40 -84
  173. package/src/lib/plugins/openapi/interfaces.ts +4 -1
  174. package/src/lib/plugins/openapi/schema/SchemaPropertyItem.tsx +5 -2
  175. package/src/lib/plugins/openapi/schema/SchemaView.tsx +48 -35
  176. package/src/lib/plugins/openapi/util/createSidebarCategory.tsx +5 -7
  177. package/src/lib/ui/Button.tsx +1 -1
  178. package/src/lib/util/joinPath.tsx +3 -0
  179. package/src/lib/util/traverse.ts +2 -2
  180. package/src/lib/util/useScrollToAnchor.ts +2 -0
  181. package/lib/Markdown-C0eXdzGn.js.map +0 -1
  182. package/lib/OperationList-DGYoFitT.js.map +0 -1
  183. package/lib/Spinner-C6n4eOvh.js.map +0 -1
  184. package/lib/circular-v7K6lDDh.js.map +0 -1
  185. package/lib/createServer-CbL1Uh2Q.js.map +0 -1
  186. package/lib/hook-CfCFKZ-2.js.map +0 -1
  187. package/lib/index-Dm1QJHVl.js.map +0 -1
  188. package/lib/joinUrl-10po2Jdj.js +0 -20
  189. package/lib/joinUrl-10po2Jdj.js.map +0 -1
  190. package/lib/useQuery-CQUwWR9i.js.map +0 -1
@@ -15,24 +15,24 @@ import * as types from "./graphql.js";
15
15
  type Documents = {
16
16
  "\n query ServersQuery($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n url\n servers {\n url\n }\n }\n }\n": typeof types.ServersQueryDocument;
17
17
  "\n fragment OperationsFragment on OperationItem {\n slug\n summary\n method\n description\n operationId\n contentTypes\n path\n deprecated\n extensions\n parameters {\n name\n in\n description\n required\n schema\n style\n explode\n examples {\n name\n description\n externalValue\n value\n summary\n }\n }\n requestBody {\n content {\n mediaType\n encoding {\n name\n }\n examples {\n name\n description\n externalValue\n value\n summary\n }\n schema\n }\n description\n required\n }\n responses {\n statusCode\n links\n description\n content {\n examples {\n name\n description\n externalValue\n value\n summary\n }\n mediaType\n encoding {\n name\n }\n schema\n }\n }\n }\n": typeof types.OperationsFragmentFragmentDoc;
18
- "\n query AllOperations(\n $input: JSON!\n $type: SchemaType!\n $tag: String\n $untagged: Boolean\n ) {\n schema(input: $input, type: $type) {\n servers {\n url\n }\n description\n summary\n title\n url\n version\n tags(name: $tag) {\n name\n description\n }\n operations(tag: $tag, untagged: $untagged) {\n slug\n ...OperationsFragment\n }\n }\n }\n": typeof types.AllOperationsDocument;
18
+ "\n query SchemaWarmup($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n openapi\n }\n }\n": typeof types.SchemaWarmupDocument;
19
+ "\n query OperationsForTag(\n $input: JSON!\n $type: SchemaType!\n $tag: String\n $untagged: Boolean\n ) {\n schema(input: $input, type: $type) {\n servers {\n url\n }\n description\n summary\n title\n url\n version\n tags(name: $tag) {\n name\n description\n }\n operations(tag: $tag, untagged: $untagged) {\n slug\n ...OperationsFragment\n }\n }\n }\n": typeof types.OperationsForTagDocument;
19
20
  "\n query getServerQuery($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n url\n servers {\n url\n }\n }\n }\n": typeof types.GetServerQueryDocument;
20
- "\n query GetCategories($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n url\n tags {\n name\n }\n }\n }\n": typeof types.GetCategoriesDocument;
21
- "\n query GetOperations($input: JSON!, $type: SchemaType!, $tag: String) {\n schema(input: $input, type: $type) {\n operations(tag: $tag) {\n slug\n deprecated\n method\n summary\n operationId\n path\n tags {\n name\n }\n }\n untagged: operations(untagged: true) {\n slug\n deprecated\n method\n summary\n operationId\n path\n }\n }\n }\n": typeof types.GetOperationsDocument;
21
+ "\n query GetSidebarOperations($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n tags {\n slug\n name\n extensions\n operations {\n summary\n slug\n method\n operationId\n path\n }\n }\n }\n }\n": typeof types.GetSidebarOperationsDocument;
22
22
  };
23
23
  const documents: Documents = {
24
24
  "\n query ServersQuery($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n url\n servers {\n url\n }\n }\n }\n":
25
25
  types.ServersQueryDocument,
26
26
  "\n fragment OperationsFragment on OperationItem {\n slug\n summary\n method\n description\n operationId\n contentTypes\n path\n deprecated\n extensions\n parameters {\n name\n in\n description\n required\n schema\n style\n explode\n examples {\n name\n description\n externalValue\n value\n summary\n }\n }\n requestBody {\n content {\n mediaType\n encoding {\n name\n }\n examples {\n name\n description\n externalValue\n value\n summary\n }\n schema\n }\n description\n required\n }\n responses {\n statusCode\n links\n description\n content {\n examples {\n name\n description\n externalValue\n value\n summary\n }\n mediaType\n encoding {\n name\n }\n schema\n }\n }\n }\n":
27
27
  types.OperationsFragmentFragmentDoc,
28
- "\n query AllOperations(\n $input: JSON!\n $type: SchemaType!\n $tag: String\n $untagged: Boolean\n ) {\n schema(input: $input, type: $type) {\n servers {\n url\n }\n description\n summary\n title\n url\n version\n tags(name: $tag) {\n name\n description\n }\n operations(tag: $tag, untagged: $untagged) {\n slug\n ...OperationsFragment\n }\n }\n }\n":
29
- types.AllOperationsDocument,
28
+ "\n query SchemaWarmup($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n openapi\n }\n }\n":
29
+ types.SchemaWarmupDocument,
30
+ "\n query OperationsForTag(\n $input: JSON!\n $type: SchemaType!\n $tag: String\n $untagged: Boolean\n ) {\n schema(input: $input, type: $type) {\n servers {\n url\n }\n description\n summary\n title\n url\n version\n tags(name: $tag) {\n name\n description\n }\n operations(tag: $tag, untagged: $untagged) {\n slug\n ...OperationsFragment\n }\n }\n }\n":
31
+ types.OperationsForTagDocument,
30
32
  "\n query getServerQuery($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n url\n servers {\n url\n }\n }\n }\n":
31
33
  types.GetServerQueryDocument,
32
- "\n query GetCategories($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n url\n tags {\n name\n }\n }\n }\n":
33
- types.GetCategoriesDocument,
34
- "\n query GetOperations($input: JSON!, $type: SchemaType!, $tag: String) {\n schema(input: $input, type: $type) {\n operations(tag: $tag) {\n slug\n deprecated\n method\n summary\n operationId\n path\n tags {\n name\n }\n }\n untagged: operations(untagged: true) {\n slug\n deprecated\n method\n summary\n operationId\n path\n }\n }\n }\n":
35
- types.GetOperationsDocument,
34
+ "\n query GetSidebarOperations($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n tags {\n slug\n name\n extensions\n operations {\n summary\n slug\n method\n operationId\n path\n }\n }\n }\n }\n":
35
+ types.GetSidebarOperationsDocument,
36
36
  };
37
37
 
38
38
  /**
@@ -51,26 +51,26 @@ export function graphql(
51
51
  * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
52
52
  */
53
53
  export function graphql(
54
- source: "\n query AllOperations(\n $input: JSON!\n $type: SchemaType!\n $tag: String\n $untagged: Boolean\n ) {\n schema(input: $input, type: $type) {\n servers {\n url\n }\n description\n summary\n title\n url\n version\n tags(name: $tag) {\n name\n description\n }\n operations(tag: $tag, untagged: $untagged) {\n slug\n ...OperationsFragment\n }\n }\n }\n",
55
- ): typeof import("./graphql.js").AllOperationsDocument;
54
+ source: "\n query SchemaWarmup($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n openapi\n }\n }\n",
55
+ ): typeof import("./graphql.js").SchemaWarmupDocument;
56
56
  /**
57
57
  * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
58
58
  */
59
59
  export function graphql(
60
- source: "\n query getServerQuery($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n url\n servers {\n url\n }\n }\n }\n",
61
- ): typeof import("./graphql.js").GetServerQueryDocument;
60
+ source: "\n query OperationsForTag(\n $input: JSON!\n $type: SchemaType!\n $tag: String\n $untagged: Boolean\n ) {\n schema(input: $input, type: $type) {\n servers {\n url\n }\n description\n summary\n title\n url\n version\n tags(name: $tag) {\n name\n description\n }\n operations(tag: $tag, untagged: $untagged) {\n slug\n ...OperationsFragment\n }\n }\n }\n",
61
+ ): typeof import("./graphql.js").OperationsForTagDocument;
62
62
  /**
63
63
  * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
64
64
  */
65
65
  export function graphql(
66
- source: "\n query GetCategories($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n url\n tags {\n name\n }\n }\n }\n",
67
- ): typeof import("./graphql.js").GetCategoriesDocument;
66
+ source: "\n query getServerQuery($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n url\n servers {\n url\n }\n }\n }\n",
67
+ ): typeof import("./graphql.js").GetServerQueryDocument;
68
68
  /**
69
69
  * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
70
70
  */
71
71
  export function graphql(
72
- source: "\n query GetOperations($input: JSON!, $type: SchemaType!, $tag: String) {\n schema(input: $input, type: $type) {\n operations(tag: $tag) {\n slug\n deprecated\n method\n summary\n operationId\n path\n tags {\n name\n }\n }\n untagged: operations(untagged: true) {\n slug\n deprecated\n method\n summary\n operationId\n path\n }\n }\n }\n",
73
- ): typeof import("./graphql.js").GetOperationsDocument;
72
+ source: "\n query GetSidebarOperations($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n tags {\n slug\n name\n extensions\n operations {\n summary\n slug\n method\n operationId\n path\n }\n }\n }\n }\n",
73
+ ): typeof import("./graphql.js").GetSidebarOperationsDocument;
74
74
 
75
75
  export function graphql(source: string) {
76
76
  return (documents as any)[source] ?? {};
@@ -160,8 +160,10 @@ export type SchemaTagsArgs = {
160
160
  export type SchemaTag = {
161
161
  __typename?: "SchemaTag";
162
162
  description?: Maybe<Scalars["String"]["output"]>;
163
- name: Scalars["String"]["output"];
163
+ extensions?: Maybe<Scalars["JSONObject"]["output"]>;
164
+ name?: Maybe<Scalars["String"]["output"]>;
164
165
  operations: Array<OperationItem>;
166
+ slug?: Maybe<Scalars["String"]["output"]>;
165
167
  };
166
168
 
167
169
  export type SchemaType = "file" | "raw" | "url";
@@ -263,14 +265,24 @@ export type OperationsFragmentFragment = {
263
265
  }>;
264
266
  } & { " $fragmentName"?: "OperationsFragmentFragment" };
265
267
 
266
- export type AllOperationsQueryVariables = Exact<{
268
+ export type SchemaWarmupQueryVariables = Exact<{
269
+ input: Scalars["JSON"]["input"];
270
+ type: SchemaType;
271
+ }>;
272
+
273
+ export type SchemaWarmupQuery = {
274
+ __typename?: "Query";
275
+ schema: { __typename?: "Schema"; openapi: string };
276
+ };
277
+
278
+ export type OperationsForTagQueryVariables = Exact<{
267
279
  input: Scalars["JSON"]["input"];
268
280
  type: SchemaType;
269
281
  tag?: InputMaybe<Scalars["String"]["input"]>;
270
282
  untagged?: InputMaybe<Scalars["Boolean"]["input"]>;
271
283
  }>;
272
284
 
273
- export type AllOperationsQuery = {
285
+ export type OperationsForTagQuery = {
274
286
  __typename?: "Query";
275
287
  schema: {
276
288
  __typename?: "Schema";
@@ -282,7 +294,7 @@ export type AllOperationsQuery = {
282
294
  servers: Array<{ __typename?: "Server"; url: string }>;
283
295
  tags: Array<{
284
296
  __typename?: "SchemaTag";
285
- name: string;
297
+ name?: string | null;
286
298
  description?: string | null;
287
299
  }>;
288
300
  operations: Array<
@@ -309,48 +321,28 @@ export type GetServerQueryQuery = {
309
321
  };
310
322
  };
311
323
 
312
- export type GetCategoriesQueryVariables = Exact<{
313
- input: Scalars["JSON"]["input"];
314
- type: SchemaType;
315
- }>;
316
-
317
- export type GetCategoriesQuery = {
318
- __typename?: "Query";
319
- schema: {
320
- __typename?: "Schema";
321
- url?: string | null;
322
- tags: Array<{ __typename?: "SchemaTag"; name: string }>;
323
- };
324
- };
325
-
326
- export type GetOperationsQueryVariables = Exact<{
324
+ export type GetSidebarOperationsQueryVariables = Exact<{
327
325
  input: Scalars["JSON"]["input"];
328
326
  type: SchemaType;
329
- tag?: InputMaybe<Scalars["String"]["input"]>;
330
327
  }>;
331
328
 
332
- export type GetOperationsQuery = {
329
+ export type GetSidebarOperationsQuery = {
333
330
  __typename?: "Query";
334
331
  schema: {
335
332
  __typename?: "Schema";
336
- operations: Array<{
337
- __typename?: "OperationItem";
338
- slug: string;
339
- deprecated?: boolean | null;
340
- method: string;
341
- summary?: string | null;
342
- operationId?: string | null;
343
- path: string;
344
- tags?: Array<{ __typename?: "TagItem"; name: string }> | null;
345
- }>;
346
- untagged: Array<{
347
- __typename?: "OperationItem";
348
- slug: string;
349
- deprecated?: boolean | null;
350
- method: string;
351
- summary?: string | null;
352
- operationId?: string | null;
353
- path: string;
333
+ tags: Array<{
334
+ __typename?: "SchemaTag";
335
+ slug?: string | null;
336
+ name?: string | null;
337
+ extensions?: any | null;
338
+ operations: Array<{
339
+ __typename?: "OperationItem";
340
+ summary?: string | null;
341
+ slug: string;
342
+ method: string;
343
+ operationId?: string | null;
344
+ path: string;
345
+ }>;
354
346
  }>;
355
347
  };
356
348
  };
@@ -455,8 +447,18 @@ export const ServersQueryDocument = new TypedDocumentString(`
455
447
  ServersQueryQuery,
456
448
  ServersQueryQueryVariables
457
449
  >;
458
- export const AllOperationsDocument = new TypedDocumentString(`
459
- query AllOperations($input: JSON!, $type: SchemaType!, $tag: String, $untagged: Boolean) {
450
+ export const SchemaWarmupDocument = new TypedDocumentString(`
451
+ query SchemaWarmup($input: JSON!, $type: SchemaType!) {
452
+ schema(input: $input, type: $type) {
453
+ openapi
454
+ }
455
+ }
456
+ `) as unknown as TypedDocumentString<
457
+ SchemaWarmupQuery,
458
+ SchemaWarmupQueryVariables
459
+ >;
460
+ export const OperationsForTagDocument = new TypedDocumentString(`
461
+ query OperationsForTag($input: JSON!, $type: SchemaType!, $tag: String, $untagged: Boolean) {
460
462
  schema(input: $input, type: $type) {
461
463
  servers {
462
464
  url
@@ -540,8 +542,8 @@ export const AllOperationsDocument = new TypedDocumentString(`
540
542
  }
541
543
  }
542
544
  }`) as unknown as TypedDocumentString<
543
- AllOperationsQuery,
544
- AllOperationsQueryVariables
545
+ OperationsForTagQuery,
546
+ OperationsForTagQueryVariables
545
547
  >;
546
548
  export const GetServerQueryDocument = new TypedDocumentString(`
547
549
  query getServerQuery($input: JSON!, $type: SchemaType!) {
@@ -556,44 +558,24 @@ export const GetServerQueryDocument = new TypedDocumentString(`
556
558
  GetServerQueryQuery,
557
559
  GetServerQueryQueryVariables
558
560
  >;
559
- export const GetCategoriesDocument = new TypedDocumentString(`
560
- query GetCategories($input: JSON!, $type: SchemaType!) {
561
+ export const GetSidebarOperationsDocument = new TypedDocumentString(`
562
+ query GetSidebarOperations($input: JSON!, $type: SchemaType!) {
561
563
  schema(input: $input, type: $type) {
562
- url
563
564
  tags {
564
- name
565
- }
566
- }
567
- }
568
- `) as unknown as TypedDocumentString<
569
- GetCategoriesQuery,
570
- GetCategoriesQueryVariables
571
- >;
572
- export const GetOperationsDocument = new TypedDocumentString(`
573
- query GetOperations($input: JSON!, $type: SchemaType!, $tag: String) {
574
- schema(input: $input, type: $type) {
575
- operations(tag: $tag) {
576
565
  slug
577
- deprecated
578
- method
579
- summary
580
- operationId
581
- path
582
- tags {
583
- name
566
+ name
567
+ extensions
568
+ operations {
569
+ summary
570
+ slug
571
+ method
572
+ operationId
573
+ path
584
574
  }
585
575
  }
586
- untagged: operations(untagged: true) {
587
- slug
588
- deprecated
589
- method
590
- summary
591
- operationId
592
- path
593
- }
594
576
  }
595
577
  }
596
578
  `) as unknown as TypedDocumentString<
597
- GetOperationsQuery,
598
- GetOperationsQueryVariables
579
+ GetSidebarOperationsQuery,
580
+ GetSidebarOperationsQueryVariables
599
581
  >;
@@ -1,14 +1,12 @@
1
- import type { ResultOf } from "@graphql-typed-document-node/core";
2
- import slugify from "@sindresorhus/slugify";
3
1
  import { CirclePlayIcon, LogInIcon } from "lucide-react";
4
2
  import { type ReactNode } from "react";
5
3
  import { matchPath } from "react-router";
6
4
  import { useAuth } from "../../authentication/hook.js";
7
5
  import { type ZudokuPlugin } from "../../core/plugins.js";
8
- import type { SchemaImports } from "../../oas/graphql/index.js";
9
6
  import { Button } from "../../ui/Button.js";
10
7
  import { joinUrl } from "../../util/joinUrl.js";
11
8
  import { GraphQLClient } from "./client/GraphQLClient.js";
9
+ import type { GetSidebarOperationsQuery } from "./graphql/graphql.js";
12
10
  import { graphql } from "./graphql/index.js";
13
11
  import { type OasPluginConfig } from "./interfaces.js";
14
12
  import type { PlaygroundContentProps } from "./playground/Playground.js";
@@ -16,54 +14,33 @@ import { PlaygroundDialog } from "./playground/PlaygroundDialog.js";
16
14
  import { createSidebarCategory } from "./util/createSidebarCategory.js";
17
15
  import { getRoutes, getVersions } from "./util/getRoutes.js";
18
16
 
19
- const GetCategoriesQuery = graphql(`
20
- query GetCategories($input: JSON!, $type: SchemaType!) {
17
+ const GetSidebarOperationsQuery = graphql(`
18
+ query GetSidebarOperations($input: JSON!, $type: SchemaType!) {
21
19
  schema(input: $input, type: $type) {
22
- url
23
20
  tags {
24
- name
25
- }
26
- }
27
- }
28
- `);
29
-
30
- const GetOperationsQuery = graphql(`
31
- query GetOperations($input: JSON!, $type: SchemaType!, $tag: String) {
32
- schema(input: $input, type: $type) {
33
- operations(tag: $tag) {
34
21
  slug
35
- deprecated
36
- method
37
- summary
38
- operationId
39
- path
40
- tags {
41
- name
22
+ name
23
+ extensions
24
+ operations {
25
+ summary
26
+ slug
27
+ method
28
+ operationId
29
+ path
42
30
  }
43
31
  }
44
- untagged: operations(untagged: true) {
45
- slug
46
- deprecated
47
- method
48
- summary
49
- operationId
50
- path
51
- }
52
32
  }
53
33
  }
54
34
  `);
55
35
 
56
- export type OperationResult = ResultOf<
57
- typeof GetOperationsQuery
58
- >["schema"]["operations"][number];
59
-
60
- type InternalOasPluginConfig = { schemaImports?: SchemaImports };
36
+ export type OperationResult =
37
+ GetSidebarOperationsQuery["schema"]["tags"][number]["operations"][number];
61
38
 
62
- export type OpenApiPluginOptions = OasPluginConfig & InternalOasPluginConfig;
39
+ export type OpenApiPluginOptions = OasPluginConfig;
63
40
 
64
41
  export const UNTAGGED_PATH = "~endpoints";
65
42
 
66
- export const openApiPlugin = (config: OpenApiPluginOptions): ZudokuPlugin => {
43
+ export const openApiPlugin = (config: OasPluginConfig): ZudokuPlugin => {
67
44
  const basePath = joinUrl(config.navigationId ?? "/reference");
68
45
  const client = new GraphQLClient(config);
69
46
 
@@ -134,7 +111,7 @@ export const openApiPlugin = (config: OpenApiPluginOptions): ZudokuPlugin => {
134
111
  );
135
112
  },
136
113
  }),
137
- getSidebar: async (path: string) => {
114
+ getSidebar: async (path, context) => {
138
115
  if (!matchPath({ path: basePath, end: false }, path)) {
139
116
  return [];
140
117
  }
@@ -147,67 +124,46 @@ export const openApiPlugin = (config: OpenApiPluginOptions): ZudokuPlugin => {
147
124
  try {
148
125
  const versionParam = match?.params.version;
149
126
  const version = versionParam ?? getVersions(config).at(0);
150
- const { type, options } = config;
127
+ const { type } = config;
151
128
  const input = type === "file" ? config.input[version!] : config.input;
152
129
 
153
- const collapsible = options?.loadTags === true || config.type === "url";
154
- const collapsed = !options?.loadTags && config.type !== "url";
155
-
156
- // find tag name by slug in config.tagPages
157
- const tagName = config.tagPages?.find(
158
- (tag) => slugify(tag) === match?.params.tag,
159
- );
130
+ const data = await context.queryClient.ensureQueryData({
131
+ queryKey: ["sidebar-operations-query", input],
132
+ queryFn: () =>
133
+ client.fetch(GetSidebarOperationsQuery, { type, input }),
134
+ });
160
135
 
161
- const [tagData, operationsData] = await Promise.all([
162
- client.fetch(GetCategoriesQuery, { type, input }),
163
- client.fetch(GetOperationsQuery, {
164
- type,
165
- input,
166
- tag: !options?.loadTags ? tagName : undefined,
167
- }),
168
- ]);
169
-
170
- const categories = tagData.schema.tags.flatMap((tag) => {
171
- const categoryPath = joinUrl(
172
- basePath,
173
- versionParam,
174
- slugify(tag.name),
175
- );
136
+ const categories = data.schema.tags.flatMap((tag) => {
137
+ if (!tag.name || tag.operations.length === 0) return [];
176
138
 
177
- const operations = operationsData.schema.operations.filter(
178
- (operation) =>
179
- operation.tags?.length !== 0 &&
180
- operation.tags?.map((t) => t.name).includes(tag.name),
181
- );
139
+ const categoryPath = joinUrl(basePath, versionParam, tag.slug);
182
140
 
183
- // skip empty categories
184
- if (options?.loadTags && operations.length === 0) {
185
- return [];
186
- }
141
+ const isCollapsed =
142
+ tag.extensions?.["x-zudoku-collapsed"] ??
143
+ !config.options?.expandAllTags;
144
+ const isCollapsible =
145
+ tag.extensions?.["x-zudoku-collapsible"] ?? true;
187
146
 
188
147
  return createSidebarCategory({
189
148
  label: tag.name,
190
149
  path: categoryPath,
191
- operations:
192
- match?.params.tag !== UNTAGGED_PATH || options?.loadTags
193
- ? operations
194
- : [],
195
- collapsible,
196
- collapsed,
150
+ operations: tag.operations,
151
+ collapsed: isCollapsed,
152
+ collapsible: isCollapsible,
197
153
  });
198
154
  });
199
155
 
200
- if (operationsData.schema.untagged.length > 0) {
156
+ const untaggedOperations = data.schema.tags.find(
157
+ (tag) => !tag.name,
158
+ )?.operations;
159
+
160
+ if (untaggedOperations) {
201
161
  categories.push(
202
162
  createSidebarCategory({
203
163
  label: "Other endpoints",
204
164
  path: joinUrl(basePath, versionParam, UNTAGGED_PATH),
205
- operations:
206
- match?.params.tag === UNTAGGED_PATH || options?.loadTags
207
- ? operationsData.schema.untagged
208
- : [],
209
- collapsible,
210
- collapsed,
165
+ operations: untaggedOperations,
166
+ collapsed: !config.options?.expandAllTags,
211
167
  }),
212
168
  );
213
169
  }
@@ -1,3 +1,5 @@
1
+ import type { SchemaImports } from "../../oas/graphql/index.js";
2
+
1
3
  type DynamicInput = () => Promise<unknown>;
2
4
 
3
5
  type OasSource =
@@ -15,11 +17,12 @@ type BaseOasConfig = {
15
17
  navigationId?: string;
16
18
  skipPreload?: boolean;
17
19
  tagPages?: Array<string>;
20
+ schemaImports?: SchemaImports;
18
21
  options?: {
19
22
  examplesLanguage?: string;
20
23
  disablePlayground?: boolean;
21
- loadTags?: boolean;
22
24
  showVersionSelect?: "always" | "if-available" | "hide";
25
+ expandAllTags?: boolean;
23
26
  };
24
27
  };
25
28
 
@@ -71,7 +71,7 @@ export const SchemaPropertyItem = ({
71
71
  return (
72
72
  <li className="p-4 bg-border/20 hover:bg-border/30">
73
73
  <div className="flex flex-col gap-2.5 justify-between text-sm">
74
- <div className="flex gap-2 items-center">
74
+ <div className="space-x-2">
75
75
  <code>{name}</code>
76
76
  <ParamInfos schema={schema} />
77
77
  <RecursiveIndicator />
@@ -84,7 +84,7 @@ export const SchemaPropertyItem = ({
84
84
  return (
85
85
  <li className="p-4 bg-border/20 hover:bg-border/30">
86
86
  <div className="flex flex-col gap-2.5 justify-between text-sm">
87
- <div className="flex gap-2 items-center">
87
+ <div className="space-x-2">
88
88
  <SelectOnClick asChild>
89
89
  <code>{name}</code>
90
90
  </SelectOnClick>
@@ -106,6 +106,9 @@ export const SchemaPropertyItem = ({
106
106
  content={schema.description}
107
107
  />
108
108
  )}
109
+ {schema.type === "array" && "items" in schema && schema.items.enum && (
110
+ <EnumValues values={schema.items.enum} />
111
+ )}
109
112
  {schema.enum && <EnumValues values={schema.enum} />}
110
113
 
111
114
  {(hasLogicalGroupings(schema) || isComplexType(schema)) && (
@@ -3,12 +3,22 @@ import type { SchemaObject } from "../../../oas/parser/index.js";
3
3
  import { Card, CardContent, CardHeader, CardTitle } from "../../../ui/Card.js";
4
4
  import { cn } from "../../../util/cn.js";
5
5
  import { groupBy } from "../../../util/groupBy.js";
6
+ import { EnumValues } from "../components/EnumValues.js";
7
+ import { ParamInfos } from "../ParamInfos.js";
6
8
  import {
7
9
  SchemaLogicalGroup,
8
10
  SchemaPropertyItem,
9
11
  } from "./SchemaPropertyItem.js";
10
12
  import { hasLogicalGroupings } from "./utils.js";
11
13
 
14
+ const renderMarkdown = (content?: string) =>
15
+ content && (
16
+ <Markdown
17
+ className={cn(ProseClasses, "text-sm leading-normal line-clamp-4")}
18
+ content={content}
19
+ />
20
+ );
21
+
12
22
  export const SchemaView = ({
13
23
  schema,
14
24
  level = 0,
@@ -33,11 +43,33 @@ export const SchemaView = ({
33
43
  return <SchemaLogicalGroup schema={schema} level={level} />;
34
44
  }
35
45
 
36
- // Sometimes items is not defined
37
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
38
- if (schema.type === "array" && schema.items) {
46
+ if (Array.isArray(schema.type)) {
47
+ return (
48
+ <Card className="p-4 space-y-2">
49
+ <span className="text-sm text-muted-foreground">
50
+ <ParamInfos schema={schema} />
51
+ </span>
52
+ {schema.enum && <EnumValues values={schema.enum} />}
53
+ {renderMarkdown(schema.description)}
54
+ </Card>
55
+ );
56
+ }
57
+
58
+ if (schema.type === "array" && typeof schema.items === "object") {
39
59
  const itemsSchema = schema.items as SchemaObject;
40
60
 
61
+ if (itemsSchema.enum) {
62
+ return (
63
+ <Card className="p-4">
64
+ <span className="text-sm text-muted-foreground">
65
+ <ParamInfos schema={schema} />
66
+ </span>
67
+ <EnumValues values={itemsSchema.enum} />
68
+ {renderMarkdown(schema.description)}
69
+ </Card>
70
+ );
71
+ }
72
+
41
73
  if (
42
74
  typeof itemsSchema.type === "string" &&
43
75
  ["string", "number", "boolean", "integer"].includes(itemsSchema.type)
@@ -45,17 +77,9 @@ export const SchemaView = ({
45
77
  return (
46
78
  <Card className="p-4">
47
79
  <span className="text-sm text-muted-foreground">
48
- {itemsSchema.type}[]
80
+ <ParamInfos schema={schema} />
49
81
  </span>
50
- {schema.description && (
51
- <Markdown
52
- className={cn(
53
- ProseClasses,
54
- "text-sm leading-normal line-clamp-4",
55
- )}
56
- content={schema.description}
57
- />
58
- )}
82
+ {renderMarkdown(schema.description)}
59
83
  </Card>
60
84
  );
61
85
  } else if (itemsSchema.type === "object") {
@@ -75,18 +99,12 @@ export const SchemaView = ({
75
99
  (!schema.properties || Object.keys(schema.properties).length === 0)
76
100
  ) {
77
101
  return (
78
- <Card className="p-4 flex gap-2 items-center">
102
+ <Card className="p-4 flex gap-2 items-baseline">
79
103
  {"name" in schema && <>{schema.name as string}</>}
80
- <span className="text-sm text-muted-foreground">object</span>
81
- {schema.description && (
82
- <Markdown
83
- className={cn(
84
- ProseClasses,
85
- "text-sm leading-normal line-clamp-4",
86
- )}
87
- content={schema.description}
88
- />
89
- )}
104
+ <span className="text-sm text-muted-foreground">
105
+ <ParamInfos schema={schema} />
106
+ </span>
107
+ {renderMarkdown(schema.description)}
90
108
  </Card>
91
109
  );
92
110
  }
@@ -133,17 +151,12 @@ export const SchemaView = ({
133
151
  ["string", "number", "boolean", "integer", "null"].includes(schema.type)
134
152
  ) {
135
153
  return (
136
- <Card className="p-4">
137
- <span className="text-sm text-muted-foreground">{schema.type}</span>
138
- {schema.description && (
139
- <Markdown
140
- className={cn(
141
- ProseClasses,
142
- "text-sm leading-normal line-clamp-4",
143
- )}
144
- content={schema.description}
145
- />
146
- )}
154
+ <Card className="p-4 space-y-2">
155
+ <span className="text-sm text-muted-foreground">
156
+ <ParamInfos schema={schema} />
157
+ </span>
158
+ {schema.enum && <EnumValues values={schema.enum} />}
159
+ {renderMarkdown(schema.description)}
147
160
  </Card>
148
161
  );
149
162
  }
@@ -28,12 +28,10 @@ export const createSidebarCategory = ({
28
28
  type: "link" as const,
29
29
  label: operation.summary ?? operation.path,
30
30
  href: `${path}#${operation.slug}`,
31
- ...(operation.method && {
32
- badge: {
33
- label: operation.method,
34
- color: MethodColorMap[operation.method.toLowerCase()]!,
35
- invert: true,
36
- } as const,
37
- }),
31
+ badge: {
32
+ label: operation.method,
33
+ color: MethodColorMap[operation.method.toLowerCase()]!,
34
+ invert: true,
35
+ },
38
36
  })),
39
37
  });