zudoku 0.1.1-dev.9 → 0.3.0-dev.10

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 (610) hide show
  1. package/dist/app/App.js +16 -6
  2. package/dist/app/App.js.map +1 -1
  3. package/dist/app/main.js +10 -2
  4. package/dist/app/main.js.map +1 -1
  5. package/dist/cli/build/handler.js +3 -1
  6. package/dist/cli/build/handler.js.map +1 -1
  7. package/dist/cli/common/analytics/lib.js +1 -1
  8. package/dist/cli/common/analytics/lib.js.map +1 -1
  9. package/dist/cli/common/logger.js +3 -1
  10. package/dist/cli/common/logger.js.map +1 -1
  11. package/dist/cli/common/outdated.js +4 -4
  12. package/dist/cli/common/outdated.js.map +1 -1
  13. package/dist/cli/common/output.js +4 -4
  14. package/dist/cli/common/output.js.map +1 -1
  15. package/dist/cli/common/utils/box.js +2 -2
  16. package/dist/cli/common/utils/box.js.map +1 -1
  17. package/dist/cli/dev/handler.js +4 -2
  18. package/dist/cli/dev/handler.js.map +1 -1
  19. package/dist/config/config.d.ts +30 -6
  20. package/dist/config/validators/auth.d.ts +2 -0
  21. package/dist/config/validators/auth.js +2 -0
  22. package/dist/config/validators/auth.js.map +1 -0
  23. package/dist/config/validators/validate.d.ts +2 -0
  24. package/dist/config/validators/validate.js +4 -0
  25. package/dist/config/validators/validate.js.map +1 -0
  26. package/dist/index.d.ts +2 -6
  27. package/dist/index.js +1 -5
  28. package/dist/index.js.map +1 -1
  29. package/dist/lib/authentication/Callback.d.ts +3 -0
  30. package/dist/lib/authentication/Callback.js +34 -0
  31. package/dist/lib/authentication/Callback.js.map +1 -0
  32. package/dist/lib/authentication/authentication.d.ts +14 -0
  33. package/dist/lib/authentication/authentication.js.map +1 -0
  34. package/dist/lib/authentication/errors.d.ts +15 -0
  35. package/dist/lib/authentication/errors.js +10 -0
  36. package/dist/lib/authentication/errors.js.map +1 -0
  37. package/dist/lib/authentication/hook.d.ts +8 -0
  38. package/dist/lib/authentication/hook.js +30 -0
  39. package/dist/lib/authentication/hook.js.map +1 -0
  40. package/dist/lib/authentication/providers/auth0.d.ts +4 -0
  41. package/dist/lib/authentication/providers/auth0.js +41 -0
  42. package/dist/lib/authentication/providers/auth0.js.map +1 -0
  43. package/dist/lib/authentication/providers/clerk.d.ts +4 -0
  44. package/dist/lib/authentication/providers/clerk.js +56 -0
  45. package/dist/lib/authentication/providers/clerk.js.map +1 -0
  46. package/dist/lib/authentication/providers/openid.d.ts +35 -0
  47. package/dist/lib/authentication/providers/openid.js +206 -0
  48. package/dist/lib/authentication/providers/openid.js.map +1 -0
  49. package/dist/lib/authentication/state.d.ts +14 -0
  50. package/dist/lib/authentication/state.js +6 -0
  51. package/dist/lib/authentication/state.js.map +1 -0
  52. package/dist/{app → lib}/components/AnchorLink.js.map +1 -1
  53. package/dist/{app → lib}/components/CategoryHeading.js.map +1 -1
  54. package/dist/lib/components/DevPortal.d.ts +25 -0
  55. package/dist/lib/components/DevPortal.js +31 -0
  56. package/dist/lib/components/DevPortal.js.map +1 -0
  57. package/dist/{app → lib}/components/Dialog.d.ts +2 -2
  58. package/dist/{app → lib}/components/Dialog.js +3 -3
  59. package/dist/lib/components/Dialog.js.map +1 -0
  60. package/dist/lib/components/Header.d.ts +1 -0
  61. package/dist/lib/components/Header.js +15 -0
  62. package/dist/lib/components/Header.js.map +1 -0
  63. package/dist/{app → lib/components}/Heading.js +2 -2
  64. package/dist/lib/components/Heading.js.map +1 -0
  65. package/dist/{app → lib}/components/Input.js.map +1 -1
  66. package/dist/{app → lib}/components/Layout.js +4 -7
  67. package/dist/lib/components/Layout.js.map +1 -0
  68. package/dist/lib/components/Link.d.ts +1 -0
  69. package/dist/lib/components/Link.js +2 -0
  70. package/dist/lib/components/Link.js.map +1 -0
  71. package/dist/{app → lib}/components/Markdown.js.map +1 -1
  72. package/dist/lib/components/Router.d.ts +4 -0
  73. package/dist/lib/components/Router.js +20 -0
  74. package/dist/lib/components/Router.js.map +1 -0
  75. package/dist/lib/components/Select.d.ts +13 -0
  76. package/dist/lib/components/Select.js +27 -0
  77. package/dist/lib/components/Select.js.map +1 -0
  78. package/dist/lib/components/Spinner.d.ts +3 -0
  79. package/dist/lib/components/Spinner.js +4 -0
  80. package/dist/lib/components/Spinner.js.map +1 -0
  81. package/dist/{app → lib}/components/SyntaxHighlight.d.ts +2 -1
  82. package/dist/{app → lib}/components/SyntaxHighlight.js +9 -2
  83. package/dist/lib/components/SyntaxHighlight.js.map +1 -0
  84. package/dist/{app → lib}/components/TopNavigation.js.map +1 -1
  85. package/dist/{app → lib}/components/context/ComponentsContext.d.ts +1 -1
  86. package/dist/{app → lib}/components/context/ComponentsContext.js.map +1 -1
  87. package/dist/{app → lib}/components/context/DevPortalProvider.js +1 -1
  88. package/dist/lib/components/context/DevPortalProvider.js.map +1 -0
  89. package/dist/lib/components/context/PluginSystem.js.map +1 -0
  90. package/dist/{app → lib}/components/context/ThemeContext.js +1 -1
  91. package/dist/{app → lib}/components/context/ThemeContext.js.map +1 -1
  92. package/dist/{app → lib}/components/context/ViewportAnchorContext.js.map +1 -1
  93. package/dist/lib/components/index.d.ts +3 -0
  94. package/dist/lib/components/index.js +4 -0
  95. package/dist/lib/components/index.js.map +1 -0
  96. package/dist/{app → lib}/components/navigation/SideNavigation.js +1 -1
  97. package/dist/{app → lib}/components/navigation/SideNavigation.js.map +1 -1
  98. package/dist/{app → lib}/components/navigation/SideNavigationCategory.js +1 -1
  99. package/dist/{app → lib}/components/navigation/SideNavigationCategory.js.map +1 -1
  100. package/dist/{app → lib}/components/navigation/SideNavigationItem.d.ts +2 -1
  101. package/dist/{app → lib}/components/navigation/SideNavigationItem.js +12 -6
  102. package/dist/lib/components/navigation/SideNavigationItem.js.map +1 -0
  103. package/dist/{app → lib}/components/navigation/SideNavigationWrapper.d.ts +3 -0
  104. package/dist/lib/components/navigation/SideNavigationWrapper.js +7 -0
  105. package/dist/lib/components/navigation/SideNavigationWrapper.js.map +1 -0
  106. package/dist/{app → lib}/components/navigation/useNavigationCollapsibleState.js.map +1 -1
  107. package/dist/{app → lib}/components/navigation/util.js.map +1 -1
  108. package/dist/{app → lib}/core/DevPortalContext.d.ts +10 -32
  109. package/dist/lib/core/DevPortalContext.js +50 -0
  110. package/dist/lib/core/DevPortalContext.js.map +1 -0
  111. package/dist/{app → lib}/core/helmet.js.map +1 -1
  112. package/dist/lib/core/icons.js.map +1 -0
  113. package/dist/{app → lib}/core/plugins.d.ts +2 -7
  114. package/dist/{app → lib}/core/plugins.js +1 -1
  115. package/dist/{app → lib}/core/plugins.js.map +1 -1
  116. package/dist/lib/core/router.js.map +1 -0
  117. package/dist/{app → lib}/oas/graphql/index.js +2 -2
  118. package/dist/lib/oas/graphql/index.js.map +1 -0
  119. package/dist/{app → lib}/oas/parser/dereference/index.js.map +1 -1
  120. package/dist/{app → lib}/oas/parser/dereference/resolveRef.js.map +1 -1
  121. package/dist/{app → lib}/oas/parser/index.js.map +1 -1
  122. package/dist/{app → lib}/oas/parser/upgrade/index.js.map +1 -1
  123. package/dist/lib/plugins/api-key/CreateApiKey.d.ts +4 -0
  124. package/dist/lib/plugins/api-key/CreateApiKey.js +37 -0
  125. package/dist/lib/plugins/api-key/CreateApiKey.js.map +1 -0
  126. package/dist/lib/plugins/api-key/SettingsApiKeys.d.ts +4 -0
  127. package/dist/lib/plugins/api-key/SettingsApiKeys.js +38 -0
  128. package/dist/lib/plugins/api-key/SettingsApiKeys.js.map +1 -0
  129. package/dist/lib/plugins/api-key/index.d.ts +30 -0
  130. package/dist/lib/plugins/api-key/index.js +94 -0
  131. package/dist/lib/plugins/api-key/index.js.map +1 -0
  132. package/dist/lib/plugins/index.d.ts +4 -0
  133. package/dist/lib/plugins/index.js +5 -0
  134. package/dist/lib/plugins/index.js.map +1 -0
  135. package/dist/lib/plugins/markdown/MdxPage.d.ts +5 -0
  136. package/dist/lib/plugins/markdown/MdxPage.js +60 -0
  137. package/dist/lib/plugins/markdown/MdxPage.js.map +1 -0
  138. package/dist/{app → lib}/plugins/markdown/Toc.js.map +1 -1
  139. package/dist/{app → lib}/plugins/markdown/generateRoutes.js +1 -6
  140. package/dist/lib/plugins/markdown/generateRoutes.js.map +1 -0
  141. package/dist/{app → lib}/plugins/markdown/index.js.map +1 -1
  142. package/dist/{app → lib}/plugins/openapi/ColorizedParam.d.ts +1 -2
  143. package/dist/{app → lib}/plugins/openapi/ColorizedParam.js +2 -2
  144. package/dist/lib/plugins/openapi/ColorizedParam.js.map +1 -0
  145. package/dist/lib/plugins/openapi/MakeRequest.js +43 -0
  146. package/dist/lib/plugins/openapi/MakeRequest.js.map +1 -0
  147. package/dist/{app → lib}/plugins/openapi/MethodBadge.js.map +1 -1
  148. package/dist/{app → lib}/plugins/openapi/OperationList.js +12 -3
  149. package/dist/lib/plugins/openapi/OperationList.js.map +1 -0
  150. package/dist/lib/plugins/openapi/OperationListItem.js +17 -0
  151. package/dist/lib/plugins/openapi/OperationListItem.js.map +1 -0
  152. package/dist/{app → lib}/plugins/openapi/ParameterList.d.ts +2 -2
  153. package/dist/lib/plugins/openapi/ParameterList.js +5 -0
  154. package/dist/lib/plugins/openapi/ParameterList.js.map +1 -0
  155. package/dist/lib/plugins/openapi/ParameterListItem.js +13 -0
  156. package/dist/{app → lib}/plugins/openapi/ParameterListItem.js.map +1 -1
  157. package/dist/{app → lib}/plugins/openapi/RequestBodySidecarBox.js +3 -3
  158. package/dist/lib/plugins/openapi/RequestBodySidecarBox.js.map +1 -0
  159. package/dist/{app → lib}/plugins/openapi/ResponsesSidecarBox.js +3 -3
  160. package/dist/{app → lib}/plugins/openapi/ResponsesSidecarBox.js.map +1 -1
  161. package/dist/lib/plugins/openapi/SchemaListView.d.ts +7 -0
  162. package/dist/lib/plugins/openapi/SchemaListView.js +43 -0
  163. package/dist/lib/plugins/openapi/SchemaListView.js.map +1 -0
  164. package/dist/{app → lib}/plugins/openapi/Sidecar.js +21 -19
  165. package/dist/lib/plugins/openapi/Sidecar.js.map +1 -0
  166. package/dist/{app → lib}/plugins/openapi/SidecarBox.js.map +1 -1
  167. package/dist/{app/plugins/openapi/Select.d.ts → lib/plugins/openapi/SimpleSelect.d.ts} +3 -2
  168. package/dist/lib/plugins/openapi/SimpleSelect.js +5 -0
  169. package/dist/lib/plugins/openapi/SimpleSelect.js.map +1 -0
  170. package/dist/{app → lib}/plugins/openapi/graphql/fragment-masking.d.ts +1 -1
  171. package/dist/{app → lib}/plugins/openapi/graphql/fragment-masking.js.map +1 -1
  172. package/dist/{app → lib}/plugins/openapi/graphql/gql.d.ts +5 -5
  173. package/dist/{app → lib}/plugins/openapi/graphql/gql.js +2 -3
  174. package/dist/lib/plugins/openapi/graphql/gql.js.map +1 -0
  175. package/dist/{app → lib}/plugins/openapi/graphql/graphql.d.ts +9 -0
  176. package/dist/{app → lib}/plugins/openapi/graphql/graphql.js +50 -0
  177. package/dist/lib/plugins/openapi/graphql/graphql.js.map +1 -0
  178. package/dist/lib/plugins/openapi/graphql/index.js.map +1 -0
  179. package/dist/{app → lib}/plugins/openapi/index.js +3 -1
  180. package/dist/lib/plugins/openapi/index.js.map +1 -0
  181. package/dist/lib/plugins/openapi/playground/Editor.d.ts +1 -0
  182. package/dist/lib/plugins/openapi/playground/Editor.js +5 -0
  183. package/dist/lib/plugins/openapi/playground/Editor.js.map +1 -0
  184. package/dist/lib/plugins/openapi/playground/Headers.d.ts +6 -0
  185. package/dist/lib/plugins/openapi/playground/Headers.js +25 -0
  186. package/dist/lib/plugins/openapi/playground/Headers.js.map +1 -0
  187. package/dist/lib/plugins/openapi/playground/InlineInput.d.ts +4 -0
  188. package/dist/lib/plugins/openapi/playground/InlineInput.js +3 -0
  189. package/dist/lib/plugins/openapi/playground/InlineInput.js.map +1 -0
  190. package/dist/lib/plugins/openapi/playground/PathParams.d.ts +6 -0
  191. package/dist/lib/plugins/openapi/playground/PathParams.js +21 -0
  192. package/dist/lib/plugins/openapi/playground/PathParams.js.map +1 -0
  193. package/dist/lib/plugins/openapi/playground/Playground.d.ts +32 -0
  194. package/dist/lib/plugins/openapi/playground/Playground.js +97 -0
  195. package/dist/lib/plugins/openapi/playground/Playground.js.map +1 -0
  196. package/dist/lib/plugins/openapi/playground/QueryParams.d.ts +5 -0
  197. package/dist/lib/plugins/openapi/playground/QueryParams.js +22 -0
  198. package/dist/lib/plugins/openapi/playground/QueryParams.js.map +1 -0
  199. package/dist/lib/plugins/openapi/playground/UrlDisplay.d.ts +4 -0
  200. package/dist/lib/plugins/openapi/playground/UrlDisplay.js +22 -0
  201. package/dist/lib/plugins/openapi/playground/UrlDisplay.js.map +1 -0
  202. package/dist/lib/plugins/openapi/playground/createUrl.d.ts +2 -0
  203. package/dist/lib/plugins/openapi/playground/createUrl.js +15 -0
  204. package/dist/lib/plugins/openapi/playground/createUrl.js.map +1 -0
  205. package/dist/{app → lib}/plugins/openapi/util/generateSchemaExample.d.ts +1 -1
  206. package/dist/{app → lib}/plugins/openapi/util/generateSchemaExample.js +17 -9
  207. package/dist/lib/plugins/openapi/util/generateSchemaExample.js.map +1 -0
  208. package/dist/{app → lib}/plugins/openapi/util/urql.js.map +1 -1
  209. package/dist/{app → lib}/plugins/openapi/worker/createSharedWorkerClient.js +2 -1
  210. package/dist/lib/plugins/openapi/worker/createSharedWorkerClient.js.map +1 -0
  211. package/dist/lib/plugins/openapi/worker/shared-worker.d.ts +1 -0
  212. package/dist/lib/plugins/openapi/worker/shared-worker.js +6 -0
  213. package/dist/lib/plugins/openapi/worker/shared-worker.js.map +1 -0
  214. package/dist/{app → lib}/plugins/openapi/worker/worker.js.map +1 -1
  215. package/dist/lib/plugins/openapi-worker.d.ts +1 -0
  216. package/dist/lib/plugins/openapi-worker.js +2 -0
  217. package/dist/lib/plugins/openapi-worker.js.map +1 -0
  218. package/dist/{app → lib}/plugins/redirect/index.d.ts +1 -2
  219. package/dist/{app → lib}/plugins/redirect/index.js.map +1 -1
  220. package/dist/lib/ui/Button.d.ts +7 -0
  221. package/dist/lib/ui/Button.js +11 -0
  222. package/dist/lib/ui/Button.js.map +1 -0
  223. package/dist/{app → lib}/ui/Callout.js.map +1 -1
  224. package/dist/{app → lib}/ui/Card.js.map +1 -1
  225. package/dist/{app → lib}/ui/Note.js.map +1 -1
  226. package/dist/{app → lib}/ui/Tabs.d.ts +2 -2
  227. package/dist/{app → lib}/ui/Tabs.js +2 -2
  228. package/dist/{app → lib}/ui/Tabs.js.map +1 -1
  229. package/dist/lib/ui/button-variants.d.ts +4 -0
  230. package/dist/{app/ui/Button.js → lib/ui/button-variants.js} +2 -12
  231. package/dist/lib/ui/button-variants.js.map +1 -0
  232. package/dist/{app → lib}/util/MdxComponents.js +9 -9
  233. package/dist/lib/util/MdxComponents.js.map +1 -0
  234. package/dist/{app → lib}/util/cn.js.map +1 -1
  235. package/dist/lib/util/createVariantComponent.d.ts +9 -0
  236. package/dist/lib/util/createVariantComponent.js +17 -0
  237. package/dist/lib/util/createVariantComponent.js.map +1 -0
  238. package/dist/{app → lib}/util/createWaitForNotify.js.map +1 -1
  239. package/dist/{app → lib}/util/groupBy.js.map +1 -1
  240. package/dist/{app → lib}/util/joinPath.js.map +1 -1
  241. package/dist/{app → lib}/util/pastellize.js.map +1 -1
  242. package/dist/lib/util/slugify.js.map +1 -0
  243. package/dist/{app → lib}/util/traverseNavigation.js.map +1 -1
  244. package/dist/{app → lib}/util/useScrollToAnchor.js.map +1 -1
  245. package/dist/{app → lib}/util/useScrollToTop.js.map +1 -1
  246. package/dist/ts.js +1 -2
  247. package/dist/ts.js.map +1 -1
  248. package/dist/vite/build.js +2 -8
  249. package/dist/vite/build.js.map +1 -1
  250. package/dist/vite/common.d.ts +1 -0
  251. package/dist/vite/common.js +5 -0
  252. package/dist/vite/common.js.map +1 -0
  253. package/dist/vite/config.d.ts +9 -2
  254. package/dist/vite/config.js +69 -28
  255. package/dist/vite/config.js.map +1 -1
  256. package/dist/vite/config.test.js +1 -1
  257. package/dist/vite/config.test.js.map +1 -1
  258. package/dist/vite/dev-server.d.ts +2 -0
  259. package/dist/vite/dev-server.js +30 -10
  260. package/dist/vite/dev-server.js.map +1 -1
  261. package/dist/vite/plugin-api-keys.d.ts +4 -0
  262. package/dist/vite/plugin-api-keys.js +33 -0
  263. package/dist/vite/plugin-api-keys.js.map +1 -0
  264. package/dist/vite/plugin-api.js +4 -2
  265. package/dist/vite/plugin-api.js.map +1 -1
  266. package/dist/vite/plugin-auth.js +3 -2
  267. package/dist/vite/plugin-auth.js.map +1 -1
  268. package/dist/vite/plugin-component.d.ts +4 -0
  269. package/dist/vite/plugin-component.js +16 -0
  270. package/dist/vite/plugin-component.js.map +1 -0
  271. package/dist/vite/plugin-config.d.ts +1 -0
  272. package/dist/vite/plugin-config.js +4 -3
  273. package/dist/vite/plugin-config.js.map +1 -1
  274. package/dist/vite/plugin-docs.js +4 -2
  275. package/dist/vite/plugin-docs.js.map +1 -1
  276. package/dist/vite/plugin-docs.test.js +1 -2
  277. package/dist/vite/plugin-docs.test.js.map +1 -1
  278. package/dist/vite/plugin-html.js +0 -3
  279. package/dist/vite/plugin-html.js.map +1 -1
  280. package/dist/vite/plugin-mdx.js +3 -1
  281. package/dist/vite/plugin-mdx.js.map +1 -1
  282. package/dist/vite/plugin-metadata.d.ts +6 -0
  283. package/dist/vite/plugin-metadata.js +24 -0
  284. package/dist/vite/plugin-metadata.js.map +1 -0
  285. package/dist/vite/plugin-openapi-worker.d.ts +4 -0
  286. package/dist/vite/plugin-openapi-worker.js +28 -0
  287. package/dist/vite/plugin-openapi-worker.js.map +1 -0
  288. package/dist/vite/plugin-redirect.d.ts +4 -0
  289. package/dist/vite/plugin-redirect.js +32 -0
  290. package/dist/vite/plugin-redirect.js.map +1 -0
  291. package/dist/vite/plugin.js +8 -0
  292. package/dist/vite/plugin.js.map +1 -1
  293. package/lib/Spinner-DCwVN24H.js +8441 -0
  294. package/lib/assets/index-BPdJm2ty.js +4764 -0
  295. package/lib/assets/worker-BCcpCNJ7.js +14473 -0
  296. package/lib/clerk-Wslx_mPo.js +19685 -0
  297. package/lib/index-PyGcnQFX.js +3462 -0
  298. package/lib/loglevel-CoH7VSwE.js +152 -0
  299. package/lib/prism-bash.min-DadFsM4Z.js +6 -0
  300. package/lib/prism-csharp.min-Yizuc34Y.js +34 -0
  301. package/lib/prism-java.min-d5iT_mOd.js +6 -0
  302. package/lib/prism-json.min-B1GJqK1k.js +1 -0
  303. package/lib/prism-markup-templating-DZrrEs0A.js +61 -0
  304. package/lib/prism-objectivec.min-BXSWqpJJ.js +1 -0
  305. package/lib/prism-php.min-o7FpoMP_.js +10 -0
  306. package/lib/prism-ruby.min-C7LwcKyz.js +9 -0
  307. package/lib/state-2Hu1renZ.js +313 -0
  308. package/lib/urql-DMlBWUKL.js +1591 -0
  309. package/lib/zudoku.auth-auth0.js +27 -0
  310. package/lib/zudoku.auth-clerk.js +49 -0
  311. package/lib/zudoku.auth-openid.js +912 -0
  312. package/lib/zudoku.components.js +894 -0
  313. package/lib/zudoku.openapi-worker.js +225 -0
  314. package/lib/zudoku.plugins.js +19908 -0
  315. package/package.json +70 -39
  316. package/src/app/App.tsx +17 -6
  317. package/src/app/main.css +1 -0
  318. package/src/app/main.tsx +12 -3
  319. package/src/lib/authentication/Callback.tsx +60 -0
  320. package/src/lib/authentication/authentication.ts +19 -0
  321. package/src/lib/authentication/errors.ts +21 -0
  322. package/src/lib/authentication/hook.ts +34 -0
  323. package/src/lib/authentication/providers/auth0.tsx +53 -0
  324. package/src/lib/authentication/providers/clerk.tsx +66 -0
  325. package/src/lib/authentication/providers/openid.tsx +314 -0
  326. package/src/lib/authentication/state.ts +21 -0
  327. package/src/{app → lib/components}/DevPortal.tsx +29 -42
  328. package/src/{app → lib}/components/Dialog.tsx +37 -37
  329. package/src/{app → lib}/components/Header.tsx +28 -23
  330. package/src/{app → lib/components}/Heading.tsx +2 -2
  331. package/src/{app → lib}/components/Layout.tsx +18 -12
  332. package/src/lib/components/Link.tsx +1 -0
  333. package/src/lib/components/Router.tsx +28 -0
  334. package/src/lib/components/Select.tsx +157 -0
  335. package/src/lib/components/Spinner.tsx +5 -0
  336. package/src/{app → lib}/components/SyntaxHighlight.tsx +15 -4
  337. package/src/{app → lib}/components/context/DevPortalProvider.ts +1 -1
  338. package/src/lib/components/index.ts +3 -0
  339. package/src/{app → lib}/components/navigation/SideNavigation.tsx +4 -1
  340. package/src/{app → lib}/components/navigation/SideNavigationCategory.tsx +3 -1
  341. package/src/{app → lib}/components/navigation/SideNavigationItem.tsx +16 -7
  342. package/src/lib/components/navigation/SideNavigationWrapper.tsx +24 -0
  343. package/src/{app → lib}/core/DevPortalContext.ts +33 -67
  344. package/src/{app → lib}/core/plugins.ts +5 -5
  345. package/src/{app → lib}/oas/graphql/index.ts +2 -2
  346. package/src/lib/plugins/api-key/CreateApiKey.tsx +94 -0
  347. package/src/lib/plugins/api-key/SettingsApiKeys.tsx +132 -0
  348. package/src/lib/plugins/api-key/index.tsx +160 -0
  349. package/src/lib/plugins/index.ts +4 -0
  350. package/src/{app → lib}/plugins/markdown/MdxPage.tsx +33 -11
  351. package/src/{app → lib}/plugins/markdown/generateRoutes.tsx +1 -16
  352. package/src/{app → lib}/plugins/openapi/ColorizedParam.tsx +1 -3
  353. package/src/lib/plugins/openapi/MakeRequest.tsx +63 -0
  354. package/src/{app → lib}/plugins/openapi/OperationList.tsx +14 -4
  355. package/src/lib/plugins/openapi/OperationListItem.tsx +93 -0
  356. package/src/{app → lib}/plugins/openapi/ParameterList.tsx +4 -4
  357. package/src/{app → lib}/plugins/openapi/ParameterListItem.tsx +5 -2
  358. package/src/{app → lib}/plugins/openapi/RequestBodySidecarBox.tsx +4 -3
  359. package/src/{app → lib}/plugins/openapi/ResponsesSidecarBox.tsx +2 -3
  360. package/src/lib/plugins/openapi/SchemaListView.tsx +228 -0
  361. package/src/{app → lib}/plugins/openapi/Sidecar.tsx +33 -28
  362. package/src/{app/plugins/openapi/Select.tsx → lib/plugins/openapi/SimpleSelect.tsx} +5 -2
  363. package/src/{app → lib}/plugins/openapi/graphql/gql.ts +7 -7
  364. package/src/{app → lib}/plugins/openapi/graphql/graphql.ts +59 -0
  365. package/src/{app → lib}/plugins/openapi/index.tsx +8 -2
  366. package/src/lib/plugins/openapi/playground/Editor.tsx +4 -0
  367. package/src/lib/plugins/openapi/playground/Headers.tsx +87 -0
  368. package/src/lib/plugins/openapi/playground/InlineInput.tsx +6 -0
  369. package/src/lib/plugins/openapi/playground/PathParams.tsx +63 -0
  370. package/src/lib/plugins/openapi/playground/Playground.tsx +361 -0
  371. package/src/lib/plugins/openapi/playground/QueryParams.tsx +89 -0
  372. package/src/lib/plugins/openapi/playground/UrlDisplay.tsx +32 -0
  373. package/src/lib/plugins/openapi/playground/createUrl.ts +22 -0
  374. package/src/{app → lib}/plugins/openapi/util/generateSchemaExample.ts +22 -9
  375. package/src/{app → lib}/plugins/openapi/worker/createSharedWorkerClient.ts +2 -1
  376. package/src/lib/plugins/openapi/worker/shared-worker.ts +5 -0
  377. package/src/lib/plugins/openapi-worker.ts +1 -0
  378. package/src/{app → lib}/plugins/redirect/index.tsx +1 -1
  379. package/src/lib/ui/Button.tsx +25 -0
  380. package/src/{app → lib}/ui/Tabs.tsx +2 -2
  381. package/src/{app/ui/Button.tsx → lib/ui/button-variants.ts} +4 -29
  382. package/src/{app → lib}/util/MdxComponents.tsx +33 -8
  383. package/src/{app → lib}/util/createVariantComponent.tsx +12 -7
  384. package/dist/app/DevPortal.d.ts +0 -25
  385. package/dist/app/DevPortal.js +0 -41
  386. package/dist/app/DevPortal.js.map +0 -1
  387. package/dist/app/Heading.js.map +0 -1
  388. package/dist/app/authentication/authentication.d.ts +0 -13
  389. package/dist/app/authentication/authentication.js.map +0 -1
  390. package/dist/app/authentication/clerk.d.ts +0 -5
  391. package/dist/app/authentication/clerk.js +0 -36
  392. package/dist/app/authentication/clerk.js.map +0 -1
  393. package/dist/app/authentication/openid.d.ts +0 -11
  394. package/dist/app/authentication/openid.js +0 -118
  395. package/dist/app/authentication/openid.js.map +0 -1
  396. package/dist/app/components/Dialog.js.map +0 -1
  397. package/dist/app/components/DynamicIcon.d.ts +0 -6
  398. package/dist/app/components/DynamicIcon.js +0 -6
  399. package/dist/app/components/DynamicIcon.js.map +0 -1
  400. package/dist/app/components/Header.d.ts +0 -1
  401. package/dist/app/components/Header.js +0 -15
  402. package/dist/app/components/Header.js.map +0 -1
  403. package/dist/app/components/Layout.js.map +0 -1
  404. package/dist/app/components/SyntaxHighlight.js.map +0 -1
  405. package/dist/app/components/context/DevPortalProvider.js.map +0 -1
  406. package/dist/app/components/context/PluginSystem.js.map +0 -1
  407. package/dist/app/components/navigation/SideNavigationItem.js.map +0 -1
  408. package/dist/app/components/navigation/SideNavigationWrapper.js +0 -6
  409. package/dist/app/components/navigation/SideNavigationWrapper.js.map +0 -1
  410. package/dist/app/core/DevPortalContext.js +0 -68
  411. package/dist/app/core/DevPortalContext.js.map +0 -1
  412. package/dist/app/core/icons.js.map +0 -1
  413. package/dist/app/core/router.js.map +0 -1
  414. package/dist/app/core/types/combine.d.ts +0 -4
  415. package/dist/app/core/types/combine.js +0 -2
  416. package/dist/app/core/types/combine.js.map +0 -1
  417. package/dist/app/oas/graphql/index.js.map +0 -1
  418. package/dist/app/oas/graphql/server.d.ts +0 -1
  419. package/dist/app/oas/graphql/server.js +0 -8
  420. package/dist/app/oas/graphql/server.js.map +0 -1
  421. package/dist/app/plugins/api-key/SettingsApiKeys.d.ts +0 -4
  422. package/dist/app/plugins/api-key/SettingsApiKeys.js +0 -7
  423. package/dist/app/plugins/api-key/SettingsApiKeys.js.map +0 -1
  424. package/dist/app/plugins/api-key/index.d.ts +0 -32
  425. package/dist/app/plugins/api-key/index.js +0 -55
  426. package/dist/app/plugins/api-key/index.js.map +0 -1
  427. package/dist/app/plugins/markdown/MdxPage.d.ts +0 -3
  428. package/dist/app/plugins/markdown/MdxPage.js +0 -55
  429. package/dist/app/plugins/markdown/MdxPage.js.map +0 -1
  430. package/dist/app/plugins/markdown/generateRoutes.js.map +0 -1
  431. package/dist/app/plugins/openapi/ColorizedParam.js.map +0 -1
  432. package/dist/app/plugins/openapi/MakeRequest.js +0 -23
  433. package/dist/app/plugins/openapi/MakeRequest.js.map +0 -1
  434. package/dist/app/plugins/openapi/OperationList.js.map +0 -1
  435. package/dist/app/plugins/openapi/OperationListItem.js +0 -15
  436. package/dist/app/plugins/openapi/OperationListItem.js.map +0 -1
  437. package/dist/app/plugins/openapi/ParameterList.js +0 -5
  438. package/dist/app/plugins/openapi/ParameterList.js.map +0 -1
  439. package/dist/app/plugins/openapi/ParameterListItem.js +0 -13
  440. package/dist/app/plugins/openapi/RequestBodySidecarBox.js.map +0 -1
  441. package/dist/app/plugins/openapi/Select.js +0 -5
  442. package/dist/app/plugins/openapi/Select.js.map +0 -1
  443. package/dist/app/plugins/openapi/Sidecar.js.map +0 -1
  444. package/dist/app/plugins/openapi/graphql/gql.js.map +0 -1
  445. package/dist/app/plugins/openapi/graphql/graphql.js.map +0 -1
  446. package/dist/app/plugins/openapi/graphql/index.js.map +0 -1
  447. package/dist/app/plugins/openapi/index.js.map +0 -1
  448. package/dist/app/plugins/openapi/playground/Playground.d.ts +0 -8
  449. package/dist/app/plugins/openapi/playground/Playground.js +0 -98
  450. package/dist/app/plugins/openapi/playground/Playground.js.map +0 -1
  451. package/dist/app/plugins/openapi/util/generateSchemaExample.js.map +0 -1
  452. package/dist/app/plugins/openapi/worker/createSharedWorkerClient.js.map +0 -1
  453. package/dist/app/ui/Button.d.ts +0 -11
  454. package/dist/app/ui/Button.js.map +0 -1
  455. package/dist/app/util/MdxComponents.js.map +0 -1
  456. package/dist/app/util/createVariantComponent.d.ts +0 -15
  457. package/dist/app/util/createVariantComponent.js +0 -12
  458. package/dist/app/util/createVariantComponent.js.map +0 -1
  459. package/dist/app/util/slugify.js.map +0 -1
  460. package/dist/auth.d.ts +0 -2
  461. package/dist/auth.js +0 -3
  462. package/dist/auth.js.map +0 -1
  463. package/dist/plugins.d.ts +0 -4
  464. package/dist/plugins.js +0 -6
  465. package/dist/plugins.js.map +0 -1
  466. package/src/app/authentication/authentication.ts +0 -18
  467. package/src/app/authentication/clerk.ts +0 -47
  468. package/src/app/authentication/openid.ts +0 -192
  469. package/src/app/components/DynamicIcon.tsx +0 -60
  470. package/src/app/components/navigation/SideNavigationWrapper.tsx +0 -15
  471. package/src/app/core/types/combine.ts +0 -16
  472. package/src/app/oas/graphql/server.ts +0 -10
  473. package/src/app/plugins/api-key/SettingsApiKeys.tsx +0 -22
  474. package/src/app/plugins/api-key/index.tsx +0 -123
  475. package/src/app/plugins/openapi/MakeRequest.tsx +0 -49
  476. package/src/app/plugins/openapi/OperationListItem.tsx +0 -55
  477. package/src/app/plugins/openapi/playground/Playground.tsx +0 -309
  478. package/src/app/plugins/openapi/queries.graphql +0 -6
  479. package/dist/{app → lib}/authentication/authentication.js +0 -0
  480. package/dist/{app → lib}/components/AnchorLink.d.ts +0 -0
  481. package/dist/{app → lib}/components/AnchorLink.js +0 -0
  482. package/dist/{app → lib}/components/CategoryHeading.d.ts +0 -0
  483. package/dist/{app → lib}/components/CategoryHeading.js +0 -0
  484. package/dist/{app → lib/components}/Heading.d.ts +0 -0
  485. package/dist/{app → lib}/components/Input.d.ts +0 -0
  486. package/dist/{app → lib}/components/Input.js +0 -0
  487. package/dist/{app → lib}/components/Layout.d.ts +0 -0
  488. package/dist/{app → lib}/components/Markdown.d.ts +0 -0
  489. package/dist/{app → lib}/components/Markdown.js +0 -0
  490. package/dist/{app → lib}/components/TopNavigation.d.ts +0 -0
  491. package/dist/{app → lib}/components/TopNavigation.js +0 -0
  492. package/dist/{app → lib}/components/context/ComponentsContext.js +0 -0
  493. package/dist/{app → lib}/components/context/DevPortalProvider.d.ts +0 -0
  494. package/dist/{app → lib}/components/context/PluginSystem.d.ts +0 -0
  495. package/dist/{app → lib}/components/context/PluginSystem.js +0 -0
  496. package/dist/{app → lib}/components/context/ThemeContext.d.ts +0 -0
  497. package/dist/{app → lib}/components/context/ViewportAnchorContext.d.ts +0 -0
  498. package/dist/{app → lib}/components/context/ViewportAnchorContext.js +0 -0
  499. package/dist/{app → lib}/components/navigation/SideNavigation.d.ts +0 -0
  500. package/dist/{app → lib}/components/navigation/SideNavigationCategory.d.ts +0 -0
  501. package/dist/{app → lib}/components/navigation/useNavigationCollapsibleState.d.ts +0 -0
  502. package/dist/{app → lib}/components/navigation/useNavigationCollapsibleState.js +0 -0
  503. package/dist/{app → lib}/components/navigation/util.d.ts +0 -0
  504. package/dist/{app → lib}/components/navigation/util.js +0 -0
  505. package/dist/{app → lib}/core/helmet.d.ts +0 -0
  506. package/dist/{app → lib}/core/helmet.js +0 -0
  507. package/dist/{app → lib}/core/icons.d.ts +0 -0
  508. package/dist/{app → lib}/core/icons.js +0 -0
  509. package/dist/{app → lib}/core/router.d.ts +0 -0
  510. package/dist/{app → lib}/core/router.js +0 -0
  511. package/dist/{app → lib}/oas/graphql/index.d.ts +0 -0
  512. package/dist/{app → lib}/oas/parser/dereference/index.d.ts +0 -0
  513. package/dist/{app → lib}/oas/parser/dereference/index.js +0 -0
  514. package/dist/{app → lib}/oas/parser/dereference/resolveRef.d.ts +0 -0
  515. package/dist/{app → lib}/oas/parser/dereference/resolveRef.js +0 -0
  516. package/dist/{app → lib}/oas/parser/index.d.ts +0 -0
  517. package/dist/{app → lib}/oas/parser/index.js +0 -0
  518. package/dist/{app → lib}/oas/parser/upgrade/index.d.ts +0 -0
  519. package/dist/{app → lib}/oas/parser/upgrade/index.js +0 -0
  520. package/dist/{app → lib}/plugins/markdown/Toc.d.ts +0 -0
  521. package/dist/{app → lib}/plugins/markdown/Toc.js +0 -0
  522. package/dist/{app → lib}/plugins/markdown/generateRoutes.d.ts +0 -0
  523. package/dist/{app → lib}/plugins/markdown/index.d.ts +0 -0
  524. package/dist/{app → lib}/plugins/markdown/index.js +0 -0
  525. package/dist/{app → lib}/plugins/openapi/MakeRequest.d.ts +0 -0
  526. package/dist/{app → lib}/plugins/openapi/MethodBadge.d.ts +0 -0
  527. package/dist/{app → lib}/plugins/openapi/MethodBadge.js +0 -0
  528. package/dist/{app → lib}/plugins/openapi/OperationList.d.ts +0 -0
  529. package/dist/{app → lib}/plugins/openapi/OperationListItem.d.ts +0 -0
  530. package/dist/{app → lib}/plugins/openapi/ParameterListItem.d.ts +0 -0
  531. package/dist/{app → lib}/plugins/openapi/RequestBodySidecarBox.d.ts +0 -0
  532. package/dist/{app → lib}/plugins/openapi/ResponsesSidecarBox.d.ts +0 -0
  533. package/dist/{app → lib}/plugins/openapi/Sidecar.d.ts +0 -0
  534. package/dist/{app → lib}/plugins/openapi/SidecarBox.d.ts +0 -0
  535. package/dist/{app → lib}/plugins/openapi/SidecarBox.js +0 -0
  536. package/dist/{app → lib}/plugins/openapi/graphql/fragment-masking.js +0 -0
  537. package/dist/{app → lib}/plugins/openapi/graphql/index.d.ts +0 -0
  538. package/dist/{app → lib}/plugins/openapi/graphql/index.js +0 -0
  539. package/dist/{app → lib}/plugins/openapi/index.d.ts +0 -0
  540. package/dist/{app → lib}/plugins/openapi/util/urql.d.ts +0 -0
  541. package/dist/{app → lib}/plugins/openapi/util/urql.js +0 -0
  542. package/dist/{app → lib}/plugins/openapi/worker/createSharedWorkerClient.d.ts +0 -0
  543. package/dist/{app → lib}/plugins/openapi/worker/worker.d.ts +0 -0
  544. package/dist/{app → lib}/plugins/openapi/worker/worker.js +0 -0
  545. package/dist/{app → lib}/plugins/redirect/index.js +0 -0
  546. package/dist/{app → lib}/ui/Callout.d.ts +0 -0
  547. package/dist/{app → lib}/ui/Callout.js +0 -0
  548. package/dist/{app → lib}/ui/Card.d.ts +0 -0
  549. package/dist/{app → lib}/ui/Card.js +0 -0
  550. package/dist/{app → lib}/ui/Note.d.ts +0 -0
  551. package/dist/{app → lib}/ui/Note.js +0 -0
  552. package/dist/{app → lib}/util/MdxComponents.d.ts +0 -0
  553. package/dist/{app → lib}/util/cn.d.ts +0 -0
  554. package/dist/{app → lib}/util/cn.js +0 -0
  555. package/dist/{app → lib}/util/createWaitForNotify.d.ts +0 -0
  556. package/dist/{app → lib}/util/createWaitForNotify.js +0 -0
  557. package/dist/{app → lib}/util/groupBy.d.ts +0 -0
  558. package/dist/{app → lib}/util/groupBy.js +0 -0
  559. package/dist/{app → lib}/util/joinPath.d.ts +0 -0
  560. package/dist/{app → lib}/util/joinPath.js +0 -0
  561. package/dist/{app → lib}/util/pastellize.d.ts +0 -0
  562. package/dist/{app → lib}/util/pastellize.js +0 -0
  563. package/dist/{app → lib}/util/slugify.d.ts +0 -0
  564. package/dist/{app → lib}/util/slugify.js +0 -0
  565. package/dist/{app → lib}/util/traverseNavigation.d.ts +0 -0
  566. package/dist/{app → lib}/util/traverseNavigation.js +0 -0
  567. package/dist/{app → lib}/util/useScrollToAnchor.d.ts +0 -0
  568. package/dist/{app → lib}/util/useScrollToAnchor.js +0 -0
  569. package/dist/{app → lib}/util/useScrollToTop.d.ts +0 -0
  570. package/dist/{app → lib}/util/useScrollToTop.js +0 -0
  571. package/src/{app → lib}/components/AnchorLink.tsx +0 -0
  572. package/src/{app → lib}/components/CategoryHeading.tsx +1 -1
  573. package/src/{app → lib}/components/Input.tsx +0 -0
  574. package/src/{app → lib}/components/Markdown.tsx +0 -0
  575. package/src/{app → lib}/components/TopNavigation.tsx +0 -0
  576. package/src/{app → lib}/components/context/ComponentsContext.tsx +0 -0
  577. package/src/{app → lib}/components/context/PluginSystem.ts +0 -0
  578. package/src/{app → lib}/components/context/ThemeContext.tsx +1 -1
  579. package/src/{app → lib}/components/context/ViewportAnchorContext.tsx +0 -0
  580. package/src/{app → lib}/components/navigation/useNavigationCollapsibleState.ts +0 -0
  581. package/src/{app → lib}/components/navigation/util.ts +0 -0
  582. package/src/{app → lib}/core/helmet.ts +0 -0
  583. package/src/{app → lib}/core/icons.tsx +0 -0
  584. package/src/{app → lib}/core/router.tsx +0 -0
  585. package/src/{app → lib}/oas/parser/dereference/index.ts +0 -0
  586. package/src/{app → lib}/oas/parser/dereference/resolveRef.ts +0 -0
  587. package/src/{app → lib}/oas/parser/index.ts +0 -0
  588. package/src/{app → lib}/oas/parser/schemas/v3.0.json +0 -0
  589. package/src/{app → lib}/oas/parser/schemas/v3.1.json +0 -0
  590. package/src/{app → lib}/oas/parser/upgrade/index.ts +0 -0
  591. package/src/{app → lib}/plugins/markdown/Toc.tsx +0 -0
  592. package/src/{app → lib}/plugins/markdown/index.tsx +0 -0
  593. package/src/{app → lib}/plugins/openapi/MethodBadge.tsx +0 -0
  594. package/src/{app → lib}/plugins/openapi/SidecarBox.tsx +0 -0
  595. package/src/{app → lib}/plugins/openapi/graphql/fragment-masking.ts +1 -1
  596. /package/src/{app → lib}/plugins/openapi/graphql/index.ts +0 -0
  597. /package/src/{app → lib}/plugins/openapi/util/urql.ts +0 -0
  598. /package/src/{app → lib}/plugins/openapi/worker/worker.ts +0 -0
  599. /package/src/{app → lib}/ui/Callout.tsx +0 -0
  600. /package/src/{app → lib}/ui/Card.tsx +0 -0
  601. /package/src/{app → lib}/ui/Note.tsx +0 -0
  602. /package/src/{app → lib}/util/cn.ts +0 -0
  603. /package/src/{app → lib}/util/createWaitForNotify.ts +0 -0
  604. /package/src/{app → lib}/util/groupBy.ts +0 -0
  605. /package/src/{app → lib}/util/joinPath.tsx +0 -0
  606. /package/src/{app → lib}/util/pastellize.ts +0 -0
  607. /package/src/{app → lib}/util/slugify.ts +0 -0
  608. /package/src/{app → lib}/util/traverseNavigation.ts +0 -0
  609. /package/src/{app → lib}/util/useScrollToAnchor.ts +0 -0
  610. /package/src/{app → lib}/util/useScrollToTop.ts +0 -0
