zudoku 0.26.0 → 0.27.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 (300) hide show
  1. package/dist/app/main.d.ts +1 -1
  2. package/dist/app/main.js +19 -7
  3. package/dist/app/main.js.map +1 -1
  4. package/dist/config/config.d.ts +1 -0
  5. package/dist/config/validators/InputSidebarSchema.d.ts +2 -2
  6. package/dist/config/validators/common.d.ts +78 -0
  7. package/dist/config/validators/common.js +6 -0
  8. package/dist/config/validators/common.js.map +1 -1
  9. package/dist/config/validators/validate.d.ts +34 -0
  10. package/dist/lib/authentication/providers/auth0.js +1 -1
  11. package/dist/lib/authentication/providers/auth0.js.map +1 -1
  12. package/dist/lib/authentication/providers/openid.d.ts +1 -1
  13. package/dist/lib/authentication/providers/openid.js +10 -6
  14. package/dist/lib/authentication/providers/openid.js.map +1 -1
  15. package/dist/lib/components/AnchorLink.js +5 -2
  16. package/dist/lib/components/AnchorLink.js.map +1 -1
  17. package/dist/lib/components/Autocomplete.d.ts +12 -0
  18. package/dist/lib/components/Autocomplete.js +47 -0
  19. package/dist/lib/components/Autocomplete.js.map +1 -0
  20. package/dist/lib/components/Header.js +4 -4
  21. package/dist/lib/components/Header.js.map +1 -1
  22. package/dist/lib/components/Heading.d.ts +1 -1
  23. package/dist/lib/components/Markdown.d.ts +2 -2
  24. package/dist/lib/components/Markdown.js +3 -1
  25. package/dist/lib/components/Markdown.js.map +1 -1
  26. package/dist/lib/components/StatusPage.d.ts +7 -0
  27. package/dist/lib/components/StatusPage.js +71 -0
  28. package/dist/lib/components/StatusPage.js.map +1 -0
  29. package/dist/lib/components/SyntaxHighlight.d.ts +2 -1
  30. package/dist/lib/components/SyntaxHighlight.js +2 -2
  31. package/dist/lib/components/SyntaxHighlight.js.map +1 -1
  32. package/dist/lib/components/ThemeSwitch.js +4 -4
  33. package/dist/lib/components/ThemeSwitch.js.map +1 -1
  34. package/dist/lib/components/cache.d.ts +6 -0
  35. package/dist/lib/components/cache.js +13 -0
  36. package/dist/lib/components/cache.js.map +1 -0
  37. package/dist/lib/components/context/ViewportAnchorContext.js +16 -4
  38. package/dist/lib/components/context/ViewportAnchorContext.js.map +1 -1
  39. package/dist/lib/components/context/ZudokuContext.js +2 -1
  40. package/dist/lib/components/context/ZudokuContext.js.map +1 -1
  41. package/dist/lib/components/index.d.ts +9 -2
  42. package/dist/lib/components/index.js +5 -2
  43. package/dist/lib/components/index.js.map +1 -1
  44. package/dist/lib/core/RouteGuard.d.ts +1 -0
  45. package/dist/lib/core/RouteGuard.js +28 -0
  46. package/dist/lib/core/RouteGuard.js.map +1 -0
  47. package/dist/lib/core/ZudokuContext.d.ts +4 -2
  48. package/dist/lib/core/ZudokuContext.js +9 -7
  49. package/dist/lib/core/ZudokuContext.js.map +1 -1
  50. package/dist/lib/oas/graphql/circular.d.ts +3 -0
  51. package/dist/lib/oas/graphql/circular.js +27 -0
  52. package/dist/lib/oas/graphql/circular.js.map +1 -0
  53. package/dist/lib/oas/graphql/index.js +5 -6
  54. package/dist/lib/oas/graphql/index.js.map +1 -1
  55. package/dist/lib/oas/parser/dereference/index.d.ts +0 -1
  56. package/dist/lib/oas/parser/dereference/index.js +1 -1
  57. package/dist/lib/oas/parser/dereference/index.js.map +1 -1
  58. package/dist/lib/plugins/markdown/MdxPage.js +8 -2
  59. package/dist/lib/plugins/markdown/MdxPage.js.map +1 -1
  60. package/dist/lib/plugins/openapi/OperationListItem.js +1 -1
  61. package/dist/lib/plugins/openapi/OperationListItem.js.map +1 -1
  62. package/dist/lib/plugins/openapi/ParameterListItem.js +1 -1
  63. package/dist/lib/plugins/openapi/ParameterListItem.js.map +1 -1
  64. package/dist/lib/plugins/openapi/PlaygroundDialogWrapper.d.ts +3 -1
  65. package/dist/lib/plugins/openapi/PlaygroundDialogWrapper.js +3 -2
  66. package/dist/lib/plugins/openapi/PlaygroundDialogWrapper.js.map +1 -1
  67. package/dist/lib/plugins/openapi/Sidecar.js +3 -3
  68. package/dist/lib/plugins/openapi/Sidecar.js.map +1 -1
  69. package/dist/lib/plugins/openapi/index.js +4 -11
  70. package/dist/lib/plugins/openapi/index.js.map +1 -1
  71. package/dist/lib/plugins/openapi/interfaces.d.ts +7 -2
  72. package/dist/lib/plugins/openapi/playground/ExamplesDropdown.d.ts +6 -0
  73. package/dist/lib/plugins/openapi/playground/ExamplesDropdown.js +12 -0
  74. package/dist/lib/plugins/openapi/playground/ExamplesDropdown.js.map +1 -0
  75. package/dist/lib/plugins/openapi/playground/Headers.js +67 -4
  76. package/dist/lib/plugins/openapi/playground/Headers.js.map +1 -1
  77. package/dist/lib/plugins/openapi/playground/ParamsGrid.d.ts +5 -0
  78. package/dist/lib/plugins/openapi/playground/ParamsGrid.js +4 -0
  79. package/dist/lib/plugins/openapi/playground/ParamsGrid.js.map +1 -0
  80. package/dist/lib/plugins/openapi/playground/PathParams.js +4 -12
  81. package/dist/lib/plugins/openapi/playground/PathParams.js.map +1 -1
  82. package/dist/lib/plugins/openapi/playground/Playground.d.ts +18 -1
  83. package/dist/lib/plugins/openapi/playground/Playground.js +53 -40
  84. package/dist/lib/plugins/openapi/playground/Playground.js.map +1 -1
  85. package/dist/lib/plugins/openapi/playground/PlaygroundDialog.js +1 -1
  86. package/dist/lib/plugins/openapi/playground/PlaygroundDialog.js.map +1 -1
  87. package/dist/lib/plugins/openapi/playground/QueryParams.js +21 -30
  88. package/dist/lib/plugins/openapi/playground/QueryParams.js.map +1 -1
  89. package/dist/lib/plugins/openapi/playground/SubmitButton.d.ts +7 -0
  90. package/dist/lib/plugins/openapi/playground/SubmitButton.js +22 -0
  91. package/dist/lib/plugins/openapi/playground/SubmitButton.js.map +1 -0
  92. package/dist/lib/plugins/openapi/playground/result-panel/RequestTab.d.ts +7 -0
  93. package/dist/lib/plugins/openapi/playground/result-panel/RequestTab.js +11 -0
  94. package/dist/lib/plugins/openapi/playground/result-panel/RequestTab.js.map +1 -0
  95. package/dist/lib/plugins/openapi/playground/result-panel/ResponseTab.d.ts +8 -0
  96. package/dist/lib/plugins/openapi/playground/result-panel/ResponseTab.js +95 -0
  97. package/dist/lib/plugins/openapi/playground/result-panel/ResponseTab.js.map +1 -0
  98. package/dist/lib/plugins/openapi/playground/result-panel/ResultPanel.d.ts +7 -0
  99. package/dist/lib/plugins/openapi/playground/result-panel/ResultPanel.js +16 -0
  100. package/dist/lib/plugins/openapi/playground/result-panel/ResultPanel.js.map +1 -0
  101. package/dist/lib/plugins/openapi/playground/result-panel/convertToTypes.d.ts +10 -0
  102. package/dist/lib/plugins/openapi/playground/result-panel/convertToTypes.js +32 -0
  103. package/dist/lib/plugins/openapi/playground/result-panel/convertToTypes.js.map +1 -0
  104. package/dist/lib/plugins/openapi/playground/result-panel/convertToTypes.test.d.ts +1 -0
  105. package/dist/lib/plugins/openapi/playground/result-panel/convertToTypes.test.js +56 -0
  106. package/dist/lib/plugins/openapi/playground/result-panel/convertToTypes.test.js.map +1 -0
  107. package/dist/lib/plugins/openapi/post-processors/removeExtensions.d.ts +2 -1
  108. package/dist/lib/plugins/openapi/post-processors/removeExtensions.js +5 -3
  109. package/dist/lib/plugins/openapi/post-processors/removeExtensions.js.map +1 -1
  110. package/dist/lib/plugins/openapi/post-processors/removeExtensions.test.js +49 -0
  111. package/dist/lib/plugins/openapi/post-processors/removeExtensions.test.js.map +1 -1
  112. package/dist/lib/plugins/openapi/post-processors/removeParameters.d.ts +10 -0
  113. package/dist/lib/plugins/openapi/post-processors/removeParameters.js +66 -0
  114. package/dist/lib/plugins/openapi/post-processors/removeParameters.js.map +1 -0
  115. package/dist/lib/plugins/openapi/post-processors/removeParameters.test.d.ts +1 -0
  116. package/dist/lib/plugins/openapi/post-processors/removeParameters.test.js +131 -0
  117. package/dist/lib/plugins/openapi/post-processors/removeParameters.test.js.map +1 -0
  118. package/dist/lib/plugins/openapi/schema/SchemaComponents.js +1 -1
  119. package/dist/lib/plugins/openapi/schema/SchemaComponents.js.map +1 -1
  120. package/dist/lib/ui/Command.d.ts +9 -1
  121. package/dist/lib/ui/Command.js +5 -1
  122. package/dist/lib/ui/Command.js.map +1 -1
  123. package/dist/lib/ui/Select.js +2 -2
  124. package/dist/lib/ui/Select.js.map +1 -1
  125. package/dist/lib/util/MdxComponents.js +2 -2
  126. package/dist/lib/util/MdxComponents.js.map +1 -1
  127. package/dist/lib/util/joinUrl.d.ts +1 -0
  128. package/dist/lib/util/joinUrl.js +40 -0
  129. package/dist/lib/util/joinUrl.js.map +1 -0
  130. package/dist/lib/util/useScrollToAnchor.d.ts +1 -0
  131. package/dist/lib/util/useScrollToAnchor.js +26 -15
  132. package/dist/lib/util/useScrollToAnchor.js.map +1 -1
  133. package/dist/vite/build.js +10 -10
  134. package/dist/vite/build.js.map +1 -1
  135. package/dist/vite/config.js +4 -1
  136. package/dist/vite/config.js.map +1 -1
  137. package/dist/vite/dev-server.js +4 -1
  138. package/dist/vite/dev-server.js.map +1 -1
  139. package/dist/vite/plugin-api.d.ts +1 -1
  140. package/dist/vite/plugin-api.js +31 -7
  141. package/dist/vite/plugin-api.js.map +1 -1
  142. package/dist/vite/plugin-auth.js +4 -1
  143. package/dist/vite/plugin-auth.js.map +1 -1
  144. package/dist/vite/plugin-mdx.js +9 -4
  145. package/dist/vite/plugin-mdx.js.map +1 -1
  146. package/dist/vite/prerender.d.ts +2 -2
  147. package/dist/vite/prerender.js +5 -4
  148. package/dist/vite/prerender.js.map +1 -1
  149. package/dist/zuplo/enrich-with-zuplo.d.ts +5 -0
  150. package/dist/zuplo/enrich-with-zuplo.js +184 -0
  151. package/dist/zuplo/enrich-with-zuplo.js.map +1 -0
  152. package/dist/zuplo/env.d.ts +1 -0
  153. package/dist/zuplo/env.js +3 -0
  154. package/dist/zuplo/env.js.map +1 -1
  155. package/dist/zuplo/policy-types.d.ts +33 -0
  156. package/dist/zuplo/policy-types.js +8 -0
  157. package/dist/zuplo/policy-types.js.map +1 -0
  158. package/dist/zuplo/with-zuplo-processors.d.ts +3 -0
  159. package/dist/zuplo/with-zuplo-processors.js +26 -0
  160. package/dist/zuplo/with-zuplo-processors.js.map +1 -0
  161. package/dist/zuplo/with-zuplo.d.ts +1 -1
  162. package/dist/zuplo/with-zuplo.js +7 -26
  163. package/dist/zuplo/with-zuplo.js.map +1 -1
  164. package/lib/{AuthenticationPlugin-DNXBcsVN.js → AuthenticationPlugin-CO_YCd2x.js} +3 -3
  165. package/lib/{AuthenticationPlugin-DNXBcsVN.js.map → AuthenticationPlugin-CO_YCd2x.js.map} +1 -1
  166. package/lib/{Markdown-BrfrjEk_.js → Markdown-B8o9Qz4q.js} +1197 -1186
  167. package/lib/{Markdown-BrfrjEk_.js.map → Markdown-B8o9Qz4q.js.map} +1 -1
  168. package/lib/{MdxPage-LNZLj_A5.js → MdxPage-BxRt3Ly7.js} +63 -58
  169. package/lib/MdxPage-BxRt3Ly7.js.map +1 -0
  170. package/lib/OperationList-DH-zIgtq.js +5160 -0
  171. package/lib/OperationList-DH-zIgtq.js.map +1 -0
  172. package/lib/{Route-Pzk6qwIk.js → Route-DJ0ZlVq1.js} +3 -3
  173. package/lib/{Route-Pzk6qwIk.js.map → Route-DJ0ZlVq1.js.map} +1 -1
  174. package/lib/{Select-DkOpAG0c.js → Select-B7UXR0SB.js} +61 -61
  175. package/lib/Select-B7UXR0SB.js.map +1 -0
  176. package/lib/{SlotletProvider-DPbx9KdU.js → SlotletProvider-CtIp8rP3.js} +4 -4
  177. package/lib/{SlotletProvider-DPbx9KdU.js.map → SlotletProvider-CtIp8rP3.js.map} +1 -1
  178. package/lib/{Button-oroWHXAy.js → Spinner-BlzrEEk1.js} +15 -12
  179. package/lib/Spinner-BlzrEEk1.js.map +1 -0
  180. package/lib/{SyntaxHighlight-CJCSPG1F.js → SyntaxHighlight-C1w1QPdY.js} +300 -295
  181. package/lib/{SyntaxHighlight-CJCSPG1F.js.map → SyntaxHighlight-C1w1QPdY.js.map} +1 -1
  182. package/lib/{ZudokuContext-D3ayHjP-.js → ZudokuContext-8jts0fF3.js} +259 -248
  183. package/lib/ZudokuContext-8jts0fF3.js.map +1 -0
  184. package/lib/{chunk-SYFQ2XB5-KWlHsT7t.js → chunk-SYFQ2XB5-BPvC-soB.js} +6 -5
  185. package/lib/{chunk-SYFQ2XB5-KWlHsT7t.js.map → chunk-SYFQ2XB5-BPvC-soB.js.map} +1 -1
  186. package/lib/circular-Dgpd6AN-.js +15397 -0
  187. package/lib/circular-Dgpd6AN-.js.map +1 -0
  188. package/lib/{createServer-BcaswoFO.js → createServer-BV0tHzLK.js} +3450 -5577
  189. package/lib/createServer-BV0tHzLK.js.map +1 -0
  190. package/lib/{hook-DUyACbIK.js → hook-BG02esyv.js} +2 -2
  191. package/lib/{hook-DUyACbIK.js.map → hook-BG02esyv.js.map} +1 -1
  192. package/lib/index-B7mqiOei.js +509 -0
  193. package/lib/index-B7mqiOei.js.map +1 -0
  194. package/lib/index-DmqsUPcm.js +1915 -0
  195. package/lib/index-DmqsUPcm.js.map +1 -0
  196. package/lib/joinUrl-BTy9bvoK.js +20 -0
  197. package/lib/joinUrl-BTy9bvoK.js.map +1 -0
  198. package/lib/post-processors/removeExtensions.js +7 -7
  199. package/lib/post-processors/removeExtensions.js.map +1 -1
  200. package/lib/post-processors/removeParameters.js +48 -0
  201. package/lib/post-processors/removeParameters.js.map +1 -0
  202. package/lib/ui/ActionButton.js +10 -11
  203. package/lib/ui/ActionButton.js.map +1 -1
  204. package/lib/ui/Command.js +125 -13
  205. package/lib/ui/Command.js.map +1 -1
  206. package/lib/ui/Select.js +2 -2
  207. package/lib/ui/Select.js.map +1 -1
  208. package/lib/{useExposedProps-BBHR7aLM.js → useExposedProps-BLKFBylA.js} +2 -2
  209. package/lib/{useExposedProps-BBHR7aLM.js.map → useExposedProps-BLKFBylA.js.map} +1 -1
  210. package/lib/useScrollToAnchor-Bl6mz9_x.js +288 -0
  211. package/lib/useScrollToAnchor-Bl6mz9_x.js.map +1 -0
  212. package/lib/zudoku.auth-auth0.js +7 -9
  213. package/lib/zudoku.auth-auth0.js.map +1 -1
  214. package/lib/zudoku.auth-clerk.js +1 -1
  215. package/lib/zudoku.auth-openid.js +223 -219
  216. package/lib/zudoku.auth-openid.js.map +1 -1
  217. package/lib/zudoku.components.js +754 -992
  218. package/lib/zudoku.components.js.map +1 -1
  219. package/lib/zudoku.plugin-api-catalog.js +3 -3
  220. package/lib/zudoku.plugin-api-keys.js +5 -5
  221. package/lib/zudoku.plugin-custom-pages.js +2 -2
  222. package/lib/zudoku.plugin-markdown.js +1 -1
  223. package/lib/zudoku.plugin-openapi.js +4 -4
  224. package/lib/zudoku.plugin-redirect.js +1 -1
  225. package/package.json +2 -2
  226. package/src/app/main.css +50 -50
  227. package/src/app/main.tsx +26 -7
  228. package/src/lib/authentication/providers/auth0.tsx +1 -4
  229. package/src/lib/authentication/providers/openid.tsx +12 -5
  230. package/src/lib/components/AnchorLink.tsx +5 -2
  231. package/src/lib/components/Autocomplete.tsx +111 -0
  232. package/src/lib/components/Header.tsx +4 -4
  233. package/src/lib/components/Markdown.tsx +14 -15
  234. package/src/lib/components/StatusPage.tsx +91 -0
  235. package/src/lib/components/SyntaxHighlight.tsx +14 -0
  236. package/src/lib/components/ThemeSwitch.tsx +14 -15
  237. package/src/lib/components/cache.ts +15 -0
  238. package/src/lib/components/context/ViewportAnchorContext.tsx +20 -6
  239. package/src/lib/components/context/ZudokuContext.ts +3 -1
  240. package/src/lib/components/index.ts +9 -2
  241. package/src/lib/core/RouteGuard.tsx +35 -0
  242. package/src/lib/core/ZudokuContext.ts +9 -8
  243. package/src/lib/oas/graphql/circular.ts +29 -0
  244. package/src/lib/oas/graphql/index.ts +9 -9
  245. package/src/lib/oas/parser/dereference/index.ts +1 -2
  246. package/src/lib/plugins/markdown/MdxPage.tsx +9 -1
  247. package/src/lib/plugins/openapi/OperationListItem.tsx +0 -2
  248. package/src/lib/plugins/openapi/ParameterListItem.tsx +1 -0
  249. package/src/lib/plugins/openapi/PlaygroundDialogWrapper.tsx +5 -0
  250. package/src/lib/plugins/openapi/Sidecar.tsx +4 -2
  251. package/src/lib/plugins/openapi/index.tsx +9 -15
  252. package/src/lib/plugins/openapi/interfaces.ts +10 -2
  253. package/src/lib/plugins/openapi/playground/ExamplesDropdown.tsx +54 -0
  254. package/src/lib/plugins/openapi/playground/Headers.tsx +136 -39
  255. package/src/lib/plugins/openapi/playground/ParamsGrid.tsx +8 -0
  256. package/src/lib/plugins/openapi/playground/PathParams.tsx +34 -74
  257. package/src/lib/plugins/openapi/playground/Playground.tsx +219 -177
  258. package/src/lib/plugins/openapi/playground/PlaygroundDialog.tsx +1 -1
  259. package/src/lib/plugins/openapi/playground/QueryParams.tsx +90 -122
  260. package/src/lib/plugins/openapi/playground/SubmitButton.tsx +75 -0
  261. package/src/lib/plugins/openapi/playground/result-panel/RequestTab.tsx +73 -0
  262. package/src/lib/plugins/openapi/playground/result-panel/ResponseTab.tsx +210 -0
  263. package/src/lib/plugins/openapi/playground/result-panel/ResultPanel.tsx +101 -0
  264. package/src/lib/plugins/openapi/playground/result-panel/convertToTypes.test.ts +64 -0
  265. package/src/lib/plugins/openapi/playground/result-panel/convertToTypes.ts +36 -0
  266. package/src/lib/plugins/openapi/post-processors/removeExtensions.test.ts +58 -0
  267. package/src/lib/plugins/openapi/post-processors/removeExtensions.ts +7 -4
  268. package/src/lib/plugins/openapi/post-processors/removeParameters.test.ts +148 -0
  269. package/src/lib/plugins/openapi/post-processors/removeParameters.ts +101 -0
  270. package/src/lib/plugins/openapi/schema/SchemaComponents.tsx +1 -1
  271. package/src/lib/ui/Command.tsx +20 -0
  272. package/src/lib/ui/Select.tsx +1 -1
  273. package/src/lib/util/MdxComponents.tsx +2 -1
  274. package/src/lib/util/joinUrl.ts +57 -0
  275. package/src/lib/util/useScrollToAnchor.ts +32 -15
  276. package/dist/lib/plugins/openapi/playground/EnumSelector.d.ts +0 -8
  277. package/dist/lib/plugins/openapi/playground/EnumSelector.js +0 -21
  278. package/dist/lib/plugins/openapi/playground/EnumSelector.js.map +0 -1
  279. package/dist/lib/plugins/openapi/playground/ResponseTab.d.ts +0 -4
  280. package/dist/lib/plugins/openapi/playground/ResponseTab.js +0 -42
  281. package/dist/lib/plugins/openapi/playground/ResponseTab.js.map +0 -1
  282. package/lib/AnchorLink-_Vu02ceN.js +0 -34
  283. package/lib/AnchorLink-_Vu02ceN.js.map +0 -1
  284. package/lib/Button-oroWHXAy.js.map +0 -1
  285. package/lib/Command-D5DE0DD7.js +0 -611
  286. package/lib/Command-D5DE0DD7.js.map +0 -1
  287. package/lib/MdxPage-LNZLj_A5.js.map +0 -1
  288. package/lib/OperationList-PCwzTp1r.js +0 -5144
  289. package/lib/OperationList-PCwzTp1r.js.map +0 -1
  290. package/lib/Select-DkOpAG0c.js.map +0 -1
  291. package/lib/Spinner-C5gHXrVz.js +0 -7
  292. package/lib/Spinner-C5gHXrVz.js.map +0 -1
  293. package/lib/ZudokuContext-D3ayHjP-.js.map +0 -1
  294. package/lib/createServer-BcaswoFO.js.map +0 -1
  295. package/lib/index-CaILD1AV.js +0 -1292
  296. package/lib/index-CaILD1AV.js.map +0 -1
  297. package/lib/index-TaRXY2w1.js +0 -43
  298. package/lib/index-TaRXY2w1.js.map +0 -1
  299. package/src/lib/plugins/openapi/playground/EnumSelector.tsx +0 -86
  300. package/src/lib/plugins/openapi/playground/ResponseTab.tsx +0 -76
