zudoku 0.0.2-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.js +1 -0
- package/dist/app/DevPortal.d.ts +26 -0
- package/dist/app/DevPortal.js +41 -0
- package/dist/app/DevPortal.js.map +1 -0
- package/dist/app/Heading.d.ts +9 -0
- package/dist/app/Heading.js +27 -0
- package/dist/app/Heading.js.map +1 -0
- package/dist/app/app.d.ts +2 -0
- package/dist/app/app.js +69 -0
- package/dist/app/app.js.map +1 -0
- package/dist/app/authentication/authentication.d.ts +13 -0
- package/dist/app/authentication/authentication.js +2 -0
- package/dist/app/authentication/authentication.js.map +1 -0
- package/dist/app/authentication/clerk.d.ts +5 -0
- package/dist/app/authentication/clerk.js +36 -0
- package/dist/app/authentication/clerk.js.map +1 -0
- package/dist/app/authentication/openid.d.ts +11 -0
- package/dist/app/authentication/openid.js +118 -0
- package/dist/app/authentication/openid.js.map +1 -0
- package/dist/app/components/AnchorLink.d.ts +5 -0
- package/dist/app/components/AnchorLink.js +17 -0
- package/dist/app/components/AnchorLink.js.map +1 -0
- package/dist/app/components/CategoryHeading.d.ts +5 -0
- package/dist/app/components/CategoryHeading.js +6 -0
- package/dist/app/components/CategoryHeading.js.map +1 -0
- package/dist/app/components/DynamicIcon.d.ts +6 -0
- package/dist/app/components/DynamicIcon.js +6 -0
- package/dist/app/components/DynamicIcon.js.map +1 -0
- package/dist/app/components/Header.d.ts +2 -0
- package/dist/app/components/Header.js +15 -0
- package/dist/app/components/Header.js.map +1 -0
- package/dist/app/components/Layout.d.ts +4 -0
- package/dist/app/components/Layout.js +31 -0
- package/dist/app/components/Layout.js.map +1 -0
- package/dist/app/components/Markdown.d.ts +5 -0
- package/dist/app/components/Markdown.js +20 -0
- package/dist/app/components/Markdown.js.map +1 -0
- package/dist/app/components/SyntaxHighlight.d.ts +9 -0
- package/dist/app/components/SyntaxHighlight.js +31 -0
- package/dist/app/components/SyntaxHighlight.js.map +1 -0
- package/dist/app/components/TopNavigation.d.ts +1 -0
- package/dist/app/components/TopNavigation.js +11 -0
- package/dist/app/components/TopNavigation.js.map +1 -0
- package/dist/app/components/context/ComponentsContext.d.ts +10 -0
- package/dist/app/components/context/ComponentsContext.js +11 -0
- package/dist/app/components/context/ComponentsContext.js.map +1 -0
- package/dist/app/components/context/DevPortalProvider.d.ts +10 -0
- package/dist/app/components/context/DevPortalProvider.js +39 -0
- package/dist/app/components/context/DevPortalProvider.js.map +1 -0
- package/dist/app/components/context/PluginSystem.d.ts +1 -0
- package/dist/app/components/context/PluginSystem.js +2 -0
- package/dist/app/components/context/PluginSystem.js.map +1 -0
- package/dist/app/components/context/ThemeContext.d.ts +5 -0
- package/dist/app/components/context/ThemeContext.js +33 -0
- package/dist/app/components/context/ThemeContext.js.map +1 -0
- package/dist/app/components/context/ViewportAnchorContext.d.ts +15 -0
- package/dist/app/components/context/ViewportAnchorContext.js +89 -0
- package/dist/app/components/context/ViewportAnchorContext.js.map +1 -0
- package/dist/app/components/navigation/SideNavigation.d.ts +1 -0
- package/dist/app/components/navigation/SideNavigation.js +11 -0
- package/dist/app/components/navigation/SideNavigation.js.map +1 -0
- package/dist/app/components/navigation/SideNavigationCategory.d.ts +4 -0
- package/dist/app/components/navigation/SideNavigationCategory.js +26 -0
- package/dist/app/components/navigation/SideNavigationCategory.js.map +1 -0
- package/dist/app/components/navigation/SideNavigationItem.d.ts +12 -0
- package/dist/app/components/navigation/SideNavigationItem.js +38 -0
- package/dist/app/components/navigation/SideNavigationItem.js.map +1 -0
- package/dist/app/components/navigation/SideNavigationWrapper.d.ts +4 -0
- package/dist/app/components/navigation/SideNavigationWrapper.js +6 -0
- package/dist/app/components/navigation/SideNavigationWrapper.js.map +1 -0
- package/dist/app/components/navigation/useNavigationCollapsibleState.d.ts +7 -0
- package/dist/app/components/navigation/useNavigationCollapsibleState.js +16 -0
- package/dist/app/components/navigation/useNavigationCollapsibleState.js.map +1 -0
- package/dist/app/components/navigation/util.d.ts +8 -0
- package/dist/app/components/navigation/util.js +15 -0
- package/dist/app/components/navigation/util.js.map +1 -0
- package/dist/app/config.d.ts +3 -0
- package/dist/app/config.js +9 -0
- package/dist/app/config.js.map +1 -0
- package/dist/app/core/DevPortalContext.d.ts +80 -0
- package/dist/app/core/DevPortalContext.js +68 -0
- package/dist/app/core/DevPortalContext.js.map +1 -0
- package/dist/app/core/helmet.d.ts +4 -0
- package/dist/app/core/helmet.js +5 -0
- package/dist/app/core/helmet.js.map +1 -0
- package/dist/app/core/icons.d.ts +1 -0
- package/dist/app/core/icons.js +2 -0
- package/dist/app/core/icons.js.map +1 -0
- package/dist/app/core/plugins.d.ts +24 -0
- package/dist/app/core/plugins.js +4 -0
- package/dist/app/core/plugins.js.map +1 -0
- package/dist/app/core/router.d.ts +1 -0
- package/dist/app/core/router.js +2 -0
- package/dist/app/core/router.js.map +1 -0
- package/dist/app/core/types/combine.d.ts +4 -0
- package/dist/app/core/types/combine.js +2 -0
- package/dist/app/core/types/combine.js.map +1 -0
- package/dist/app/main.d.ts +1 -0
- package/dist/app/main.js +18 -0
- package/dist/app/main.js.map +1 -0
- package/dist/app/markdowns.d.ts +3 -0
- package/dist/app/markdowns.js +5 -0
- package/dist/app/markdowns.js.map +1 -0
- package/dist/app/oas/graphql/index.d.ts +12 -0
- package/dist/app/oas/graphql/index.js +290 -0
- package/dist/app/oas/graphql/index.js.map +1 -0
- package/dist/app/oas/graphql/server.d.ts +1 -0
- package/dist/app/oas/graphql/server.js +8 -0
- package/dist/app/oas/graphql/server.js.map +1 -0
- package/dist/app/oas/parser/dereference/index.d.ts +5 -0
- package/dist/app/oas/parser/dereference/index.js +43 -0
- package/dist/app/oas/parser/dereference/index.js.map +1 -0
- package/dist/app/oas/parser/dereference/resolveRef.d.ts +5 -0
- package/dist/app/oas/parser/dereference/resolveRef.js +26 -0
- package/dist/app/oas/parser/dereference/resolveRef.js.map +1 -0
- package/dist/app/oas/parser/index.d.ts +21 -0
- package/dist/app/oas/parser/index.js +58 -0
- package/dist/app/oas/parser/index.js.map +1 -0
- package/dist/app/oas/parser/schemas/v3.0.json +1489 -0
- package/dist/app/oas/parser/schemas/v3.1.json +1298 -0
- package/dist/app/oas/parser/upgrade/index.d.ts +9 -0
- package/dist/app/oas/parser/upgrade/index.js +90 -0
- package/dist/app/oas/parser/upgrade/index.js.map +1 -0
- package/dist/app/plugins/api-key/SettingsApiKeys.d.ts +4 -0
- package/dist/app/plugins/api-key/SettingsApiKeys.js +7 -0
- package/dist/app/plugins/api-key/SettingsApiKeys.js.map +1 -0
- package/dist/app/plugins/api-key/index.d.ts +32 -0
- package/dist/app/plugins/api-key/index.js +55 -0
- package/dist/app/plugins/api-key/index.js.map +1 -0
- package/dist/app/plugins/markdown/MdxPage.d.ts +3 -0
- package/dist/app/plugins/markdown/MdxPage.js +55 -0
- package/dist/app/plugins/markdown/MdxPage.js.map +1 -0
- package/dist/app/plugins/markdown/Toc.d.ts +4 -0
- package/dist/app/plugins/markdown/Toc.js +40 -0
- package/dist/app/plugins/markdown/Toc.js.map +1 -0
- package/dist/app/plugins/markdown/generateRoutes.d.ts +3 -0
- package/dist/app/plugins/markdown/generateRoutes.js +50 -0
- package/dist/app/plugins/markdown/generateRoutes.js.map +1 -0
- package/dist/app/plugins/markdown/index.d.ts +19 -0
- package/dist/app/plugins/markdown/index.js +9 -0
- package/dist/app/plugins/markdown/index.js.map +1 -0
- package/dist/app/plugins/openapi/ColorizedParam.d.ts +8 -0
- package/dist/app/plugins/openapi/ColorizedParam.js +40 -0
- package/dist/app/plugins/openapi/ColorizedParam.js.map +1 -0
- package/dist/app/plugins/openapi/MakeRequest.d.ts +4 -0
- package/dist/app/plugins/openapi/MakeRequest.js +11 -0
- package/dist/app/plugins/openapi/MakeRequest.js.map +1 -0
- package/dist/app/plugins/openapi/MethodBadge.d.ts +13 -0
- package/dist/app/plugins/openapi/MethodBadge.js +26 -0
- package/dist/app/plugins/openapi/MethodBadge.js.map +1 -0
- package/dist/app/plugins/openapi/OperationList.d.ts +47 -0
- package/dist/app/plugins/openapi/OperationList.js +82 -0
- package/dist/app/plugins/openapi/OperationList.js.map +1 -0
- package/dist/app/plugins/openapi/OperationListItem.d.ts +7 -0
- package/dist/app/plugins/openapi/OperationListItem.js +15 -0
- package/dist/app/plugins/openapi/OperationListItem.js.map +1 -0
- package/dist/app/plugins/openapi/ParameterList.d.ts +7 -0
- package/dist/app/plugins/openapi/ParameterList.js +5 -0
- package/dist/app/plugins/openapi/ParameterList.js.map +1 -0
- package/dist/app/plugins/openapi/ParameterListItem.d.ts +8 -0
- package/dist/app/plugins/openapi/ParameterListItem.js +13 -0
- package/dist/app/plugins/openapi/ParameterListItem.js.map +1 -0
- package/dist/app/plugins/openapi/RequestBodySidecarBox.d.ts +6 -0
- package/dist/app/plugins/openapi/RequestBodySidecarBox.js +19 -0
- package/dist/app/plugins/openapi/RequestBodySidecarBox.js.map +1 -0
- package/dist/app/plugins/openapi/ResponsesSidecarBox.d.ts +6 -0
- package/dist/app/plugins/openapi/ResponsesSidecarBox.js +15 -0
- package/dist/app/plugins/openapi/ResponsesSidecarBox.js.map +1 -0
- package/dist/app/plugins/openapi/Select.d.ts +9 -0
- package/dist/app/plugins/openapi/Select.js +5 -0
- package/dist/app/plugins/openapi/Select.js.map +1 -0
- package/dist/app/plugins/openapi/Sidecar.d.ts +4 -0
- package/dist/app/plugins/openapi/Sidecar.js +39 -0
- package/dist/app/plugins/openapi/Sidecar.js.map +1 -0
- package/dist/app/plugins/openapi/SidecarBox.d.ts +10 -0
- package/dist/app/plugins/openapi/SidecarBox.js +8 -0
- package/dist/app/plugins/openapi/SidecarBox.js.map +1 -0
- package/dist/app/plugins/openapi/graphql/index.d.ts +836 -0
- package/dist/app/plugins/openapi/graphql/index.js +4 -0
- package/dist/app/plugins/openapi/graphql/index.js.map +1 -0
- package/dist/app/plugins/openapi/index.d.ts +22 -0
- package/dist/app/plugins/openapi/index.js +91 -0
- package/dist/app/plugins/openapi/index.js.map +1 -0
- package/dist/app/plugins/openapi/util/generateSchemaExample.d.ts +3 -0
- package/dist/app/plugins/openapi/util/generateSchemaExample.js +52 -0
- package/dist/app/plugins/openapi/util/generateSchemaExample.js.map +1 -0
- package/dist/app/plugins/openapi/util/getCode.d.ts +2 -0
- package/dist/app/plugins/openapi/util/getCode.js +54 -0
- package/dist/app/plugins/openapi/util/getCode.js.map +1 -0
- package/dist/app/plugins/openapi/util/urql.d.ts +8 -0
- package/dist/app/plugins/openapi/util/urql.js +8 -0
- package/dist/app/plugins/openapi/util/urql.js.map +1 -0
- package/dist/app/plugins/openapi/worker/createSharedWorkerClient.d.ts +5 -0
- package/dist/app/plugins/openapi/worker/createSharedWorkerClient.js +47 -0
- package/dist/app/plugins/openapi/worker/createSharedWorkerClient.js.map +1 -0
- package/dist/app/plugins/openapi/worker/worker.d.ts +1 -0
- package/dist/app/plugins/openapi/worker/worker.js +20 -0
- package/dist/app/plugins/openapi/worker/worker.js.map +1 -0
- package/dist/app/plugins/redirect/index.d.ts +10 -0
- package/dist/app/plugins/redirect/index.js +11 -0
- package/dist/app/plugins/redirect/index.js.map +1 -0
- package/dist/app/tailwind.d.ts +3 -0
- package/dist/app/tailwind.js +69 -0
- package/dist/app/tailwind.js.map +1 -0
- package/dist/app/ui/Callout.d.ts +51 -0
- package/dist/app/ui/Callout.js +50 -0
- package/dist/app/ui/Callout.js.map +1 -0
- package/dist/app/ui/Card.d.ts +8 -0
- package/dist/app/ui/Card.js +17 -0
- package/dist/app/ui/Card.js.map +1 -0
- package/dist/app/ui/Note.d.ts +8 -0
- package/dist/app/ui/Note.js +23 -0
- package/dist/app/ui/Note.js.map +1 -0
- package/dist/app/util/MdxComponents.d.ts +27 -0
- package/dist/app/util/MdxComponents.js +40 -0
- package/dist/app/util/MdxComponents.js.map +1 -0
- package/dist/app/util/cn.d.ts +2 -0
- package/dist/app/util/cn.js +6 -0
- package/dist/app/util/cn.js.map +1 -0
- package/dist/app/util/createWaitForNotify.d.ts +1 -0
- package/dist/app/util/createWaitForNotify.js +15 -0
- package/dist/app/util/createWaitForNotify.js.map +1 -0
- package/dist/app/util/groupBy.d.ts +6 -0
- package/dist/app/util/groupBy.js +9 -0
- package/dist/app/util/groupBy.js.map +1 -0
- package/dist/app/util/joinPath.d.ts +1 -0
- package/dist/app/util/joinPath.js +8 -0
- package/dist/app/util/joinPath.js.map +1 -0
- package/dist/app/util/pastellize.d.ts +4 -0
- package/dist/app/util/pastellize.js +14 -0
- package/dist/app/util/pastellize.js.map +1 -0
- package/dist/app/util/slugify.d.ts +3 -0
- package/dist/app/util/slugify.js +3 -0
- package/dist/app/util/slugify.js.map +1 -0
- package/dist/app/util/traverseNavigation.d.ts +6 -0
- package/dist/app/util/traverseNavigation.js +30 -0
- package/dist/app/util/traverseNavigation.js.map +1 -0
- package/dist/app/util/useScrollToAnchor.d.ts +1 -0
- package/dist/app/util/useScrollToAnchor.js +33 -0
- package/dist/app/util/useScrollToAnchor.js.map +1 -0
- package/dist/app/util/useScrollToTop.d.ts +1 -0
- package/dist/app/util/useScrollToTop.js +13 -0
- package/dist/app/util/useScrollToTop.js.map +1 -0
- package/dist/auth.d.ts +2 -0
- package/dist/auth.js +3 -0
- package/dist/auth.js.map +1 -0
- package/dist/cli/build/handler.d.ts +4 -0
- package/dist/cli/build/handler.js +9 -0
- package/dist/cli/build/handler.js.map +1 -0
- package/dist/cli/cli.d.ts +1 -0
- package/dist/cli/cli.js +64 -0
- package/dist/cli/cli.js.map +1 -0
- package/dist/cli/cmds/build.d.ts +8 -0
- package/dist/cli/cmds/build.js +23 -0
- package/dist/cli/cmds/build.js.map +1 -0
- package/dist/cli/cmds/dev.d.ts +8 -0
- package/dist/cli/cmds/dev.js +29 -0
- package/dist/cli/cmds/dev.js.map +1 -0
- package/dist/cli/common/analytics/lib.d.ts +17 -0
- package/dist/cli/common/analytics/lib.js +53 -0
- package/dist/cli/common/analytics/lib.js.map +1 -0
- package/dist/cli/common/constants.d.ts +5 -0
- package/dist/cli/common/constants.js +9 -0
- package/dist/cli/common/constants.js.map +1 -0
- package/dist/cli/common/logger.d.ts +2 -0
- package/dist/cli/common/logger.js +14 -0
- package/dist/cli/common/logger.js.map +1 -0
- package/dist/cli/common/machine-id/lib.d.ts +1 -0
- package/dist/cli/common/machine-id/lib.js +74 -0
- package/dist/cli/common/machine-id/lib.js.map +1 -0
- package/dist/cli/common/outdated.d.ts +1 -0
- package/dist/cli/common/outdated.js +70 -0
- package/dist/cli/common/outdated.js.map +1 -0
- package/dist/cli/common/output.d.ts +9 -0
- package/dist/cli/common/output.js +65 -0
- package/dist/cli/common/output.js.map +1 -0
- package/dist/cli/common/utils/box.d.ts +33 -0
- package/dist/cli/common/utils/box.js +81 -0
- package/dist/cli/common/utils/box.js.map +1 -0
- package/dist/cli/common/utils/ports.d.ts +1 -0
- package/dist/cli/common/utils/ports.js +18 -0
- package/dist/cli/common/utils/ports.js.map +1 -0
- package/dist/cli/common/validators/lib.d.ts +20 -0
- package/dist/cli/common/validators/lib.js +31 -0
- package/dist/cli/common/validators/lib.js.map +1 -0
- package/dist/cli/common/xdg/lib.d.ts +6 -0
- package/dist/cli/common/xdg/lib.js +18 -0
- package/dist/cli/common/xdg/lib.js.map +1 -0
- package/dist/cli/dev/handler.d.ts +5 -0
- package/dist/cli/dev/handler.js +22 -0
- package/dist/cli/dev/handler.js.map +1 -0
- package/dist/config/config.d.ts +37 -0
- package/dist/config/config.js +2 -0
- package/dist/config/config.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/plugins.d.ts +4 -0
- package/dist/plugins.js +6 -0
- package/dist/plugins.js.map +1 -0
- package/dist/vite/build.d.ts +3 -0
- package/dist/vite/build.js +29 -0
- package/dist/vite/build.js.map +1 -0
- package/dist/vite/config.d.ts +6 -0
- package/dist/vite/config.js +74 -0
- package/dist/vite/config.js.map +1 -0
- package/dist/vite/dev-server.d.ts +10 -0
- package/dist/vite/dev-server.js +53 -0
- package/dist/vite/dev-server.js.map +1 -0
- package/dist/vite/html.d.ts +5 -0
- package/dist/vite/html.js +32 -0
- package/dist/vite/html.js.map +1 -0
- package/dist/vite/import-auth-plugin.d.ts +3 -0
- package/dist/vite/import-auth-plugin.js +28 -0
- package/dist/vite/import-auth-plugin.js.map +1 -0
- package/dist/vite/plugin.d.ts +7 -0
- package/dist/vite/plugin.js +109 -0
- package/dist/vite/plugin.js.map +1 -0
- package/package.json +118 -0
- package/src/app/DevPortal.tsx +115 -0
- package/src/app/Heading.tsx +60 -0
- package/src/app/app.tsx +85 -0
- package/src/app/authentication/authentication.ts +18 -0
- package/src/app/authentication/clerk.ts +47 -0
- package/src/app/authentication/openid.ts +192 -0
- package/src/app/components/AnchorLink.tsx +19 -0
- package/src/app/components/CategoryHeading.tsx +16 -0
- package/src/app/components/DynamicIcon.tsx +60 -0
- package/src/app/components/Header.tsx +69 -0
- package/src/app/components/Layout.tsx +56 -0
- package/src/app/components/Markdown.tsx +37 -0
- package/src/app/components/SyntaxHighlight.tsx +92 -0
- package/src/app/components/TopNavigation.tsx +32 -0
- package/src/app/components/context/ComponentsContext.tsx +24 -0
- package/src/app/components/context/DevPortalProvider.ts +54 -0
- package/src/app/components/context/PluginSystem.ts +0 -0
- package/src/app/components/context/ThemeContext.tsx +46 -0
- package/src/app/components/context/ViewportAnchorContext.tsx +139 -0
- package/src/app/components/navigation/SideNavigation.tsx +18 -0
- package/src/app/components/navigation/SideNavigationCategory.tsx +74 -0
- package/src/app/components/navigation/SideNavigationItem.tsx +143 -0
- package/src/app/components/navigation/SideNavigationWrapper.tsx +15 -0
- package/src/app/components/navigation/useNavigationCollapsibleState.ts +27 -0
- package/src/app/components/navigation/util.ts +38 -0
- package/src/app/config.ts +20 -0
- package/src/app/core/DevPortalContext.ts +164 -0
- package/src/app/core/helmet.ts +5 -0
- package/src/app/core/icons.tsx +1 -0
- package/src/app/core/plugins.ts +43 -0
- package/src/app/core/router.tsx +1 -0
- package/src/app/core/types/combine.ts +16 -0
- package/src/app/main.css +137 -0
- package/src/app/main.tsx +22 -0
- package/src/app/markdowns.ts +7 -0
- package/src/app/oas/graphql/index.ts +422 -0
- package/src/app/oas/graphql/server.ts +10 -0
- package/src/app/oas/parser/dereference/index.ts +59 -0
- package/src/app/oas/parser/dereference/resolveRef.ts +32 -0
- package/src/app/oas/parser/index.ts +94 -0
- package/src/app/oas/parser/schemas/v3.0.json +1489 -0
- package/src/app/oas/parser/schemas/v3.1.json +1298 -0
- package/src/app/oas/parser/upgrade/index.ts +108 -0
- package/src/app/plugins/api-key/SettingsApiKeys.tsx +22 -0
- package/src/app/plugins/api-key/index.tsx +123 -0
- package/src/app/plugins/markdown/MdxPage.tsx +128 -0
- package/src/app/plugins/markdown/Toc.tsx +122 -0
- package/src/app/plugins/markdown/generateRoutes.tsx +72 -0
- package/src/app/plugins/markdown/index.tsx +31 -0
- package/src/app/plugins/openapi/ColorizedParam.tsx +73 -0
- package/src/app/plugins/openapi/MakeRequest.tsx +30 -0
- package/src/app/plugins/openapi/MethodBadge.tsx +36 -0
- package/src/app/plugins/openapi/OperationList.tsx +119 -0
- package/src/app/plugins/openapi/OperationListItem.tsx +55 -0
- package/src/app/plugins/openapi/ParameterList.tsx +32 -0
- package/src/app/plugins/openapi/ParameterListItem.tsx +60 -0
- package/src/app/plugins/openapi/RequestBodySidecarBox.tsx +48 -0
- package/src/app/plugins/openapi/ResponsesSidecarBox.tsx +60 -0
- package/src/app/plugins/openapi/Select.tsx +35 -0
- package/src/app/plugins/openapi/Sidecar.tsx +99 -0
- package/src/app/plugins/openapi/SidecarBox.tsx +35 -0
- package/src/app/plugins/openapi/graphql/env.d.ts +48 -0
- package/src/app/plugins/openapi/graphql/index.ts +13 -0
- package/src/app/plugins/openapi/index.tsx +142 -0
- package/src/app/plugins/openapi/util/generateSchemaExample.ts +59 -0
- package/src/app/plugins/openapi/util/getCode.tsx +69 -0
- package/src/app/plugins/openapi/util/urql.ts +8 -0
- package/src/app/plugins/openapi/worker/createSharedWorkerClient.ts +60 -0
- package/src/app/plugins/openapi/worker/worker.ts +30 -0
- package/src/app/plugins/redirect/index.tsx +20 -0
- package/src/app/tailwind.ts +72 -0
- package/src/app/ui/Callout.tsx +87 -0
- package/src/app/ui/Card.tsx +82 -0
- package/src/app/ui/Note.tsx +58 -0
- package/src/app/util/MdxComponents.tsx +70 -0
- package/src/app/util/cn.ts +6 -0
- package/src/app/util/createWaitForNotify.ts +18 -0
- package/src/app/util/groupBy.ts +24 -0
- package/src/app/util/joinPath.tsx +10 -0
- package/src/app/util/pastellize.ts +25 -0
- package/src/app/util/slugify.ts +3 -0
- package/src/app/util/traverseNavigation.ts +55 -0
- package/src/app/util/useScrollToAnchor.ts +38 -0
- package/src/app/util/useScrollToTop.ts +13 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/* prettier-ignore */
|
|
3
|
+
|
|
4
|
+
/** An IntrospectionQuery representation of your schema.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* This is an introspection of your schema saved as a file by GraphQLSP.
|
|
8
|
+
* It will automatically be used by `gql.tada` to infer the types of your GraphQL documents.
|
|
9
|
+
* If you need to reuse this data or update your `scalars`, update `tadaOutputLocation` to
|
|
10
|
+
* instead save to a .ts instead of a .d.ts file.
|
|
11
|
+
*/
|
|
12
|
+
export type introspection = {
|
|
13
|
+
name: never;
|
|
14
|
+
query: 'Query';
|
|
15
|
+
mutation: never;
|
|
16
|
+
subscription: never;
|
|
17
|
+
types: {
|
|
18
|
+
'Boolean': unknown;
|
|
19
|
+
'EncodingItem': { kind: 'OBJECT'; name: 'EncodingItem'; fields: { 'allowReserved': { name: 'allowReserved'; type: { kind: 'SCALAR'; name: 'Boolean'; ofType: null; } }; 'contentType': { name: 'contentType'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; 'explode': { name: 'explode'; type: { kind: 'SCALAR'; name: 'Boolean'; ofType: null; } }; 'headers': { name: 'headers'; type: { kind: 'SCALAR'; name: 'JSONObject'; ofType: null; } }; 'name': { name: 'name'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; 'style': { name: 'style'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; }; };
|
|
20
|
+
'ExampleItem': { kind: 'OBJECT'; name: 'ExampleItem'; fields: { 'description': { name: 'description'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; 'externalValue': { name: 'externalValue'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; 'name': { name: 'name'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; 'summary': { name: 'summary'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; 'value': { name: 'value'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; }; };
|
|
21
|
+
'Float': unknown;
|
|
22
|
+
'ID': unknown;
|
|
23
|
+
'Int': unknown;
|
|
24
|
+
'JSON': unknown;
|
|
25
|
+
'JSONObject': unknown;
|
|
26
|
+
'MediaTypeObject': { kind: 'OBJECT'; name: 'MediaTypeObject'; fields: { 'encoding': { name: 'encoding'; type: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'EncodingItem'; ofType: null; }; }; } }; 'examples': { name: 'examples'; type: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'ExampleItem'; ofType: null; }; }; } }; 'mediaType': { name: 'mediaType'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; 'schema': { name: 'schema'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'JSON'; ofType: null; }; } }; }; };
|
|
27
|
+
'OperationItem': { kind: 'OBJECT'; name: 'OperationItem'; fields: { 'contentTypes': { name: 'contentTypes'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; }; }; } }; 'deprecated': { name: 'deprecated'; type: { kind: 'SCALAR'; name: 'Boolean'; ofType: null; } }; 'description': { name: 'description'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; 'method': { name: 'method'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; 'operationId': { name: 'operationId'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; 'parameters': { name: 'parameters'; type: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'ParameterItem'; ofType: null; }; }; } }; 'path': { name: 'path'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; 'requestBody': { name: 'requestBody'; type: { kind: 'OBJECT'; name: 'RequestBodyObject'; ofType: null; } }; 'responses': { name: 'responses'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'ResponseItem'; ofType: null; }; }; }; } }; 'slug': { name: 'slug'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; 'summary': { name: 'summary'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; 'tags': { name: 'tags'; type: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'TagItem'; ofType: null; }; }; } }; }; };
|
|
28
|
+
'ParameterIn': { name: 'ParameterIn'; enumValues: 'cookie' | 'header' | 'path' | 'query'; };
|
|
29
|
+
'ParameterItem': { kind: 'OBJECT'; name: 'ParameterItem'; fields: { 'allowEmptyValue': { name: 'allowEmptyValue'; type: { kind: 'SCALAR'; name: 'Boolean'; ofType: null; } }; 'allowReserved': { name: 'allowReserved'; type: { kind: 'SCALAR'; name: 'Boolean'; ofType: null; } }; 'deprecated': { name: 'deprecated'; type: { kind: 'SCALAR'; name: 'Boolean'; ofType: null; } }; 'description': { name: 'description'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; 'examples': { name: 'examples'; type: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'ExampleItem'; ofType: null; }; }; } }; 'explode': { name: 'explode'; type: { kind: 'SCALAR'; name: 'Boolean'; ofType: null; } }; 'in': { name: 'in'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'ParameterIn'; ofType: null; }; } }; 'name': { name: 'name'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; 'required': { name: 'required'; type: { kind: 'SCALAR'; name: 'Boolean'; ofType: null; } }; 'schema': { name: 'schema'; type: { kind: 'SCALAR'; name: 'JSON'; ofType: null; } }; 'style': { name: 'style'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; }; };
|
|
30
|
+
'PathItem': { kind: 'OBJECT'; name: 'PathItem'; fields: { 'methods': { name: 'methods'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; }; }; } }; 'path': { name: 'path'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; }; };
|
|
31
|
+
'Query': { kind: 'OBJECT'; name: 'Query'; fields: { 'schema': { name: 'schema'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'Schema'; ofType: null; }; } }; }; };
|
|
32
|
+
'RequestBodyObject': { kind: 'OBJECT'; name: 'RequestBodyObject'; fields: { 'content': { name: 'content'; type: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'MediaTypeObject'; ofType: null; }; }; } }; 'description': { name: 'description'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; 'required': { name: 'required'; type: { kind: 'SCALAR'; name: 'Boolean'; ofType: null; } }; }; };
|
|
33
|
+
'ResponseItem': { kind: 'OBJECT'; name: 'ResponseItem'; fields: { 'content': { name: 'content'; type: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'MediaTypeObject'; ofType: null; }; }; } }; 'description': { name: 'description'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; 'headers': { name: 'headers'; type: { kind: 'SCALAR'; name: 'JSON'; ofType: null; } }; 'links': { name: 'links'; type: { kind: 'SCALAR'; name: 'JSON'; ofType: null; } }; 'statusCode': { name: 'statusCode'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; }; };
|
|
34
|
+
'Schema': { kind: 'OBJECT'; name: 'Schema'; fields: { 'description': { name: 'description'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; 'openapi': { name: 'openapi'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; 'operations': { name: 'operations'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'OperationItem'; ofType: null; }; }; }; } }; 'paths': { name: 'paths'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'PathItem'; ofType: null; }; }; }; } }; 'tags': { name: 'tags'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'SchemaTag'; ofType: null; }; }; }; } }; 'title': { name: 'title'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; 'url': { name: 'url'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; 'version': { name: 'version'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; }; };
|
|
35
|
+
'SchemaTag': { kind: 'OBJECT'; name: 'SchemaTag'; fields: { 'description': { name: 'description'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; 'name': { name: 'name'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; 'operations': { name: 'operations'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'OperationItem'; ofType: null; }; }; }; } }; }; };
|
|
36
|
+
'SchemaType': { name: 'SchemaType'; enumValues: 'json' | 'url' | 'yaml'; };
|
|
37
|
+
'String': unknown;
|
|
38
|
+
'TagItem': { kind: 'OBJECT'; name: 'TagItem'; fields: { 'description': { name: 'description'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; 'name': { name: 'name'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; }; };
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
import * as gqlTada from "gql.tada";
|
|
43
|
+
|
|
44
|
+
declare module "gql.tada" {
|
|
45
|
+
interface setupSchema {
|
|
46
|
+
introspection: introspection;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { initGraphQLTada } from "gql.tada";
|
|
2
|
+
import type { introspection } from "./env.d.ts";
|
|
3
|
+
|
|
4
|
+
export const graphql = initGraphQLTada<{
|
|
5
|
+
introspection: introspection;
|
|
6
|
+
scalars: {
|
|
7
|
+
JSON: unknown;
|
|
8
|
+
JSONObject: unknown;
|
|
9
|
+
};
|
|
10
|
+
}>();
|
|
11
|
+
|
|
12
|
+
export type { FragmentOf, ResultOf, VariablesOf } from "gql.tada";
|
|
13
|
+
export { readFragment } from "gql.tada";
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { createContext, useContext } from "react";
|
|
2
|
+
import {
|
|
3
|
+
type DevPortalPlugin,
|
|
4
|
+
type PluginNavigationCategory,
|
|
5
|
+
} from "../../core/plugins.js";
|
|
6
|
+
import { Outlet, matchPath, type RouteObject } from "../../core/router.js";
|
|
7
|
+
import { MethodBadge } from "./MethodBadge.js";
|
|
8
|
+
import { OperationList } from "./OperationList.js";
|
|
9
|
+
import { graphql } from "./graphql/index.js";
|
|
10
|
+
import {
|
|
11
|
+
Provider,
|
|
12
|
+
Client as UrqlClient,
|
|
13
|
+
cacheExchange,
|
|
14
|
+
fetchExchange,
|
|
15
|
+
} from "./util/urql.js";
|
|
16
|
+
import { createSharedWorkerClient } from "./worker/createSharedWorkerClient.js";
|
|
17
|
+
|
|
18
|
+
const OasContext = createContext<{ config: OasPluginConfig } | undefined>(
|
|
19
|
+
undefined,
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
export const OasConfigProvider = OasContext.Provider;
|
|
23
|
+
|
|
24
|
+
export const useOasConfig = () => {
|
|
25
|
+
const ctx = useContext(OasContext);
|
|
26
|
+
if (!ctx) {
|
|
27
|
+
throw new Error("useOasConfig must be used within a OasConfigProvider");
|
|
28
|
+
}
|
|
29
|
+
return ctx.config;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
type OasSource =
|
|
33
|
+
| { type: "url"; input: string }
|
|
34
|
+
| { type: "yaml"; input: string }
|
|
35
|
+
| { type: "json"; input: object };
|
|
36
|
+
|
|
37
|
+
export type OasPluginConfig = {
|
|
38
|
+
server?: string;
|
|
39
|
+
path?: string;
|
|
40
|
+
} & OasSource;
|
|
41
|
+
|
|
42
|
+
const OasContextProvider = ({
|
|
43
|
+
config,
|
|
44
|
+
client,
|
|
45
|
+
}: {
|
|
46
|
+
config: OasPluginConfig;
|
|
47
|
+
client: typeof UrqlClient;
|
|
48
|
+
}) => {
|
|
49
|
+
return (
|
|
50
|
+
<Provider value={client}>
|
|
51
|
+
<OasConfigProvider value={{ config }}>
|
|
52
|
+
<Outlet />
|
|
53
|
+
</OasConfigProvider>
|
|
54
|
+
</Provider>
|
|
55
|
+
);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const GetCategoriesQuery = graphql(`
|
|
59
|
+
query GetCategories($input: JSON!, $type: SchemaType!) {
|
|
60
|
+
schema(input: $input, type: $type) {
|
|
61
|
+
tags {
|
|
62
|
+
__typename
|
|
63
|
+
name
|
|
64
|
+
operations {
|
|
65
|
+
__typename
|
|
66
|
+
slug
|
|
67
|
+
method
|
|
68
|
+
summary
|
|
69
|
+
operationId
|
|
70
|
+
path
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
`);
|
|
76
|
+
|
|
77
|
+
export const openApiPlugin = (config: OasPluginConfig): DevPortalPlugin => {
|
|
78
|
+
const basePath = config.path ?? "/reference";
|
|
79
|
+
|
|
80
|
+
const client = config.server
|
|
81
|
+
? new UrqlClient({
|
|
82
|
+
url: config.server,
|
|
83
|
+
exchanges: [cacheExchange, fetchExchange],
|
|
84
|
+
})
|
|
85
|
+
: createSharedWorkerClient();
|
|
86
|
+
|
|
87
|
+
return {
|
|
88
|
+
getNavigation: async (path: string) => {
|
|
89
|
+
if (!matchPath({ path: basePath, end: false }, path)) {
|
|
90
|
+
return [];
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const { data } = await client.query(GetCategoriesQuery, {
|
|
94
|
+
input: config.input,
|
|
95
|
+
type: config.type,
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
if (!data) return [];
|
|
99
|
+
|
|
100
|
+
const categories = data.schema.tags
|
|
101
|
+
.filter((tag) => tag.operations.length > 0)
|
|
102
|
+
.map<PluginNavigationCategory>((tag) => ({
|
|
103
|
+
path,
|
|
104
|
+
label: tag.name ?? "",
|
|
105
|
+
collapsible: false,
|
|
106
|
+
children: tag.operations.map((operation) => ({
|
|
107
|
+
path: `#${operation.slug}`,
|
|
108
|
+
title: operation.summary ?? operation.path,
|
|
109
|
+
label: (
|
|
110
|
+
<div className="flex flex-1 min-w-0 justify-between gap-2">
|
|
111
|
+
<span className="truncate">
|
|
112
|
+
{operation.summary ?? operation.path}
|
|
113
|
+
</span>
|
|
114
|
+
<MethodBadge method={operation.method} />
|
|
115
|
+
</div>
|
|
116
|
+
),
|
|
117
|
+
})),
|
|
118
|
+
}));
|
|
119
|
+
|
|
120
|
+
categories.unshift({
|
|
121
|
+
path,
|
|
122
|
+
label: "Overview",
|
|
123
|
+
collapsible: false,
|
|
124
|
+
children: [{ path: "#description", label: "Description" }],
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
return categories;
|
|
128
|
+
},
|
|
129
|
+
getRoutes: () =>
|
|
130
|
+
[
|
|
131
|
+
{
|
|
132
|
+
element: <OasContextProvider config={config} client={client} />,
|
|
133
|
+
children: [
|
|
134
|
+
{
|
|
135
|
+
path: basePath,
|
|
136
|
+
children: [{ index: true, element: <OperationList /> }],
|
|
137
|
+
},
|
|
138
|
+
],
|
|
139
|
+
},
|
|
140
|
+
] satisfies RouteObject[],
|
|
141
|
+
};
|
|
142
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import { type SchemaObject } from "../../../oas/graphql/index.js";
|
|
3
|
+
|
|
4
|
+
export const isObject = (value: unknown): boolean =>
|
|
5
|
+
typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6
|
+
|
|
7
|
+
export const generateSchemaExample = (schema: SchemaObject): any => {
|
|
8
|
+
// Directly return the example or default if they exist
|
|
9
|
+
if (schema.example !== undefined) {
|
|
10
|
+
return schema.example;
|
|
11
|
+
} else if (schema.default !== undefined) {
|
|
12
|
+
return schema.default;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Process examples object
|
|
16
|
+
if (schema.examples && isObject(schema.examples)) {
|
|
17
|
+
return Object.values(schema.examples)[0];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Recursively process objects and arrays
|
|
21
|
+
return processComplexTypes(schema);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
function processComplexTypes(schema: SchemaObject): any {
|
|
25
|
+
if (schema.type === "object" && schema.properties) {
|
|
26
|
+
const obj: { [key: string]: any } = {};
|
|
27
|
+
Object.keys(schema.properties!).forEach((key) => {
|
|
28
|
+
obj[key] = generateSchemaExample(schema.properties![key]);
|
|
29
|
+
});
|
|
30
|
+
return obj;
|
|
31
|
+
} else if (schema.type === "array" && schema.items) {
|
|
32
|
+
return [generateSchemaExample(schema.items)];
|
|
33
|
+
}
|
|
34
|
+
// Fallback for missing or undefined types
|
|
35
|
+
return getDefaultForType(schema.type);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function getDefaultForType(type?: string | string[]): any {
|
|
39
|
+
if (Array.isArray(type)) {
|
|
40
|
+
return getDefaultForSingleType(type[0]);
|
|
41
|
+
}
|
|
42
|
+
return getDefaultForSingleType(type);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function getDefaultForSingleType(type?: string): any {
|
|
46
|
+
switch (type) {
|
|
47
|
+
case "string":
|
|
48
|
+
return "";
|
|
49
|
+
case "number":
|
|
50
|
+
case "integer":
|
|
51
|
+
return 0;
|
|
52
|
+
case "boolean":
|
|
53
|
+
return false;
|
|
54
|
+
case "null":
|
|
55
|
+
return null;
|
|
56
|
+
default:
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { OperationListItemResult } from "../OperationList.js";
|
|
2
|
+
|
|
3
|
+
export const getCode = (operation: OperationListItemResult, option: string) => {
|
|
4
|
+
switch (option) {
|
|
5
|
+
case "curl":
|
|
6
|
+
return (
|
|
7
|
+
`curl --request ${operation.method.toLocaleUpperCase()} \\\n` +
|
|
8
|
+
` --url ${operation.path} \\\n` +
|
|
9
|
+
` --header 'Content-Type: application/json'`
|
|
10
|
+
);
|
|
11
|
+
case "wget":
|
|
12
|
+
return (
|
|
13
|
+
`wget --method=${operation.method.toLocaleUpperCase()} \\\n` +
|
|
14
|
+
` --header='Content-Type: application/json' \\\n` +
|
|
15
|
+
` ${operation.path}`
|
|
16
|
+
);
|
|
17
|
+
case "js":
|
|
18
|
+
return (
|
|
19
|
+
`fetch('${operation.path}', {\n` +
|
|
20
|
+
` method: '${operation.method.toLocaleUpperCase()}',\n` +
|
|
21
|
+
` headers: { 'Content-Type': 'application/json' },\n` +
|
|
22
|
+
`});`
|
|
23
|
+
);
|
|
24
|
+
case "ruby":
|
|
25
|
+
return (
|
|
26
|
+
`require 'net/http'\n\n` +
|
|
27
|
+
`url = URI.parse('${operation.path}')\n` +
|
|
28
|
+
`http = Net::HTTP.new(url.host, url.port)\n` +
|
|
29
|
+
`request = Net::HTTP::${operation.method}.new(url)\n` +
|
|
30
|
+
`request['Content-Type'] = 'application/json'\n` +
|
|
31
|
+
`http.request(request)`
|
|
32
|
+
);
|
|
33
|
+
case "php":
|
|
34
|
+
return (
|
|
35
|
+
`$ch = curl_init('${operation.path}');\n` +
|
|
36
|
+
`curl_setopt($ch, CURLOPT_CUSTOMREQUEST, '${operation.method.toLocaleUpperCase()}');\n` +
|
|
37
|
+
`curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);\n` +
|
|
38
|
+
`curl_exec($ch);\n` +
|
|
39
|
+
`curl_close($ch);`
|
|
40
|
+
);
|
|
41
|
+
case "go":
|
|
42
|
+
return (
|
|
43
|
+
`package main\n\n` +
|
|
44
|
+
`import (\n` +
|
|
45
|
+
` "net/http"\n` +
|
|
46
|
+
` "strings"\n` +
|
|
47
|
+
`)\n\n` +
|
|
48
|
+
`func main() {\n` +
|
|
49
|
+
` client := &http.Client{}\n` +
|
|
50
|
+
` req, _ := http.NewRequest("${operation.method.toLocaleUpperCase()}", "${operation.path}", strings.NewReader(""))\n` +
|
|
51
|
+
` req.Header.Set("Content-Type", "application/json")\n` +
|
|
52
|
+
` client.Do(req)\n` +
|
|
53
|
+
`}`
|
|
54
|
+
);
|
|
55
|
+
case "rust":
|
|
56
|
+
return (
|
|
57
|
+
`use reqwest::Client;\n\n` +
|
|
58
|
+
`fn main() {\n` +
|
|
59
|
+
` let client = Client::new();\n` +
|
|
60
|
+
` let res = client\n` +
|
|
61
|
+
` .${operation.method.toLocaleLowerCase()}("${operation.path}")\n` +
|
|
62
|
+
` .header("Content-Type", "application/json")\n` +
|
|
63
|
+
` .send();\n` +
|
|
64
|
+
`}`
|
|
65
|
+
);
|
|
66
|
+
default:
|
|
67
|
+
return "";
|
|
68
|
+
}
|
|
69
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as urql from "urql";
|
|
2
|
+
|
|
3
|
+
export const useQuery = urql.useQuery;
|
|
4
|
+
export const Provider = urql.Provider;
|
|
5
|
+
export const cacheExchange = urql.cacheExchange;
|
|
6
|
+
export const fetchExchange = urql.fetchExchange;
|
|
7
|
+
export const mapExchange = urql.mapExchange;
|
|
8
|
+
export const Client = urql.Client;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { monotonicFactory } from "ulid";
|
|
2
|
+
import { createWaitForNotify } from "../../../util/createWaitForNotify.js";
|
|
3
|
+
import {
|
|
4
|
+
cacheExchange,
|
|
5
|
+
Client,
|
|
6
|
+
fetchExchange,
|
|
7
|
+
mapExchange,
|
|
8
|
+
} from "../util/urql.js";
|
|
9
|
+
|
|
10
|
+
export type WorkerGraphQLMessage = { id: string; body: string };
|
|
11
|
+
|
|
12
|
+
const ulid = monotonicFactory();
|
|
13
|
+
export const createSharedWorkerClient = () => {
|
|
14
|
+
const worker = new SharedWorker(new URL("./worker.ts", import.meta.url), {
|
|
15
|
+
type: "module",
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
worker.port.start();
|
|
19
|
+
|
|
20
|
+
const [waitFor, notify] = createWaitForNotify<string>();
|
|
21
|
+
|
|
22
|
+
worker.port.onmessage = (e: MessageEvent<WorkerGraphQLMessage>) => {
|
|
23
|
+
notify(e.data.id, e.data.body);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
return new Client({
|
|
27
|
+
url: "/__z/graphql",
|
|
28
|
+
// Custom fetch to send the GraphQL request to the worker and convert the response back to a `Response` object
|
|
29
|
+
fetch: async (_req, init) => {
|
|
30
|
+
if (!init?.body) throw new Error("No body");
|
|
31
|
+
|
|
32
|
+
const id = ulid();
|
|
33
|
+
worker.port.postMessage({
|
|
34
|
+
id,
|
|
35
|
+
body: init.body as string,
|
|
36
|
+
} satisfies WorkerGraphQLMessage);
|
|
37
|
+
|
|
38
|
+
const body = await waitFor(id);
|
|
39
|
+
|
|
40
|
+
return new Response(body, {
|
|
41
|
+
headers: {
|
|
42
|
+
"Content-Type": "application/json",
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
},
|
|
46
|
+
exchanges: [
|
|
47
|
+
cacheExchange,
|
|
48
|
+
mapExchange({
|
|
49
|
+
onError(error, operation) {
|
|
50
|
+
console.error(error);
|
|
51
|
+
console.groupCollapsed("Operation info");
|
|
52
|
+
console.log("body", operation.query.loc?.source.body.trim());
|
|
53
|
+
console.log("variables", operation.variables);
|
|
54
|
+
console.groupEnd();
|
|
55
|
+
},
|
|
56
|
+
}),
|
|
57
|
+
fetchExchange,
|
|
58
|
+
],
|
|
59
|
+
});
|
|
60
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { createGraphQLServer } from "../../../oas/graphql/index.js";
|
|
2
|
+
import { type WorkerGraphQLMessage } from "./createSharedWorkerClient.js";
|
|
3
|
+
|
|
4
|
+
const localServer = createGraphQLServer();
|
|
5
|
+
|
|
6
|
+
const worker = self as unknown as SharedWorkerGlobalScope;
|
|
7
|
+
|
|
8
|
+
worker.addEventListener(
|
|
9
|
+
"connect",
|
|
10
|
+
function (event: MessageEvent<{ id: string; body: string }>) {
|
|
11
|
+
const port = event.ports[0];
|
|
12
|
+
|
|
13
|
+
port.onmessage = async function (e) {
|
|
14
|
+
const response = await localServer.fetch(
|
|
15
|
+
new Request("/__z/graphql", {
|
|
16
|
+
method: "POST",
|
|
17
|
+
body: e.data.body,
|
|
18
|
+
headers: {
|
|
19
|
+
"Content-Type": "application/json",
|
|
20
|
+
},
|
|
21
|
+
}),
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
port.postMessage({
|
|
25
|
+
id: e.data.id,
|
|
26
|
+
body: await response.text(),
|
|
27
|
+
} satisfies WorkerGraphQLMessage);
|
|
28
|
+
};
|
|
29
|
+
},
|
|
30
|
+
);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Navigate } from "react-router-dom";
|
|
2
|
+
import type { DevPortalPlugin } from "../../core/plugins.js";
|
|
3
|
+
|
|
4
|
+
type Redirect = {
|
|
5
|
+
from: string;
|
|
6
|
+
to: string;
|
|
7
|
+
replace?: boolean;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const redirectPlugin = (options: {
|
|
11
|
+
redirects: Redirect[];
|
|
12
|
+
}): DevPortalPlugin => {
|
|
13
|
+
return {
|
|
14
|
+
getRoutes: () =>
|
|
15
|
+
options.redirects.map(({ from, to, replace }) => ({
|
|
16
|
+
path: from,
|
|
17
|
+
element: <Navigate to={to} replace={replace} />,
|
|
18
|
+
})),
|
|
19
|
+
};
|
|
20
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import typographyPlugin from "@tailwindcss/typography";
|
|
2
|
+
import type { Config } from "tailwindcss";
|
|
3
|
+
import defaultTheme from "tailwindcss/defaultTheme.js";
|
|
4
|
+
const content = [
|
|
5
|
+
"./src/**/*.{js,ts,jsx,tsx,md,mdx}",
|
|
6
|
+
"./node_modules/zudoku/dist/**/*.{js,ts,jsx,tsx,md,mdx}",
|
|
7
|
+
];
|
|
8
|
+
|
|
9
|
+
// ,
|
|
10
|
+
// if (process.env.NODE_ENV === "development") {
|
|
11
|
+
// content.push("../../plugins/*/src/**/*.{js,ts,jsx,tsx}");
|
|
12
|
+
// }
|
|
13
|
+
|
|
14
|
+
const config: Config = {
|
|
15
|
+
darkMode: "selector",
|
|
16
|
+
content,
|
|
17
|
+
theme: {
|
|
18
|
+
extend: {
|
|
19
|
+
fontFamily: {
|
|
20
|
+
sans: [
|
|
21
|
+
["Geist", ...defaultTheme.fontFamily.sans],
|
|
22
|
+
{ fontFeatureSettings: '"rlig" 1, "calt" 0' },
|
|
23
|
+
],
|
|
24
|
+
},
|
|
25
|
+
typography: () => ({
|
|
26
|
+
DEFAULT: {
|
|
27
|
+
css: {
|
|
28
|
+
blockquote: { quotes: "none" },
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
}),
|
|
32
|
+
colors: {
|
|
33
|
+
border: "hsl(var(--border))",
|
|
34
|
+
input: "hsl(var(--input))",
|
|
35
|
+
ring: "hsl(var(--ring))",
|
|
36
|
+
background: "hsl(var(--background))",
|
|
37
|
+
foreground: "hsl(var(--foreground))",
|
|
38
|
+
primary: {
|
|
39
|
+
DEFAULT: "hsl(var(--primary))",
|
|
40
|
+
foreground: "hsl(var(--primary-foreground))",
|
|
41
|
+
},
|
|
42
|
+
secondary: {
|
|
43
|
+
DEFAULT: "hsl(var(--secondary))",
|
|
44
|
+
foreground: "hsl(var(--secondary-foreground))",
|
|
45
|
+
},
|
|
46
|
+
destructive: {
|
|
47
|
+
DEFAULT: "hsl(var(--destructive))",
|
|
48
|
+
foreground: "hsl(var(--destructive-foreground))",
|
|
49
|
+
},
|
|
50
|
+
muted: {
|
|
51
|
+
DEFAULT: "hsl(var(--muted))",
|
|
52
|
+
foreground: "hsl(var(--muted-foreground))",
|
|
53
|
+
},
|
|
54
|
+
accent: {
|
|
55
|
+
DEFAULT: "hsl(var(--accent))",
|
|
56
|
+
foreground: "hsl(var(--accent-foreground))",
|
|
57
|
+
},
|
|
58
|
+
popover: {
|
|
59
|
+
DEFAULT: "hsl(var(--popover))",
|
|
60
|
+
foreground: "hsl(var(--popover-foreground))",
|
|
61
|
+
},
|
|
62
|
+
card: {
|
|
63
|
+
DEFAULT: "hsl(var(--card))",
|
|
64
|
+
foreground: "hsl(var(--card-foreground))",
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
plugins: [typographyPlugin],
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export default config;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import {
|
|
3
|
+
AlertTriangleIcon,
|
|
4
|
+
InfoIcon,
|
|
5
|
+
LightbulbIcon,
|
|
6
|
+
ShieldAlertIcon,
|
|
7
|
+
} from "../core/icons.js";
|
|
8
|
+
import { cn } from "../util/cn.js";
|
|
9
|
+
|
|
10
|
+
const stylesMap = {
|
|
11
|
+
note: {
|
|
12
|
+
border: "border-gray-300 dark:border-zinc-800",
|
|
13
|
+
bg: "bg-gray-100 dark:bg-zinc-800/50",
|
|
14
|
+
iconColor: "text-gray-600 dark:text-zinc-300",
|
|
15
|
+
titleColor: "text-gray-600 dark:text-zinc-300",
|
|
16
|
+
textColor: "text-gray-600 dark:text-zinc-300",
|
|
17
|
+
Icon: InfoIcon,
|
|
18
|
+
},
|
|
19
|
+
tip: {
|
|
20
|
+
border: "border-green-500 dark:border-green-800",
|
|
21
|
+
bg: "bg-green-200/25 dark:bg-green-950/70",
|
|
22
|
+
iconColor: "text-green-600 dark:text-green-200",
|
|
23
|
+
titleColor: "text-green-700 dark:text-green-200",
|
|
24
|
+
textColor: "text-green-600 dark:text-green-50",
|
|
25
|
+
Icon: LightbulbIcon,
|
|
26
|
+
},
|
|
27
|
+
info: {
|
|
28
|
+
border: "border-blue-400 dark:border-blue-900/60",
|
|
29
|
+
bg: "bg-blue-50 dark:bg-blue-950/40",
|
|
30
|
+
iconColor: "text-blue-400 dark:text-blue-200",
|
|
31
|
+
titleColor: "text-blue-700 dark:text-blue-200",
|
|
32
|
+
textColor: "text-blue-600 dark:text-blue-100",
|
|
33
|
+
Icon: InfoIcon,
|
|
34
|
+
},
|
|
35
|
+
caution: {
|
|
36
|
+
border: "border-yellow-400 dark:border-yellow-400/25",
|
|
37
|
+
bg: "bg-yellow-100/60 dark:bg-yellow-400/10",
|
|
38
|
+
iconColor: "text-yellow-500 dark:text-yellow-300",
|
|
39
|
+
titleColor: "text-yellow-600 dark:text-yellow-300",
|
|
40
|
+
textColor: "text-yellow-700 dark:text-yellow-200",
|
|
41
|
+
Icon: AlertTriangleIcon,
|
|
42
|
+
},
|
|
43
|
+
danger: {
|
|
44
|
+
border: "border-rose-400 dark:border-rose-800",
|
|
45
|
+
bg: "bg-rose-50 dark:bg-rose-950/40",
|
|
46
|
+
iconColor: "text-rose-400 dark:text-rose-300",
|
|
47
|
+
titleColor: "text-rose-800 dark:text-rose-300",
|
|
48
|
+
textColor: "text-rose-700 dark:text-rose-100",
|
|
49
|
+
Icon: ShieldAlertIcon,
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
type CalloutProps = {
|
|
54
|
+
type: keyof typeof stylesMap;
|
|
55
|
+
title?: string;
|
|
56
|
+
children: ReactNode;
|
|
57
|
+
className?: string;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export const Callout = ({ type, children, title, className }: CalloutProps) => {
|
|
61
|
+
const { border, bg, iconColor, titleColor, textColor, Icon } =
|
|
62
|
+
stylesMap[type];
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<div
|
|
66
|
+
className={cn(
|
|
67
|
+
"not-prose grid grid-cols-[fit-content_1fr] grid-rows-[fit-content_1fr] gap-x-4 gap-y-2 text-md rounded-md border p-4",
|
|
68
|
+
"[&_a]:underline [&_a]:decoration-current [&_a]:decoration-from-font [&_a]:underline-offset-4 hover:[&_a]:decoration-1",
|
|
69
|
+
"[&_code]:!bg-transparent [&_code]:!border-none",
|
|
70
|
+
title && "items-center",
|
|
71
|
+
border,
|
|
72
|
+
bg,
|
|
73
|
+
className,
|
|
74
|
+
)}
|
|
75
|
+
>
|
|
76
|
+
<Icon
|
|
77
|
+
className={cn(!title && "mt-1 translate-y-px", iconColor)}
|
|
78
|
+
size={20}
|
|
79
|
+
aria-hidden="true"
|
|
80
|
+
/>
|
|
81
|
+
{title && <h3 className={cn("font-medium", titleColor)}>{title}</h3>}
|
|
82
|
+
<div className={cn("col-start-2", !title && "row-start-1", textColor)}>
|
|
83
|
+
{children}
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
);
|
|
87
|
+
};
|