@@ -0,0 +1,314 @@
1
+ import logger from "loglevel";
2
+ import * as oauth from "oauth4webapi";
3
+ import { OpenIDAuthenticationConfig } from "../../../config/config.js";
4
+ import { RouteObject } from "../../core/router.js";
5
+ import {
6
+ AuthenticationProvider,
7
+ AuthenticationProviderInitializer,
8
+ } from "../authentication.js";
9
+ import { Callback } from "../Callback.js";
10
+ import { AuthorizationError, OAuthAuthorizationError } from "../errors.js";
11
+ import { useAuthState, UserProfile } from "../state.js";
12
+
13
+ const CODE_VERIFIER_KEY = "code-verifier";
14
+
15
+ interface TokenState {
16
+ accessToken: string;
17
+ refreshToken?: string;
18
+ expiresOn: Date;
19
+ tokenType: string;
20
+ }
21
+
22
+ export class OpenIDAuthenticationProvider implements AuthenticationProvider {
23
+ protected client: oauth.Client;
24
+ protected issuer: string;
25
+ protected authorizationEndpoint: string | undefined;
26
+ protected tokenEndpoint: string | undefined;
27
+
28
+ protected authorizationServer: oauth.AuthorizationServer | undefined;
29
+ protected tokens: TokenState | undefined;
30
+
31
+ protected callbackUrlPath = "/oauth/callback";
32
+ protected logoutRedirectUrlPath = "/";
33
+
34
+ constructor({
35
+ issuer,
36
+ authorizationEndpoint,
37
+ tokenEndpoint,
38
+ clientId,
39
+ }: OpenIDAuthenticationConfig) {
40
+ this.client = {
41
+ client_id: clientId,
42
+ token_endpoint_auth_method: "none",
43
+ };
44
+ this.issuer = issuer;
45
+ this.authorizationEndpoint = authorizationEndpoint;
46
+ this.tokenEndpoint = tokenEndpoint;
47
+ }
48
+
49
+ protected async getAuthServer() {
50
+ if (!this.authorizationServer) {
51
+ if (this.tokenEndpoint && this.authorizationEndpoint) {
52
+ this.authorizationServer = {
53
+ issuer: new URL(this.authorizationEndpoint!).origin,
54
+ authorization_endpoint: this.authorizationEndpoint,
55
+ token_endpoint: this.tokenEndpoint,
56
+ code_challenge_methods_supported: [],
57
+ };
58
+ } else {
59
+ const issuerUrl = new URL(this.issuer);
60
+ const response = await oauth.discoveryRequest(issuerUrl);
61
+ this.authorizationServer = await oauth.processDiscoveryResponse(
62
+ issuerUrl,
63
+ response,
64
+ );
65
+ }
66
+ }
67
+ return this.authorizationServer;
68
+ }
69
+
70
+ /**
71
+ * Sets the tokens from various OAuth responses
72
+ * @param response
73
+ */
74
+ protected setTokensFromResponse(
75
+ response: oauth.TokenEndpointResponse | oauth.OAuth2Error,
76
+ ) {
77
+ if (oauth.isOAuth2Error(response)) {
78
+ logger.error("Bad Token Response", response);
79
+ throw new OAuthAuthorizationError("Bad Token Response", response);
80
+ }
81
+
82
+ if (!response.expires_in) {
83
+ throw new AuthorizationError("No expires_in in response");
84
+ }
85
+
86
+ this.tokens = {
87
+ accessToken: response.access_token,
88
+ refreshToken: response.refresh_token,
89
+ expiresOn: new Date(Date.now() + response.expires_in * 1000),
90
+ tokenType: response.token_type,
91
+ };
92
+ }
93
+
94
+ async initialize() {
95
+ // No init needed
96
+ }
97
+
98
+ async login(): Promise<void> {
99
+ const code_challenge_method = "S256";
100
+ const authorizationServer = await this.getAuthServer();
101
+
102
+ if (!authorizationServer.authorization_endpoint) {
103
+ throw new AuthorizationError("No authorization endpoint");
104
+ }
105
+
106
+ /**
107
+ * The following MUST be generated for every redirect to the authorization_endpoint. You must store
108
+ * the codeVerifier and nonce in the end-user session such that it can be recovered as the user
109
+ * gets redirected from the authorization server back to your application.
110
+ */
111
+ const codeVerifier = oauth.generateRandomCodeVerifier();
112
+ const codeChallenge = await oauth.calculatePKCECodeChallenge(codeVerifier);
113
+
114
+ localStorage.setItem(CODE_VERIFIER_KEY, codeVerifier);
115
+
116
+ // redirect user to as.authorization_endpoint
117
+ const authorizationUrl = new URL(
118
+ authorizationServer.authorization_endpoint,
119
+ );
120
+
121
+ const redirectUrl = new URL(window.location.href);
122
+ redirectUrl.pathname = this.callbackUrlPath;
123
+ redirectUrl.search = "";
124
+
125
+ authorizationUrl.searchParams.set("client_id", this.client.client_id);
126
+ authorizationUrl.searchParams.set("redirect_uri", redirectUrl.toString());
127
+ authorizationUrl.searchParams.set("response_type", "code");
128
+ authorizationUrl.searchParams.set("scope", "openid+profile+email");
129
+ authorizationUrl.searchParams.set("code_challenge", codeChallenge);
130
+ authorizationUrl.searchParams.set(
131
+ "code_challenge_method",
132
+ code_challenge_method,
133
+ );
134
+
135
+ /**
136
+ * We cannot be sure the AS supports PKCE so we're going to use state too. Use of PKCE is
137
+ * backwards compatible even if the AS doesn't support it which is why we're using it regardless.
138
+ */
139
+ if (
140
+ authorizationServer.code_challenge_methods_supported?.includes("S256") !==
141
+ true
142
+ ) {
143
+ const state = oauth.generateRandomState();
144
+ authorizationUrl.searchParams.set("state", state);
145
+ }
146
+
147
+ // now redirect the user to authorizationUrl.href
148
+ location.href = authorizationUrl.href;
149
+ }
150
+ async getAccessToken(): Promise<string> {
151
+ const as = await this.getAuthServer();
152
+ if (!this.tokens) {
153
+ throw new AuthorizationError("User is not authenticated");
154
+ }
155
+ if (this.tokens.expiresOn < new Date()) {
156
+ if (!this.tokens.refreshToken) {
157
+ // TODO: Log user bac in
158
+ throw new AuthorizationError(
159
+ "Token expired and no refresh token available",
160
+ );
161
+ }
162
+
163
+ const request = await oauth.refreshTokenGrantRequest(
164
+ as,
165
+ this.client,
166
+ this.tokens.refreshToken,
167
+ );
168
+ const response = await oauth.processRefreshTokenResponse(
169
+ as,
170
+ this.client,
171
+ request,
172
+ );
173
+
174
+ this.setTokensFromResponse(response);
175
+ }
176
+
177
+ return this.tokens.accessToken;
178
+ }
179
+
180
+ async logout(): Promise<void> {
181
+ useAuthState.setState({
182
+ isAuthenticated: false,
183
+ isPending: false,
184
+ profile: undefined,
185
+ });
186
+
187
+ const as = await this.getAuthServer();
188
+
189
+ const redirectUrl = new URL(window.location.href);
190
+ redirectUrl.pathname = this.logoutRedirectUrlPath;
191
+
192
+ let logoutUrl: URL;
193
+ // The endSessionEndpoint is set, the IdP supports some form of logout,
194
+ // so we use the IdP logout. Otherwise, just redirect the user to home
195
+ if (as.end_session_endpoint) {
196
+ logoutUrl = new URL(as.end_session_endpoint);
197
+ // TODO: get id_token and set hint
198
+ // const { id_token } = session;
199
+ // if (id_token) {
200
+ // logoutUrl.searchParams.set("id_token_hint", id_token);
201
+ // }
202
+ logoutUrl.searchParams.set(
203
+ "post_logout_redirect_uri",
204
+ redirectUrl.toString(),
205
+ );
206
+ } else {
207
+ logoutUrl = redirectUrl;
208
+ }
209
+ }
210
+ getRoutes(): RouteObject[] {
211
+ return [
212
+ {
213
+ path: this.callbackUrlPath,
214
+ element: <Callback handleCallback={this.handleCallback} />,
215
+ },
216
+ ];
217
+ }
218
+
219
+ handleCallback = async (): Promise<void> => {
220
+ const url = new URL(window.location.href);
221
+ const state = url.searchParams.get("state");
222
+
223
+ // one eternity later, the user lands back on the redirect_uri
224
+ // Authorization Code Grant Request & Response
225
+ const codeVerifier = localStorage.getItem(CODE_VERIFIER_KEY);
226
+ // localStorage.removeItem(CODE_VERIFIER_KEY);
227
+
228
+ if (!codeVerifier) {
229
+ throw new AuthorizationError(
230
+ "Code verifier not found. Invalid auth state.",
231
+ );
232
+ }
233
+
234
+ const authServer = await this.getAuthServer();
235
+
236
+ const params = oauth.validateAuthResponse(
237
+ authServer,
238
+ this.client,
239
+ url.searchParams,
240
+ state ?? undefined,
241
+ );
242
+ if (oauth.isOAuth2Error(params)) {
243
+ logger.error("Error validating OAuth response", params);
244
+ throw new OAuthAuthorizationError(
245
+ "Error validating OAuth response",
246
+ params,
247
+ );
248
+ }
249
+
250
+ const redirectUrl = new URL(url);
251
+ redirectUrl.pathname = this.callbackUrlPath;
252
+ redirectUrl.search = "";
253
+
254
+ const response = await oauth.authorizationCodeGrantRequest(
255
+ authServer,
256
+ this.client,
257
+ params,
258
+ redirectUrl.toString(),
259
+ codeVerifier,
260
+ );
261
+
262
+ // TODO: do we need to do these
263
+ // const challenges = oauth.parseWwwAuthenticateChallenges(response);
264
+ // if (challenges) {
265
+ // for (const challenge of challenges) {
266
+ // console.error("WWW-Authenticate Challenge", challenge);
267
+ // }
268
+ // throw new Error(); // Handle WWW-Authenticate Challenges as needed
269
+ // }
270
+ const oauthResult = await oauth.processAuthorizationCodeOAuth2Response(
271
+ authServer,
272
+ this.client,
273
+ response,
274
+ );
275
+
276
+ this.setTokensFromResponse(oauthResult);
277
+
278
+ const accessToken = await this.getAccessToken();
279
+
280
+ const userInfoResponse = await oauth.userInfoRequest(
281
+ authServer,
282
+ this.client,
283
+ accessToken,
284
+ );
285
+ const userInfo = await userInfoResponse.json();
286
+
287
+ const profile: UserProfile = {
288
+ sub: userInfo.sub,
289
+ email: userInfo.email,
290
+ name: userInfo.name,
291
+ emailVerified: userInfo.email_verified ?? false,
292
+ pictureUrl: userInfo.picture,
293
+ };
294
+
295
+ useAuthState.setState({
296
+ isAuthenticated: true,
297
+ isPending: false,
298
+ profile,
299
+ });
300
+
301
+ // // Remove the query strings so react query doesn't keep retrying
302
+ // // to make the token request
303
+ // history.replaceState({}, "", window.location.pathname);
304
+
305
+ // Returning true because we are using react query
306
+ // return true;
307
+ };
308
+ }
309
+
310
+ const openIDAuth: AuthenticationProviderInitializer<
311
+ OpenIDAuthenticationConfig
312
+ > = (options) => new OpenIDAuthenticationProvider(options);
313
+
314
+ export default openIDAuth;
@@ -0,0 +1,21 @@
1
+ import { create } from "zustand";
2
+
3
+ export const useAuthState = create<AuthState>(() => ({
4
+ isPending: true,
5
+ isAuthenticated: false,
6
+ }));
7
+
8
+ export interface AuthState {
9
+ isAuthenticated: boolean;
10
+ isPending: boolean;
11
+ profile?: UserProfile;
12
+ }
13
+
14
+ export interface UserProfile {
15
+ sub: string;
16
+ email: string | undefined;
17
+ emailVerified: boolean;
18
+ name: string | undefined;
19
+ pictureUrl: string | undefined;
20
+ [key: string]: string | boolean | undefined;
21
+ }
@@ -1,25 +1,28 @@
1
1
  import { MDXProvider } from "@mdx-js/react";