@@ -0,0 +1,101 @@
1
+ import { UseMutationResult } from "@tanstack/react-query";
2
+ import { Spinner } from "../../../../components/Spinner.js";
3
+ import { Callout } from "../../../../ui/Callout.js";
4
+ import {
5
+ Card,
6
+ CardContent,
7
+ CardHeader,
8
+ CardTitle,
9
+ } from "../../../../ui/Card.js";
10
+ import {
11
+ Tabs,
12
+ TabsContent,
13
+ TabsList,
14
+ TabsTrigger,
15
+ } from "../../../../ui/Tabs.js";
16
+ import { cn } from "../../../../util/cn.js";
17
+ import { PlaygroundResult } from "../Playground.js";
18
+ import { RequestTab } from "./RequestTab.js";
19
+ import { ResponseTab } from "./ResponseTab.js";
20
+
21
+ export const ResultPanel = ({
22
+ queryMutation,
23
+ showPathParamsWarning,
24
+ }: {
25
+ queryMutation: UseMutationResult<PlaygroundResult, Error, any, unknown>;
26
+ showPathParamsWarning: boolean;
27
+ }) => {
28
+ const status = ((queryMutation.data?.status ?? 0) / 100).toFixed(0);
29
+ return (
30
+ <div className="min-w-0 p-8 bg-muted/70 overflow-y-auto">
31
+ {queryMutation.error ? (
32
+ <div className="flex flex-col gap-2">
33
+ {showPathParamsWarning && (
34
+ <Callout type="caution">
35
+ Some path parameters are missing values. Please fill them in to
36
+ ensure the request is sent correctly.
37
+ </Callout>
38
+ )}
39
+ <Card>
40
+ <CardHeader>
41
+ <CardTitle>Request failed</CardTitle>
42
+ </CardHeader>
43
+ <CardContent>
44
+ Error:{" "}
45
+ {queryMutation.error.message ||
46
+ String(queryMutation.error) ||
47
+ "Unexpected error"}
48
+ </CardContent>
49
+ </Card>
50
+ </div>
51
+ ) : queryMutation.data ? (
52
+ <div className="flex flex-col gap-2">
53
+ <Tabs defaultValue="response">
54
+ <TabsList>
55
+ <TabsTrigger value="request">Request</TabsTrigger>
56
+ <TabsTrigger value="response">
57
+ Response
58
+ <span
59
+ className={cn(
60
+ "text-xs font-mono ml-1",
61
+ status === "2" && "text-green-500",
62
+ status === "3" && "text-blue-500",
63
+ status === "4" && "text-yellow-500",
64
+ status === "5" && "text-red-500",
65
+ )}
66
+ >
67
+ ({queryMutation.data.status})
68
+ </span>
69
+ </TabsTrigger>
70
+ </TabsList>
71
+ <TabsContent value="request">
72
+ <RequestTab {...queryMutation.data.request} />
73
+ </TabsContent>
74
+ <TabsContent value="response">
75
+ <ResponseTab
76
+ status={queryMutation.data.status}
77
+ time={queryMutation.data.time}
78
+ size={queryMutation.data.size}
79
+ headers={queryMutation.data.headers}
80
+ body={queryMutation.data.body}
81
+ url={queryMutation.data.request.url}
82
+ />
83
+ </TabsContent>
84
+ </Tabs>
85
+ </div>
86
+ ) : (
87
+ <div className="grid place-items-center h-full">
88
+ <span className="text-[16px] font-semibold text-muted-foreground">
89
+ {queryMutation.isPending ? (
90
+ <Spinner />
91
+ ) : (
92
+ "Send a request first to see the response here"
93
+ )}
94
+ </span>
95
+ </div>
96
+ )}
97
+ </div>
98
+ );
99
+ };
100
+
101
+ export default ResultPanel;
@@ -0,0 +1,64 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { generateInterface } from "./convertToTypes.js";
3
+
4
+ describe("generateInterface", () => {
5
+ it("should handle primitive types", () => {
6
+ const input = {
7
+ string: "hello",
8
+ number: 42,
9
+ boolean: true,
10
+ null: null,
11
+ };
12
+
13
+ const expected = [
14
+ "{",
15
+ " string: string;",
16
+ " number: number;",
17
+ " boolean: boolean;",
18
+ " null: null;",
19
+ "}",
20
+ ].join("\n");
21
+
22
+ expect(generateInterface(input)).toBe(expected);
23
+ });
24
+
25
+ it("should handle nested objects", () => {
26
+ const input = {
27
+ user: {
28
+ name: "John",
29
+ age: 30,
30
+ },
31
+ };
32
+
33
+ const expected = [
34
+ "{",
35
+ " user: {",
36
+ " name: string;",
37
+ " age: number;",
38
+ "};",
39
+ "}",
40
+ ].join("\n");
41
+
42
+ expect(generateInterface(input)).toBe(expected);
43
+ });
44
+
45
+ it("should handle arrays", () => {
46
+ const input = {
47
+ numbers: [1, 2, 3],
48
+ empty: [],
49
+ objects: [{ id: 1 }],
50
+ };
51
+
52
+ const expected = [
53
+ "{",
54
+ " numbers: number[];",
55
+ " empty: any[];",
56
+ " objects: {",
57
+ " id: number;",
58
+ "}[];",
59
+ "}",
60
+ ].join("\n");
61
+
62
+ expect(generateInterface(input)).toBe(expected);
63
+ });
64
+ });
@@ -0,0 +1,36 @@
1
+ type JsonValue = string | number | boolean | null | JsonObject | JsonArray;
2
+ type JsonObject = { [key: string]: JsonValue };
3
+ type JsonArray = JsonValue[];
4
+
5
+ function inferType(value: JsonValue): string {
6
+ if (value === null) return "null";
7
+ if (Array.isArray(value)) {
8
+ if (value.length === 0) return "any[]";
9
+ const firstValue = value[0];
10
+ if (firstValue === undefined) return "any[]";
11
+ const elementType = inferType(firstValue);
12
+ return `${elementType}[]`;
13
+ }
14
+ if (typeof value === "object") {
15
+ return generateInterface(value);
16
+ }
17
+ return typeof value;
18
+ }
19
+
20
+ export function generateInterface(obj: JsonObject, indentation = ""): string {
21
+ const lines: string[] = ["{"];
22
+
23
+ for (const [key, value] of Object.entries(obj)) {
24
+ const propertyType = inferType(value);
25
+ lines.push(` ${key}: ${propertyType};`);
26
+ }
27
+
28
+ lines.push("}");
29
+ return lines.join("\n");
30
+ }
31
+
32
+ export function convertToTypes(json: JsonValue): { lines: string[] } {
33
+ const typeDefinition = inferType(json);
34
+ const lines = [`type GeneratedType = ${typeDefinition};`];
35
+ return { lines };
36
+ }
@@ -4,28 +4,34 @@ import { removeExtensions } from "./removeExtensions.js";
4
4
  const baseDoc = {
5
5
  openapi: "3.1.0",
6
6
  "x-root-ext": "remove me",
7
+ "x-zuplo-ext": "remove me too",
7
8
  info: {
8
9
  title: "Test API",
9
10
  version: "1.0.0",
10
11
  "x-info-ext": "remove me",
12
+ "x-zuplo-info": "remove me too",
11
13
  },
12
14
  paths: {
13
15
  "/test": {
14
16
  "x-path-ext": "remove me",
17
+ "x-zuplo-path": "remove me too",
15
18
  parameters: [
16
19
  {
17
20
  name: "param1",
18
21
  in: "query",
19
22
  schema: { type: "string" },
20
23
  "x-param-ext": "remove me",
24
+ "x-zuplo-param": "remove me too",
21
25
  },
22
26
  ],
23
27
  get: {
24
28
  "x-operation-ext": "remove me",
29
+ "x-zuplo-route": "remove me too",
25
30
  responses: {
26
31
  "200": {
27
32
  description: "OK",
28
33
  "x-response-ext": "remove me",
34
+ "x-zuplo-response": "remove me too",
29
35
  },
30
36
  },
31
37
  parameters: [
@@ -34,6 +40,7 @@ const baseDoc = {
34
40
  in: "header",
35
41
  schema: { type: "string" },
36
42
  "x-op-param-ext": "remove me",
43
+ "x-zuplo-param": "remove me too",
37
44
  },
38
45
  ],
39
46
  },
@@ -43,6 +50,7 @@ const baseDoc = {
43
50
  {
44
51
  name: "example",
45
52
  "x-tag-ext": "remove me",
53
+ "x-zuplo-tag": "remove me too",
46
54
  },
47
55
  ],
48
56
  components: {
@@ -52,6 +60,7 @@ const baseDoc = {
52
60
  name: "api_key",
53
61
  in: "header",
54
62
  "x-security-ext": "remove me",
63
+ "x-zuplo-security": "remove me too",
55
64
  },
56
65
  },
57
66
  },
@@ -141,4 +150,53 @@ describe("removeExtensions", () => {
141
150
 
142
151
  expect(processed).toEqual(docWithoutExtensions);
143
152
  });
153
+
154
+ it("removes extensions based on shouldRemove callback", () => {
155
+ const processed = removeExtensions({
156
+ shouldRemove: (key) => key.startsWith("x-zuplo"),
157
+ })(baseDoc);
158
+
159
+ // Should remove x-zuplo extensions
160
+ const removedExtensions = [
161
+ "x-zuplo-ext",
162
+ "info.x-zuplo-info",
163
+ "paths./test.x-zuplo-path",
164
+ "paths./test.parameters.0.x-zuplo-param",
165
+ "paths./test.get.x-zuplo-route",
166
+ "paths./test.get.responses.200.x-zuplo-response",
167
+ "paths./test.get.parameters.0.x-zuplo-param",
168
+ "tags.0.x-zuplo-tag",
169
+ "components.securitySchemes.ApiKeyAuth.x-zuplo-security",
170
+ ];
171
+
172
+ // Should keep other x- extensions
173
+ const keptExtensions = [
174
+ "x-root-ext",
175
+ "info.x-info-ext",
176
+ "paths./test.x-path-ext",
177
+ "paths./test.parameters.0.x-param-ext",
178
+ "paths./test.get.x-operation-ext",
179
+ "paths./test.get.responses.200.x-response-ext",
180
+ "paths./test.get.parameters.0.x-op-param-ext",
181
+ "tags.0.x-tag-ext",
182
+ "components.securitySchemes.ApiKeyAuth.x-security-ext",
183
+ ];
184
+
185
+ removedExtensions.forEach((ext) => {
186
+ expect(processed).not.toHaveProperty(ext.split("."));
187
+ });
188
+
189
+ keptExtensions.forEach((ext) => {
190
+ expect(processed).toHaveProperty(ext.split("."));
191
+ });
192
+
193
+ // Assert that non-x- fields remain unchanged
194
+ expect(processed).toHaveProperty("openapi", "3.1.0");
195
+ expect(processed).toHaveProperty("info.title", "Test API");
196
+ expect(processed).toHaveProperty(
197
+ "paths./test.get.responses.200.description",
198
+ "OK",
199
+ );
200
+ expect(processed).toHaveProperty("tags.0.name", "example");
201
+ });
144
202
  });
