zudoku 0.3.0-dev.6 → 0.3.0-dev.61

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 (529) hide show
  1. package/dist/app/App.d.ts +1 -2
  2. package/dist/app/App.js +1 -29
  3. package/dist/app/App.js.map +1 -1
  4. package/dist/app/demo.d.ts +2 -0
  5. package/dist/app/demo.js +32 -0
  6. package/dist/app/demo.js.map +1 -0
  7. package/dist/app/entry.client.d.ts +2 -0
  8. package/dist/app/entry.client.js +35 -0
  9. package/dist/app/entry.client.js.map +1 -0
  10. package/dist/app/entry.server.d.ts +14 -0
  11. package/dist/app/entry.server.js +105 -0
  12. package/dist/app/entry.server.js.map +1 -0
  13. package/dist/app/main.d.ts +6 -1
  14. package/dist/app/main.js +67 -12
  15. package/dist/app/main.js.map +1 -1
  16. package/dist/app/standalone.d.ts +2 -0
  17. package/dist/app/standalone.js +37 -0
  18. package/dist/app/standalone.js.map +1 -0
  19. package/dist/app/tailwind.d.ts +1 -1
  20. package/dist/app/tailwind.js +0 -4
  21. package/dist/app/tailwind.js.map +1 -1
  22. package/dist/cli/cmds/dev.js +5 -0
  23. package/dist/cli/cmds/dev.js.map +1 -1
  24. package/dist/cli/dev/handler.d.ts +1 -0
  25. package/dist/cli/dev/handler.js +3 -1
  26. package/dist/cli/dev/handler.js.map +1 -1
  27. package/dist/config/config.d.ts +11 -39
  28. package/dist/config/validators/validate.d.ts +908 -2
  29. package/dist/config/validators/validate.js +150 -1
  30. package/dist/config/validators/validate.js.map +1 -1
  31. package/dist/internal.d.ts +1 -0
  32. package/dist/internal.js +2 -0
  33. package/dist/internal.js.map +1 -0
  34. package/dist/lib/authentication/AuthenticationPlugin.d.ts +13 -0
  35. package/dist/lib/authentication/AuthenticationPlugin.js +31 -0
  36. package/dist/lib/authentication/AuthenticationPlugin.js.map +1 -0
  37. package/dist/lib/authentication/Callback.js +1 -1
  38. package/dist/lib/authentication/Callback.js.map +1 -1
  39. package/dist/lib/authentication/authentication.d.ts +6 -9
  40. package/dist/lib/authentication/components/SignIn.d.ts +1 -0
  41. package/dist/lib/authentication/components/SignIn.js +10 -0
  42. package/dist/lib/authentication/components/SignIn.js.map +1 -0
  43. package/dist/lib/authentication/components/SignOut.d.ts +1 -0
  44. package/dist/lib/authentication/components/SignOut.js +10 -0
  45. package/dist/lib/authentication/components/SignOut.js.map +1 -0
  46. package/dist/lib/authentication/components/SignUp.d.ts +1 -0
  47. package/dist/lib/authentication/components/SignUp.js +10 -0
  48. package/dist/lib/authentication/components/SignUp.js.map +1 -0
  49. package/dist/lib/authentication/hook.js +2 -2
  50. package/dist/lib/authentication/hook.js.map +1 -1
  51. package/dist/lib/authentication/providers/auth0.js +2 -2
  52. package/dist/lib/authentication/providers/auth0.js.map +1 -1
  53. package/dist/lib/authentication/providers/clerk.js +59 -30
  54. package/dist/lib/authentication/providers/clerk.js.map +1 -1
  55. package/dist/lib/authentication/providers/openid.d.ts +19 -6
  56. package/dist/lib/authentication/providers/openid.js +45 -16
  57. package/dist/lib/authentication/providers/openid.js.map +1 -1
  58. package/dist/lib/components/Bootstrap.d.ts +13 -0
  59. package/dist/lib/components/Bootstrap.js +12 -0
  60. package/dist/lib/components/Bootstrap.js.map +1 -0
  61. package/dist/lib/components/DevPortal.d.ts +4 -19
  62. package/dist/lib/components/DevPortal.js +30 -12
  63. package/dist/lib/components/DevPortal.js.map +1 -1
  64. package/dist/lib/components/DeveloperHint.d.ts +5 -0
  65. package/dist/lib/components/DeveloperHint.js +10 -0
  66. package/dist/lib/components/DeveloperHint.js.map +1 -0
  67. package/dist/lib/components/ErrorPage.d.ts +6 -0
  68. package/dist/lib/components/ErrorPage.js +9 -0
  69. package/dist/lib/components/ErrorPage.js.map +1 -0
  70. package/dist/lib/components/Header.js +17 -3
  71. package/dist/lib/components/Header.js.map +1 -1
  72. package/dist/lib/components/Heading.d.ts +9 -4
  73. package/dist/lib/components/Heading.js +17 -2
  74. package/dist/lib/components/Heading.js.map +1 -1
  75. package/dist/lib/components/InlineCode.d.ts +5 -0
  76. package/dist/lib/components/InlineCode.js +4 -0
  77. package/dist/lib/components/InlineCode.js.map +1 -0
  78. package/dist/lib/components/Layout.js +3 -2
  79. package/dist/lib/components/Layout.js.map +1 -1
  80. package/dist/lib/components/NotFoundPage.d.ts +1 -0
  81. package/dist/lib/components/NotFoundPage.js +12 -0
  82. package/dist/lib/components/NotFoundPage.js.map +1 -0
  83. package/dist/lib/components/SyntaxHighlight.d.ts +3 -2
  84. package/dist/lib/components/SyntaxHighlight.js +20 -18
  85. package/dist/lib/components/SyntaxHighlight.js.map +1 -1
  86. package/dist/lib/components/TopNavigation.d.ts +1 -1
  87. package/dist/lib/components/TopNavigation.js +5 -1
  88. package/dist/lib/components/TopNavigation.js.map +1 -1
  89. package/dist/lib/components/context/DevPortalProvider.d.ts +1 -1
  90. package/dist/lib/components/context/DevPortalProvider.js +20 -3
  91. package/dist/lib/components/context/DevPortalProvider.js.map +1 -1
  92. package/dist/lib/components/index.d.ts +32 -3
  93. package/dist/lib/components/index.js +21 -3
  94. package/dist/lib/components/index.js.map +1 -1
  95. package/dist/lib/components/navigation/SideNavigationCategory.js +2 -2
  96. package/dist/lib/components/navigation/SideNavigationCategory.js.map +1 -1
  97. package/dist/lib/components/navigation/SideNavigationItem.js +1 -1
  98. package/dist/lib/components/navigation/SideNavigationItem.js.map +1 -1
  99. package/dist/lib/core/DevPortalContext.d.ts +46 -12
  100. package/dist/lib/core/DevPortalContext.js +7 -9
  101. package/dist/lib/core/DevPortalContext.js.map +1 -1
  102. package/dist/lib/core/plugins.d.ts +16 -4
  103. package/dist/lib/core/plugins.js +2 -0
  104. package/dist/lib/core/plugins.js.map +1 -1
  105. package/dist/lib/errors/ErrorAlert.d.ts +3 -0
  106. package/dist/lib/errors/ErrorAlert.js +8 -0
  107. package/dist/lib/errors/ErrorAlert.js.map +1 -0
  108. package/dist/lib/errors/RouterError.d.ts +1 -0
  109. package/dist/lib/errors/RouterError.js +12 -0
  110. package/dist/lib/errors/RouterError.js.map +1 -0
  111. package/dist/lib/errors/ServerError.d.ts +3 -0
  112. package/dist/lib/errors/ServerError.js +6 -0
  113. package/dist/lib/errors/ServerError.js.map +1 -0
  114. package/dist/lib/errors/TopLevelError.d.ts +2 -0
  115. package/dist/lib/errors/TopLevelError.js +7 -0
  116. package/dist/lib/errors/TopLevelError.js.map +1 -0
  117. package/dist/lib/oas/graphql/index.js +6 -4
  118. package/dist/lib/oas/graphql/index.js.map +1 -1
  119. package/dist/lib/oas/parser/index.d.ts +1 -1
  120. package/dist/lib/oas/parser/index.js +38 -12
  121. package/dist/lib/oas/parser/index.js.map +1 -1
  122. package/dist/lib/plugins/{api-key → api-keys}/CreateApiKey.js +1 -1
  123. package/dist/lib/plugins/api-keys/CreateApiKey.js.map +1 -0
  124. package/dist/lib/plugins/api-keys/ProtectedRoute.d.ts +1 -0
  125. package/dist/lib/plugins/api-keys/ProtectedRoute.js +14 -0
  126. package/dist/lib/plugins/api-keys/ProtectedRoute.js.map +1 -0
  127. package/dist/lib/plugins/api-keys/SettingsApiKeys.js +39 -0
  128. package/dist/lib/plugins/api-keys/SettingsApiKeys.js.map +1 -0
  129. package/dist/lib/plugins/{api-key → api-keys}/index.d.ts +4 -5
  130. package/dist/lib/plugins/{api-key → api-keys}/index.js +11 -19
  131. package/dist/lib/plugins/api-keys/index.js.map +1 -0
  132. package/dist/lib/plugins/custom-page/index.d.ts +8 -0
  133. package/dist/lib/plugins/custom-page/index.js +12 -0
  134. package/dist/lib/plugins/custom-page/index.js.map +1 -0
  135. package/dist/lib/plugins/markdown/MdxPage.d.ts +3 -2
  136. package/dist/lib/plugins/markdown/MdxPage.js +7 -6
  137. package/dist/lib/plugins/markdown/MdxPage.js.map +1 -1
  138. package/dist/lib/plugins/markdown/Toc.js +1 -1
  139. package/dist/lib/plugins/markdown/Toc.js.map +1 -1
  140. package/dist/lib/plugins/markdown/generateRoutes.d.ts +3 -3
  141. package/dist/lib/plugins/markdown/generateRoutes.js +4 -4
  142. package/dist/lib/plugins/markdown/generateRoutes.js.map +1 -1
  143. package/dist/lib/plugins/markdown/index.d.ts +4 -1
  144. package/dist/lib/plugins/markdown/index.js +3 -7
  145. package/dist/lib/plugins/markdown/index.js.map +1 -1
  146. package/dist/lib/plugins/openapi/OperationList.js +17 -5
  147. package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
  148. package/dist/lib/plugins/openapi/OperationListItem.js +10 -5
  149. package/dist/lib/plugins/openapi/OperationListItem.js.map +1 -1
  150. package/dist/lib/plugins/openapi/ParameterList.js +1 -1
  151. package/dist/lib/plugins/openapi/ParameterList.js.map +1 -1
  152. package/dist/lib/plugins/openapi/ParameterListItem.js +1 -1
  153. package/dist/lib/plugins/openapi/ParameterListItem.js.map +1 -1
  154. package/dist/lib/plugins/openapi/{MakeRequest.d.ts → PlaygroundDialogWrapper.d.ts} +1 -1
  155. package/dist/lib/plugins/openapi/{MakeRequest.js → PlaygroundDialogWrapper.js} +4 -16
  156. package/dist/lib/plugins/openapi/PlaygroundDialogWrapper.js.map +1 -0
  157. package/dist/lib/plugins/openapi/RequestBodySidecarBox.js +1 -9
  158. package/dist/lib/plugins/openapi/RequestBodySidecarBox.js.map +1 -1
  159. package/dist/lib/plugins/openapi/ResponsesSidecarBox.js +1 -1
  160. package/dist/lib/plugins/openapi/ResponsesSidecarBox.js.map +1 -1
  161. package/dist/lib/plugins/openapi/Route.d.ts +6 -0
  162. package/dist/lib/plugins/openapi/Route.js +8 -0
  163. package/dist/lib/plugins/openapi/Route.js.map +1 -0
  164. package/dist/lib/plugins/openapi/SchemaListView.js +6 -27
  165. package/dist/lib/plugins/openapi/SchemaListView.js.map +1 -1
  166. package/dist/lib/plugins/openapi/SchemaListViewItem.d.ts +7 -0
  167. package/dist/lib/plugins/openapi/SchemaListViewItem.js +16 -0
  168. package/dist/lib/plugins/openapi/SchemaListViewItem.js.map +1 -0
  169. package/dist/lib/plugins/openapi/SchemaListViewItemGroup.d.ts +8 -0
  170. package/dist/lib/plugins/openapi/SchemaListViewItemGroup.js +17 -0
  171. package/dist/lib/plugins/openapi/SchemaListViewItemGroup.js.map +1 -0
  172. package/dist/lib/plugins/openapi/Sidecar.js +10 -8
  173. package/dist/lib/plugins/openapi/Sidecar.js.map +1 -1
  174. package/dist/lib/plugins/openapi/SidecarBox.js +1 -1
  175. package/dist/lib/plugins/openapi/SidecarBox.js.map +1 -1
  176. package/dist/lib/plugins/openapi/{Select.d.ts → SimpleSelect.d.ts} +3 -2
  177. package/dist/lib/plugins/openapi/SimpleSelect.js +5 -0
  178. package/dist/lib/plugins/openapi/SimpleSelect.js.map +1 -0
  179. package/dist/lib/plugins/openapi/StaggeredRender.d.ts +8 -0
  180. package/dist/lib/plugins/openapi/StaggeredRender.js +18 -0
  181. package/dist/lib/plugins/openapi/StaggeredRender.js.map +1 -0
  182. package/dist/lib/plugins/openapi/client/createMemoryClient.d.ts +12 -0
  183. package/dist/lib/plugins/openapi/client/createMemoryClient.js +46 -0
  184. package/dist/lib/plugins/openapi/client/createMemoryClient.js.map +1 -0
  185. package/dist/lib/plugins/openapi/client/createServer.d.ts +4 -0
  186. package/dist/lib/plugins/openapi/client/createServer.js +30 -0
  187. package/dist/lib/plugins/openapi/client/createServer.js.map +1 -0
  188. package/dist/lib/plugins/openapi/client/createWorkerClient.d.ts +10 -0
  189. package/dist/lib/plugins/openapi/{worker/createSharedWorkerClient.js → client/createWorkerClient.js} +15 -2
  190. package/dist/lib/plugins/openapi/client/createWorkerClient.js.map +1 -0
  191. package/dist/lib/plugins/openapi/client/interfaces.d.ts +4 -0
  192. package/dist/lib/plugins/openapi/client/interfaces.js +2 -0
  193. package/dist/lib/plugins/openapi/client/interfaces.js.map +1 -0
  194. package/dist/lib/plugins/openapi/{worker → client}/worker.js +2 -2
  195. package/dist/lib/plugins/openapi/client/worker.js.map +1 -0
  196. package/dist/lib/plugins/openapi/context.d.ts +5 -0
  197. package/dist/lib/plugins/openapi/context.js +11 -0
  198. package/dist/lib/plugins/openapi/context.js.map +1 -0
  199. package/dist/lib/plugins/openapi/index.d.ts +4 -18
  200. package/dist/lib/plugins/openapi/index.js +35 -20
  201. package/dist/lib/plugins/openapi/index.js.map +1 -1
  202. package/dist/lib/plugins/openapi/interfaces.d.ts +15 -0
  203. package/dist/lib/plugins/openapi/interfaces.js +2 -0
  204. package/dist/lib/plugins/openapi/interfaces.js.map +1 -0
  205. package/dist/lib/plugins/openapi/playground/Headers.d.ts +2 -3
  206. package/dist/lib/plugins/openapi/playground/Headers.js +16 -6
  207. package/dist/lib/plugins/openapi/playground/Headers.js.map +1 -1
  208. package/dist/lib/plugins/openapi/playground/PathParams.d.ts +1 -1
  209. package/dist/lib/plugins/openapi/playground/Playground.d.ts +5 -4
  210. package/dist/lib/plugins/openapi/playground/Playground.js +22 -13
  211. package/dist/lib/plugins/openapi/playground/Playground.js.map +1 -1
  212. package/dist/lib/plugins/openapi/playground/PlaygroundDialog.d.ts +3 -0
  213. package/dist/lib/plugins/openapi/playground/PlaygroundDialog.js +12 -0
  214. package/dist/lib/plugins/openapi/playground/PlaygroundDialog.js.map +1 -0
  215. package/dist/lib/plugins/openapi/playground/QueryParams.d.ts +1 -1
  216. package/dist/lib/plugins/openapi/playground/QueryParams.js +2 -1
  217. package/dist/lib/plugins/openapi/playground/QueryParams.js.map +1 -1
  218. package/dist/lib/plugins/openapi/playground/createUrl.d.ts +1 -1
  219. package/dist/lib/plugins/openapi/util/prose.d.ts +1 -0
  220. package/dist/lib/plugins/openapi/util/prose.js +4 -0
  221. package/dist/lib/plugins/openapi/util/prose.js.map +1 -0
  222. package/dist/lib/plugins/openapi-worker.d.ts +1 -1
  223. package/dist/lib/plugins/openapi-worker.js +1 -1
  224. package/dist/lib/plugins/openapi-worker.js.map +1 -1
  225. package/dist/lib/plugins/redirect/index.d.ts +0 -1
  226. package/dist/lib/plugins/redirect/index.js +3 -4
  227. package/dist/lib/plugins/redirect/index.js.map +1 -1
  228. package/dist/lib/ui/Callout.js +2 -2
  229. package/dist/lib/ui/Callout.js.map +1 -1
  230. package/dist/lib/ui/Card.js +1 -1
  231. package/dist/lib/ui/Card.js.map +1 -1
  232. package/dist/lib/ui/DropdownMenu.d.ts +27 -0
  233. package/dist/lib/ui/DropdownMenu.js +36 -0
  234. package/dist/lib/ui/DropdownMenu.js.map +1 -0
  235. package/dist/lib/ui/button-variants.d.ts +2 -2
  236. package/dist/lib/ui/button-variants.js +1 -0
  237. package/dist/lib/ui/button-variants.js.map +1 -1
  238. package/dist/lib/util/MdxComponents.d.ts +2 -2
  239. package/dist/lib/util/MdxComponents.js +7 -5
  240. package/dist/lib/util/MdxComponents.js.map +1 -1
  241. package/dist/lib/util/groupBy.d.ts +1 -6
  242. package/dist/lib/util/groupBy.js +10 -8
  243. package/dist/lib/util/groupBy.js.map +1 -1
  244. package/dist/lib/util/joinPath.js +2 -1
  245. package/dist/lib/util/joinPath.js.map +1 -1
  246. package/dist/lib/util/logInit.d.ts +1 -0
  247. package/dist/lib/util/logInit.js +9 -0
  248. package/dist/lib/util/logInit.js.map +1 -0
  249. package/dist/lib/util/objectEntries.d.ts +4 -0
  250. package/dist/lib/util/objectEntries.js +2 -0
  251. package/dist/lib/util/objectEntries.js.map +1 -0
  252. package/dist/lib/util/renderIf.d.ts +1 -0
  253. package/dist/lib/util/renderIf.js +2 -0
  254. package/dist/lib/util/renderIf.js.map +1 -0
  255. package/dist/vite/build.js +30 -7
  256. package/dist/vite/build.js.map +1 -1
  257. package/dist/vite/config.d.ts +21 -12
  258. package/dist/vite/config.js +107 -55
  259. package/dist/vite/config.js.map +1 -1
  260. package/dist/vite/config.test.js +6 -3
  261. package/dist/vite/config.test.js.map +1 -1
  262. package/dist/vite/dev-server.d.ts +2 -1
  263. package/dist/vite/dev-server.js +44 -15
  264. package/dist/vite/dev-server.js.map +1 -1
  265. package/dist/vite/html.js +18 -5
  266. package/dist/vite/html.js.map +1 -1
  267. package/dist/vite/plugin-api-keys.js +7 -8
  268. package/dist/vite/plugin-api-keys.js.map +1 -1
  269. package/dist/vite/plugin-api.js +9 -20
  270. package/dist/vite/plugin-api.js.map +1 -1
  271. package/dist/vite/plugin-auth.js +5 -6
  272. package/dist/vite/plugin-auth.js.map +1 -1
  273. package/dist/vite/plugin-component.js +5 -2
  274. package/dist/vite/plugin-component.js.map +1 -1
  275. package/dist/vite/plugin-config.d.ts +0 -2
  276. package/dist/vite/plugin-config.js +2 -13
  277. package/dist/vite/plugin-config.js.map +1 -1
  278. package/dist/vite/plugin-custom-css.d.ts +6 -0
  279. package/dist/vite/plugin-custom-css.js +54 -0
  280. package/dist/vite/plugin-custom-css.js.map +1 -0
  281. package/dist/vite/plugin-docs.js +15 -5
  282. package/dist/vite/plugin-docs.js.map +1 -1
  283. package/dist/vite/plugin-mdx.d.ts +3 -1
  284. package/dist/vite/plugin-mdx.js +5 -5
  285. package/dist/vite/plugin-mdx.js.map +1 -1
  286. package/dist/vite/plugin-metadata.js +1 -1
  287. package/dist/vite/plugin-metadata.js.map +1 -1
  288. package/dist/vite/plugin-redirect.js +10 -10
  289. package/dist/vite/plugin-redirect.js.map +1 -1
  290. package/dist/vite/plugin.js +3 -5
  291. package/dist/vite/plugin.js.map +1 -1
  292. package/dist/vite/prerender.d.ts +17 -0
  293. package/dist/vite/prerender.js +79 -0
  294. package/dist/vite/prerender.js.map +1 -0
  295. package/lib/AnchorLink-Bj1hwDuD.js +705 -0
  296. package/lib/AnchorLink-Bj1hwDuD.js.map +1 -0
  297. package/lib/AuthenticationPlugin-RvXALgvS.js +52 -0
  298. package/lib/AuthenticationPlugin-RvXALgvS.js.map +1 -0
  299. package/lib/CategoryHeading-DMkTmmBh.js +10 -0
  300. package/lib/CategoryHeading-DMkTmmBh.js.map +1 -0
  301. package/lib/Combination-lAFQBd6U.js +2774 -0
  302. package/lib/Combination-lAFQBd6U.js.map +1 -0
  303. package/lib/DevPortalProvider-BBhQ8kgI.js +1125 -0
  304. package/lib/DevPortalProvider-BBhQ8kgI.js.map +1 -0
  305. package/lib/Markdown-BjRJKl_E.js +15028 -0
  306. package/lib/Markdown-BjRJKl_E.js.map +1 -0
  307. package/lib/MdxPage-DJTFOCbZ.js +190 -0
  308. package/lib/MdxPage-DJTFOCbZ.js.map +1 -0
  309. package/lib/OperationList-DDTtK3I7.js +5403 -0
  310. package/lib/OperationList-DDTtK3I7.js.map +1 -0
  311. package/lib/Route-Bsrd0acQ.js +13 -0
  312. package/lib/Route-Bsrd0acQ.js.map +1 -0
  313. package/lib/Select-CEnkyfyn.js +2223 -0
  314. package/lib/Select-CEnkyfyn.js.map +1 -0
  315. package/lib/Spinner-Ciq_pWU7.js +359 -0
  316. package/lib/Spinner-Ciq_pWU7.js.map +1 -0
  317. package/lib/_commonjsHelpers-BVfed4GL.js +29 -0
  318. package/lib/_commonjsHelpers-BVfed4GL.js.map +1 -0
  319. package/lib/assets/index-BPdJm2ty.js +1 -0
  320. package/lib/assets/index-BPdJm2ty.js.map +1 -0
  321. package/lib/assets/{worker-BCcpCNJ7.js → worker-BWwCA-wk.js} +10727 -10300
  322. package/lib/assets/worker-BWwCA-wk.js.map +1 -0
  323. package/lib/context-_fYfJFgk.js +14 -0
  324. package/lib/context-_fYfJFgk.js.map +1 -0
  325. package/lib/hook-BY1NP0kj.js +93 -0
  326. package/lib/hook-BY1NP0kj.js.map +1 -0
  327. package/lib/index-BE2a6gGC.js +726 -0
  328. package/lib/index-BE2a6gGC.js.map +1 -0
  329. package/lib/index-pI9JkN46.js +4765 -0
  330. package/lib/index-pI9JkN46.js.map +1 -0
  331. package/lib/jsx-runtime-BIr0WBt_.js +1526 -0
  332. package/lib/jsx-runtime-BIr0WBt_.js.map +1 -0
  333. package/lib/prism-bash.min-DadFsM4Z.js +1 -0
  334. package/lib/prism-bash.min-DadFsM4Z.js.map +1 -0
  335. package/lib/prism-csharp.min-Yizuc34Y.js +35 -0
  336. package/lib/prism-csharp.min-Yizuc34Y.js.map +1 -0
  337. package/lib/prism-java.min-d5iT_mOd.js +1 -0
  338. package/lib/prism-java.min-d5iT_mOd.js.map +1 -0
  339. package/lib/prism-json.min-B1GJqK1k.js +1 -0
  340. package/lib/prism-json.min-B1GJqK1k.js.map +1 -0
  341. package/lib/prism-markup-templating-DZrrEs0A.js +1 -0
  342. package/lib/prism-markup-templating-DZrrEs0A.js.map +1 -0
  343. package/lib/prism-objectivec.min-BXSWqpJJ.js +2 -0
  344. package/lib/prism-objectivec.min-BXSWqpJJ.js.map +1 -0
  345. package/lib/prism-php.min-o7FpoMP_.js +1 -0
  346. package/lib/prism-php.min-o7FpoMP_.js.map +1 -0
  347. package/lib/prism-ruby.min-C7LwcKyz.js +1 -0
  348. package/lib/prism-ruby.min-C7LwcKyz.js.map +1 -0
  349. package/lib/router-BiRCp01d.js +2971 -0
  350. package/lib/router-BiRCp01d.js.map +1 -0
  351. package/lib/slugify-CiPVjteN.js +28 -0
  352. package/lib/slugify-CiPVjteN.js.map +1 -0
  353. package/lib/state-DKdaQzvh.js +288 -0
  354. package/lib/state-DKdaQzvh.js.map +1 -0
  355. package/lib/urql-DMlBWUKL.js +1 -0
  356. package/lib/urql-DMlBWUKL.js.map +1 -0
  357. package/lib/zudoku.auth-auth0.js +10 -7
  358. package/lib/zudoku.auth-auth0.js.map +1 -0
  359. package/lib/zudoku.auth-clerk.js +59 -29
  360. package/lib/zudoku.auth-clerk.js.map +1 -0
  361. package/lib/zudoku.auth-openid.js +714 -538
  362. package/lib/zudoku.auth-openid.js.map +1 -0
  363. package/lib/zudoku.components.js +1793 -512
  364. package/lib/zudoku.components.js.map +1 -0
  365. package/lib/zudoku.openapi-worker.js +15035 -146
  366. package/lib/zudoku.openapi-worker.js.map +1 -0
  367. package/lib/zudoku.plugin-api-keys.js +313 -0
  368. package/lib/zudoku.plugin-api-keys.js.map +1 -0
  369. package/lib/zudoku.plugin-custom-page.js +13 -0
  370. package/lib/zudoku.plugin-custom-page.js.map +1 -0
  371. package/lib/zudoku.plugin-markdown.js +48 -0
  372. package/lib/zudoku.plugin-markdown.js.map +1 -0
  373. package/lib/zudoku.plugin-openapi.js +10 -0
  374. package/lib/zudoku.plugin-openapi.js.map +1 -0
  375. package/lib/zudoku.plugin-redirect.js +11 -0
  376. package/lib/zudoku.plugin-redirect.js.map +1 -0
  377. package/package.json +60 -24
  378. package/src/app/App.tsx +0 -41
  379. package/src/app/demo-cdn.html +26 -0
  380. package/src/app/demo.html +18 -0
  381. package/src/app/demo.tsx +45 -0
  382. package/src/app/entry.client.tsx +47 -0
  383. package/src/app/entry.server.tsx +160 -0
  384. package/src/app/main.css +80 -0
  385. package/src/app/main.tsx +86 -15
  386. package/src/app/standalone.html +20 -0
  387. package/src/app/standalone.tsx +51 -0
  388. package/src/app/tailwind.ts +2 -6
  389. package/src/lib/authentication/AuthenticationPlugin.tsx +38 -0
  390. package/src/lib/authentication/Callback.tsx +1 -1
  391. package/src/lib/authentication/authentication.ts +6 -12
  392. package/src/lib/authentication/components/SignIn.tsx +11 -0
  393. package/src/lib/authentication/components/SignOut.tsx +11 -0
  394. package/src/lib/authentication/components/SignUp.tsx +11 -0
  395. package/src/lib/authentication/hook.ts +2 -2
  396. package/src/lib/authentication/providers/auth0.tsx +4 -2
  397. package/src/lib/authentication/providers/clerk.tsx +63 -31
  398. package/src/lib/authentication/providers/openid.tsx +56 -16
  399. package/src/lib/components/Bootstrap.tsx +44 -0
  400. package/src/lib/components/DevPortal.tsx +55 -49
  401. package/src/lib/components/DeveloperHint.tsx +25 -0
  402. package/src/lib/components/ErrorPage.tsx +28 -0
  403. package/src/lib/components/Header.tsx +89 -28
  404. package/src/lib/components/Heading.tsx +26 -7
  405. package/src/lib/components/InlineCode.tsx +19 -0
  406. package/src/lib/components/Layout.tsx +9 -7
  407. package/src/lib/components/NotFoundPage.tsx +33 -0
  408. package/src/lib/components/SyntaxHighlight.tsx +26 -18
  409. package/src/lib/components/TopNavigation.tsx +6 -1
  410. package/src/lib/components/context/DevPortalProvider.ts +24 -4
  411. package/src/lib/components/index.ts +25 -3
  412. package/src/lib/components/navigation/SideNavigationCategory.tsx +3 -3
  413. package/src/lib/components/navigation/SideNavigationItem.tsx +1 -1
  414. package/src/lib/core/DevPortalContext.ts +54 -25
  415. package/src/lib/core/plugins.ts +26 -5
  416. package/src/lib/errors/ErrorAlert.tsx +21 -0
  417. package/src/lib/errors/RouterError.tsx +13 -0
  418. package/src/lib/errors/ServerError.tsx +5 -0
  419. package/src/lib/errors/TopLevelError.tsx +8 -0
  420. package/src/lib/oas/graphql/index.ts +9 -5
  421. package/src/lib/oas/parser/index.ts +41 -20
  422. package/src/lib/plugins/{api-key → api-keys}/CreateApiKey.tsx +1 -1
  423. package/src/lib/plugins/api-keys/ProtectedRoute.tsx +29 -0
  424. package/src/lib/plugins/api-keys/SettingsApiKeys.tsx +139 -0
  425. package/src/lib/plugins/{api-key → api-keys}/index.tsx +16 -40
  426. package/src/lib/plugins/custom-page/index.tsx +22 -0
  427. package/src/lib/plugins/markdown/MdxPage.tsx +51 -34
  428. package/src/lib/plugins/markdown/Toc.tsx +1 -1
  429. package/src/lib/plugins/markdown/generateRoutes.tsx +16 -6
  430. package/src/lib/plugins/markdown/index.tsx +10 -7
  431. package/src/lib/plugins/openapi/OperationList.tsx +46 -10
  432. package/src/lib/plugins/openapi/OperationListItem.tsx +68 -42
  433. package/src/lib/plugins/openapi/ParameterList.tsx +1 -1
  434. package/src/lib/plugins/openapi/ParameterListItem.tsx +3 -4
  435. package/src/lib/plugins/openapi/{MakeRequest.tsx → PlaygroundDialogWrapper.tsx} +3 -19
  436. package/src/lib/plugins/openapi/RequestBodySidecarBox.tsx +2 -16
  437. package/src/lib/plugins/openapi/ResponsesSidecarBox.tsx +3 -1
  438. package/src/lib/plugins/openapi/Route.tsx +21 -0
  439. package/src/lib/plugins/openapi/SchemaListView.tsx +23 -192
  440. package/src/lib/plugins/openapi/SchemaListViewItem.tsx +110 -0
  441. package/src/lib/plugins/openapi/SchemaListViewItemGroup.tsx +63 -0
  442. package/src/lib/plugins/openapi/Sidecar.tsx +15 -10
  443. package/src/lib/plugins/openapi/SidecarBox.tsx +1 -1
  444. package/src/lib/plugins/openapi/{Select.tsx → SimpleSelect.tsx} +6 -3
  445. package/src/lib/plugins/openapi/StaggeredRender.tsx +31 -0
  446. package/src/lib/plugins/openapi/client/createMemoryClient.ts +56 -0
  447. package/src/lib/plugins/openapi/client/createServer.ts +33 -0
  448. package/src/lib/plugins/openapi/{worker/createSharedWorkerClient.ts → client/createWorkerClient.ts} +21 -2
  449. package/src/lib/plugins/openapi/client/interfaces.ts +5 -0
  450. package/src/lib/plugins/openapi/{worker → client}/worker.ts +3 -3
  451. package/src/lib/plugins/openapi/context.tsx +16 -0
  452. package/src/lib/plugins/openapi/index.tsx +59 -52
  453. package/src/lib/plugins/openapi/interfaces.ts +9 -0
  454. package/src/lib/plugins/openapi/playground/Headers.tsx +60 -33
  455. package/src/lib/plugins/openapi/playground/PathParams.tsx +1 -1
  456. package/src/lib/plugins/openapi/playground/Playground.tsx +172 -193
  457. package/src/lib/plugins/openapi/playground/PlaygroundDialog.tsx +36 -0
  458. package/src/lib/plugins/openapi/playground/QueryParams.tsx +7 -2
  459. package/src/lib/plugins/openapi/playground/createUrl.ts +1 -1
  460. package/src/lib/plugins/openapi/util/prose.ts +7 -0
  461. package/src/lib/plugins/openapi-worker.ts +1 -1
  462. package/src/lib/plugins/redirect/index.tsx +3 -4
  463. package/src/lib/ui/Callout.tsx +4 -4
  464. package/src/lib/ui/Card.tsx +1 -1
  465. package/src/lib/ui/DropdownMenu.tsx +199 -0
  466. package/src/lib/ui/button-variants.ts +1 -0
  467. package/src/lib/util/MdxComponents.tsx +7 -15
  468. package/src/lib/util/groupBy.ts +7 -12
  469. package/src/lib/util/joinPath.tsx +2 -1
  470. package/src/lib/util/logInit.ts +9 -0
  471. package/src/lib/util/objectEntries.ts +5 -0
  472. package/src/lib/util/renderIf.ts +4 -0
  473. package/dist/lib/components/Link.d.ts +0 -1
  474. package/dist/lib/components/Link.js +0 -2
  475. package/dist/lib/components/Link.js.map +0 -1
  476. package/dist/lib/components/Router.d.ts +0 -4
  477. package/dist/lib/components/Router.js +0 -20
  478. package/dist/lib/components/Router.js.map +0 -1
  479. package/dist/lib/core/helmet.d.ts +0 -4
  480. package/dist/lib/core/helmet.js +0 -5
  481. package/dist/lib/core/helmet.js.map +0 -1
  482. package/dist/lib/core/icons.d.ts +0 -1
  483. package/dist/lib/core/icons.js +0 -2
  484. package/dist/lib/core/icons.js.map +0 -1
  485. package/dist/lib/core/router.d.ts +0 -1
  486. package/dist/lib/core/router.js +0 -2
  487. package/dist/lib/core/router.js.map +0 -1
  488. package/dist/lib/plugins/api-key/CreateApiKey.js.map +0 -1
  489. package/dist/lib/plugins/api-key/SettingsApiKeys.js +0 -38
  490. package/dist/lib/plugins/api-key/SettingsApiKeys.js.map +0 -1
  491. package/dist/lib/plugins/api-key/index.js.map +0 -1
  492. package/dist/lib/plugins/index.d.ts +0 -4
  493. package/dist/lib/plugins/index.js +0 -5
  494. package/dist/lib/plugins/index.js.map +0 -1
  495. package/dist/lib/plugins/openapi/MakeRequest.js.map +0 -1
  496. package/dist/lib/plugins/openapi/Select.js +0 -5
  497. package/dist/lib/plugins/openapi/Select.js.map +0 -1
  498. package/dist/lib/plugins/openapi/worker/createSharedWorkerClient.d.ts +0 -5
  499. package/dist/lib/plugins/openapi/worker/createSharedWorkerClient.js.map +0 -1
  500. package/dist/lib/plugins/openapi/worker/shared-worker.d.ts +0 -1
  501. package/dist/lib/plugins/openapi/worker/shared-worker.js +0 -6
  502. package/dist/lib/plugins/openapi/worker/shared-worker.js.map +0 -1
  503. package/dist/lib/plugins/openapi/worker/worker.js.map +0 -1
  504. package/dist/vite/common.d.ts +0 -1
  505. package/dist/vite/common.js +0 -5
  506. package/dist/vite/common.js.map +0 -1
  507. package/dist/vite/plugin-html.d.ts +0 -3
  508. package/dist/vite/plugin-html.js +0 -47
  509. package/dist/vite/plugin-html.js.map +0 -1
  510. package/dist/vite/plugin-openapi-worker.d.ts +0 -4
  511. package/dist/vite/plugin-openapi-worker.js +0 -28
  512. package/dist/vite/plugin-openapi-worker.js.map +0 -1
  513. package/lib/Spinner-BINYpvLB.js +0 -8412
  514. package/lib/clerk-Wslx_mPo.js +0 -19685
  515. package/lib/index-PyGcnQFX.js +0 -3462
  516. package/lib/loglevel-CoH7VSwE.js +0 -152
  517. package/lib/state-2Hu1renZ.js +0 -313
  518. package/lib/zudoku.plugins.js +0 -19892
  519. package/src/lib/components/Link.tsx +0 -1
  520. package/src/lib/components/Router.tsx +0 -28
  521. package/src/lib/core/helmet.ts +0 -5
  522. package/src/lib/core/icons.tsx +0 -1
  523. package/src/lib/core/router.tsx +0 -1
  524. package/src/lib/plugins/api-key/SettingsApiKeys.tsx +0 -117
  525. package/src/lib/plugins/index.ts +0 -4
  526. package/src/lib/plugins/openapi/worker/shared-worker.ts +0 -5
  527. /package/dist/lib/plugins/{api-key → api-keys}/CreateApiKey.d.ts +0 -0
  528. /package/dist/lib/plugins/{api-key → api-keys}/SettingsApiKeys.d.ts +0 -0
  529. /package/dist/lib/plugins/openapi/{worker → client}/worker.d.ts +0 -0