2
2
  import { QueryClientProvider } from "@tanstack/react-query";
3
3
  import { memo, Suspense, useEffect, useMemo } from "react";
4
- import { createBrowserRouter, RouterProvider } from "react-router-dom";
5
- import { type AuthProvider } from "./authentication/authentication.js";
6
- import {
7
- ComponentsProvider,
8
- DEFAULT_COMPONENTS,
9
- type ComponentsContextType,
10
- } from "./components/context/ComponentsContext.js";
11
- import { DevPortalProvider } from "./components/context/DevPortalProvider.js";
12
- import { ThemeProvider } from "./components/context/ThemeContext.js";
13
- import { ViewportAnchorProvider } from "./components/context/ViewportAnchorContext.js";
14
- import { Layout } from "./components/Layout.js";
15
4
  import {
16
5
  DevPortalContext,
17
6
  queryClient,
18
7
  type NavigationItem,
19
- } from "./core/DevPortalContext.js";
20
- import { HelmetProvider } from "./core/helmet.js";
21
- import { isNavigationPlugin, type DevPortalPlugin } from "./core/plugins.js";
22
- import { MdxComponents, type MdxComponentsType } from "./util/MdxComponents.js";
8
+ } from "../core/DevPortalContext.js";
9
+ import { HelmetProvider } from "../core/helmet.js";
10
+ import { type DevPortalPlugin } from "../core/plugins.js";
11
+
12
+ import { AuthenticationProvider } from "../authentication/authentication.js";
13
+ import {
14
+ MdxComponents,
15
+ type MdxComponentsType,
16
+ } from "../util/MdxComponents.js";
17
+ import {
18
+ ComponentsProvider,
19
+ DEFAULT_COMPONENTS,
20
+ type ComponentsContextType,
21
+ } from "./context/ComponentsContext.js";
22
+ import { DevPortalProvider } from "./context/DevPortalProvider.js";
23
+ import { ThemeProvider } from "./context/ThemeContext.js";
24
+ import { ViewportAnchorProvider } from "./context/ViewportAnchorContext.js";
25
+ import { Router } from "./Router.js";
23
26
 
