zudoku 0.0.0-z7b86faab → 0.0.0-z8ac421f0

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 (321) hide show
  1. package/dist/app/main.js +1 -1
  2. package/dist/app/main.js.map +1 -1
  3. package/dist/config/create-plugin.d.ts +2 -0
  4. package/dist/config/create-plugin.js +55 -0
  5. package/dist/config/create-plugin.js.map +1 -0
  6. package/dist/config/loader.js +2 -2
  7. package/dist/config/loader.js.map +1 -1
  8. package/dist/config/validators/InputNavigationSchema.d.ts +174 -124
  9. package/dist/config/validators/InputNavigationSchema.js +17 -0
  10. package/dist/config/validators/InputNavigationSchema.js.map +1 -1
  11. package/dist/config/validators/NavigationSchema.d.ts +10 -2
  12. package/dist/config/validators/NavigationSchema.js +7 -0
  13. package/dist/config/validators/NavigationSchema.js.map +1 -1
  14. package/dist/config/validators/ProtectedRoutesSchema.d.ts +1 -1
  15. package/dist/config/validators/validate.d.ts +6 -5
  16. package/dist/config/validators/validate.js +2 -0
  17. package/dist/config/validators/validate.js.map +1 -1
  18. package/dist/flat-config.d.ts +36 -24
  19. package/dist/index.d.ts +2 -1
  20. package/dist/index.js +1 -0
  21. package/dist/index.js.map +1 -1
  22. package/dist/lib/components/Bootstrap.js +1 -2
  23. package/dist/lib/components/Bootstrap.js.map +1 -1
  24. package/dist/lib/components/Heading.d.ts +1 -1
  25. package/dist/lib/components/MobileTopNavigation.js +2 -1
  26. package/dist/lib/components/MobileTopNavigation.js.map +1 -1
  27. package/dist/lib/components/Slot.test.js +1 -1
  28. package/dist/lib/components/Slot.test.js.map +1 -1
  29. package/dist/lib/components/TopNavigation.d.ts +7 -1
  30. package/dist/lib/components/TopNavigation.js +7 -2
  31. package/dist/lib/components/TopNavigation.js.map +1 -1
  32. package/dist/lib/components/Zudoku.d.ts +4 -1
  33. package/dist/lib/components/Zudoku.js +4 -7
  34. package/dist/lib/components/Zudoku.js.map +1 -1
  35. package/dist/lib/components/context/ZudokuContext.d.ts +9 -4
  36. package/dist/lib/components/context/ZudokuContext.js +4 -2
  37. package/dist/lib/components/context/ZudokuContext.js.map +1 -1
  38. package/dist/lib/components/context/ZudokuProvider.js +1 -1
  39. package/dist/lib/components/context/ZudokuProvider.js.map +1 -1
  40. package/dist/lib/components/context/ZudokuReactContext.d.ts +11 -0
  41. package/dist/lib/components/context/ZudokuReactContext.js +4 -0
  42. package/dist/lib/components/context/ZudokuReactContext.js.map +1 -0
  43. package/dist/lib/components/index.d.ts +18 -74
  44. package/dist/lib/components/index.js +19 -36
  45. package/dist/lib/components/index.js.map +1 -1
  46. package/dist/lib/components/navigation/Navigation.js +4 -3
  47. package/dist/lib/components/navigation/Navigation.js.map +1 -1
  48. package/dist/lib/components/navigation/NavigationCategory.js +8 -0
  49. package/dist/lib/components/navigation/NavigationCategory.js.map +1 -1
  50. package/dist/lib/components/navigation/NavigationFilterContext.d.ts +8 -0
  51. package/dist/lib/components/navigation/NavigationFilterContext.js +12 -0
  52. package/dist/lib/components/navigation/NavigationFilterContext.js.map +1 -0
  53. package/dist/lib/components/navigation/NavigationFilterInput.d.ts +3 -0
  54. package/dist/lib/components/navigation/NavigationFilterInput.js +9 -0
  55. package/dist/lib/components/navigation/NavigationFilterInput.js.map +1 -0
  56. package/dist/lib/components/navigation/NavigationItem.js +11 -1
  57. package/dist/lib/components/navigation/NavigationItem.js.map +1 -1
  58. package/dist/lib/components/navigation/utils.d.ts +2 -1
  59. package/dist/lib/components/navigation/utils.js +22 -1
  60. package/dist/lib/components/navigation/utils.js.map +1 -1
  61. package/dist/lib/core/ZudokuContext.d.ts +2 -1
  62. package/dist/lib/core/ZudokuContext.js +3 -1
  63. package/dist/lib/core/ZudokuContext.js.map +1 -1
  64. package/dist/lib/core/__internal.d.ts +1 -0
  65. package/dist/lib/core/__internal.js +2 -0
  66. package/dist/lib/core/__internal.js.map +1 -1
  67. package/dist/lib/core/plugins.d.ts +5 -1
  68. package/dist/lib/core/plugins.js.map +1 -1
  69. package/dist/lib/core/transform-config.d.ts +4 -2
  70. package/dist/lib/core/transform-config.js +33 -13
  71. package/dist/lib/core/transform-config.js.map +1 -1
  72. package/dist/lib/core/transform-config.test.d.ts +1 -0
  73. package/dist/lib/core/transform-config.test.js +83 -0
  74. package/dist/lib/core/transform-config.test.js.map +1 -0
  75. package/dist/lib/errors/ErrorAlert.js +1 -2
  76. package/dist/lib/errors/ErrorAlert.js.map +1 -1
  77. package/dist/lib/hooks/index.d.ts +7 -30
  78. package/dist/lib/hooks/index.js +7 -15
  79. package/dist/lib/hooks/index.js.map +1 -1
  80. package/dist/lib/hooks/useEvent.test.js +1 -1
  81. package/dist/lib/hooks/useEvent.test.js.map +1 -1
  82. package/dist/lib/oas/graphql/circular.d.ts +1 -1
  83. package/dist/lib/oas/graphql/circular.js +18 -35
  84. package/dist/lib/oas/graphql/circular.js.map +1 -1
  85. package/dist/lib/oas/graphql/circular.test.js +33 -2
  86. package/dist/lib/oas/graphql/circular.test.js.map +1 -1
  87. package/dist/lib/oas/parser/index.js +14 -5
  88. package/dist/lib/oas/parser/index.js.map +1 -1
  89. package/dist/lib/plugins/openapi/ParamInfos.js +8 -5
  90. package/dist/lib/plugins/openapi/ParamInfos.js.map +1 -1
  91. package/dist/lib/plugins/openapi/ParameterListItem.js +1 -1
  92. package/dist/lib/plugins/openapi/ParameterListItem.js.map +1 -1
  93. package/dist/lib/plugins/openapi/playground/fileUtils.d.ts +1 -0
  94. package/dist/lib/plugins/openapi/playground/fileUtils.js +3 -0
  95. package/dist/lib/plugins/openapi/playground/fileUtils.js.map +1 -1
  96. package/dist/lib/plugins/openapi/playground/result-panel/AudioPlayer.d.ts +6 -0
  97. package/dist/lib/plugins/openapi/playground/result-panel/AudioPlayer.js +20 -0
  98. package/dist/lib/plugins/openapi/playground/result-panel/AudioPlayer.js.map +1 -0
  99. package/dist/lib/plugins/openapi/playground/result-panel/ResponseTab.js +7 -2
  100. package/dist/lib/plugins/openapi/playground/result-panel/ResponseTab.js.map +1 -1
  101. package/dist/lib/plugins/openapi/schema/SchemaPropertyItem.js +2 -2
  102. package/dist/lib/plugins/openapi/schema/SchemaPropertyItem.js.map +1 -1
  103. package/dist/lib/ui/Alert.d.ts +3 -2
  104. package/dist/lib/ui/Alert.js +9 -5
  105. package/dist/lib/ui/Alert.js.map +1 -1
  106. package/dist/lib/ui/InputGroup.d.ts +16 -0
  107. package/dist/lib/ui/InputGroup.js +65 -0
  108. package/dist/lib/ui/InputGroup.js.map +1 -0
  109. package/dist/lib/ui/Secret.js +2 -2
  110. package/dist/lib/ui/Secret.js.map +1 -1
  111. package/dist/lib/util/flattenAllOf.d.ts +0 -2
  112. package/dist/lib/util/flattenAllOf.js +6 -46
  113. package/dist/lib/util/flattenAllOf.js.map +1 -1
  114. package/dist/lib/util/flattenAllOf.test.js +28 -1
  115. package/dist/lib/util/flattenAllOf.test.js.map +1 -1
  116. package/dist/lib/util/flattenAllOfProcessor.d.ts +2 -0
  117. package/dist/lib/util/flattenAllOfProcessor.js +48 -0
  118. package/dist/lib/util/flattenAllOfProcessor.js.map +1 -0
  119. package/dist/lib/util/readFrontmatter.js +2 -1
  120. package/dist/lib/util/readFrontmatter.js.map +1 -1
  121. package/dist/vite/api/SchemaManager.js +1 -1
  122. package/dist/vite/api/SchemaManager.js.map +1 -1
  123. package/dist/vite/api/SchemaManager.test.js +1 -1
  124. package/dist/vite/api/SchemaManager.test.js.map +1 -1
  125. package/dist/vite/build.js +91 -73
  126. package/dist/vite/build.js.map +1 -1
  127. package/dist/vite/config.js +5 -2
  128. package/dist/vite/config.js.map +1 -1
  129. package/dist/vite/mdx/remark-inject-filepath.js +5 -1
  130. package/dist/vite/mdx/remark-inject-filepath.js.map +1 -1
  131. package/dist/vite/mdx/remark-link-rewrite.js +3 -2
  132. package/dist/vite/mdx/remark-link-rewrite.js.map +1 -1
  133. package/dist/vite/plugin-config.js +16 -4
  134. package/dist/vite/plugin-config.js.map +1 -1
  135. package/dist/vite/plugin-docs.js +9 -7
  136. package/dist/vite/plugin-docs.js.map +1 -1
  137. package/dist/vite/plugin-markdown-export.js +4 -2
  138. package/dist/vite/plugin-markdown-export.js.map +1 -1
  139. package/dist/vite/plugin-theme.js +2 -1
  140. package/dist/vite/plugin-theme.js.map +1 -1
  141. package/dist/vite/prerender/prerender.js +3 -1
  142. package/dist/vite/prerender/prerender.js.map +1 -1
  143. package/dist/vite/prerender/worker.js +3 -1
  144. package/dist/vite/prerender/worker.js.map +1 -1
  145. package/lib/{ClaudeLogo-DJ9bU-sO.js → ClaudeLogo-Br8C_vTq.js} +26 -22
  146. package/lib/{ClaudeLogo-DJ9bU-sO.js.map → ClaudeLogo-Br8C_vTq.js.map} +1 -1
  147. package/lib/Drawer-Ch7927PF.js.map +1 -1
  148. package/lib/{HydrationBoundary-CNF2ZV3E.js → HydrationBoundary-CJu4vUlG.js} +6 -6
  149. package/lib/{HydrationBoundary-CNF2ZV3E.js.map → HydrationBoundary-CJu4vUlG.js.map} +1 -1
  150. package/lib/{MdxPage-stpAoBtx.js → MdxPage-C0QFAsgv.js} +8 -8
  151. package/lib/{MdxPage-stpAoBtx.js.map → MdxPage-C0QFAsgv.js.map} +1 -1
  152. package/lib/Mermaid-Chx5BPHn.js +104 -0
  153. package/lib/Mermaid-Chx5BPHn.js.map +1 -0
  154. package/lib/{OAuthErrorPage-DJ811Bn_.js → OAuthErrorPage-CFz_gBFx.js} +22 -19
  155. package/lib/{OAuthErrorPage-DJ811Bn_.js.map → OAuthErrorPage-CFz_gBFx.js.map} +1 -1
  156. package/lib/{OasProvider-CS_ASmBB.js → OasProvider-BwIOIlky.js} +3 -3
  157. package/lib/{OasProvider-CS_ASmBB.js.map → OasProvider-BwIOIlky.js.map} +1 -1
  158. package/lib/OperationList-DYRzbPJu.js +5908 -0
  159. package/lib/OperationList-DYRzbPJu.js.map +1 -0
  160. package/lib/{RouteGuard--A04ESy8.js → RouteGuard-CVs3yvEs.js} +5 -5
  161. package/lib/{RouteGuard--A04ESy8.js.map → RouteGuard-CVs3yvEs.js.map} +1 -1
  162. package/lib/{SchemaList-BJZJv1gD.js → SchemaList-D4FEyoDV.js} +8 -8
  163. package/lib/{SchemaList-BJZJv1gD.js.map → SchemaList-D4FEyoDV.js.map} +1 -1
  164. package/lib/{SchemaView-U4JMYB3N.js → SchemaView-ScvkhsYE.js} +116 -110
  165. package/lib/SchemaView-ScvkhsYE.js.map +1 -0
  166. package/lib/{Secret-BDBqq4p3.js → Secret-DUpgv4V3.js} +92 -72
  167. package/lib/Secret-DUpgv4V3.js.map +1 -0
  168. package/lib/{SignUp-DCBViNUi.js → SignUp-Dug1jAGC.js} +31 -26
  169. package/lib/{SignUp-DCBViNUi.js.map → SignUp-Dug1jAGC.js.map} +1 -1
  170. package/lib/{SyntaxHighlight-Dshjn3Zf.js → SyntaxHighlight-BMu0b_hF.js} +9 -9
  171. package/lib/{SyntaxHighlight-Dshjn3Zf.js.map → SyntaxHighlight-BMu0b_hF.js.map} +1 -1
  172. package/lib/{Toc-Cgz6CPiE.js → Toc-BiJ2YL0O.js} +2 -2
  173. package/lib/{Toc-Cgz6CPiE.js.map → Toc-BiJ2YL0O.js.map} +1 -1
  174. package/lib/{index-CL8eDnQW.js → Zudoku-iyiXgWFY.js} +2996 -2859
  175. package/lib/Zudoku-iyiXgWFY.js.map +1 -0
  176. package/lib/ZudokuContext-CYyb_PB_.js +175 -0
  177. package/lib/ZudokuContext-CYyb_PB_.js.map +1 -0
  178. package/lib/ZudokuReactContext-DGJAP1sN.js +222 -0
  179. package/lib/ZudokuReactContext-DGJAP1sN.js.map +1 -0
  180. package/lib/chunk-EPOLDU6W-C6C8jAwd.js.map +1 -1
  181. package/lib/{circular-BmMJjG1v.js → circular-BOpxmAie.js} +1327 -1346
  182. package/lib/{circular-BmMJjG1v.js.map → circular-BOpxmAie.js.map} +1 -1
  183. package/lib/createServer-BunbJzB5.js +13038 -0
  184. package/lib/createServer-BunbJzB5.js.map +1 -0
  185. package/lib/{errors-b9I-fAOY.js → errors-B77S9iOc.js} +3 -3
  186. package/lib/{errors-b9I-fAOY.js.map → errors-B77S9iOc.js.map} +1 -1
  187. package/lib/{firebase-BCXX7Qv5.js → firebase-C7XKRGLf.js} +26 -25
  188. package/lib/{firebase-BCXX7Qv5.js.map → firebase-C7XKRGLf.js.map} +1 -1
  189. package/lib/{hook-BGlHBdET.js → hook-Dz_n9SoE.js} +16 -15
  190. package/lib/{hook-BGlHBdET.js.map → hook-Dz_n9SoE.js.map} +1 -1
  191. package/lib/{index-UOLtazB8.js → index-BDp2MTiq.js} +2 -2
  192. package/lib/{index-UOLtazB8.js.map → index-BDp2MTiq.js.map} +1 -1
  193. package/lib/{index-O9RHI87z.js → index-Bx29qHVi.js} +589 -551
  194. package/lib/index-Bx29qHVi.js.map +1 -0
  195. package/lib/index-CrcNWbel.js.map +1 -1
  196. package/lib/index-DAWHN3cH.js +86 -0
  197. package/lib/index-DAWHN3cH.js.map +1 -0
  198. package/lib/index.esm-BYObtETB.js.map +1 -1
  199. package/lib/{index.esm-B_0dvNjB.js → index.esm-Ca5zvoff.js} +20 -20
  200. package/lib/{index.esm-B_0dvNjB.js.map → index.esm-Ca5zvoff.js.map} +1 -1
  201. package/lib/{index.esm-C5CBsVzN.js → index.esm-Cth49JBv.js} +2 -2
  202. package/lib/index.esm-Cth49JBv.js.map +1 -0
  203. package/lib/{invariant-BJAl77rw.js → invariant-B_t_F2s_.js} +3 -3
  204. package/lib/{invariant-BJAl77rw.js.map → invariant-B_t_F2s_.js.map} +1 -1
  205. package/lib/jsx-runtime-BzflLqGi.js.map +1 -1
  206. package/lib/{mutation-BISOc7OM.js → mutation-B7eFBLZY.js} +2 -2
  207. package/lib/{mutation-BISOc7OM.js.map → mutation-B7eFBLZY.js.map} +1 -1
  208. package/lib/ui/Alert.js +32 -20
  209. package/lib/ui/Alert.js.map +1 -1
  210. package/lib/ui/Carousel.js.map +1 -1
  211. package/lib/ui/InputGroup.js +155 -0
  212. package/lib/ui/InputGroup.js.map +1 -0
  213. package/lib/ui/Secret.js +2 -2
  214. package/lib/ui/Secret.js.map +1 -1
  215. package/lib/ui/SyntaxHighlight.js +3 -3
  216. package/lib/useExposedProps-CzTDfXfq.js +30 -0
  217. package/lib/useExposedProps-CzTDfXfq.js.map +1 -0
  218. package/lib/{useMutation-CFMGlAMW.js → useMutation-CErliDZ9.js} +5 -5
  219. package/lib/{useMutation-CFMGlAMW.js.map → useMutation-CErliDZ9.js.map} +1 -1
  220. package/lib/{useSuspenseQuery-CSB_rVek.js → useQuery-ht7aWJ3S.js} +432 -446
  221. package/lib/useQuery-ht7aWJ3S.js.map +1 -0
  222. package/lib/useSuspenseQuery-DQH4Bmc2.js +18 -0
  223. package/lib/useSuspenseQuery-DQH4Bmc2.js.map +1 -0
  224. package/lib/zudoku.__internal.js +1519 -1033
  225. package/lib/zudoku.__internal.js.map +1 -1
  226. package/lib/zudoku.auth-auth0.js +6 -5
  227. package/lib/zudoku.auth-auth0.js.map +1 -1
  228. package/lib/zudoku.auth-azureb2c.js +14 -13
  229. package/lib/zudoku.auth-azureb2c.js.map +1 -1
  230. package/lib/zudoku.auth-clerk.js +2 -2
  231. package/lib/zudoku.auth-firebase.js +5 -5
  232. package/lib/zudoku.auth-openid.js +8 -7
  233. package/lib/zudoku.auth-openid.js.map +1 -1
  234. package/lib/zudoku.auth-supabase.js +4 -4
  235. package/lib/zudoku.components.js +31 -29
  236. package/lib/zudoku.components.js.map +1 -1
  237. package/lib/zudoku.hooks.js +24 -11
  238. package/lib/zudoku.hooks.js.map +1 -1
  239. package/lib/zudoku.mermaid.js +5 -4
  240. package/lib/zudoku.mermaid.js.map +1 -1
  241. package/lib/zudoku.plugin-api-catalog.js +41 -36
  242. package/lib/zudoku.plugin-api-catalog.js.map +1 -1
  243. package/lib/zudoku.plugin-api-keys.js +156 -153
  244. package/lib/zudoku.plugin-api-keys.js.map +1 -1
  245. package/lib/zudoku.plugin-custom-pages.js +1 -1
  246. package/lib/zudoku.plugin-markdown.js +1 -1
  247. package/lib/zudoku.plugin-openapi.js +2 -2
  248. package/lib/zudoku.plugin-search-pagefind.js +19 -18
  249. package/lib/zudoku.plugin-search-pagefind.js.map +1 -1
  250. package/lib/zudoku.plugins.js.map +1 -1
  251. package/lib/zudoku.react-query.js +26 -25
  252. package/lib/zudoku.react-query.js.map +1 -1
  253. package/lib/zudoku.router.js.map +1 -1
  254. package/package.json +17 -10
  255. package/src/app/defaultTheme.css +4 -0
  256. package/src/app/main.css +2 -0
  257. package/src/app/main.tsx +1 -1
  258. package/src/lib/components/Bootstrap.tsx +1 -4
  259. package/src/lib/components/MobileTopNavigation.tsx +13 -8
  260. package/src/lib/components/Slot.test.tsx +1 -1
  261. package/src/lib/components/TopNavigation.tsx +25 -7
  262. package/src/lib/components/Zudoku.tsx +18 -14
  263. package/src/lib/components/context/ZudokuContext.ts +3 -6
  264. package/src/lib/components/context/ZudokuProvider.tsx +1 -1
  265. package/src/lib/components/context/ZudokuReactContext.tsx +17 -0
  266. package/src/lib/components/index.ts +19 -39
  267. package/src/lib/components/navigation/Navigation.tsx +4 -3
  268. package/src/lib/components/navigation/NavigationCategory.tsx +9 -0
  269. package/src/lib/components/navigation/NavigationFilterContext.tsx +28 -0
  270. package/src/lib/components/navigation/NavigationFilterInput.tsx +35 -0
  271. package/src/lib/components/navigation/NavigationItem.tsx +17 -1
  272. package/src/lib/components/navigation/utils.ts +32 -1
  273. package/src/lib/core/ZudokuContext.ts +7 -1
  274. package/src/lib/core/__internal.tsx +2 -0
  275. package/src/lib/core/plugins.ts +7 -3
  276. package/src/lib/core/transform-config.test.tsx +99 -0
  277. package/src/lib/core/transform-config.ts +57 -19
  278. package/src/lib/errors/ErrorAlert.tsx +1 -6
  279. package/src/lib/hooks/index.ts +7 -16
  280. package/src/lib/hooks/useEvent.test.tsx +1 -1
  281. package/src/lib/oas/graphql/circular.test.ts +37 -2
  282. package/src/lib/oas/graphql/circular.ts +25 -51
  283. package/src/lib/oas/parser/index.ts +17 -6
  284. package/src/lib/plugins/openapi/ParamInfos.tsx +10 -5
  285. package/src/lib/plugins/openapi/ParameterListItem.tsx +1 -0
  286. package/src/lib/plugins/openapi/playground/fileUtils.ts +4 -0
  287. package/src/lib/plugins/openapi/playground/result-panel/AudioPlayer.tsx +50 -0
  288. package/src/lib/plugins/openapi/playground/result-panel/ResponseTab.tsx +33 -17
  289. package/src/lib/plugins/openapi/schema/SchemaPropertyItem.tsx +2 -0
  290. package/src/lib/ui/Alert.tsx +17 -5
  291. package/src/lib/ui/InputGroup.tsx +168 -0
  292. package/src/lib/ui/Secret.tsx +2 -2
  293. package/src/lib/util/flattenAllOf.test.ts +34 -1
  294. package/src/lib/util/flattenAllOf.ts +7 -57
  295. package/src/lib/util/flattenAllOfProcessor.ts +58 -0
  296. package/src/lib/util/readFrontmatter.ts +2 -1
  297. package/src/zuplo/enrich-with-zuplo-mcp.ts +168 -0
  298. package/src/zuplo/enrich-with-zuplo.ts +254 -0
  299. package/src/zuplo/policy-types.ts +46 -0
  300. package/src/zuplo/with-zuplo-processors.ts +35 -0
  301. package/src/zuplo/with-zuplo.ts +14 -0
  302. package/lib/Mermaid-Koc3z8mU.js +0 -102
  303. package/lib/Mermaid-Koc3z8mU.js.map +0 -1
  304. package/lib/OperationList-Dq_AB4W9.js +0 -5820
  305. package/lib/OperationList-Dq_AB4W9.js.map +0 -1
  306. package/lib/SchemaView-U4JMYB3N.js.map +0 -1
  307. package/lib/Secret-BDBqq4p3.js.map +0 -1
  308. package/lib/Separator-BXt1LYnm.js +0 -27
  309. package/lib/Separator-BXt1LYnm.js.map +0 -1
  310. package/lib/ZudokuContext-BZB1TWdT.js +0 -387
  311. package/lib/ZudokuContext-BZB1TWdT.js.map +0 -1
  312. package/lib/___vite-browser-external_commonjs-proxy-BttVsNON.js +0 -9
  313. package/lib/___vite-browser-external_commonjs-proxy-BttVsNON.js.map +0 -1
  314. package/lib/createServer-CLSZ7hWJ.js +0 -16693
  315. package/lib/createServer-CLSZ7hWJ.js.map +0 -1
  316. package/lib/index-CL8eDnQW.js.map +0 -1
  317. package/lib/index-DBjOT2H1.js +0 -133
  318. package/lib/index-DBjOT2H1.js.map +0 -1
  319. package/lib/index-O9RHI87z.js.map +0 -1
  320. package/lib/index.esm-C5CBsVzN.js.map +0 -1
  321. package/lib/useSuspenseQuery-CSB_rVek.js.map +0 -1