@@ -1,3 +1,25 @@
1
- export { useMDXComponents } from "@mdx-js/react";
2
- export { DevPortal } from "./DevPortal.js";
3
- export { Link } from "./Link.js";
1
+ import { useMDXComponents as useMDXComponentsImport } from "@mdx-js/react";
2
+ import { Helmet } from "@zudoku/react-helmet-async";
3
+ import { Link as LinkImport } from "react-router-dom";
4
+ import { RouterError as RouterErrorImport } from "../errors/RouterError.js";
5
+ import { ServerError as ServerErrorImport } from "../errors/ServerError.js";
6
+ import { Button as ButtonImport } from "../ui/Button.js";
7
+ import { Callout as CalloutImport } from "../ui/Callout.js";
8
+ import {
9
+ Bootstrap as BootstrapImport,
10
+ BootstrapStatic as BootstrapStaticImport,
11
+ } from "./Bootstrap.js";
12
+ import { DevPortal as DevPortalImport } from "./DevPortal.js";
13
+ import { Layout as LayoutImport } from "./Layout.js";
14
+
15
+ export const useMDXComponents = /*@__PURE__*/ useMDXComponentsImport;
16
+ export const Callout = /*@__PURE__*/ CalloutImport;
17
+ export const DevPortal = /*@__PURE__*/ DevPortalImport;
18
+ export const Layout = /*@__PURE__*/ LayoutImport;
19
+ export const Link = /*@__PURE__*/ LinkImport;
20
+ export const RouterError = /*@__PURE__*/ RouterErrorImport;
21
+ export const ServerError = /*@__PURE__*/ ServerErrorImport;
22
+ export const Bootstrap = /*@__PURE__*/ BootstrapImport;
23
+ export const BootstrapStatic = /*@__PURE__*/ BootstrapStaticImport;
24
+ export const Button = /*@__PURE__*/ ButtonImport;
25
+ export const Head = /*@__PURE__*/ Helmet;
@@ -8,7 +8,7 @@ import { useTopNavigationItem } from "../context/DevPortalProvider.js";
8
8
  import { useViewportAnchor } from "../context/ViewportAnchorContext.js";
