zudoku 0.3.0-dev.9 → 0.3.0-dev.91
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/cli.js +5 -1
- 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 +33 -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 +74 -12
- package/dist/app/main.js.map +1 -1
- package/dist/app/standalone.d.ts +2 -0
- package/dist/app/standalone.js +38 -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 +21 -46
- package/dist/config/validators/InputSidebarSchema.d.ts +176 -0
- package/dist/config/validators/InputSidebarSchema.js +71 -0
- package/dist/config/validators/InputSidebarSchema.js.map +1 -0
- package/dist/config/validators/SidebarSchema.d.ts +17 -0
- package/dist/config/validators/SidebarSchema.js +76 -0
- package/dist/config/validators/SidebarSchema.js.map +1 -0
- package/dist/config/validators/validate.d.ts +1263 -2
- package/dist/config/validators/validate.js +170 -1
- package/dist/config/validators/validate.js.map +1 -1
- package/dist/index.d.ts +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/authentication.d.ts +10 -9
- package/dist/lib/authentication/components/SignIn.d.ts +1 -0
- package/dist/lib/authentication/components/SignIn.js +14 -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 +12 -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 +4 -4
- package/dist/lib/authentication/hook.js.map +1 -1
- package/dist/lib/authentication/providers/auth0.js +11 -6
- 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 +30 -7
- package/dist/lib/authentication/providers/openid.js +79 -29
- package/dist/lib/authentication/providers/openid.js.map +1 -1
- package/dist/lib/authentication/state.js +1 -1
- package/dist/lib/authentication/state.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 +5 -23
- package/dist/lib/components/DevPortal.js +43 -20
- 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 +23 -4
- 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 +7 -5
- 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/SlotletProvider.d.ts +9 -0
- package/dist/lib/components/SlotletProvider.js +11 -0
- package/dist/lib/components/SlotletProvider.js.map +1 -0
- package/dist/lib/components/SyntaxHighlight.d.ts +3 -2
- package/dist/lib/components/SyntaxHighlight.js +24 -22
- package/dist/lib/components/SyntaxHighlight.js.map +1 -1
- package/dist/lib/components/TopNavigation.d.ts +1 -1
- package/dist/lib/components/TopNavigation.js +8 -4
- package/dist/lib/components/TopNavigation.js.map +1 -1
- package/dist/lib/components/context/ThemeContext.d.ts +1 -4
- package/dist/lib/components/context/ThemeContext.js +3 -29
- package/dist/lib/components/context/ThemeContext.js.map +1 -1
- package/dist/lib/components/context/ThemeProvider.d.ts +4 -0
- package/dist/lib/components/context/ThemeProvider.js +23 -0
- package/dist/lib/components/context/ThemeProvider.js.map +1 -0
- package/dist/lib/components/context/ZudokuContext.d.ts +15 -0
- package/dist/lib/components/context/ZudokuContext.js +46 -0
- package/dist/lib/components/context/ZudokuContext.js.map +1 -0
- package/dist/lib/components/context/ZudokuProvider.d.ts +5 -0
- package/dist/lib/components/context/ZudokuProvider.js +16 -0
- package/dist/lib/components/context/ZudokuProvider.js.map +1 -0
- 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/Sidebar.d.ts +1 -0
- package/dist/lib/components/navigation/Sidebar.js +12 -0
- package/dist/lib/components/navigation/Sidebar.js.map +1 -0
- package/dist/lib/components/navigation/SidebarBadge.d.ts +22 -0
- package/dist/lib/components/navigation/SidebarBadge.js +24 -0
- package/dist/lib/components/navigation/SidebarBadge.js.map +1 -0
- package/dist/lib/components/navigation/SidebarCategory.d.ts +5 -0
- package/dist/lib/components/navigation/SidebarCategory.js +33 -0
- package/dist/lib/components/navigation/SidebarCategory.js.map +1 -0
- package/dist/lib/components/navigation/SidebarItem.d.ts +12 -0
- package/dist/lib/components/navigation/SidebarItem.js +42 -0
- package/dist/lib/components/navigation/SidebarItem.js.map +1 -0
- package/dist/lib/components/navigation/{SideNavigationWrapper.d.ts → SidebarWrapper.d.ts} +1 -1
- package/dist/lib/components/navigation/{SideNavigationWrapper.js → SidebarWrapper.js} +2 -2
- package/dist/lib/components/navigation/SidebarWrapper.js.map +1 -0
- package/dist/lib/components/navigation/utils.d.ts +16 -0
- package/dist/lib/components/navigation/utils.js +85 -0
- package/dist/lib/components/navigation/utils.js.map +1 -0
- package/dist/lib/core/DevPortalContext.d.ts +58 -42
- package/dist/lib/core/DevPortalContext.js +18 -19
- package/dist/lib/core/DevPortalContext.js.map +1 -1
- package/dist/lib/core/plugins.d.ts +25 -10
- package/dist/lib/core/plugins.js +3 -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 +8 -5
- 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 +4 -4
- 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 +54 -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 +18 -20
- 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 +10 -40
- package/dist/lib/plugins/markdown/MdxPage.js.map +1 -1
- package/dist/lib/plugins/markdown/Toc.js +17 -9
- 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 +20 -43
- 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/ColorizedParam.d.ts +2 -1
- package/dist/lib/plugins/openapi/ColorizedParam.js +14 -9
- package/dist/lib/plugins/openapi/ColorizedParam.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 +11 -5
- package/dist/lib/plugins/openapi/OperationListItem.js.map +1 -1
- package/dist/lib/plugins/openapi/ParameterList.js +2 -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} +2 -1
- package/dist/lib/plugins/openapi/PlaygroundDialogWrapper.js +23 -0
- package/dist/lib/plugins/openapi/PlaygroundDialogWrapper.js.map +1 -0
- package/dist/lib/plugins/openapi/RequestBodySidecarBox.js +3 -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 +10 -26
- package/dist/lib/plugins/openapi/SchemaListView.js.map +1 -1
- package/dist/lib/plugins/openapi/SchemaListViewItem.d.ts +8 -0
- package/dist/lib/plugins/openapi/SchemaListViewItem.js +25 -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.d.ts +4 -0
- package/dist/lib/plugins/openapi/Sidecar.js +55 -21
- package/dist/lib/plugins/openapi/Sidecar.js.map +1 -1
- package/dist/lib/plugins/openapi/SidecarBox.d.ts +1 -0
- package/dist/lib/plugins/openapi/SidecarBox.js +3 -2
- 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/graphql/gql.d.ts +6 -6
- package/dist/lib/plugins/openapi/graphql/gql.js +1 -1
- package/dist/lib/plugins/openapi/graphql/gql.js.map +1 -1
- package/dist/lib/plugins/openapi/graphql/graphql.d.ts +15 -15
- package/dist/lib/plugins/openapi/graphql/graphql.js +67 -67
- package/dist/lib/plugins/openapi/graphql/graphql.js.map +1 -1
- package/dist/lib/plugins/openapi/index.d.ts +4 -18
- package/dist/lib/plugins/openapi/index.js +76 -32
- package/dist/lib/plugins/openapi/index.js.map +1 -1
- package/dist/lib/plugins/openapi/interfaces.d.ts +16 -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.js +1 -1
- package/dist/lib/plugins/openapi/playground/Headers.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/PathParams.d.ts +4 -5
- package/dist/lib/plugins/openapi/playground/PathParams.js +9 -13
- package/dist/lib/plugins/openapi/playground/PathParams.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/Playground.d.ts +26 -14
- package/dist/lib/plugins/openapi/playground/Playground.js +54 -26
- package/dist/lib/plugins/openapi/playground/Playground.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/PlaygroundDialog.d.ts +5 -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 +4 -3
- package/dist/lib/plugins/openapi/playground/QueryParams.js +21 -12
- package/dist/lib/plugins/openapi/playground/QueryParams.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/ResponseTab.d.ts +4 -0
- package/dist/lib/plugins/openapi/playground/ResponseTab.js +40 -0
- package/dist/lib/plugins/openapi/playground/ResponseTab.js.map +1 -0
- package/dist/lib/plugins/openapi/playground/createUrl.d.ts +1 -1
- package/dist/lib/plugins/openapi/playground/createUrl.js +5 -9
- package/dist/lib/plugins/openapi/playground/createUrl.js.map +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/Button.d.ts +5 -1
- package/dist/lib/ui/Button.js +24 -1
- package/dist/lib/ui/Button.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/Input.js.map +1 -0
- 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/fetchTimeout.d.ts +1 -0
- package/dist/lib/util/fetchTimeout.js +14 -0
- package/dist/lib/util/fetchTimeout.js.map +1 -0
- 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/invariant.d.ts +6 -0
- package/dist/lib/util/invariant.js +21 -0
- package/dist/lib/util/invariant.js.map +1 -0
- 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/lib/util/requestIdleCallbackPolyfill.d.ts +1 -0
- package/dist/lib/util/requestIdleCallbackPolyfill.js +7 -0
- package/dist/lib/util/requestIdleCallbackPolyfill.js.map +1 -0
- package/dist/lib/util/useScrollToAnchor.js +31 -17
- package/dist/lib/util/useScrollToAnchor.js.map +1 -1
- package/dist/vite/build.js +30 -7
- package/dist/vite/build.js.map +1 -1
- package/dist/vite/config.d.ts +20 -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 +3 -6
- package/dist/vite/plugin-config.js +5 -8
- 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 +11 -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-sidebar.d.ts +3 -0
- package/dist/vite/plugin-sidebar.js +23 -0
- package/dist/vite/plugin-sidebar.js.map +1 -0
- package/dist/vite/plugin.js +5 -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/AuthenticationPlugin-CH5NSVOu.js +55 -0
- package/lib/AuthenticationPlugin-CH5NSVOu.js.map +1 -0
- package/lib/CategoryHeading-BWq12Bfa.js +10 -0
- package/lib/CategoryHeading-BWq12Bfa.js.map +1 -0
- package/lib/Combination-D-9IH0zy.js +2789 -0
- package/lib/Combination-D-9IH0zy.js.map +1 -0
- package/lib/DeveloperHint-BQSFXH01.js +10 -0
- package/lib/DeveloperHint-BQSFXH01.js.map +1 -0
- package/lib/Input-HmAaR6kw.js +2239 -0
- package/lib/Input-HmAaR6kw.js.map +1 -0
- package/lib/Markdown-B_Gax7at.js +14108 -0
- package/lib/Markdown-B_Gax7at.js.map +1 -0
- package/lib/MdxPage-3-PenZs2.js +187 -0
- package/lib/MdxPage-3-PenZs2.js.map +1 -0
- package/lib/OperationList-DvKqvB16.js +448 -0
- package/lib/OperationList-DvKqvB16.js.map +1 -0
- package/lib/Route-CnmaDun4.js +14 -0
- package/lib/Route-CnmaDun4.js.map +1 -0
- package/lib/SlotletProvider-CzMAO73_.js +82 -0
- package/lib/SlotletProvider-CzMAO73_.js.map +1 -0
- package/lib/Spinner-D99Tq0hv.js +274 -0
- package/lib/Spinner-D99Tq0hv.js.map +1 -0
- package/lib/ZudokuContext-BIZ8zHbZ.js +1084 -0
- package/lib/ZudokuContext-BIZ8zHbZ.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-CyHZIIfE.js} +10727 -10300
- package/lib/assets/worker-CyHZIIfE.js.map +1 -0
- package/lib/index-7kcHaXD6.js +1771 -0
- package/lib/index-7kcHaXD6.js.map +1 -0
- package/lib/index-7nswqEVR.js +124 -0
- package/lib/index-7nswqEVR.js.map +1 -0
- package/lib/index-DjaqWcmv.js +5934 -0
- package/lib/index-DjaqWcmv.js.map +1 -0
- package/lib/index-pI9JkN46.js +4765 -0
- package/lib/index-pI9JkN46.js.map +1 -0
- package/lib/joinPath-VeNuJa7y.js +8 -0
- package/lib/joinPath-VeNuJa7y.js.map +1 -0
- package/lib/jsx-runtime-B6kdoens.js +635 -0
- package/lib/jsx-runtime-B6kdoens.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 +1 -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 +1 -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-DsXXkBLH.js +288 -0
- package/lib/state-DsXXkBLH.js.map +1 -0
- package/lib/{urql-DMlBWUKL.js → urql-DrBfkb92.js} +2 -2
- package/lib/urql-DrBfkb92.js.map +1 -0
- package/lib/utils-D3g3xyZM.js +749 -0
- package/lib/utils-D3g3xyZM.js.map +1 -0
- package/lib/zudoku.auth-auth0.js +31 -20
- 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 +742 -573
- package/lib/zudoku.auth-openid.js.map +1 -0
- package/lib/zudoku.components.js +2008 -684
- 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 +325 -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 +31 -0
- package/lib/zudoku.plugin-markdown.js.map +1 -0
- package/lib/zudoku.plugin-openapi.js +14 -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 +64 -25
- 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 +46 -0
- package/src/app/entry.client.tsx +47 -0
- package/src/app/entry.server.tsx +160 -0
- package/src/app/main.css +83 -3
- package/src/app/main.tsx +87 -15
- package/src/app/standalone.html +20 -0
- package/src/app/standalone.tsx +52 -0
- package/src/app/tailwind.ts +2 -6
- package/src/lib/authentication/AuthenticationPlugin.tsx +38 -0
- package/src/lib/authentication/authentication.ts +6 -12
- package/src/lib/authentication/components/SignIn.tsx +15 -0
- package/src/lib/authentication/components/SignOut.tsx +13 -0
- package/src/lib/authentication/components/SignUp.tsx +11 -0
- package/src/lib/authentication/hook.ts +4 -4
- package/src/lib/authentication/providers/auth0.tsx +16 -6
- package/src/lib/authentication/providers/clerk.tsx +63 -31
- package/src/lib/authentication/providers/openid.tsx +104 -34
- package/src/lib/authentication/state.ts +1 -1
- package/src/lib/components/Bootstrap.tsx +44 -0
- package/src/lib/components/DevPortal.tsx +75 -66
- package/src/lib/components/DeveloperHint.tsx +25 -0
- package/src/lib/components/ErrorPage.tsx +28 -0
- package/src/lib/components/Header.tsx +106 -31
- package/src/lib/components/Heading.tsx +26 -7
- package/src/lib/components/InlineCode.tsx +19 -0
- package/src/lib/components/Layout.tsx +16 -11
- package/src/lib/components/NotFoundPage.tsx +33 -0
- package/src/lib/components/SlotletProvider.tsx +25 -0
- package/src/lib/components/SyntaxHighlight.tsx +53 -44
- package/src/lib/components/TopNavigation.tsx +10 -5
- package/src/lib/components/context/ThemeContext.tsx +3 -41
- package/src/lib/components/context/ThemeProvider.tsx +27 -0
- package/src/lib/components/context/ZudokuContext.ts +58 -0
- package/src/lib/components/context/ZudokuProvider.tsx +26 -0
- package/src/lib/components/index.ts +25 -3
- package/src/lib/components/navigation/Sidebar.tsx +24 -0
- package/src/lib/components/navigation/SidebarBadge.tsx +40 -0
- package/src/lib/components/navigation/SidebarCategory.tsx +105 -0
- package/src/lib/components/navigation/SidebarItem.tsx +100 -0
- package/src/lib/components/navigation/{SideNavigationWrapper.tsx → SidebarWrapper.tsx} +1 -1
- package/src/lib/components/navigation/utils.ts +117 -0
- package/src/lib/core/DevPortalContext.ts +72 -68
- package/src/lib/core/plugins.ts +40 -16
- 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 +11 -6
- package/src/lib/oas/parser/index.ts +41 -20
- package/src/lib/plugins/{api-key → api-keys}/CreateApiKey.tsx +4 -4
- package/src/lib/plugins/api-keys/ProtectedRoute.tsx +29 -0
- package/src/lib/plugins/{api-key → api-keys}/SettingsApiKeys.tsx +49 -16
- package/src/lib/plugins/{api-key → api-keys}/index.tsx +27 -41
- package/src/lib/plugins/custom-page/index.tsx +22 -0
- package/src/lib/plugins/markdown/MdxPage.tsx +54 -73
- package/src/lib/plugins/markdown/Toc.tsx +53 -40
- package/src/lib/plugins/markdown/generateRoutes.tsx +35 -53
- package/src/lib/plugins/markdown/index.tsx +10 -7
- package/src/lib/plugins/openapi/ColorizedParam.tsx +23 -16
- package/src/lib/plugins/openapi/OperationList.tsx +46 -10
- package/src/lib/plugins/openapi/OperationListItem.tsx +51 -30
- package/src/lib/plugins/openapi/ParameterList.tsx +13 -10
- package/src/lib/plugins/openapi/ParameterListItem.tsx +3 -4
- package/src/lib/plugins/openapi/PlaygroundDialogWrapper.tsx +39 -0
- package/src/lib/plugins/openapi/RequestBodySidecarBox.tsx +3 -15
- package/src/lib/plugins/openapi/ResponsesSidecarBox.tsx +3 -2
- package/src/lib/plugins/openapi/Route.tsx +21 -0
- package/src/lib/plugins/openapi/SchemaListView.tsx +39 -192
- package/src/lib/plugins/openapi/SchemaListViewItem.tsx +125 -0
- package/src/lib/plugins/openapi/SchemaListViewItemGroup.tsx +63 -0
- package/src/lib/plugins/openapi/Sidecar.tsx +77 -30
- package/src/lib/plugins/openapi/SidecarBox.tsx +13 -2
- 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/graphql/gql.ts +8 -8
- package/src/lib/plugins/openapi/graphql/graphql.ts +80 -80
- package/src/lib/plugins/openapi/index.tsx +134 -76
- package/src/lib/plugins/openapi/interfaces.ts +10 -0
- package/src/lib/plugins/openapi/playground/Headers.tsx +1 -1
- package/src/lib/plugins/openapi/playground/PathParams.tsx +76 -50
- package/src/lib/plugins/openapi/playground/Playground.tsx +240 -230
- package/src/lib/plugins/openapi/playground/PlaygroundDialog.tsx +40 -0
- package/src/lib/plugins/openapi/playground/QueryParams.tsx +107 -66
- package/src/lib/plugins/openapi/playground/ResponseTab.tsx +76 -0
- package/src/lib/plugins/openapi/playground/createUrl.ts +12 -15
- 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/Button.tsx +32 -2
- 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/util/MdxComponents.tsx +7 -15
- package/src/lib/util/fetchTimeout.tsx +21 -0
- package/src/lib/util/groupBy.ts +7 -12
- package/src/lib/util/invariant.ts +26 -0
- 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/src/lib/util/requestIdleCallbackPolyfill.ts +6 -0
- package/src/lib/util/useScrollToAnchor.ts +39 -18
- package/dist/lib/authentication/Callback.d.ts +0 -3
- package/dist/lib/authentication/Callback.js +0 -34
- package/dist/lib/authentication/Callback.js.map +0 -1
- package/dist/lib/components/Input.js.map +0 -1
- 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/components/context/DevPortalProvider.d.ts +0 -9
- package/dist/lib/components/context/DevPortalProvider.js +0 -39
- package/dist/lib/components/context/DevPortalProvider.js.map +0 -1
- package/dist/lib/components/navigation/SideNavigation.d.ts +0 -1
- package/dist/lib/components/navigation/SideNavigation.js +0 -11
- package/dist/lib/components/navigation/SideNavigation.js.map +0 -1
- package/dist/lib/components/navigation/SideNavigationCategory.d.ts +0 -4
- package/dist/lib/components/navigation/SideNavigationCategory.js +0 -26
- package/dist/lib/components/navigation/SideNavigationCategory.js.map +0 -1
- package/dist/lib/components/navigation/SideNavigationItem.d.ts +0 -13
- package/dist/lib/components/navigation/SideNavigationItem.js +0 -44
- package/dist/lib/components/navigation/SideNavigationItem.js.map +0 -1
- package/dist/lib/components/navigation/SideNavigationWrapper.js.map +0 -1
- package/dist/lib/components/navigation/useNavigationCollapsibleState.d.ts +0 -6
- package/dist/lib/components/navigation/useNavigationCollapsibleState.js +0 -16
- package/dist/lib/components/navigation/useNavigationCollapsibleState.js.map +0 -1
- package/dist/lib/components/navigation/util.d.ts +0 -8
- package/dist/lib/components/navigation/util.js +0 -15
- package/dist/lib/components/navigation/util.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 +0 -43
- package/dist/lib/plugins/openapi/MakeRequest.js.map +0 -1
- package/dist/lib/plugins/openapi/MethodBadge.d.ts +0 -13
- package/dist/lib/plugins/openapi/MethodBadge.js +0 -26
- package/dist/lib/plugins/openapi/MethodBadge.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/lib/ui/button-variants.d.ts +0 -4
- package/dist/lib/ui/button-variants.js +0 -24
- package/dist/lib/ui/button-variants.js.map +0 -1
- package/dist/lib/util/traverseNavigation.d.ts +0 -6
- package/dist/lib/util/traverseNavigation.js +0 -30
- package/dist/lib/util/traverseNavigation.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-BewqqUU-.js +0 -8413
- 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 -19904
- package/src/lib/authentication/Callback.tsx +0 -60
- package/src/lib/components/Link.tsx +0 -1
- package/src/lib/components/Router.tsx +0 -28
- package/src/lib/components/context/DevPortalProvider.ts +0 -54
- package/src/lib/components/navigation/SideNavigation.tsx +0 -21
- package/src/lib/components/navigation/SideNavigationCategory.tsx +0 -76
- package/src/lib/components/navigation/SideNavigationItem.tsx +0 -152
- package/src/lib/components/navigation/useNavigationCollapsibleState.ts +0 -27
- package/src/lib/components/navigation/util.ts +0 -38
- 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/index.ts +0 -4
- package/src/lib/plugins/openapi/MakeRequest.tsx +0 -63
- package/src/lib/plugins/openapi/MethodBadge.tsx +0 -36
- package/src/lib/plugins/openapi/worker/shared-worker.ts +0 -5
- package/src/lib/ui/button-variants.ts +0 -31
- package/src/lib/util/traverseNavigation.ts +0 -55
- /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/dist/lib/{components → ui}/Input.d.ts +0 -0
- /package/dist/lib/{components → ui}/Input.js +0 -0
- /package/src/lib/{components → ui}/Input.tsx +0 -0
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { QueryClient } from "@tanstack/react-query";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { NavigateFunction } from "react-router-dom";
|
|
3
|
+
import type { SidebarConfig } from "../../config/validators/SidebarSchema.js";
|
|
4
4
|
import { type AuthenticationProvider } from "../authentication/authentication.js";
|
|
5
|
+
import type { ComponentsContextType } from "../components/context/ComponentsContext.js";
|
|
6
|
+
import { Slotlets } from "../components/SlotletProvider.js";
|
|
7
|
+
import { joinPath } from "../util/joinPath.js";
|
|
8
|
+
import type { MdxComponentsType } from "../util/MdxComponents.js";
|
|
5
9
|
import {
|
|
6
|
-
type
|
|
7
|
-
type DevPortalProps,
|
|
8
|
-
} from "../components/DevPortal.js";
|
|
9
|
-
import {
|
|
10
|
+
type DevPortalPlugin,
|
|
10
11
|
isApiIdentityPlugin,
|
|
11
12
|
isNavigationPlugin,
|
|
12
|
-
needsInitialization,
|
|
13
|
-
type DevPortalPlugin,
|
|
14
13
|
type NavigationPlugin,
|
|
14
|
+
needsInitialization,
|
|
15
15
|
} from "./plugins.js";
|
|
16
16
|
|
|
17
17
|
export interface ApiIdentity {
|
|
@@ -20,76 +20,80 @@ export interface ApiIdentity {
|
|
|
20
20
|
id: string;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
type BaseNavigationCategoryItem = {
|
|
24
|
-
label: ReactNode;
|
|
25
|
-
title?: string;
|
|
26
|
-
muted?: boolean;
|
|
27
|
-
icon?: ReactNode;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export type PathNavigationCategoryItem = BaseNavigationCategoryItem & {
|
|
31
|
-
path: string;
|
|
32
|
-
children?: NavigationCategoryItem[];
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export type HrefNavigationCategoryItem = BaseNavigationCategoryItem & {
|
|
36
|
-
href: string;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export type NavigationCategoryItem =
|
|
40
|
-
| PathNavigationCategoryItem
|
|
41
|
-
| HrefNavigationCategoryItem;
|
|
42
|
-
|
|
43
|
-
export type NavigationCategory = {
|
|
44
|
-
label: string;
|
|
45
|
-
path?: string;
|
|
46
|
-
expanded?: boolean;
|
|
47
|
-
collapsible?: boolean;
|
|
48
|
-
icon?: ReactNode;
|
|
49
|
-
children: NavigationCategoryItem[];
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export type NavigationItem = {
|
|
53
|
-
label: string;
|
|
54
|
-
path: DevPortalPath;
|
|
55
|
-
categories?: NavigationCategory[];
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export type RoutingState = {
|
|
59
|
-
path?: string;
|
|
60
|
-
};
|
|
61
|
-
|
|
62
23
|
export const queryClient = new QueryClient();
|
|
63
24
|
|
|
64
|
-
export const useRoutingState = create<RoutingState>(() => ({}));
|
|
65
|
-
|
|
66
25
|
export type ApiKeyCache = "api-keys";
|
|
67
26
|
export type DevPortalCacheKey = ApiKeyCache | string;
|
|
68
27
|
|
|
28
|
+
type Metadata = Partial<{
|
|
29
|
+
title: string;
|
|
30
|
+
description: string;
|
|
31
|
+
logo: string;
|
|
32
|
+
favicon: string;
|
|
33
|
+
generator: string;
|
|
34
|
+
applicationName: string;
|
|
35
|
+
referrer: string;
|
|
36
|
+
keywords: string[];
|
|
37
|
+
authors: string[];
|
|
38
|
+
creator: string;
|
|
39
|
+
publisher: string;
|
|
40
|
+
}>;
|
|
41
|
+
|
|
42
|
+
type Page = Partial<{
|
|
43
|
+
pageTitle?: string;
|
|
44
|
+
logo?: {
|
|
45
|
+
src: {
|
|
46
|
+
light: string;
|
|
47
|
+
dark: string;
|
|
48
|
+
};
|
|
49
|
+
width?: string;
|
|
50
|
+
alt?: string;
|
|
51
|
+
};
|
|
52
|
+
}>;
|
|
53
|
+
|
|
54
|
+
export type ZudokuContextOptions = {
|
|
55
|
+
metadata?: Metadata;
|
|
56
|
+
page?: Page;
|
|
57
|
+
authentication?: AuthenticationProvider;
|
|
58
|
+
topNavigation?: Array<{ id: string; label: string }>;
|
|
59
|
+
sidebars?: SidebarConfig;
|
|
60
|
+
plugins?: DevPortalPlugin[];
|
|
61
|
+
slotlets?: Slotlets;
|
|
62
|
+
mdx?: {
|
|
63
|
+
components?: MdxComponentsType;
|
|
64
|
+
};
|
|
65
|
+
overrides?: ComponentsContextType;
|
|
66
|
+
};
|
|
67
|
+
|
|
69
68
|
export class DevPortalContext {
|
|
70
|
-
|
|
69
|
+
public plugins: NonNullable<ZudokuContextOptions["plugins"]>;
|
|
70
|
+
public sidebars: NonNullable<ZudokuContextOptions["sidebars"]>;
|
|
71
|
+
public topNavigation: NonNullable<ZudokuContextOptions["topNavigation"]>;
|
|
72
|
+
public meta: ZudokuContextOptions["metadata"];
|
|
73
|
+
public page: ZudokuContextOptions["page"];
|
|
74
|
+
public authentication?: ZudokuContextOptions["authentication"];
|
|
71
75
|
private navigationPlugins: NavigationPlugin[];
|
|
72
76
|
|
|
73
|
-
|
|
74
|
-
public meta: DevPortalProps["meta"];
|
|
75
|
-
public authentication?: AuthenticationProvider;
|
|
76
|
-
public state: typeof useRoutingState;
|
|
77
|
-
|
|
78
|
-
constructor(config: DevPortalProps) {
|
|
77
|
+
constructor(config: ZudokuContextOptions) {
|
|
79
78
|
this.plugins = config.plugins ?? [];
|
|
80
|
-
this.
|
|
79
|
+
this.topNavigation = config.topNavigation ?? [];
|
|
80
|
+
this.sidebars = config.sidebars ?? {};
|
|
81
81
|
this.navigationPlugins = this.plugins.filter(isNavigationPlugin);
|
|
82
82
|
this.authentication = config.authentication;
|
|
83
|
-
this.meta = config.
|
|
84
|
-
this.
|
|
83
|
+
this.meta = config.metadata;
|
|
84
|
+
this.page = config.page;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
initialize = async (
|
|
88
|
-
|
|
87
|
+
initialize = async ({
|
|
88
|
+
navigate,
|
|
89
|
+
}: {
|
|
90
|
+
navigate: NavigateFunction;
|
|
91
|
+
}): Promise<void> => {
|
|
92
|
+
await Promise.all(
|
|
89
93
|
this.plugins
|
|
90
94
|
.filter(needsInitialization)
|
|
91
|
-
.map((plugin) => plugin.initialize(this)),
|
|
92
|
-
|
|
95
|
+
.map((plugin) => plugin.initialize?.(this, { navigate })),
|
|
96
|
+
);
|
|
93
97
|
};
|
|
94
98
|
|
|
95
99
|
invalidateCache = async (key: DevPortalCacheKey[]) => {
|
|
@@ -106,17 +110,17 @@ export class DevPortalContext {
|
|
|
106
110
|
return keys.flat();
|
|
107
111
|
};
|
|
108
112
|
|
|
109
|
-
|
|
113
|
+
getPluginSidebar = async (path: string) => {
|
|
110
114
|
const navigations = await Promise.all(
|
|
111
|
-
this.navigationPlugins.map(
|
|
112
|
-
plugin.
|
|
115
|
+
this.navigationPlugins.map((plugin) =>
|
|
116
|
+
plugin.getSidebar?.(joinPath(path)),
|
|
113
117
|
),
|
|
114
118
|
);
|
|
115
119
|
|
|
116
120
|
return navigations.flatMap((nav) => nav ?? []);
|
|
117
121
|
};
|
|
118
122
|
|
|
119
|
-
async
|
|
123
|
+
signRequest = async (request: Request) => {
|
|
120
124
|
if (!this.authentication) {
|
|
121
125
|
throw new Error("No authentication provider configured");
|
|
122
126
|
}
|
|
@@ -126,5 +130,5 @@ export class DevPortalContext {
|
|
|
126
130
|
request.headers.set("Authorization", `Bearer ${accessToken}`);
|
|
127
131
|
|
|
128
132
|
return request;
|
|
129
|
-
}
|
|
133
|
+
};
|
|
130
134
|
}
|
package/src/lib/core/plugins.ts
CHANGED
|
@@ -1,32 +1,48 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} from "./DevPortalContext.js";
|
|
7
|
-
|
|
8
|
-
export type PluginNavigationCategory = {
|
|
9
|
-
path: string;
|
|
10
|
-
} & NavigationCategory;
|
|
1
|
+
import { type ReactElement } from "react";
|
|
2
|
+
import { NavigateFunction, type RouteObject } from "react-router-dom";
|
|
3
|
+
import type { Sidebar } from "../../config/validators/SidebarSchema.js";
|
|
4
|
+
import { MdxComponentsType } from "../util/MdxComponents.js";
|
|
5
|
+
import { DevPortalContext, type ApiIdentity } from "./DevPortalContext.js";
|
|
11
6
|
|
|
12
7
|
export type DevPortalPlugin =
|
|
8
|
+
| CommonPlugin
|
|
9
|
+
| ProfileMenuPlugin
|
|
13
10
|
| NavigationPlugin
|
|
14
|
-
| ApiIdentityPlugin
|
|
15
|
-
| InitializationPlugin;
|
|
11
|
+
| ApiIdentityPlugin;
|
|
16
12
|
|
|
17
13
|
export interface NavigationPlugin {
|
|
18
14
|
getRoutes: () => RouteObject[];
|
|
19
|
-
|
|
15
|
+
getSidebar?: (path: string) => Promise<Sidebar>;
|
|
20
16
|
}
|
|
21
17
|
|
|
22
18
|
export interface ApiIdentityPlugin {
|
|
23
19
|
getIdentities: (context: DevPortalContext) => Promise<ApiIdentity[]>;
|
|
24
20
|
}
|
|
25
21
|
|
|
26
|
-
export interface
|
|
27
|
-
|
|
22
|
+
export interface ProfileMenuPlugin {
|
|
23
|
+
getProfileMenuItems: (context: DevPortalContext) => ProfileNavigationItem[];
|
|
28
24
|
}
|
|
29
25
|
|
|
26
|
+
export type ProfileNavigationItem = {
|
|
27
|
+
label: string;
|
|
28
|
+
path?: string;
|
|
29
|
+
children?: ProfileNavigationItem[];
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export interface CommonPlugin {
|
|
33
|
+
initialize?: (
|
|
34
|
+
context: DevPortalContext,
|
|
35
|
+
options: { navigate: NavigateFunction },
|
|
36
|
+
) => Promise<void | boolean> | void | boolean;
|
|
37
|
+
getHead?: () => ReactElement | undefined;
|
|
38
|
+
getMdxComponents?: () => MdxComponentsType;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export const isProfileMenuPlugin = (
|
|
42
|
+
obj: DevPortalPlugin,
|
|
43
|
+
): obj is ProfileMenuPlugin =>
|
|
44
|
+
"getProfileMenuItems" in obj && typeof obj.getProfileMenuItems === "function";
|
|
45
|
+
|
|
30
46
|
export const isNavigationPlugin = (
|
|
31
47
|
obj: DevPortalPlugin,
|
|
32
48
|
): obj is NavigationPlugin =>
|
|
@@ -34,9 +50,17 @@ export const isNavigationPlugin = (
|
|
|
34
50
|
|
|
35
51
|
export const needsInitialization = (
|
|
36
52
|
obj: DevPortalPlugin,
|
|
37
|
-
): obj is
|
|
53
|
+
): obj is CommonPlugin =>
|
|
38
54
|
"initialize" in obj && typeof obj.initialize === "function";
|
|
39
55
|
|
|
56
|
+
export const hasHead = (obj: DevPortalPlugin): obj is CommonPlugin =>
|
|
57
|
+
"getHead" in obj && typeof obj.getHead === "function";
|
|
58
|
+
|
|
59
|
+
export const isMdxProviderPlugin = (
|
|
60
|
+
obj: DevPortalPlugin,
|
|
61
|
+
): obj is CommonPlugin =>
|
|
62
|
+
"getMdxComponents" in obj && typeof obj.getMdxComponents === "function";
|
|
63
|
+
|
|
40
64
|
export const isApiIdentityPlugin = (
|
|
41
65
|
obj: DevPortalPlugin,
|
|
42
66
|
): obj is ApiIdentityPlugin =>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2
|
+
export function ErrorAlert({ error }: { error: any }) {
|
|
3
|
+
const message = error?.message ?? "Something went wrong";
|
|
4
|
+
const stack = error?.stack;
|
|
5
|
+
|
|
6
|
+
return (
|
|
7
|
+
<div className="flex h-screen max-h-screen min-h-full items-center justify-center bg-primary-background px-4 py-16 lg:px-8">
|
|
8
|
+
<div className="mx-auto max-w-[85%] sm:max-w-[50%]">
|
|
9
|
+
<h1 className="text-4xl font-bold tracking-tight text-h1-text sm:text-5xl">
|
|
10
|
+
Something went wrong
|
|
11
|
+
</h1>
|
|
12
|
+
<p className="mt-5 text-h1-text">{message}</p>
|
|
13
|
+
{stack ? (
|
|
14
|
+
<pre className="mt-5 max-h-[400px] w-full overflow-scroll rounded-md border border-input-border bg-input-background p-3 text-property-name-text text-red-700">
|
|
15
|
+
{stack}
|
|
16
|
+
</pre>
|
|
17
|
+
) : null}
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { isRouteErrorResponse, useRouteError } from "react-router-dom";
|
|
2
|
+
import { NotFoundPage } from "../components/NotFoundPage.js";
|
|
3
|
+
import { ErrorAlert } from "./ErrorAlert.js";
|
|
4
|
+
|
|
5
|
+
export function RouterError() {
|
|
6
|
+
const error = useRouteError();
|
|
7
|
+
|
|
8
|
+
if (isRouteErrorResponse(error) && error.status === 404) {
|
|
9
|
+
return <NotFoundPage />;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return <ErrorAlert error={error} />;
|
|
13
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FallbackProps } from "react-error-boundary";
|
|
2
|
+
import { ErrorAlert } from "./ErrorAlert.js";
|
|
3
|
+
|
|
4
|
+
export function TopLevelError({ error, resetErrorBoundary }: FallbackProps) {
|
|
5
|
+
// Call resetErrorBoundary() to reset the error boundary and retry the render.
|
|
6
|
+
|
|
7
|
+
return <ErrorAlert error={error} />;
|
|
8
|
+
}
|
|
@@ -36,16 +36,21 @@ type OperationLike = {
|
|
|
36
36
|
method: string;
|
|
37
37
|
};
|
|
38
38
|
export const slugifyOperation = (operation: OperationLike, tag?: string) => {
|
|
39
|
+
const summary =
|
|
40
|
+
operation.summary +
|
|
41
|
+
(operation.operationId
|
|
42
|
+
? "-" +
|
|
43
|
+
operation.operationId.slice(0, operation.summary ? Infinity : Infinity)
|
|
44
|
+
: "");
|
|
45
|
+
|
|
39
46
|
return slugify(
|
|
40
47
|
(tag ? tag + "-" : "") +
|
|
41
|
-
(operation.
|
|
42
|
-
operation.operationId ??
|
|
43
|
-
`${operation.method}-${operation.path}`),
|
|
48
|
+
(summary || `${operation.method}-${operation.path}`),
|
|
44
49
|
{ lower: true, trim: true },
|
|
45
50
|
);
|
|
46
51
|
};
|
|
47
52
|
|
|
48
|
-
const cache = new LRUCache<string, OpenAPIDocument
|
|
53
|
+
const cache = new LRUCache<string, Promise<OpenAPIDocument>>({
|
|
49
54
|
ttl: 60 * 10 * 1000,
|
|
50
55
|
ttlAutopurge: true,
|
|
51
56
|
});
|
|
@@ -207,7 +212,7 @@ const MediaTypeItem = builder
|
|
|
207
212
|
.implement({
|
|
208
213
|
fields: (t) => ({
|
|
209
214
|
mediaType: t.exposeString("mediaType"),
|
|
210
|
-
schema: t.expose("schema", { type: JSONScalar }),
|
|
215
|
+
schema: t.expose("schema", { type: JSONScalar, nullable: true }),
|
|
211
216
|
examples: t.expose("examples", { type: [ExampleItem], nullable: true }),
|
|
212
217
|
encoding: t.expose("encoding", { type: [EncodingItem], nullable: true }),
|
|
213
218
|
}),
|
|
@@ -384,7 +389,7 @@ const loadOpenAPISchema = async (input: NonNullable<unknown>) => {
|
|
|
384
389
|
return cache.get(hash)!;
|
|
385
390
|
}
|
|
386
391
|
|
|
387
|
-
const schema =
|
|
392
|
+
const schema = validate(input);
|
|
388
393
|
|
|
389
394
|
cache.set(hash, schema);
|
|
390
395
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { GraphQLError } from "graphql/error/index.js";
|
|
1
2
|
import { OpenAPIV3, type OpenAPIV3_1 } from "openapi-types";
|
|
2
3
|
import { dereference, type JSONSchema } from "./dereference/index.js";
|
|
3
4
|
import { upgradeSchema } from "./upgrade/index.js";
|
|
@@ -9,10 +10,6 @@ type DeepOmitReference<T> = T extends ReferenceObject
|
|
|
9
10
|
? { [K in keyof T]: DeepOmitReference<T[K]> }
|
|
10
11
|
: T;
|
|
11
12
|
|
|
12
|
-
// type Prettify<T> = {
|
|
13
|
-
// [K in keyof T]: T[K];
|
|
14
|
-
// } & {};
|
|
15
|
-
|
|
16
13
|
export type OpenAPIDocument = DeepOmitReference<OpenAPIV3_1.Document>;
|
|
17
14
|
export type ResponseObject = DeepOmitReference<OpenAPIV3_1.ResponseObject>;
|
|
18
15
|
export type OperationObject = DeepOmitReference<OpenAPIV3_1.OperationObject>;
|
|
@@ -46,35 +43,63 @@ export const HttpMethods = Object.values(OpenAPIV3.HttpMethods);
|
|
|
46
43
|
// };
|
|
47
44
|
|
|
48
45
|
const parseSchemaInput = async (
|
|
49
|
-
|
|
50
|
-
schemaInput: any,
|
|
46
|
+
schemaInput: unknown,
|
|
51
47
|
): Promise<JSONSchema & { openapi?: string }> => {
|
|
52
48
|
if (typeof schemaInput === "string") {
|
|
53
49
|
if (schemaInput.trim().startsWith("{")) {
|
|
54
|
-
|
|
50
|
+
try {
|
|
51
|
+
return JSON.parse(schemaInput);
|
|
52
|
+
} catch (err) {
|
|
53
|
+
throw new GraphQLError("Invalid JSON schema", {
|
|
54
|
+
originalError: err,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
55
57
|
}
|
|
56
58
|
if (schemaInput.includes("://")) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
+
let response;
|
|
60
|
+
try {
|
|
61
|
+
response = await fetch(schemaInput, {
|
|
62
|
+
cache: "force-cache",
|
|
63
|
+
});
|
|
64
|
+
} catch (err) {
|
|
65
|
+
throw new GraphQLError("Failed to fetch schema", {
|
|
66
|
+
originalError: err,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (!response.ok) {
|
|
71
|
+
throw new GraphQLError(
|
|
72
|
+
`Failed to fetch schema: ${response.statusText}`,
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
try {
|
|
77
|
+
return (await response.json()) as JSONSchema;
|
|
78
|
+
} catch (err) {
|
|
79
|
+
throw new GraphQLError("Fetched invalid JSON schema", {
|
|
80
|
+
originalError: err,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
59
83
|
}
|
|
60
84
|
const yaml = await import("yaml");
|
|
61
|
-
|
|
85
|
+
const parsed = yaml.parse(schemaInput);
|
|
86
|
+
|
|
87
|
+
if (typeof parsed === "object") return parsed;
|
|
62
88
|
}
|
|
63
89
|
|
|
64
|
-
if (typeof schemaInput === "object") return schemaInput;
|
|
90
|
+
if (typeof schemaInput === "object") return schemaInput as JSONSchema;
|
|
65
91
|
|
|
66
|
-
throw new
|
|
92
|
+
throw new GraphQLError("Unsupported schema input: " + schemaInput);
|
|
67
93
|
};
|
|
68
94
|
|
|
69
95
|
/**
|
|
70
96
|
* Validates, dereferences and upgrades the OpenAPI schema (to v3.1) if necessary.
|
|
71
97
|
*/
|
|
72
|
-
|
|
73
|
-
export const validate = async (schemaInput: any) => {
|
|
98
|
+
export const validate = async (schemaInput: unknown) => {
|
|
74
99
|
const schema = await parseSchemaInput(schemaInput);
|
|
75
100
|
|
|
76
101
|
if (!schema.openapi) {
|
|
77
|
-
throw new
|
|
102
|
+
throw new GraphQLError("OpenAPI version is not defined");
|
|
78
103
|
}
|
|
79
104
|
|
|
80
105
|
// const validator = await getValidator(schema.openapi);
|
|
@@ -86,9 +111,5 @@ export const validate = async (schemaInput: any) => {
|
|
|
86
111
|
|
|
87
112
|
const dereferenced = await dereference(schema);
|
|
88
113
|
|
|
89
|
-
|
|
90
|
-
dereferenced as OpenAPIV3_1.Document | OpenAPIV3.Document,
|
|
91
|
-
);
|
|
92
|
-
|
|
93
|
-
return upgraded;
|
|
114
|
+
return upgradeSchema(dereferenced);
|
|
94
115
|
};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { useMutation } from "@tanstack/react-query";
|
|
2
2
|
import { useForm } from "react-hook-form";
|
|
3
3
|
import { Link, useNavigate } from "react-router-dom";
|
|
4
|
-
import {
|
|
5
|
-
import { Input } from "../../components/Input.js";
|
|
4
|
+
import { useZudoku } from "../../components/context/ZudokuContext.js";
|
|
6
5
|
import {
|
|
7
6
|
Select,
|
|
8
7
|
SelectContent,
|
|
@@ -12,12 +11,13 @@ import {
|
|
|
12
11
|
SelectValue,
|
|
13
12
|
} from "../../components/Select.js";
|
|
14
13
|
import { Button } from "../../ui/Button.js";
|
|
14
|
+
import { Input } from "../../ui/Input.js";
|
|
15
15
|
import { ApiKeyService } from "./index.js";
|
|
16
16
|
|
|
17
17
|
type CreateApiKey = { description: string; expiresOn?: string };
|
|
18
18
|
|
|
19
19
|
export const CreateApiKey = ({ service }: { service: ApiKeyService }) => {
|
|
20
|
-
const context =
|
|
20
|
+
const context = useZudoku();
|
|
21
21
|
const navigate = useNavigate();
|
|
22
22
|
const form = useForm<CreateApiKey>({
|
|
23
23
|
defaultValues: {
|
|
@@ -47,7 +47,7 @@ export const CreateApiKey = ({ service }: { service: ApiKeyService }) => {
|
|
|
47
47
|
|
|
48
48
|
return (
|
|
49
49
|
<div className="max-w-screen-lg pt-[--padding-content-top] pb-[--padding-content-bottom]">
|
|
50
|
-
<div className="flex justify-between mb-4 border-b
|
|
50
|
+
<div className="flex justify-between mb-4 border-b pb-1">
|
|
51
51
|
<h1 className="font-medium text-2xl">New API Key</h1>
|
|
52
52
|
</div>
|
|
53
53
|
<form
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Outlet } from "react-router-dom";
|
|
2
|
+
import { useAuth } from "../../authentication/hook.js";
|
|
3
|
+
import { DeveloperHint } from "../../components/DeveloperHint.js";
|
|
4
|
+
import { Button } from "../../ui/Button.js";
|
|
5
|
+
|
|
6
|
+
export const ProtectedRoute = () => {
|
|
7
|
+
const auth = useAuth();
|
|
8
|
+
|
|
9
|
+
// TODO: should we suspend here somehow?
|
|
10
|
+
if (auth.isAuthEnabled && auth.isPending) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return auth.isAuthenticated ? (
|
|
15
|
+
<Outlet />
|
|
16
|
+
) : !auth.isAuthEnabled ? (
|
|
17
|
+
<div className="flex flex-col justify-center gap-2 items-center h-1/2">
|
|
18
|
+
<DeveloperHint className="max-w-[600px]">
|
|
19
|
+
Authentication needs to be enabled for API keys to work. Enable it in
|
|
20
|
+
your Zudoku configuration under <code>authentication</code>.
|
|
21
|
+
</DeveloperHint>
|
|
22
|
+
</div>
|
|
23
|
+
) : (
|
|
24
|
+
<div className="flex flex-col justify-center gap-2 items-center h-1/2">
|
|
25
|
+
Please login first to view this page
|
|
26
|
+
<Button onClick={() => auth.login()}>Login</Button>
|
|
27
|
+
</div>
|
|
28
|
+
);
|
|
29
|
+
};
|
|
@@ -6,12 +6,14 @@ import {
|
|
|
6
6
|
import { EyeIcon, EyeOffIcon, RotateCwIcon, TrashIcon } from "lucide-react";
|
|
7
7
|
import { useState } from "react";
|
|
8
8
|
import { Link } from "react-router-dom";
|
|
9
|
-
import {
|
|
9
|
+
import { useZudoku } from "../../components/context/ZudokuContext.js";
|
|
10
|
+
import { Slotlet } from "../../components/SlotletProvider.js";
|
|
10
11
|
import { Button } from "../../ui/Button.js";
|
|
12
|
+
import { cn } from "../../util/cn.js";
|
|
11
13
|
import { ApiKeyService } from "./index.js";
|
|
12
14
|
|
|
13
15
|
export const SettingsApiKeys = ({ service }: { service: ApiKeyService }) => {
|
|
14
|
-
const context =
|
|
16
|
+
const context = useZudoku();
|
|
15
17
|
const queryClient = useQueryClient();
|
|
16
18
|
const { data } = useSuspenseQuery({
|
|
17
19
|
queryFn: () => service.getKeys(context),
|
|
@@ -32,9 +34,22 @@ export const SettingsApiKeys = ({ service }: { service: ApiKeyService }) => {
|
|
|
32
34
|
},
|
|
33
35
|
});
|
|
34
36
|
|
|
37
|
+
const rollKeyMutation = useMutation({
|
|
38
|
+
mutationFn: (id: string) => {
|
|
39
|
+
if (!service.rollKey) {
|
|
40
|
+
throw new Error("rollKey not implemented");
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return service.rollKey(id, context);
|
|
44
|
+
},
|
|
45
|
+
onSuccess: () => queryClient.invalidateQueries({ queryKey: ["api-keys"] }),
|
|
46
|
+
});
|
|
47
|
+
|
|
35
48
|
return (
|
|
36
49
|
<div className="max-w-screen-lg h-full pt-[--padding-content-top] pb-[--padding-content-bottom]">
|
|
37
|
-
<
|
|
50
|
+
<Slotlet name="api-keys-list-page" />
|
|
51
|
+
|
|
52
|
+
<div className="flex justify-between mb-4 border-b pb-3">
|
|
38
53
|
<h1 className="font-medium text-2xl">API Keys</h1>
|
|
39
54
|
{service.createKey && (
|
|
40
55
|
<Button asChild>
|
|
@@ -43,24 +58,31 @@ export const SettingsApiKeys = ({ service }: { service: ApiKeyService }) => {
|
|
|
43
58
|
)}
|
|
44
59
|
</div>
|
|
45
60
|
|
|
61
|
+
<Slotlet name="api-keys-list-page-before-keys" />
|
|
62
|
+
|
|
46
63
|
{data.length === 0 ? (
|
|
47
|
-
<div className="flex flex-col justify-center gap-4 items-center
|
|
48
|
-
<
|
|
64
|
+
<div className="flex flex-col justify-center gap-4 items-center p-8 border rounded bg-muted/30 text-muted-foreground">
|
|
65
|
+
<p className="text-center">
|
|
49
66
|
No API keys created yet.
|
|
50
67
|
<br />
|
|
51
|
-
Get started and create
|
|
52
|
-
</
|
|
68
|
+
Get started and create your first key.
|
|
69
|
+
</p>
|
|
53
70
|
{service.createKey && (
|
|
54
|
-
<Button asChild>
|
|
71
|
+
<Button asChild variant="outline">
|
|
55
72
|
<Link to="/settings/api-keys/new">Create API Key</Link>
|
|
56
73
|
</Button>
|
|
57
74
|
)}
|
|
58
75
|
</div>
|
|
59
76
|
) : (
|
|
60
|
-
<ul
|
|
61
|
-
{
|
|
77
|
+
<ul
|
|
78
|
+
className={cn(
|
|
79
|
+
"grid grid-cols-1 rounded border",
|
|
80
|
+
"lg:grid-cols-[minmax(250px,min-content)_1fr_min-content]",
|
|
81
|
+
)}
|
|
82
|
+
>
|
|
83
|
+
{data.map((key) => (
|
|
62
84
|
<li
|
|
63
|
-
className="border-b
|
|
85
|
+
className="border-b p-5 grid grid-cols-subgrid col-span-full gap-2 items-center"
|
|
64
86
|
key={key.id}
|
|
65
87
|
>
|
|
66
88
|
<div className="flex flex-col gap-1 text-sm">
|
|
@@ -78,12 +100,23 @@ export const SettingsApiKeys = ({ service }: { service: ApiKeyService }) => {
|
|
|
78
100
|
)}
|
|
79
101
|
</div>
|
|
80
102
|
</div>
|
|
81
|
-
<div className="items-center flex justify-center">
|
|
103
|
+
<div className="items-center flex lg:justify-center">
|
|
82
104
|
<RevealApiKey apiKey={key.key} />
|
|
83
105
|
</div>
|
|
84
106
|
<div className="flex gap-2">
|
|
85
107
|
{service.rollKey && (
|
|
86
|
-
<Button
|
|
108
|
+
<Button
|
|
109
|
+
size="icon"
|
|
110
|
+
title="Roll this key"
|
|
111
|
+
variant="ghost"
|
|
112
|
+
onClick={() => {
|
|
113
|
+
if (!confirm("Do you want to roll this key?")) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
rollKeyMutation.mutate(key.id);
|
|
118
|
+
}}
|
|
119
|
+
>
|
|
87
120
|
<RotateCwIcon size={16} />
|
|
88
121
|
</Button>
|
|
89
122
|
)}
|
|
@@ -116,10 +149,10 @@ const RevealApiKey = ({ apiKey }: { apiKey: string }) => {
|
|
|
116
149
|
const [revealed, setRevealed] = useState(false);
|
|
117
150
|
|
|
118
151
|
return (
|
|
119
|
-
<div className="flex gap-2 items-center text-sm">
|
|
120
|
-
<
|
|
152
|
+
<div className="flex gap-2 items-center text-sm w-full">
|
|
153
|
+
<div className="border rounded bg-gray-100 dark:bg-gray-950 p-1 font-mono w-fit overflow-x-scroll h-9 items-center flex px-2">
|
|
121
154
|
{revealed ? apiKey : "•".repeat(apiKey.length)}
|
|
122
|
-
</
|
|
155
|
+
</div>
|
|
123
156
|
<Button
|
|
124
157
|
variant="outline"
|
|
125
158
|
onClick={() => setRevealed((prev) => !prev)}
|