zudoku 0.3.0-dev.6 → 0.3.0-dev.60
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 +5 -39
- package/dist/config/validators/validate.d.ts +878 -2
- package/dist/config/validators/validate.js +144 -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 +16 -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 +3 -4
- package/dist/lib/authentication/components/Login.d.ts +1 -0
- package/dist/lib/authentication/components/Login.js +10 -0
- package/dist/lib/authentication/components/Login.js.map +1 -0
- package/dist/lib/authentication/components/Logout.d.ts +1 -0
- package/dist/lib/authentication/components/Logout.js +10 -0
- package/dist/lib/authentication/components/Logout.js.map +1 -0
- package/dist/lib/authentication/providers/clerk.js +45 -27
- package/dist/lib/authentication/providers/clerk.js.map +1 -1
- package/dist/lib/authentication/providers/openid.d.ts +11 -3
- package/dist/lib/authentication/providers/openid.js +22 -11
- package/dist/lib/authentication/providers/openid.js.map +1 -1
- package/dist/lib/authentication/routes.d.ts +5 -0
- package/dist/lib/authentication/routes.js +12 -0
- package/dist/lib/authentication/routes.js.map +1 -0
- 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-CG6Bw32B.js +46 -0
- package/lib/AuthenticationPlugin-CG6Bw32B.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-Q_gAL2NZ.js +93 -0
- package/lib/hook-Q_gAL2NZ.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 +2 -1
- package/lib/zudoku.auth-auth0.js.map +1 -0
- package/lib/zudoku.auth-clerk.js +48 -31
- package/lib/zudoku.auth-clerk.js.map +1 -0
- package/lib/zudoku.auth-openid.js +608 -448
- 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 +36 -0
- package/src/lib/authentication/Callback.tsx +1 -1
- package/src/lib/authentication/authentication.ts +3 -7
- package/src/lib/authentication/components/Login.tsx +11 -0
- package/src/lib/authentication/components/Logout.tsx +11 -0
- package/src/lib/authentication/providers/clerk.tsx +44 -27
- package/src/lib/authentication/providers/openid.tsx +25 -13
- package/src/lib/authentication/routes.tsx +10 -0
- 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 +52 -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,36 @@
|
|
|
1
|
+
import type { RouteObject } from "react-router-dom";
|
|
2
|
+
import {
|
|
3
|
+
CommonPlugin,
|
|
4
|
+
NavigationPlugin,
|
|
5
|
+
ProfileMenuPlugin,
|
|
6
|
+
} from "../core/plugins.js";
|
|
7
|
+
import { Login } from "./components/Login.js";
|
|
8
|
+
import { Logout } from "./components/Logout.js";
|
|
9
|
+
|
|
10
|
+
type PluginInterface = NavigationPlugin & CommonPlugin & ProfileMenuPlugin;
|
|
11
|
+
|
|
12
|
+
export class AuthenticationPlugin implements PluginInterface {
|
|
13
|
+
constructor(private additionalRoutes: RouteObject[] = []) {}
|
|
14
|
+
getRoutes() {
|
|
15
|
+
return [
|
|
16
|
+
{
|
|
17
|
+
path: "/logout",
|
|
18
|
+
element: <Logout />,
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
path: "/login",
|
|
22
|
+
element: <Login />,
|
|
23
|
+
},
|
|
24
|
+
...this.additionalRoutes,
|
|
25
|
+
];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
getProfileMenuItems() {
|
|
29
|
+
return [
|
|
30
|
+
{
|
|
31
|
+
label: "Logout",
|
|
32
|
+
path: "/logout",
|
|
33
|
+
},
|
|
34
|
+
];
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
InitializationPlugin,
|
|
3
|
-
NavigationPlugin,
|
|
4
|
-
} from "../../lib/core/plugins.js";
|
|
1
|
+
import { DevPortalPlugin } from "../core/plugins.js";
|
|
5
2
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export interface AuthenticationProvider extends AuthenticationPlugin {
|
|
3
|
+
export interface AuthenticationProvider {
|
|
9
4
|
login(): Promise<void>;
|
|
10
5
|
getAccessToken(): Promise<string>;
|
|
11
6
|
logout(): Promise<void>;
|
|
7
|
+
getAuthenticationPlugin?(): DevPortalPlugin;
|
|
12
8
|
}
|
|
13
9
|
|
|
14
10
|
/**
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
import { useDevPortal } from "../../components/context/DevPortalProvider.js";
|
|
3
|
+
|
|
4
|
+
export const Login = () => {
|
|
5
|
+
const context = useDevPortal();
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
void context.authentication?.login();
|
|
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 Logout = () => {
|
|
5
|
+
const context = useDevPortal();
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
void context.authentication?.logout();
|
|
8
|
+
}, [context.authentication]);
|
|
9
|
+
|
|
10
|
+
return null;
|
|
11
|
+
};
|
|
@@ -1,18 +1,54 @@
|
|
|
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
|
> = ({ clerkPubKey }) => {
|
|
9
43
|
let clerkApi: Clerk;
|
|
10
44
|
|
|
11
45
|
const ensureLoaded = (async () => {
|
|
46
|
+
if (typeof window === "undefined") return;
|
|
12
47
|
const { Clerk } = await import("@clerk/clerk-js");
|
|
13
48
|
clerkApi = new Clerk(clerkPubKey);
|
|
14
49
|
|
|
15
|
-
await clerkApi.load(
|
|
50
|
+
await clerkApi.load();
|
|
51
|
+
return clerkApi;
|
|
16
52
|
})();
|
|
17
53
|
|
|
18
54
|
async function getAccessToken() {
|
|
@@ -28,38 +64,19 @@ const clerkAuth: AuthenticationProviderInitializer<
|
|
|
28
64
|
}
|
|
29
65
|
|
|
30
66
|
return {
|
|
31
|
-
initialize: async () => {
|
|
32
|
-
await ensureLoaded;
|
|
33
|
-
|
|
34
|
-
if (clerkApi.session) {
|
|
35
|
-
useAuthState.setState({
|
|
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
|
-
}
|
|
54
|
-
},
|
|
55
67
|
getAccessToken,
|
|
56
68
|
logout: async () => {
|
|
57
69
|
await clerkApi.signOut();
|
|
58
70
|
},
|
|
59
71
|
login: async () => {
|
|
60
|
-
await clerkApi.redirectToSignIn(
|
|
72
|
+
await clerkApi.redirectToSignIn({
|
|
73
|
+
signInForceRedirectUrl: "http://localhost:9000/",
|
|
74
|
+
signUpForceRedirectUrl: "http://localhost:9000/",
|
|
75
|
+
});
|
|
76
|
+
},
|
|
77
|
+
getAuthenticationPlugin() {
|
|
78
|
+
return new ClerkAuthPlugin(ensureLoaded);
|
|
61
79
|
},
|
|
62
|
-
getRoutes: () => [],
|
|
63
80
|
};
|
|
64
81
|
};
|
|
65
82
|
|
|
@@ -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;
|
|
@@ -91,10 +109,6 @@ export class OpenIDAuthenticationProvider implements AuthenticationProvider {
|
|
|
91
109
|
};
|
|
92
110
|
}
|
|
93
111
|
|
|
94
|
-
async initialize() {
|
|
95
|
-
// No init needed
|
|
96
|
-
}
|
|
97
|
-
|
|
98
112
|
async login(): Promise<void> {
|
|
99
113
|
const code_challenge_method = "S256";
|
|
100
114
|
const authorizationServer = await this.getAuthServer();
|
|
@@ -207,14 +221,6 @@ export class OpenIDAuthenticationProvider implements AuthenticationProvider {
|
|
|
207
221
|
logoutUrl = redirectUrl;
|
|
208
222
|
}
|
|
209
223
|
}
|
|
210
|
-
getRoutes(): RouteObject[] {
|
|
211
|
-
return [
|
|
212
|
-
{
|
|
213
|
-
path: this.callbackUrlPath,
|
|
214
|
-
element: <Callback handleCallback={this.handleCallback} />,
|
|
215
|
-
},
|
|
216
|
-
];
|
|
217
|
-
}
|
|
218
224
|
|
|
219
225
|
handleCallback = async (): Promise<void> => {
|
|
220
226
|
const url = new URL(window.location.href);
|
|
@@ -305,6 +311,12 @@ export class OpenIDAuthenticationProvider implements AuthenticationProvider {
|
|
|
305
311
|
// Returning true because we are using react query
|
|
306
312
|
// return true;
|
|
307
313
|
};
|
|
314
|
+
|
|
315
|
+
getAuthenticationPlugin() {
|
|
316
|
+
return new OpenIdAuthPlugin(this.callbackUrlPath, () =>
|
|
317
|
+
this.handleCallback(),
|
|
318
|
+
);
|
|
319
|
+
}
|
|
308
320
|
}
|
|
309
321
|
|
|
310
322
|
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 };
|
|
@@ -1,28 +1,33 @@
|
|
|
1
1
|
import { MDXProvider } from "@mdx-js/react";
|
|
2
2
|
import { QueryClientProvider } from "@tanstack/react-query";
|
|
3
|
-
import {
|
|
3
|
+
import { Helmet } from "@zudoku/react-helmet-async";
|
|
4
|
+
import {
|
|
5
|
+
Fragment,
|
|
6
|
+
memo,
|
|
7
|
+
type PropsWithChildren,
|
|
8
|
+
useContext,
|
|
9
|
+
useEffect,
|
|
10
|
+
useMemo,
|
|
11
|
+
useState,
|
|
12
|
+
} from "react";
|
|
13
|
+
import { ErrorBoundary } from "react-error-boundary";
|
|
14
|
+
import { useNavigation } from "react-router-dom";
|
|
4
15
|
import {
|
|
5
16
|
DevPortalContext,
|
|
6
17
|
queryClient,
|
|
7
|
-
|
|
18
|
+
ZudokuContextOptions,
|
|
8
19
|
} from "../core/DevPortalContext.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
MdxComponents,
|
|
15
|
-
type MdxComponentsType,
|
|
16
|
-
} from "../util/MdxComponents.js";
|
|
20
|
+
import { hasHead } from "../core/plugins.js";
|
|
21
|
+
import { TopLevelError } from "../errors/TopLevelError.js";
|
|
22
|
+
import { StaggeredRenderContext } from "../plugins/openapi/StaggeredRender.js";
|
|
23
|
+
import { MdxComponents } from "../util/MdxComponents.js";
|
|
17
24
|
import {
|
|
18
25
|
ComponentsProvider,
|
|
19
26
|
DEFAULT_COMPONENTS,
|
|
20
|
-
type ComponentsContextType,
|
|
21
27
|
} from "./context/ComponentsContext.js";
|
|
22
28
|
import { DevPortalProvider } from "./context/DevPortalProvider.js";
|
|
23
29
|
import { ThemeProvider } from "./context/ThemeContext.js";
|
|
24
30
|
import { ViewportAnchorProvider } from "./context/ViewportAnchorContext.js";
|
|
25
|
-
import { Router } from "./Router.js";
|
|
26
31
|
|
|
27
32
|
export const DevPortalSystemPaths = {
|
|
28
33
|
Settings: "/settings",
|
|
@@ -32,31 +37,33 @@ export type DevPortalPath =
|
|
|
32
37
|
| string
|
|
33
38
|
| (typeof DevPortalSystemPaths)[keyof typeof DevPortalSystemPaths];
|
|
34
39
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
description: string;
|
|
40
|
-
logo: string;
|
|
41
|
-
favicon: string;
|
|
42
|
-
}>;
|
|
43
|
-
authentication?: AuthenticationProvider;
|
|
44
|
-
navigation: NavigationItem[];
|
|
45
|
-
plugins?: DevPortalPlugin[];
|
|
46
|
-
mdxComponents?: MdxComponentsType;
|
|
47
|
-
overrides?: ComponentsContextType;
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
const DevPortalInner = (props: DevPortalProps) => {
|
|
40
|
+
const DevPortalInner = ({
|
|
41
|
+
children,
|
|
42
|
+
...props
|
|
43
|
+
}: PropsWithChildren<ZudokuContextOptions>) => {
|
|
51
44
|
const components = useMemo(
|
|
52
45
|
() => ({ ...DEFAULT_COMPONENTS, ...props.overrides }),
|
|
53
46
|
[props.overrides],
|
|
54
47
|
);
|
|
55
48
|
|
|
56
49
|
const mdxComponents = useMemo(
|
|
57
|
-
() => ({ ...MdxComponents, ...props.
|
|
58
|
-
[props.
|
|
50
|
+
() => ({ ...MdxComponents, ...props.mdx?.components }),
|
|
51
|
+
[props.mdx?.components],
|
|
52
|
+
);
|
|
53
|
+
const { stagger } = useContext(StaggeredRenderContext);
|
|
54
|
+
const [didNavigate, setDidNavigate] = useState(false);
|
|
55
|
+
const staggeredValue = useMemo(
|
|
56
|
+
() => (didNavigate ? { stagger: true } : { stagger }),
|
|
57
|
+
[stagger, didNavigate],
|
|
59
58
|
);
|
|
59
|
+
const navigation = useNavigation();
|
|
60
|
+
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
if (didNavigate) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
setDidNavigate(true);
|
|
66
|
+
}, [didNavigate, navigation.location]);
|
|
60
67
|
|
|
61
68
|
const devPortalContext = useMemo(() => new DevPortalContext(props), [props]);
|
|
62
69
|
|
|
@@ -64,39 +71,38 @@ const DevPortalInner = (props: DevPortalProps) => {
|
|
|
64
71
|
void devPortalContext.initialize();
|
|
65
72
|
}, [devPortalContext]);
|
|
66
73
|
|
|
74
|
+
const heads = props.plugins
|
|
75
|
+
?.filter(hasHead)
|
|
76
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
77
|
+
.map((plugin, i) => <Fragment key={i}>{plugin.getHead?.()}</Fragment>);
|
|
78
|
+
|
|
67
79
|
return (
|
|
68
80
|
<QueryClientProvider client={queryClient}>
|
|
69
|
-
<
|
|
81
|
+
<Helmet>{heads}</Helmet>
|
|
82
|
+
<StaggeredRenderContext.Provider value={staggeredValue}>
|
|
70
83
|
<DevPortalProvider value={devPortalContext}>
|
|
71
84
|
<MDXProvider components={mdxComponents}>
|
|
72
85
|
<ThemeProvider>
|
|
73
86
|
<ComponentsProvider value={components}>
|
|
74
|
-
<ViewportAnchorProvider>
|
|
75
|
-
<Suspense
|
|
76
|
-
fallback={
|
|
77
|
-
<div className="grid place-items-center h-full">
|
|
78
|
-
Loading...
|
|
79
|
-
</div>
|
|
80
|
-
}
|
|
81
|
-
>
|
|
82
|
-
<Router
|
|
83
|
-
plugins={[
|
|
84
|
-
...(props.plugins ?? []),
|
|
85
|
-
...(props.authentication ? [props.authentication] : []),
|
|
86
|
-
]}
|
|
87
|
-
/>
|
|
88
|
-
</Suspense>
|
|
89
|
-
</ViewportAnchorProvider>
|
|
87
|
+
<ViewportAnchorProvider>{children}</ViewportAnchorProvider>
|
|
90
88
|
</ComponentsProvider>
|
|
91
89
|
</ThemeProvider>
|
|
92
90
|
</MDXProvider>
|
|
93
91
|
</DevPortalProvider>
|
|
94
|
-
</
|
|
92
|
+
</StaggeredRenderContext.Provider>
|
|
95
93
|
</QueryClientProvider>
|
|
96
94
|
);
|
|
97
95
|
};
|
|
98
96
|
|
|
99
|
-
const
|
|
97
|
+
const Inner = memo(DevPortalInner);
|
|
98
|
+
|
|
99
|
+
const DevPortal = (props: ZudokuContextOptions) => {
|
|
100
|
+
return (
|
|
101
|
+
<ErrorBoundary FallbackComponent={TopLevelError}>
|
|
102
|
+
<Inner {...props} />
|
|
103
|
+
</ErrorBoundary>
|
|
104
|
+
);
|
|
105
|
+
};
|
|
100
106
|
DevPortal.displayName = "DevPortal";
|
|
101
107
|
|
|
102
108
|
export { DevPortal };
|