@@ -2,21 +2,24 @@ import { type RecordAny, traverse } from "./traverse.js";
2
2
 
3
3
  interface RemoveExtensionsOptions {
4
4
  keys?: string[];
5
+ shouldRemove?: (key: string) => boolean;
5
6
  }
6
7
 
7
8
  // Remove all `x-` prefixed key/value pairs, or filter by names if provided
8
9
  export const removeExtensions =
9
- ({ keys }: RemoveExtensionsOptions = {}) =>
10
+ ({ keys, shouldRemove }: RemoveExtensionsOptions = {}) =>
10
11
  (doc: RecordAny): RecordAny =>
11
12
  traverse(doc, (spec) => {
12
13
  const result: RecordAny = {};
13
14
 
14
15
  for (const [key, value] of Object.entries(spec)) {
15
16
  const isExtension = key.startsWith("x-");
16
- const shouldRemove =
17
- isExtension && (keys === undefined || keys.includes(key));
17
+ const shouldBeRemoved =
18
+ isExtension &&
19
+ (keys === undefined || keys.includes(key)) &&
20
+ (!shouldRemove || shouldRemove(key));
18
21
 
19
- if (shouldRemove) continue;
22
+ if (shouldBeRemoved) continue;
20
23
 
21
24
  result[key] = value;
22
25
  }
@@ -0,0 +1,148 @@
1
+ import { type OpenAPIV3_1 } from "openapi-types";
2
+ import { describe, expect, it } from "vitest";
3
+ import { removeParameters } from "./removeParameters.js";
4
+
5
+ const baseDoc: OpenAPIV3_1.Document = {
6
+ openapi: "3.1.0",
7
+ info: {
8
+ title: "Test API",
9
+ version: "1.0.0",
10
+ },
11
+ components: {
12
+ parameters: {
13
+ commonParam: {
14
+ name: "commonParam",
15
+ in: "query",
16
+ schema: { type: "string" },
17
+ },
18
+ headerParam: {
19
+ name: "headerParam",
20
+ in: "header",
21
+ schema: { type: "string" },
22
+ },
23
+ },
24
+ },
25
+ paths: {
26
+ "/test": {
27
+ parameters: [
28
+ {
29
+ name: "pathParam",
30
+ in: "path",
31
+ schema: { type: "string" },
32
+ required: true,
33
+ },
34
+ {
35
+ name: "pathHeader",
36
+ in: "header",
37
+ schema: { type: "string" },
38
+ required: true,
39
+ },
40
+ ],
41
+ get: {
42
+ parameters: [
43
+ {
44
+ name: "opParam",
45
+ in: "query",
46
+ schema: { type: "string" },
47
+ required: true,
48
+ },
49
+ {
50
+ name: "opHeader",
51
+ in: "header",
52
+ schema: { type: "string" },
53
+ required: true,
54
+ },
55
+ ],
56
+ responses: {
57
+ "200": {
58
+ description: "OK",
59
+ },
60
+ },
61
+ },
62
+ },
63
+ },
64
+ };
65
+
66
+ describe("removeParameters", () => {
67
+ it("removes parameters by name", () => {
68
+ const processed = removeParameters({
69
+ names: ["pathParam", "opParam"],
70
+ })(baseDoc);
71
+
72
+ expect(processed.paths["/test"].parameters).toHaveLength(1);
73
+ expect(processed.paths["/test"].parameters[0].name).toBe("pathHeader");
74
+ expect(processed.paths["/test"].get.parameters).toHaveLength(1);
75
+ expect(processed.paths["/test"].get.parameters[0].name).toBe("opHeader");
76
+ });
77
+
78
+ it("removes parameters by location", () => {
79
+ const processed = removeParameters({
80
+ in: ["header"],
81
+ })(baseDoc);
82
+
83
+ expect(processed.paths["/test"].parameters).toHaveLength(1);
84
+ expect(processed.paths["/test"].parameters[0].in).toBe("path");
85
+ expect(processed.paths["/test"].get.parameters).toHaveLength(1);
86
+ expect(processed.paths["/test"].get.parameters[0].in).toBe("query");
87
+ });
88
+
89
+ it("removes parameters using shouldRemove callback", () => {
90
+ const processed = removeParameters({
91
+ shouldRemove: ({ parameter }) =>
92
+ parameter.in === "header" && parameter.name.includes("op"),
93
+ })(baseDoc);
94
+
95
+ expect(processed.paths["/test"].parameters).toHaveLength(2);
96
+ expect(processed.paths["/test"].get.parameters).toHaveLength(1);
97
+ expect(processed.paths["/test"].get.parameters[0].name).toBe("opParam");
98
+ });
99
+
100
+ it("combines multiple removal criteria", () => {
101
+ const processed = removeParameters({
102
+ in: ["query", "header"],
103
+ shouldRemove: ({ parameter }) => parameter.name === "pathHeader",
104
+ })(baseDoc);
105
+
106
+ expect(processed.paths["/test"].parameters).toHaveLength(1);
107
+ expect(processed.paths["/test"].parameters[0].name).toBe("pathParam");
108
+ expect(processed.paths["/test"].get.parameters).toHaveLength(0);
109
+ });
110
+
111
+ it("handles missing parameters arrays", () => {
112
+ const docWithoutParams = {
113
+ openapi: "3.1.0",
114
+ paths: {
115
+ "/test": {
116
+ get: {
117
+ summary: "Test endpoint",
118
+ },
119
+ },
120
+ },
121
+ };
122
+
123
+ const processed = removeParameters({
124
+ names: ["someParam"],
125
+ })(docWithoutParams);
126
+
127
+ expect(processed).toEqual(docWithoutParams);
128
+ });
129
+
130
+ it("preserves non-parameter properties", () => {
131
+ const processed = removeParameters({
132
+ names: ["globalParam"],
133
+ })(baseDoc);
134
+
135
+ expect(processed.openapi).toBe("3.1.0");
136
+ expect(processed.paths["/test"].get).toBeDefined();
137
+ });
138
+
139
+ it("removes parameters from components", () => {
140
+ const processed = removeParameters({
141
+ in: ["header"],
142
+ })(baseDoc);
143
+
144
+ expect(Object.keys(processed.components.parameters)).toHaveLength(1);
145
+ expect(processed.components.parameters.commonParam).toBeDefined();
146
+ expect(processed.components.parameters.headerParam).toBeUndefined();
147
+ });
148
+ });
@@ -0,0 +1,101 @@
1
+ import { type RecordAny, traverse } from "./traverse.js";
2
+
3
+ interface RemoveParametersOptions {
4
+ // Names of parameters to remove
5
+ names?: string[];
6
+ // Specific locations to remove parameters from ('query', 'header', 'path', 'cookie')
7
+ in?: string[];
8
+ // Custom filter function
9
+ shouldRemove?: ({ parameter }: { parameter: RecordAny }) => boolean;
10
+ }
11
+
12
+ export const removeParameters =
13
+ ({ names, in: locations, shouldRemove }: RemoveParametersOptions = {}) =>
14
+ (doc: RecordAny): RecordAny =>
15
+ traverse(doc, (spec) => {
16
+ // Helper function to filter parameters
17
+ const filterParameters = (parameters: RecordAny[]) =>
18
+ parameters.filter((p) => {
19
+ if (names?.includes(p.name)) return false;
20
+ if (locations?.includes(p.in)) return false;
21
+ if (shouldRemove?.({ parameter: p })) return false;
22
+ return true;
23
+ });
24
+
25
+ // Handle components.parameters
26
+ if (spec.components?.parameters) {
27
+ spec = {
28
+ ...spec,
29
+ components: {
30
+ ...spec.components,
31
+ parameters: Object.fromEntries(
32
+ Object.entries(spec.components.parameters).filter(
33
+ ([_, param]) => {
34
+ const p = param as RecordAny;
35
+ if (p.$ref) return true; // Skip references
36
+ return (
37
+ !names?.includes(p.name) &&
38
+ !locations?.includes(p.in) &&
39
+ !shouldRemove?.({ parameter: p })
40
+ );
41
+ },
42
+ ),
43
+ ),
44
+ },
45
+ };
46
+ }
47
+
48
+ // Handle paths
49
+ if (spec.paths) {
50
+ const updatedPaths: RecordAny = {};
51
+
52
+ for (const [path, pathItem] of Object.entries(spec.paths)) {
53
+ if (typeof pathItem !== "object" || pathItem === null) {
54
+ updatedPaths[path] = pathItem;
55
+ continue;
56
+ }
57
+
58
+ let updatedPathItem = { ...pathItem };
59
+
60
+ // Handle path-level parameters
61
+ if (
62
+ "parameters" in updatedPathItem &&
63
+ Array.isArray(updatedPathItem.parameters)
64
+ ) {
65
+ updatedPathItem.parameters = filterParameters(
66
+ updatedPathItem.parameters,
67
+ );
68
+ }
69
+
70
+ // Handle operation-level parameters
71
+ for (const method of Object.keys(updatedPathItem)) {
72
+ const pathItemWithMethods = updatedPathItem as Record<
73
+ string,
74
+ RecordAny
75
+ >;
76
+
77
+ if (
78
+ method === "parameters" ||
79
+ typeof pathItemWithMethods[method] !== "object"
80
+ ) {
81
+ continue;
82
+ }
83
+
84
+ const operation = pathItemWithMethods[method];
85
+ if (Array.isArray(operation.parameters)) {
86
+ pathItemWithMethods[method] = {
87
+ ...operation,
88
+ parameters: filterParameters(operation.parameters),
89
+ };
90
+ updatedPathItem = pathItemWithMethods;
91
+ }
92
+ }
93
+
94
+ updatedPaths[path] = updatedPathItem;
95
+ }
96
+
97
+ spec = { ...spec, paths: updatedPaths };
98
+ }
99
+
100
+ return spec;
101
+ });
@@ -3,7 +3,7 @@ import { ListPlusIcon, RefreshCcwDotIcon } from "lucide-react";
3
3
  import { useCallback, useState } from "react";
4
4
  import { Badge } from "zudoku/ui/Badge.js";
5
5
  import { Markdown, ProseClasses } from "../../../components/Markdown.js";
6
- import { CIRCULAR_REF } from "../../../oas/parser/dereference/index.js";
6
+ import { CIRCULAR_REF } from "../../../oas/graphql/circular.js";
7
7
  import type { SchemaObject } from "../../../oas/parser/index.js";
8
8
  import { Button } from "../../../ui/Button.js";
9
9
  import { cn } from "../../../util/cn.js";
@@ -52,6 +52,25 @@ const CommandInput = React.forwardRef<
52
52
 
53
53
  CommandInput.displayName = CommandPrimitive.Input.displayName;
54
54
 
55
+ const CommandInlineInput = React.forwardRef<
56
+ React.ElementRef<typeof CommandPrimitive.Input>,
57
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>
58
+ >(({ className, ...props }, ref) => (
59
+ // eslint-disable-next-line react/no-unknown-property
60
+ <div className="flex items-center" cmdk-input-wrapper="">
61
+ <CommandPrimitive.Input
62
+ ref={ref}
63
+ className={cn(
64
+ "flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50",
65
+ "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
66
+ className,
67
+ )}
68
+ {...props}
69
+ />
70
+ </div>
71
+ ));
72
+
73
+ CommandInlineInput.displayName = CommandPrimitive.Input.displayName;
55
74
  const CommandList = React.forwardRef<
56
75
  React.ElementRef<typeof CommandPrimitive.List>,
57
76
  React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>
@@ -143,6 +162,7 @@ export {
143
162
  CommandDialog,
144
163
  CommandEmpty,
145
164
  CommandGroup,
165
+ CommandInlineInput,
146
166
  CommandInput,
147
167
  CommandItem,
148
168
  CommandList,
@@ -83,9 +83,9 @@ const SelectContent = React.forwardRef<
83
83
  <SelectScrollUpButton />
84
84
  <SelectPrimitive.Viewport
85
85
  className={cn(
86
- "p-1",
87
86
  position === "popper" &&
88
87
  "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]",
88
+ "divide-y",
89
89
  )}
90
90
  >
91
91
  {children}
@@ -61,7 +61,7 @@ export const MdxComponents = {
61
61
  code: ({ className, children, ...props }) => {
62
62
  // `inline` provided by the rehype plugin, as react-markdown removed support for that
63
63
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
64
- const inline = (props as any).inline;
64
+ const { inline, title } = props as Record<string, unknown>;
65
65
 
66
66
  if (inline === true || inline === "true") {
67
67
  return <InlineCode className={className}>{children}</InlineCode>;
@@ -75,6 +75,7 @@ export const MdxComponents = {
75
75
  className="rounded-xl p-4 border dark:!bg-foreground/10 dark:border-transparent"
76
76
  showLanguageIndicator
77
77
  code={String(children).trim()}
78
+ title={typeof title === "string" ? title : undefined}
78
79
  />
79
80
  );
80
81
  },