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.
- package/dist/app/App.d.ts +1 -2
- package/dist/app/App.js +1 -29
- package/dist/app/App.js.map +1 -1
- package/dist/app/demo.d.ts +2 -0
- package/dist/app/demo.js +32 -0
- package/dist/app/demo.js.map +1 -0
- package/dist/app/entry.client.d.ts +2 -0
- package/dist/app/entry.client.js +35 -0
- package/dist/app/entry.client.js.map +1 -0
- package/dist/app/entry.server.d.ts +14 -0
- package/dist/app/entry.server.js +105 -0
- package/dist/app/entry.server.js.map +1 -0
- package/dist/app/main.d.ts +6 -1
- package/dist/app/main.js +67 -12
- package/dist/app/main.js.map +1 -1
- package/dist/app/standalone.d.ts +2 -0
- package/dist/app/standalone.js +37 -0
- package/dist/app/standalone.js.map +1 -0
- package/dist/app/tailwind.d.ts +1 -1
- package/dist/app/tailwind.js +0 -4
- package/dist/app/tailwind.js.map +1 -1
- package/dist/cli/cmds/dev.js +5 -0
- package/dist/cli/cmds/dev.js.map +1 -1
- package/dist/cli/dev/handler.d.ts +1 -0
- package/dist/cli/dev/handler.js +3 -1
- package/dist/cli/dev/handler.js.map +1 -1
- package/dist/config/config.d.ts +11 -39
- package/dist/config/validators/validate.d.ts +908 -2
- package/dist/config/validators/validate.js +150 -1
- package/dist/config/validators/validate.js.map +1 -1
- package/dist/internal.d.ts +1 -0
- package/dist/internal.js +2 -0
- package/dist/internal.js.map +1 -0
- package/dist/lib/authentication/AuthenticationPlugin.d.ts +13 -0
- package/dist/lib/authentication/AuthenticationPlugin.js +31 -0
- package/dist/lib/authentication/AuthenticationPlugin.js.map +1 -0
- package/dist/lib/authentication/Callback.js +1 -1
- package/dist/lib/authentication/Callback.js.map +1 -1
- package/dist/lib/authentication/authentication.d.ts +6 -9
- package/dist/lib/authentication/components/SignIn.d.ts +1 -0
- package/dist/lib/authentication/components/SignIn.js +10 -0
- package/dist/lib/authentication/components/SignIn.js.map +1 -0
- package/dist/lib/authentication/components/SignOut.d.ts +1 -0
- package/dist/lib/authentication/components/SignOut.js +10 -0
- package/dist/lib/authentication/components/SignOut.js.map +1 -0
- package/dist/lib/authentication/components/SignUp.d.ts +1 -0
- package/dist/lib/authentication/components/SignUp.js +10 -0
- package/dist/lib/authentication/components/SignUp.js.map +1 -0
- package/dist/lib/authentication/hook.js +2 -2
- package/dist/lib/authentication/hook.js.map +1 -1
- package/dist/lib/authentication/providers/auth0.js +2 -2
- package/dist/lib/authentication/providers/auth0.js.map +1 -1
- package/dist/lib/authentication/providers/clerk.js +59 -30
- package/dist/lib/authentication/providers/clerk.js.map +1 -1
- package/dist/lib/authentication/providers/openid.d.ts +19 -6
- package/dist/lib/authentication/providers/openid.js +45 -16
- package/dist/lib/authentication/providers/openid.js.map +1 -1
- package/dist/lib/components/Bootstrap.d.ts +13 -0
- package/dist/lib/components/Bootstrap.js +12 -0
- package/dist/lib/components/Bootstrap.js.map +1 -0
- package/dist/lib/components/DevPortal.d.ts +4 -19
- package/dist/lib/components/DevPortal.js +30 -12
- package/dist/lib/components/DevPortal.js.map +1 -1
- package/dist/lib/components/DeveloperHint.d.ts +5 -0
- package/dist/lib/components/DeveloperHint.js +10 -0
- package/dist/lib/components/DeveloperHint.js.map +1 -0
- package/dist/lib/components/ErrorPage.d.ts +6 -0
- package/dist/lib/components/ErrorPage.js +9 -0
- package/dist/lib/components/ErrorPage.js.map +1 -0
- package/dist/lib/components/Header.js +17 -3
- package/dist/lib/components/Header.js.map +1 -1
- package/dist/lib/components/Heading.d.ts +9 -4
- package/dist/lib/components/Heading.js +17 -2
- package/dist/lib/components/Heading.js.map +1 -1
- package/dist/lib/components/InlineCode.d.ts +5 -0
- package/dist/lib/components/InlineCode.js +4 -0
- package/dist/lib/components/InlineCode.js.map +1 -0
- package/dist/lib/components/Layout.js +3 -2
- package/dist/lib/components/Layout.js.map +1 -1
- package/dist/lib/components/NotFoundPage.d.ts +1 -0
- package/dist/lib/components/NotFoundPage.js +12 -0
- package/dist/lib/components/NotFoundPage.js.map +1 -0
- package/dist/lib/components/SyntaxHighlight.d.ts +3 -2
- package/dist/lib/components/SyntaxHighlight.js +20 -18
- package/dist/lib/components/SyntaxHighlight.js.map +1 -1
- package/dist/lib/components/TopNavigation.d.ts +1 -1
- package/dist/lib/components/TopNavigation.js +5 -1
- package/dist/lib/components/TopNavigation.js.map +1 -1
- package/dist/lib/components/context/DevPortalProvider.d.ts +1 -1
- package/dist/lib/components/context/DevPortalProvider.js +20 -3
- package/dist/lib/components/context/DevPortalProvider.js.map +1 -1
- package/dist/lib/components/index.d.ts +32 -3
- package/dist/lib/components/index.js +21 -3
- package/dist/lib/components/index.js.map +1 -1
- package/dist/lib/components/navigation/SideNavigationCategory.js +2 -2
- package/dist/lib/components/navigation/SideNavigationCategory.js.map +1 -1
- package/dist/lib/components/navigation/SideNavigationItem.js +1 -1
- package/dist/lib/components/navigation/SideNavigationItem.js.map +1 -1
- package/dist/lib/core/DevPortalContext.d.ts +46 -12
- package/dist/lib/core/DevPortalContext.js +7 -9
- package/dist/lib/core/DevPortalContext.js.map +1 -1
- package/dist/lib/core/plugins.d.ts +16 -4
- package/dist/lib/core/plugins.js +2 -0
- package/dist/lib/core/plugins.js.map +1 -1
- package/dist/lib/errors/ErrorAlert.d.ts +3 -0
- package/dist/lib/errors/ErrorAlert.js +8 -0
- package/dist/lib/errors/ErrorAlert.js.map +1 -0
- package/dist/lib/errors/RouterError.d.ts +1 -0
- package/dist/lib/errors/RouterError.js +12 -0
- package/dist/lib/errors/RouterError.js.map +1 -0
- package/dist/lib/errors/ServerError.d.ts +3 -0
- package/dist/lib/errors/ServerError.js +6 -0
- package/dist/lib/errors/ServerError.js.map +1 -0
- package/dist/lib/errors/TopLevelError.d.ts +2 -0
- package/dist/lib/errors/TopLevelError.js +7 -0
- package/dist/lib/errors/TopLevelError.js.map +1 -0
- package/dist/lib/oas/graphql/index.js +6 -4
- package/dist/lib/oas/graphql/index.js.map +1 -1
- package/dist/lib/oas/parser/index.d.ts +1 -1
- package/dist/lib/oas/parser/index.js +38 -12
- package/dist/lib/oas/parser/index.js.map +1 -1
- package/dist/lib/plugins/{api-key → api-keys}/CreateApiKey.js +1 -1
- package/dist/lib/plugins/api-keys/CreateApiKey.js.map +1 -0
- package/dist/lib/plugins/api-keys/ProtectedRoute.d.ts +1 -0
- package/dist/lib/plugins/api-keys/ProtectedRoute.js +14 -0
- package/dist/lib/plugins/api-keys/ProtectedRoute.js.map +1 -0
- package/dist/lib/plugins/api-keys/SettingsApiKeys.js +39 -0
- package/dist/lib/plugins/api-keys/SettingsApiKeys.js.map +1 -0
- package/dist/lib/plugins/{api-key → api-keys}/index.d.ts +4 -5
- package/dist/lib/plugins/{api-key → api-keys}/index.js +11 -19
- package/dist/lib/plugins/api-keys/index.js.map +1 -0
- package/dist/lib/plugins/custom-page/index.d.ts +8 -0
- package/dist/lib/plugins/custom-page/index.js +12 -0
- package/dist/lib/plugins/custom-page/index.js.map +1 -0
- package/dist/lib/plugins/markdown/MdxPage.d.ts +3 -2
- package/dist/lib/plugins/markdown/MdxPage.js +7 -6
- package/dist/lib/plugins/markdown/MdxPage.js.map +1 -1
- package/dist/lib/plugins/markdown/Toc.js +1 -1
- package/dist/lib/plugins/markdown/Toc.js.map +1 -1
- package/dist/lib/plugins/markdown/generateRoutes.d.ts +3 -3
- package/dist/lib/plugins/markdown/generateRoutes.js +4 -4
- package/dist/lib/plugins/markdown/generateRoutes.js.map +1 -1
- package/dist/lib/plugins/markdown/index.d.ts +4 -1
- package/dist/lib/plugins/markdown/index.js +3 -7
- package/dist/lib/plugins/markdown/index.js.map +1 -1
- package/dist/lib/plugins/openapi/OperationList.js +17 -5
- package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
- package/dist/lib/plugins/openapi/OperationListItem.js +10 -5
- package/dist/lib/plugins/openapi/OperationListItem.js.map +1 -1
- package/dist/lib/plugins/openapi/ParameterList.js +1 -1
- package/dist/lib/plugins/openapi/ParameterList.js.map +1 -1
- package/dist/lib/plugins/openapi/ParameterListItem.js +1 -1
- package/dist/lib/plugins/openapi/ParameterListItem.js.map +1 -1
- package/dist/lib/plugins/openapi/{MakeRequest.d.ts → PlaygroundDialogWrapper.d.ts} +1 -1
- package/dist/lib/plugins/openapi/{MakeRequest.js → PlaygroundDialogWrapper.js} +4 -16
- package/dist/lib/plugins/openapi/PlaygroundDialogWrapper.js.map +1 -0
- package/dist/lib/plugins/openapi/RequestBodySidecarBox.js +1 -9
- package/dist/lib/plugins/openapi/RequestBodySidecarBox.js.map +1 -1
- package/dist/lib/plugins/openapi/ResponsesSidecarBox.js +1 -1
- package/dist/lib/plugins/openapi/ResponsesSidecarBox.js.map +1 -1
- package/dist/lib/plugins/openapi/Route.d.ts +6 -0
- package/dist/lib/plugins/openapi/Route.js +8 -0
- package/dist/lib/plugins/openapi/Route.js.map +1 -0
- package/dist/lib/plugins/openapi/SchemaListView.js +6 -27
- package/dist/lib/plugins/openapi/SchemaListView.js.map +1 -1
- package/dist/lib/plugins/openapi/SchemaListViewItem.d.ts +7 -0
- package/dist/lib/plugins/openapi/SchemaListViewItem.js +16 -0
- package/dist/lib/plugins/openapi/SchemaListViewItem.js.map +1 -0
- package/dist/lib/plugins/openapi/SchemaListViewItemGroup.d.ts +8 -0
- package/dist/lib/plugins/openapi/SchemaListViewItemGroup.js +17 -0
- package/dist/lib/plugins/openapi/SchemaListViewItemGroup.js.map +1 -0
- package/dist/lib/plugins/openapi/Sidecar.js +10 -8
- package/dist/lib/plugins/openapi/Sidecar.js.map +1 -1
- package/dist/lib/plugins/openapi/SidecarBox.js +1 -1
- package/dist/lib/plugins/openapi/SidecarBox.js.map +1 -1
- package/dist/lib/plugins/openapi/{Select.d.ts → SimpleSelect.d.ts} +3 -2
- package/dist/lib/plugins/openapi/SimpleSelect.js +5 -0
- package/dist/lib/plugins/openapi/SimpleSelect.js.map +1 -0
- package/dist/lib/plugins/openapi/StaggeredRender.d.ts +8 -0
- package/dist/lib/plugins/openapi/StaggeredRender.js +18 -0
- package/dist/lib/plugins/openapi/StaggeredRender.js.map +1 -0
- package/dist/lib/plugins/openapi/client/createMemoryClient.d.ts +12 -0
- package/dist/lib/plugins/openapi/client/createMemoryClient.js +46 -0
- package/dist/lib/plugins/openapi/client/createMemoryClient.js.map +1 -0
- package/dist/lib/plugins/openapi/client/createServer.d.ts +4 -0
- package/dist/lib/plugins/openapi/client/createServer.js +30 -0
- package/dist/lib/plugins/openapi/client/createServer.js.map +1 -0
- package/dist/lib/plugins/openapi/client/createWorkerClient.d.ts +10 -0
- package/dist/lib/plugins/openapi/{worker/createSharedWorkerClient.js → client/createWorkerClient.js} +15 -2
- package/dist/lib/plugins/openapi/client/createWorkerClient.js.map +1 -0
- package/dist/lib/plugins/openapi/client/interfaces.d.ts +4 -0
- package/dist/lib/plugins/openapi/client/interfaces.js +2 -0
- package/dist/lib/plugins/openapi/client/interfaces.js.map +1 -0
- package/dist/lib/plugins/openapi/{worker → client}/worker.js +2 -2
- package/dist/lib/plugins/openapi/client/worker.js.map +1 -0
- package/dist/lib/plugins/openapi/context.d.ts +5 -0
- package/dist/lib/plugins/openapi/context.js +11 -0
- package/dist/lib/plugins/openapi/context.js.map +1 -0
- package/dist/lib/plugins/openapi/index.d.ts +4 -18
- package/dist/lib/plugins/openapi/index.js +35 -20
- package/dist/lib/plugins/openapi/index.js.map +1 -1
- package/dist/lib/plugins/openapi/interfaces.d.ts +15 -0
- package/dist/lib/plugins/openapi/interfaces.js +2 -0
- package/dist/lib/plugins/openapi/interfaces.js.map +1 -0
- package/dist/lib/plugins/openapi/playground/Headers.d.ts +2 -3
- package/dist/lib/plugins/openapi/playground/Headers.js +16 -6
- package/dist/lib/plugins/openapi/playground/Headers.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/PathParams.d.ts +1 -1
- package/dist/lib/plugins/openapi/playground/Playground.d.ts +5 -4
- package/dist/lib/plugins/openapi/playground/Playground.js +22 -13
- package/dist/lib/plugins/openapi/playground/Playground.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/PlaygroundDialog.d.ts +3 -0
- package/dist/lib/plugins/openapi/playground/PlaygroundDialog.js +12 -0
- package/dist/lib/plugins/openapi/playground/PlaygroundDialog.js.map +1 -0
- package/dist/lib/plugins/openapi/playground/QueryParams.d.ts +1 -1
- package/dist/lib/plugins/openapi/playground/QueryParams.js +2 -1
- package/dist/lib/plugins/openapi/playground/QueryParams.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/createUrl.d.ts +1 -1
- package/dist/lib/plugins/openapi/util/prose.d.ts +1 -0
- package/dist/lib/plugins/openapi/util/prose.js +4 -0
- package/dist/lib/plugins/openapi/util/prose.js.map +1 -0
- package/dist/lib/plugins/openapi-worker.d.ts +1 -1
- package/dist/lib/plugins/openapi-worker.js +1 -1
- package/dist/lib/plugins/openapi-worker.js.map +1 -1
- package/dist/lib/plugins/redirect/index.d.ts +0 -1
- package/dist/lib/plugins/redirect/index.js +3 -4
- package/dist/lib/plugins/redirect/index.js.map +1 -1
- package/dist/lib/ui/Callout.js +2 -2
- package/dist/lib/ui/Callout.js.map +1 -1
- package/dist/lib/ui/Card.js +1 -1
- package/dist/lib/ui/Card.js.map +1 -1
- package/dist/lib/ui/DropdownMenu.d.ts +27 -0
- package/dist/lib/ui/DropdownMenu.js +36 -0
- package/dist/lib/ui/DropdownMenu.js.map +1 -0
- package/dist/lib/ui/button-variants.d.ts +2 -2
- package/dist/lib/ui/button-variants.js +1 -0
- package/dist/lib/ui/button-variants.js.map +1 -1
- package/dist/lib/util/MdxComponents.d.ts +2 -2
- package/dist/lib/util/MdxComponents.js +7 -5
- package/dist/lib/util/MdxComponents.js.map +1 -1
- package/dist/lib/util/groupBy.d.ts +1 -6
- package/dist/lib/util/groupBy.js +10 -8
- package/dist/lib/util/groupBy.js.map +1 -1
- package/dist/lib/util/joinPath.js +2 -1
- package/dist/lib/util/joinPath.js.map +1 -1
- package/dist/lib/util/logInit.d.ts +1 -0
- package/dist/lib/util/logInit.js +9 -0
- package/dist/lib/util/logInit.js.map +1 -0
- package/dist/lib/util/objectEntries.d.ts +4 -0
- package/dist/lib/util/objectEntries.js +2 -0
- package/dist/lib/util/objectEntries.js.map +1 -0
- package/dist/lib/util/renderIf.d.ts +1 -0
- package/dist/lib/util/renderIf.js +2 -0
- package/dist/lib/util/renderIf.js.map +1 -0
- package/dist/vite/build.js +30 -7
- package/dist/vite/build.js.map +1 -1
- package/dist/vite/config.d.ts +21 -12
- package/dist/vite/config.js +107 -55
- package/dist/vite/config.js.map +1 -1
- package/dist/vite/config.test.js +6 -3
- package/dist/vite/config.test.js.map +1 -1
- package/dist/vite/dev-server.d.ts +2 -1
- package/dist/vite/dev-server.js +44 -15
- package/dist/vite/dev-server.js.map +1 -1
- package/dist/vite/html.js +18 -5
- package/dist/vite/html.js.map +1 -1
- package/dist/vite/plugin-api-keys.js +7 -8
- package/dist/vite/plugin-api-keys.js.map +1 -1
- package/dist/vite/plugin-api.js +9 -20
- package/dist/vite/plugin-api.js.map +1 -1
- package/dist/vite/plugin-auth.js +5 -6
- package/dist/vite/plugin-auth.js.map +1 -1
- package/dist/vite/plugin-component.js +5 -2
- package/dist/vite/plugin-component.js.map +1 -1
- package/dist/vite/plugin-config.d.ts +0 -2
- package/dist/vite/plugin-config.js +2 -13
- package/dist/vite/plugin-config.js.map +1 -1
- package/dist/vite/plugin-custom-css.d.ts +6 -0
- package/dist/vite/plugin-custom-css.js +54 -0
- package/dist/vite/plugin-custom-css.js.map +1 -0
- package/dist/vite/plugin-docs.js +15 -5
- package/dist/vite/plugin-docs.js.map +1 -1
- package/dist/vite/plugin-mdx.d.ts +3 -1
- package/dist/vite/plugin-mdx.js +5 -5
- package/dist/vite/plugin-mdx.js.map +1 -1
- package/dist/vite/plugin-metadata.js +1 -1
- package/dist/vite/plugin-metadata.js.map +1 -1
- package/dist/vite/plugin-redirect.js +10 -10
- package/dist/vite/plugin-redirect.js.map +1 -1
- package/dist/vite/plugin.js +3 -5
- package/dist/vite/plugin.js.map +1 -1
- package/dist/vite/prerender.d.ts +17 -0
- package/dist/vite/prerender.js +79 -0
- package/dist/vite/prerender.js.map +1 -0
- package/lib/AnchorLink-Bj1hwDuD.js +705 -0
- package/lib/AnchorLink-Bj1hwDuD.js.map +1 -0
- package/lib/AuthenticationPlugin-RvXALgvS.js +52 -0
- package/lib/AuthenticationPlugin-RvXALgvS.js.map +1 -0
- package/lib/CategoryHeading-DMkTmmBh.js +10 -0
- package/lib/CategoryHeading-DMkTmmBh.js.map +1 -0
- package/lib/Combination-lAFQBd6U.js +2774 -0
- package/lib/Combination-lAFQBd6U.js.map +1 -0
- package/lib/DevPortalProvider-BBhQ8kgI.js +1125 -0
- package/lib/DevPortalProvider-BBhQ8kgI.js.map +1 -0
- package/lib/Markdown-BjRJKl_E.js +15028 -0
- package/lib/Markdown-BjRJKl_E.js.map +1 -0
- package/lib/MdxPage-DJTFOCbZ.js +190 -0
- package/lib/MdxPage-DJTFOCbZ.js.map +1 -0
- package/lib/OperationList-DDTtK3I7.js +5403 -0
- package/lib/OperationList-DDTtK3I7.js.map +1 -0
- package/lib/Route-Bsrd0acQ.js +13 -0
- package/lib/Route-Bsrd0acQ.js.map +1 -0
- package/lib/Select-CEnkyfyn.js +2223 -0
- package/lib/Select-CEnkyfyn.js.map +1 -0
- package/lib/Spinner-Ciq_pWU7.js +359 -0
- package/lib/Spinner-Ciq_pWU7.js.map +1 -0
- package/lib/_commonjsHelpers-BVfed4GL.js +29 -0
- package/lib/_commonjsHelpers-BVfed4GL.js.map +1 -0
- package/lib/assets/index-BPdJm2ty.js +1 -0
- package/lib/assets/index-BPdJm2ty.js.map +1 -0
- package/lib/assets/{worker-BCcpCNJ7.js → worker-BWwCA-wk.js} +10727 -10300
- package/lib/assets/worker-BWwCA-wk.js.map +1 -0
- package/lib/context-_fYfJFgk.js +14 -0
- package/lib/context-_fYfJFgk.js.map +1 -0
- package/lib/hook-BY1NP0kj.js +93 -0
- package/lib/hook-BY1NP0kj.js.map +1 -0
- package/lib/index-BE2a6gGC.js +726 -0
- package/lib/index-BE2a6gGC.js.map +1 -0
- package/lib/index-pI9JkN46.js +4765 -0
- package/lib/index-pI9JkN46.js.map +1 -0
- package/lib/jsx-runtime-BIr0WBt_.js +1526 -0
- package/lib/jsx-runtime-BIr0WBt_.js.map +1 -0
- package/lib/prism-bash.min-DadFsM4Z.js +1 -0
- package/lib/prism-bash.min-DadFsM4Z.js.map +1 -0
- package/lib/prism-csharp.min-Yizuc34Y.js +35 -0
- package/lib/prism-csharp.min-Yizuc34Y.js.map +1 -0
- package/lib/prism-java.min-d5iT_mOd.js +1 -0
- package/lib/prism-java.min-d5iT_mOd.js.map +1 -0
- package/lib/prism-json.min-B1GJqK1k.js +1 -0
- package/lib/prism-json.min-B1GJqK1k.js.map +1 -0
- package/lib/prism-markup-templating-DZrrEs0A.js +1 -0
- package/lib/prism-markup-templating-DZrrEs0A.js.map +1 -0
- package/lib/prism-objectivec.min-BXSWqpJJ.js +2 -0
- package/lib/prism-objectivec.min-BXSWqpJJ.js.map +1 -0
- package/lib/prism-php.min-o7FpoMP_.js +1 -0
- package/lib/prism-php.min-o7FpoMP_.js.map +1 -0
- package/lib/prism-ruby.min-C7LwcKyz.js +1 -0
- package/lib/prism-ruby.min-C7LwcKyz.js.map +1 -0
- package/lib/router-BiRCp01d.js +2971 -0
- package/lib/router-BiRCp01d.js.map +1 -0
- package/lib/slugify-CiPVjteN.js +28 -0
- package/lib/slugify-CiPVjteN.js.map +1 -0
- package/lib/state-DKdaQzvh.js +288 -0
- package/lib/state-DKdaQzvh.js.map +1 -0
- package/lib/urql-DMlBWUKL.js +1 -0
- package/lib/urql-DMlBWUKL.js.map +1 -0
- package/lib/zudoku.auth-auth0.js +10 -7
- package/lib/zudoku.auth-auth0.js.map +1 -0
- package/lib/zudoku.auth-clerk.js +59 -29
- package/lib/zudoku.auth-clerk.js.map +1 -0
- package/lib/zudoku.auth-openid.js +714 -538
- package/lib/zudoku.auth-openid.js.map +1 -0
- package/lib/zudoku.components.js +1793 -512
- package/lib/zudoku.components.js.map +1 -0
- package/lib/zudoku.openapi-worker.js +15035 -146
- package/lib/zudoku.openapi-worker.js.map +1 -0
- package/lib/zudoku.plugin-api-keys.js +313 -0
- package/lib/zudoku.plugin-api-keys.js.map +1 -0
- package/lib/zudoku.plugin-custom-page.js +13 -0
- package/lib/zudoku.plugin-custom-page.js.map +1 -0
- package/lib/zudoku.plugin-markdown.js +48 -0
- package/lib/zudoku.plugin-markdown.js.map +1 -0
- package/lib/zudoku.plugin-openapi.js +10 -0
- package/lib/zudoku.plugin-openapi.js.map +1 -0
- package/lib/zudoku.plugin-redirect.js +11 -0
- package/lib/zudoku.plugin-redirect.js.map +1 -0
- package/package.json +60 -24
- package/src/app/App.tsx +0 -41
- package/src/app/demo-cdn.html +26 -0
- package/src/app/demo.html +18 -0
- package/src/app/demo.tsx +45 -0
- package/src/app/entry.client.tsx +47 -0
- package/src/app/entry.server.tsx +160 -0
- package/src/app/main.css +80 -0
- package/src/app/main.tsx +86 -15
- package/src/app/standalone.html +20 -0
- package/src/app/standalone.tsx +51 -0
- package/src/app/tailwind.ts +2 -6
- package/src/lib/authentication/AuthenticationPlugin.tsx +38 -0
- package/src/lib/authentication/Callback.tsx +1 -1
- package/src/lib/authentication/authentication.ts +6 -12
- package/src/lib/authentication/components/SignIn.tsx +11 -0
- package/src/lib/authentication/components/SignOut.tsx +11 -0
- package/src/lib/authentication/components/SignUp.tsx +11 -0
- package/src/lib/authentication/hook.ts +2 -2
- package/src/lib/authentication/providers/auth0.tsx +4 -2
- package/src/lib/authentication/providers/clerk.tsx +63 -31
- package/src/lib/authentication/providers/openid.tsx +56 -16
- package/src/lib/components/Bootstrap.tsx +44 -0
- package/src/lib/components/DevPortal.tsx +55 -49
- package/src/lib/components/DeveloperHint.tsx +25 -0
- package/src/lib/components/ErrorPage.tsx +28 -0
- package/src/lib/components/Header.tsx +89 -28
- package/src/lib/components/Heading.tsx +26 -7
- package/src/lib/components/InlineCode.tsx +19 -0
- package/src/lib/components/Layout.tsx +9 -7
- package/src/lib/components/NotFoundPage.tsx +33 -0
- package/src/lib/components/SyntaxHighlight.tsx +26 -18
- package/src/lib/components/TopNavigation.tsx +6 -1
- package/src/lib/components/context/DevPortalProvider.ts +24 -4
- package/src/lib/components/index.ts +25 -3
- package/src/lib/components/navigation/SideNavigationCategory.tsx +3 -3
- package/src/lib/components/navigation/SideNavigationItem.tsx +1 -1
- package/src/lib/core/DevPortalContext.ts +54 -25
- package/src/lib/core/plugins.ts +26 -5
- package/src/lib/errors/ErrorAlert.tsx +21 -0
- package/src/lib/errors/RouterError.tsx +13 -0
- package/src/lib/errors/ServerError.tsx +5 -0
- package/src/lib/errors/TopLevelError.tsx +8 -0
- package/src/lib/oas/graphql/index.ts +9 -5
- package/src/lib/oas/parser/index.ts +41 -20
- package/src/lib/plugins/{api-key → api-keys}/CreateApiKey.tsx +1 -1
- package/src/lib/plugins/api-keys/ProtectedRoute.tsx +29 -0
- package/src/lib/plugins/api-keys/SettingsApiKeys.tsx +139 -0
- package/src/lib/plugins/{api-key → api-keys}/index.tsx +16 -40
- package/src/lib/plugins/custom-page/index.tsx +22 -0
- package/src/lib/plugins/markdown/MdxPage.tsx +51 -34
- package/src/lib/plugins/markdown/Toc.tsx +1 -1
- package/src/lib/plugins/markdown/generateRoutes.tsx +16 -6
- package/src/lib/plugins/markdown/index.tsx +10 -7
- package/src/lib/plugins/openapi/OperationList.tsx +46 -10
- package/src/lib/plugins/openapi/OperationListItem.tsx +68 -42
- package/src/lib/plugins/openapi/ParameterList.tsx +1 -1
- package/src/lib/plugins/openapi/ParameterListItem.tsx +3 -4
- package/src/lib/plugins/openapi/{MakeRequest.tsx → PlaygroundDialogWrapper.tsx} +3 -19
- package/src/lib/plugins/openapi/RequestBodySidecarBox.tsx +2 -16
- package/src/lib/plugins/openapi/ResponsesSidecarBox.tsx +3 -1
- package/src/lib/plugins/openapi/Route.tsx +21 -0
- package/src/lib/plugins/openapi/SchemaListView.tsx +23 -192
- package/src/lib/plugins/openapi/SchemaListViewItem.tsx +110 -0
- package/src/lib/plugins/openapi/SchemaListViewItemGroup.tsx +63 -0
- package/src/lib/plugins/openapi/Sidecar.tsx +15 -10
- package/src/lib/plugins/openapi/SidecarBox.tsx +1 -1
- package/src/lib/plugins/openapi/{Select.tsx → SimpleSelect.tsx} +6 -3
- package/src/lib/plugins/openapi/StaggeredRender.tsx +31 -0
- package/src/lib/plugins/openapi/client/createMemoryClient.ts +56 -0
- package/src/lib/plugins/openapi/client/createServer.ts +33 -0
- package/src/lib/plugins/openapi/{worker/createSharedWorkerClient.ts → client/createWorkerClient.ts} +21 -2
- package/src/lib/plugins/openapi/client/interfaces.ts +5 -0
- package/src/lib/plugins/openapi/{worker → client}/worker.ts +3 -3
- package/src/lib/plugins/openapi/context.tsx +16 -0
- package/src/lib/plugins/openapi/index.tsx +59 -52
- package/src/lib/plugins/openapi/interfaces.ts +9 -0
- package/src/lib/plugins/openapi/playground/Headers.tsx +60 -33
- package/src/lib/plugins/openapi/playground/PathParams.tsx +1 -1
- package/src/lib/plugins/openapi/playground/Playground.tsx +172 -193
- package/src/lib/plugins/openapi/playground/PlaygroundDialog.tsx +36 -0
- package/src/lib/plugins/openapi/playground/QueryParams.tsx +7 -2
- package/src/lib/plugins/openapi/playground/createUrl.ts +1 -1
- package/src/lib/plugins/openapi/util/prose.ts +7 -0
- package/src/lib/plugins/openapi-worker.ts +1 -1
- package/src/lib/plugins/redirect/index.tsx +3 -4
- package/src/lib/ui/Callout.tsx +4 -4
- package/src/lib/ui/Card.tsx +1 -1
- package/src/lib/ui/DropdownMenu.tsx +199 -0
- package/src/lib/ui/button-variants.ts +1 -0
- package/src/lib/util/MdxComponents.tsx +7 -15
- package/src/lib/util/groupBy.ts +7 -12
- package/src/lib/util/joinPath.tsx +2 -1
- package/src/lib/util/logInit.ts +9 -0
- package/src/lib/util/objectEntries.ts +5 -0
- package/src/lib/util/renderIf.ts +4 -0
- package/dist/lib/components/Link.d.ts +0 -1
- package/dist/lib/components/Link.js +0 -2
- package/dist/lib/components/Link.js.map +0 -1
- package/dist/lib/components/Router.d.ts +0 -4
- package/dist/lib/components/Router.js +0 -20
- package/dist/lib/components/Router.js.map +0 -1
- package/dist/lib/core/helmet.d.ts +0 -4
- package/dist/lib/core/helmet.js +0 -5
- package/dist/lib/core/helmet.js.map +0 -1
- package/dist/lib/core/icons.d.ts +0 -1
- package/dist/lib/core/icons.js +0 -2
- package/dist/lib/core/icons.js.map +0 -1
- package/dist/lib/core/router.d.ts +0 -1
- package/dist/lib/core/router.js +0 -2
- package/dist/lib/core/router.js.map +0 -1
- package/dist/lib/plugins/api-key/CreateApiKey.js.map +0 -1
- package/dist/lib/plugins/api-key/SettingsApiKeys.js +0 -38
- package/dist/lib/plugins/api-key/SettingsApiKeys.js.map +0 -1
- package/dist/lib/plugins/api-key/index.js.map +0 -1
- package/dist/lib/plugins/index.d.ts +0 -4
- package/dist/lib/plugins/index.js +0 -5
- package/dist/lib/plugins/index.js.map +0 -1
- package/dist/lib/plugins/openapi/MakeRequest.js.map +0 -1
- package/dist/lib/plugins/openapi/Select.js +0 -5
- package/dist/lib/plugins/openapi/Select.js.map +0 -1
- package/dist/lib/plugins/openapi/worker/createSharedWorkerClient.d.ts +0 -5
- package/dist/lib/plugins/openapi/worker/createSharedWorkerClient.js.map +0 -1
- package/dist/lib/plugins/openapi/worker/shared-worker.d.ts +0 -1
- package/dist/lib/plugins/openapi/worker/shared-worker.js +0 -6
- package/dist/lib/plugins/openapi/worker/shared-worker.js.map +0 -1
- package/dist/lib/plugins/openapi/worker/worker.js.map +0 -1
- package/dist/vite/common.d.ts +0 -1
- package/dist/vite/common.js +0 -5
- package/dist/vite/common.js.map +0 -1
- package/dist/vite/plugin-html.d.ts +0 -3
- package/dist/vite/plugin-html.js +0 -47
- package/dist/vite/plugin-html.js.map +0 -1
- package/dist/vite/plugin-openapi-worker.d.ts +0 -4
- package/dist/vite/plugin-openapi-worker.js +0 -28
- package/dist/vite/plugin-openapi-worker.js.map +0 -1
- package/lib/Spinner-BINYpvLB.js +0 -8412
- package/lib/clerk-Wslx_mPo.js +0 -19685
- package/lib/index-PyGcnQFX.js +0 -3462
- package/lib/loglevel-CoH7VSwE.js +0 -152
- package/lib/state-2Hu1renZ.js +0 -313
- package/lib/zudoku.plugins.js +0 -19892
- package/src/lib/components/Link.tsx +0 -1
- package/src/lib/components/Router.tsx +0 -28
- package/src/lib/core/helmet.ts +0 -5
- package/src/lib/core/icons.tsx +0 -1
- package/src/lib/core/router.tsx +0 -1
- package/src/lib/plugins/api-key/SettingsApiKeys.tsx +0 -117
- package/src/lib/plugins/index.ts +0 -4
- package/src/lib/plugins/openapi/worker/shared-worker.ts +0 -5
- /package/dist/lib/plugins/{api-key → api-keys}/CreateApiKey.d.ts +0 -0
- /package/dist/lib/plugins/{api-key → api-keys}/SettingsApiKeys.d.ts +0 -0
- /package/dist/lib/plugins/openapi/{worker → client}/worker.d.ts +0 -0
package/src/app/main.tsx
CHANGED
|
@@ -1,18 +1,89 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
1
|
+
import { type RouteObject } from "react-router-dom";
|
|
2
|
+
import { configuredApiKeysPlugin } from "virtual:zudoku-api-keys-plugin";
|
|
3
|
+
import { configuredApiPlugins } from "virtual:zudoku-api-plugins";
|
|
4
|
+
import { configuredAuthProvider } from "virtual:zudoku-auth";
|
|
5
|
+
import { configuredDocsPlugins } from "virtual:zudoku-docs-plugins";
|
|
6
|
+
import { configuredRedirectPlugin } from "virtual:zudoku-redirect-plugin";
|
|
7
|
+
import "virtual:zudoku-theme.css";
|
|
8
|
+
import { DevPortal, Layout, RouterError } from "zudoku/components";
|
|
9
|
+
import { isNavigationPlugin } from "zudoku/internal";
|
|
10
|
+
import { customPagePlugin } from "zudoku/plugins/custom-page";
|
|
11
|
+
import type { ZudokuConfig } from "../config/config.js";
|
|
12
|
+
import type { ZudokuContextOptions } from "../lib/core/DevPortalContext.js";
|
|
5
13
|
|
|
6
|
-
|
|
14
|
+
export const convertZudokuConfigToOptions = (
|
|
15
|
+
config: ZudokuConfig,
|
|
16
|
+
): ZudokuContextOptions => {
|
|
17
|
+
const fallbackLogo =
|
|
18
|
+
config.page?.logoUrl ?? "https://cdn.zudoku.dev/logos/icon.svg";
|
|
7
19
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
20
|
+
return {
|
|
21
|
+
page: {
|
|
22
|
+
pageTitle: "Developer Portal",
|
|
23
|
+
...config.page,
|
|
24
|
+
logo: {
|
|
25
|
+
...config.page?.logo,
|
|
26
|
+
src: {
|
|
27
|
+
light: config.page?.logo?.src?.light ?? fallbackLogo,
|
|
28
|
+
dark: config.page?.logo?.src?.dark ?? fallbackLogo,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
metadata: {
|
|
33
|
+
favicon: "https://cdn.zudoku.dev/logos/icon.svg",
|
|
34
|
+
title: "%s | Developer Portal",
|
|
35
|
+
...config.metadata,
|
|
36
|
+
},
|
|
37
|
+
mdx: config.mdx,
|
|
38
|
+
navigation: config.navigation ?? [],
|
|
39
|
+
authentication: configuredAuthProvider,
|
|
40
|
+
plugins: [
|
|
41
|
+
...configuredDocsPlugins,
|
|
42
|
+
...configuredApiPlugins,
|
|
43
|
+
...(configuredRedirectPlugin ? [configuredRedirectPlugin] : []),
|
|
44
|
+
...(configuredApiKeysPlugin ? [configuredApiKeysPlugin] : []),
|
|
45
|
+
...(config.customPages ? [customPagePlugin(config.customPages)] : []),
|
|
46
|
+
...(configuredAuthProvider?.getAuthenticationPlugin
|
|
47
|
+
? [configuredAuthProvider.getAuthenticationPlugin()]
|
|
48
|
+
: []),
|
|
49
|
+
],
|
|
50
|
+
};
|
|
51
|
+
};
|
|
13
52
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
)
|
|
53
|
+
export const getRoutesByConfig = (config: ZudokuConfig): RouteObject[] => {
|
|
54
|
+
const options = convertZudokuConfigToOptions(config);
|
|
55
|
+
|
|
56
|
+
const allPlugins = [
|
|
57
|
+
...(options.plugins ? options.plugins : []),
|
|
58
|
+
...(options.authentication?.getAuthenticationPlugin
|
|
59
|
+
? [options.authentication.getAuthenticationPlugin()]
|
|
60
|
+
: []),
|
|
61
|
+
];
|
|
62
|
+
|
|
63
|
+
const routes = allPlugins
|
|
64
|
+
.flatMap((plugin) => (isNavigationPlugin(plugin) ? plugin.getRoutes() : []))
|
|
65
|
+
.concat({
|
|
66
|
+
path: "*",
|
|
67
|
+
loader: () => {
|
|
68
|
+
throw new Response("Not Found", { status: 404 });
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
return [
|
|
73
|
+
{
|
|
74
|
+
element: (
|
|
75
|
+
<DevPortal {...options}>
|
|
76
|
+
<Layout />
|
|
77
|
+
</DevPortal>
|
|
78
|
+
),
|
|
79
|
+
errorElement: (
|
|
80
|
+
<DevPortal {...options}>
|
|
81
|
+
<Layout>
|
|
82
|
+
<RouterError />
|
|
83
|
+
</Layout>
|
|
84
|
+
</DevPortal>
|
|
85
|
+
),
|
|
86
|
+
children: routes,
|
|
87
|
+
},
|
|
88
|
+
];
|
|
89
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link
|
|
6
|
+
rel="icon"
|
|
7
|
+
type="image/svg+xml"
|
|
8
|
+
href="https://cdn.zudoku.dev/logos/icon.svg"
|
|
9
|
+
/>
|
|
10
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
11
|
+
<title>Dev Portal</title>
|
|
12
|
+
<script type="module" crossorigin src="./main.js"></script>
|
|
13
|
+
<link rel="stylesheet" crossorigin href="./style.css" />
|
|
14
|
+
</head>
|
|
15
|
+
<body>
|
|
16
|
+
<div
|
|
17
|
+
data-api-url="https://blue-sloth-main-afc3428.d2.zuplo.dev/schemas/rewiring-america"
|
|
18
|
+
></div>
|
|
19
|
+
</body>
|
|
20
|
+
</html>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { StrictMode } from "react";
|
|
2
|
+
import { createRoot } from "react-dom/client";
|
|
3
|
+
|
|
4
|
+
// Styles
|
|
5
|
+
import "./main.css";
|
|
6
|
+
|
|
7
|
+
// Logger
|
|
8
|
+
import "../lib/util/logInit.js";
|
|
9
|
+
|
|
10
|
+
// Base React Component
|
|
11
|
+
import { DevPortal } from "../lib/components/DevPortal.js";
|
|
12
|
+
|
|
13
|
+
// Plugins
|
|
14
|
+
import { openApiPlugin } from "../lib/plugins/openapi/index.js";
|
|
15
|
+
|
|
16
|
+
const root = document.querySelector("[data-api-url]");
|
|
17
|
+
if (!root || root.tagName !== "DIV") {
|
|
18
|
+
throw new Error("No div found with attribute data-api-url");
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const apiUrl = root.getAttribute("data-api-url");
|
|
22
|
+
const pageTitle = document.getElementsByTagName("title")[0].innerText;
|
|
23
|
+
const logoUrl = root.getAttribute("data-logo-url");
|
|
24
|
+
|
|
25
|
+
// IMPORTANT: This component must not contain tailwind classes
|
|
26
|
+
// This directory is not processed by the tailwind plugin
|
|
27
|
+
|
|
28
|
+
createRoot(root).render(
|
|
29
|
+
<StrictMode>
|
|
30
|
+
<DevPortal
|
|
31
|
+
page={{
|
|
32
|
+
logo: {
|
|
33
|
+
src: {
|
|
34
|
+
light: logoUrl ?? "https://cdn.zudoku.dev/logos/icon.svg",
|
|
35
|
+
dark: logoUrl ?? "https://cdn.zudoku.dev/logos/icon.svg",
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
39
|
+
pageTitle: pageTitle ?? "Developer Portal",
|
|
40
|
+
}}
|
|
41
|
+
navigation={[
|
|
42
|
+
{
|
|
43
|
+
label: "API Reference",
|
|
44
|
+
path: "/",
|
|
45
|
+
categories: [],
|
|
46
|
+
},
|
|
47
|
+
]}
|
|
48
|
+
plugins={[openApiPlugin({ type: "url", input: apiUrl!, path: "/" })]}
|
|
49
|
+
/>
|
|
50
|
+
</StrictMode>,
|
|
51
|
+
);
|
package/src/app/tailwind.ts
CHANGED
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
import typographyPlugin from "@tailwindcss/typography";
|
|
2
2
|
import type { Config } from "tailwindcss";
|
|
3
3
|
import defaultTheme from "tailwindcss/defaultTheme.js";
|
|
4
|
+
|
|
4
5
|
const content = [
|
|
5
6
|
"./src/**/*.{js,ts,jsx,tsx,md,mdx}",
|
|
6
7
|
"./node_modules/zudoku/dist/**/*.{js,ts,jsx,tsx,md,mdx}",
|
|
7
8
|
];
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
// if (process.env.NODE_ENV === "development") {
|
|
11
|
-
// content.push("../../plugins/*/src/**/*.{js,ts,jsx,tsx}");
|
|
12
|
-
// }
|
|
13
|
-
|
|
14
|
-
const config: Config = {
|
|
10
|
+
const config: Omit<Config, "content"> = {
|
|
15
11
|
darkMode: "selector",
|
|
16
12
|
content,
|
|
17
13
|
theme: {
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CommonPlugin,
|
|
3
|
+
NavigationPlugin,
|
|
4
|
+
ProfileMenuPlugin,
|
|
5
|
+
} from "../core/plugins.js";
|
|
6
|
+
import { SignIn } from "./components/SignIn.js";
|
|
7
|
+
import { SignOut } from "./components/SignOut.js";
|
|
8
|
+
import { SignUp } from "./components/SignUp.js";
|
|
9
|
+
|
|
10
|
+
type PluginInterface = NavigationPlugin & CommonPlugin & ProfileMenuPlugin;
|
|
11
|
+
|
|
12
|
+
export class AuthenticationPlugin implements PluginInterface {
|
|
13
|
+
getRoutes() {
|
|
14
|
+
return [
|
|
15
|
+
{
|
|
16
|
+
path: "/signout",
|
|
17
|
+
element: <SignOut />,
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
path: "/signin",
|
|
21
|
+
element: <SignIn />,
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
path: "/signup",
|
|
25
|
+
element: <SignUp />,
|
|
26
|
+
},
|
|
27
|
+
];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
getProfileMenuItems() {
|
|
31
|
+
return [
|
|
32
|
+
{
|
|
33
|
+
label: "Logout",
|
|
34
|
+
path: "/signout",
|
|
35
|
+
},
|
|
36
|
+
];
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -1,19 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
InitializationPlugin,
|
|
3
|
-
NavigationPlugin,
|
|
4
|
-
} from "../../lib/core/plugins.js";
|
|
1
|
+
import { DevPortalPlugin } from "../core/plugins.js";
|
|
5
2
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
export interface AuthenticationProvider {
|
|
4
|
+
signUp(): Promise<void>;
|
|
5
|
+
signIn(): Promise<void>;
|
|
6
|
+
signOut(): Promise<void>;
|
|
10
7
|
getAccessToken(): Promise<string>;
|
|
11
|
-
|
|
8
|
+
getAuthenticationPlugin?(): DevPortalPlugin;
|
|
12
9
|
}
|
|
13
10
|
|
|
14
|
-
/**
|
|
15
|
-
* Function to get an initialized AuthenticationProvider
|
|
16
|
-
*/
|
|
17
11
|
export interface AuthenticationProviderInitializer<TConfig> {
|
|
18
12
|
(config: TConfig): AuthenticationProvider;
|
|
19
13
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
import { useDevPortal } from "../../components/context/DevPortalProvider.js";
|
|
3
|
+
|
|
4
|
+
export const SignIn = () => {
|
|
5
|
+
const context = useDevPortal();
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
void context.authentication?.signIn();
|
|
8
|
+
}, [context.authentication]);
|
|
9
|
+
|
|
10
|
+
return null;
|
|
11
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
import { useDevPortal } from "../../components/context/DevPortalProvider.js";
|
|
3
|
+
|
|
4
|
+
export const SignOut = () => {
|
|
5
|
+
const context = useDevPortal();
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
void context.authentication?.signOut();
|
|
8
|
+
}, [context.authentication]);
|
|
9
|
+
|
|
10
|
+
return null;
|
|
11
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
import { useDevPortal } from "../../components/context/DevPortalProvider.js";
|
|
3
|
+
|
|
4
|
+
export const SignUp = () => {
|
|
5
|
+
const context = useDevPortal();
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
void context.authentication?.signUp();
|
|
8
|
+
}, [context.authentication]);
|
|
9
|
+
|
|
10
|
+
return null;
|
|
11
|
+
};
|
|
@@ -17,7 +17,7 @@ export const useAuth = () => {
|
|
|
17
17
|
throw new Error("Authentication is not enabled.");
|
|
18
18
|
}
|
|
19
19
|
// TODO: Should handle errors/state
|
|
20
|
-
await authentication.
|
|
20
|
+
await authentication.signIn();
|
|
21
21
|
},
|
|
22
22
|
|
|
23
23
|
logout: async () => {
|
|
@@ -25,7 +25,7 @@ export const useAuth = () => {
|
|
|
25
25
|
throw new Error("Authentication is not enabled.");
|
|
26
26
|
}
|
|
27
27
|
// TODO: Should handle errors/state
|
|
28
|
-
await authentication.
|
|
28
|
+
await authentication.signOut();
|
|
29
29
|
|
|
30
30
|
// Redirect to home
|
|
31
31
|
window.location.href = "/";
|
|
@@ -4,7 +4,7 @@ import { useAuthState } from "../state.js";
|
|
|
4
4
|
import { OpenIDAuthenticationProvider } from "./openid.js";
|
|
5
5
|
|
|
6
6
|
class Auth0AuthenticationProvider extends OpenIDAuthenticationProvider {
|
|
7
|
-
override async
|
|
7
|
+
override async signOut(): Promise<void> {
|
|
8
8
|
useAuthState.setState({
|
|
9
9
|
isAuthenticated: false,
|
|
10
10
|
isPending: false,
|
|
@@ -12,7 +12,9 @@ class Auth0AuthenticationProvider extends OpenIDAuthenticationProvider {
|
|
|
12
12
|
});
|
|
13
13
|
const as = await this.getAuthServer();
|
|
14
14
|
|
|
15
|
-
const redirectUrl = new URL(
|
|
15
|
+
const redirectUrl = new URL(
|
|
16
|
+
window.location.origin + this.logoutRedirectUrlPath,
|
|
17
|
+
);
|
|
16
18
|
redirectUrl.pathname = this.logoutRedirectUrlPath;
|
|
17
19
|
|
|
18
20
|
// SEE: https://auth0.com/docs/authenticate/login/logout/log-users-out-of-auth0
|
|
@@ -1,18 +1,58 @@
|
|
|
1
1
|
import type { Clerk } from "@clerk/clerk-js";
|
|
2
2
|
import { ClerkAuthenticationConfig } from "../../../config/config.js";
|
|
3
3
|
import { AuthenticationProviderInitializer } from "../authentication.js";
|
|
4
|
+
import { AuthenticationPlugin } from "../AuthenticationPlugin.js";
|
|
4
5
|
import { useAuthState } from "../state.js";
|
|
5
6
|
|
|
7
|
+
class ClerkAuthPlugin extends AuthenticationPlugin {
|
|
8
|
+
constructor(private clerk: Promise<Clerk | undefined>) {
|
|
9
|
+
super();
|
|
10
|
+
}
|
|
11
|
+
initialize = async () => {
|
|
12
|
+
const clerk = await this.clerk;
|
|
13
|
+
|
|
14
|
+
if (!clerk) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (clerk.session) {
|
|
19
|
+
useAuthState.setState({
|
|
20
|
+
isAuthenticated: true,
|
|
21
|
+
isPending: false,
|
|
22
|
+
profile: {
|
|
23
|
+
sub: clerk.session.user.id,
|
|
24
|
+
name: clerk.session.user.fullName ?? undefined,
|
|
25
|
+
email: clerk.session.user.emailAddresses[0]?.emailAddress,
|
|
26
|
+
emailVerified: false, // TODO: Check this
|
|
27
|
+
pictureUrl: clerk.session.user.imageUrl,
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
} else {
|
|
31
|
+
useAuthState.setState({
|
|
32
|
+
isAuthenticated: false,
|
|
33
|
+
isPending: false,
|
|
34
|
+
profile: undefined,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
6
40
|
const clerkAuth: AuthenticationProviderInitializer<
|
|
7
41
|
ClerkAuthenticationConfig
|
|
8
|
-
> = ({
|
|
42
|
+
> = ({
|
|
43
|
+
clerkPubKey,
|
|
44
|
+
redirectToAfterSignOut = "/",
|
|
45
|
+
redirectToAfterSignUp = "/",
|
|
46
|
+
redirectToAfterSignIn = "/",
|
|
47
|
+
}) => {
|
|
9
48
|
let clerkApi: Clerk;
|
|
10
|
-
|
|
11
49
|
const ensureLoaded = (async () => {
|
|
50
|
+
if (typeof window === "undefined") return;
|
|
12
51
|
const { Clerk } = await import("@clerk/clerk-js");
|
|
13
52
|
clerkApi = new Clerk(clerkPubKey);
|
|
14
53
|
|
|
15
|
-
await clerkApi.load(
|
|
54
|
+
await clerkApi.load();
|
|
55
|
+
return clerkApi;
|
|
16
56
|
})();
|
|
17
57
|
|
|
18
58
|
async function getAccessToken() {
|
|
@@ -28,38 +68,30 @@ const clerkAuth: AuthenticationProviderInitializer<
|
|
|
28
68
|
}
|
|
29
69
|
|
|
30
70
|
return {
|
|
31
|
-
|
|
71
|
+
getAccessToken,
|
|
72
|
+
signOut: async () => {
|
|
32
73
|
await ensureLoaded;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
isAuthenticated: true,
|
|
37
|
-
isPending: false,
|
|
38
|
-
profile: {
|
|
39
|
-
sub: clerkApi.session.user.id,
|
|
40
|
-
name: clerkApi.session.user.fullName ?? undefined,
|
|
41
|
-
email: clerkApi.session.user.emailAddresses[0]?.emailAddress,
|
|
42
|
-
emailVerified: false, // TODO: Check this
|
|
43
|
-
// emailVerified: clerkApi.session.user.hasVerifiedEmailAddress,
|
|
44
|
-
pictureUrl: clerkApi.session.user.imageUrl,
|
|
45
|
-
},
|
|
46
|
-
});
|
|
47
|
-
} else {
|
|
48
|
-
useAuthState.setState({
|
|
49
|
-
isAuthenticated: false,
|
|
50
|
-
isPending: false,
|
|
51
|
-
profile: undefined,
|
|
52
|
-
});
|
|
53
|
-
}
|
|
74
|
+
await clerkApi.signOut({
|
|
75
|
+
redirectUrl: window.location.origin + redirectToAfterSignOut,
|
|
76
|
+
});
|
|
54
77
|
},
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
await clerkApi.
|
|
78
|
+
signIn: async () => {
|
|
79
|
+
await ensureLoaded;
|
|
80
|
+
await clerkApi.redirectToSignIn({
|
|
81
|
+
signInForceRedirectUrl: window.location.origin + redirectToAfterSignIn,
|
|
82
|
+
signUpForceRedirectUrl: window.location.origin + redirectToAfterSignUp,
|
|
83
|
+
});
|
|
84
|
+
},
|
|
85
|
+
signUp: async () => {
|
|
86
|
+
await ensureLoaded;
|
|
87
|
+
await clerkApi.redirectToSignUp({
|
|
88
|
+
signInForceRedirectUrl: window.location.origin + redirectToAfterSignIn,
|
|
89
|
+
signUpForceRedirectUrl: window.location.origin + redirectToAfterSignUp,
|
|
90
|
+
});
|
|
58
91
|
},
|
|
59
|
-
|
|
60
|
-
|
|
92
|
+
getAuthenticationPlugin() {
|
|
93
|
+
return new ClerkAuthPlugin(ensureLoaded);
|
|
61
94
|
},
|
|
62
|
-
getRoutes: () => [],
|
|
63
95
|
};
|
|
64
96
|
};
|
|
65
97
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import logger from "loglevel";
|
|
2
2
|
import * as oauth from "oauth4webapi";
|
|
3
3
|
import { OpenIDAuthenticationConfig } from "../../../config/config.js";
|
|
4
|
-
import { RouteObject } from "../../core/router.js";
|
|
5
4
|
import {
|
|
6
5
|
AuthenticationProvider,
|
|
7
6
|
AuthenticationProviderInitializer,
|
|
8
7
|
} from "../authentication.js";
|
|
8
|
+
import { AuthenticationPlugin } from "../AuthenticationPlugin.js";
|
|
9
9
|
import { Callback } from "../Callback.js";
|
|
10
10
|
import { AuthorizationError, OAuthAuthorizationError } from "../errors.js";
|
|
11
11
|
import { useAuthState, UserProfile } from "../state.js";
|
|
@@ -19,6 +19,24 @@ interface TokenState {
|
|
|
19
19
|
tokenType: string;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
class OpenIdAuthPlugin extends AuthenticationPlugin {
|
|
23
|
+
constructor(
|
|
24
|
+
private callbackUrlPath: string,
|
|
25
|
+
private handleCallback: () => Promise<void>,
|
|
26
|
+
) {
|
|
27
|
+
super();
|
|
28
|
+
}
|
|
29
|
+
getRoutes() {
|
|
30
|
+
return [
|
|
31
|
+
...super.getRoutes(),
|
|
32
|
+
{
|
|
33
|
+
path: this.callbackUrlPath,
|
|
34
|
+
element: <Callback handleCallback={this.handleCallback} />,
|
|
35
|
+
},
|
|
36
|
+
];
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
22
40
|
export class OpenIDAuthenticationProvider implements AuthenticationProvider {
|
|
23
41
|
protected client: oauth.Client;
|
|
24
42
|
protected issuer: string;
|
|
@@ -30,12 +48,18 @@ export class OpenIDAuthenticationProvider implements AuthenticationProvider {
|
|
|
30
48
|
|
|
31
49
|
protected callbackUrlPath = "/oauth/callback";
|
|
32
50
|
protected logoutRedirectUrlPath = "/";
|
|
51
|
+
private redirectToAfterSignUp?: string;
|
|
52
|
+
private redirectToAfterSignIn?: string;
|
|
53
|
+
private redirectToAfterSignOut?: string;
|
|
33
54
|
|
|
34
55
|
constructor({
|
|
35
56
|
issuer,
|
|
36
57
|
authorizationEndpoint,
|
|
37
58
|
tokenEndpoint,
|
|
38
59
|
clientId,
|
|
60
|
+
redirectToAfterSignUp,
|
|
61
|
+
redirectToAfterSignIn,
|
|
62
|
+
redirectToAfterSignOut,
|
|
39
63
|
}: OpenIDAuthenticationConfig) {
|
|
40
64
|
this.client = {
|
|
41
65
|
client_id: clientId,
|
|
@@ -44,6 +68,9 @@ export class OpenIDAuthenticationProvider implements AuthenticationProvider {
|
|
|
44
68
|
this.issuer = issuer;
|
|
45
69
|
this.authorizationEndpoint = authorizationEndpoint;
|
|
46
70
|
this.tokenEndpoint = tokenEndpoint;
|
|
71
|
+
this.redirectToAfterSignUp = redirectToAfterSignUp ?? "/";
|
|
72
|
+
this.redirectToAfterSignIn = redirectToAfterSignIn ?? "/";
|
|
73
|
+
this.redirectToAfterSignOut = redirectToAfterSignOut ?? "/";
|
|
47
74
|
}
|
|
48
75
|
|
|
49
76
|
protected async getAuthServer() {
|
|
@@ -91,11 +118,15 @@ export class OpenIDAuthenticationProvider implements AuthenticationProvider {
|
|
|
91
118
|
};
|
|
92
119
|
}
|
|
93
120
|
|
|
94
|
-
async
|
|
95
|
-
|
|
121
|
+
async signUp() {
|
|
122
|
+
return this.authorize(true);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
async signIn() {
|
|
126
|
+
return this.authorize();
|
|
96
127
|
}
|
|
97
128
|
|
|
98
|
-
async
|
|
129
|
+
private async authorize(signUp = false): Promise<void> {
|
|
99
130
|
const code_challenge_method = "S256";
|
|
100
131
|
const authorizationServer = await this.getAuthServer();
|
|
101
132
|
|
|
@@ -115,10 +146,18 @@ export class OpenIDAuthenticationProvider implements AuthenticationProvider {
|
|
|
115
146
|
|
|
116
147
|
// redirect user to as.authorization_endpoint
|
|
117
148
|
const authorizationUrl = new URL(
|
|
118
|
-
|
|
149
|
+
signUp
|
|
150
|
+
? authorizationServer.registration_endpoint ??
|
|
151
|
+
authorizationServer.authorization_endpoint
|
|
152
|
+
: authorizationServer.authorization_endpoint,
|
|
119
153
|
);
|
|
120
154
|
|
|
121
|
-
const redirectUrl = new URL(
|
|
155
|
+
const redirectUrl = new URL(
|
|
156
|
+
(signUp
|
|
157
|
+
? window.location.origin + this.redirectToAfterSignUp
|
|
158
|
+
: window.location.origin + this.redirectToAfterSignIn) ??
|
|
159
|
+
window.location.href,
|
|
160
|
+
);
|
|
122
161
|
redirectUrl.pathname = this.callbackUrlPath;
|
|
123
162
|
redirectUrl.search = "";
|
|
124
163
|
|
|
@@ -147,6 +186,7 @@ export class OpenIDAuthenticationProvider implements AuthenticationProvider {
|
|
|
147
186
|
// now redirect the user to authorizationUrl.href
|
|
148
187
|
location.href = authorizationUrl.href;
|
|
149
188
|
}
|
|
189
|
+
|
|
150
190
|
async getAccessToken(): Promise<string> {
|
|
151
191
|
const as = await this.getAuthServer();
|
|
152
192
|
if (!this.tokens) {
|
|
@@ -177,7 +217,7 @@ export class OpenIDAuthenticationProvider implements AuthenticationProvider {
|
|
|
177
217
|
return this.tokens.accessToken;
|
|
178
218
|
}
|
|
179
219
|
|
|
180
|
-
async
|
|
220
|
+
async signOut(): Promise<void> {
|
|
181
221
|
useAuthState.setState({
|
|
182
222
|
isAuthenticated: false,
|
|
183
223
|
isPending: false,
|
|
@@ -186,7 +226,9 @@ export class OpenIDAuthenticationProvider implements AuthenticationProvider {
|
|
|
186
226
|
|
|
187
227
|
const as = await this.getAuthServer();
|
|
188
228
|
|
|
189
|
-
const redirectUrl = new URL(
|
|
229
|
+
const redirectUrl = new URL(
|
|
230
|
+
window.location.origin + this.redirectToAfterSignOut,
|
|
231
|
+
);
|
|
190
232
|
redirectUrl.pathname = this.logoutRedirectUrlPath;
|
|
191
233
|
|
|
192
234
|
let logoutUrl: URL;
|
|
@@ -207,14 +249,6 @@ export class OpenIDAuthenticationProvider implements AuthenticationProvider {
|
|
|
207
249
|
logoutUrl = redirectUrl;
|
|
208
250
|
}
|
|
209
251
|
}
|
|
210
|
-
getRoutes(): RouteObject[] {
|
|
211
|
-
return [
|
|
212
|
-
{
|
|
213
|
-
path: this.callbackUrlPath,
|
|
214
|
-
element: <Callback handleCallback={this.handleCallback} />,
|
|
215
|
-
},
|
|
216
|
-
];
|
|
217
|
-
}
|
|
218
252
|
|
|
219
253
|
handleCallback = async (): Promise<void> => {
|
|
220
254
|
const url = new URL(window.location.href);
|
|
@@ -305,6 +339,12 @@ export class OpenIDAuthenticationProvider implements AuthenticationProvider {
|
|
|
305
339
|
// Returning true because we are using react query
|
|
306
340
|
// return true;
|
|
307
341
|
};
|
|
342
|
+
|
|
343
|
+
getAuthenticationPlugin() {
|
|
344
|
+
return new OpenIdAuthPlugin(this.callbackUrlPath, () =>
|
|
345
|
+
this.handleCallback(),
|
|
346
|
+
);
|
|
347
|
+
}
|
|
308
348
|
}
|
|
309
349
|
|
|
310
350
|
const openIDAuth: AuthenticationProviderInitializer<
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { type HelmetData, HelmetProvider } from "@zudoku/react-helmet-async";
|
|
2
|
+
import { StrictMode } from "react";
|
|
3
|
+
import { createBrowserRouter, RouterProvider } from "react-router-dom";
|
|
4
|
+
import {
|
|
5
|
+
type StaticHandlerContext,
|
|
6
|
+
StaticRouterProvider,
|
|
7
|
+
} from "react-router-dom/server.js";
|
|
8
|
+
import { StaggeredRenderContext } from "../plugins/openapi/StaggeredRender.js";
|
|
9
|
+
|
|
10
|
+
const Bootstrap = ({
|
|
11
|
+
router,
|
|
12
|
+
hydrate = false,
|
|
13
|
+
}: {
|
|
14
|
+
hydrate?: boolean;
|
|
15
|
+
router: ReturnType<typeof createBrowserRouter>;
|
|
16
|
+
}) => {
|
|
17
|
+
return (
|
|
18
|
+
<StrictMode>
|
|
19
|
+
<HelmetProvider>
|
|
20
|
+
<StaggeredRenderContext.Provider value={{ stagger: !hydrate }}>
|
|
21
|
+
<RouterProvider router={router} />
|
|
22
|
+
</StaggeredRenderContext.Provider>
|
|
23
|
+
</HelmetProvider>
|
|
24
|
+
</StrictMode>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const BootstrapStatic = ({
|
|
29
|
+
router,
|
|
30
|
+
context,
|
|
31
|
+
helmetContext,
|
|
32
|
+
}: {
|
|
33
|
+
helmetContext: HelmetData["context"];
|
|
34
|
+
context: StaticHandlerContext;
|
|
35
|
+
router: ReturnType<typeof createBrowserRouter>;
|
|
36
|
+
}) => (
|
|
37
|
+
<StrictMode>
|
|
38
|
+
<HelmetProvider context={helmetContext}>
|
|
39
|
+
<StaticRouterProvider router={router} context={context} />
|
|
40
|
+
</HelmetProvider>
|
|
41
|
+
</StrictMode>
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
export { Bootstrap, BootstrapStatic };
|