24
27
  export const DevPortalSystemPaths = {
25
28
  Settings: "/settings",
@@ -37,35 +40,14 @@ export type DevPortalProps = {
37
40
  logo: string;
38
41
  favicon: string;
39
42
  }>;
40
- authentication?: AuthProvider;
43
+ authentication?: AuthenticationProvider;
41
44
  navigation: NavigationItem[];
42
45
  plugins?: DevPortalPlugin[];
43
46
  mdxComponents?: MdxComponentsType;
44
47
  overrides?: ComponentsContextType;
45
48
  };
46
49
 
47
- const DevPortal = (props: DevPortalProps) => {
48
- const router = useMemo(() => {
49
- const routes = (props.plugins ?? []).flatMap((plugin) =>
50
- isNavigationPlugin(plugin) ? plugin.getRoutes() : [],
51
- );
52
-
53
- return createBrowserRouter([
54
- {
55
- path: "/",
56
- element: <Layout />,
57
- errorElement: (
58
- <Layout>
59
- <div className="h-[75vh] flex items-center justify-center">
60
- Error, look at the console
61
- </div>
62
- </Layout>
63
- ),
64
- children: routes,
65
- },
66
- ]);
67
- }, [props.plugins]);
68
-
50
+ const DevPortalInner = (props: DevPortalProps) => {
69
51
  const components = useMemo(
70
52
  () => ({ ...DEFAULT_COMPONENTS, ...props.overrides }),
71
53
  [props.overrides],
@@ -97,7 +79,12 @@ const DevPortal = (props: DevPortalProps) => {
97
79
  </div>
98
80
  }
99
81
  >
100
- <RouterProvider router={router} />
82
+ <Router
83
+ plugins={[
84
+ ...(props.plugins ?? []),
85
+ ...(props.authentication ? [props.authentication] : []),
86
+ ]}
87
+ />
101
88
  </Suspense>
102
89
  </ViewportAnchorProvider>
103
90
  </ComponentsProvider>
@@ -109,7 +96,7 @@ const DevPortal = (props: DevPortalProps) => {
109
96
  );
110
97
  };
111
98
 
112
- const MemoDevPortal = memo(DevPortal);
113
- MemoDevPortal.displayName = "DevPortal";
99
+ const DevPortal = memo(DevPortalInner);
100
+ DevPortal.displayName = "DevPortal";
114
101
 
115
- export default MemoDevPortal;
102
+ export { DevPortal };
@@ -1,15 +1,15 @@
1
- import * as React from "react"
2
- import * as DialogPrimitive from "@radix-ui/react-dialog"
3
- import { XIcon } from "lucide-react"
1
+ import * as DialogPrimitive from "@radix-ui/react-dialog";
2
+ import { XIcon } from "lucide-react";
3
+ import * as React from "react";
4
4
  import { cn } from "../util/cn.js";
5
5
 
6
- const Dialog = DialogPrimitive.Root
6
+ const Dialog = DialogPrimitive.Root;
7
7
 
8
- const DialogTrigger = DialogPrimitive.Trigger
8
+ const DialogTrigger = DialogPrimitive.Trigger;
9
9
 
10
- const DialogPortal = DialogPrimitive.Portal
10
+ const DialogPortal = DialogPrimitive.Portal;
11
11
 
12
- const DialogClose = DialogPrimitive.Close
12
+ const DialogClose = DialogPrimitive.Close;
13
13
 
14
14
  const DialogOverlay = React.forwardRef<
15
15
  React.ElementRef<typeof DialogPrimitive.Overlay>,
@@ -19,12 +19,12 @@ const DialogOverlay = React.forwardRef<
19
19
  ref={ref}
20
20
  className={cn(
21
21
  "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
22
- className
22
+ className,
23
23
  )}
24
24
  {...props}
25
25
  />
26
- ))
27
- DialogOverlay.displayName = DialogPrimitive.Overlay.displayName
26
+ ));
27
+ DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
28
28
 
