zudoku 0.1.1-dev.9 → 0.3.0-dev.3
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.js +15 -6
- package/dist/app/App.js.map +1 -1
- package/dist/app/main.js +10 -2
- package/dist/app/main.js.map +1 -1
- package/dist/cli/build/handler.js +3 -1
- package/dist/cli/build/handler.js.map +1 -1
- package/dist/cli/common/analytics/lib.js +1 -1
- package/dist/cli/common/analytics/lib.js.map +1 -1
- package/dist/cli/common/logger.js +3 -1
- package/dist/cli/common/logger.js.map +1 -1
- package/dist/cli/common/outdated.js +4 -4
- package/dist/cli/common/outdated.js.map +1 -1
- package/dist/cli/common/output.js +4 -4
- package/dist/cli/common/output.js.map +1 -1
- package/dist/cli/common/utils/box.js +2 -2
- package/dist/cli/common/utils/box.js.map +1 -1
- package/dist/cli/dev/handler.js +4 -2
- package/dist/cli/dev/handler.js.map +1 -1
- package/dist/config/config.d.ts +30 -6
- package/dist/config/validators/auth.d.ts +2 -0
- package/dist/config/validators/auth.js +2 -0
- package/dist/config/validators/auth.js.map +1 -0
- package/dist/config/validators/validate.d.ts +2 -0
- package/dist/config/validators/validate.js +4 -0
- package/dist/config/validators/validate.js.map +1 -0
- package/dist/index.d.ts +2 -6
- package/dist/index.js +1 -5
- package/dist/index.js.map +1 -1
- package/dist/lib/authentication/Callback.d.ts +3 -0
- package/dist/lib/authentication/Callback.js +34 -0
- package/dist/lib/authentication/Callback.js.map +1 -0
- package/dist/lib/authentication/authentication.d.ts +14 -0
- package/dist/lib/authentication/authentication.js.map +1 -0
- package/dist/lib/authentication/errors.d.ts +15 -0
- package/dist/lib/authentication/errors.js +10 -0
- package/dist/lib/authentication/errors.js.map +1 -0
- package/dist/lib/authentication/hook.d.ts +7 -0
- package/dist/lib/authentication/hook.js +29 -0
- package/dist/lib/authentication/hook.js.map +1 -0
- package/dist/lib/authentication/providers/auth0.d.ts +4 -0
- package/dist/lib/authentication/providers/auth0.js +40 -0
- package/dist/lib/authentication/providers/auth0.js.map +1 -0
- package/dist/lib/authentication/providers/clerk.d.ts +4 -0
- package/dist/lib/authentication/providers/clerk.js +54 -0
- package/dist/lib/authentication/providers/clerk.js.map +1 -0
- package/dist/lib/authentication/providers/openid.d.ts +35 -0
- package/dist/lib/authentication/providers/openid.js +204 -0
- package/dist/lib/authentication/providers/openid.js.map +1 -0
- package/dist/lib/authentication/state.d.ts +13 -0
- package/dist/lib/authentication/state.js +5 -0
- package/dist/lib/authentication/state.js.map +1 -0
- package/dist/{app → lib}/components/AnchorLink.js.map +1 -1
- package/dist/{app → lib}/components/CategoryHeading.js.map +1 -1
- package/dist/lib/components/DevPortal.d.ts +25 -0
- package/dist/lib/components/DevPortal.js +32 -0
- package/dist/lib/components/DevPortal.js.map +1 -0
- package/dist/{app → lib}/components/Dialog.d.ts +2 -2
- package/dist/{app → lib}/components/Dialog.js +3 -3
- package/dist/lib/components/Dialog.js.map +1 -0
- package/dist/lib/components/Header.d.ts +1 -0
- package/dist/lib/components/Header.js +15 -0
- package/dist/lib/components/Header.js.map +1 -0
- package/dist/{app → lib/components}/Heading.js +2 -2
- package/dist/lib/components/Heading.js.map +1 -0
- package/dist/{app → lib}/components/Input.js.map +1 -1
- package/dist/{app → lib}/components/Layout.js +4 -7
- package/dist/lib/components/Layout.js.map +1 -0
- package/dist/lib/components/Link.d.ts +1 -0
- package/dist/lib/components/Link.js +2 -0
- package/dist/lib/components/Link.js.map +1 -0
- package/dist/{app → lib}/components/Markdown.js.map +1 -1
- package/dist/lib/components/Router.d.ts +4 -0
- package/dist/lib/components/Router.js +20 -0
- package/dist/lib/components/Router.js.map +1 -0
- package/dist/lib/components/Select.d.ts +13 -0
- package/dist/lib/components/Select.js +27 -0
- package/dist/lib/components/Select.js.map +1 -0
- package/dist/lib/components/Spinner.d.ts +3 -0
- package/dist/lib/components/Spinner.js +4 -0
- package/dist/lib/components/Spinner.js.map +1 -0
- package/dist/{app → lib}/components/SyntaxHighlight.d.ts +2 -1
- package/dist/{app → lib}/components/SyntaxHighlight.js +4 -1
- package/dist/lib/components/SyntaxHighlight.js.map +1 -0
- package/dist/{app → lib}/components/TopNavigation.js.map +1 -1
- package/dist/{app → lib}/components/context/ComponentsContext.d.ts +1 -1
- package/dist/{app → lib}/components/context/ComponentsContext.js.map +1 -1
- package/dist/{app → lib}/components/context/DevPortalProvider.js +1 -1
- package/dist/lib/components/context/DevPortalProvider.js.map +1 -0
- package/dist/lib/components/context/PluginSystem.js.map +1 -0
- package/dist/{app → lib}/components/context/ThemeContext.js +1 -1
- package/dist/{app → lib}/components/context/ThemeContext.js.map +1 -1
- package/dist/{app → lib}/components/context/ViewportAnchorContext.js.map +1 -1
- package/dist/lib/components/index.d.ts +3 -0
- package/dist/lib/components/index.js +4 -0
- package/dist/lib/components/index.js.map +1 -0
- package/dist/{app → lib}/components/navigation/SideNavigation.js +1 -1
- package/dist/{app → lib}/components/navigation/SideNavigation.js.map +1 -1
- package/dist/{app → lib}/components/navigation/SideNavigationCategory.js +1 -1
- package/dist/{app → lib}/components/navigation/SideNavigationCategory.js.map +1 -1
- package/dist/{app → lib}/components/navigation/SideNavigationItem.d.ts +2 -1
- package/dist/{app → lib}/components/navigation/SideNavigationItem.js +12 -6
- package/dist/lib/components/navigation/SideNavigationItem.js.map +1 -0
- package/dist/{app → lib}/components/navigation/SideNavigationWrapper.d.ts +3 -0
- package/dist/lib/components/navigation/SideNavigationWrapper.js +7 -0
- package/dist/lib/components/navigation/SideNavigationWrapper.js.map +1 -0
- package/dist/{app → lib}/components/navigation/useNavigationCollapsibleState.js.map +1 -1
- package/dist/{app → lib}/components/navigation/util.js.map +1 -1
- package/dist/{app → lib}/core/DevPortalContext.d.ts +10 -32
- package/dist/lib/core/DevPortalContext.js +48 -0
- package/dist/lib/core/DevPortalContext.js.map +1 -0
- package/dist/{app → lib}/core/helmet.js.map +1 -1
- package/dist/lib/core/icons.js.map +1 -0
- package/dist/{app → lib}/core/plugins.d.ts +2 -7
- package/dist/{app → lib}/core/plugins.js +1 -1
- package/dist/{app → lib}/core/plugins.js.map +1 -1
- package/dist/lib/core/router.js.map +1 -0
- package/dist/{app → lib}/oas/graphql/index.js +2 -2
- package/dist/lib/oas/graphql/index.js.map +1 -0
- package/dist/{app → lib}/oas/parser/dereference/index.js.map +1 -1
- package/dist/{app → lib}/oas/parser/dereference/resolveRef.js.map +1 -1
- package/dist/{app → lib}/oas/parser/index.js.map +1 -1
- package/dist/{app → lib}/oas/parser/upgrade/index.js.map +1 -1
- package/dist/lib/plugins/api-key/CreateApiKey.d.ts +5 -0
- package/dist/lib/plugins/api-key/CreateApiKey.js +37 -0
- package/dist/lib/plugins/api-key/CreateApiKey.js.map +1 -0
- package/dist/lib/plugins/api-key/SettingsApiKeys.d.ts +5 -0
- package/dist/lib/plugins/api-key/SettingsApiKeys.js +38 -0
- package/dist/lib/plugins/api-key/SettingsApiKeys.js.map +1 -0
- package/dist/lib/plugins/api-key/index.d.ts +30 -0
- package/dist/lib/plugins/api-key/index.js +67 -0
- package/dist/lib/plugins/api-key/index.js.map +1 -0
- package/dist/lib/plugins/index.d.ts +4 -0
- package/dist/lib/plugins/index.js +5 -0
- package/dist/lib/plugins/index.js.map +1 -0
- package/dist/lib/plugins/markdown/MdxPage.d.ts +5 -0
- package/dist/lib/plugins/markdown/MdxPage.js +60 -0
- package/dist/lib/plugins/markdown/MdxPage.js.map +1 -0
- package/dist/{app → lib}/plugins/markdown/Toc.js.map +1 -1
- package/dist/{app → lib}/plugins/markdown/generateRoutes.js +1 -6
- package/dist/lib/plugins/markdown/generateRoutes.js.map +1 -0
- package/dist/{app → lib}/plugins/markdown/index.js.map +1 -1
- package/dist/{app → lib}/plugins/openapi/ColorizedParam.d.ts +1 -2
- package/dist/{app → lib}/plugins/openapi/ColorizedParam.js +2 -2
- package/dist/lib/plugins/openapi/ColorizedParam.js.map +1 -0
- package/dist/lib/plugins/openapi/MakeRequest.js +43 -0
- package/dist/lib/plugins/openapi/MakeRequest.js.map +1 -0
- package/dist/{app → lib}/plugins/openapi/MethodBadge.js.map +1 -1
- package/dist/{app → lib}/plugins/openapi/OperationList.js +12 -3
- package/dist/lib/plugins/openapi/OperationList.js.map +1 -0
- package/dist/lib/plugins/openapi/OperationListItem.js +17 -0
- package/dist/lib/plugins/openapi/OperationListItem.js.map +1 -0
- package/dist/{app → lib}/plugins/openapi/ParameterList.d.ts +2 -2
- package/dist/lib/plugins/openapi/ParameterList.js +5 -0
- package/dist/lib/plugins/openapi/ParameterList.js.map +1 -0
- package/dist/lib/plugins/openapi/ParameterListItem.js +13 -0
- package/dist/{app → lib}/plugins/openapi/ParameterListItem.js.map +1 -1
- package/dist/{app → lib}/plugins/openapi/RequestBodySidecarBox.js +1 -1
- package/dist/{app → lib}/plugins/openapi/RequestBodySidecarBox.js.map +1 -1
- package/dist/{app → lib}/plugins/openapi/ResponsesSidecarBox.js +3 -3
- package/dist/{app → lib}/plugins/openapi/ResponsesSidecarBox.js.map +1 -1
- package/dist/lib/plugins/openapi/SchemaListView.d.ts +7 -0
- package/dist/lib/plugins/openapi/SchemaListView.js +43 -0
- package/dist/lib/plugins/openapi/SchemaListView.js.map +1 -0
- package/dist/{app → lib}/plugins/openapi/Select.js.map +1 -1
- package/dist/{app → lib}/plugins/openapi/Sidecar.js +15 -15
- package/dist/{app → lib}/plugins/openapi/Sidecar.js.map +1 -1
- package/dist/{app → lib}/plugins/openapi/SidecarBox.js.map +1 -1
- package/dist/{app → lib}/plugins/openapi/graphql/fragment-masking.d.ts +1 -1
- package/dist/{app → lib}/plugins/openapi/graphql/fragment-masking.js.map +1 -1
- package/dist/{app → lib}/plugins/openapi/graphql/gql.d.ts +5 -5
- package/dist/{app → lib}/plugins/openapi/graphql/gql.js +2 -3
- package/dist/lib/plugins/openapi/graphql/gql.js.map +1 -0
- package/dist/{app → lib}/plugins/openapi/graphql/graphql.d.ts +9 -0
- package/dist/{app → lib}/plugins/openapi/graphql/graphql.js +50 -0
- package/dist/lib/plugins/openapi/graphql/graphql.js.map +1 -0
- package/dist/lib/plugins/openapi/graphql/index.js.map +1 -0
- package/dist/{app → lib}/plugins/openapi/index.js +3 -1
- package/dist/lib/plugins/openapi/index.js.map +1 -0
- package/dist/lib/plugins/openapi/playground/Editor.d.ts +1 -0
- package/dist/lib/plugins/openapi/playground/Editor.js +5 -0
- package/dist/lib/plugins/openapi/playground/Editor.js.map +1 -0
- package/dist/lib/plugins/openapi/playground/Headers.d.ts +7 -0
- package/dist/lib/plugins/openapi/playground/Headers.js +15 -0
- package/dist/lib/plugins/openapi/playground/Headers.js.map +1 -0
- package/dist/lib/plugins/openapi/playground/InlineInput.d.ts +4 -0
- package/dist/lib/plugins/openapi/playground/InlineInput.js +3 -0
- package/dist/lib/plugins/openapi/playground/InlineInput.js.map +1 -0
- package/dist/lib/plugins/openapi/playground/PathParams.d.ts +6 -0
- package/dist/lib/plugins/openapi/playground/PathParams.js +21 -0
- package/dist/lib/plugins/openapi/playground/PathParams.js.map +1 -0
- package/dist/lib/plugins/openapi/playground/Playground.d.ts +31 -0
- package/dist/lib/plugins/openapi/playground/Playground.js +97 -0
- package/dist/lib/plugins/openapi/playground/Playground.js.map +1 -0
- package/dist/lib/plugins/openapi/playground/QueryParams.d.ts +5 -0
- package/dist/lib/plugins/openapi/playground/QueryParams.js +22 -0
- package/dist/lib/plugins/openapi/playground/QueryParams.js.map +1 -0
- package/dist/lib/plugins/openapi/playground/UrlDisplay.d.ts +4 -0
- package/dist/lib/plugins/openapi/playground/UrlDisplay.js +22 -0
- package/dist/lib/plugins/openapi/playground/UrlDisplay.js.map +1 -0
- package/dist/lib/plugins/openapi/playground/createUrl.d.ts +2 -0
- package/dist/lib/plugins/openapi/playground/createUrl.js +15 -0
- package/dist/lib/plugins/openapi/playground/createUrl.js.map +1 -0
- package/dist/{app → lib}/plugins/openapi/util/generateSchemaExample.d.ts +1 -1
- package/dist/{app → lib}/plugins/openapi/util/generateSchemaExample.js +17 -9
- package/dist/lib/plugins/openapi/util/generateSchemaExample.js.map +1 -0
- package/dist/{app → lib}/plugins/openapi/util/urql.js.map +1 -1
- package/dist/{app → lib}/plugins/openapi/worker/createSharedWorkerClient.js +2 -1
- package/dist/lib/plugins/openapi/worker/createSharedWorkerClient.js.map +1 -0
- package/dist/lib/plugins/openapi/worker/shared-worker.d.ts +1 -0
- package/dist/lib/plugins/openapi/worker/shared-worker.js +6 -0
- package/dist/lib/plugins/openapi/worker/shared-worker.js.map +1 -0
- package/dist/{app → lib}/plugins/openapi/worker/worker.js.map +1 -1
- package/dist/lib/plugins/openapi-worker.d.ts +1 -0
- package/dist/lib/plugins/openapi-worker.js +2 -0
- package/dist/lib/plugins/openapi-worker.js.map +1 -0
- package/dist/{app → lib}/plugins/redirect/index.d.ts +1 -2
- package/dist/{app → lib}/plugins/redirect/index.js.map +1 -1
- package/dist/lib/ui/Button.d.ts +7 -0
- package/dist/lib/ui/Button.js +11 -0
- package/dist/lib/ui/Button.js.map +1 -0
- package/dist/{app → lib}/ui/Callout.js.map +1 -1
- package/dist/{app → lib}/ui/Card.js.map +1 -1
- package/dist/{app → lib}/ui/Note.js.map +1 -1
- package/dist/{app → lib}/ui/Tabs.d.ts +2 -2
- package/dist/{app → lib}/ui/Tabs.js +2 -2
- package/dist/{app → lib}/ui/Tabs.js.map +1 -1
- package/dist/lib/ui/button-variants.d.ts +4 -0
- package/dist/{app/ui/Button.js → lib/ui/button-variants.js} +2 -12
- package/dist/lib/ui/button-variants.js.map +1 -0
- package/dist/{app → lib}/util/MdxComponents.js +9 -9
- package/dist/lib/util/MdxComponents.js.map +1 -0
- package/dist/{app → lib}/util/cn.js.map +1 -1
- package/dist/lib/util/createVariantComponent.d.ts +9 -0
- package/dist/lib/util/createVariantComponent.js +17 -0
- package/dist/lib/util/createVariantComponent.js.map +1 -0
- package/dist/{app → lib}/util/createWaitForNotify.js.map +1 -1
- package/dist/{app → lib}/util/groupBy.js.map +1 -1
- package/dist/{app → lib}/util/joinPath.js.map +1 -1
- package/dist/{app → lib}/util/pastellize.js.map +1 -1
- package/dist/lib/util/slugify.js.map +1 -0
- package/dist/{app → lib}/util/traverseNavigation.js.map +1 -1
- package/dist/{app → lib}/util/useScrollToAnchor.js.map +1 -1
- package/dist/{app → lib}/util/useScrollToTop.js.map +1 -1
- package/dist/ts.js +1 -2
- package/dist/ts.js.map +1 -1
- package/dist/vite/build.js +2 -8
- package/dist/vite/build.js.map +1 -1
- package/dist/vite/common.d.ts +1 -0
- package/dist/vite/common.js +5 -0
- package/dist/vite/common.js.map +1 -0
- package/dist/vite/config.d.ts +9 -2
- package/dist/vite/config.js +69 -28
- package/dist/vite/config.js.map +1 -1
- package/dist/vite/dev-server.d.ts +2 -0
- package/dist/vite/dev-server.js +30 -10
- package/dist/vite/dev-server.js.map +1 -1
- package/dist/vite/plugin-api-keys.d.ts +4 -0
- package/dist/vite/plugin-api-keys.js +33 -0
- package/dist/vite/plugin-api-keys.js.map +1 -0
- package/dist/vite/plugin-api.js +4 -2
- package/dist/vite/plugin-api.js.map +1 -1
- package/dist/vite/plugin-auth.js +3 -2
- package/dist/vite/plugin-auth.js.map +1 -1
- package/dist/vite/plugin-component.d.ts +4 -0
- package/dist/vite/plugin-component.js +16 -0
- package/dist/vite/plugin-component.js.map +1 -0
- package/dist/vite/plugin-config.d.ts +1 -0
- package/dist/vite/plugin-config.js +4 -3
- package/dist/vite/plugin-config.js.map +1 -1
- package/dist/vite/plugin-docs.js +4 -2
- package/dist/vite/plugin-docs.js.map +1 -1
- package/dist/vite/plugin-docs.test.js +1 -2
- package/dist/vite/plugin-docs.test.js.map +1 -1
- package/dist/vite/plugin-html.js +0 -3
- package/dist/vite/plugin-html.js.map +1 -1
- package/dist/vite/plugin-mdx.js +3 -1
- package/dist/vite/plugin-mdx.js.map +1 -1
- package/dist/vite/plugin-metadata.d.ts +6 -0
- package/dist/vite/plugin-metadata.js +24 -0
- package/dist/vite/plugin-metadata.js.map +1 -0
- package/dist/vite/plugin-openapi-worker.d.ts +4 -0
- package/dist/vite/plugin-openapi-worker.js +28 -0
- package/dist/vite/plugin-openapi-worker.js.map +1 -0
- package/dist/vite/plugin-redirect.d.ts +4 -0
- package/dist/vite/plugin-redirect.js +32 -0
- package/dist/vite/plugin-redirect.js.map +1 -0
- package/dist/vite/plugin.js +8 -0
- package/dist/vite/plugin.js.map +1 -1
- package/lib/Spinner-7LezPqGn.js +8393 -0
- package/lib/_commonjsHelpers-BkfeUUK-.js +28 -0
- package/lib/assets/index-BPdJm2ty.js +4764 -0
- package/lib/assets/worker-BCcpCNJ7.js +14473 -0
- package/lib/clerk-Wslx_mPo.js +19685 -0
- package/lib/index-DNx3xWa2.js +3461 -0
- package/lib/prism-bash.min-DadFsM4Z.js +6 -0
- package/lib/prism-java.min-d5iT_mOd.js +6 -0
- package/lib/prism-json.min-B1GJqK1k.js +1 -0
- package/lib/prism-markup-templating-DZrrEs0A.js +61 -0
- package/lib/prism-php.min-o7FpoMP_.js +10 -0
- package/lib/prism-ruby.min-C7LwcKyz.js +9 -0
- package/lib/state-oycsxkHz.js +287 -0
- package/lib/urql-DMlBWUKL.js +1591 -0
- package/lib/zudoku.auth-auth0.js +26 -0
- package/lib/zudoku.auth-clerk.js +47 -0
- package/lib/zudoku.auth-openid.js +1058 -0
- package/lib/zudoku.components.js +925 -0
- package/lib/zudoku.openapi-worker.js +225 -0
- package/lib/zudoku.plugins.js +19863 -0
- package/package.json +69 -39
- package/src/app/App.tsx +16 -6
- package/src/app/main.css +1 -0
- package/src/app/main.tsx +12 -3
- package/src/lib/authentication/Callback.tsx +60 -0
- package/src/lib/authentication/authentication.ts +19 -0
- package/src/lib/authentication/errors.ts +21 -0
- package/src/lib/authentication/hook.ts +33 -0
- package/src/lib/authentication/providers/auth0.tsx +52 -0
- package/src/lib/authentication/providers/clerk.tsx +64 -0
- package/src/lib/authentication/providers/openid.tsx +312 -0
- package/src/lib/authentication/state.ts +19 -0
- package/src/{app → lib/components}/DevPortal.tsx +30 -42
- package/src/{app → lib}/components/Dialog.tsx +37 -37
- package/src/{app → lib}/components/Header.tsx +25 -20
- package/src/{app → lib/components}/Heading.tsx +2 -2
- package/src/{app → lib}/components/Layout.tsx +18 -12
- package/src/lib/components/Link.tsx +1 -0
- package/src/lib/components/Router.tsx +28 -0
- package/src/lib/components/Select.tsx +157 -0
- package/src/lib/components/Spinner.tsx +5 -0
- package/src/{app → lib}/components/SyntaxHighlight.tsx +10 -3
- package/src/{app → lib}/components/context/DevPortalProvider.ts +1 -1
- package/src/lib/components/index.ts +3 -0
- package/src/{app → lib}/components/navigation/SideNavigation.tsx +4 -1
- package/src/{app → lib}/components/navigation/SideNavigationCategory.tsx +3 -1
- package/src/{app → lib}/components/navigation/SideNavigationItem.tsx +16 -7
- package/src/lib/components/navigation/SideNavigationWrapper.tsx +24 -0
- package/src/{app → lib}/core/DevPortalContext.ts +28 -64
- package/src/{app → lib}/core/plugins.ts +5 -5
- package/src/{app → lib}/oas/graphql/index.ts +2 -2
- package/src/lib/plugins/api-key/CreateApiKey.tsx +100 -0
- package/src/lib/plugins/api-key/SettingsApiKeys.tsx +125 -0
- package/src/lib/plugins/api-key/index.tsx +115 -0
- package/src/lib/plugins/index.ts +4 -0
- package/src/{app → lib}/plugins/markdown/MdxPage.tsx +32 -10
- package/src/{app → lib}/plugins/markdown/generateRoutes.tsx +1 -16
- package/src/{app → lib}/plugins/openapi/ColorizedParam.tsx +1 -3
- package/src/lib/plugins/openapi/MakeRequest.tsx +63 -0
- package/src/{app → lib}/plugins/openapi/OperationList.tsx +14 -4
- package/src/{app → lib}/plugins/openapi/OperationListItem.tsx +40 -6
- package/src/{app → lib}/plugins/openapi/ParameterList.tsx +4 -4
- package/src/{app → lib}/plugins/openapi/ParameterListItem.tsx +5 -2
- package/src/{app → lib}/plugins/openapi/RequestBodySidecarBox.tsx +1 -1
- package/src/{app → lib}/plugins/openapi/ResponsesSidecarBox.tsx +2 -3
- package/src/lib/plugins/openapi/SchemaListView.tsx +228 -0
- package/src/{app → lib}/plugins/openapi/Sidecar.tsx +23 -23
- package/src/{app → lib}/plugins/openapi/graphql/gql.ts +7 -7
- package/src/{app → lib}/plugins/openapi/graphql/graphql.ts +59 -0
- package/src/{app → lib}/plugins/openapi/index.tsx +8 -2
- package/src/lib/plugins/openapi/playground/Editor.tsx +4 -0
- package/src/lib/plugins/openapi/playground/Headers.tsx +60 -0
- package/src/lib/plugins/openapi/playground/InlineInput.tsx +6 -0
- package/src/lib/plugins/openapi/playground/PathParams.tsx +63 -0
- package/src/lib/plugins/openapi/playground/Playground.tsx +366 -0
- package/src/lib/plugins/openapi/playground/QueryParams.tsx +89 -0
- package/src/lib/plugins/openapi/playground/UrlDisplay.tsx +32 -0
- package/src/lib/plugins/openapi/playground/createUrl.ts +22 -0
- package/src/{app → lib}/plugins/openapi/util/generateSchemaExample.ts +22 -9
- package/src/{app → lib}/plugins/openapi/worker/createSharedWorkerClient.ts +2 -1
- package/src/lib/plugins/openapi/worker/shared-worker.ts +5 -0
- package/src/lib/plugins/openapi-worker.ts +1 -0
- package/src/{app → lib}/plugins/redirect/index.tsx +1 -1
- package/src/lib/ui/Button.tsx +25 -0
- package/src/{app → lib}/ui/Tabs.tsx +2 -2
- package/src/{app/ui/Button.tsx → lib/ui/button-variants.ts} +4 -29
- package/src/{app → lib}/util/MdxComponents.tsx +33 -8
- package/src/{app → lib}/util/createVariantComponent.tsx +12 -7
- package/dist/app/DevPortal.d.ts +0 -25
- package/dist/app/DevPortal.js +0 -41
- package/dist/app/DevPortal.js.map +0 -1
- package/dist/app/Heading.js.map +0 -1
- package/dist/app/authentication/authentication.d.ts +0 -13
- package/dist/app/authentication/authentication.js.map +0 -1
- package/dist/app/authentication/clerk.d.ts +0 -5
- package/dist/app/authentication/clerk.js +0 -36
- package/dist/app/authentication/clerk.js.map +0 -1
- package/dist/app/authentication/openid.d.ts +0 -11
- package/dist/app/authentication/openid.js +0 -118
- package/dist/app/authentication/openid.js.map +0 -1
- package/dist/app/components/Dialog.js.map +0 -1
- package/dist/app/components/DynamicIcon.d.ts +0 -6
- package/dist/app/components/DynamicIcon.js +0 -6
- package/dist/app/components/DynamicIcon.js.map +0 -1
- package/dist/app/components/Header.d.ts +0 -1
- package/dist/app/components/Header.js +0 -15
- package/dist/app/components/Header.js.map +0 -1
- package/dist/app/components/Layout.js.map +0 -1
- package/dist/app/components/SyntaxHighlight.js.map +0 -1
- package/dist/app/components/context/DevPortalProvider.js.map +0 -1
- package/dist/app/components/context/PluginSystem.js.map +0 -1
- package/dist/app/components/navigation/SideNavigationItem.js.map +0 -1
- package/dist/app/components/navigation/SideNavigationWrapper.js +0 -6
- package/dist/app/components/navigation/SideNavigationWrapper.js.map +0 -1
- package/dist/app/core/DevPortalContext.js +0 -68
- package/dist/app/core/DevPortalContext.js.map +0 -1
- package/dist/app/core/icons.js.map +0 -1
- package/dist/app/core/router.js.map +0 -1
- package/dist/app/core/types/combine.d.ts +0 -4
- package/dist/app/core/types/combine.js +0 -2
- package/dist/app/core/types/combine.js.map +0 -1
- package/dist/app/oas/graphql/index.js.map +0 -1
- package/dist/app/oas/graphql/server.d.ts +0 -1
- package/dist/app/oas/graphql/server.js +0 -8
- package/dist/app/oas/graphql/server.js.map +0 -1
- package/dist/app/plugins/api-key/SettingsApiKeys.d.ts +0 -4
- package/dist/app/plugins/api-key/SettingsApiKeys.js +0 -7
- package/dist/app/plugins/api-key/SettingsApiKeys.js.map +0 -1
- package/dist/app/plugins/api-key/index.d.ts +0 -32
- package/dist/app/plugins/api-key/index.js +0 -55
- package/dist/app/plugins/api-key/index.js.map +0 -1
- package/dist/app/plugins/markdown/MdxPage.d.ts +0 -3
- package/dist/app/plugins/markdown/MdxPage.js +0 -55
- package/dist/app/plugins/markdown/MdxPage.js.map +0 -1
- package/dist/app/plugins/markdown/generateRoutes.js.map +0 -1
- package/dist/app/plugins/openapi/ColorizedParam.js.map +0 -1
- package/dist/app/plugins/openapi/MakeRequest.js +0 -23
- package/dist/app/plugins/openapi/MakeRequest.js.map +0 -1
- package/dist/app/plugins/openapi/OperationList.js.map +0 -1
- package/dist/app/plugins/openapi/OperationListItem.js +0 -15
- package/dist/app/plugins/openapi/OperationListItem.js.map +0 -1
- package/dist/app/plugins/openapi/ParameterList.js +0 -5
- package/dist/app/plugins/openapi/ParameterList.js.map +0 -1
- package/dist/app/plugins/openapi/ParameterListItem.js +0 -13
- package/dist/app/plugins/openapi/graphql/gql.js.map +0 -1
- package/dist/app/plugins/openapi/graphql/graphql.js.map +0 -1
- package/dist/app/plugins/openapi/graphql/index.js.map +0 -1
- package/dist/app/plugins/openapi/index.js.map +0 -1
- package/dist/app/plugins/openapi/playground/Playground.d.ts +0 -8
- package/dist/app/plugins/openapi/playground/Playground.js +0 -98
- package/dist/app/plugins/openapi/playground/Playground.js.map +0 -1
- package/dist/app/plugins/openapi/util/generateSchemaExample.js.map +0 -1
- package/dist/app/plugins/openapi/worker/createSharedWorkerClient.js.map +0 -1
- package/dist/app/ui/Button.d.ts +0 -11
- package/dist/app/ui/Button.js.map +0 -1
- package/dist/app/util/MdxComponents.js.map +0 -1
- package/dist/app/util/createVariantComponent.d.ts +0 -15
- package/dist/app/util/createVariantComponent.js +0 -12
- package/dist/app/util/createVariantComponent.js.map +0 -1
- package/dist/app/util/slugify.js.map +0 -1
- package/dist/auth.d.ts +0 -2
- package/dist/auth.js +0 -3
- package/dist/auth.js.map +0 -1
- package/dist/plugins.d.ts +0 -4
- package/dist/plugins.js +0 -6
- package/dist/plugins.js.map +0 -1
- package/src/app/authentication/authentication.ts +0 -18
- package/src/app/authentication/clerk.ts +0 -47
- package/src/app/authentication/openid.ts +0 -192
- package/src/app/components/DynamicIcon.tsx +0 -60
- package/src/app/components/navigation/SideNavigationWrapper.tsx +0 -15
- package/src/app/core/types/combine.ts +0 -16
- package/src/app/oas/graphql/server.ts +0 -10
- package/src/app/plugins/api-key/SettingsApiKeys.tsx +0 -22
- package/src/app/plugins/api-key/index.tsx +0 -123
- package/src/app/plugins/openapi/MakeRequest.tsx +0 -49
- package/src/app/plugins/openapi/playground/Playground.tsx +0 -309
- package/src/app/plugins/openapi/queries.graphql +0 -6
- package/dist/{app → lib}/authentication/authentication.js +0 -0
- package/dist/{app → lib}/components/AnchorLink.d.ts +0 -0
- package/dist/{app → lib}/components/AnchorLink.js +0 -0
- package/dist/{app → lib}/components/CategoryHeading.d.ts +0 -0
- package/dist/{app → lib}/components/CategoryHeading.js +0 -0
- package/dist/{app → lib/components}/Heading.d.ts +0 -0
- package/dist/{app → lib}/components/Input.d.ts +0 -0
- package/dist/{app → lib}/components/Input.js +0 -0
- package/dist/{app → lib}/components/Layout.d.ts +0 -0
- package/dist/{app → lib}/components/Markdown.d.ts +0 -0
- package/dist/{app → lib}/components/Markdown.js +0 -0
- package/dist/{app → lib}/components/TopNavigation.d.ts +0 -0
- package/dist/{app → lib}/components/TopNavigation.js +0 -0
- package/dist/{app → lib}/components/context/ComponentsContext.js +0 -0
- package/dist/{app → lib}/components/context/DevPortalProvider.d.ts +0 -0
- package/dist/{app → lib}/components/context/PluginSystem.d.ts +0 -0
- package/dist/{app → lib}/components/context/PluginSystem.js +0 -0
- package/dist/{app → lib}/components/context/ThemeContext.d.ts +0 -0
- package/dist/{app → lib}/components/context/ViewportAnchorContext.d.ts +0 -0
- package/dist/{app → lib}/components/context/ViewportAnchorContext.js +0 -0
- package/dist/{app → lib}/components/navigation/SideNavigation.d.ts +0 -0
- package/dist/{app → lib}/components/navigation/SideNavigationCategory.d.ts +0 -0
- package/dist/{app → lib}/components/navigation/useNavigationCollapsibleState.d.ts +0 -0
- package/dist/{app → lib}/components/navigation/useNavigationCollapsibleState.js +0 -0
- package/dist/{app → lib}/components/navigation/util.d.ts +0 -0
- package/dist/{app → lib}/components/navigation/util.js +0 -0
- package/dist/{app → lib}/core/helmet.d.ts +0 -0
- package/dist/{app → lib}/core/helmet.js +0 -0
- package/dist/{app → lib}/core/icons.d.ts +0 -0
- package/dist/{app → lib}/core/icons.js +0 -0
- package/dist/{app → lib}/core/router.d.ts +0 -0
- package/dist/{app → lib}/core/router.js +0 -0
- package/dist/{app → lib}/oas/graphql/index.d.ts +0 -0
- package/dist/{app → lib}/oas/parser/dereference/index.d.ts +0 -0
- package/dist/{app → lib}/oas/parser/dereference/index.js +0 -0
- package/dist/{app → lib}/oas/parser/dereference/resolveRef.d.ts +0 -0
- package/dist/{app → lib}/oas/parser/dereference/resolveRef.js +0 -0
- package/dist/{app → lib}/oas/parser/index.d.ts +0 -0
- package/dist/{app → lib}/oas/parser/index.js +0 -0
- package/dist/{app → lib}/oas/parser/upgrade/index.d.ts +0 -0
- package/dist/{app → lib}/oas/parser/upgrade/index.js +0 -0
- package/dist/{app → lib}/plugins/markdown/Toc.d.ts +0 -0
- package/dist/{app → lib}/plugins/markdown/Toc.js +0 -0
- package/dist/{app → lib}/plugins/markdown/generateRoutes.d.ts +0 -0
- package/dist/{app → lib}/plugins/markdown/index.d.ts +0 -0
- package/dist/{app → lib}/plugins/markdown/index.js +0 -0
- package/dist/{app → lib}/plugins/openapi/MakeRequest.d.ts +0 -0
- package/dist/{app → lib}/plugins/openapi/MethodBadge.d.ts +0 -0
- package/dist/{app → lib}/plugins/openapi/MethodBadge.js +0 -0
- package/dist/{app → lib}/plugins/openapi/OperationList.d.ts +0 -0
- package/dist/{app → lib}/plugins/openapi/OperationListItem.d.ts +0 -0
- package/dist/{app → lib}/plugins/openapi/ParameterListItem.d.ts +0 -0
- package/dist/{app → lib}/plugins/openapi/RequestBodySidecarBox.d.ts +0 -0
- package/dist/{app → lib}/plugins/openapi/ResponsesSidecarBox.d.ts +0 -0
- package/dist/{app → lib}/plugins/openapi/Select.d.ts +0 -0
- package/dist/{app → lib}/plugins/openapi/Select.js +0 -0
- package/dist/{app → lib}/plugins/openapi/Sidecar.d.ts +0 -0
- package/dist/{app → lib}/plugins/openapi/SidecarBox.d.ts +0 -0
- package/dist/{app → lib}/plugins/openapi/SidecarBox.js +0 -0
- package/dist/{app → lib}/plugins/openapi/graphql/fragment-masking.js +0 -0
- package/dist/{app → lib}/plugins/openapi/graphql/index.d.ts +0 -0
- package/dist/{app → lib}/plugins/openapi/graphql/index.js +0 -0
- package/dist/{app → lib}/plugins/openapi/index.d.ts +0 -0
- package/dist/{app → lib}/plugins/openapi/util/urql.d.ts +0 -0
- package/dist/{app → lib}/plugins/openapi/util/urql.js +0 -0
- package/dist/{app → lib}/plugins/openapi/worker/createSharedWorkerClient.d.ts +0 -0
- package/dist/{app → lib}/plugins/openapi/worker/worker.d.ts +0 -0
- package/dist/{app → lib}/plugins/openapi/worker/worker.js +0 -0
- package/dist/{app → lib}/plugins/redirect/index.js +0 -0
- package/dist/{app → lib}/ui/Callout.d.ts +0 -0
- package/dist/{app → lib}/ui/Callout.js +0 -0
- package/dist/{app → lib}/ui/Card.d.ts +0 -0
- package/dist/{app → lib}/ui/Card.js +0 -0
- package/dist/{app → lib}/ui/Note.d.ts +0 -0
- package/dist/{app → lib}/ui/Note.js +0 -0
- package/dist/{app → lib}/util/MdxComponents.d.ts +0 -0
- package/dist/{app → lib}/util/cn.d.ts +0 -0
- package/dist/{app → lib}/util/cn.js +0 -0
- package/dist/{app → lib}/util/createWaitForNotify.d.ts +0 -0
- package/dist/{app → lib}/util/createWaitForNotify.js +0 -0
- package/dist/{app → lib}/util/groupBy.d.ts +0 -0
- package/dist/{app → lib}/util/groupBy.js +0 -0
- package/dist/{app → lib}/util/joinPath.d.ts +0 -0
- package/dist/{app → lib}/util/joinPath.js +0 -0
- package/dist/{app → lib}/util/pastellize.d.ts +0 -0
- package/dist/{app → lib}/util/pastellize.js +0 -0
- package/dist/{app → lib}/util/slugify.d.ts +0 -0
- package/dist/{app → lib}/util/slugify.js +0 -0
- package/dist/{app → lib}/util/traverseNavigation.d.ts +0 -0
- package/dist/{app → lib}/util/traverseNavigation.js +0 -0
- package/dist/{app → lib}/util/useScrollToAnchor.d.ts +0 -0
- package/dist/{app → lib}/util/useScrollToAnchor.js +0 -0
- package/dist/{app → lib}/util/useScrollToTop.d.ts +0 -0
- package/dist/{app → lib}/util/useScrollToTop.js +0 -0
- package/src/{app → lib}/components/AnchorLink.tsx +0 -0
- package/src/{app → lib}/components/CategoryHeading.tsx +1 -1
- package/src/{app → lib}/components/Input.tsx +0 -0
- package/src/{app → lib}/components/Markdown.tsx +0 -0
- package/src/{app → lib}/components/TopNavigation.tsx +0 -0
- package/src/{app → lib}/components/context/ComponentsContext.tsx +0 -0
- package/src/{app → lib}/components/context/PluginSystem.ts +0 -0
- package/src/{app → lib}/components/context/ThemeContext.tsx +1 -1
- package/src/{app → lib}/components/context/ViewportAnchorContext.tsx +0 -0
- package/src/{app → lib}/components/navigation/useNavigationCollapsibleState.ts +0 -0
- package/src/{app → lib}/components/navigation/util.ts +0 -0
- package/src/{app → lib}/core/helmet.ts +0 -0
- package/src/{app → lib}/core/icons.tsx +0 -0
- package/src/{app → lib}/core/router.tsx +0 -0
- package/src/{app → lib}/oas/parser/dereference/index.ts +0 -0
- package/src/{app → lib}/oas/parser/dereference/resolveRef.ts +0 -0
- package/src/{app → lib}/oas/parser/index.ts +0 -0
- package/src/{app → lib}/oas/parser/schemas/v3.0.json +0 -0
- package/src/{app → lib}/oas/parser/schemas/v3.1.json +0 -0
- package/src/{app → lib}/oas/parser/upgrade/index.ts +0 -0
- package/src/{app → lib}/plugins/markdown/Toc.tsx +0 -0
- package/src/{app → lib}/plugins/markdown/index.tsx +0 -0
- package/src/{app → lib}/plugins/openapi/MethodBadge.tsx +0 -0
- package/src/{app → lib}/plugins/openapi/Select.tsx +0 -0
- package/src/{app → lib}/plugins/openapi/SidecarBox.tsx +0 -0
- package/src/{app → lib}/plugins/openapi/graphql/fragment-masking.ts +1 -1
- /package/src/{app → lib}/plugins/openapi/graphql/index.ts +0 -0
- /package/src/{app → lib}/plugins/openapi/util/urql.ts +0 -0
- /package/src/{app → lib}/plugins/openapi/worker/worker.ts +0 -0
- /package/src/{app → lib}/ui/Callout.tsx +0 -0
- /package/src/{app → lib}/ui/Card.tsx +0 -0
- /package/src/{app → lib}/ui/Note.tsx +0 -0
- /package/src/{app → lib}/util/cn.ts +0 -0
- /package/src/{app → lib}/util/createWaitForNotify.ts +0 -0
- /package/src/{app → lib}/util/groupBy.ts +0 -0
- /package/src/{app → lib}/util/joinPath.tsx +0 -0
- /package/src/{app → lib}/util/pastellize.ts +0 -0
- /package/src/{app → lib}/util/slugify.ts +0 -0
- /package/src/{app → lib}/util/traverseNavigation.ts +0 -0
- /package/src/{app → lib}/util/useScrollToAnchor.ts +0 -0
- /package/src/{app → lib}/util/useScrollToTop.ts +0 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { useMutation } from "@tanstack/react-query";
|
|
2
|
+
import { useForm } from "react-hook-form";
|
|
3
|
+
import { Link, useNavigate } from "react-router-dom";
|
|
4
|
+
import { useDevPortal } from "../../components/context/DevPortalProvider.js";
|
|
5
|
+
import { Input } from "../../components/Input.js";
|
|
6
|
+
import {
|
|
7
|
+
Select,
|
|
8
|
+
SelectContent,
|
|
9
|
+
SelectGroup,
|
|
10
|
+
SelectItem,
|
|
11
|
+
SelectTrigger,
|
|
12
|
+
SelectValue,
|
|
13
|
+
} from "../../components/Select.js";
|
|
14
|
+
import { Button } from "../../ui/Button.js";
|
|
15
|
+
import { type ApiKeyPluginOptions, ApiKeyService } from "./index.js";
|
|
16
|
+
|
|
17
|
+
type CreateApiKey = { description: string; expiresOn?: string };
|
|
18
|
+
|
|
19
|
+
export const CreateApiKey = ({
|
|
20
|
+
options,
|
|
21
|
+
service,
|
|
22
|
+
}: {
|
|
23
|
+
options: ApiKeyPluginOptions;
|
|
24
|
+
service: ApiKeyService;
|
|
25
|
+
}) => {
|
|
26
|
+
const context = useDevPortal();
|
|
27
|
+
const navigate = useNavigate();
|
|
28
|
+
const form = useForm<CreateApiKey>({
|
|
29
|
+
defaultValues: {
|
|
30
|
+
expiresOn: "30",
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
const createKeyMutation = useMutation({
|
|
34
|
+
mutationFn: ({ description, expiresOn }: CreateApiKey) => {
|
|
35
|
+
if (!service.createKey) {
|
|
36
|
+
throw new Error("deleteKey not implemented");
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const expiresOnDate =
|
|
40
|
+
expiresOn !== "never" ? addDaysToDate(Number(expiresOn)) : undefined;
|
|
41
|
+
|
|
42
|
+
return service.createKey(
|
|
43
|
+
{ description: description, expiresOn: expiresOnDate },
|
|
44
|
+
context,
|
|
45
|
+
);
|
|
46
|
+
},
|
|
47
|
+
onSuccess: () => navigate("/settings/api-keys/"),
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
if (!service.createKey) {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<div className="max-w-screen-lg pt-[--padding-content-top] pb-[--padding-content-bottom]">
|
|
56
|
+
<div className="flex justify-between mb-4 border-b border-border pb-1">
|
|
57
|
+
<h1 className="font-medium text-2xl">New API Key</h1>
|
|
58
|
+
</div>
|
|
59
|
+
<form
|
|
60
|
+
onSubmit={form.handleSubmit((data) => createKeyMutation.mutate(data))}
|
|
61
|
+
>
|
|
62
|
+
<div className="flex gap-2 flex-col">
|
|
63
|
+
Note
|
|
64
|
+
<Input {...form.register("description")} />
|
|
65
|
+
Expiration
|
|
66
|
+
<Select
|
|
67
|
+
onValueChange={(value) => form.setValue("expiresOn", value)}
|
|
68
|
+
defaultValue={form.getValues("expiresOn")}
|
|
69
|
+
>
|
|
70
|
+
<SelectTrigger>
|
|
71
|
+
<SelectValue />
|
|
72
|
+
</SelectTrigger>
|
|
73
|
+
<SelectContent>
|
|
74
|
+
<SelectGroup>
|
|
75
|
+
{[7, 30, 60, 90].map((option) => (
|
|
76
|
+
<SelectItem value={String(option)} key={option}>
|
|
77
|
+
{option} days
|
|
78
|
+
</SelectItem>
|
|
79
|
+
))}
|
|
80
|
+
<SelectItem value="never">Never</SelectItem>
|
|
81
|
+
</SelectGroup>
|
|
82
|
+
</SelectContent>
|
|
83
|
+
</Select>
|
|
84
|
+
<div className="flex gap-2">
|
|
85
|
+
<Button>Generate Key</Button>
|
|
86
|
+
<Button variant="outline" asChild>
|
|
87
|
+
<Link to="/settings/api-keys/">Cancel</Link>
|
|
88
|
+
</Button>
|
|
89
|
+
</div>
|
|
90
|
+
</div>
|
|
91
|
+
</form>
|
|
92
|
+
</div>
|
|
93
|
+
);
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const addDaysToDate = (days: number): string => {
|
|
97
|
+
const date = new Date();
|
|
98
|
+
date.setDate(date.getDate() + days);
|
|
99
|
+
return date.toISOString();
|
|
100
|
+
};
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useMutation,
|
|
3
|
+
useQueryClient,
|
|
4
|
+
useSuspenseQuery,
|
|
5
|
+
} from "@tanstack/react-query";
|
|
6
|
+
import { EyeIcon, EyeOffIcon, RotateCwIcon, TrashIcon } from "lucide-react";
|
|
7
|
+
import { useState } from "react";
|
|
8
|
+
import { Link } from "react-router-dom";
|
|
9
|
+
import { useDevPortal } from "../../components/context/DevPortalProvider.js";
|
|
10
|
+
import { Button } from "../../ui/Button.js";
|
|
11
|
+
import { Card } from "../../ui/Card.js";
|
|
12
|
+
import { type ApiKeyPluginOptions, ApiKeyService } from "./index.js";
|
|
13
|
+
|
|
14
|
+
export const SettingsApiKeys = ({
|
|
15
|
+
options,
|
|
16
|
+
service,
|
|
17
|
+
}: {
|
|
18
|
+
options: ApiKeyPluginOptions;
|
|
19
|
+
service: ApiKeyService;
|
|
20
|
+
}) => {
|
|
21
|
+
const context = useDevPortal();
|
|
22
|
+
const queryClient = useQueryClient();
|
|
23
|
+
const { data } = useSuspenseQuery({
|
|
24
|
+
queryFn: () => service.getKeys(context),
|
|
25
|
+
queryKey: ["api-keys"],
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const deleteKeyMutation = useMutation({
|
|
29
|
+
mutationFn: (id: string) => {
|
|
30
|
+
if (!service.deleteKey) {
|
|
31
|
+
throw new Error("deleteKey not implemented");
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return service.deleteKey(id, context);
|
|
35
|
+
},
|
|
36
|
+
onSuccess: () => {
|
|
37
|
+
void queryClient.invalidateQueries({ queryKey: ["api-keys"] });
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<div className="max-w-screen-lg pt-[--padding-content-top] pb-[--padding-content-bottom]">
|
|
43
|
+
<div className="flex justify-between mb-4 border-b border-border pb-3">
|
|
44
|
+
<h1 className="font-medium text-2xl">API Keys</h1>
|
|
45
|
+
{service.createKey && (
|
|
46
|
+
<Button asChild>
|
|
47
|
+
<Link to="/settings/api-keys/new">Create API Key</Link>
|
|
48
|
+
</Button>
|
|
49
|
+
)}
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
<Card>
|
|
53
|
+
<ul className="grid grid-cols-[min-content_1fr_min-content] ">
|
|
54
|
+
{data.map((key) => (
|
|
55
|
+
<li
|
|
56
|
+
className="border-b border-border p-5 grid grid-cols-subgrid col-span-full gap-2 items-center"
|
|
57
|
+
key={key.id}
|
|
58
|
+
>
|
|
59
|
+
<div className="flex flex-col gap-1 text-sm">
|
|
60
|
+
{key.description ?? key.id}
|
|
61
|
+
<div className="text-muted-foreground text-xs">
|
|
62
|
+
{key.createdOn && (
|
|
63
|
+
<div>
|
|
64
|
+
Created on {new Date(key.createdOn).toLocaleDateString()}
|
|
65
|
+
</div>
|
|
66
|
+
)}
|
|
67
|
+
{key.expiresOn && (
|
|
68
|
+
<div>
|
|
69
|
+
Expires on {new Date(key.expiresOn).toLocaleDateString()}
|
|
70
|
+
</div>
|
|
71
|
+
)}
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
<div className="items-center flex justify-center">
|
|
75
|
+
<RevealApiKey apiKey={key.key} />
|
|
76
|
+
</div>
|
|
77
|
+
<div className="flex gap-2">
|
|
78
|
+
{service.rollKey && (
|
|
79
|
+
<Button size="icon">
|
|
80
|
+
<RotateCwIcon size={16} />
|
|
81
|
+
</Button>
|
|
82
|
+
)}
|
|
83
|
+
{service.deleteKey && (
|
|
84
|
+
<Button
|
|
85
|
+
variant="ghost"
|
|
86
|
+
size="icon"
|
|
87
|
+
onClick={() => {
|
|
88
|
+
if (!confirm("Do you want to delete this key?")) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
deleteKeyMutation.mutate(key.id);
|
|
93
|
+
}}
|
|
94
|
+
disabled={deleteKeyMutation.isPending}
|
|
95
|
+
>
|
|
96
|
+
<TrashIcon size={16} />
|
|
97
|
+
</Button>
|
|
98
|
+
)}
|
|
99
|
+
</div>
|
|
100
|
+
</li>
|
|
101
|
+
))}
|
|
102
|
+
</ul>
|
|
103
|
+
</Card>
|
|
104
|
+
</div>
|
|
105
|
+
);
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const RevealApiKey = ({ apiKey }: { apiKey: string }) => {
|
|
109
|
+
const [revealed, setRevealed] = useState(false);
|
|
110
|
+
|
|
111
|
+
return (
|
|
112
|
+
<div className="flex gap-2 items-center text-sm">
|
|
113
|
+
<code className="border border-border rounded bg-gray-100 dark:bg-gray-950 p-1 font-mono">
|
|
114
|
+
{revealed ? apiKey : "•".repeat(apiKey.length)}
|
|
115
|
+
</code>
|
|
116
|
+
<Button
|
|
117
|
+
variant="outline"
|
|
118
|
+
onClick={() => setRevealed((prev) => !prev)}
|
|
119
|
+
size="icon"
|
|
120
|
+
>
|
|
121
|
+
{revealed ? <EyeOffIcon size={16} /> : <EyeIcon size={16} />}
|
|
122
|
+
</Button>
|
|
123
|
+
</div>
|
|
124
|
+
);
|
|
125
|
+
};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { DevPortalContext } from "../../core/DevPortalContext.js";
|
|
2
|
+
import {
|
|
3
|
+
type ApiIdentityPlugin,
|
|
4
|
+
type DevPortalPlugin,
|
|
5
|
+
} from "../../core/plugins.js";
|
|
6
|
+
import { CreateApiKey } from "./CreateApiKey.js";
|
|
7
|
+
import { SettingsApiKeys } from "./SettingsApiKeys.js";
|
|
8
|
+
|
|
9
|
+
export type ApiKeyResults = Promise<ApiKey[]>;
|
|
10
|
+
const DEFAULT_API_KEY_ENDPOINT =
|
|
11
|
+
"https://zudoku-rewiringamerica-main-ef9c9c0.d2.zuplo.dev";
|
|
12
|
+
|
|
13
|
+
export type ApiKeyService = {
|
|
14
|
+
getKeys: (context: DevPortalContext) => ApiKeyResults;
|
|
15
|
+
rollKey?: (id: string, context: DevPortalContext) => Promise<void>;
|
|
16
|
+
deleteKey?: (id: string, context: DevPortalContext) => Promise<void>;
|
|
17
|
+
updateKeyDescription?: (
|
|
18
|
+
apiKey: { jd: string; description: string },
|
|
19
|
+
context: DevPortalContext,
|
|
20
|
+
) => Promise<void>;
|
|
21
|
+
getUsage?: (apiKeys: string[], context: DevPortalContext) => Promise<void>;
|
|
22
|
+
createKey?: (
|
|
23
|
+
apiKey: { description: string; expiresOn?: string },
|
|
24
|
+
context: DevPortalContext,
|
|
25
|
+
) => Promise<void>;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export type GetApiKeysOptions = ApiKeyService | { endpoint: string } | object;
|
|
29
|
+
|
|
30
|
+
export type ApiKeyPluginOptions = object & GetApiKeysOptions;
|
|
31
|
+
|
|
32
|
+
export interface ApiKey {
|
|
33
|
+
id: string;
|
|
34
|
+
description?: string;
|
|
35
|
+
createdOn?: string;
|
|
36
|
+
updatedOn?: string;
|
|
37
|
+
expiresOn?: string;
|
|
38
|
+
key: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const createDefaultHandler = (endpoint: string): ApiKeyService => {
|
|
42
|
+
return {
|
|
43
|
+
deleteKey: async (id, context) => {
|
|
44
|
+
const request = new Request(endpoint + `/v1/developer/api-keys/${id}`, {
|
|
45
|
+
method: "DELETE",
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
await context.signRequest(request);
|
|
49
|
+
|
|
50
|
+
await fetch(request);
|
|
51
|
+
},
|
|
52
|
+
createKey: async (apiKey, context) => {
|
|
53
|
+
const request = new Request(endpoint + `/v1/developer/api-keys`, {
|
|
54
|
+
method: "POST",
|
|
55
|
+
headers: {
|
|
56
|
+
"Content-Type": "application/json",
|
|
57
|
+
},
|
|
58
|
+
body: JSON.stringify(apiKey),
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
await context.signRequest(request);
|
|
62
|
+
await fetch(request);
|
|
63
|
+
},
|
|
64
|
+
getKeys: async (context) => {
|
|
65
|
+
const request = new Request(endpoint + `/v1/developer/api-keys`);
|
|
66
|
+
|
|
67
|
+
await context.signRequest(request);
|
|
68
|
+
|
|
69
|
+
const keys = await fetch(request);
|
|
70
|
+
|
|
71
|
+
return await keys.json();
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export const apiKeyPlugin = (
|
|
77
|
+
options: ApiKeyPluginOptions,
|
|
78
|
+
): DevPortalPlugin & ApiIdentityPlugin => {
|
|
79
|
+
const endpoint =
|
|
80
|
+
"endpoint" in options ? options.endpoint : DEFAULT_API_KEY_ENDPOINT;
|
|
81
|
+
|
|
82
|
+
const service =
|
|
83
|
+
"getKeys" in options ? options : createDefaultHandler(endpoint);
|
|
84
|
+
|
|
85
|
+
return {
|
|
86
|
+
getIdentities: async (context) => {
|
|
87
|
+
try {
|
|
88
|
+
const keys = await service.getKeys(context);
|
|
89
|
+
|
|
90
|
+
return keys.map((key) => ({
|
|
91
|
+
authorizeRequest: (request) => {
|
|
92
|
+
request.headers.set("Authorization", `Bearer ${key.key}`);
|
|
93
|
+
return request;
|
|
94
|
+
},
|
|
95
|
+
id: key.id,
|
|
96
|
+
label: key.description ?? key.id,
|
|
97
|
+
}));
|
|
98
|
+
} catch {
|
|
99
|
+
return [];
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
getRoutes: () => {
|
|
103
|
+
return [
|
|
104
|
+
{
|
|
105
|
+
path: "/settings/api-keys",
|
|
106
|
+
element: <SettingsApiKeys options={options} service={service} />,
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
path: "/settings/api-keys/new",
|
|
110
|
+
element: <CreateApiKey options={options} service={service} />,
|
|
111
|
+
},
|
|
112
|
+
];
|
|
113
|
+
},
|
|
114
|
+
};
|
|
115
|
+
};
|
|
@@ -1,22 +1,42 @@
|
|
|
1
|
+
import { useMDXComponents } from "@mdx-js/react";
|
|
1
2
|
import { useMemo, type PropsWithChildren, type ReactNode } from "react";
|
|
2
|
-
import { Heading } from "../../Heading.js";
|
|
3
3
|
import { CategoryHeading } from "../../components/CategoryHeading.js";
|
|
4
|
+
import { Heading } from "../../components/Heading.js";
|
|
4
5
|
import { ProseClasses } from "../../components/Markdown.js";
|
|
5
6
|
import { useTopNavigationItem } from "../../components/context/DevPortalProvider.js";
|
|
6
7
|
import { isPathItem } from "../../components/navigation/util.js";
|
|
7
8
|
import { Helmet } from "../../core/helmet.js";
|
|
8
9
|
import { Link, useLocation } from "../../core/router.js";
|
|
10
|
+
import type { MdxComponentsType } from "../../util/MdxComponents.js";
|
|
9
11
|
import { cn } from "../../util/cn.js";
|
|
10
12
|
import slugify from "../../util/slugify.js";
|
|
11
13
|
import { traverseNavigation } from "../../util/traverseNavigation.js";
|
|
12
14
|
import { Toc } from "./Toc.js";
|
|
13
15
|
import type { MDXImport } from "./index.js";
|
|
14
16
|
|
|
17
|
+
const MarkdownHeadings = {
|
|
18
|
+
h2: ({ children, id }) => (
|
|
19
|
+
<Heading level={2} id={id} registerSidebarAnchor>
|
|
20
|
+
{children}
|
|
21
|
+
</Heading>
|
|
22
|
+
),
|
|
23
|
+
h3: ({ children, id }) => (
|
|
24
|
+
<Heading level={3} id={id} registerSidebarAnchor>
|
|
25
|
+
{" "}
|
|
26
|
+
{children}
|
|
27
|
+
</Heading>
|
|
28
|
+
),
|
|
29
|
+
} satisfies MdxComponentsType;
|
|
30
|
+
|
|
15
31
|
export const MdxPage = ({
|
|
16
|
-
|
|
32
|
+
mdxComponent: MdxComponent,
|
|
17
33
|
frontmatter,
|
|
18
34
|
tableOfContents,
|
|
19
|
-
}: PropsWithChildren<
|
|
35
|
+
}: PropsWithChildren<
|
|
36
|
+
Omit<MDXImport, "default"> & {
|
|
37
|
+
mdxComponent: MDXImport["default"];
|
|
38
|
+
}
|
|
39
|
+
>) => {
|
|
20
40
|
const navItem = useTopNavigationItem();
|
|
21
41
|
const location = useLocation();
|
|
22
42
|
|
|
@@ -28,9 +48,9 @@ export const MdxPage = ({
|
|
|
28
48
|
})
|
|
29
49
|
: undefined;
|
|
30
50
|
|
|
31
|
-
const title = frontmatter
|
|
32
|
-
const category = frontmatter
|
|
33
|
-
const hideToc = frontmatter
|
|
51
|
+
const title = frontmatter.title;
|
|
52
|
+
const category = frontmatter.category ?? categoryTitle;
|
|
53
|
+
const hideToc = frontmatter.toc === false;
|
|
34
54
|
|
|
35
55
|
const pageTitle =
|
|
36
56
|
tableOfContents.find((item) => item.depth === 1)?.value ?? title;
|
|
@@ -75,21 +95,23 @@ export const MdxPage = ({
|
|
|
75
95
|
<div
|
|
76
96
|
className={cn(
|
|
77
97
|
ProseClasses,
|
|
78
|
-
"
|
|
98
|
+
"max-w-full xl:w-full xl:max-w-prose flex-1 flex-shrink pt-[--padding-content-top] pb-[--padding-content-bottom]",
|
|
79
99
|
)}
|
|
80
100
|
>
|
|
81
|
-
<header
|
|
101
|
+
<header>
|
|
82
102
|
{category && <CategoryHeading>{category}</CategoryHeading>}
|
|
83
103
|
{title && (
|
|
84
104
|
<Heading level={1} id={slugify(title, { lower: true })}>
|
|
85
105
|
{title}
|
|
86
106
|
</Heading>
|
|
87
107
|
)}
|
|
88
|
-
{frontmatter
|
|
108
|
+
{frontmatter.description && (
|
|
89
109
|
<p className="prose-lg">{frontmatter.description}</p>
|
|
90
110
|
)}
|
|
91
111
|
</header>
|
|
92
|
-
|
|
112
|
+
<MdxComponent
|
|
113
|
+
components={{ ...useMDXComponents(), ...MarkdownHeadings }}
|
|
114
|
+
/>
|
|
93
115
|
<hr />
|
|
94
116
|
<div className="not-prose flex items-center justify-between gap-8">
|
|
95
117
|
{prev.path ? (
|
|
@@ -1,21 +1,10 @@
|
|
|
1
|
-
import { Heading } from "../../Heading.js";
|
|
2
1
|
import { useTopNavigationItem } from "../../components/context/DevPortalProvider.js";
|
|
3
2
|
import { isPathItem } from "../../components/navigation/util.js";
|
|
4
3
|
import { Navigate, type RouteObject } from "../../core/router.js";
|
|
5
|
-
import type { MdxComponentsType } from "../../util/MdxComponents.js";
|
|
6
4
|
import { traverseNavigation } from "../../util/traverseNavigation.js";
|
|
7
5
|
import { MdxPage } from "./MdxPage.js";
|
|
8
6
|
import type { MarkdownPluginOptions } from "./index.js";
|
|
9
7
|
|
|
10
|
-
const MarkdownHeadings = {
|
|
11
|
-
h2: ({ children, id }) => (
|
|
12
|
-
<Heading level={2} id={id} children={children} registerSidebarAnchor />
|
|
13
|
-
),
|
|
14
|
-
h3: ({ children, id }) => (
|
|
15
|
-
<Heading level={3} id={id} children={children} registerSidebarAnchor />
|
|
16
|
-
),
|
|
17
|
-
} satisfies MdxComponentsType;
|
|
18
|
-
|
|
19
8
|
export const generateRoutes = (
|
|
20
9
|
markdownFiles: MarkdownPluginOptions["markdownFiles"],
|
|
21
10
|
): RouteObject[] => {
|
|
@@ -39,11 +28,7 @@ export const generateRoutes = (
|
|
|
39
28
|
const { default: Component, ...props } = await importPromise();
|
|
40
29
|
|
|
41
30
|
return {
|
|
42
|
-
element:
|
|
43
|
-
<MdxPage {...props}>
|
|
44
|
-
<Component components={MarkdownHeadings} />
|
|
45
|
-
</MdxPage>
|
|
46
|
-
),
|
|
31
|
+
element: <MdxPage mdxComponent={Component} {...props} />,
|
|
47
32
|
};
|
|
48
33
|
},
|
|
49
34
|
} satisfies RouteObject;
|
|
@@ -15,7 +15,6 @@ export const usePastellizedColor = (name: string) => {
|
|
|
15
15
|
|
|
16
16
|
export const ColorizedParam = ({
|
|
17
17
|
name,
|
|
18
|
-
value,
|
|
19
18
|
className,
|
|
20
19
|
backgroundOpacity = "100%",
|
|
21
20
|
slug,
|
|
@@ -23,7 +22,6 @@ export const ColorizedParam = ({
|
|
|
23
22
|
onClick,
|
|
24
23
|
}: {
|
|
25
24
|
name: string;
|
|
26
|
-
value?: string;
|
|
27
25
|
className?: string;
|
|
28
26
|
backgroundOpacity?: string;
|
|
29
27
|
slug?: string;
|
|
@@ -76,7 +74,7 @@ export const ColorizedParam = ({
|
|
|
76
74
|
className="absolute inset-0 border-b-2 transition-opacity duration-200 opacity-30 group-data-[active=true]:opacity-100"
|
|
77
75
|
style={{ borderColor, backgroundColor }}
|
|
78
76
|
/>
|
|
79
|
-
<span className="relative">{children
|
|
77
|
+
<span className="relative">{children ?? name}</span>
|
|
80
78
|
</span>
|
|
81
79
|
);
|
|
82
80
|
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { graphql } from "./graphql/index.js";
|
|
2
|
+
import { useOasConfig } from "./index.js";
|
|
3
|
+
import type { OperationListItemResult } from "./OperationList.js";
|
|
4
|
+
import { Playground } from "./playground/Playground.js";
|
|
5
|
+
|
|
6
|
+
import { useQuery } from "urql";
|
|
7
|
+
|
|
8
|
+
const GetServerQuery = graphql(/* GraphQL */ `
|
|
9
|
+
query getServerQuery($input: JSON!, $type: SchemaType!) {
|
|
10
|
+
schema(input: $input, type: $type) {
|
|
11
|
+
url
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
`);
|
|
15
|
+
|
|
16
|
+
export const MakeRequest = ({
|
|
17
|
+
operation,
|
|
18
|
+
}: {
|
|
19
|
+
operation: OperationListItemResult;
|
|
20
|
+
}) => {
|
|
21
|
+
const variables = useOasConfig();
|
|
22
|
+
const [server] = useQuery({ query: GetServerQuery, variables });
|
|
23
|
+
|
|
24
|
+
const headers = operation.parameters
|
|
25
|
+
?.filter((p) => p.in === "header")
|
|
26
|
+
.map((p) => ({
|
|
27
|
+
name: p.name,
|
|
28
|
+
value: p.examples?.find((x) => x.value)?.value ?? "",
|
|
29
|
+
}));
|
|
30
|
+
const queryParams = operation.parameters
|
|
31
|
+
?.filter((p) => p.in === "query")
|
|
32
|
+
.sort((a, b) => (a.required && !b.required ? -1 : 1))
|
|
33
|
+
.map((p) => {
|
|
34
|
+
return {
|
|
35
|
+
name: p.name,
|
|
36
|
+
value: "",
|
|
37
|
+
active: p.required ?? false,
|
|
38
|
+
isRequired: p.required ?? false,
|
|
39
|
+
};
|
|
40
|
+
});
|
|
41
|
+
const pathParams = operation.parameters
|
|
42
|
+
?.filter((p) => p.in === "path")
|
|
43
|
+
.map((p) => ({
|
|
44
|
+
name: p.name,
|
|
45
|
+
value: "",
|
|
46
|
+
}));
|
|
47
|
+
|
|
48
|
+
const hasParams =
|
|
49
|
+
operation.parameters?.some((p) => p.in === "query" || p.in === "path") ??
|
|
50
|
+
false;
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<Playground
|
|
54
|
+
host={server.data?.schema.url ?? ""}
|
|
55
|
+
method={operation.method}
|
|
56
|
+
url={operation.path}
|
|
57
|
+
headers={headers}
|
|
58
|
+
queryParams={queryParams}
|
|
59
|
+
pathParams={pathParams}
|
|
60
|
+
hasParams={hasParams}
|
|
61
|
+
/>
|
|
62
|
+
);
|
|
63
|
+
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ResultOf } from "@graphql-typed-document-node/core";
|
|
2
2
|
import { CategoryHeading } from "../../components/CategoryHeading.js";
|
|
3
|
+
import { Heading } from "../../components/Heading.js";
|
|
3
4
|
import { Markdown, ProseClasses } from "../../components/Markdown.js";
|
|
4
5
|
import { cn } from "../../util/cn.js";
|
|
5
6
|
import { OperationListItem } from "./OperationListItem.js";
|
|
6
|
-
import { useOasConfig } from "./index.js";
|
|
7
7
|
import { graphql } from "./graphql/index.js";
|
|
8
|
+
import { useOasConfig } from "./index.js";
|
|
8
9
|
import { useQuery } from "./util/urql.js";
|
|
9
|
-
import { ResultOf } from "@graphql-typed-document-node/core";
|
|
10
10
|
|
|
11
11
|
export const OperationsFragment = graphql(/* GraphQL */ `
|
|
12
12
|
fragment OperationsFragment on OperationItem {
|
|
@@ -24,6 +24,13 @@ export const OperationsFragment = graphql(/* GraphQL */ `
|
|
|
24
24
|
required
|
|
25
25
|
schema
|
|
26
26
|
style
|
|
27
|
+
examples {
|
|
28
|
+
name
|
|
29
|
+
description
|
|
30
|
+
externalValue
|
|
31
|
+
value
|
|
32
|
+
summary
|
|
33
|
+
}
|
|
27
34
|
}
|
|
28
35
|
requestBody {
|
|
29
36
|
content {
|
|
@@ -72,12 +79,15 @@ const AllOperationsQuery = graphql(/* GraphQL */ `
|
|
|
72
79
|
}
|
|
73
80
|
`);
|
|
74
81
|
|
|
82
|
+
const suspenseContext = { suspense: true };
|
|
83
|
+
|
|
75
84
|
export const OperationList = () => {
|
|
76
85
|
const { type, input } = useOasConfig();
|
|
77
86
|
|
|
78
87
|
const [result] = useQuery({
|
|
79
88
|
query: AllOperationsQuery,
|
|
80
89
|
variables: { type, input },
|
|
90
|
+
context: suspenseContext,
|
|
81
91
|
});
|
|
82
92
|
|
|
83
93
|
if (!result.data) return null;
|
|
@@ -91,7 +101,7 @@ export const OperationList = () => {
|
|
|
91
101
|
</Heading>
|
|
92
102
|
<Markdown content={result.data.schema.description ?? ""} />
|
|
93
103
|
</div>
|
|
94
|
-
{result.data
|
|
104
|
+
{result.data.schema.tags
|
|
95
105
|
.filter((tag) => tag.operations.length > 0)
|
|
96
106
|
.map((tag) => (
|
|
97
107
|
<div key={tag.name}>
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { Heading } from "../../Heading.js";
|
|
1
|
+
import { Heading } from "../../components/Heading.js";
|
|
2
2
|
import { Markdown, ProseClasses } from "../../components/Markdown.js";
|
|
3
|
-
import {
|
|
3
|
+
import { Tabs, TabsContent, TabsList, TabsTrigger } from "../../ui/Tabs.js";
|
|
4
4
|
import { OperationsFragment } from "./OperationList.js";
|
|
5
5
|
import { ParameterList } from "./ParameterList.js";
|
|
6
|
+
import { SchemaListView } from "./SchemaListView.js";
|
|
6
7
|
import { Sidecar } from "./Sidecar.js";
|
|
7
8
|
import { FragmentType, useFragment } from "./graphql/index.js";
|
|
8
9
|
|
|
@@ -15,8 +16,11 @@ export const OperationListItem = ({
|
|
|
15
16
|
operationFragment: FragmentType<typeof OperationsFragment>;
|
|
16
17
|
}) => {
|
|
17
18
|
const operation = useFragment(OperationsFragment, operationFragment);
|
|
18
|
-
const groupedParameters = groupBy(
|
|
19
|
-
|
|
19
|
+
const groupedParameters = Object.groupBy(
|
|
20
|
+
operation.parameters ?? [],
|
|
21
|
+
(param) => param.in,
|
|
22
|
+
);
|
|
23
|
+
const first = operation.responses.find((re) => re.statusCode === "200");
|
|
20
24
|
return (
|
|
21
25
|
<div
|
|
22
26
|
key={operation.operationId}
|
|
@@ -35,11 +39,11 @@ export const OperationListItem = ({
|
|
|
35
39
|
{operation.parameters && operation.parameters.length > 0 && (
|
|
36
40
|
<div className="mt-4">
|
|
37
41
|
{PARAM_GROUPS.flatMap((group) =>
|
|
38
|
-
groupedParameters
|
|
42
|
+
groupedParameters[group]?.length ? (
|
|
39
43
|
<ParameterList
|
|
40
44
|
key={group}
|
|
41
45
|
id={operation.slug}
|
|
42
|
-
|
|
46
|
+
parameters={groupedParameters[group]}
|
|
43
47
|
group={group}
|
|
44
48
|
/>
|
|
45
49
|
) : (
|
|
@@ -48,7 +52,37 @@ export const OperationListItem = ({
|
|
|
48
52
|
)}
|
|
49
53
|
</div>
|
|
50
54
|
)}
|
|
55
|
+
<Heading level={3} className="capitalize">
|
|
56
|
+
Responses
|
|
57
|
+
</Heading>
|
|
58
|
+
<Tabs defaultValue={`${first?.statusCode}${first?.description}`}>
|
|
59
|
+
<TabsList>
|
|
60
|
+
{operation.responses.map((response) => (
|
|
61
|
+
<TabsTrigger
|
|
62
|
+
value={response.statusCode + response.description}
|
|
63
|
+
key={response.statusCode}
|
|
64
|
+
title={response.description}
|
|
65
|
+
>
|
|
66
|
+
{response.statusCode}
|
|
67
|
+
</TabsTrigger>
|
|
68
|
+
))}
|
|
69
|
+
</TabsList>
|
|
70
|
+
<ul className="list-none m-0 px-0 overflow-hidden">
|
|
71
|
+
{operation.responses.map((response) => (
|
|
72
|
+
<TabsContent
|
|
73
|
+
value={response.statusCode + response.description}
|
|
74
|
+
key={response.statusCode}
|
|
75
|
+
>
|
|
76
|
+
<SchemaListView
|
|
77
|
+
schema={response.content?.at(0)?.schema}
|
|
78
|
+
name=""
|
|
79
|
+
/>
|
|
80
|
+
</TabsContent>
|
|
81
|
+
))}
|
|
82
|
+
</ul>
|
|
83
|
+
</Tabs>
|
|
51
84
|
</div>
|
|
85
|
+
|
|
52
86
|
<Sidecar operation={operation} />
|
|
53
87
|
</div>
|
|
54
88
|
);
|