@@ -86,6 +86,13 @@ export const usePrevNext = (): {
86
86
  let foundCurrent = false;
87
87
 
88
88
  traverseNavigation(navigation, (item) => {
89
+ if (
90
+ item.type === "separator" ||
91
+ item.type === "section" ||
92
+ item.type === "filter"
93
+ )
94
+ return;
95
+
89
96
  const itemId =
90
97
  item.type === "doc"
91
98
  ? joinUrl(item.path)
@@ -133,9 +140,33 @@ export const navigationListItem = cva(
133
140
  },
134
141
  );
135
142
 
143
+ export const itemMatchesFilter = (
144
+ item: NavigationItem,
145
+ query: string,
146
+ ): boolean => {
147
+ if (["separator", "section", "filter"].includes(item.type)) {
148
+ return true;
149
+ }
150
+ if (item.label?.toLowerCase().includes(query.toLowerCase())) {
151
+ return true;
152
+ }
153
+
154
+ if (item.type === "category") {
155
+ return item.items.some((child) => itemMatchesFilter(child, query));
156
+ }
157
+
158
+ return false;
159
+ };
160
+
136
161
  export const shouldShowItem =
137
- (auth: UseAuthReturn, context: ZudokuContext) =>
162
+ (auth: UseAuthReturn, context: ZudokuContext, filterQuery?: string) =>
138
163
  (item: NavigationItem): boolean => {
164
+ if (item.type === "filter") return true;
165
+
166
+ if (filterQuery?.trim() && !itemMatchesFilter(item, filterQuery)) {
167
+ return false;
168
+ }
169
+
139
170
  if (typeof item.display === "function") {
140
171
  return item.display({ context, auth });
141
172
  }
@@ -132,10 +132,15 @@ export class ZudokuContext {
132
132
  public readonly getAuthState: () => AuthState;
133
133
  public readonly queryClient: QueryClient;
134
134
  public readonly options: ZudokuContextOptions;
135
+ public readonly env: Record<string, string | undefined>;
135
136
  private readonly navigationPlugins: NavigationPlugin[];
136
137
  private emitter = createNanoEvents<ZudokuEvents>();
137
138
 
138
- constructor(options: ZudokuContextOptions, queryClient: QueryClient) {
139
+ constructor(
140
+ options: ZudokuContextOptions,
141
+ queryClient: QueryClient,
142
+ env: Record<string, string | undefined>,
143
+ ) {
139
144
  const pluginProtectedRoutes = Object.fromEntries(
140
145
  (options.plugins ?? []).flatMap((plugin) => {
141
146
  if (!isNavigationPlugin(plugin)) return [];
@@ -152,6 +157,7 @@ export class ZudokuContext {
152
157
  };
153
158
 
154
159
  this.queryClient = queryClient;
160
+ this.env = env;
155
161
  this.options = { ...options, protectedRoutes };
156
162
  this.plugins = options.plugins ?? [];
157
163
  this.navigation = options.navigation ?? [];
@@ -17,6 +17,7 @@ import { StatusPage as StatusPageImport } from "../components/StatusPage.js";
17
17
  import { RouterError as RouterErrorImport } from "../errors/RouterError.js";
18
18
  import { ServerError as ServerErrorImport } from "../errors/ServerError.js";
19
19
  import { RouteGuard as RouteGuardImport } from "./RouteGuard.js";
20
+ import { runPluginTransformConfig as runPluginTransformConfigImport } from "./transform-config.js";
20
21
 
21
22
  export const Layout = LayoutImport;
22
23
  export const RouterError = RouterErrorImport;
@@ -28,3 +29,4 @@ export const Head = Helmet;
28
29
  export const StatusPage = StatusPageImport;
29
30
  export const BuildCheck = BuildCheckImport;
30
31
  export const Meta = MetaImport;
32
+ export const runPluginTransformConfig = runPluginTransformConfigImport;
@@ -68,11 +68,15 @@ export interface ConfigHookContext {
68
68
  configPath: string;
69
69
  }
70
70
 
71
+ export interface TransformConfigContext {
72
+ config: ZudokuConfig;
73
+ merge: <T extends Partial<ZudokuConfig>>(partial: T) => ZudokuConfig & T;
74
+ }
75
+
71
76
  export interface TransformConfigPlugin {
72
77
  transformConfig?: (
73
- config: ZudokuConfig,
74
- ctx: ConfigHookContext,
75
- ) => Partial<ZudokuConfig> | void | Promise<Partial<ZudokuConfig> | void>;
78
+ context: TransformConfigContext,
79
+ ) => ZudokuConfig | void | Promise<ZudokuConfig | void>;
76
80
  }
77
81
 
78
82
  export interface CommonPlugin {
@@ -0,0 +1,99 @@
1
+ import { describe, expect, test } from "vitest";
2
+ import { isPlainObject, mergeConfig } from "./transform-config.js";
3
+
4
+ describe("isPlainObject", () => {
5
+ test("returns true for plain objects", () => {
6
+ expect(isPlainObject({})).toBe(true);
7
+ expect(isPlainObject({ a: 1 })).toBe(true);
8
+ });
9
+
10
+ test("returns false for arrays", () => {
11
+ expect(isPlainObject([])).toBe(false);
12
+ expect(isPlainObject([1, 2, 3])).toBe(false);
13
+ });
14
+
15
+ test("returns false for null and undefined", () => {
16
+ expect(isPlainObject(null)).toBe(false);
17
+ expect(isPlainObject(undefined)).toBe(false);
18
+ });
19
+
20
+ test("returns false for class instances", () => {
21
+ expect(isPlainObject(new Date())).toBe(false);
22
+ expect(isPlainObject(new Map())).toBe(false);
23
+ expect(isPlainObject(/regex/)).toBe(false);
24
+ });
25
+ });
26
+
27
+ describe("mergeConfig", () => {
28
+ test("merges flat objects", () => {
29
+ const target = { a: 1, b: 2 };
30
+ const source = { b: 3, c: 4 };
31
+ expect(mergeConfig(target, source)).toEqual({ a: 1, b: 3, c: 4 });
32
+ });
33
+
34
+ test("merges nested objects", () => {
35
+ const target = { nested: { a: 1, b: 2 } } as Record<string, unknown>;
36
+ const source = { nested: { b: 3, c: 4 } };
37
+ expect(mergeConfig(target, source)).toEqual({
38
+ nested: { a: 1, b: 3, c: 4 },
39
+ });
40
+ });
41
+
42
+ test("replaces arrays instead of merging", () => {
43
+ const target = { arr: [1, 2, 3] };
44
+ const source = { arr: [4, 5] };
45
+ expect(mergeConfig(target, source)).toEqual({ arr: [4, 5] });
46
+ });
47
+
48
+ test("preserves React elements without deep cloning", () => {
49
+ const element = <div className="test">Hello</div>;
50
+ const target = { banner: { message: "old" } };
51
+ const source = { banner: { message: element } };
52
+
53
+ const result = mergeConfig(target, source);
54
+
55
+ // Should be the exact same reference, not a clone
56
+ expect(result.banner.message).toBe(element);
57
+ });
58
+
59
+ test("does not clone React element children", () => {
60
+ const child = <strong>Bold</strong>;
61
+ const element = <div>{child} text</div>;
62
+ const target = { site: { banner: {} } };
63
+ const source = { site: { banner: { message: element } } };
64
+
65
+ const result = mergeConfig(target, source);
66
+
67
+ // The element should be identical (same reference)
68
+ expect(result.site.banner.message).toBe(element);
69
+ // Children should be preserved exactly
70
+ expect(result.site.banner.message.props.children).toBe(
71
+ element.props.children,
72
+ );
73
+ });
74
+
75
+ test("handles null and undefined values", () => {
76
+ const target = { a: 1, b: 2 };
77
+ const source = { a: null, c: undefined };
78
+ expect(mergeConfig(target, source)).toEqual({
79
+ a: null,
80
+ b: 2,
81
+ c: undefined,
82
+ });
83
+ });
84
+
85
+ test("replaces non-plain objects", () => {
86
+ const date = new Date("2024-01-01");
87
+ const target = { date: new Date("2020-01-01") };
88
+ const source = { date };
89
+ const result = mergeConfig(target, source);
90
+ expect(result.date).toBe(date);
91
+ });
92
+
93
+ test("does not mutate target", () => {
94
+ const target = { a: 1, nested: { b: 2 } };
95
+ const source = { a: 2, nested: { c: 3 } };
96
+ mergeConfig(target, source);
97
+ expect(target).toEqual({ a: 1, nested: { b: 2 } });
98
+ });
99
+ });
@@ -1,28 +1,66 @@
1
- import createDeepmerge from "@fastify/deepmerge";
2
- import type { ConfigWithMeta } from "../../config/loader.js";
3
- import { type ConfigHookContext, isTransformConfigPlugin } from "./plugins.js";
4
-
5
- const mergeConfig = createDeepmerge({
6
- mergeArray: (opt) => (_, source) => opt.clone(source),
7
- });
8
-
9
- export const runTransformConfigHooks = async (
10
- config: ConfigWithMeta,
11
- ): Promise<ConfigWithMeta> => {
12
- const ctx = {
13
- mode: config.__meta.mode,
14
- rootDir: config.__meta.rootDir,
15
- configPath: config.__meta.configPath,
16
- } satisfies ConfigHookContext;
1
+ import { isValidElement } from "react";
2
+ import type { ZudokuConfig } from "../../config/validators/validate.js";
3
+ import { isTransformConfigPlugin } from "./plugins.js";
4
+
5
+ export const isPlainObject = (
6
+ value: unknown,
7
+ ): value is Record<string, unknown> =>
8
+ typeof value === "object" &&
9
+ value !== null &&
10
+ !Array.isArray(value) &&
11
+ Object.getPrototypeOf(value) === Object.prototype;
12
+
13
+ export const mergeConfig = <
14
+ T extends Record<string, unknown>,
15
+ S extends Record<string, unknown>,
16
+ >(
17
+ target: T,
18
+ source: S,
19
+ ): T & S => {
20
+ const result = { ...target } as T & S;
21
+
22
+ for (const key of Object.keys(source) as (keyof S)[]) {
23
+ const sourceValue = source[key];
24
+ const targetValue = target[key as keyof T];
25
+
26
+ // Don't merge React elements, arrays, or non-plain objects - just replace
27
+ if (
28
+ isValidElement(sourceValue) ||
29
+ Array.isArray(sourceValue) ||
30
+ !isPlainObject(sourceValue)
31
+ ) {
32
+ (result as Record<string, unknown>)[key as string] = sourceValue;
33
+ } else if (isPlainObject(targetValue)) {
34
+ (result as Record<string, unknown>)[key as string] = mergeConfig(
35
+ targetValue,
36
+ sourceValue,
37
+ );
38
+ } else {
39
+ (result as Record<string, unknown>)[key as string] = sourceValue;
40
+ }
41
+ }
42
+
43
+ return result;
44
+ };
45
+
46
+ export const runPluginTransformConfig = async <T extends ZudokuConfig>(
47
+ config: T,
48
+ ): Promise<T> => {
17
49
  const plugins = config.plugins ?? [];
18
50
 
19
51
  let result = config;
20
52
 
21
53
  for (const plugin of plugins.filter(isTransformConfigPlugin)) {
22
- const partial = await plugin.transformConfig?.(result, ctx);
23
- if (!partial) continue;
54
+ const merge = <T extends Record<string, unknown>>(partial: T) =>
55
+ mergeConfig(result, partial);
56
+
57
+ const transformed = await plugin.transformConfig?.({
58
+ config: result,
59
+ merge,
60
+ });
61
+ if (!transformed) continue;
24
62
 
25
- result = mergeConfig(result, partial) as ConfigWithMeta;
63
+ result = transformed as T;
26
64
  }
27
65
 
28
66
  return result;
@@ -1,4 +1,3 @@
1
- import { SyntaxHighlight } from "zudoku/ui/SyntaxHighlight.js";
2
1
  import { DeveloperHint } from "../components/DeveloperHint.js";
3
2
  import { Heading } from "../components/Heading.js";
4
3
  import { Typography } from "../components/Typography.js";
@@ -22,11 +21,7 @@ export function ErrorAlert({ error }: { error: unknown }) {
22
21
  Error: {message}
23
22
  {hint && <DeveloperHint className="mb-4">{hint}</DeveloperHint>}
24
23
  {stringError && (
25
- <SyntaxHighlight
26
- className="max-h-[400px] [&>pre]:p-4"
27
- language="js"
28
- code={stringError}
29
- />
24
+ <pre className="max-h-[400px] [&>pre]:p-4">{stringError}</pre>
30
25
  )}
31
26
  </Typography>
32
27
  );
@@ -1,16 +1,7 @@
1
- import { useMDXComponents as useMDXComponentsImport } from "@mdx-js/react";
2
- import { useTheme as useThemeImport } from "next-themes";
3
- import { useAuth as useAuthImport } from "../authentication/hook.js";
4
- import { CACHE_KEYS, useCache as useCacheImport } from "../components/cache.js";
5
- import { useZudoku as useZudokuImport } from "../components/context/ZudokuContext.js";
6
- import { useExposedProps as useExposedPropsImport } from "../util/useExposedProps.js";
7
- import { useEvent as useEventImport } from "./useEvent.js";
8
-
9
- export const useEvent = /*@__PURE__*/ useEventImport;
10
- export const useTheme = /*@__PURE__*/ useThemeImport;
11
- export const useExposedProps = /*@__PURE__*/ useExposedPropsImport;
12
- export const useMDXComponents = /*@__PURE__*/ useMDXComponentsImport;
13
- export const useAuth = /*@__PURE__*/ useAuthImport;
14
- export const useZudoku = /*@__PURE__*/ useZudokuImport;
15
- export const useCache = /*@__PURE__*/ useCacheImport;
16
- export { CACHE_KEYS };
1
+ export { useMDXComponents } from "@mdx-js/react";
2
+ export { useTheme } from "next-themes";
3
+ export { useAuth } from "../authentication/hook.js";
4
+ export { CACHE_KEYS, useCache } from "../components/cache.js";
5
+ export { useZudoku } from "../components/context/ZudokuContext.js";
6
+ export { useExposedProps } from "../util/useExposedProps.js";
7
+ export { useEvent } from "./useEvent.js";
@@ -13,7 +13,7 @@ import { useEvent } from "./useEvent.js";
13
13
 
14
14
  const createTestContext = () => {
15
15
  const queryClient = new QueryClient();
16
- const context = new ZudokuContext({}, queryClient);
16
+ const context = new ZudokuContext({}, queryClient, {});
17
17
  const wrapper = ({ children }: PropsWithChildren) => (
18
18
  <QueryClientProvider client={queryClient}>
19
19
  <ZudokuProvider context={context}>{children}</ZudokuProvider>
@@ -156,16 +156,20 @@ describe("handleCircularRefs", () => {
156
156
  });
157
157
  });
158
158
 
159
- it("should deduplicate shared object instances with __$ref", () => {
159
+ it("should handle shared object instances with __$ref without marking circular", () => {
160
160
  const shared = { __$ref: "#/components/schemas/Foo", type: "string" };
161
161
  const obj = { a: shared, b: shared };
162
162
  const result = handleCircularRefs(obj);
163
163
 
164
+ // Both should return the cached result, not mark as circular
164
165
  expect(result.a).toEqual({
165
166
  __$ref: "#/components/schemas/Foo",
166
167
  type: "string",
167
168
  });
168
- expect(result.b).toBe(`${SCHEMA_REF_PREFIX}#/components/schemas/Foo`);
169
+ expect(result.b).toEqual({
170
+ __$ref: "#/components/schemas/Foo",
171
+ type: "string",
172
+ });
169
173
  });
170
174
 
171
175
  it("should mark circular ref with property name from path", () => {
@@ -183,4 +187,35 @@ describe("handleCircularRefs", () => {
183
187
 
184
188
  expect(result.properties.child.properties.back).toContain(CIRCULAR_REF);
185
189
  });
190
+
191
+ // Exact reproduction of #1869 - shared object instances with __$ref
192
+ it("should NOT mark shared object instances with __$ref as circular (issue #1869)", () => {
193
+ // When dereferencing, the SAME object instance is returned for all refs to the same schema
194
+ const timestampSchema = {
195
+ __$ref: "#/components/schemas/timestamp",
196
+ type: "string",
197
+ format: "date-time",
198
+ };
199
+
200
+ // Both created_at and updated_at point to the SAME object instance
201
+ const obj = {
202
+ type: "object",
203
+ properties: {
204
+ created_at: timestampSchema,
205
+ updated_at: timestampSchema,
206
+ },
207
+ };
208
+
209
+ const result = handleCircularRefs(obj);
210
+
211
+ // The first one should be fully expanded
212
+ expect(result.properties.created_at).toEqual({
213
+ __$ref: "#/components/schemas/timestamp",
214
+ type: "string",
215
+ format: "date-time",
216
+ });
217
+ // The second one should ALSO be fully expanded (not marked as circular)
218
+ expect(typeof result.properties.updated_at).toBe("object");
219
+ expect(result.properties.updated_at).not.toContain(CIRCULAR_REF);
220
+ });
186
221
  });
@@ -1,6 +1,5 @@
1
1
  import { GraphQLScalarType } from "graphql/index.js";
2
2
  import { GraphQLJSON } from "graphql-type-json";
3
- import type { RecordAny } from "../../util/traverse.js";
4
3
 
5
4
  export const CIRCULAR_REF = "$[Circular Reference]";
6
5
  export const SCHEMA_REF_PREFIX = "$ref:";
@@ -17,73 +16,48 @@ const OPENAPI_PROPS = new Set([
17
16
  export const handleCircularRefs = (
18
17
  // biome-ignore lint/suspicious/noExplicitAny: Allow any type
19
18
  obj: any,
20
- visited = new WeakSet(),
19
+ currentPath = new WeakSet(),
21
20
  refs = new WeakMap(),
22
21
  path: string[] = [],
23
- seenRefPaths = new Set<string>(),
22
+ currentRefPaths = new Set<string>(),
24
23
  // biome-ignore lint/suspicious/noExplicitAny: Allow any type
25
24
  ): any => {
26
25
  if (obj === null || typeof obj !== "object") return obj;
27
26
 
28
27
  const refPath = obj.__$ref;
28
+ const isCircular =
29
+ currentPath.has(obj) ||
30
+ (typeof refPath === "string" && currentRefPaths.has(refPath));
29
31
 
30
- // Check if this object has a __$ref marker (set during schema code generation)
31
- // If we've already fully processed this ref path, return a reference marker
32
- // instead of the full data to avoid JSON.stringify serializing duplicates
33
- if (typeof refPath === "string" && seenRefPaths.has(refPath)) {
34
- return SCHEMA_REF_PREFIX + refPath;
35
- }
36
-
37
- if (visited.has(obj)) {
38
- const cached = refs.get(obj);
39
- if (cached) {
40
- return typeof refPath === "string"
41
- ? // If already processed, return ref marker to avoid duplicate serialization
42
- SCHEMA_REF_PREFIX + refPath
43
- : cached;
44
- }
32
+ if (isCircular) {
33
+ if (typeof refPath === "string") return SCHEMA_REF_PREFIX + refPath;
45
34
  const circularProp = path.find((p) => !OPENAPI_PROPS.has(p)) || path[0];
46
-
47
35
  return [CIRCULAR_REF, circularProp].filter(Boolean).join(":");
48
36
  }
49
37
 
50
- visited.add(obj);
38
+ if (refs.has(obj)) return refs.get(obj);
51
39
 
52
- // Add refPath BEFORE recursing to detect cycles within this branch
53
- // This will be removed after processing to allow siblings with the same ref
54
- if (typeof refPath === "string") {
55
- seenRefPaths.add(refPath);
56
- }
40
+ currentPath.add(obj);
41
+ if (typeof refPath === "string") currentRefPaths.add(refPath);
57
42
 
58
- let result: RecordAny | RecordAny[];
59
- if (Array.isArray(obj)) {
60
- result = obj.map((item, index) =>
61
- handleCircularRefs(
62
- item,
63
- visited,
64
- refs,
65
- [...path, index.toString()],
66
- seenRefPaths,
67
- ),
43
+ const recurse = (value: unknown, key: string) =>
44
+ handleCircularRefs(
45
+ value,
46
+ currentPath,
47
+ refs,
48
+ [...path, key],
49
+ currentRefPaths,
68
50
  );
69
- } else {
70
- result = {};
71
- for (const [key, value] of Object.entries(obj)) {
72
- result[key] = handleCircularRefs(
73
- value,
74
- visited,
75
- refs,
76
- [...path, key],
77
- seenRefPaths,
51
+
52
+ const result = Array.isArray(obj)
53
+ ? obj.map((item, i) => recurse(item, i.toString()))
54
+ : Object.fromEntries(
55
+ Object.entries(obj).map(([k, v]) => [k, recurse(v, k)]),
78
56
  );
79
- }
80
- }
81
- refs.set(obj, result);
82
57
 
83
- // Remove refPath after processing so sibling refs aren't incorrectly marked
84
- if (typeof refPath === "string") {
85
- seenRefPaths.delete(refPath);
86
- }
58
+ refs.set(obj, result);
59
+ currentPath.delete(obj);
60
+ if (typeof refPath === "string") currentRefPaths.delete(refPath);
87
61
 
88
62
  return result;
89
63
  };
@@ -1,6 +1,7 @@
1
1
  import { GraphQLError } from "graphql/error/index.js";
2
2
  import { OpenAPIV3, type OpenAPIV3_1 } from "openapi-types";
3
- import { flattenAllOfProcessor } from "../../util/flattenAllOf.js";
3
+ import { flattenAllOf } from "../../util/flattenAllOf.js";
4
+ import { traverse } from "../../util/traverse.js";
4
5
  import { dereference, type JSONSchema } from "./dereference/index.js";
5
6
  import { upgradeSchema } from "./upgrade/index.js";
6
7
 
@@ -104,11 +105,21 @@ export const validate = async (schemaInput: unknown) => {
104
105
  const dereferenced = await dereference(schema);
105
106
  const upgraded = upgradeSchema(dereferenced);
106
107
 
107
- const flattened = await flattenAllOfProcessor({
108
- schema: upgraded,
109
- file: "schema.json",
110
- dereference: async (schema) => schema,
111
- });
108
+ const flattened = traverse(upgraded, (spec) => {
109
+ if (!spec || typeof spec !== "object" || Array.isArray(spec)) {
110
+ return spec;
111
+ }
112
+ const isSchemaObject =
113
+ "type" in spec ||
114
+ "properties" in spec ||
115
+ "allOf" in spec ||
116
+ "anyOf" in spec ||
117
+ "oneOf" in spec;
118
+
119
+ if (!isSchemaObject) return spec;
120
+
121
+ return flattenAllOf(spec) as typeof spec;
122
+ }) as OpenAPIDocument;
112
123
 
113
124
  return flattened;
114
125
  };
@@ -28,11 +28,16 @@ const Pattern = ({ pattern }: { pattern: string }) => {
28
28
  const getSchemaInfos = (schema?: SchemaObject) => {
29
29
  if (!schema) return [];
30
30
 
31
+ const items =
32
+ schema.type === "array" && typeof schema.items === "object"
33
+ ? schema.items
34
+ : undefined;
35
+
31
36
  return [
32
- schema.type === "array" && schema.items.type
33
- ? Array.isArray(schema.items.type)
34
- ? `(${schema.items.type.join(" | ")})[]`
35
- : `${schema.items.type}[]`
37
+ items?.type
38
+ ? Array.isArray(items.type)
39
+ ? `(${items.type.join(" | ")})[]`
40
+ : `${items.type}[]`
36
41
  : Array.isArray(schema.type)
37
42
  ? schema.type.join(" | ")
38
43
  : schema.type,
@@ -40,7 +45,7 @@ const getSchemaInfos = (schema?: SchemaObject) => {
40
45
  schema.enum && "enum",
41
46
  schema.const && "const",
42
47
  schema.format,
43
- schema.type === "array" && schema.items?.contentMediaType,
48
+ items?.contentMediaType,
44
49
  schema.minimum !== undefined && `min: ${schema.minimum}`,
45
50
  schema.maximum !== undefined && `max: ${schema.maximum}`,
46
51
  schema.minLength !== undefined && `minLength: ${schema.minLength}`,
@@ -90,6 +90,7 @@ export const ParameterListItem = ({
90
90
  </code>
91
91
  )}
92
92
  </ItemTitle>
93
+ {"\u200B"}
93
94
  <ParamInfos
94
95
  className="inline"
95
96
  schema={paramSchema}
@@ -4,6 +4,10 @@ export function isBinaryContentType(contentType: string) {
4
4
  );
5
5
  }
6
6
 
7
+ export function isAudioContentType(contentType: string) {
8
+ return /^audio\//i.test(contentType);
9
+ }
10
+
7
11
  export const extractFileName = (
8
12
  headers: Array<[string, string]>,
9
13
  url: string,
@@ -0,0 +1,50 @@
1
+ import { DownloadIcon } from "lucide-react";
2
+ import { useEffect, useState } from "react";
3
+ import { Button } from "zudoku/ui/Button.js";
4
+ import { humanFileSize } from "../../../../util/humanFileSize.js";
5
+
6
+ export const AudioPlayer = ({
7
+ blob,
8
+ fileName,
9
+ size,
10
+ onDownload,
11
+ }: {
12
+ blob: Blob;
13
+ fileName: string;
14
+ size: number;
15
+ onDownload: () => void;
16
+ }) => {
17
+ const [audioUrl, setAudioUrl] = useState<string | null>(null);
18
+
19
+ useEffect(() => {
20
+ const url = URL.createObjectURL(blob);
21
+ setAudioUrl(url);
22
+
23
+ return () => {
24
+ URL.revokeObjectURL(url);
25
+ };
26
+ }, [blob]);
27
+
28
+ if (!audioUrl) {
29
+ return (
30
+ <div className="p-4 text-center">
31
+ <div className="text-sm text-muted-foreground">Loading audio...</div>
32
+ </div>
33
+ );
34
+ }
35
+
36
+ return (
37
+ <div className="p-4 text-center">
38
+ <div className="flex flex-col items-center gap-4">
39
+ {/* biome-ignore lint/a11y/useMediaCaption: API response audio cannot have predefined captions */}
40
+ <audio controls src={audioUrl} className="w-full max-w-md">
41
+ Your browser does not support the audio element.
42
+ </audio>
43
+ <Button onClick={onDownload} className="flex items-center gap-2">
44
+ <DownloadIcon className="h-4 w-4" />
45
+ Download {fileName} ({humanFileSize(size)})
46
+ </Button>
47
+ </div>
48
+ </div>
49
+ );
50
+ };