29
29
  const DialogContent = React.forwardRef<
30
30
  React.ElementRef<typeof DialogPrimitive.Content>,
@@ -35,8 +35,8 @@ const DialogContent = React.forwardRef<
35
35
  <DialogPrimitive.Content
36
36
  ref={ref}
37
37
  className={cn(
38
- "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
39
- className
38
+ "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg border-border",
39
+ className,
40
40
  )}
41
41
  {...props}
42
42
  >
@@ -47,36 +47,36 @@ const DialogContent = React.forwardRef<
47
47
  </DialogPrimitive.Close>
48
48
  </DialogPrimitive.Content>
49
49
  </DialogPortal>
50
- ))
51
- DialogContent.displayName = DialogPrimitive.Content.displayName
50
+ ));
51
+ DialogContent.displayName = DialogPrimitive.Content.displayName;
52
52
 
53
53
  const DialogHeader = ({
54
- className,
55
- ...props
56
- }: React.HTMLAttributes<HTMLDivElement>) => (
54
+ className,
55
+ ...props
56
+ }: React.HTMLAttributes<HTMLDivElement>) => (
57
57
  <div
58
58
  className={cn(
59
59
  "flex flex-col space-y-1.5 text-center sm:text-left",
60
- className
60
+ className,
61
61
  )}
62
62
  {...props}
63
63
  />
64
- )
65
- DialogHeader.displayName = "DialogHeader"
64
+ );
65
+ DialogHeader.displayName = "DialogHeader";
66
66
 