9
9
  import { SideNavigationItem } from "./SideNavigationItem.js";
10
10
  import { useNavigationCollapsibleState } from "./useNavigationCollapsibleState.js";
11
- import { checkHasActiveItem, isPathItem } from "./util.js";
11
+ import { checkHasActiveItem } from "./util.js";
12
12
 
13
13
  export const SideNavigationCategory = ({
14
14
  category,
@@ -59,9 +59,9 @@ export const SideNavigationCategory = ({
59
59
  <Collapsible.Content className="CollapsibleContent -mx-[--padding-nav-item]">
60
60
  {/* margin on Collapsible.Content will lead jumpiness when animating because it's not added to the calculated height */}
61
61
  <ul className="space-y-0.5 mt-1.5 mb-4 ms-3">
62
- {category.children.map((item) => (
62
+ {category.children.map((item, i) => (
63
63
  <SideNavigationItem
64
- key={isPathItem(item) ? item.path + item.label : item.href}
64
+ key={i}
65
65
  category={category}
66
66
  item={item}
67
67
  activeAnchor={activeAnchor}
@@ -114,7 +114,7 @@ export const SideNavigationItem = ({
114
114
  {linkContent}
115
115
  </Collapsible.Trigger>
116
116
  <Collapsible.Content className="CollapsibleContent ms-[calc(var(--padding-nav-item)*1.125)]">
117
- <ul className="mt-1 border-border border-l ps-1.5">
117
+ <ul className="mt-1 border-l ps-1.5">
118
118
  {item.children.map((child) => (
119
119
  <SideNavigationItem
120
120
  key={isPathItem(child) ? child.path : child.href}
@@ -1,17 +1,15 @@
1
1
  import { QueryClient } from "@tanstack/react-query";
2
2
  import { type ReactNode } from "react";
3
- import { create } from "zustand";
4
3
  import { type AuthenticationProvider } from "../authentication/authentication.js";
4
+ import type { ComponentsContextType } from "../components/context/ComponentsContext.js";
5
+ import { type DevPortalPath } from "../components/DevPortal.js";
6
+ import type { MdxComponentsType } from "../util/MdxComponents.js";
5
7
  import {
6
- type DevPortalPath,
7
- type DevPortalProps,
8
- } from "../components/DevPortal.js";
9
- import {
8
+ type DevPortalPlugin,
10
9
  isApiIdentityPlugin,
11
10
  isNavigationPlugin,
12
- needsInitialization,
13
- type DevPortalPlugin,
14
11
  type NavigationPlugin,
12
+ needsInitialization,
15
13
  } from "./plugins.js";
16
14
 
17
15
  export interface ApiIdentity {
@@ -55,40 +53,71 @@ export type NavigationItem = {
55
53
  categories?: NavigationCategory[];
56
54
  };
57
55
 
58
- export type RoutingState = {
59
- path?: string;
60
- };
61
-
62
56
  export const queryClient = new QueryClient();
63
57
 
64
- export const useRoutingState = create<RoutingState>(() => ({}));
65
-
66
58
  export type ApiKeyCache = "api-keys";
67
59
  export type DevPortalCacheKey = ApiKeyCache | string;
68
60
 
61
+ type Metadata = Partial<{
62
+ title: string;
63
+ description: string;
64
+ logo: string;
65
+ favicon: string;
66
+ generator: string;
67
+ applicationName: string;
68
+ referrer: string;
69
+ keywords: string[];
70
+ authors: string[];
71
+ creator: string;
72
+ publisher: string;
73
+ }>;
74
+
75
+ type Page = Partial<{
76
+ pageTitle?: string;
77
+ logo?: {
78
+ src: {
79
+ light: string;
80
+ dark: string;
81
+ };
82
+ width?: string;
83
+ alt?: string;
84
+ };
85
+ }>;
86
+
87
+ export type ZudokuContextOptions = {
88
+ metadata?: Metadata;
89
+ page?: Page;
90
+ authentication?: AuthenticationProvider;
91
+ navigation: NavigationItem[];
92
+ plugins?: DevPortalPlugin[];
93
+ mdx?: {
94
+ components?: MdxComponentsType;
95
+ };
96
+ overrides?: ComponentsContextType;
97
+ };
98
+
69
99
  export class DevPortalContext {
70
- private plugins: DevPortalPlugin[] = [];
100
+ public plugins: NonNullable<ZudokuContextOptions["plugins"]> = [];
101
+ public navigation: ZudokuContextOptions["navigation"];
102
+ public meta: ZudokuContextOptions["metadata"];
103
+ public page: ZudokuContextOptions["page"];
104
+ public authentication?: ZudokuContextOptions["authentication"];
71
105
  private navigationPlugins: NavigationPlugin[];
72
106
 
73
- public navigation: NavigationItem[];
74
- public meta: DevPortalProps["meta"];
75
- public authentication?: AuthenticationProvider;
76
- public state: typeof useRoutingState;
77
-
78
- constructor(config: DevPortalProps) {
107
+ constructor(config: ZudokuContextOptions) {
79
108
  this.plugins = config.plugins ?? [];
80
109
  this.navigation = config.navigation;
81
110
  this.navigationPlugins = this.plugins.filter(isNavigationPlugin);
82
111
  this.authentication = config.authentication;
83
- this.meta = config.meta;
84
- this.state = useRoutingState;
112
+ this.meta = config.metadata;
113
+ this.page = config.page;
85
114
  }
86
115
 
87
116
  initialize = async () => {
88
117
  await Promise.all([
89
118
  this.plugins
90
119
  .filter(needsInitialization)
91
- .map((plugin) => plugin.initialize(this)),
120
+ .map((plugin) => plugin.initialize?.(this)),
92
121
  ]);
93
122
  };
94
123
 
@@ -116,7 +145,7 @@ export class DevPortalContext {
116
145
  return navigations.flatMap((nav) => nav ?? []);
117
146
  };
118
147
 
119
- async signRequest(request: Request) {
148
+ signRequest = async (request: Request) => {
120
149
  if (!this.authentication) {
121
150
  throw new Error("No authentication provider configured");
122
151
  }
@@ -126,5 +155,5 @@ export class DevPortalContext {
126
155
  request.headers.set("Authorization", `Bearer ${accessToken}`);
127
156
 
128
157
  return request;
129
- }
158
+ };
130
159
  }
@@ -1,3 +1,4 @@
1
+ import { type ReactElement } from "react";
1
2
  import { type RouteObject } from "react-router-dom";
2
3
  import {
3
4
  DevPortalContext,
@@ -10,9 +11,10 @@ export type PluginNavigationCategory = {
10
11
  } & NavigationCategory;
11
12
 
12
13
  export type DevPortalPlugin =
14
+ | CommonPlugin
15
+ | ProfileMenuPlugin
13
16
  | NavigationPlugin
14
- | ApiIdentityPlugin
15
- | InitializationPlugin;
17
+ | ApiIdentityPlugin;
16
18
 
17
19
  export interface NavigationPlugin {
18
20
  getRoutes: () => RouteObject[];
@@ -23,10 +25,26 @@ export interface ApiIdentityPlugin {
23
25
  getIdentities: (context: DevPortalContext) => Promise<ApiIdentity[]>;
24
26
  }
25
27
 
26
- export interface InitializationPlugin {
27
- initialize: (context: DevPortalContext) => Promise<void> | void;
28
+ export interface ProfileMenuPlugin {
29
+ getProfileMenuItems: (context: DevPortalContext) => NavigationItem[];
28
30
  }
29
31
 
32
+ export type NavigationItem = {
33
+ label: string;
34
+ path?: string;
35
+ children?: NavigationItem[];
36
+ };
37
+
38
+ export interface CommonPlugin {
39
+ initialize?: (context: DevPortalContext) => Promise<void> | void;
40
+ getHead?: () => ReactElement | undefined;
41
+ }
42
+
43
+ export const isProfileMenuPlugin = (
44
+ obj: DevPortalPlugin,
45
+ ): obj is ProfileMenuPlugin =>
46
+ "getProfileMenuItems" in obj && typeof obj.getProfileMenuItems === "function";
47
+
30
48
  export const isNavigationPlugin = (
31
49
  obj: DevPortalPlugin,
32
50
  ): obj is NavigationPlugin =>
@@ -34,9 +52,12 @@ export const isNavigationPlugin = (
34
52
 
35
53
  export const needsInitialization = (
36
54
  obj: DevPortalPlugin,
37
- ): obj is InitializationPlugin =>
55
+ ): obj is CommonPlugin =>
38
56
  "initialize" in obj && typeof obj.initialize === "function";
39
57
 
58
+ export const hasHead = (obj: DevPortalPlugin): obj is CommonPlugin =>
59
+ "getHead" in obj && typeof obj.getHead === "function";
60
+
40
61
  export const isApiIdentityPlugin = (
41
62
  obj: DevPortalPlugin,
42
63
  ): obj is ApiIdentityPlugin =>
@@ -0,0 +1,21 @@
1
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2
+ export function ErrorAlert({ error }: { error: any }) {
3
+ const message = error?.message ?? "Something went wrong";
4
+ const stack = error?.stack;
5
+
6
+ return (
7
+ <div className="flex h-screen max-h-screen min-h-full items-center justify-center bg-primary-background px-4 py-16 lg:px-8">
8
+ <div className="mx-auto max-w-[85%] sm:max-w-[50%]">
9
+ <h1 className="text-4xl font-bold tracking-tight text-h1-text sm:text-5xl">
10
+ Something went wrong
11
+ </h1>
12
+ <p className="mt-5 text-h1-text">{message}</p>
13
+ {stack ? (
14
+ <pre className="mt-5 max-h-[400px] w-full overflow-scroll rounded-md border border-input-border bg-input-background p-3 text-property-name-text text-red-700">
15
+ {stack}
16
+ </pre>
17
+ ) : null}
18
+ </div>
19
+ </div>
20
+ );
21
+ }
@@ -0,0 +1,13 @@
1
+ import { isRouteErrorResponse, useRouteError } from "react-router-dom";
2
+ import { NotFoundPage } from "../components/NotFoundPage.js";
3
+ import { ErrorAlert } from "./ErrorAlert.js";
4
+
5
+ export function RouterError() {
6
+ const error = useRouteError();
7
+
8
+ if (isRouteErrorResponse(error) && error.status === 404) {
9
+ return <NotFoundPage />;
10
+ }
11
+
12
+ return <ErrorAlert error={error} />;
13
+ }
@@ -0,0 +1,5 @@
1
+ import { ErrorAlert } from "./ErrorAlert.js";
2
+
3
+ export function ServerError({ error }: { error: unknown }) {
4
+ return <ErrorAlert error={error} />;
5
+ }
@@ -0,0 +1,8 @@
1
+ import { FallbackProps } from "react-error-boundary";
2
+ import { ErrorAlert } from "./ErrorAlert.js";
3
+
4
+ export function TopLevelError({ error, resetErrorBoundary }: FallbackProps) {
5
+ // Call resetErrorBoundary() to reset the error boundary and retry the render.
6
+
7
+ return <ErrorAlert error={error} />;
8
+ }
@@ -36,16 +36,20 @@ type OperationLike = {
36
36
  method: string;
37
37
  };
38
38
  export const slugifyOperation = (operation: OperationLike, tag?: string) => {
39
+ const summary =
40
+ operation.summary +
41
+ (operation.operationId
42
+ ? "-" + operation.operationId.slice(0, operation.summary ? 4 : 12)
43
+ : "");
44
+
39
45
  return slugify(
40
46
  (tag ? tag + "-" : "") +
41
- (operation.summary ??
42
- operation.operationId ??
43
- `${operation.method}-${operation.path}`),
47
+ (summary || `${operation.method}-${operation.path}`),
44
48
  { lower: true, trim: true },
45
49
  );
46
50
  };
47
51
 
48
- const cache = new LRUCache<string, OpenAPIDocument>({
52
+ const cache = new LRUCache<string, Promise<OpenAPIDocument>>({
49
53
  ttl: 60 * 10 * 1000,
50
54
  ttlAutopurge: true,
51
55
  });
@@ -384,7 +388,7 @@ const loadOpenAPISchema = async (input: NonNullable<unknown>) => {
384
388
  return cache.get(hash)!;
385
389
  }
386
390
 
387
- const schema = await validate(input);
391
+ const schema = validate(input);
388
392
 
389
393
  cache.set(hash, schema);
390
394
 
@@ -1,3 +1,4 @@
1
+ import { GraphQLError } from "graphql/error/index.js";
1
2
  import { OpenAPIV3, type OpenAPIV3_1 } from "openapi-types";
2
3
  import { dereference, type JSONSchema } from "./dereference/index.js";
3
4
  import { upgradeSchema } from "./upgrade/index.js";
@@ -9,10 +10,6 @@ type DeepOmitReference<T> = T extends ReferenceObject
9
10
  ? { [K in keyof T]: DeepOmitReference<T[K]> }
10
11
  : T;
11
12
 
12
- // type Prettify<T> = {
13
- // [K in keyof T]: T[K];
14
- // } & {};
15
-
16
13
  export type OpenAPIDocument = DeepOmitReference<OpenAPIV3_1.Document>;
17
14
  export type ResponseObject = DeepOmitReference<OpenAPIV3_1.ResponseObject>;
18
15
  export type OperationObject = DeepOmitReference<OpenAPIV3_1.OperationObject>;
@@ -46,35 +43,63 @@ export const HttpMethods = Object.values(OpenAPIV3.HttpMethods);
46
43
  // };
47
44
 
48
45
  const parseSchemaInput = async (
49
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
50
- schemaInput: any,
46
+ schemaInput: unknown,
51
47
  ): Promise<JSONSchema & { openapi?: string }> => {
52
48
  if (typeof schemaInput === "string") {
53
49
  if (schemaInput.trim().startsWith("{")) {
54
- return JSON.parse(schemaInput);
50
+ try {
51
+ return JSON.parse(schemaInput);
52
+ } catch (err) {
53
+ throw new GraphQLError("Invalid JSON schema", {
54
+ originalError: err,
55
+ });
56
+ }
55
57
  }
56
58
  if (schemaInput.includes("://")) {
57
- const response = await fetch(schemaInput);
58
- return (await response.json()) as JSONSchema;
59
+ let response;
60
+ try {
61
+ response = await fetch(schemaInput, {
62
+ cache: "force-cache",
63
+ });
64
+ } catch (err) {
65
+ throw new GraphQLError("Failed to fetch schema", {
66
+ originalError: err,
67
+ });
68
+ }
69
+
70
+ if (!response.ok) {
71
+ throw new GraphQLError(
72
+ `Failed to fetch schema: ${response.statusText}`,
73
+ );
74
+ }
75
+
76
+ try {
77
+ return (await response.json()) as JSONSchema;
78
+ } catch (err) {
79
+ throw new GraphQLError("Fetched invalid JSON schema", {
80
+ originalError: err,
81
+ });
82
+ }
59
83
  }
60
84
  const yaml = await import("yaml");
61
- return yaml.parse(schemaInput);
85
+ const parsed = yaml.parse(schemaInput);
86
+
87
+ if (typeof parsed === "object") return parsed;
62
88
  }
63
89
 
64
- if (typeof schemaInput === "object") return schemaInput;
90
+ if (typeof schemaInput === "object") return schemaInput as JSONSchema;
65
91
 
66
- throw new Error("Unsupported schema input");
92
+ throw new GraphQLError("Unsupported schema input: " + schemaInput);
67
93
  };
68
94
 
69
95
  /**
70
96
  * Validates, dereferences and upgrades the OpenAPI schema (to v3.1) if necessary.
71
97
  */
72
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
73
- export const validate = async (schemaInput: any) => {
98
+ export const validate = async (schemaInput: unknown) => {
74
99
  const schema = await parseSchemaInput(schemaInput);
75
100
 
76
101
  if (!schema.openapi) {
77
- throw new Error("OpenAPI version is not defined");
102
+ throw new GraphQLError("OpenAPI version is not defined");
78
103
  }
79
104
 
80
105
  // const validator = await getValidator(schema.openapi);
@@ -86,9 +111,5 @@ export const validate = async (schemaInput: any) => {
86
111
 
87
112
  const dereferenced = await dereference(schema);
88
113
 
89
- const upgraded = upgradeSchema(
90
- dereferenced as OpenAPIV3_1.Document | OpenAPIV3.Document,
91
- );
92
-
93
- return upgraded;
114
+ return upgradeSchema(dereferenced);
94
115
  };
@@ -47,7 +47,7 @@ export const CreateApiKey = ({ service }: { service: ApiKeyService }) => {
47
47
 
48
48
  return (
49
49
  <div className="max-w-screen-lg pt-[--padding-content-top] pb-[--padding-content-bottom]">
50
- <div className="flex justify-between mb-4 border-b border-border pb-1">
50
+ <div className="flex justify-between mb-4 border-b pb-1">
51
51
  <h1 className="font-medium text-2xl">New API Key</h1>
52
52
  </div>
53
53
  <form
@@ -0,0 +1,29 @@
1
+ import { Outlet } from "react-router-dom";
2
+ import { useAuth } from "../../authentication/hook.js";
3
+ import { DeveloperHint } from "../../components/DeveloperHint.js";
4
+ import { Button } from "../../ui/Button.js";
5
+
6
+ export const ProtectedRoute = () => {
7
+ const auth = useAuth();
8
+
9
+ // TODO: should we suspend here somehow?
10
+ if (auth.isAuthEnabled && auth.isPending) {
11
+ return null;
12
+ }
13
+
14
+ return auth.isAuthenticated ? (
15
+ <Outlet />
16
+ ) : !auth.isAuthEnabled ? (
17
+ <div className="flex flex-col justify-center gap-2 items-center h-1/2">
18
+ <DeveloperHint className="max-w-[600px]">
19
+ Authentication needs to be enabled for API keys to work. Enable it in
20
+ your Zudoku configuration under <code>authentication</code>.
21
+ </DeveloperHint>
22
+ </div>
23
+ ) : (
24
+ <div className="flex flex-col justify-center gap-2 items-center h-1/2">
25
+ Please login first to view this page
26
+ <Button onClick={() => auth.login()}>Login</Button>
27
+ </div>
28
+ );
29
+ };
@@ -0,0 +1,139 @@
1
+ import {
2
+ useMutation,
3
+ useQueryClient,
4
+ useSuspenseQuery,
5
+ } from "@tanstack/react-query";
6
+ import { EyeIcon, EyeOffIcon, RotateCwIcon, TrashIcon } from "lucide-react";
7
+ import { useState } from "react";
8
+ import { Link } from "react-router-dom";
9
+ import { useDevPortal } from "../../components/context/DevPortalProvider.js";
10
+ import { Button } from "../../ui/Button.js";
11
+ import { cn } from "../../util/cn.js";
12
+ import { ApiKeyService } from "./index.js";
13
+
14
+ export const SettingsApiKeys = ({ service }: { service: ApiKeyService }) => {
15
+ const context = useDevPortal();
16
+ const queryClient = useQueryClient();
17
+ const { data } = useSuspenseQuery({
18
+ queryFn: () => service.getKeys(context),
19
+ queryKey: ["api-keys"],
20
+ retry: false,
21
+ });
22
+
23
+ const deleteKeyMutation = useMutation({
24
+ mutationFn: (id: string) => {
25
+ if (!service.deleteKey) {
26
+ throw new Error("deleteKey not implemented");
27
+ }
28
+
29
+ return service.deleteKey(id, context);
30
+ },
31
+ onSuccess: () => {
32
+ void queryClient.invalidateQueries({ queryKey: ["api-keys"] });
33
+ },
34
+ });
35
+
36
+ return (
37
+ <div className="max-w-screen-lg h-full pt-[--padding-content-top] pb-[--padding-content-bottom]">
38
+ <div className="flex justify-between mb-4 border-b pb-3">
39
+ <h1 className="font-medium text-2xl">API Keys</h1>
40
+ {service.createKey && (
41
+ <Button asChild>
42
+ <Link to="/settings/api-keys/new">Create API Key</Link>
43
+ </Button>
44
+ )}
45
+ </div>
46
+
47
+ {data.length === 0 ? (
48
+ <div className="flex flex-col justify-center gap-4 items-center h-1/2 my-8">
49
+ <div className="text-center">
50
+ No API keys created yet.
51
+ <br />
52
+ Get started and create the first one now
53
+ </div>
54
+ {service.createKey && (
55
+ <Button asChild>
56
+ <Link to="/settings/api-keys/new">Create API Key</Link>
57
+ </Button>
58
+ )}
59
+ </div>
60
+ ) : (
61
+ <ul
62
+ className={cn(
63
+ "grid grid-cols-1 rounded border",
64
+ "lg:grid-cols-[minmax(250px,min-content)_1fr_min-content]",
65
+ )}
66
+ >
67
+ {data.map((key) => (
68
+ <li
69
+ className="border-b p-5 grid grid-cols-subgrid col-span-full gap-2 items-center"
70
+ key={key.id}
71
+ >
72
+ <div className="flex flex-col gap-1 text-sm">
73
+ {key.description ?? key.id}
74
+ <div className="text-muted-foreground text-xs">
75
+ {key.createdOn && (
76
+ <div>
77
+ Created on {new Date(key.createdOn).toLocaleDateString()}
78
+ </div>
79
+ )}
80
+ {key.expiresOn && (
81
+ <div>
82
+ Expires on {new Date(key.expiresOn).toLocaleDateString()}
83
+ </div>
84
+ )}
85
+ </div>
86
+ </div>
87
+ <div className="items-center flex lg:justify-center">
88
+ <RevealApiKey apiKey={key.key} />
89
+ </div>
90
+ <div className="flex gap-2">
91
+ {service.rollKey && (
92
+ <Button size="icon">
93
+ <RotateCwIcon size={16} />
94
+ </Button>
95
+ )}
96
+ {service.deleteKey && (
97
+ <Button
98
+ variant="ghost"
99
+ size="icon"
100
+ onClick={() => {
101
+ if (!confirm("Do you want to delete this key?")) {
102
+ return;
103
+ }
104
+
105
+ deleteKeyMutation.mutate(key.id);
106
+ }}
107
+ disabled={deleteKeyMutation.isPending}
108
+ >
109
+ <TrashIcon size={16} />
110
+ </Button>
111
+ )}
112
+ </div>
113
+ </li>
114
+ ))}
115
+ </ul>
116
+ )}
117
+ </div>
118
+ );
119
+ };
120
+
121
+ const RevealApiKey = ({ apiKey }: { apiKey: string }) => {
122
+ const [revealed, setRevealed] = useState(false);
123
+
124
+ return (
125
+ <div className="flex gap-2 items-center text-sm w-full">
126
+ <input
127
+ className="border rounded bg-gray-100 dark:bg-gray-950 p-1 font-mono max-w-min"
128
+ value={revealed ? apiKey : "•".repeat(apiKey.length)}
129
+ />
130
+ <Button
131
+ variant="outline"
132
+ onClick={() => setRevealed((prev) => !prev)}
133
+ size="icon"
134
+ >
135
+ {revealed ? <EyeOffIcon size={16} /> : <EyeIcon size={16} />}
136
+ </Button>
137
+ </div>
138
+ );
139
+ };