zudoku 0.1.1-dev.15 → 0.1.1-dev.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app/App.js +3 -1
- package/dist/app/App.js.map +1 -1
- package/dist/config/config.d.ts +3 -3
- package/dist/index.d.ts +2 -6
- package/dist/index.js +1 -5
- package/dist/index.js.map +1 -1
- package/dist/{app → lib}/DevPortal.d.ts +2 -2
- package/dist/{app → lib}/DevPortal.js +4 -4
- package/dist/{app → lib}/DevPortal.js.map +1 -1
- package/dist/{app → lib}/Heading.js.map +1 -1
- package/dist/{app → lib}/Router.js.map +1 -1
- package/dist/lib/auth.d.ts +1 -0
- package/dist/lib/auth.js +2 -0
- package/dist/lib/auth.js.map +1 -0
- package/dist/lib/authentication/authentication.js.map +1 -0
- package/dist/{app → lib}/authentication/clerk.d.ts +1 -2
- package/dist/{app → lib}/authentication/clerk.js +1 -2
- package/dist/lib/authentication/clerk.js.map +1 -0
- package/dist/{app → lib}/authentication/openid.js.map +1 -1
- package/dist/{app → lib}/components/AnchorLink.js.map +1 -1
- package/dist/{app → lib}/components/CategoryHeading.js.map +1 -1
- package/dist/{app → lib}/components/Dialog.js.map +1 -1
- package/dist/{app → lib}/components/DynamicIcon.js.map +1 -1
- package/dist/{app → lib}/components/Header.js.map +1 -1
- package/dist/{app → lib}/components/Input.js.map +1 -1
- package/dist/{app → lib}/components/Layout.js.map +1 -1
- package/dist/{app → lib}/components/Markdown.js.map +1 -1
- package/dist/{app → lib}/components/SyntaxHighlight.js.map +1 -1
- package/dist/{app → lib}/components/TopNavigation.js.map +1 -1
- package/dist/{app → lib}/components/context/ComponentsContext.js.map +1 -1
- package/dist/{app → lib}/components/context/DevPortalProvider.js.map +1 -1
- package/dist/lib/components/context/PluginSystem.js.map +1 -0
- package/dist/{app → lib}/components/context/ThemeContext.js.map +1 -1
- package/dist/{app → lib}/components/context/ViewportAnchorContext.js.map +1 -1
- package/dist/{app → lib}/components/navigation/SideNavigation.js.map +1 -1
- package/dist/{app → lib}/components/navigation/SideNavigationCategory.js.map +1 -1
- package/dist/{app → lib}/components/navigation/SideNavigationItem.js.map +1 -1
- package/dist/{app → lib}/components/navigation/SideNavigationWrapper.js.map +1 -1
- package/dist/{app → lib}/components/navigation/useNavigationCollapsibleState.js.map +1 -1
- package/dist/{app → lib}/components/navigation/util.js.map +1 -1
- package/dist/lib/components.d.ts +3 -0
- package/dist/lib/components.js +4 -0
- package/dist/lib/components.js.map +1 -0
- package/dist/{app → lib}/core/DevPortalContext.js.map +1 -1
- package/dist/{app → lib}/core/helmet.js.map +1 -1
- package/dist/lib/core/icons.js.map +1 -0
- package/dist/{app → lib}/core/plugins.js.map +1 -1
- package/dist/lib/core/router.js.map +1 -0
- package/dist/lib/core/types/combine.js.map +1 -0
- package/dist/{app → lib}/oas/graphql/index.js.map +1 -1
- package/dist/{app → lib}/oas/graphql/server.js.map +1 -1
- package/dist/{app → lib}/oas/parser/dereference/index.js.map +1 -1
- package/dist/{app → lib}/oas/parser/dereference/resolveRef.js.map +1 -1
- package/dist/{app → lib}/oas/parser/index.js.map +1 -1
- package/dist/{app → lib}/oas/parser/upgrade/index.js.map +1 -1
- package/dist/{app → lib}/plugins/api-key/SettingsApiKeys.js.map +1 -1
- package/dist/{app → lib}/plugins/api-key/index.js.map +1 -1
- package/dist/{app → lib}/plugins/markdown/MdxPage.js.map +1 -1
- package/dist/{app → lib}/plugins/markdown/Toc.js.map +1 -1
- package/dist/{app → lib}/plugins/markdown/generateRoutes.js.map +1 -1
- package/dist/{app → lib}/plugins/markdown/index.js.map +1 -1
- package/dist/{app → lib}/plugins/openapi/ColorizedParam.js.map +1 -1
- package/dist/{app → lib}/plugins/openapi/MakeRequest.js.map +1 -1
- package/dist/{app → lib}/plugins/openapi/MethodBadge.js.map +1 -1
- package/dist/{app → lib}/plugins/openapi/OperationList.js.map +1 -1
- package/dist/{app → lib}/plugins/openapi/OperationListItem.js.map +1 -1
- package/dist/{app → lib}/plugins/openapi/ParameterList.js.map +1 -1
- package/dist/{app → lib}/plugins/openapi/ParameterListItem.js.map +1 -1
- package/dist/{app → lib}/plugins/openapi/RequestBodySidecarBox.js.map +1 -1
- package/dist/{app → lib}/plugins/openapi/ResponsesSidecarBox.js.map +1 -1
- package/dist/{app → lib}/plugins/openapi/Select.js.map +1 -1
- package/dist/{app → lib}/plugins/openapi/Sidecar.js.map +1 -1
- package/dist/{app → lib}/plugins/openapi/SidecarBox.js.map +1 -1
- package/dist/{app → lib}/plugins/openapi/graphql/fragment-masking.js.map +1 -1
- package/dist/{app → lib}/plugins/openapi/graphql/gql.js.map +1 -1
- package/dist/{app → lib}/plugins/openapi/graphql/graphql.js.map +1 -1
- package/dist/lib/plugins/openapi/graphql/index.js.map +1 -0
- package/dist/{app → lib}/plugins/openapi/index.js.map +1 -1
- package/dist/{app → lib}/plugins/openapi/playground/Playground.js.map +1 -1
- package/dist/{app → lib}/plugins/openapi/util/generateSchemaExample.js.map +1 -1
- package/dist/{app → lib}/plugins/openapi/util/urql.js.map +1 -1
- package/dist/{app → lib}/plugins/openapi/worker/createSharedWorkerClient.js.map +1 -1
- package/dist/{app → lib}/plugins/openapi/worker/worker.js.map +1 -1
- package/dist/{app → lib}/plugins/redirect/index.js.map +1 -1
- package/dist/lib/plugins.d.ts +4 -0
- package/dist/lib/plugins.js +6 -0
- package/dist/lib/plugins.js.map +1 -0
- package/dist/{app → lib}/ui/Button.d.ts +1 -1
- package/dist/{app → lib}/ui/Button.js.map +1 -1
- package/dist/{app → lib}/ui/Callout.js.map +1 -1
- package/dist/{app → lib}/ui/Card.js.map +1 -1
- package/dist/{app → lib}/ui/Note.js.map +1 -1
- package/dist/{app → lib}/ui/Tabs.js.map +1 -1
- package/dist/{app → lib}/util/MdxComponents.js.map +1 -1
- package/dist/{app → lib}/util/cn.js.map +1 -1
- package/dist/{app → lib}/util/createVariantComponent.js.map +1 -1
- package/dist/{app → lib}/util/createWaitForNotify.js.map +1 -1
- package/dist/{app → lib}/util/groupBy.js.map +1 -1
- package/dist/{app → lib}/util/joinPath.js.map +1 -1
- package/dist/{app → lib}/util/pastellize.js.map +1 -1
- package/dist/lib/util/slugify.js.map +1 -0
- package/dist/{app → lib}/util/traverseNavigation.js.map +1 -1
- package/dist/{app → lib}/util/useScrollToAnchor.js.map +1 -1
- package/dist/{app → lib}/util/useScrollToTop.js.map +1 -1
- package/dist/vite/config.d.ts +0 -1
- package/dist/vite/config.js +18 -14
- package/dist/vite/config.js.map +1 -1
- package/dist/vite/dev-server.js +1 -1
- package/dist/vite/plugin-api.js +1 -1
- package/dist/vite/plugin-api.js.map +1 -1
- package/dist/vite/plugin-auth.js +2 -2
- package/dist/vite/plugin-auth.js.map +1 -1
- package/dist/vite/plugin-component.d.ts +3 -0
- package/dist/vite/plugin-component.js +22 -0
- package/dist/vite/plugin-component.js.map +1 -0
- package/dist/vite/plugin-docs.js +1 -1
- package/dist/vite/plugin-docs.js.map +1 -1
- package/dist/vite/plugin-html.js +0 -3
- package/dist/vite/plugin-html.js.map +1 -1
- package/dist/vite/plugin-mdx.js +1 -1
- package/dist/vite/plugin-mdx.js.map +1 -1
- package/package.json +15 -17
- package/src/app/App.tsx +4 -1
- package/dist/app/authentication/authentication.js.map +0 -1
- package/dist/app/authentication/clerk.js.map +0 -1
- package/dist/app/components/context/PluginSystem.js.map +0 -1
- package/dist/app/core/icons.js.map +0 -1
- package/dist/app/core/router.js.map +0 -1
- package/dist/app/core/types/combine.js.map +0 -1
- package/dist/app/main.css +0 -137
- package/dist/app/plugins/openapi/graphql/index.js.map +0 -1
- package/dist/app/util/slugify.js.map +0 -1
- package/dist/auth.d.ts +0 -2
- package/dist/auth.js +0 -3
- package/dist/auth.js.map +0 -1
- package/dist/plugins.d.ts +0 -4
- package/dist/plugins.js +0 -6
- package/dist/plugins.js.map +0 -1
- package/src/app/DevPortal.tsx +0 -93
- package/src/app/Heading.tsx +0 -60
- package/src/app/Router.tsx +0 -28
- package/src/app/authentication/authentication.ts +0 -18
- package/src/app/authentication/clerk.ts +0 -47
- package/src/app/authentication/openid.ts +0 -192
- package/src/app/components/AnchorLink.tsx +0 -19
- package/src/app/components/CategoryHeading.tsx +0 -16
- package/src/app/components/Dialog.tsx +0 -119
- package/src/app/components/DynamicIcon.tsx +0 -60
- package/src/app/components/Header.tsx +0 -69
- package/src/app/components/Input.tsx +0 -24
- package/src/app/components/Layout.tsx +0 -56
- package/src/app/components/Markdown.tsx +0 -37
- package/src/app/components/SyntaxHighlight.tsx +0 -94
- package/src/app/components/TopNavigation.tsx +0 -32
- package/src/app/components/context/ComponentsContext.tsx +0 -24
- package/src/app/components/context/DevPortalProvider.ts +0 -54
- package/src/app/components/context/PluginSystem.ts +0 -0
- package/src/app/components/context/ThemeContext.tsx +0 -46
- package/src/app/components/context/ViewportAnchorContext.tsx +0 -139
- package/src/app/components/navigation/SideNavigation.tsx +0 -18
- package/src/app/components/navigation/SideNavigationCategory.tsx +0 -74
- package/src/app/components/navigation/SideNavigationItem.tsx +0 -143
- package/src/app/components/navigation/SideNavigationWrapper.tsx +0 -15
- package/src/app/components/navigation/useNavigationCollapsibleState.ts +0 -27
- package/src/app/components/navigation/util.ts +0 -38
- package/src/app/core/DevPortalContext.ts +0 -164
- package/src/app/core/helmet.ts +0 -5
- package/src/app/core/icons.tsx +0 -1
- package/src/app/core/plugins.ts +0 -43
- package/src/app/core/router.tsx +0 -1
- package/src/app/core/types/combine.ts +0 -16
- package/src/app/oas/graphql/index.ts +0 -422
- package/src/app/oas/graphql/server.ts +0 -10
- package/src/app/oas/parser/dereference/index.ts +0 -59
- package/src/app/oas/parser/dereference/resolveRef.ts +0 -32
- package/src/app/oas/parser/index.ts +0 -94
- package/src/app/oas/parser/schemas/v3.0.json +0 -1489
- package/src/app/oas/parser/schemas/v3.1.json +0 -1298
- package/src/app/oas/parser/upgrade/index.ts +0 -108
- package/src/app/plugins/api-key/SettingsApiKeys.tsx +0 -22
- package/src/app/plugins/api-key/index.tsx +0 -123
- package/src/app/plugins/markdown/MdxPage.tsx +0 -128
- package/src/app/plugins/markdown/Toc.tsx +0 -122
- package/src/app/plugins/markdown/generateRoutes.tsx +0 -72
- package/src/app/plugins/markdown/index.tsx +0 -31
- package/src/app/plugins/openapi/ColorizedParam.tsx +0 -82
- package/src/app/plugins/openapi/MakeRequest.tsx +0 -49
- package/src/app/plugins/openapi/MethodBadge.tsx +0 -36
- package/src/app/plugins/openapi/OperationList.tsx +0 -117
- package/src/app/plugins/openapi/OperationListItem.tsx +0 -55
- package/src/app/plugins/openapi/ParameterList.tsx +0 -32
- package/src/app/plugins/openapi/ParameterListItem.tsx +0 -60
- package/src/app/plugins/openapi/RequestBodySidecarBox.tsx +0 -51
- package/src/app/plugins/openapi/ResponsesSidecarBox.tsx +0 -60
- package/src/app/plugins/openapi/Select.tsx +0 -35
- package/src/app/plugins/openapi/Sidecar.tsx +0 -160
- package/src/app/plugins/openapi/SidecarBox.tsx +0 -36
- package/src/app/plugins/openapi/graphql/fragment-masking.ts +0 -111
- package/src/app/plugins/openapi/graphql/gql.ts +0 -70
- package/src/app/plugins/openapi/graphql/graphql.ts +0 -795
- package/src/app/plugins/openapi/graphql/index.ts +0 -2
- package/src/app/plugins/openapi/index.tsx +0 -142
- package/src/app/plugins/openapi/playground/Playground.tsx +0 -309
- package/src/app/plugins/openapi/queries.graphql +0 -6
- package/src/app/plugins/openapi/util/generateSchemaExample.ts +0 -59
- package/src/app/plugins/openapi/util/urql.ts +0 -8
- package/src/app/plugins/openapi/worker/createSharedWorkerClient.ts +0 -60
- package/src/app/plugins/openapi/worker/worker.ts +0 -30
- package/src/app/plugins/redirect/index.tsx +0 -20
- package/src/app/ui/Button.tsx +0 -56
- package/src/app/ui/Callout.tsx +0 -87
- package/src/app/ui/Card.tsx +0 -82
- package/src/app/ui/Note.tsx +0 -58
- package/src/app/ui/Tabs.tsx +0 -52
- package/src/app/util/MdxComponents.tsx +0 -70
- package/src/app/util/cn.ts +0 -6
- package/src/app/util/createVariantComponent.tsx +0 -30
- package/src/app/util/createWaitForNotify.ts +0 -18
- package/src/app/util/groupBy.ts +0 -24
- package/src/app/util/joinPath.tsx +0 -10
- package/src/app/util/pastellize.ts +0 -25
- package/src/app/util/slugify.ts +0 -3
- package/src/app/util/traverseNavigation.ts +0 -55
- package/src/app/util/useScrollToAnchor.ts +0 -38
- package/src/app/util/useScrollToTop.ts +0 -13
- /package/dist/{app → lib}/Heading.d.ts +0 -0
- /package/dist/{app → lib}/Heading.js +0 -0
- /package/dist/{app → lib}/Router.d.ts +0 -0
- /package/dist/{app → lib}/Router.js +0 -0
- /package/dist/{app → lib}/authentication/authentication.d.ts +0 -0
- /package/dist/{app → lib}/authentication/authentication.js +0 -0
- /package/dist/{app → lib}/authentication/openid.d.ts +0 -0
- /package/dist/{app → lib}/authentication/openid.js +0 -0
- /package/dist/{app → lib}/components/AnchorLink.d.ts +0 -0
- /package/dist/{app → lib}/components/AnchorLink.js +0 -0
- /package/dist/{app → lib}/components/CategoryHeading.d.ts +0 -0
- /package/dist/{app → lib}/components/CategoryHeading.js +0 -0
- /package/dist/{app → lib}/components/Dialog.d.ts +0 -0
- /package/dist/{app → lib}/components/Dialog.js +0 -0
- /package/dist/{app → lib}/components/DynamicIcon.d.ts +0 -0
- /package/dist/{app → lib}/components/DynamicIcon.js +0 -0
- /package/dist/{app → lib}/components/Header.d.ts +0 -0
- /package/dist/{app → lib}/components/Header.js +0 -0
- /package/dist/{app → lib}/components/Input.d.ts +0 -0
- /package/dist/{app → lib}/components/Input.js +0 -0
- /package/dist/{app → lib}/components/Layout.d.ts +0 -0
- /package/dist/{app → lib}/components/Layout.js +0 -0
- /package/dist/{app → lib}/components/Markdown.d.ts +0 -0
- /package/dist/{app → lib}/components/Markdown.js +0 -0
- /package/dist/{app → lib}/components/SyntaxHighlight.d.ts +0 -0
- /package/dist/{app → lib}/components/SyntaxHighlight.js +0 -0
- /package/dist/{app → lib}/components/TopNavigation.d.ts +0 -0
- /package/dist/{app → lib}/components/TopNavigation.js +0 -0
- /package/dist/{app → lib}/components/context/ComponentsContext.d.ts +0 -0
- /package/dist/{app → lib}/components/context/ComponentsContext.js +0 -0
- /package/dist/{app → lib}/components/context/DevPortalProvider.d.ts +0 -0
- /package/dist/{app → lib}/components/context/DevPortalProvider.js +0 -0
- /package/dist/{app → lib}/components/context/PluginSystem.d.ts +0 -0
- /package/dist/{app → lib}/components/context/PluginSystem.js +0 -0
- /package/dist/{app → lib}/components/context/ThemeContext.d.ts +0 -0
- /package/dist/{app → lib}/components/context/ThemeContext.js +0 -0
- /package/dist/{app → lib}/components/context/ViewportAnchorContext.d.ts +0 -0
- /package/dist/{app → lib}/components/context/ViewportAnchorContext.js +0 -0
- /package/dist/{app → lib}/components/navigation/SideNavigation.d.ts +0 -0
- /package/dist/{app → lib}/components/navigation/SideNavigation.js +0 -0
- /package/dist/{app → lib}/components/navigation/SideNavigationCategory.d.ts +0 -0
- /package/dist/{app → lib}/components/navigation/SideNavigationCategory.js +0 -0
- /package/dist/{app → lib}/components/navigation/SideNavigationItem.d.ts +0 -0
- /package/dist/{app → lib}/components/navigation/SideNavigationItem.js +0 -0
- /package/dist/{app → lib}/components/navigation/SideNavigationWrapper.d.ts +0 -0
- /package/dist/{app → lib}/components/navigation/SideNavigationWrapper.js +0 -0
- /package/dist/{app → lib}/components/navigation/useNavigationCollapsibleState.d.ts +0 -0
- /package/dist/{app → lib}/components/navigation/useNavigationCollapsibleState.js +0 -0
- /package/dist/{app → lib}/components/navigation/util.d.ts +0 -0
- /package/dist/{app → lib}/components/navigation/util.js +0 -0
- /package/dist/{app → lib}/core/DevPortalContext.d.ts +0 -0
- /package/dist/{app → lib}/core/DevPortalContext.js +0 -0
- /package/dist/{app → lib}/core/helmet.d.ts +0 -0
- /package/dist/{app → lib}/core/helmet.js +0 -0
- /package/dist/{app → lib}/core/icons.d.ts +0 -0
- /package/dist/{app → lib}/core/icons.js +0 -0
- /package/dist/{app → lib}/core/plugins.d.ts +0 -0
- /package/dist/{app → lib}/core/plugins.js +0 -0
- /package/dist/{app → lib}/core/router.d.ts +0 -0
- /package/dist/{app → lib}/core/router.js +0 -0
- /package/dist/{app → lib}/core/types/combine.d.ts +0 -0
- /package/dist/{app → lib}/core/types/combine.js +0 -0
- /package/dist/{app → lib}/oas/graphql/index.d.ts +0 -0
- /package/dist/{app → lib}/oas/graphql/index.js +0 -0
- /package/dist/{app → lib}/oas/graphql/server.d.ts +0 -0
- /package/dist/{app → lib}/oas/graphql/server.js +0 -0
- /package/dist/{app → lib}/oas/parser/dereference/index.d.ts +0 -0
- /package/dist/{app → lib}/oas/parser/dereference/index.js +0 -0
- /package/dist/{app → lib}/oas/parser/dereference/resolveRef.d.ts +0 -0
- /package/dist/{app → lib}/oas/parser/dereference/resolveRef.js +0 -0
- /package/dist/{app → lib}/oas/parser/index.d.ts +0 -0
- /package/dist/{app → lib}/oas/parser/index.js +0 -0
- /package/dist/{app → lib}/oas/parser/upgrade/index.d.ts +0 -0
- /package/dist/{app → lib}/oas/parser/upgrade/index.js +0 -0
- /package/dist/{app → lib}/plugins/api-key/SettingsApiKeys.d.ts +0 -0
- /package/dist/{app → lib}/plugins/api-key/SettingsApiKeys.js +0 -0
- /package/dist/{app → lib}/plugins/api-key/index.d.ts +0 -0
- /package/dist/{app → lib}/plugins/api-key/index.js +0 -0
- /package/dist/{app → lib}/plugins/markdown/MdxPage.d.ts +0 -0
- /package/dist/{app → lib}/plugins/markdown/MdxPage.js +0 -0
- /package/dist/{app → lib}/plugins/markdown/Toc.d.ts +0 -0
- /package/dist/{app → lib}/plugins/markdown/Toc.js +0 -0
- /package/dist/{app → lib}/plugins/markdown/generateRoutes.d.ts +0 -0
- /package/dist/{app → lib}/plugins/markdown/generateRoutes.js +0 -0
- /package/dist/{app → lib}/plugins/markdown/index.d.ts +0 -0
- /package/dist/{app → lib}/plugins/markdown/index.js +0 -0
- /package/dist/{app → lib}/plugins/openapi/ColorizedParam.d.ts +0 -0
- /package/dist/{app → lib}/plugins/openapi/ColorizedParam.js +0 -0
- /package/dist/{app → lib}/plugins/openapi/MakeRequest.d.ts +0 -0
- /package/dist/{app → lib}/plugins/openapi/MakeRequest.js +0 -0
- /package/dist/{app → lib}/plugins/openapi/MethodBadge.d.ts +0 -0
- /package/dist/{app → lib}/plugins/openapi/MethodBadge.js +0 -0
- /package/dist/{app → lib}/plugins/openapi/OperationList.d.ts +0 -0
- /package/dist/{app → lib}/plugins/openapi/OperationList.js +0 -0
- /package/dist/{app → lib}/plugins/openapi/OperationListItem.d.ts +0 -0
- /package/dist/{app → lib}/plugins/openapi/OperationListItem.js +0 -0
- /package/dist/{app → lib}/plugins/openapi/ParameterList.d.ts +0 -0
- /package/dist/{app → lib}/plugins/openapi/ParameterList.js +0 -0
- /package/dist/{app → lib}/plugins/openapi/ParameterListItem.d.ts +0 -0
- /package/dist/{app → lib}/plugins/openapi/ParameterListItem.js +0 -0
- /package/dist/{app → lib}/plugins/openapi/RequestBodySidecarBox.d.ts +0 -0
- /package/dist/{app → lib}/plugins/openapi/RequestBodySidecarBox.js +0 -0
- /package/dist/{app → lib}/plugins/openapi/ResponsesSidecarBox.d.ts +0 -0
- /package/dist/{app → lib}/plugins/openapi/ResponsesSidecarBox.js +0 -0
- /package/dist/{app → lib}/plugins/openapi/Select.d.ts +0 -0
- /package/dist/{app → lib}/plugins/openapi/Select.js +0 -0
- /package/dist/{app → lib}/plugins/openapi/Sidecar.d.ts +0 -0
- /package/dist/{app → lib}/plugins/openapi/Sidecar.js +0 -0
- /package/dist/{app → lib}/plugins/openapi/SidecarBox.d.ts +0 -0
- /package/dist/{app → lib}/plugins/openapi/SidecarBox.js +0 -0
- /package/dist/{app → lib}/plugins/openapi/graphql/fragment-masking.d.ts +0 -0
- /package/dist/{app → lib}/plugins/openapi/graphql/fragment-masking.js +0 -0
- /package/dist/{app → lib}/plugins/openapi/graphql/gql.d.ts +0 -0
- /package/dist/{app → lib}/plugins/openapi/graphql/gql.js +0 -0
- /package/dist/{app → lib}/plugins/openapi/graphql/graphql.d.ts +0 -0
- /package/dist/{app → lib}/plugins/openapi/graphql/graphql.js +0 -0
- /package/dist/{app → lib}/plugins/openapi/graphql/index.d.ts +0 -0
- /package/dist/{app → lib}/plugins/openapi/graphql/index.js +0 -0
- /package/dist/{app → lib}/plugins/openapi/index.d.ts +0 -0
- /package/dist/{app → lib}/plugins/openapi/index.js +0 -0
- /package/dist/{app → lib}/plugins/openapi/playground/Playground.d.ts +0 -0
- /package/dist/{app → lib}/plugins/openapi/playground/Playground.js +0 -0
- /package/dist/{app → lib}/plugins/openapi/util/generateSchemaExample.d.ts +0 -0
- /package/dist/{app → lib}/plugins/openapi/util/generateSchemaExample.js +0 -0
- /package/dist/{app → lib}/plugins/openapi/util/urql.d.ts +0 -0
- /package/dist/{app → lib}/plugins/openapi/util/urql.js +0 -0
- /package/dist/{app → lib}/plugins/openapi/worker/createSharedWorkerClient.d.ts +0 -0
- /package/dist/{app → lib}/plugins/openapi/worker/createSharedWorkerClient.js +0 -0
- /package/dist/{app → lib}/plugins/openapi/worker/worker.d.ts +0 -0
- /package/dist/{app → lib}/plugins/openapi/worker/worker.js +0 -0
- /package/dist/{app → lib}/plugins/redirect/index.d.ts +0 -0
- /package/dist/{app → lib}/plugins/redirect/index.js +0 -0
- /package/dist/{app → lib}/ui/Button.js +0 -0
- /package/dist/{app → lib}/ui/Callout.d.ts +0 -0
- /package/dist/{app → lib}/ui/Callout.js +0 -0
- /package/dist/{app → lib}/ui/Card.d.ts +0 -0
- /package/dist/{app → lib}/ui/Card.js +0 -0
- /package/dist/{app → lib}/ui/Note.d.ts +0 -0
- /package/dist/{app → lib}/ui/Note.js +0 -0
- /package/dist/{app → lib}/ui/Tabs.d.ts +0 -0
- /package/dist/{app → lib}/ui/Tabs.js +0 -0
- /package/dist/{app → lib}/util/MdxComponents.d.ts +0 -0
- /package/dist/{app → lib}/util/MdxComponents.js +0 -0
- /package/dist/{app → lib}/util/cn.d.ts +0 -0
- /package/dist/{app → lib}/util/cn.js +0 -0
- /package/dist/{app → lib}/util/createVariantComponent.d.ts +0 -0
- /package/dist/{app → lib}/util/createVariantComponent.js +0 -0
- /package/dist/{app → lib}/util/createWaitForNotify.d.ts +0 -0
- /package/dist/{app → lib}/util/createWaitForNotify.js +0 -0
- /package/dist/{app → lib}/util/groupBy.d.ts +0 -0
- /package/dist/{app → lib}/util/groupBy.js +0 -0
- /package/dist/{app → lib}/util/joinPath.d.ts +0 -0
- /package/dist/{app → lib}/util/joinPath.js +0 -0
- /package/dist/{app → lib}/util/pastellize.d.ts +0 -0
- /package/dist/{app → lib}/util/pastellize.js +0 -0
- /package/dist/{app → lib}/util/slugify.d.ts +0 -0
- /package/dist/{app → lib}/util/slugify.js +0 -0
- /package/dist/{app → lib}/util/traverseNavigation.d.ts +0 -0
- /package/dist/{app → lib}/util/traverseNavigation.js +0 -0
- /package/dist/{app → lib}/util/useScrollToAnchor.d.ts +0 -0
- /package/dist/{app → lib}/util/useScrollToAnchor.js +0 -0
- /package/dist/{app → lib}/util/useScrollToTop.d.ts +0 -0
- /package/dist/{app → lib}/util/useScrollToTop.js +0 -0
|
@@ -1,142 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,309 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Dialog,
|
|
3
|
-
DialogContent,
|
|
4
|
-
DialogDescription,
|
|
5
|
-
DialogHeader,
|
|
6
|
-
DialogTitle,
|
|
7
|
-
DialogTrigger,
|
|
8
|
-
} from "../../../components/Dialog.js";
|
|
9
|
-
import { Card, CardContent } from "../../../ui/Card.js";
|
|
10
|
-
import { Button } from "../../../ui/Button.js";
|
|
11
|
-
import { Tabs, TabsContent, TabsList, TabsTrigger } from "../../../ui/Tabs.js";
|
|
12
|
-
import { Header } from "har-format";
|
|
13
|
-
import {
|
|
14
|
-
Fragment,
|
|
15
|
-
InputHTMLAttributes,
|
|
16
|
-
useEffect,
|
|
17
|
-
useRef,
|
|
18
|
-
useState,
|
|
19
|
-
} from "react";
|
|
20
|
-
import { TrashIcon } from "lucide-react";
|
|
21
|
-
import createVariantComponent from "../../../util/createVariantComponent.js";
|
|
22
|
-
import { SyntaxHighlight } from "../../../components/SyntaxHighlight.js";
|
|
23
|
-
import {
|
|
24
|
-
ColorizedParam,
|
|
25
|
-
DATA_ATTR,
|
|
26
|
-
usePastellizedColor,
|
|
27
|
-
} from "../ColorizedParam.js";
|
|
28
|
-
import { cn } from "../../../util/cn.js";
|
|
29
|
-
import { useMutation } from "@tanstack/react-query";
|
|
30
|
-
|
|
31
|
-
const InlineInput = createVariantComponent(
|
|
32
|
-
"input",
|
|
33
|
-
"px-2 bg-transparent h-8 font-mono text-xs m-2",
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
const ParameterValue = ({
|
|
37
|
-
part,
|
|
38
|
-
className,
|
|
39
|
-
...props
|
|
40
|
-
}: {
|
|
41
|
-
part: string;
|
|
42
|
-
} & InputHTMLAttributes<HTMLInputElement>) => {
|
|
43
|
-
const color = usePastellizedColor(part);
|
|
44
|
-
return (
|
|
45
|
-
<InlineInput
|
|
46
|
-
{...props}
|
|
47
|
-
className={cn(className, "opacity-80 data-[active=true]:opacity-100")}
|
|
48
|
-
style={{ color: `hsl(${color})` }}
|
|
49
|
-
/>
|
|
50
|
-
);
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
const Playground = ({
|
|
54
|
-
url,
|
|
55
|
-
host,
|
|
56
|
-
method,
|
|
57
|
-
defaultHeaders,
|
|
58
|
-
}: {
|
|
59
|
-
host: string;
|
|
60
|
-
url: string;
|
|
61
|
-
method: string;
|
|
62
|
-
defaultHeaders?: Header[];
|
|
63
|
-
}) => {
|
|
64
|
-
const [headers, setHeaders] = useState<Header[]>(
|
|
65
|
-
defaultHeaders ?? [{ name: "", value: "" }],
|
|
66
|
-
);
|
|
67
|
-
const [urlParts, setUrlParts] = useState<Header[]>(
|
|
68
|
-
url
|
|
69
|
-
.split("/")
|
|
70
|
-
.filter((part) => part.startsWith("{") && part.endsWith("}"))
|
|
71
|
-
.map((part) => ({ name: part, value: "" })),
|
|
72
|
-
);
|
|
73
|
-
|
|
74
|
-
useEffect(() => {
|
|
75
|
-
const lastHeader = headers.at(-1);
|
|
76
|
-
if (lastHeader?.value !== "" || lastHeader?.name !== "") {
|
|
77
|
-
setHeaders([...headers, { name: "", value: "" }]);
|
|
78
|
-
}
|
|
79
|
-
}, [headers]);
|
|
80
|
-
|
|
81
|
-
const x = useMutation({
|
|
82
|
-
mutationFn: async () => {
|
|
83
|
-
const fullUrl =
|
|
84
|
-
host +
|
|
85
|
-
url
|
|
86
|
-
.split("/")
|
|
87
|
-
.map((v) => urlParts.find((part) => part.name === v)?.value ?? v)
|
|
88
|
-
.join("/");
|
|
89
|
-
console.log(
|
|
90
|
-
fullUrl,
|
|
91
|
-
Object.fromEntries(
|
|
92
|
-
headers.map((header) => [header.name, header.value]),
|
|
93
|
-
),
|
|
94
|
-
);
|
|
95
|
-
const response = await fetch(fullUrl, {
|
|
96
|
-
// method,
|
|
97
|
-
headers: Object.fromEntries(
|
|
98
|
-
headers
|
|
99
|
-
.filter((h) => h.name)
|
|
100
|
-
.map((header) => [header.name, header.value]),
|
|
101
|
-
),
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
return {
|
|
105
|
-
status: response.status,
|
|
106
|
-
body: await response.text(),
|
|
107
|
-
};
|
|
108
|
-
},
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
const path = url.split("/").map((part) => (
|
|
112
|
-
<Fragment key={part}>
|
|
113
|
-
{part.startsWith("{") && part.endsWith("}") ? (
|
|
114
|
-
<ColorizedParam
|
|
115
|
-
name={part.slice(1, -1)}
|
|
116
|
-
backgroundOpacity="0"
|
|
117
|
-
onClick={() => {
|
|
118
|
-
console.log("asd");
|
|
119
|
-
}}
|
|
120
|
-
slug={part.slice(1, -1)}
|
|
121
|
-
>
|
|
122
|
-
{urlParts.find((p) => p.name === part)?.value}
|
|
123
|
-
</ColorizedParam>
|
|
124
|
-
) : (
|
|
125
|
-
part
|
|
126
|
-
)}
|
|
127
|
-
/
|
|
128
|
-
<wbr />
|
|
129
|
-
</Fragment>
|
|
130
|
-
));
|
|
131
|
-
|
|
132
|
-
return (
|
|
133
|
-
<Dialog>
|
|
134
|
-
<DialogTrigger>Open</DialogTrigger>
|
|
135
|
-
<DialogContent className="max-w-screen-xl">
|
|
136
|
-
<DialogHeader>
|
|
137
|
-
<DialogTitle>API Playground</DialogTitle>
|
|
138
|
-
<DialogDescription>
|
|
139
|
-
<div className="grid grid-cols-2 gap-2">
|
|
140
|
-
<Card>
|
|
141
|
-
<CardContent className="border-b border-border pt-4">
|
|
142
|
-
<div>URL</div>
|
|
143
|
-
<div className="flex gap-2">
|
|
144
|
-
<div className="border rounded border-border p-1.5 w-full">
|
|
145
|
-
{path}
|
|
146
|
-
</div>
|
|
147
|
-
<Button onClick={() => x.mutateAsync()}>Send</Button>
|
|
148
|
-
</div>
|
|
149
|
-
</CardContent>
|
|
150
|
-
<Tabs defaultValue="headers">
|
|
151
|
-
<CardContent className="border-b border-border py-4">
|
|
152
|
-
<TabsList>
|
|
153
|
-
<TabsTrigger value="headers">
|
|
154
|
-
Headers ({headers.length})
|
|
155
|
-
</TabsTrigger>
|
|
156
|
-
<TabsTrigger value="parameters">Parameters</TabsTrigger>
|
|
157
|
-
<TabsTrigger value="auth">Auth</TabsTrigger>
|
|
158
|
-
</TabsList>
|
|
159
|
-
</CardContent>
|
|
160
|
-
<CardContent>
|
|
161
|
-
<TabsContent value="headers">
|
|
162
|
-
<div className="grid grid-cols-[1fr_1fr_auto]">
|
|
163
|
-
{headers.map((header, i) => (
|
|
164
|
-
<div
|
|
165
|
-
key={i}
|
|
166
|
-
className="grid-cols-subgrid col-span-full grid items-center gap-x-2 has-[:focus]:bg-muted hover:bg-muted rounded overflow-hidden group"
|
|
167
|
-
>
|
|
168
|
-
{/*<input type="checkbox" />*/}
|
|
169
|
-
<InlineInput
|
|
170
|
-
onChange={(e) =>
|
|
171
|
-
setHeaders((headers) => {
|
|
172
|
-
const newHeaders = [...headers];
|
|
173
|
-
newHeaders[i] = {
|
|
174
|
-
...headers[i],
|
|
175
|
-
name: e.target.value,
|
|
176
|
-
};
|
|
177
|
-
return newHeaders;
|
|
178
|
-
})
|
|
179
|
-
}
|
|
180
|
-
value={header.name}
|
|
181
|
-
placeholder={"Name"}
|
|
182
|
-
className="peer"
|
|
183
|
-
/>
|
|
184
|
-
<InlineInput
|
|
185
|
-
onChange={(e) =>
|
|
186
|
-
setHeaders((headers) => {
|
|
187
|
-
const newHeaders = [...headers];
|
|
188
|
-
newHeaders[i] = {
|
|
189
|
-
name: "",
|
|
190
|
-
...headers.at(i),
|
|
191
|
-
value: e.target.value,
|
|
192
|
-
};
|
|
193
|
-
return newHeaders;
|
|
194
|
-
})
|
|
195
|
-
}
|
|
196
|
-
value={header.value}
|
|
197
|
-
placeholder={"Value"}
|
|
198
|
-
className="peer"
|
|
199
|
-
/>
|
|
200
|
-
<button
|
|
201
|
-
className="hover:bg-black/5 p-1 rounded mr-2 text-muted-foreground invisible group-hover:visible peer-focus:visible"
|
|
202
|
-
onClick={() => {
|
|
203
|
-
setHeaders((headers) =>
|
|
204
|
-
[...headers].toSpliced(i, 1),
|
|
205
|
-
);
|
|
206
|
-
}}
|
|
207
|
-
>
|
|
208
|
-
<TrashIcon size={16} />
|
|
209
|
-
</button>
|
|
210
|
-
<div className="col-span-full border-b border-border"></div>
|
|
211
|
-
</div>
|
|
212
|
-
))}
|
|
213
|
-
</div>
|
|
214
|
-
</TabsContent>
|
|
215
|
-
<TabsContent value="parameters">
|
|
216
|
-
Parameters
|
|
217
|
-
<div className="grid grid-cols-[1fr_1fr_auto]">
|
|
218
|
-
{urlParts.map(({ name, value }, i) => (
|
|
219
|
-
<div
|
|
220
|
-
key={i}
|
|
221
|
-
className="grid-cols-subgrid col-span-full grid items-center gap-x-2 has-[:focus]:bg-muted hover:bg-muted rounded overflow-hidden group"
|
|
222
|
-
>
|
|
223
|
-
{/*<input type="checkbox" />*/}
|
|
224
|
-
<InlineInput
|
|
225
|
-
onChange={(e) =>
|
|
226
|
-
setHeaders((headers) => {
|
|
227
|
-
const newHeaders = [...headers];
|
|
228
|
-
newHeaders[i] = {
|
|
229
|
-
...headers[i],
|
|
230
|
-
name: e.target.value,
|
|
231
|
-
};
|
|
232
|
-
return newHeaders;
|
|
233
|
-
})
|
|
234
|
-
}
|
|
235
|
-
value={name.slice(1, -1)}
|
|
236
|
-
disabled
|
|
237
|
-
placeholder={"Name"}
|
|
238
|
-
className="peer"
|
|
239
|
-
/>
|
|
240
|
-
<ParameterValue
|
|
241
|
-
part={name.slice(1, -1)}
|
|
242
|
-
onChange={(e) =>
|
|
243
|
-
setUrlParts((parts) => {
|
|
244
|
-
const newParts = [...parts];
|
|
245
|
-
newParts[i] = {
|
|
246
|
-
name: "",
|
|
247
|
-
...parts.at(i),
|
|
248
|
-
value: e.target.value,
|
|
249
|
-
};
|
|
250
|
-
return newParts;
|
|
251
|
-
})
|
|
252
|
-
}
|
|
253
|
-
{...{ [DATA_ATTR]: name.slice(1, -1) }}
|
|
254
|
-
value={value}
|
|
255
|
-
placeholder={"Value"}
|
|
256
|
-
className="peer"
|
|
257
|
-
/>
|
|
258
|
-
|
|
259
|
-
<div className="col-span-full border-b border-border"></div>
|
|
260
|
-
</div>
|
|
261
|
-
))}
|
|
262
|
-
</div>
|
|
263
|
-
</TabsContent>
|
|
264
|
-
<TabsContent value="auth">
|
|
265
|
-
<CardContent>
|
|
266
|
-
{url
|
|
267
|
-
.split("/")
|
|
268
|
-
.map((part, i) =>
|
|
269
|
-
part.startsWith("{") && part.endsWith("}")
|
|
270
|
-
? urlParts[i]
|
|
271
|
-
: part,
|
|
272
|
-
)
|
|
273
|
-
.join("/")}
|
|
274
|
-
</CardContent>
|
|
275
|
-
Change your password here.
|
|
276
|
-
</TabsContent>
|
|
277
|
-
</CardContent>
|
|
278
|
-
</Tabs>
|
|
279
|
-
</Card>
|
|
280
|
-
<Card>
|
|
281
|
-
<CardContent>
|
|
282
|
-
{method.toUpperCase()}
|
|
283
|
-
{url
|
|
284
|
-
.split("/")
|
|
285
|
-
.map((v) =>
|
|
286
|
-
v.startsWith("{") && v.endsWith("}")
|
|
287
|
-
? urlParts.find((part) => part.name === v)?.value ?? v
|
|
288
|
-
: v,
|
|
289
|
-
)
|
|
290
|
-
.join("/")}
|
|
291
|
-
<SyntaxHighlight
|
|
292
|
-
language="json"
|
|
293
|
-
noBackground
|
|
294
|
-
copyable={false}
|
|
295
|
-
className="text-xs"
|
|
296
|
-
code={x.data?.body ?? JSON.stringify("")}
|
|
297
|
-
/>
|
|
298
|
-
</CardContent>
|
|
299
|
-
{x.data?.status}
|
|
300
|
-
</Card>
|
|
301
|
-
</div>
|
|
302
|
-
</DialogDescription>
|
|
303
|
-
</DialogHeader>
|
|
304
|
-
</DialogContent>
|
|
305
|
-
</Dialog>
|
|
306
|
-
);
|
|
307
|
-
};
|
|
308
|
-
|
|
309
|
-
export { Playground };
|
|
@@ -1,59 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
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;
|
|
@@ -1,60 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
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
|
-
);
|
|
@@ -1,20 +0,0 @@
|
|
|
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
|
-
};
|