67
67
  const DialogFooter = ({
68
- className,
69
- ...props
70
- }: React.HTMLAttributes<HTMLDivElement>) => (
68
+ className,
69
+ ...props
70
+ }: React.HTMLAttributes<HTMLDivElement>) => (
71
71
  <div
72
72
  className={cn(
73
73
  "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
74
- className
74
+ className,
75
75
  )}
76
76
  {...props}
77
77
  />
78
- )
79
- DialogFooter.displayName = "DialogFooter"
78
+ );
79
+ DialogFooter.displayName = "DialogFooter";
80
80
 
81
81
  const DialogTitle = React.forwardRef<
82
82
  React.ElementRef<typeof DialogPrimitive.Title>,
@@ -86,12 +86,12 @@ const DialogTitle = React.forwardRef<
86
86
  ref={ref}
87
87
  className={cn(
88
88
  "text-lg font-semibold leading-none tracking-tight",
89
- className
89
+ className,
90
90
  )}
91
91
  {...props}
92
92
  />
93
- ))
94
- DialogTitle.displayName = DialogPrimitive.Title.displayName
93
+ ));
94
+ DialogTitle.displayName = DialogPrimitive.Title.displayName;
95
95
 
96
96
  const DialogDescription = React.forwardRef<
97
97
  React.ElementRef<typeof DialogPrimitive.Description>,
