zudoku 0.0.0-f865d81 → 0.0.0-fa903e7
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/demo.js +0 -2
- package/dist/app/demo.js.map +1 -1
- package/dist/app/entry.client.js +14 -0
- package/dist/app/entry.client.js.map +1 -1
- package/dist/app/entry.server.js +6 -6
- package/dist/app/entry.server.js.map +1 -1
- package/dist/app/main.d.ts +1 -1
- package/dist/app/main.js +2 -2
- package/dist/app/main.js.map +1 -1
- package/dist/app/standalone.js +0 -2
- package/dist/app/standalone.js.map +1 -1
- package/dist/cli/cli.js +1 -2
- package/dist/cli/cli.js.map +1 -1
- package/dist/cli/common/logger.js +9 -0
- package/dist/cli/common/logger.js.map +1 -1
- package/dist/codegen.d.ts +3 -0
- package/dist/codegen.js +45 -0
- package/dist/codegen.js.map +1 -0
- package/dist/config/validators/InputSidebarSchema.d.ts +10 -10
- package/dist/config/validators/validate.d.ts +148 -117
- package/dist/config/validators/validate.js +13 -6
- package/dist/config/validators/validate.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/authentication/AuthenticationPlugin.d.ts +4 -2
- package/dist/lib/authentication/AuthenticationPlugin.js +3 -0
- package/dist/lib/authentication/AuthenticationPlugin.js.map +1 -1
- package/dist/lib/authentication/authentication.d.ts +3 -3
- package/dist/lib/authentication/hook.d.ts +5 -4
- package/dist/lib/authentication/hook.js +1 -3
- package/dist/lib/authentication/hook.js.map +1 -1
- package/dist/lib/authentication/providers/auth0.js +12 -11
- package/dist/lib/authentication/providers/auth0.js.map +1 -1
- package/dist/lib/authentication/providers/openid.d.ts +0 -1
- package/dist/lib/authentication/providers/openid.js +11 -26
- package/dist/lib/authentication/providers/openid.js.map +1 -1
- package/dist/lib/authentication/state.d.ts +25 -4
- package/dist/lib/authentication/state.js +28 -3
- package/dist/lib/authentication/state.js.map +1 -1
- package/dist/lib/authentication/use-broadcast/shared.d.ts +48 -0
- package/dist/lib/authentication/use-broadcast/shared.js +243 -0
- package/dist/lib/authentication/use-broadcast/shared.js.map +1 -0
- package/dist/lib/authentication/use-broadcast/useBroadcast.d.ts +24 -0
- package/dist/lib/authentication/use-broadcast/useBroadcast.js +106 -0
- package/dist/lib/authentication/use-broadcast/useBroadcast.js.map +1 -0
- package/dist/lib/components/Bootstrap.d.ts +3 -1
- package/dist/lib/components/Bootstrap.js +10 -4
- package/dist/lib/components/Bootstrap.js.map +1 -1
- package/dist/lib/components/ClientOnly.d.ts +4 -2
- package/dist/lib/components/ClientOnly.js +1 -1
- package/dist/lib/components/ClientOnly.js.map +1 -1
- package/dist/lib/components/DeveloperHint.js +2 -1
- package/dist/lib/components/DeveloperHint.js.map +1 -1
- package/dist/lib/components/Header.js +16 -10
- package/dist/lib/components/Header.js.map +1 -1
- package/dist/lib/components/Heading.d.ts +1 -1
- package/dist/lib/components/Layout.js +12 -4
- package/dist/lib/components/Layout.js.map +1 -1
- package/dist/lib/components/MobileTopNavigation.js +6 -7
- package/dist/lib/components/MobileTopNavigation.js.map +1 -1
- package/dist/lib/components/SyntaxHighlight.js +16 -12
- package/dist/lib/components/SyntaxHighlight.js.map +1 -1
- package/dist/lib/components/ThemeSwitch.d.ts +1 -0
- package/dist/lib/components/ThemeSwitch.js +13 -0
- package/dist/lib/components/ThemeSwitch.js.map +1 -0
- package/dist/lib/components/TopNavigation.d.ts +2 -0
- package/dist/lib/components/TopNavigation.js +13 -7
- package/dist/lib/components/TopNavigation.js.map +1 -1
- package/dist/lib/components/{DevPortal.d.ts → Zudoku.d.ts} +3 -3
- package/dist/lib/components/{DevPortal.js → Zudoku.js} +13 -14
- package/dist/lib/components/Zudoku.js.map +1 -0
- package/dist/lib/components/context/ZudokuContext.d.ts +7 -7
- package/dist/lib/components/context/ZudokuContext.js +8 -13
- package/dist/lib/components/context/ZudokuContext.js.map +1 -1
- package/dist/lib/components/context/ZudokuProvider.d.ts +2 -2
- package/dist/lib/components/context/ZudokuProvider.js.map +1 -1
- package/dist/lib/components/index.d.ts +18 -10
- package/dist/lib/components/index.js +2 -3
- package/dist/lib/components/index.js.map +1 -1
- package/dist/lib/components/navigation/Sidebar.js +1 -1
- package/dist/lib/components/navigation/Sidebar.js.map +1 -1
- package/dist/lib/components/navigation/utils.js +2 -2
- package/dist/lib/components/navigation/utils.js.map +1 -1
- package/dist/lib/core/{DevPortalContext.d.ts → ZudokuContext.d.ts} +3 -7
- package/dist/lib/core/{DevPortalContext.js → ZudokuContext.js} +2 -7
- package/dist/lib/core/ZudokuContext.js.map +1 -0
- package/dist/lib/core/plugins.d.ts +18 -12
- package/dist/lib/core/plugins.js.map +1 -1
- package/dist/lib/errors/ErrorAlert.js +1 -1
- package/dist/lib/errors/ErrorAlert.js.map +1 -1
- package/dist/lib/oas/graphql/index.js +4 -4
- package/dist/lib/oas/graphql/index.js.map +1 -1
- package/dist/lib/oas/parser/upgrade/index.d.ts +2 -2
- package/dist/lib/oas/parser/upgrade/index.js +2 -17
- package/dist/lib/oas/parser/upgrade/index.js.map +1 -1
- package/dist/lib/plugins/api-keys/index.d.ts +9 -9
- package/dist/lib/plugins/api-keys/index.js +3 -0
- package/dist/lib/plugins/api-keys/index.js.map +1 -1
- package/dist/lib/plugins/custom-pages/index.d.ts +2 -2
- package/dist/lib/plugins/custom-pages/index.js.map +1 -1
- package/dist/lib/plugins/markdown/MdxPage.d.ts +9 -1
- package/dist/lib/plugins/markdown/MdxPage.js +14 -1
- package/dist/lib/plugins/markdown/MdxPage.js.map +1 -1
- package/dist/lib/plugins/markdown/index.d.ts +2 -2
- package/dist/lib/plugins/markdown/index.js +1 -1
- package/dist/lib/plugins/markdown/index.js.map +1 -1
- package/dist/lib/plugins/openapi/CollapsibleCode.d.ts +5 -0
- package/dist/lib/plugins/openapi/CollapsibleCode.js +24 -0
- package/dist/lib/plugins/openapi/CollapsibleCode.js.map +1 -0
- package/dist/lib/plugins/openapi/ColorizedParam.js +13 -9
- package/dist/lib/plugins/openapi/ColorizedParam.js.map +1 -1
- package/dist/lib/plugins/openapi/Endpoint.d.ts +1 -1
- package/dist/lib/plugins/openapi/Endpoint.js +5 -9
- package/dist/lib/plugins/openapi/Endpoint.js.map +1 -1
- package/dist/lib/plugins/openapi/OperationList.d.ts +2 -2
- package/dist/lib/plugins/openapi/OperationList.js +21 -22
- package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
- package/dist/lib/plugins/openapi/ParameterListItem.js +6 -1
- package/dist/lib/plugins/openapi/ParameterListItem.js.map +1 -1
- package/dist/lib/plugins/openapi/RequestBodySidecarBox.js +7 -3
- package/dist/lib/plugins/openapi/RequestBodySidecarBox.js.map +1 -1
- package/dist/lib/plugins/openapi/ResponsesSidecarBox.js +9 -2
- package/dist/lib/plugins/openapi/ResponsesSidecarBox.js.map +1 -1
- package/dist/lib/plugins/openapi/Route.d.ts +4 -4
- package/dist/lib/plugins/openapi/Route.js +2 -4
- package/dist/lib/plugins/openapi/Route.js.map +1 -1
- package/dist/lib/plugins/openapi/Sidecar.d.ts +1 -1
- package/dist/lib/plugins/openapi/Sidecar.js +35 -33
- package/dist/lib/plugins/openapi/Sidecar.js.map +1 -1
- package/dist/lib/plugins/openapi/client/GraphQLClient.d.ts +8 -0
- package/dist/lib/plugins/openapi/client/GraphQLClient.js +114 -0
- package/dist/lib/plugins/openapi/client/GraphQLClient.js.map +1 -0
- package/dist/lib/plugins/openapi/client/GraphQLContext.d.ts +7 -0
- package/dist/lib/plugins/openapi/client/GraphQLContext.js +5 -0
- package/dist/lib/plugins/openapi/client/GraphQLContext.js.map +1 -0
- package/dist/lib/plugins/openapi/client/createServer.d.ts +1 -0
- package/dist/lib/plugins/openapi/client/useCreateQuery.d.ts +5 -0
- package/dist/lib/plugins/openapi/client/useCreateQuery.js +15 -0
- package/dist/lib/plugins/openapi/client/useCreateQuery.js.map +1 -0
- package/dist/lib/plugins/openapi/client/worker.d.ts +4 -1
- package/dist/lib/plugins/openapi/client/worker.js +23 -14
- package/dist/lib/plugins/openapi/client/worker.js.map +1 -1
- package/dist/lib/plugins/openapi/graphql/fragment-masking.d.ts +3 -3
- package/dist/lib/plugins/openapi/graphql/fragment-masking.js +3 -4
- package/dist/lib/plugins/openapi/graphql/fragment-masking.js.map +1 -1
- package/dist/lib/plugins/openapi/graphql/gql.d.ts +5 -51
- package/dist/lib/plugins/openapi/graphql/gql.js +4 -2
- package/dist/lib/plugins/openapi/graphql/gql.js.map +1 -1
- package/dist/lib/plugins/openapi/graphql/graphql.d.ts +32 -8
- package/dist/lib/plugins/openapi/graphql/graphql.js +194 -662
- package/dist/lib/plugins/openapi/graphql/graphql.js.map +1 -1
- package/dist/lib/plugins/openapi/index.d.ts +2 -2
- package/dist/lib/plugins/openapi/index.js +40 -53
- package/dist/lib/plugins/openapi/index.js.map +1 -1
- package/dist/lib/plugins/openapi/interfaces.d.ts +1 -1
- package/dist/lib/plugins/openapi/post-processors/removeExtensions.d.ts +6 -0
- package/dist/lib/plugins/openapi/post-processors/removeExtensions.js +14 -0
- package/dist/lib/plugins/openapi/post-processors/removeExtensions.js.map +1 -0
- package/dist/lib/plugins/openapi/post-processors/removeExtensions.test.d.ts +1 -0
- package/dist/lib/plugins/openapi/post-processors/removeExtensions.test.js +125 -0
- package/dist/lib/plugins/openapi/post-processors/removeExtensions.test.js.map +1 -0
- package/dist/lib/plugins/openapi/post-processors/removePaths.d.ts +11 -0
- package/dist/lib/plugins/openapi/post-processors/removePaths.js +33 -0
- package/dist/lib/plugins/openapi/post-processors/removePaths.js.map +1 -0
- package/dist/lib/plugins/openapi/post-processors/removePaths.test.d.ts +1 -0
- package/dist/lib/plugins/openapi/post-processors/removePaths.test.js +104 -0
- package/dist/lib/plugins/openapi/post-processors/removePaths.test.js.map +1 -0
- package/dist/lib/plugins/openapi/post-processors/traverse.d.ts +1 -0
- package/dist/lib/plugins/openapi/post-processors/traverse.js +2 -0
- package/dist/lib/plugins/openapi/post-processors/traverse.js.map +1 -0
- package/dist/lib/plugins/openapi/schema/SchemaView.js +2 -1
- package/dist/lib/plugins/openapi/schema/SchemaView.js.map +1 -1
- package/dist/lib/plugins/openapi/util/generateSchemaExample.d.ts +0 -1
- package/dist/lib/plugins/openapi/util/generateSchemaExample.js +25 -36
- package/dist/lib/plugins/openapi/util/generateSchemaExample.js.map +1 -1
- package/dist/lib/plugins/openapi-worker.d.ts +1 -1
- package/dist/lib/plugins/openapi-worker.js +7 -1
- package/dist/lib/plugins/openapi-worker.js.map +1 -1
- package/dist/lib/plugins/redirect/index.d.ts +4 -7
- package/dist/lib/plugins/redirect/index.js +1 -1
- package/dist/lib/plugins/redirect/index.js.map +1 -1
- package/dist/lib/plugins/search-inkeep/index.d.ts +2 -2
- package/dist/lib/plugins/search-inkeep/index.js.map +1 -1
- package/dist/lib/ui/ActionButton.d.ts +4 -0
- package/dist/lib/ui/ActionButton.js +10 -0
- package/dist/lib/ui/ActionButton.js.map +1 -0
- package/dist/lib/util/MdxComponents.d.ts +1 -1
- package/dist/lib/util/traverse.d.ts +2 -0
- package/dist/lib/util/traverse.js +18 -0
- package/dist/lib/util/traverse.js.map +1 -0
- package/dist/lib/util/useIsomorphicLayoutEffect.d.ts +3 -0
- package/dist/lib/util/useIsomorphicLayoutEffect.js +4 -0
- package/dist/lib/util/useIsomorphicLayoutEffect.js.map +1 -0
- package/dist/lib/util/useOnScreen.d.ts +4 -0
- package/dist/lib/util/useOnScreen.js +19 -0
- package/dist/lib/util/useOnScreen.js.map +1 -0
- package/dist/vite/build.js +5 -1
- package/dist/vite/build.js.map +1 -1
- package/dist/vite/config.d.ts +2 -8
- package/dist/vite/config.js +25 -54
- package/dist/vite/config.js.map +1 -1
- package/dist/vite/config.test.js +3 -4
- package/dist/vite/config.test.js.map +1 -1
- package/dist/vite/html.js +0 -2
- package/dist/vite/html.js.map +1 -1
- package/dist/vite/output.d.ts +101 -0
- package/dist/vite/output.js +53 -0
- package/dist/vite/output.js.map +1 -0
- package/dist/vite/plugin-api.js +23 -19
- package/dist/vite/plugin-api.js.map +1 -1
- package/dist/vite/plugin-component.js +14 -19
- package/dist/vite/plugin-component.js.map +1 -1
- package/dist/vite/plugin-config.d.ts +2 -3
- package/dist/vite/plugin-config.js +2 -3
- package/dist/vite/plugin-config.js.map +1 -1
- package/dist/vite/plugin-docs.test.js +15 -23
- package/dist/vite/plugin-docs.test.js.map +1 -1
- package/dist/vite/plugin-mdx.d.ts +0 -6
- package/dist/vite/plugin-mdx.js +13 -5
- package/dist/vite/plugin-mdx.js.map +1 -1
- package/dist/vite/plugin.js +1 -3
- package/dist/vite/plugin.js.map +1 -1
- package/dist/vite/prerender.js +3 -2
- package/dist/vite/prerender.js.map +1 -1
- package/dist/vite/remarkStaticGeneration.d.ts +3 -0
- package/dist/vite/remarkStaticGeneration.js +125 -0
- package/dist/vite/remarkStaticGeneration.js.map +1 -0
- package/dist/zuplo/with-zuplo.d.ts +3 -0
- package/dist/zuplo/with-zuplo.js +28 -0
- package/dist/zuplo/with-zuplo.js.map +1 -0
- package/lib/{AnchorLink-BbB2q-jx.js → AnchorLink-CDlhr8gL.js} +11 -10
- package/lib/{AnchorLink-BbB2q-jx.js.map → AnchorLink-CDlhr8gL.js.map} +1 -1
- package/lib/AuthenticationPlugin-D0Em0SwR.js +59 -0
- package/lib/{AuthenticationPlugin-C9BHGXlE.js.map → AuthenticationPlugin-D0Em0SwR.js.map} +1 -1
- package/lib/Button-jK0EsymC.js +48 -0
- package/lib/Button-jK0EsymC.js.map +1 -0
- package/lib/{ClientOnly-CVN6leDu.js → ClientOnly-E7hGysn1.js} +4 -4
- package/lib/ClientOnly-E7hGysn1.js.map +1 -0
- package/lib/Markdown-ievDDhFT.js +15192 -0
- package/lib/Markdown-ievDDhFT.js.map +1 -0
- package/lib/MdxPage-B2FpJ9KC.js +183 -0
- package/lib/MdxPage-B2FpJ9KC.js.map +1 -0
- package/lib/OperationList-BkNQEsNs.js +4693 -0
- package/lib/OperationList-BkNQEsNs.js.map +1 -0
- package/lib/Route-DlG_HTMu.js +11 -0
- package/lib/Route-DlG_HTMu.js.map +1 -0
- package/lib/{Select-Bagt3Bme.js → Select-O9ZM3ZgX.js} +7 -7
- package/lib/Select-O9ZM3ZgX.js.map +1 -0
- package/lib/{Spinner-C6zroowC.js → SidebarBadge-DxFJcJ6V.js} +28 -17
- package/lib/SidebarBadge-DxFJcJ6V.js.map +1 -0
- package/lib/SlotletProvider-DyomlzGx.js +252 -0
- package/lib/SlotletProvider-DyomlzGx.js.map +1 -0
- package/lib/Spinner-3cQDBVGr.js +7 -0
- package/lib/Spinner-3cQDBVGr.js.map +1 -0
- package/lib/SyntaxHighlight-DkLOsjHS.js +2983 -0
- package/lib/SyntaxHighlight-DkLOsjHS.js.map +1 -0
- package/lib/assets/{worker-Bf8vjASY.js → worker-BHClFO3A.js} +156 -156
- package/lib/assets/worker-BHClFO3A.js.map +1 -0
- package/lib/context-D1nXWxm7.js +22 -0
- package/lib/context-D1nXWxm7.js.map +1 -0
- package/lib/createServer-CpJlUPtn.js +15299 -0
- package/lib/createServer-CpJlUPtn.js.map +1 -0
- package/lib/{hook-sn0zMTkE.js → hook-hEqe7fPB.js} +12 -14
- package/lib/hook-hEqe7fPB.js.map +1 -0
- package/lib/index-C7SaIME0.js +1277 -0
- package/lib/index-C7SaIME0.js.map +1 -0
- package/lib/index-Czzd9rjU.js +899 -0
- package/lib/index-Czzd9rjU.js.map +1 -0
- package/lib/index-Yn8c3UWE.js +921 -0
- package/lib/index-Yn8c3UWE.js.map +1 -0
- package/lib/object_hash-CvlLgU-M.js +785 -0
- package/lib/object_hash-CvlLgU-M.js.map +1 -0
- package/lib/post-processors/removeExtensions.js +11 -0
- package/lib/post-processors/removeExtensions.js.map +1 -0
- package/lib/post-processors/removePaths.js +28 -0
- package/lib/post-processors/removePaths.js.map +1 -0
- package/lib/post-processors/traverse.js +12 -0
- package/lib/post-processors/traverse.js.map +1 -0
- package/lib/{router-BsfSoK2j.js → router-lfyopgBI.js} +23 -23
- package/lib/{router-BsfSoK2j.js.map → router-lfyopgBI.js.map} +1 -1
- package/lib/state-tsXBLONe.js +203 -0
- package/lib/{state-CsuHT8ZO.js.map → state-tsXBLONe.js.map} +1 -1
- package/lib/ui/ActionButton.js +25 -0
- package/lib/ui/ActionButton.js.map +1 -0
- package/lib/useExposedProps-CTPtylCV.js +10 -0
- package/lib/{useExposedProps-ChOIUaS4.js.map → useExposedProps-CTPtylCV.js.map} +1 -1
- package/lib/{ZudokuContext-BKXGJTmu.js → utils-DcpDOncX.js} +242 -246
- package/lib/utils-DcpDOncX.js.map +1 -0
- package/lib/zudoku.auth-auth0.js +24 -18
- package/lib/zudoku.auth-auth0.js.map +1 -1
- package/lib/zudoku.auth-clerk.js +2 -2
- package/lib/zudoku.auth-openid.js +124 -138
- package/lib/zudoku.auth-openid.js.map +1 -1
- package/lib/zudoku.components.js +1291 -1119
- package/lib/zudoku.components.js.map +1 -1
- package/lib/zudoku.openapi-worker.js +10 -16336
- package/lib/zudoku.openapi-worker.js.map +1 -1
- package/lib/zudoku.plugin-api-keys.js +41 -39
- package/lib/zudoku.plugin-api-keys.js.map +1 -1
- package/lib/zudoku.plugin-custom-pages.js +2 -2
- package/lib/zudoku.plugin-custom-pages.js.map +1 -1
- package/lib/zudoku.plugin-markdown.js +15 -14
- package/lib/zudoku.plugin-markdown.js.map +1 -1
- package/lib/zudoku.plugin-openapi.js +5 -9
- package/lib/zudoku.plugin-openapi.js.map +1 -1
- package/lib/zudoku.plugin-redirect.js +2 -2
- package/lib/zudoku.plugin-redirect.js.map +1 -1
- package/lib/zudoku.plugin-search-inkeep.js +1 -1
- package/lib/zudoku.plugin-search-inkeep.js.map +1 -1
- package/package.json +27 -7
- package/src/app/demo.tsx +0 -3
- package/src/app/entry.client.tsx +14 -0
- package/src/app/entry.server.tsx +59 -53
- package/src/app/main.css +1 -1
- package/src/app/main.tsx +4 -4
- package/src/app/standalone.tsx +0 -3
- package/src/lib/authentication/AuthenticationPlugin.tsx +4 -1
- package/src/lib/authentication/authentication.ts +3 -3
- package/src/lib/authentication/hook.ts +1 -3
- package/src/lib/authentication/providers/auth0.tsx +17 -11
- package/src/lib/authentication/providers/openid.tsx +12 -30
- package/src/lib/authentication/state.ts +50 -9
- package/{LICENSE.md → src/lib/authentication/use-broadcast/LICENSE.md} +2 -2
- package/src/lib/authentication/use-broadcast/shared.ts +372 -0
- package/src/lib/authentication/use-broadcast/useBroadcast.ts +146 -0
- package/src/lib/components/Bootstrap.tsx +36 -14
- package/src/lib/components/ClientOnly.tsx +6 -3
- package/src/lib/components/DeveloperHint.tsx +6 -1
- package/src/lib/components/Header.tsx +68 -40
- package/src/lib/components/Layout.tsx +49 -37
- package/src/lib/components/MobileTopNavigation.tsx +15 -18
- package/src/lib/components/SyntaxHighlight.tsx +81 -46
- package/src/lib/components/ThemeSwitch.tsx +26 -0
- package/src/lib/components/TopNavigation.tsx +27 -19
- package/src/lib/components/Zudoku.tsx +108 -0
- package/src/lib/components/context/ZudokuContext.ts +11 -16
- package/src/lib/components/context/ZudokuProvider.tsx +2 -2
- package/src/lib/components/index.ts +2 -3
- package/src/lib/components/navigation/Sidebar.tsx +3 -3
- package/src/lib/components/navigation/utils.ts +2 -2
- package/src/lib/core/{DevPortalContext.ts → ZudokuContext.ts} +3 -11
- package/src/lib/core/plugins.ts +20 -16
- package/src/lib/errors/ErrorAlert.tsx +2 -1
- package/src/lib/oas/graphql/index.ts +4 -4
- package/src/lib/oas/parser/upgrade/index.ts +3 -24
- package/src/lib/plugins/api-keys/index.tsx +12 -9
- package/src/lib/plugins/custom-pages/index.tsx +2 -2
- package/src/lib/plugins/markdown/MdxPage.tsx +25 -1
- package/src/lib/plugins/markdown/index.tsx +3 -2
- package/src/lib/plugins/openapi/CollapsibleCode.tsx +80 -0
- package/src/lib/plugins/openapi/ColorizedParam.tsx +23 -14
- package/src/lib/plugins/openapi/Endpoint.tsx +5 -10
- package/src/lib/plugins/openapi/OperationList.tsx +20 -40
- package/src/lib/plugins/openapi/ParameterListItem.tsx +37 -31
- package/src/lib/plugins/openapi/RequestBodySidecarBox.tsx +18 -13
- package/src/lib/plugins/openapi/ResponsesSidecarBox.tsx +17 -12
- package/src/lib/plugins/openapi/Route.tsx +11 -12
- package/src/lib/plugins/openapi/Sidecar.tsx +73 -59
- package/src/lib/plugins/openapi/client/GraphQLClient.tsx +157 -0
- package/src/lib/plugins/openapi/client/GraphQLContext.tsx +16 -0
- package/src/lib/plugins/openapi/client/createServer.ts +2 -0
- package/src/lib/plugins/openapi/client/useCreateQuery.ts +21 -0
- package/src/lib/plugins/openapi/client/worker.ts +38 -24
- package/src/lib/plugins/openapi/graphql/fragment-masking.ts +11 -18
- package/src/lib/plugins/openapi/graphql/gql.ts +10 -27
- package/src/lib/plugins/openapi/graphql/graphql.ts +233 -665
- package/src/lib/plugins/openapi/index.tsx +42 -67
- package/src/lib/plugins/openapi/interfaces.ts +1 -1
- package/src/lib/plugins/openapi/post-processors/removeExtensions.test.ts +144 -0
- package/src/lib/plugins/openapi/post-processors/removeExtensions.ts +24 -0
- package/src/lib/plugins/openapi/post-processors/removePaths.test.ts +126 -0
- package/src/lib/plugins/openapi/post-processors/removePaths.ts +55 -0
- package/src/lib/plugins/openapi/post-processors/traverse.ts +1 -0
- package/src/lib/plugins/openapi/schema/SchemaView.tsx +5 -2
- package/src/lib/plugins/openapi/util/generateSchemaExample.ts +28 -42
- package/src/lib/plugins/openapi-worker.ts +11 -1
- package/src/lib/plugins/redirect/index.tsx +5 -9
- package/src/lib/plugins/search-inkeep/index.tsx +2 -2
- package/src/lib/ui/ActionButton.tsx +28 -0
- package/src/lib/util/traverse.ts +25 -0
- package/src/lib/util/useIsomorphicLayoutEffect.ts +5 -0
- package/src/lib/util/useOnScreen.ts +32 -0
- package/dist/lib/components/DevPortal.js.map +0 -1
- package/dist/lib/components/context/ThemeContext.d.ts +0 -2
- package/dist/lib/components/context/ThemeContext.js +0 -7
- package/dist/lib/components/context/ThemeContext.js.map +0 -1
- package/dist/lib/components/context/ThemeProvider.d.ts +0 -4
- package/dist/lib/components/context/ThemeProvider.js +0 -23
- package/dist/lib/components/context/ThemeProvider.js.map +0 -1
- package/dist/lib/core/DevPortalContext.js.map +0 -1
- package/dist/lib/plugins/openapi/client/createMemoryClient.d.ts +0 -12
- package/dist/lib/plugins/openapi/client/createMemoryClient.js +0 -46
- package/dist/lib/plugins/openapi/client/createMemoryClient.js.map +0 -1
- package/dist/lib/plugins/openapi/client/createWorkerClient.d.ts +0 -10
- package/dist/lib/plugins/openapi/client/createWorkerClient.js +0 -61
- package/dist/lib/plugins/openapi/client/createWorkerClient.js.map +0 -1
- package/dist/lib/plugins/openapi/client/interfaces.d.ts +0 -4
- package/dist/lib/plugins/openapi/client/interfaces.js +0 -2
- package/dist/lib/plugins/openapi/client/interfaces.js.map +0 -1
- package/dist/lib/themeToggle.d.ts +0 -1
- package/dist/lib/themeToggle.js +0 -7
- package/dist/lib/themeToggle.js.map +0 -1
- package/dist/lib/util/createWaitForNotify.d.ts +0 -1
- package/dist/lib/util/createWaitForNotify.js +0 -15
- package/dist/lib/util/createWaitForNotify.js.map +0 -1
- package/dist/vite/plugin-html-transform.d.ts +0 -2
- package/dist/vite/plugin-html-transform.js +0 -15
- package/dist/vite/plugin-html-transform.js.map +0 -1
- package/lib/AuthenticationPlugin-C9BHGXlE.js +0 -55
- package/lib/ClientOnly-CVN6leDu.js.map +0 -1
- package/lib/DeveloperHint-DHdLXGHA.js +0 -16
- package/lib/DeveloperHint-DHdLXGHA.js.map +0 -1
- package/lib/Markdown-BDcCAWwm.js +0 -18059
- package/lib/Markdown-BDcCAWwm.js.map +0 -1
- package/lib/MdxPage-DKMH_t0f.js +0 -174
- package/lib/MdxPage-DKMH_t0f.js.map +0 -1
- package/lib/OperationList-Tj7ubW_t.js +0 -604
- package/lib/OperationList-Tj7ubW_t.js.map +0 -1
- package/lib/Route-C3DGB6OS.js +0 -13
- package/lib/Route-C3DGB6OS.js.map +0 -1
- package/lib/Select-Bagt3Bme.js.map +0 -1
- package/lib/SlotletProvider-Da7eFgd2.js +0 -241
- package/lib/SlotletProvider-Da7eFgd2.js.map +0 -1
- package/lib/Spinner-C6zroowC.js.map +0 -1
- package/lib/StaggeredRender-DDHSzQKE.js +0 -17
- package/lib/StaggeredRender-DDHSzQKE.js.map +0 -1
- package/lib/ZudokuContext-BKXGJTmu.js.map +0 -1
- package/lib/assets/worker-Bf8vjASY.js.map +0 -1
- package/lib/hook-sn0zMTkE.js.map +0 -1
- package/lib/index-AjWCJNGC.js +0 -5690
- package/lib/index-AjWCJNGC.js.map +0 -1
- package/lib/index-CRo94sKK.js +0 -1783
- package/lib/index-CRo94sKK.js.map +0 -1
- package/lib/state-CsuHT8ZO.js +0 -183
- package/lib/urql-core-KJnLL26g.js +0 -1455
- package/lib/urql-core-KJnLL26g.js.map +0 -1
- package/lib/useExposedProps-ChOIUaS4.js +0 -9
- package/src/lib/components/DevPortal.tsx +0 -111
- package/src/lib/components/context/ThemeContext.tsx +0 -8
- package/src/lib/components/context/ThemeProvider.tsx +0 -27
- package/src/lib/plugins/openapi/client/createMemoryClient.ts +0 -51
- package/src/lib/plugins/openapi/client/createWorkerClient.ts +0 -75
- package/src/lib/plugins/openapi/client/interfaces.ts +0 -5
- package/src/lib/themeToggle.ts +0 -7
- package/src/lib/util/createWaitForNotify.ts +0 -18
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { MDXProvider } from "@mdx-js/react";
|
|
2
|
+
import { Helmet } from "@zudoku/react-helmet-async";
|
|
3
|
+
import { ThemeProvider } from "next-themes";
|
|
4
|
+
import {
|
|
5
|
+
Fragment,
|
|
6
|
+
memo,
|
|
7
|
+
type PropsWithChildren,
|
|
8
|
+
useContext,
|
|
9
|
+
useEffect,
|
|
10
|
+
useMemo,
|
|
11
|
+
useState,
|
|
12
|
+
} from "react";
|
|
13
|
+
import { ErrorBoundary } from "react-error-boundary";
|
|
14
|
+
import { Outlet, useNavigation } from "react-router-dom";
|
|
15
|
+
import { hasHead, isMdxProviderPlugin } from "../core/plugins.js";
|
|
16
|
+
import { ZudokuContext, ZudokuContextOptions } from "../core/ZudokuContext.js";
|
|
17
|
+
import { TopLevelError } from "../errors/TopLevelError.js";
|
|
18
|
+
import { StaggeredRenderContext } from "../plugins/openapi/StaggeredRender.js";
|
|
19
|
+
import { MdxComponents } from "../util/MdxComponents.js";
|
|
20
|
+
import "../util/requestIdleCallbackPolyfill.js";
|
|
21
|
+
import {
|
|
22
|
+
ComponentsProvider,
|
|
23
|
+
DEFAULT_COMPONENTS,
|
|
24
|
+
} from "./context/ComponentsContext.js";
|
|
25
|
+
import { ViewportAnchorProvider } from "./context/ViewportAnchorContext.js";
|
|
26
|
+
import { ZudokuProvider } from "./context/ZudokuProvider.js";
|
|
27
|
+
import { SlotletProvider } from "./SlotletProvider.js";
|
|
28
|
+
|
|
29
|
+
const ZudokoInner = memo(
|
|
30
|
+
({ children, ...props }: PropsWithChildren<ZudokuContextOptions>) => {
|
|
31
|
+
const components = useMemo(
|
|
32
|
+
() => ({ ...DEFAULT_COMPONENTS, ...props.overrides }),
|
|
33
|
+
[props.overrides],
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
const mdxComponents = useMemo(() => {
|
|
37
|
+
const componentsFromPlugins = (props.plugins ?? [])
|
|
38
|
+
.filter(isMdxProviderPlugin)
|
|
39
|
+
.flatMap((plugin) =>
|
|
40
|
+
plugin.getMdxComponents ? [plugin.getMdxComponents()] : [],
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
return {
|
|
44
|
+
...componentsFromPlugins.reduce(
|
|
45
|
+
(acc, curr) => ({ ...acc, ...curr }),
|
|
46
|
+
{},
|
|
47
|
+
),
|
|
48
|
+
...MdxComponents,
|
|
49
|
+
...props.mdx?.components,
|
|
50
|
+
};
|
|
51
|
+
}, [props.mdx?.components, props.plugins]);
|
|
52
|
+
const { stagger } = useContext(StaggeredRenderContext);
|
|
53
|
+
const [didNavigate, setDidNavigate] = useState(false);
|
|
54
|
+
const staggeredValue = useMemo(
|
|
55
|
+
() => (didNavigate ? { stagger: true } : { stagger }),
|
|
56
|
+
[stagger, didNavigate],
|
|
57
|
+
);
|
|
58
|
+
const navigation = useNavigation();
|
|
59
|
+
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
if (didNavigate) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
setDidNavigate(true);
|
|
65
|
+
}, [didNavigate, navigation.location]);
|
|
66
|
+
|
|
67
|
+
const [zudokuContext] = useState(() => new ZudokuContext(props));
|
|
68
|
+
|
|
69
|
+
const heads = props.plugins
|
|
70
|
+
?.filter(hasHead)
|
|
71
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
72
|
+
.map((plugin, i) => <Fragment key={i}>{plugin.getHead?.()}</Fragment>);
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<>
|
|
76
|
+
<Helmet>{heads}</Helmet>
|
|
77
|
+
<StaggeredRenderContext.Provider value={staggeredValue}>
|
|
78
|
+
<ZudokuProvider context={zudokuContext}>
|
|
79
|
+
<MDXProvider components={mdxComponents}>
|
|
80
|
+
<ThemeProvider attribute="class" disableTransitionOnChange>
|
|
81
|
+
<ComponentsProvider value={components}>
|
|
82
|
+
<SlotletProvider slotlets={props.slotlets}>
|
|
83
|
+
<ViewportAnchorProvider>
|
|
84
|
+
{children ?? <Outlet />}
|
|
85
|
+
</ViewportAnchorProvider>
|
|
86
|
+
</SlotletProvider>
|
|
87
|
+
</ComponentsProvider>
|
|
88
|
+
</ThemeProvider>
|
|
89
|
+
</MDXProvider>
|
|
90
|
+
</ZudokuProvider>
|
|
91
|
+
</StaggeredRenderContext.Provider>
|
|
92
|
+
</>
|
|
93
|
+
);
|
|
94
|
+
},
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
ZudokoInner.displayName = "ZudokoInner";
|
|
98
|
+
|
|
99
|
+
const Zudoku = (props: ZudokuContextOptions) => {
|
|
100
|
+
return (
|
|
101
|
+
<ErrorBoundary FallbackComponent={TopLevelError}>
|
|
102
|
+
<ZudokoInner {...props} />
|
|
103
|
+
</ErrorBoundary>
|
|
104
|
+
);
|
|
105
|
+
};
|
|
106
|
+
Zudoku.displayName = "Zudoku";
|
|
107
|
+
|
|
108
|
+
export { Zudoku };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { useQuery, useSuspenseQuery } from "@tanstack/react-query";
|
|
2
2
|
import { createContext, useContext } from "react";
|
|
3
3
|
import { matchPath, useLocation } from "react-router-dom";
|
|
4
|
-
import {
|
|
4
|
+
import { ZudokuContext } from "../../core/ZudokuContext.js";
|
|
5
5
|
import { joinPath } from "../../util/joinPath.js";
|
|
6
6
|
import { traverseSidebar } from "../navigation/utils.js";
|
|
7
7
|
|
|
8
|
-
export const ZudokuReactContext = createContext<
|
|
8
|
+
export const ZudokuReactContext = createContext<ZudokuContext | undefined>(
|
|
9
9
|
undefined,
|
|
10
10
|
);
|
|
11
11
|
|
|
@@ -13,7 +13,7 @@ export const useZudoku = () => {
|
|
|
13
13
|
const context = useContext(ZudokuReactContext);
|
|
14
14
|
|
|
15
15
|
if (!context) {
|
|
16
|
-
throw new Error("
|
|
16
|
+
throw new Error("useZudoku must be used within a ZudokuProvider.");
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
return context;
|
|
@@ -49,18 +49,13 @@ export const useCurrentNavigation = () => {
|
|
|
49
49
|
topNavigation.find((t) => t.id === currentSidebarItem?.[0]) ??
|
|
50
50
|
topNavigation.find((item) => matchPath(item.id, location.pathname));
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
queryFn:
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
return {
|
|
57
|
-
sidebar: [
|
|
58
|
-
...(currentSidebarItem ? currentSidebarItem[1] : []),
|
|
59
|
-
...pluginSidebar,
|
|
60
|
-
],
|
|
61
|
-
topNavItem: currentTopNavItem,
|
|
62
|
-
};
|
|
63
|
-
},
|
|
64
|
-
queryKey: ["navigation", location.pathname],
|
|
52
|
+
const { data } = useSuspenseQuery({
|
|
53
|
+
queryFn: () => getPluginSidebar(location.pathname),
|
|
54
|
+
queryKey: ["plugin-sidebar", location.pathname],
|
|
65
55
|
});
|
|
56
|
+
|
|
57
|
+
return {
|
|
58
|
+
sidebar: [...(currentSidebarItem ? currentSidebarItem[1] : []), ...data],
|
|
59
|
+
topNavItem: currentTopNavItem,
|
|
60
|
+
};
|
|
66
61
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { useSuspenseQuery } from "@tanstack/react-query";
|
|
2
2
|
import type { PropsWithChildren } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { ZudokuContext } from "../../core/ZudokuContext.js";
|
|
4
4
|
import { ZudokuReactContext } from "./ZudokuContext.js";
|
|
5
5
|
|
|
6
6
|
export const ZudokuProvider = ({
|
|
7
7
|
children,
|
|
8
8
|
context,
|
|
9
|
-
}: PropsWithChildren<{ context:
|
|
9
|
+
}: PropsWithChildren<{ context: ZudokuContext }>) => {
|
|
10
10
|
useSuspenseQuery({
|
|
11
11
|
queryFn: async () => {
|
|
12
12
|
await context.initialize();
|
|
@@ -11,11 +11,10 @@ import {
|
|
|
11
11
|
BootstrapStatic as BootstrapStaticImport,
|
|
12
12
|
} from "./Bootstrap.js";
|
|
13
13
|
import { ClientOnly as ClientOnlyImport } from "./ClientOnly.js";
|
|
14
|
-
import { DevPortal as DevPortalImport } from "./DevPortal.js";
|
|
15
14
|
import { Layout as LayoutImport } from "./Layout.js";
|
|
15
|
+
import { Zudoku as ZudokuImport } from "./Zudoku.js";
|
|
16
16
|
import { useZudoku as useZudokuImport } from "./context/ZudokuContext.js";
|
|
17
17
|
export const useMDXComponents = /*@__PURE__*/ useMDXComponentsImport;
|
|
18
|
-
export const DevPortal = /*@__PURE__*/ DevPortalImport;
|
|
19
18
|
export const Layout = /*@__PURE__*/ LayoutImport;
|
|
20
19
|
export const RouterError = /*@__PURE__*/ RouterErrorImport;
|
|
21
20
|
export const ServerError = /*@__PURE__*/ ServerErrorImport;
|
|
@@ -26,7 +25,7 @@ export const Head = /*@__PURE__*/ Helmet;
|
|
|
26
25
|
|
|
27
26
|
export const useZudoku = /*@__PURE__*/ useZudokuImport;
|
|
28
27
|
export const useAuth = /*@__PURE__*/ useAuthState;
|
|
29
|
-
export const Zudoku = /*@__PURE__*/
|
|
28
|
+
export const Zudoku = /*@__PURE__*/ ZudokuImport;
|
|
30
29
|
|
|
31
30
|
export const Callout = /*@__PURE__*/ CalloutImport;
|
|
32
31
|
export const ClientOnly = /*@__PURE__*/ ClientOnlyImport;
|
|
@@ -15,10 +15,10 @@ export const Sidebar = () => {
|
|
|
15
15
|
<>
|
|
16
16
|
<SidebarWrapper
|
|
17
17
|
ref={navRef}
|
|
18
|
-
pushMainContent={navigation.
|
|
18
|
+
pushMainContent={navigation.sidebar.length > 0}
|
|
19
19
|
>
|
|
20
20
|
<Slotlet name="zudoku-before-navigation" />
|
|
21
|
-
{navigation.
|
|
21
|
+
{navigation.sidebar.map((item) => (
|
|
22
22
|
<SidebarItem key={item.label} item={item} />
|
|
23
23
|
))}
|
|
24
24
|
<Slotlet name="zudoku-after-navigation" />
|
|
@@ -30,7 +30,7 @@ export const Sidebar = () => {
|
|
|
30
30
|
<VisuallyHidden>
|
|
31
31
|
<DrawerTitle>Sidebar</DrawerTitle>
|
|
32
32
|
</VisuallyHidden>
|
|
33
|
-
{navigation.
|
|
33
|
+
{navigation.sidebar.map((item) => (
|
|
34
34
|
<SidebarItem key={item.label} item={item} />
|
|
35
35
|
))}
|
|
36
36
|
</DrawerContent>
|
|
@@ -44,7 +44,7 @@ export const useCurrentItem = () => {
|
|
|
44
44
|
const location = useLocation();
|
|
45
45
|
const nav = useCurrentNavigation();
|
|
46
46
|
|
|
47
|
-
const currentSidebar = nav.
|
|
47
|
+
const currentSidebar = nav.sidebar;
|
|
48
48
|
|
|
49
49
|
return traverseSidebar(currentSidebar, (item) => {
|
|
50
50
|
if (item.type === "doc" && joinPath(item.id) === location.pathname) {
|
|
@@ -79,7 +79,7 @@ export const usePrevNext = (): {
|
|
|
79
79
|
} => {
|
|
80
80
|
const currentId = useLocation().pathname;
|
|
81
81
|
const nav = useCurrentNavigation();
|
|
82
|
-
const currentSidebar = nav.
|
|
82
|
+
const currentSidebar = nav.sidebar;
|
|
83
83
|
|
|
84
84
|
let prev;
|
|
85
85
|
let next;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { QueryClient } from "@tanstack/react-query";
|
|
2
1
|
import { ReactNode } from "react";
|
|
3
2
|
import type { SidebarConfig } from "../../config/validators/SidebarSchema.js";
|
|
4
3
|
import { TopNavigationItem } from "../../config/validators/validate.js";
|
|
@@ -8,11 +7,11 @@ import { Slotlets } from "../components/SlotletProvider.js";
|
|
|
8
7
|
import { joinPath } from "../util/joinPath.js";
|
|
9
8
|
import type { MdxComponentsType } from "../util/MdxComponents.js";
|
|
10
9
|
import {
|
|
11
|
-
type DevPortalPlugin,
|
|
12
10
|
isApiIdentityPlugin,
|
|
13
11
|
isNavigationPlugin,
|
|
14
12
|
type NavigationPlugin,
|
|
15
13
|
needsInitialization,
|
|
14
|
+
type ZudokuPlugin,
|
|
16
15
|
} from "./plugins.js";
|
|
17
16
|
|
|
18
17
|
export interface ApiIdentity {
|
|
@@ -21,10 +20,7 @@ export interface ApiIdentity {
|
|
|
21
20
|
id: string;
|
|
22
21
|
}
|
|
23
22
|
|
|
24
|
-
export const queryClient = new QueryClient();
|
|
25
|
-
|
|
26
23
|
export type ApiKeyCache = "api-keys";
|
|
27
|
-
export type DevPortalCacheKey = ApiKeyCache | string;
|
|
28
24
|
|
|
29
25
|
type Metadata = Partial<{
|
|
30
26
|
title: string;
|
|
@@ -63,7 +59,7 @@ export type ZudokuContextOptions = {
|
|
|
63
59
|
authentication?: AuthenticationProvider;
|
|
64
60
|
topNavigation?: TopNavigationItem[];
|
|
65
61
|
sidebars?: SidebarConfig;
|
|
66
|
-
plugins?:
|
|
62
|
+
plugins?: ZudokuPlugin[];
|
|
67
63
|
slotlets?: Slotlets;
|
|
68
64
|
mdx?: {
|
|
69
65
|
components?: MdxComponentsType;
|
|
@@ -71,7 +67,7 @@ export type ZudokuContextOptions = {
|
|
|
71
67
|
overrides?: ComponentsContextType;
|
|
72
68
|
};
|
|
73
69
|
|
|
74
|
-
export class
|
|
70
|
+
export class ZudokuContext {
|
|
75
71
|
public plugins: NonNullable<ZudokuContextOptions["plugins"]>;
|
|
76
72
|
public sidebars: SidebarConfig;
|
|
77
73
|
public topNavigation: NonNullable<ZudokuContextOptions["topNavigation"]>;
|
|
@@ -98,10 +94,6 @@ export class DevPortalContext {
|
|
|
98
94
|
);
|
|
99
95
|
};
|
|
100
96
|
|
|
101
|
-
invalidateCache = async (key: DevPortalCacheKey[]) => {
|
|
102
|
-
await queryClient.invalidateQueries({ queryKey: key });
|
|
103
|
-
};
|
|
104
|
-
|
|
105
97
|
getApiIdentities = async () => {
|
|
106
98
|
const keys = await Promise.all(
|
|
107
99
|
this.plugins
|
package/src/lib/core/plugins.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import type { LucideProps } from "lucide-react";
|
|
1
2
|
import { type ReactElement } from "react";
|
|
2
3
|
import { type RouteObject } from "react-router-dom";
|
|
3
4
|
import type { Sidebar } from "../../config/validators/SidebarSchema.js";
|
|
4
5
|
import { MdxComponentsType } from "../util/MdxComponents.js";
|
|
5
|
-
import {
|
|
6
|
+
import { ZudokuContext, type ApiIdentity } from "./ZudokuContext.js";
|
|
6
7
|
|
|
7
|
-
export type
|
|
8
|
+
export type ZudokuPlugin =
|
|
8
9
|
| CommonPlugin
|
|
9
10
|
| ProfileMenuPlugin
|
|
10
11
|
| NavigationPlugin
|
|
@@ -19,7 +20,7 @@ export interface NavigationPlugin {
|
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
export interface ApiIdentityPlugin {
|
|
22
|
-
getIdentities: (context:
|
|
23
|
+
getIdentities: (context: ZudokuContext) => Promise<ApiIdentity[]>;
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
export interface SearchProviderPlugin {
|
|
@@ -30,52 +31,55 @@ export interface SearchProviderPlugin {
|
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
export interface ProfileMenuPlugin {
|
|
33
|
-
getProfileMenuItems: (context:
|
|
34
|
+
getProfileMenuItems: (context: ZudokuContext) => ProfileNavigationItem[];
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
export type ProfileNavigationItem = {
|
|
37
38
|
label: string;
|
|
38
39
|
path?: string;
|
|
40
|
+
weight?: number;
|
|
41
|
+
category?: "top" | "middle" | "bottom";
|
|
39
42
|
children?: ProfileNavigationItem[];
|
|
43
|
+
icon?: React.ComponentType<
|
|
44
|
+
LucideProps & {
|
|
45
|
+
[key: string]: any;
|
|
46
|
+
}
|
|
47
|
+
>;
|
|
40
48
|
};
|
|
41
49
|
|
|
42
50
|
export interface CommonPlugin {
|
|
43
51
|
initialize?: (
|
|
44
|
-
context:
|
|
52
|
+
context: ZudokuContext,
|
|
45
53
|
) => Promise<void | boolean> | void | boolean;
|
|
46
54
|
getHead?: () => ReactElement | undefined;
|
|
47
55
|
getMdxComponents?: () => MdxComponentsType;
|
|
48
56
|
}
|
|
49
57
|
|
|
50
58
|
export const isProfileMenuPlugin = (
|
|
51
|
-
obj:
|
|
59
|
+
obj: ZudokuPlugin,
|
|
52
60
|
): obj is ProfileMenuPlugin =>
|
|
53
61
|
"getProfileMenuItems" in obj && typeof obj.getProfileMenuItems === "function";
|
|
54
62
|
|
|
55
63
|
export const isNavigationPlugin = (
|
|
56
|
-
obj:
|
|
64
|
+
obj: ZudokuPlugin,
|
|
57
65
|
): obj is NavigationPlugin =>
|
|
58
66
|
"getRoutes" in obj && typeof obj.getRoutes === "function";
|
|
59
67
|
|
|
60
68
|
export const isSearchPlugin = (
|
|
61
|
-
obj:
|
|
69
|
+
obj: ZudokuPlugin,
|
|
62
70
|
): obj is SearchProviderPlugin =>
|
|
63
71
|
"renderSearch" in obj && typeof obj.renderSearch === "function";
|
|
64
72
|
|
|
65
|
-
export const needsInitialization = (
|
|
66
|
-
obj: DevPortalPlugin,
|
|
67
|
-
): obj is CommonPlugin =>
|
|
73
|
+
export const needsInitialization = (obj: ZudokuPlugin): obj is CommonPlugin =>
|
|
68
74
|
"initialize" in obj && typeof obj.initialize === "function";
|
|
69
75
|
|
|
70
|
-
export const hasHead = (obj:
|
|
76
|
+
export const hasHead = (obj: ZudokuPlugin): obj is CommonPlugin =>
|
|
71
77
|
"getHead" in obj && typeof obj.getHead === "function";
|
|
72
78
|
|
|
73
|
-
export const isMdxProviderPlugin = (
|
|
74
|
-
obj: DevPortalPlugin,
|
|
75
|
-
): obj is CommonPlugin =>
|
|
79
|
+
export const isMdxProviderPlugin = (obj: ZudokuPlugin): obj is CommonPlugin =>
|
|
76
80
|
"getMdxComponents" in obj && typeof obj.getMdxComponents === "function";
|
|
77
81
|
|
|
78
82
|
export const isApiIdentityPlugin = (
|
|
79
|
-
obj:
|
|
83
|
+
obj: ZudokuPlugin,
|
|
80
84
|
): obj is ApiIdentityPlugin =>
|
|
81
85
|
"getIdentities" in obj && typeof obj.getIdentities === "function";
|
|
@@ -5,6 +5,7 @@ import { ZudokuError } from "../util/invariant.js";
|
|
|
5
5
|
export function ErrorAlert({ error }: { error: unknown }) {
|
|
6
6
|
const message =
|
|
7
7
|
error instanceof Error ? error.message : "Something went wrong";
|
|
8
|
+
|
|
8
9
|
const hint = error instanceof ZudokuError ? error.developerHint : undefined;
|
|
9
10
|
const title =
|
|
10
11
|
error instanceof ZudokuError ? error.title : "Something went wrong";
|
|
@@ -12,7 +13,7 @@ export function ErrorAlert({ error }: { error: unknown }) {
|
|
|
12
13
|
const cause = error instanceof Error ? error.cause : undefined;
|
|
13
14
|
|
|
14
15
|
return (
|
|
15
|
-
<div className="flex h-screen max-h-
|
|
16
|
+
<div className="flex h-screen max-h-[calc(100vh-var(--header-height))] min-h-full items-center justify-center bg-primary-background px-4 py-16 lg:px-8">
|
|
16
17
|
<div className="mx-auto max-w-[85%] sm:max-w-[50%]">
|
|
17
18
|
<h1 className="text-4xl font-bold tracking-tight text-h1-text sm:text-5xl">
|
|
18
19
|
{title}
|
|
@@ -206,7 +206,7 @@ const ExampleItem = builder
|
|
|
206
206
|
name: t.exposeString("name"),
|
|
207
207
|
summary: t.exposeString("summary", { nullable: true }),
|
|
208
208
|
description: t.exposeString("description", { nullable: true }),
|
|
209
|
-
value: t.
|
|
209
|
+
value: t.expose("value", { type: JSONScalar, nullable: true }),
|
|
210
210
|
externalValue: t.exposeString("externalValue", { nullable: true }),
|
|
211
211
|
}),
|
|
212
212
|
});
|
|
@@ -348,10 +348,10 @@ const OperationItem = builder
|
|
|
348
348
|
statusCode,
|
|
349
349
|
description: response.description,
|
|
350
350
|
content: Object.entries(response.content ?? {}).map(
|
|
351
|
-
([mediaType,
|
|
351
|
+
([mediaType, { schema, examples }]) => ({
|
|
352
352
|
mediaType,
|
|
353
|
-
schema
|
|
354
|
-
examples: Object.entries(
|
|
353
|
+
schema,
|
|
354
|
+
examples: Object.entries(examples ?? {}).map(
|
|
355
355
|
([name, value]) => ({ name, ...value }),
|
|
356
356
|
),
|
|
357
357
|
}),
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import { type RecordAny, traverse } from "../../../util/traverse.js";
|
|
2
3
|
import type { OpenAPIDocument } from "../index.js";
|
|
3
4
|
/**
|
|
4
5
|
* Upgrade from OpenAPI 3.0.x to 3.1.0
|
|
@@ -6,30 +7,8 @@ import type { OpenAPIDocument } from "../index.js";
|
|
|
6
7
|
* Taken from https://github.com/scalar/openapi-parser/blob/main/packages/openapi-parser/src/utils/upgradeFromThreeToThreeOne.ts
|
|
7
8
|
* https://www.openapis.org/blog/2021/02/16/migrating-from-openapi-3-0-to-3-1-0
|
|
8
9
|
*/
|
|
9
|
-
export function traverse(
|
|
10
|
-
specification: Record<string, any>,
|
|
11
|
-
transform: (specification: Record<string, any>) => Record<string, any>,
|
|
12
|
-
) {
|
|
13
|
-
const result: Record<string, any> = {};
|
|
14
10
|
|
|
15
|
-
|
|
16
|
-
if (Array.isArray(value)) {
|
|
17
|
-
result[key] = value.map((item) =>
|
|
18
|
-
typeof item === "object" && item !== null
|
|
19
|
-
? traverse(item, transform)
|
|
20
|
-
: item,
|
|
21
|
-
);
|
|
22
|
-
} else if (typeof value === "object" && value !== null) {
|
|
23
|
-
result[key] = traverse(value, transform);
|
|
24
|
-
} else {
|
|
25
|
-
result[key] = value;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return transform(result);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export const upgradeSchema = (schema: Record<string, any>): OpenAPIDocument => {
|
|
11
|
+
export const upgradeSchema = (schema: RecordAny): OpenAPIDocument => {
|
|
33
12
|
if (schema.openapi?.startsWith("3.0")) {
|
|
34
13
|
schema.openapi = "3.1.0";
|
|
35
14
|
}
|
|
@@ -75,7 +54,7 @@ export const upgradeSchema = (schema: Record<string, any>): OpenAPIDocument => {
|
|
|
75
54
|
schema = traverse(schema, (sub) => {
|
|
76
55
|
if (sub.type === "object" && sub.properties !== undefined) {
|
|
77
56
|
for (const [, value] of Object.entries(sub.properties)) {
|
|
78
|
-
const v = (value ?? {}) as
|
|
57
|
+
const v = (value ?? {}) as RecordAny;
|
|
79
58
|
if (v.type === "string" && v.format === "binary") {
|
|
80
59
|
v.contentEncoding = "application/octet-stream";
|
|
81
60
|
delete v.format;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { FileKey2Icon } from "lucide-react";
|
|
1
2
|
import { type RouteObject } from "react-router-dom";
|
|
2
|
-
import {
|
|
3
|
+
import { ZudokuContext } from "../../core/ZudokuContext.js";
|
|
3
4
|
import {
|
|
4
5
|
type ApiIdentityPlugin,
|
|
5
|
-
type
|
|
6
|
+
type ZudokuPlugin,
|
|
6
7
|
ProfileMenuPlugin,
|
|
7
8
|
} from "../../core/plugins.js";
|
|
8
9
|
import { RouterError } from "../../errors/RouterError.js";
|
|
@@ -15,17 +16,17 @@ const DEFAULT_API_KEY_ENDPOINT =
|
|
|
15
16
|
"https://zudoku-rewiringamerica-main-ef9c9c0.d2.zuplo.dev";
|
|
16
17
|
|
|
17
18
|
export type ApiKeyService = {
|
|
18
|
-
getKeys: (context:
|
|
19
|
-
rollKey?: (id: string, context:
|
|
20
|
-
deleteKey?: (id: string, context:
|
|
19
|
+
getKeys: (context: ZudokuContext) => Promise<ApiKey[]>;
|
|
20
|
+
rollKey?: (id: string, context: ZudokuContext) => Promise<void>;
|
|
21
|
+
deleteKey?: (id: string, context: ZudokuContext) => Promise<void>;
|
|
21
22
|
updateKeyDescription?: (
|
|
22
23
|
apiKey: { id: string; description: string },
|
|
23
|
-
context:
|
|
24
|
+
context: ZudokuContext,
|
|
24
25
|
) => Promise<void>;
|
|
25
|
-
getUsage?: (apiKeys: string[], context:
|
|
26
|
+
getUsage?: (apiKeys: string[], context: ZudokuContext) => Promise<void>;
|
|
26
27
|
createKey?: (
|
|
27
28
|
apiKey: { description: string; expiresOn?: string },
|
|
28
|
-
context:
|
|
29
|
+
context: ZudokuContext,
|
|
29
30
|
) => Promise<void>;
|
|
30
31
|
};
|
|
31
32
|
|
|
@@ -93,7 +94,7 @@ const createDefaultHandler = (endpoint: string): ApiKeyService => {
|
|
|
93
94
|
|
|
94
95
|
export const apiKeyPlugin = (
|
|
95
96
|
options: ApiKeyPluginOptions,
|
|
96
|
-
):
|
|
97
|
+
): ZudokuPlugin & ApiIdentityPlugin & ProfileMenuPlugin => {
|
|
97
98
|
const endpoint =
|
|
98
99
|
"endpoint" in options ? options.endpoint : DEFAULT_API_KEY_ENDPOINT;
|
|
99
100
|
|
|
@@ -105,6 +106,8 @@ export const apiKeyPlugin = (
|
|
|
105
106
|
{
|
|
106
107
|
label: "API Keys",
|
|
107
108
|
path: "/settings/api-keys",
|
|
109
|
+
category: "middle",
|
|
110
|
+
icon: FileKey2Icon,
|
|
108
111
|
},
|
|
109
112
|
],
|
|
110
113
|
getIdentities: async (context) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ComponentType, type ReactNode } from "react";
|
|
2
2
|
import type { RouteObject } from "react-router-dom";
|
|
3
3
|
import { type ExposedComponentProps } from "../../components/SlotletProvider.js";
|
|
4
|
-
import type {
|
|
4
|
+
import type { NavigationPlugin, ZudokuPlugin } from "../../core/plugins.js";
|
|
5
5
|
import { CustomPage } from "./CustomPage.js";
|
|
6
6
|
|
|
7
7
|
export type CustomPageConfig = {
|
|
@@ -13,7 +13,7 @@ export type CustomPageConfig = {
|
|
|
13
13
|
|
|
14
14
|
export const customPagesPlugin = (
|
|
15
15
|
config: CustomPageConfig[],
|
|
16
|
-
):
|
|
16
|
+
): ZudokuPlugin & NavigationPlugin => {
|
|
17
17
|
return {
|
|
18
18
|
getRoutes: (): RouteObject[] =>
|
|
19
19
|
config.map(({ path, ...props }) => ({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useMDXComponents } from "@mdx-js/react";
|
|
2
2
|
import slugify from "@sindresorhus/slugify";
|
|
3
3
|
import { Helmet } from "@zudoku/react-helmet-async";
|
|
4
|
-
import { type PropsWithChildren } from "react";
|
|
4
|
+
import { type PropsWithChildren, useEffect } from "react";
|
|
5
5
|
import { Link } from "react-router-dom";
|
|
6
6
|
import { CategoryHeading } from "../../components/CategoryHeading.js";
|
|
7
7
|
import { Heading } from "../../components/Heading.js";
|
|
@@ -15,6 +15,14 @@ import { cn } from "../../util/cn.js";
|
|
|
15
15
|
import { Toc } from "./Toc.js";
|
|
16
16
|
import { MarkdownPluginDefaultOptions, MDXImport } from "./index.js";
|
|
17
17
|
|
|
18
|
+
declare global {
|
|
19
|
+
interface Window {
|
|
20
|
+
__getReactRefreshIgnoredExports?: (args: {
|
|
21
|
+
id: string;
|
|
22
|
+
}) => string[] | undefined;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
18
26
|
const MarkdownHeadings = {
|
|
19
27
|
h2: ({ children, id }) => (
|
|
20
28
|
<Heading level={2} id={id} registerSidebarAnchor>
|
|
@@ -30,11 +38,13 @@ const MarkdownHeadings = {
|
|
|
30
38
|
|
|
31
39
|
export const MdxPage = ({
|
|
32
40
|
mdxComponent: MdxComponent,
|
|
41
|
+
file,
|
|
33
42
|
frontmatter = {},
|
|
34
43
|
defaultOptions,
|
|
35
44
|
tableOfContents,
|
|
36
45
|
}: PropsWithChildren<
|
|
37
46
|
Omit<MDXImport, "default"> & {
|
|
47
|
+
file: string;
|
|
38
48
|
mdxComponent: MDXImport["default"];
|
|
39
49
|
defaultOptions?: MarkdownPluginDefaultOptions;
|
|
40
50
|
}
|
|
@@ -57,6 +67,20 @@ export const MdxPage = ({
|
|
|
57
67
|
|
|
58
68
|
const { prev, next } = usePrevNext();
|
|
59
69
|
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
if (process.env.NODE_ENV === "development") {
|
|
72
|
+
window.__getReactRefreshIgnoredExports = ({ id }) => {
|
|
73
|
+
if (!id.endsWith(file)) return;
|
|
74
|
+
|
|
75
|
+
return ["frontmatter", "tableOfContents"];
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
return () => {
|
|
79
|
+
window.__getReactRefreshIgnoredExports = undefined;
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
}, [file]);
|
|
83
|
+
|
|
60
84
|
return (
|
|
61
85
|
<div className="xl:grid grid-cols-[--sidecar-grid-cols] gap-8 justify-between">
|
|
62
86
|
<Helmet>
|
|
@@ -2,7 +2,7 @@ import type { Toc } from "@stefanprobst/rehype-extract-toc";
|
|
|
2
2
|
import type { MDXProps } from "mdx/types.js";
|
|
3
3
|
import { RouteObject } from "react-router-dom";
|
|
4
4
|
import { ZudokuDocsConfig } from "../../../config/validators/validate.js";
|
|
5
|
-
import type {
|
|
5
|
+
import type { ZudokuPlugin } from "../../core/plugins.js";
|
|
6
6
|
import { DocResolver } from "./resolver.js";
|
|
7
7
|
|
|
8
8
|
export interface MarkdownPluginOptions extends ZudokuDocsConfig {
|
|
@@ -29,7 +29,7 @@ export type MDXImport = {
|
|
|
29
29
|
|
|
30
30
|
export const markdownPlugin = (
|
|
31
31
|
options: MarkdownPluginOptions[],
|
|
32
|
-
):
|
|
32
|
+
): ZudokuPlugin => ({
|
|
33
33
|
getRoutes: () => {
|
|
34
34
|
const routeMap = new Map<string, RouteObject>();
|
|
35
35
|
options.forEach(({ fileImports, files, defaultOptions }) =>
|
|
@@ -57,6 +57,7 @@ export const markdownPlugin = (
|
|
|
57
57
|
return {
|
|
58
58
|
element: (
|
|
59
59
|
<MdxPage
|
|
60
|
+
file={file}
|
|
60
61
|
mdxComponent={Component}
|
|
61
62
|
{...props}
|
|
62
63
|
defaultOptions={defaultOptions}
|