zudoku 0.3.0-dev.4 → 0.3.0-dev.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app/App.d.ts +1 -2
- package/dist/app/App.js +1 -28
- package/dist/app/App.js.map +1 -1
- package/dist/app/demo.d.ts +2 -0
- package/dist/app/demo.js +27 -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 +12 -0
- package/dist/app/entry.server.js +104 -0
- package/dist/app/entry.server.js.map +1 -0
- package/dist/app/main.d.ts +6 -1
- package/dist/app/main.js +54 -12
- package/dist/app/main.js.map +1 -1
- package/dist/app/standalone.d.ts +2 -0
- package/dist/app/standalone.js +32 -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/app/zudoku-manifest.d.ts +1 -0
- package/dist/app/zudoku-manifest.js +20 -0
- package/dist/app/zudoku-manifest.js.map +1 -0
- 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 +15 -16
- package/dist/internal.d.ts +1 -0
- package/dist/internal.js +2 -0
- package/dist/internal.js.map +1 -0
- package/dist/lib/authentication/Callback.js +1 -1
- package/dist/lib/authentication/Callback.js.map +1 -1
- package/dist/lib/authentication/authentication.d.ts +2 -2
- package/dist/lib/authentication/hook.d.ts +1 -0
- package/dist/lib/authentication/hook.js +1 -0
- package/dist/lib/authentication/hook.js.map +1 -1
- package/dist/lib/authentication/providers/auth0.js +1 -0
- package/dist/lib/authentication/providers/auth0.js.map +1 -1
- package/dist/lib/authentication/providers/clerk.js +4 -0
- package/dist/lib/authentication/providers/clerk.js.map +1 -1
- package/dist/lib/authentication/providers/openid.d.ts +1 -1
- package/dist/lib/authentication/providers/openid.js +2 -0
- package/dist/lib/authentication/providers/openid.js.map +1 -1
- package/dist/lib/authentication/state.d.ts +1 -0
- package/dist/lib/authentication/state.js +1 -0
- package/dist/lib/authentication/state.js.map +1 -1
- package/dist/lib/components/Bootstrap.d.ts +12 -0
- package/dist/lib/components/Bootstrap.js +9 -0
- package/dist/lib/components/Bootstrap.js.map +1 -0
- package/dist/lib/components/DevPortal.d.ts +4 -19
- package/dist/lib/components/DevPortal.js +17 -12
- package/dist/lib/components/DevPortal.js.map +1 -1
- 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 +3 -3
- package/dist/lib/components/Header.js.map +1 -1
- package/dist/lib/components/Heading.d.ts +9 -4
- package/dist/lib/components/Heading.js +17 -2
- package/dist/lib/components/Heading.js.map +1 -1
- package/dist/lib/components/InlineCode.d.ts +5 -0
- package/dist/lib/components/InlineCode.js +4 -0
- package/dist/lib/components/InlineCode.js.map +1 -0
- package/dist/lib/components/Layout.js +3 -2
- package/dist/lib/components/Layout.js.map +1 -1
- package/dist/lib/components/NotFoundPage.d.ts +1 -0
- package/dist/lib/components/NotFoundPage.js +12 -0
- package/dist/lib/components/NotFoundPage.js.map +1 -0
- package/dist/lib/components/SyntaxHighlight.d.ts +3 -2
- package/dist/lib/components/SyntaxHighlight.js +21 -19
- package/dist/lib/components/SyntaxHighlight.js.map +1 -1
- package/dist/lib/components/TopNavigation.d.ts +1 -1
- package/dist/lib/components/TopNavigation.js +4 -0
- package/dist/lib/components/TopNavigation.js.map +1 -1
- package/dist/lib/components/context/DevPortalProvider.d.ts +1 -1
- package/dist/lib/components/context/DevPortalProvider.js +2 -2
- package/dist/lib/components/context/DevPortalProvider.js.map +1 -1
- package/dist/lib/components/index.d.ts +28 -3
- package/dist/lib/components/index.js +17 -3
- package/dist/lib/components/index.js.map +1 -1
- package/dist/lib/core/DevPortalContext.d.ts +33 -3
- package/dist/lib/core/DevPortalContext.js +8 -5
- package/dist/lib/core/DevPortalContext.js.map +1 -1
- package/dist/lib/core/plugins.d.ts +7 -4
- package/dist/lib/core/plugins.js +1 -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 +1 -1
- 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-keys/CreateApiKey.d.ts +4 -0
- package/dist/lib/plugins/{api-key → api-keys}/CreateApiKey.js +1 -1
- package/dist/lib/plugins/api-keys/CreateApiKey.js.map +1 -0
- package/dist/lib/plugins/api-keys/SettingsApiKeys.d.ts +4 -0
- package/dist/lib/plugins/api-keys/SettingsApiKeys.js +38 -0
- package/dist/lib/plugins/api-keys/SettingsApiKeys.js.map +1 -0
- package/dist/lib/plugins/{api-key → api-keys}/index.js +32 -9
- package/dist/lib/plugins/api-keys/index.js.map +1 -0
- package/dist/lib/plugins/markdown/MdxPage.d.ts +3 -2
- package/dist/lib/plugins/markdown/MdxPage.js +7 -6
- package/dist/lib/plugins/markdown/MdxPage.js.map +1 -1
- package/dist/lib/plugins/markdown/Toc.js +1 -1
- package/dist/lib/plugins/markdown/Toc.js.map +1 -1
- package/dist/lib/plugins/markdown/generateRoutes.d.ts +3 -3
- package/dist/lib/plugins/markdown/generateRoutes.js +4 -4
- package/dist/lib/plugins/markdown/generateRoutes.js.map +1 -1
- package/dist/lib/plugins/markdown/index.d.ts +4 -1
- package/dist/lib/plugins/markdown/index.js +3 -7
- package/dist/lib/plugins/markdown/index.js.map +1 -1
- package/dist/lib/plugins/openapi/OperationList.js +16 -5
- package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
- package/dist/lib/plugins/openapi/OperationListItem.js +10 -5
- package/dist/lib/plugins/openapi/OperationListItem.js.map +1 -1
- package/dist/lib/plugins/openapi/ParameterList.js +1 -1
- package/dist/lib/plugins/openapi/ParameterList.js.map +1 -1
- package/dist/lib/plugins/openapi/ParameterListItem.js +1 -1
- package/dist/lib/plugins/openapi/ParameterListItem.js.map +1 -1
- package/dist/lib/plugins/openapi/{MakeRequest.d.ts → PlaygroundDialogWrapper.d.ts} +1 -1
- package/dist/lib/plugins/openapi/{MakeRequest.js → PlaygroundDialogWrapper.js} +5 -5
- package/dist/lib/plugins/openapi/PlaygroundDialogWrapper.js.map +1 -0
- package/dist/lib/plugins/openapi/RequestBodySidecarBox.js +1 -9
- package/dist/lib/plugins/openapi/RequestBodySidecarBox.js.map +1 -1
- package/dist/lib/plugins/openapi/ResponsesSidecarBox.js +1 -1
- package/dist/lib/plugins/openapi/ResponsesSidecarBox.js.map +1 -1
- package/dist/lib/plugins/openapi/Route.d.ts +6 -0
- package/dist/lib/plugins/openapi/Route.js +8 -0
- package/dist/lib/plugins/openapi/Route.js.map +1 -0
- package/dist/lib/plugins/openapi/SchemaListView.js +6 -27
- package/dist/lib/plugins/openapi/SchemaListView.js.map +1 -1
- package/dist/lib/plugins/openapi/SchemaListViewItem.d.ts +7 -0
- package/dist/lib/plugins/openapi/SchemaListViewItem.js +16 -0
- package/dist/lib/plugins/openapi/SchemaListViewItem.js.map +1 -0
- package/dist/lib/plugins/openapi/SchemaListViewItemGroup.d.ts +8 -0
- package/dist/lib/plugins/openapi/SchemaListViewItemGroup.js +17 -0
- package/dist/lib/plugins/openapi/SchemaListViewItemGroup.js.map +1 -0
- package/dist/lib/plugins/openapi/Sidecar.js +10 -8
- package/dist/lib/plugins/openapi/Sidecar.js.map +1 -1
- package/dist/lib/plugins/openapi/{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/client/createMemoryClient.d.ts +12 -0
- package/dist/lib/plugins/openapi/client/createMemoryClient.js +46 -0
- package/dist/lib/plugins/openapi/client/createMemoryClient.js.map +1 -0
- package/dist/lib/plugins/openapi/client/createServer.d.ts +4 -0
- package/dist/lib/plugins/openapi/client/createServer.js +30 -0
- package/dist/lib/plugins/openapi/client/createServer.js.map +1 -0
- package/dist/lib/plugins/openapi/client/createWorkerClient.d.ts +10 -0
- package/dist/lib/plugins/openapi/{worker/createSharedWorkerClient.js → client/createWorkerClient.js} +15 -2
- package/dist/lib/plugins/openapi/client/createWorkerClient.js.map +1 -0
- package/dist/lib/plugins/openapi/client/interfaces.d.ts +4 -0
- package/dist/lib/plugins/openapi/client/interfaces.js +2 -0
- package/dist/lib/plugins/openapi/client/interfaces.js.map +1 -0
- package/dist/lib/plugins/openapi/{worker → client}/worker.js +2 -2
- package/dist/lib/plugins/openapi/client/worker.js.map +1 -0
- package/dist/lib/plugins/openapi/context.d.ts +5 -0
- package/dist/lib/plugins/openapi/context.js +11 -0
- package/dist/lib/plugins/openapi/context.js.map +1 -0
- package/dist/lib/plugins/openapi/index.d.ts +4 -18
- package/dist/lib/plugins/openapi/index.js +35 -20
- package/dist/lib/plugins/openapi/index.js.map +1 -1
- package/dist/lib/plugins/openapi/interfaces.d.ts +15 -0
- package/dist/lib/plugins/openapi/interfaces.js +2 -0
- package/dist/lib/plugins/openapi/interfaces.js.map +1 -0
- package/dist/lib/plugins/openapi/playground/Headers.d.ts +2 -3
- package/dist/lib/plugins/openapi/playground/Headers.js +16 -6
- package/dist/lib/plugins/openapi/playground/Headers.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/PathParams.d.ts +1 -1
- package/dist/lib/plugins/openapi/playground/Playground.d.ts +4 -3
- package/dist/lib/plugins/openapi/playground/Playground.js +8 -12
- package/dist/lib/plugins/openapi/playground/Playground.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/PlaygroundDialog.d.ts +3 -0
- package/dist/lib/plugins/openapi/playground/PlaygroundDialog.js +10 -0
- package/dist/lib/plugins/openapi/playground/PlaygroundDialog.js.map +1 -0
- package/dist/lib/plugins/openapi/playground/QueryParams.d.ts +1 -1
- package/dist/lib/plugins/openapi/playground/QueryParams.js +2 -1
- package/dist/lib/plugins/openapi/playground/QueryParams.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/createUrl.d.ts +1 -1
- package/dist/lib/plugins/openapi/util/prose.d.ts +1 -0
- package/dist/lib/plugins/openapi/util/prose.js +4 -0
- package/dist/lib/plugins/openapi/util/prose.js.map +1 -0
- package/dist/lib/plugins/openapi-worker.d.ts +1 -1
- package/dist/lib/plugins/openapi-worker.js +1 -1
- package/dist/lib/plugins/openapi-worker.js.map +1 -1
- package/dist/lib/plugins/redirect/index.js +2 -3
- package/dist/lib/plugins/redirect/index.js.map +1 -1
- package/dist/lib/ui/Callout.js +2 -2
- package/dist/lib/ui/Callout.js.map +1 -1
- package/dist/lib/ui/button-variants.d.ts +2 -2
- package/dist/lib/util/MdxComponents.js +2 -2
- package/dist/lib/util/MdxComponents.js.map +1 -1
- package/dist/lib/util/groupBy.d.ts +1 -6
- package/dist/lib/util/groupBy.js +10 -8
- package/dist/lib/util/groupBy.js.map +1 -1
- package/dist/lib/util/logInit.d.ts +1 -0
- package/dist/lib/util/logInit.js +9 -0
- package/dist/lib/util/logInit.js.map +1 -0
- package/dist/lib/util/objectEntries.d.ts +4 -0
- package/dist/lib/util/objectEntries.js +2 -0
- package/dist/lib/util/objectEntries.js.map +1 -0
- package/dist/lib/util/renderIf.d.ts +1 -0
- package/dist/lib/util/renderIf.js +2 -0
- package/dist/lib/util/renderIf.js.map +1 -0
- package/dist/vite/build.js +27 -8
- package/dist/vite/build.js.map +1 -1
- package/dist/vite/config.d.ts +13 -9
- package/dist/vite/config.js +98 -57
- package/dist/vite/config.js.map +1 -1
- package/dist/vite/config.test.js +7 -4
- package/dist/vite/config.test.js.map +1 -1
- package/dist/vite/dev-server.d.ts +2 -1
- package/dist/vite/dev-server.js +43 -15
- package/dist/vite/dev-server.js.map +1 -1
- package/dist/vite/html.js +5 -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 +8 -19
- 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 +3 -2
- package/dist/vite/plugin-component.js.map +1 -1
- package/dist/vite/plugin-config.d.ts +0 -1
- package/dist/vite/plugin-config.js +13 -7
- 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 +55 -0
- package/dist/vite/plugin-custom-css.js.map +1 -0
- package/dist/vite/plugin-docs.js +14 -4
- package/dist/vite/plugin-docs.js.map +1 -1
- package/dist/vite/plugin-docs.test.js +1 -1
- package/dist/vite/plugin-docs.test.js.map +1 -1
- package/dist/vite/plugin-html.js +1 -9
- package/dist/vite/plugin-html.js.map +1 -1
- package/dist/vite/plugin-mdx.d.ts +3 -1
- package/dist/vite/plugin-mdx.js +4 -4
- package/dist/vite/plugin-mdx.js.map +1 -1
- package/dist/vite/plugin-redirect.js +9 -9
- package/dist/vite/plugin-redirect.js.map +1 -1
- package/dist/vite/plugin.js +3 -3
- package/dist/vite/plugin.js.map +1 -1
- package/dist/vite/prerender.d.ts +17 -0
- package/dist/vite/prerender.js +55 -0
- package/dist/vite/prerender.js.map +1 -0
- package/lib/AnchorLink-DCdBbdqo.js +705 -0
- package/lib/AnchorLink-DCdBbdqo.js.map +1 -0
- package/lib/DevPortalProvider-C-O1s7mm.js +1081 -0
- package/lib/DevPortalProvider-C-O1s7mm.js.map +1 -0
- package/lib/Markdown-CGZJUYcj.js +15028 -0
- package/lib/Markdown-CGZJUYcj.js.map +1 -0
- package/lib/MdxPage-BZLuBOqR.js +190 -0
- package/lib/MdxPage-BZLuBOqR.js.map +1 -0
- package/lib/OperationList-BEpN70_E.js +5562 -0
- package/lib/OperationList-BEpN70_E.js.map +1 -0
- package/lib/Route-WiMUalLG.js +13 -0
- package/lib/Route-WiMUalLG.js.map +1 -0
- package/lib/Select-BQ9-3iTJ.js +4571 -0
- package/lib/Select-BQ9-3iTJ.js.map +1 -0
- package/lib/Spinner-C1L_TK5f.js +182 -0
- package/lib/Spinner-C1L_TK5f.js.map +1 -0
- package/lib/_commonjsHelpers-BkfeUUK-.js +1 -0
- package/lib/_commonjsHelpers-BkfeUUK-.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-BjPv-hjP.js} +10742 -10318
- package/lib/assets/worker-BjPv-hjP.js.map +1 -0
- package/lib/context-_fYfJFgk.js +14 -0
- package/lib/context-_fYfJFgk.js.map +1 -0
- package/lib/createWorkerClient-TWecYOlx.js +16698 -0
- package/lib/createWorkerClient-TWecYOlx.js.map +1 -0
- package/lib/hook-SM2dMVmI.js +77 -0
- package/lib/hook-SM2dMVmI.js.map +1 -0
- package/lib/index-CtLNbq0d.js +412 -0
- package/lib/index-CtLNbq0d.js.map +1 -0
- package/lib/index-PvQa9XLl.js +724 -0
- package/lib/index-PvQa9XLl.js.map +1 -0
- package/lib/index-pI9JkN46.js +4765 -0
- package/lib/index-pI9JkN46.js.map +1 -0
- package/lib/jsx-runtime-DLtUZ5Ve.js +1526 -0
- package/lib/jsx-runtime-DLtUZ5Ve.js.map +1 -0
- package/lib/prism-bash.min-DadFsM4Z.js +1 -0
- package/lib/prism-bash.min-DadFsM4Z.js.map +1 -0
- package/lib/prism-csharp.min-Yizuc34Y.js +35 -0
- package/lib/prism-csharp.min-Yizuc34Y.js.map +1 -0
- package/lib/prism-java.min-d5iT_mOd.js +1 -0
- package/lib/prism-java.min-d5iT_mOd.js.map +1 -0
- package/lib/prism-json.min-B1GJqK1k.js +1 -0
- package/lib/prism-json.min-B1GJqK1k.js.map +1 -0
- package/lib/prism-markup-templating-DZrrEs0A.js +1 -0
- package/lib/prism-markup-templating-DZrrEs0A.js.map +1 -0
- package/lib/prism-objectivec.min-BXSWqpJJ.js +2 -0
- package/lib/prism-objectivec.min-BXSWqpJJ.js.map +1 -0
- package/lib/prism-php.min-o7FpoMP_.js +1 -0
- package/lib/prism-php.min-o7FpoMP_.js.map +1 -0
- package/lib/prism-ruby.min-C7LwcKyz.js +1 -0
- package/lib/prism-ruby.min-C7LwcKyz.js.map +1 -0
- package/lib/router-BkOLuJlq.js +2973 -0
- package/lib/router-BkOLuJlq.js.map +1 -0
- package/lib/slugify-DbLhpSPt.js +28 -0
- package/lib/slugify-DbLhpSPt.js.map +1 -0
- package/lib/{state-oycsxkHz.js → state-Ds_OxRHP.js} +20 -18
- package/lib/state-Ds_OxRHP.js.map +1 -0
- package/lib/util-Cgie7wjb.js +41 -0
- package/lib/util-Cgie7wjb.js.map +1 -0
- package/lib/zudoku.auth-auth0.js +3 -1
- package/lib/zudoku.auth-auth0.js.map +1 -0
- package/lib/zudoku.auth-clerk.js +11 -8
- package/lib/zudoku.auth-clerk.js.map +1 -0
- package/lib/zudoku.auth-openid.js +5 -2
- package/lib/zudoku.auth-openid.js.map +1 -0
- package/lib/zudoku.components.js +800 -464
- package/lib/zudoku.components.js.map +1 -0
- package/lib/zudoku.openapi-worker.js +3 -223
- package/lib/zudoku.openapi-worker.js.map +1 -0
- package/lib/zudoku.plugin-api-keys.js +287 -0
- package/lib/zudoku.plugin-api-keys.js.map +1 -0
- package/lib/zudoku.plugin-markdown.js +49 -0
- package/lib/zudoku.plugin-markdown.js.map +1 -0
- package/lib/zudoku.plugin-openapi.js +9 -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 +33 -15
- package/src/app/App.tsx +0 -40
- package/src/app/demo-cdn.html +26 -0
- package/src/app/demo.html +18 -0
- package/src/app/demo.tsx +40 -0
- package/src/app/entry.client.tsx +47 -0
- package/src/app/entry.server.tsx +158 -0
- package/src/app/main.css +74 -0
- package/src/app/main.tsx +71 -15
- package/src/app/standalone.html +20 -0
- package/src/app/standalone.tsx +46 -0
- package/src/app/tailwind.ts +2 -6
- package/src/app/zudoku-manifest.ts +22 -0
- package/src/lib/authentication/Callback.tsx +1 -1
- package/src/lib/authentication/authentication.ts +2 -5
- package/src/lib/authentication/hook.ts +1 -0
- package/src/lib/authentication/providers/auth0.tsx +1 -0
- package/src/lib/authentication/providers/clerk.tsx +3 -0
- package/src/lib/authentication/providers/openid.tsx +3 -1
- package/src/lib/authentication/state.ts +2 -0
- package/src/lib/components/Bootstrap.tsx +37 -0
- package/src/lib/components/DevPortal.tsx +41 -56
- package/src/lib/components/ErrorPage.tsx +28 -0
- package/src/lib/components/Header.tsx +7 -7
- package/src/lib/components/Heading.tsx +26 -7
- package/src/lib/components/InlineCode.tsx +19 -0
- package/src/lib/components/Layout.tsx +9 -7
- package/src/lib/components/NotFoundPage.tsx +39 -0
- package/src/lib/components/SyntaxHighlight.tsx +27 -19
- package/src/lib/components/TopNavigation.tsx +5 -0
- package/src/lib/components/context/DevPortalProvider.ts +2 -2
- package/src/lib/components/index.ts +21 -3
- package/src/lib/core/DevPortalContext.ts +42 -13
- package/src/lib/core/plugins.ts +10 -5
- package/src/lib/errors/ErrorAlert.tsx +21 -0
- package/src/lib/errors/RouterError.tsx +13 -0
- package/src/lib/errors/ServerError.tsx +5 -0
- package/src/lib/errors/TopLevelError.tsx +8 -0
- package/src/lib/oas/graphql/index.ts +2 -2
- package/src/lib/oas/parser/index.ts +41 -20
- package/src/lib/plugins/{api-key → api-keys}/CreateApiKey.tsx +2 -8
- package/src/lib/plugins/{api-key → api-keys}/SettingsApiKeys.tsx +21 -14
- package/src/lib/plugins/{api-key → api-keys}/index.tsx +43 -9
- package/src/lib/plugins/markdown/MdxPage.tsx +52 -35
- package/src/lib/plugins/markdown/Toc.tsx +1 -1
- package/src/lib/plugins/markdown/generateRoutes.tsx +16 -6
- package/src/lib/plugins/markdown/index.tsx +10 -7
- package/src/lib/plugins/openapi/OperationList.tsx +40 -4
- package/src/lib/plugins/openapi/OperationListItem.tsx +69 -42
- package/src/lib/plugins/openapi/ParameterList.tsx +1 -1
- package/src/lib/plugins/openapi/ParameterListItem.tsx +3 -4
- package/src/lib/plugins/openapi/{MakeRequest.tsx → PlaygroundDialogWrapper.tsx} +4 -4
- package/src/lib/plugins/openapi/RequestBodySidecarBox.tsx +2 -16
- package/src/lib/plugins/openapi/ResponsesSidecarBox.tsx +3 -1
- package/src/lib/plugins/openapi/Route.tsx +21 -0
- package/src/lib/plugins/openapi/SchemaListView.tsx +23 -192
- package/src/lib/plugins/openapi/SchemaListViewItem.tsx +110 -0
- package/src/lib/plugins/openapi/SchemaListViewItemGroup.tsx +63 -0
- package/src/lib/plugins/openapi/Sidecar.tsx +15 -10
- package/src/lib/plugins/openapi/{Select.tsx → SimpleSelect.tsx} +6 -3
- 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 -1
- package/src/lib/plugins/openapi/client/interfaces.ts +5 -0
- package/src/lib/plugins/openapi/{worker → client}/worker.ts +3 -3
- package/src/lib/plugins/openapi/context.tsx +16 -0
- package/src/lib/plugins/openapi/index.tsx +59 -52
- package/src/lib/plugins/openapi/interfaces.ts +9 -0
- package/src/lib/plugins/openapi/playground/Headers.tsx +60 -33
- package/src/lib/plugins/openapi/playground/PathParams.tsx +1 -1
- package/src/lib/plugins/openapi/playground/Playground.tsx +158 -193
- package/src/lib/plugins/openapi/playground/PlaygroundDialog.tsx +34 -0
- package/src/lib/plugins/openapi/playground/QueryParams.tsx +7 -2
- package/src/lib/plugins/openapi/playground/createUrl.ts +1 -1
- package/src/lib/plugins/openapi/util/prose.ts +7 -0
- package/src/lib/plugins/openapi-worker.ts +1 -1
- package/src/lib/plugins/redirect/index.tsx +2 -2
- package/src/lib/ui/Callout.tsx +4 -4
- package/src/lib/util/MdxComponents.tsx +2 -12
- package/src/lib/util/groupBy.ts +7 -12
- package/src/lib/util/logInit.ts +9 -0
- package/src/lib/util/objectEntries.ts +5 -0
- package/src/lib/util/renderIf.ts +4 -0
- package/dist/lib/components/Link.d.ts +0 -1
- package/dist/lib/components/Link.js +0 -2
- package/dist/lib/components/Link.js.map +0 -1
- package/dist/lib/components/Router.d.ts +0 -4
- package/dist/lib/components/Router.js +0 -20
- package/dist/lib/components/Router.js.map +0 -1
- package/dist/lib/core/helmet.d.ts +0 -4
- package/dist/lib/core/helmet.js +0 -5
- package/dist/lib/core/helmet.js.map +0 -1
- package/dist/lib/core/icons.d.ts +0 -1
- package/dist/lib/core/icons.js +0 -2
- package/dist/lib/core/icons.js.map +0 -1
- package/dist/lib/core/router.d.ts +0 -1
- package/dist/lib/core/router.js +0 -2
- package/dist/lib/core/router.js.map +0 -1
- package/dist/lib/plugins/api-key/CreateApiKey.d.ts +0 -5
- package/dist/lib/plugins/api-key/CreateApiKey.js.map +0 -1
- package/dist/lib/plugins/api-key/SettingsApiKeys.d.ts +0 -5
- package/dist/lib/plugins/api-key/SettingsApiKeys.js +0 -38
- package/dist/lib/plugins/api-key/SettingsApiKeys.js.map +0 -1
- package/dist/lib/plugins/api-key/index.js.map +0 -1
- package/dist/lib/plugins/index.d.ts +0 -4
- package/dist/lib/plugins/index.js +0 -5
- package/dist/lib/plugins/index.js.map +0 -1
- package/dist/lib/plugins/openapi/MakeRequest.js.map +0 -1
- package/dist/lib/plugins/openapi/Select.js +0 -5
- package/dist/lib/plugins/openapi/Select.js.map +0 -1
- package/dist/lib/plugins/openapi/worker/createSharedWorkerClient.d.ts +0 -5
- package/dist/lib/plugins/openapi/worker/createSharedWorkerClient.js.map +0 -1
- package/dist/lib/plugins/openapi/worker/shared-worker.d.ts +0 -1
- package/dist/lib/plugins/openapi/worker/shared-worker.js +0 -6
- package/dist/lib/plugins/openapi/worker/shared-worker.js.map +0 -1
- package/dist/lib/plugins/openapi/worker/worker.js.map +0 -1
- package/dist/vite/common.d.ts +0 -1
- package/dist/vite/common.js +0 -5
- package/dist/vite/common.js.map +0 -1
- package/dist/vite/plugin-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-7LezPqGn.js +0 -8393
- package/lib/clerk-Wslx_mPo.js +0 -19685
- package/lib/index-DNx3xWa2.js +0 -3461
- package/lib/urql-DMlBWUKL.js +0 -1591
- package/lib/zudoku.plugins.js +0 -19863
- package/src/lib/components/Link.tsx +0 -1
- package/src/lib/components/Router.tsx +0 -28
- package/src/lib/core/helmet.ts +0 -5
- package/src/lib/core/icons.tsx +0 -1
- package/src/lib/core/router.tsx +0 -1
- package/src/lib/plugins/index.ts +0 -4
- package/src/lib/plugins/openapi/worker/shared-worker.ts +0 -5
- /package/dist/lib/plugins/{api-key → api-keys}/index.d.ts +0 -0
- /package/dist/lib/plugins/openapi/{worker → client}/worker.d.ts +0 -0
|
@@ -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
|
+
}
|
|
@@ -45,7 +45,7 @@ export const slugifyOperation = (operation: OperationLike, tag?: string) => {
|
|
|
45
45
|
);
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
-
const cache = new LRUCache<string, OpenAPIDocument
|
|
48
|
+
const cache = new LRUCache<string, Promise<OpenAPIDocument>>({
|
|
49
49
|
ttl: 60 * 10 * 1000,
|
|
50
50
|
ttlAutopurge: true,
|
|
51
51
|
});
|
|
@@ -384,7 +384,7 @@ const loadOpenAPISchema = async (input: NonNullable<unknown>) => {
|
|
|
384
384
|
return cache.get(hash)!;
|
|
385
385
|
}
|
|
386
386
|
|
|
387
|
-
const schema =
|
|
387
|
+
const schema = validate(input);
|
|
388
388
|
|
|
389
389
|
cache.set(hash, schema);
|
|
390
390
|
|
|
@@ -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
|
};
|
|
@@ -12,17 +12,11 @@ import {
|
|
|
12
12
|
SelectValue,
|
|
13
13
|
} from "../../components/Select.js";
|
|
14
14
|
import { Button } from "../../ui/Button.js";
|
|
15
|
-
import {
|
|
15
|
+
import { ApiKeyService } from "./index.js";
|
|
16
16
|
|
|
17
17
|
type CreateApiKey = { description: string; expiresOn?: string };
|
|
18
18
|
|
|
19
|
-
export const CreateApiKey = ({
|
|
20
|
-
options,
|
|
21
|
-
service,
|
|
22
|
-
}: {
|
|
23
|
-
options: ApiKeyPluginOptions;
|
|
24
|
-
service: ApiKeyService;
|
|
25
|
-
}) => {
|
|
19
|
+
export const CreateApiKey = ({ service }: { service: ApiKeyService }) => {
|
|
26
20
|
const context = useDevPortal();
|
|
27
21
|
const navigate = useNavigate();
|
|
28
22
|
const form = useForm<CreateApiKey>({
|
|
@@ -8,21 +8,15 @@ import { useState } from "react";
|
|
|
8
8
|
import { Link } from "react-router-dom";
|
|
9
9
|
import { useDevPortal } from "../../components/context/DevPortalProvider.js";
|
|
10
10
|
import { Button } from "../../ui/Button.js";
|
|
11
|
-
import {
|
|
12
|
-
import { type ApiKeyPluginOptions, ApiKeyService } from "./index.js";
|
|
11
|
+
import { ApiKeyService } from "./index.js";
|
|
13
12
|
|
|
14
|
-
export const SettingsApiKeys = ({
|
|
15
|
-
options,
|
|
16
|
-
service,
|
|
17
|
-
}: {
|
|
18
|
-
options: ApiKeyPluginOptions;
|
|
19
|
-
service: ApiKeyService;
|
|
20
|
-
}) => {
|
|
13
|
+
export const SettingsApiKeys = ({ service }: { service: ApiKeyService }) => {
|
|
21
14
|
const context = useDevPortal();
|
|
22
15
|
const queryClient = useQueryClient();
|
|
23
16
|
const { data } = useSuspenseQuery({
|
|
24
17
|
queryFn: () => service.getKeys(context),
|
|
25
18
|
queryKey: ["api-keys"],
|
|
19
|
+
retry: false,
|
|
26
20
|
});
|
|
27
21
|
|
|
28
22
|
const deleteKeyMutation = useMutation({
|
|
@@ -39,7 +33,7 @@ export const SettingsApiKeys = ({
|
|
|
39
33
|
});
|
|
40
34
|
|
|
41
35
|
return (
|
|
42
|
-
<div className="max-w-screen-lg pt-[--padding-content-top] pb-[--padding-content-bottom]">
|
|
36
|
+
<div className="max-w-screen-lg h-full pt-[--padding-content-top] pb-[--padding-content-bottom]">
|
|
43
37
|
<div className="flex justify-between mb-4 border-b border-border pb-3">
|
|
44
38
|
<h1 className="font-medium text-2xl">API Keys</h1>
|
|
45
39
|
{service.createKey && (
|
|
@@ -49,9 +43,22 @@ export const SettingsApiKeys = ({
|
|
|
49
43
|
)}
|
|
50
44
|
</div>
|
|
51
45
|
|
|
52
|
-
|
|
53
|
-
<
|
|
54
|
-
|
|
46
|
+
{data.length === 0 ? (
|
|
47
|
+
<div className="flex flex-col justify-center gap-4 items-center h-1/2 my-8">
|
|
48
|
+
<div className="text-center">
|
|
49
|
+
No API keys created yet.
|
|
50
|
+
<br />
|
|
51
|
+
Get started and create the first one now
|
|
52
|
+
</div>
|
|
53
|
+
{service.createKey && (
|
|
54
|
+
<Button asChild>
|
|
55
|
+
<Link to="/settings/api-keys/new">Create API Key</Link>
|
|
56
|
+
</Button>
|
|
57
|
+
)}
|
|
58
|
+
</div>
|
|
59
|
+
) : (
|
|
60
|
+
<ul className="grid grid-cols-[minmax(250px,min-content)_1fr_min-content] ">
|
|
61
|
+
{data.map((key: any) => (
|
|
55
62
|
<li
|
|
56
63
|
className="border-b border-border p-5 grid grid-cols-subgrid col-span-full gap-2 items-center"
|
|
57
64
|
key={key.id}
|
|
@@ -100,7 +107,7 @@ export const SettingsApiKeys = ({
|
|
|
100
107
|
</li>
|
|
101
108
|
))}
|
|
102
109
|
</ul>
|
|
103
|
-
|
|
110
|
+
)}
|
|
104
111
|
</div>
|
|
105
112
|
);
|
|
106
113
|
};
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
import { Outlet, type RouteObject } from "react-router-dom";
|
|
2
|
+
import invariant from "tiny-invariant";
|
|
3
|
+
import { useAuth } from "../../authentication/hook.js";
|
|
1
4
|
import { DevPortalContext } from "../../core/DevPortalContext.js";
|
|
2
5
|
import {
|
|
3
6
|
type ApiIdentityPlugin,
|
|
4
7
|
type DevPortalPlugin,
|
|
5
8
|
} from "../../core/plugins.js";
|
|
9
|
+
import { RouterError } from "../../errors/RouterError.js";
|
|
10
|
+
import { Button } from "../../ui/Button.js";
|
|
6
11
|
import { CreateApiKey } from "./CreateApiKey.js";
|
|
7
12
|
import { SettingsApiKeys } from "./SettingsApiKeys.js";
|
|
8
13
|
|
|
@@ -47,7 +52,8 @@ const createDefaultHandler = (endpoint: string): ApiKeyService => {
|
|
|
47
52
|
|
|
48
53
|
await context.signRequest(request);
|
|
49
54
|
|
|
50
|
-
await fetch(request);
|
|
55
|
+
const response = await fetch(request);
|
|
56
|
+
invariant(response.ok, "Failed to delete API key");
|
|
51
57
|
},
|
|
52
58
|
createKey: async (apiKey, context) => {
|
|
53
59
|
const request = new Request(endpoint + `/v1/developer/api-keys`, {
|
|
@@ -59,7 +65,9 @@ const createDefaultHandler = (endpoint: string): ApiKeyService => {
|
|
|
59
65
|
});
|
|
60
66
|
|
|
61
67
|
await context.signRequest(request);
|
|
62
|
-
|
|
68
|
+
|
|
69
|
+
const response = await fetch(request);
|
|
70
|
+
invariant(response.ok, "Failed to create API key");
|
|
63
71
|
},
|
|
64
72
|
getKeys: async (context) => {
|
|
65
73
|
const request = new Request(endpoint + `/v1/developer/api-keys`);
|
|
@@ -67,12 +75,31 @@ const createDefaultHandler = (endpoint: string): ApiKeyService => {
|
|
|
67
75
|
await context.signRequest(request);
|
|
68
76
|
|
|
69
77
|
const keys = await fetch(request);
|
|
78
|
+
invariant(keys.ok, "Failed to fetch API keys");
|
|
70
79
|
|
|
71
80
|
return await keys.json();
|
|
72
81
|
},
|
|
73
82
|
};
|
|
74
83
|
};
|
|
75
84
|
|
|
85
|
+
const ProtectedRoute = () => {
|
|
86
|
+
const auth = useAuth();
|
|
87
|
+
|
|
88
|
+
// TODO: should we suspend here somehow?
|
|
89
|
+
if (auth.isPending) {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return auth.isAuthenticated ? (
|
|
94
|
+
<Outlet />
|
|
95
|
+
) : (
|
|
96
|
+
<div className="flex flex-col justify-center gap-2 items-center h-1/2 my-12">
|
|
97
|
+
Please login first to view this page
|
|
98
|
+
<Button onClick={() => auth.login()}>Login</Button>
|
|
99
|
+
</div>
|
|
100
|
+
);
|
|
101
|
+
};
|
|
102
|
+
|
|
76
103
|
export const apiKeyPlugin = (
|
|
77
104
|
options: ApiKeyPluginOptions,
|
|
78
105
|
): DevPortalPlugin & ApiIdentityPlugin => {
|
|
@@ -99,15 +126,22 @@ export const apiKeyPlugin = (
|
|
|
99
126
|
return [];
|
|
100
127
|
}
|
|
101
128
|
},
|
|
102
|
-
getRoutes: () => {
|
|
129
|
+
getRoutes: (): RouteObject[] => {
|
|
130
|
+
// TODO: Make lazy
|
|
103
131
|
return [
|
|
104
132
|
{
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
133
|
+
element: <ProtectedRoute />,
|
|
134
|
+
errorElement: <RouterError />,
|
|
135
|
+
children: [
|
|
136
|
+
{
|
|
137
|
+
path: "/settings/api-keys",
|
|
138
|
+
element: <SettingsApiKeys service={service} />,
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
path: "/settings/api-keys/new",
|
|
142
|
+
element: <CreateApiKey service={service} />,
|
|
143
|
+
},
|
|
144
|
+
],
|
|
111
145
|
},
|
|
112
146
|
];
|
|
113
147
|
},
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { useMDXComponents } from "@mdx-js/react";
|
|
2
|
+
import { Helmet } from "@zudoku/react-helmet-async";
|
|
2
3
|
import { useMemo, type PropsWithChildren, type ReactNode } from "react";
|
|
4
|
+
import { Link, useLocation } from "react-router-dom";
|
|
3
5
|
import { CategoryHeading } from "../../components/CategoryHeading.js";
|
|
4
6
|
import { Heading } from "../../components/Heading.js";
|
|
5
7
|
import { ProseClasses } from "../../components/Markdown.js";
|
|
6
8
|
import { useTopNavigationItem } from "../../components/context/DevPortalProvider.js";
|
|
7
9
|
import { isPathItem } from "../../components/navigation/util.js";
|
|
8
|
-
import { Helmet } from "../../core/helmet.js";
|
|
9
|
-
import { Link, useLocation } from "../../core/router.js";
|
|
10
10
|
import type { MdxComponentsType } from "../../util/MdxComponents.js";
|
|
11
11
|
import { cn } from "../../util/cn.js";
|
|
12
12
|
import slugify from "../../util/slugify.js";
|
|
13
13
|
import { traverseNavigation } from "../../util/traverseNavigation.js";
|
|
14
14
|
import { Toc } from "./Toc.js";
|
|
15
|
-
import
|
|
15
|
+
import { MarkdownPluginDefaultOptions, MDXImport } from "./index.js";
|
|
16
16
|
|
|
17
17
|
const MarkdownHeadings = {
|
|
18
18
|
h2: ({ children, id }) => (
|
|
@@ -30,11 +30,13 @@ const MarkdownHeadings = {
|
|
|
30
30
|
|
|
31
31
|
export const MdxPage = ({
|
|
32
32
|
mdxComponent: MdxComponent,
|
|
33
|
-
frontmatter,
|
|
33
|
+
frontmatter = {},
|
|
34
|
+
defaultOptions,
|
|
34
35
|
tableOfContents,
|
|
35
36
|
}: PropsWithChildren<
|
|
36
37
|
Omit<MDXImport, "default"> & {
|
|
37
38
|
mdxComponent: MDXImport["default"];
|
|
39
|
+
defaultOptions?: MarkdownPluginDefaultOptions;
|
|
38
40
|
}
|
|
39
41
|
>) => {
|
|
40
42
|
const navItem = useTopNavigationItem();
|
|
@@ -50,10 +52,11 @@ export const MdxPage = ({
|
|
|
50
52
|
|
|
51
53
|
const title = frontmatter.title;
|
|
52
54
|
const category = frontmatter.category ?? categoryTitle;
|
|
53
|
-
const hideToc = frontmatter.toc === false;
|
|
54
|
-
|
|
55
|
+
const hideToc = frontmatter.toc === false || defaultOptions?.toc === false;
|
|
55
56
|
const pageTitle =
|
|
56
57
|
tableOfContents.find((item) => item.depth === 1)?.value ?? title;
|
|
58
|
+
const hidePager =
|
|
59
|
+
frontmatter.disablePager ?? defaultOptions?.disablePager ?? false;
|
|
57
60
|
|
|
58
61
|
const tocEntries =
|
|
59
62
|
tableOfContents.find((item) => item.depth === 1)?.children ??
|
|
@@ -112,35 +115,49 @@ export const MdxPage = ({
|
|
|
112
115
|
<MdxComponent
|
|
113
116
|
components={{ ...useMDXComponents(), ...MarkdownHeadings }}
|
|
114
117
|
/>
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
<
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
118
|
+
{!hidePager && (
|
|
119
|
+
<>
|
|
120
|
+
<hr />
|
|
121
|
+
<div className="not-prose flex items-center justify-between gap-8">
|
|
122
|
+
{prev.path ? (
|
|
123
|
+
<Link
|
|
124
|
+
to={prev.path}
|
|
125
|
+
className="flex flex-col items-stretch gap-2 flex-1 truncate border border-border rounded px-6 py-4 text-start hover:border-primary/85 transition shadow-sm hover:shadow-md"
|
|
126
|
+
title={
|
|
127
|
+
typeof prev.label === "string" ? prev.label : undefined
|
|
128
|
+
}
|
|
129
|
+
>
|
|
130
|
+
<div className="text-sm text-muted-foreground">
|
|
131
|
+
← Previous page
|
|
132
|
+
</div>
|
|
133
|
+
<div className="text-lg text-primary truncate">
|
|
134
|
+
{prev.label}
|
|
135
|
+
</div>
|
|
136
|
+
</Link>
|
|
137
|
+
) : (
|
|
138
|
+
<div className="flex-1" />
|
|
139
|
+
)}
|
|
140
|
+
{next.path ? (
|
|
141
|
+
<Link
|
|
142
|
+
to={next.path}
|
|
143
|
+
className="flex flex-col items-stretch gap-2 flex-1 truncate border border-border rounded px-6 py-4 text-end hover:border-primary/85 transition shadow-sm hover:shadow-md"
|
|
144
|
+
title={
|
|
145
|
+
typeof next.label === "string" ? next.label : undefined
|
|
146
|
+
}
|
|
147
|
+
>
|
|
148
|
+
<div className="text-sm text-muted-foreground">
|
|
149
|
+
Next page →
|
|
150
|
+
</div>
|
|
151
|
+
<div className="text-lg text-primary truncate">
|
|
152
|
+
{next.label}
|
|
153
|
+
</div>
|
|
154
|
+
</Link>
|
|
155
|
+
) : (
|
|
156
|
+
<div className="flex-1" />
|
|
157
|
+
)}
|
|
158
|
+
</div>
|
|
159
|
+
</>
|
|
160
|
+
)}
|
|
144
161
|
</div>
|
|
145
162
|
<div className="hidden xl:block">
|
|
146
163
|
{showToc && <Toc entries={tocEntries} />}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { TocEntry } from "@stefanprobst/rehype-extract-toc";
|
|
2
|
+
import { ListTreeIcon } from "lucide-react";
|
|
2
3
|
import {
|
|
3
4
|
useEffect,
|
|
4
5
|
useRef,
|
|
@@ -8,7 +9,6 @@ import {
|
|
|
8
9
|
} from "react";
|
|
9
10
|
import { AnchorLink } from "../../components/AnchorLink.js";
|
|
10
11
|
import { useViewportAnchor } from "../../components/context/ViewportAnchorContext.js";
|
|
11
|
-
import { ListTreeIcon } from "../../core/icons.js";
|
|
12
12
|
import { cn } from "../../util/cn.js";
|
|
13
13
|
|
|
14
14
|
const DATA_ANCHOR_ATTR = "data-active";
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
+
import { Navigate, type RouteObject } from "react-router-dom";
|
|
1
2
|
import { useTopNavigationItem } from "../../components/context/DevPortalProvider.js";
|
|
2
3
|
import { isPathItem } from "../../components/navigation/util.js";
|
|
3
|
-
import { Navigate, type RouteObject } from "../../core/router.js";
|
|
4
4
|
import { traverseNavigation } from "../../util/traverseNavigation.js";
|
|
5
|
-
|
|
6
|
-
import
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
MarkdownPluginDefaultOptions,
|
|
8
|
+
MarkdownPluginOptions,
|
|
9
|
+
} from "./index.js";
|
|
7
10
|
|
|
8
11
|
export const generateRoutes = (
|
|
9
12
|
markdownFiles: MarkdownPluginOptions["markdownFiles"],
|
|
13
|
+
defaultOptions?: MarkdownPluginDefaultOptions,
|
|
10
14
|
): RouteObject[] => {
|
|
11
15
|
const routes = Object.entries(markdownFiles).flatMap(
|
|
12
16
|
([file, importPromise]) => {
|
|
@@ -25,17 +29,23 @@ export const generateRoutes = (
|
|
|
25
29
|
return {
|
|
26
30
|
path: routePath,
|
|
27
31
|
lazy: async () => {
|
|
32
|
+
const { MdxPage } = await import("./MdxPage.js");
|
|
28
33
|
const { default: Component, ...props } = await importPromise();
|
|
29
|
-
|
|
30
34
|
return {
|
|
31
|
-
element:
|
|
35
|
+
element: (
|
|
36
|
+
<MdxPage
|
|
37
|
+
mdxComponent={Component}
|
|
38
|
+
{...props}
|
|
39
|
+
defaultOptions={defaultOptions}
|
|
40
|
+
/>
|
|
41
|
+
),
|
|
32
42
|
};
|
|
33
43
|
},
|
|
34
44
|
} satisfies RouteObject;
|
|
35
45
|
},
|
|
36
46
|
);
|
|
37
47
|
|
|
38
|
-
const rootRoutes = Array.from(
|
|
48
|
+
const rootRoutes: RouteObject[] = Array.from(
|
|
39
49
|
new Set(routes.map((route) => route.path.split("/").at(0))),
|
|
40
50
|
).map((dir) => ({
|
|
41
51
|
path: `/${dir}`,
|
|
@@ -5,13 +5,19 @@ import { generateRoutes } from "./generateRoutes.js";
|
|
|
5
5
|
|
|
6
6
|
export type MarkdownPluginOptions = {
|
|
7
7
|
markdownFiles: Record<string, () => Promise<MDXImport>>;
|
|
8
|
+
defaultOptions?: MarkdownPluginDefaultOptions;
|
|
8
9
|
};
|
|
10
|
+
export type MarkdownPluginDefaultOptions = Pick<
|
|
11
|
+
Frontmatter,
|
|
12
|
+
"toc" | "disablePager"
|
|
13
|
+
>;
|
|
9
14
|
|
|
10
15
|
export type Frontmatter = {
|
|
11
16
|
title?: string;
|
|
12
17
|
description?: string;
|
|
13
18
|
category?: string;
|
|
14
19
|
toc?: boolean;
|
|
20
|
+
disablePager?: boolean;
|
|
15
21
|
};
|
|
16
22
|
|
|
17
23
|
export type MDXImport = {
|
|
@@ -22,10 +28,7 @@ export type MDXImport = {
|
|
|
22
28
|
|
|
23
29
|
export const markdownPlugin = ({
|
|
24
30
|
markdownFiles,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
};
|
|
31
|
+
defaultOptions,
|
|
32
|
+
}: MarkdownPluginOptions): DevPortalPlugin => ({
|
|
33
|
+
getRoutes: () => generateRoutes(markdownFiles, defaultOptions),
|
|
34
|
+
});
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { ResultOf } from "@graphql-typed-document-node/core";
|
|
2
2
|
import { CategoryHeading } from "../../components/CategoryHeading.js";
|
|
3
|
+
import { ErrorPage } from "../../components/ErrorPage.js";
|
|
3
4
|
import { Heading } from "../../components/Heading.js";
|
|
4
|
-
import {
|
|
5
|
+
import { InlineCode } from "../../components/InlineCode.js";
|
|
6
|
+
import { Markdown } from "../../components/Markdown.js";
|
|
7
|
+
import { SyntaxHighlight } from "../../components/SyntaxHighlight.js";
|
|
8
|
+
import { Callout } from "../../ui/Callout.js";
|
|
5
9
|
import { cn } from "../../util/cn.js";
|
|
6
10
|
import { OperationListItem } from "./OperationListItem.js";
|
|
11
|
+
import { useOasConfig } from "./context.js";
|
|
7
12
|
import { graphql } from "./graphql/index.js";
|
|
8
|
-
import {
|
|
13
|
+
import { SchemaProseClasses } from "./util/prose.js";
|
|
9
14
|
import { useQuery } from "./util/urql.js";
|
|
10
15
|
|
|
11
16
|
export const OperationsFragment = graphql(/* GraphQL */ `
|
|
@@ -90,11 +95,42 @@ export const OperationList = () => {
|
|
|
90
95
|
context: suspenseContext,
|
|
91
96
|
});
|
|
92
97
|
|
|
98
|
+
const error = result.error?.graphQLErrors.at(0);
|
|
99
|
+
|
|
100
|
+
// Looks like there is no Suspense level error handling (yet)?
|
|
101
|
+
// So we handle the error case in the component directly
|
|
102
|
+
if (error) {
|
|
103
|
+
return (
|
|
104
|
+
<ErrorPage
|
|
105
|
+
category="Error"
|
|
106
|
+
title="Schema cannot be displayed"
|
|
107
|
+
message={
|
|
108
|
+
<>
|
|
109
|
+
{import.meta.env.DEV && (
|
|
110
|
+
<Callout type="danger" title="Developer hint" className="mb-4">
|
|
111
|
+
Check your configuration value{" "}
|
|
112
|
+
<InlineCode>apis.type</InlineCode> and{" "}
|
|
113
|
+
<InlineCode>apis.input</InlineCode> in the Zudoku config.
|
|
114
|
+
</Callout>
|
|
115
|
+
)}
|
|
116
|
+
An error occurred while trying to fetch the API reference:
|
|
117
|
+
<SyntaxHighlight code={error.toString()} language="plain" />
|
|
118
|
+
</>
|
|
119
|
+
}
|
|
120
|
+
/>
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
|
|
93
124
|
if (!result.data) return null;
|
|
94
125
|
|
|
95
126
|
return (
|
|
96
127
|
<div className="pt-[--padding-content-top]">
|
|
97
|
-
<div
|
|
128
|
+
<div
|
|
129
|
+
className={cn(
|
|
130
|
+
SchemaProseClasses,
|
|
131
|
+
"mb-16 max-w-full prose-img:max-w-prose",
|
|
132
|
+
)}
|
|
133
|
+
>
|
|
98
134
|
<CategoryHeading>Overview</CategoryHeading>
|
|
99
135
|
<Heading level={1} id="description" registerSidebarAnchor>
|
|
100
136
|
{result.data.schema.title}
|
|
@@ -108,7 +144,7 @@ export const OperationList = () => {
|
|
|
108
144
|
{tag.name && <CategoryHeading>{tag.name}</CategoryHeading>}
|
|
109
145
|
{tag.description && (
|
|
110
146
|
<Markdown
|
|
111
|
-
className={`${
|
|
147
|
+
className={`${SchemaProseClasses} mt-2 mb-12`}
|
|
112
148
|
content={tag.description}
|
|
113
149
|
/>
|
|
114
150
|
)}
|