@@ -102,18 +102,18 @@ const DialogDescription = React.forwardRef<
102
102
  className={cn("text-sm text-muted-foreground", className)}
103
103
  {...props}
104
104
  />
105
- ))
106
- DialogDescription.displayName = DialogPrimitive.Description.displayName
105
+ ));
106
+ DialogDescription.displayName = DialogPrimitive.Description.displayName;
107
107
 
108
108
  export {
109
109
  Dialog,
110
- DialogPortal,
111
- DialogOverlay,
112
- DialogTrigger,
113
110
  DialogClose,
114
111
  DialogContent,
115
- DialogHeader,
112
+ DialogDescription,
116
113
  DialogFooter,
114
+ DialogHeader,
115
+ DialogOverlay,
116
+ DialogPortal,
117
117
  DialogTitle,
118
- DialogDescription,
119
- }
118
+ DialogTrigger,
119
+ };
@@ -1,14 +1,15 @@
1
- import { MoonStarIcon, SearchIcon, SunIcon } from "lucide-react";
1
+ import { MoonStarIcon, SunIcon } from "lucide-react";
2
2
  import { memo } from "react";
3
- import { useDevPortalState } from "../core/DevPortalContext.js";
3
+
4
+ import { useAuth } from "../authentication/hook.js";
4
5
  import { TopNavigation } from "./TopNavigation.js";
5
6
  import { useDevPortal } from "./context/DevPortalProvider.js";
6
7
  import { useTheme } from "./context/ThemeContext.js";
7
8
 
8
- export const Header = memo(() => {
9
+ export const Header = memo(function HeaderInner() {
9
10
  const [isDark, toggleTheme] = useTheme();
10
- const { isLoggedIn, email } = useDevPortalState();
11
- const { login, logout, meta } = useDevPortal();
11
+ const { isAuthenticated, profile, isAuthEnabled, login, logout } = useAuth();
12
+ const { meta } = useDevPortal();
12
13
 
13
14
  const ThemeIcon = isDark ? MoonStarIcon : SunIcon;
14
15
 
@@ -25,8 +26,8 @@ export const Header = memo(() => {
25
26
  </span>
26
27
  </div>
27
28
  <div className="grid grid-cols-[--sidecar-grid-cols] items-center gap-8">
28
- <div className="w-full max-w-prose mx-auto">
29
- <button className="flex items-center border border-input hover:bg-accent hover:text-accent-foreground p-4 relative h-8 justify-start rounded-lg bg-background text-sm text-muted-foreground shadow-none w-40 sm:w-72">
29
+ <div className="w-full max-w-prose">
30
+ {/*<button className="flex items-center border border-input hover:bg-accent hover:text-accent-foreground p-4 relative h-8 justify-start rounded-lg bg-background text-sm text-muted-foreground shadow-none w-40 sm:w-72">
30
31
  <div className="flex items-center gap-2 flex-grow">
31
32
  <SearchIcon size={14} />
32
33
  Search
@@ -34,25 +35,29 @@ export const Header = memo(() => {
34
35
  <kbd className="absolute right-[0.3rem] top-[0.3rem] hidden h-5 select-none items-center gap-1 rounded border border-border bg-muted px-1.5 font-mono text-[11px] font-medium opacity-100 sm:flex">
35
36
  ⌘K
36
37
  </kbd>
37
- </button>
38
+ </button>*/}
38
39
  </div>
40
+
39
41
  <div className="items-center justify-self-end text-sm hidden lg:flex">
40
- {!isLoggedIn ? (
41
- <button
42
- className="cursor-pointer hover:bg-secondary p-1 px-2 mx-2 rounded"
43
- onClick={logout}
44
- >
45
- Logout {email ? `(${email})` : null}
46
- </button>
47
- ) : (
48
- <button
49
- className="cursor-pointer hover:bg-secondary p-1 px-2 mx-2 rounded"
50
- onClick={login}
51
- >
52
- Login
53
- </button>
42
+ {isAuthEnabled && (
43
+ <>
44
+ {isAuthenticated ? (
45
+ <button
46
+ className="cursor-pointer hover:bg-secondary p-1 px-2 mx-2 rounded text-nowrap"
47
+ onClick={logout}
48
+ >
49
+ Logout {profile?.email ? `(${profile.email})` : null}
50
+ </button>
51
+ ) : (
52
+ <button
53
+ className="cursor-pointer hover:bg-secondary p-1 px-2 mx-2 rounded"
54
+ onClick={login}
55
+ >
56
+ Login
57
+ </button>
58
+ )}
59
+ </>
54
60
  )}
55
-
56
61
  <button
57
62
  className="cursor-pointer hover:bg-secondary p-2.5 -m-2.5 rounded-full"
58
63
  onClick={toggleTheme}
@@ -1,6 +1,6 @@
1
1
  import { type ReactNode } from "react";
2
- import { useRegisterAnchorElement } from "./components/context/ViewportAnchorContext.js";
3
- import { cn } from "./util/cn.js";
2
+ import { cn } from "../util/cn.js";
3
+ import { useRegisterAnchorElement } from "./context/ViewportAnchorContext.js";
4
4
 
5
5
  const getComponent = (level: number) => {
6
6
  switch (level) {