zudoku 0.0.0-monetization-standalone.z2a065bd9 → 0.0.0-money-plugin.z605c614d
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/config/create-plugin.d.ts +2 -2
- package/dist/config/create-plugin.js.map +1 -1
- package/dist/config/validators/InputNavigationSchema.d.ts +103 -53
- package/dist/config/validators/InputNavigationSchema.js +17 -0
- package/dist/config/validators/InputNavigationSchema.js.map +1 -1
- package/dist/config/validators/NavigationSchema.d.ts +10 -2
- package/dist/config/validators/NavigationSchema.js +7 -0
- package/dist/config/validators/NavigationSchema.js.map +1 -1
- package/dist/config/validators/ProtectedRoutesSchema.d.ts +1 -1
- package/dist/config/validators/validate.d.ts +3 -3
- package/dist/flat-config.d.ts +35 -24
- package/dist/lib/components/Heading.d.ts +1 -1
- package/dist/lib/components/MobileTopNavigation.js +2 -1
- package/dist/lib/components/MobileTopNavigation.js.map +1 -1
- package/dist/lib/components/TopNavigation.d.ts +7 -1
- package/dist/lib/components/TopNavigation.js +7 -2
- package/dist/lib/components/TopNavigation.js.map +1 -1
- package/dist/lib/components/context/ZudokuContext.d.ts +8 -1
- package/dist/lib/components/context/ZudokuContext.js +2 -0
- package/dist/lib/components/context/ZudokuContext.js.map +1 -1
- package/dist/lib/components/index.d.ts +18 -76
- package/dist/lib/components/index.js +19 -36
- package/dist/lib/components/index.js.map +1 -1
- package/dist/lib/components/navigation/Navigation.js +4 -3
- package/dist/lib/components/navigation/Navigation.js.map +1 -1
- package/dist/lib/components/navigation/NavigationCategory.js +8 -0
- package/dist/lib/components/navigation/NavigationCategory.js.map +1 -1
- package/dist/lib/components/navigation/NavigationFilterContext.d.ts +8 -0
- package/dist/lib/components/navigation/NavigationFilterContext.js +12 -0
- package/dist/lib/components/navigation/NavigationFilterContext.js.map +1 -0
- package/dist/lib/components/navigation/NavigationFilterInput.d.ts +3 -0
- package/dist/lib/components/navigation/NavigationFilterInput.js +9 -0
- package/dist/lib/components/navigation/NavigationFilterInput.js.map +1 -0
- package/dist/lib/components/navigation/NavigationItem.js +11 -1
- package/dist/lib/components/navigation/NavigationItem.js.map +1 -1
- package/dist/lib/components/navigation/utils.d.ts +2 -1
- package/dist/lib/components/navigation/utils.js +22 -1
- package/dist/lib/components/navigation/utils.js.map +1 -1
- package/dist/lib/hooks/index.d.ts +7 -30
- package/dist/lib/hooks/index.js +7 -15
- package/dist/lib/hooks/index.js.map +1 -1
- package/dist/lib/oas/graphql/circular.d.ts +1 -1
- package/dist/lib/oas/graphql/circular.js +18 -35
- package/dist/lib/oas/graphql/circular.js.map +1 -1
- package/dist/lib/oas/graphql/circular.test.js +33 -2
- package/dist/lib/oas/graphql/circular.test.js.map +1 -1
- package/dist/lib/oas/parser/index.js +14 -5
- package/dist/lib/oas/parser/index.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/fileUtils.d.ts +1 -0
- package/dist/lib/plugins/openapi/playground/fileUtils.js +3 -0
- package/dist/lib/plugins/openapi/playground/fileUtils.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/result-panel/AudioPlayer.d.ts +6 -0
- package/dist/lib/plugins/openapi/playground/result-panel/AudioPlayer.js +20 -0
- package/dist/lib/plugins/openapi/playground/result-panel/AudioPlayer.js.map +1 -0
- package/dist/lib/plugins/openapi/playground/result-panel/ResponseTab.js +7 -2
- package/dist/lib/plugins/openapi/playground/result-panel/ResponseTab.js.map +1 -1
- package/dist/lib/ui/Alert.d.ts +3 -2
- package/dist/lib/ui/Alert.js +9 -5
- package/dist/lib/ui/Alert.js.map +1 -1
- package/dist/lib/ui/Command.d.ts +3 -3
- package/dist/lib/ui/InputGroup.d.ts +16 -0
- package/dist/lib/ui/InputGroup.js +65 -0
- package/dist/lib/ui/InputGroup.js.map +1 -0
- package/dist/lib/util/flattenAllOf.d.ts +0 -2
- package/dist/lib/util/flattenAllOf.js +0 -46
- package/dist/lib/util/flattenAllOf.js.map +1 -1
- package/dist/lib/util/flattenAllOf.test.js +2 -1
- package/dist/lib/util/flattenAllOf.test.js.map +1 -1
- package/dist/lib/util/flattenAllOfProcessor.d.ts +2 -0
- package/dist/lib/util/flattenAllOfProcessor.js +48 -0
- package/dist/lib/util/flattenAllOfProcessor.js.map +1 -0
- package/dist/lib/util/readFrontmatter.js +2 -1
- package/dist/lib/util/readFrontmatter.js.map +1 -1
- package/dist/vite/api/SchemaManager.js +1 -1
- package/dist/vite/api/SchemaManager.js.map +1 -1
- package/dist/vite/api/SchemaManager.test.js +1 -1
- package/dist/vite/api/SchemaManager.test.js.map +1 -1
- package/dist/vite/build.js +91 -73
- package/dist/vite/build.js.map +1 -1
- package/dist/vite/mdx/remark-inject-filepath.js +5 -1
- package/dist/vite/mdx/remark-inject-filepath.js.map +1 -1
- package/dist/vite/mdx/remark-link-rewrite.js +3 -2
- package/dist/vite/mdx/remark-link-rewrite.js.map +1 -1
- package/dist/vite/plugin-docs.js +9 -7
- package/dist/vite/plugin-docs.js.map +1 -1
- package/dist/vite/plugin-markdown-export.js +4 -2
- package/dist/vite/plugin-markdown-export.js.map +1 -1
- package/lib/{ClaudeLogo-K64Qm6gS.js → ClaudeLogo-DP6JOmz1.js} +26 -22
- package/lib/{ClaudeLogo-K64Qm6gS.js.map → ClaudeLogo-DP6JOmz1.js.map} +1 -1
- package/lib/{HydrationBoundary-CNF2ZV3E.js → HydrationBoundary-CJu4vUlG.js} +6 -6
- package/lib/{HydrationBoundary-CNF2ZV3E.js.map → HydrationBoundary-CJu4vUlG.js.map} +1 -1
- package/lib/{MdxPage-Cr99RARi.js → MdxPage-BR_7-0cT.js} +8 -8
- package/lib/{MdxPage-Cr99RARi.js.map → MdxPage-BR_7-0cT.js.map} +1 -1
- package/lib/Mermaid-DAWm9rzb.js +104 -0
- package/lib/Mermaid-DAWm9rzb.js.map +1 -0
- package/lib/{OAuthErrorPage-BRXS5AMu.js → OAuthErrorPage-l0orKh-A.js} +22 -19
- package/lib/{OAuthErrorPage-BRXS5AMu.js.map → OAuthErrorPage-l0orKh-A.js.map} +1 -1
- package/lib/{OasProvider-sP_SqSM7.js → OasProvider-DPW0x8dk.js} +3 -3
- package/lib/{OasProvider-sP_SqSM7.js.map → OasProvider-DPW0x8dk.js.map} +1 -1
- package/lib/{OperationList-DR0APPhk.js → OperationList-Dcm9TZG7.js} +952 -948
- package/lib/OperationList-Dcm9TZG7.js.map +1 -0
- package/lib/{RouteGuard-CZuPjknT.js → RouteGuard-CVs3yvEs.js} +5 -5
- package/lib/{RouteGuard-CZuPjknT.js.map → RouteGuard-CVs3yvEs.js.map} +1 -1
- package/lib/{SchemaList-DgqAAHSI.js → SchemaList-B7RzviG5.js} +8 -8
- package/lib/{SchemaList-DgqAAHSI.js.map → SchemaList-B7RzviG5.js.map} +1 -1
- package/lib/{SchemaView-7IyQYEqk.js → SchemaView-Dt5-T06r.js} +3 -3
- package/lib/{SchemaView-7IyQYEqk.js.map → SchemaView-Dt5-T06r.js.map} +1 -1
- package/lib/{Secret-BE7V0Vb5.js → Secret-DUpgv4V3.js} +4 -4
- package/lib/{Secret-BE7V0Vb5.js.map → Secret-DUpgv4V3.js.map} +1 -1
- package/lib/{SignUp-D3zhMk7q.js → SignUp-CifBTCq4.js} +31 -26
- package/lib/{SignUp-D3zhMk7q.js.map → SignUp-CifBTCq4.js.map} +1 -1
- package/lib/{SyntaxHighlight-paLQ8NP8.js → SyntaxHighlight-BMu0b_hF.js} +3 -3
- package/lib/{SyntaxHighlight-paLQ8NP8.js.map → SyntaxHighlight-BMu0b_hF.js.map} +1 -1
- package/lib/{Toc-GluXkcIk.js → Toc-CeMXYWgp.js} +2 -2
- package/lib/{Toc-GluXkcIk.js.map → Toc-CeMXYWgp.js.map} +1 -1
- package/lib/{index-DYfX9H7i.js → Zudoku-B5YsolG1.js} +2869 -2710
- package/lib/Zudoku-B5YsolG1.js.map +1 -0
- package/lib/ZudokuContext-CYyb_PB_.js +175 -0
- package/lib/ZudokuContext-CYyb_PB_.js.map +1 -0
- package/lib/ZudokuReactContext-DGJAP1sN.js +222 -0
- package/lib/ZudokuReactContext-DGJAP1sN.js.map +1 -0
- package/lib/{circular-Bunzbpsy.js → circular-BV9K7T3F.js} +1327 -1346
- package/lib/{circular-Bunzbpsy.js.map → circular-BV9K7T3F.js.map} +1 -1
- package/lib/createServer-DYUdwZG4.js +13036 -0
- package/lib/createServer-DYUdwZG4.js.map +1 -0
- package/lib/{errors-D2NINcVk.js → errors-C3XsqYso.js} +3 -3
- package/lib/{errors-D2NINcVk.js.map → errors-C3XsqYso.js.map} +1 -1
- package/lib/{firebase-BVAmGV_v.js → firebase-CL9aCRn0.js} +26 -25
- package/lib/firebase-CL9aCRn0.js.map +1 -0
- package/lib/{hook-Da8QTnPd.js → hook-Dz_n9SoE.js} +16 -15
- package/lib/{hook-Da8QTnPd.js.map → hook-Dz_n9SoE.js.map} +1 -1
- package/lib/{index-DTjrb36R.js → index-CFW_9FdI.js} +2 -2
- package/lib/{index-DTjrb36R.js.map → index-CFW_9FdI.js.map} +1 -1
- package/lib/index-DAWHN3cH.js +86 -0
- package/lib/index-DAWHN3cH.js.map +1 -0
- package/lib/{index-BfTLawvZ.js → index-DywuWe2u.js} +589 -551
- package/lib/index-DywuWe2u.js.map +1 -0
- package/lib/{index.esm-B_0dvNjB.js → index.esm-Ca5zvoff.js} +20 -20
- package/lib/{index.esm-B_0dvNjB.js.map → index.esm-Ca5zvoff.js.map} +1 -1
- package/lib/{index.esm-GMDd_9gw.js → index.esm-ld_S_9qs.js} +2 -2
- package/lib/index.esm-ld_S_9qs.js.map +1 -0
- package/lib/{invariant-BJAl77rw.js → invariant-B_t_F2s_.js} +3 -3
- package/lib/{invariant-BJAl77rw.js.map → invariant-B_t_F2s_.js.map} +1 -1
- package/lib/{mutation-BISOc7OM.js → mutation-B7eFBLZY.js} +2 -2
- package/lib/{mutation-BISOc7OM.js.map → mutation-B7eFBLZY.js.map} +1 -1
- package/lib/ui/Alert.js +36 -24
- package/lib/ui/Alert.js.map +1 -1
- package/lib/ui/InputGroup.js +155 -0
- package/lib/ui/InputGroup.js.map +1 -0
- package/lib/ui/SyntaxHighlight.js +3 -3
- package/lib/useExposedProps-CzTDfXfq.js +30 -0
- package/lib/useExposedProps-CzTDfXfq.js.map +1 -0
- package/lib/{useMutation-CFMGlAMW.js → useMutation-CErliDZ9.js} +5 -5
- package/lib/{useMutation-CFMGlAMW.js.map → useMutation-CErliDZ9.js.map} +1 -1
- package/lib/{useSuspenseQuery-CSB_rVek.js → useQuery-ht7aWJ3S.js} +432 -446
- package/lib/useQuery-ht7aWJ3S.js.map +1 -0
- package/lib/useSuspenseQuery-DQH4Bmc2.js +18 -0
- package/lib/useSuspenseQuery-DQH4Bmc2.js.map +1 -0
- package/lib/zudoku.__internal.js +1504 -1041
- package/lib/zudoku.__internal.js.map +1 -1
- package/lib/zudoku.auth-auth0.js +6 -5
- package/lib/zudoku.auth-auth0.js.map +1 -1
- package/lib/zudoku.auth-azureb2c.js +14 -13
- package/lib/zudoku.auth-azureb2c.js.map +1 -1
- package/lib/zudoku.auth-clerk.js +2 -2
- package/lib/zudoku.auth-firebase.js +5 -5
- package/lib/zudoku.auth-openid.js +8 -7
- package/lib/zudoku.auth-openid.js.map +1 -1
- package/lib/zudoku.auth-supabase.js +4 -4
- package/lib/zudoku.components.js +31 -29
- package/lib/zudoku.components.js.map +1 -1
- package/lib/zudoku.hooks.js +24 -11
- package/lib/zudoku.hooks.js.map +1 -1
- package/lib/zudoku.mermaid.js +5 -4
- package/lib/zudoku.mermaid.js.map +1 -1
- package/lib/zudoku.plugin-api-catalog.js +41 -36
- package/lib/zudoku.plugin-api-catalog.js.map +1 -1
- package/lib/zudoku.plugin-api-keys.js +156 -153
- package/lib/zudoku.plugin-api-keys.js.map +1 -1
- package/lib/zudoku.plugin-custom-pages.js +1 -1
- package/lib/zudoku.plugin-markdown.js +1 -1
- package/lib/zudoku.plugin-openapi.js +2 -2
- package/lib/zudoku.plugin-search-pagefind.js +19 -18
- package/lib/zudoku.plugin-search-pagefind.js.map +1 -1
- package/lib/zudoku.react-query.js +26 -25
- package/lib/zudoku.react-query.js.map +1 -1
- package/package.json +5 -4
- package/src/app/defaultTheme.css +4 -0
- package/src/app/main.css +2 -0
- package/src/lib/components/MobileTopNavigation.tsx +13 -8
- package/src/lib/components/TopNavigation.tsx +25 -7
- package/src/lib/components/context/ZudokuContext.ts +1 -0
- package/src/lib/components/index.ts +19 -39
- package/src/lib/components/navigation/Navigation.tsx +4 -3
- package/src/lib/components/navigation/NavigationCategory.tsx +9 -0
- package/src/lib/components/navigation/NavigationFilterContext.tsx +28 -0
- package/src/lib/components/navigation/NavigationFilterInput.tsx +35 -0
- package/src/lib/components/navigation/NavigationItem.tsx +17 -1
- package/src/lib/components/navigation/utils.ts +32 -1
- package/src/lib/hooks/index.ts +7 -16
- package/src/lib/oas/graphql/circular.test.ts +37 -2
- package/src/lib/oas/graphql/circular.ts +25 -51
- package/src/lib/oas/parser/index.ts +17 -6
- package/src/lib/plugins/openapi/playground/fileUtils.ts +4 -0
- package/src/lib/plugins/openapi/playground/result-panel/AudioPlayer.tsx +50 -0
- package/src/lib/plugins/openapi/playground/result-panel/ResponseTab.tsx +33 -17
- package/src/lib/ui/Alert.tsx +17 -5
- package/src/lib/ui/InputGroup.tsx +168 -0
- package/src/lib/util/flattenAllOf.test.ts +2 -1
- package/src/lib/util/flattenAllOf.ts +0 -57
- package/src/lib/util/flattenAllOfProcessor.ts +58 -0
- package/src/lib/util/readFrontmatter.ts +2 -1
- package/src/zuplo/enrich-with-zuplo-mcp.ts +168 -0
- package/src/zuplo/enrich-with-zuplo.ts +254 -0
- package/src/zuplo/policy-types.ts +46 -0
- package/src/zuplo/with-zuplo-processors.ts +35 -0
- package/src/zuplo/with-zuplo.ts +14 -0
- package/lib/Mermaid-DEztDKFw.js +0 -102
- package/lib/Mermaid-DEztDKFw.js.map +0 -1
- package/lib/OperationList-DR0APPhk.js.map +0 -1
- package/lib/Separator-BXt1LYnm.js +0 -27
- package/lib/Separator-BXt1LYnm.js.map +0 -1
- package/lib/ZudokuContext-CnEI8jPU.js +0 -389
- package/lib/ZudokuContext-CnEI8jPU.js.map +0 -1
- package/lib/___vite-browser-external_commonjs-proxy-BttVsNON.js +0 -9
- package/lib/___vite-browser-external_commonjs-proxy-BttVsNON.js.map +0 -1
- package/lib/createServer-Dl4Xwsm4.js +0 -16693
- package/lib/createServer-Dl4Xwsm4.js.map +0 -1
- package/lib/firebase-BVAmGV_v.js.map +0 -1
- package/lib/index-Ba6RP577.js +0 -133
- package/lib/index-Ba6RP577.js.map +0 -1
- package/lib/index-BfTLawvZ.js.map +0 -1
- package/lib/index-DYfX9H7i.js.map +0 -1
- package/lib/index.esm-GMDd_9gw.js.map +0 -1
- package/lib/useSuspenseQuery-CSB_rVek.js.map +0 -1
|
@@ -1,46 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
} from "./
|
|
14
|
-
import { useZudoku as useZudokuImport } from "./context/ZudokuContext.js";
|
|
15
|
-
import { Heading as HeadingImport } from "./Heading.js";
|
|
16
|
-
import { Markdown as MarkdownImport } from "./Markdown.js";
|
|
17
|
-
import { Slot as SlotImport } from "./Slot.js";
|
|
18
|
-
import { Spinner as SpinnerImport } from "./Spinner.js";
|
|
19
|
-
import { Typography as TypographyImport } from "./Typography.js";
|
|
20
|
-
import { Zudoku as ZudokuImport } from "./Zudoku.js";
|
|
1
|
+
export { Helmet as Head } from "@zudoku/react-helmet-async";
|
|
2
|
+
export { Link } from "react-router";
|
|
3
|
+
export { Button } from "../ui/Button.js";
|
|
4
|
+
export { Callout } from "../ui/Callout.js";
|
|
5
|
+
export { ZudokuError } from "../util/invariant.js";
|
|
6
|
+
export { ClientOnly } from "./ClientOnly.js";
|
|
7
|
+
export { Heading } from "./Heading.js";
|
|
8
|
+
export { Markdown } from "./Markdown.js";
|
|
9
|
+
export { Search } from "./Search.js";
|
|
10
|
+
export { Slot } from "./Slot.js";
|
|
11
|
+
export { Spinner } from "./Spinner.js";
|
|
12
|
+
export { Typography } from "./Typography.js";
|
|
13
|
+
export { Zudoku } from "./Zudoku.js";
|
|
21
14
|
|
|
22
|
-
|
|
23
|
-
export const Heading = /*@__PURE__*/ HeadingImport;
|
|
24
|
-
export const Callout = /*@__PURE__*/ CalloutImport;
|
|
25
|
-
export const Markdown = /*@__PURE__*/ MarkdownImport;
|
|
26
|
-
export const Spinner = /*@__PURE__*/ SpinnerImport;
|
|
27
|
-
export const ClientOnly = /*@__PURE__*/ ClientOnlyImport;
|
|
28
|
-
export const Button = /*@__PURE__*/ ButtonImport;
|
|
29
|
-
export const Link = /*@__PURE__*/ LinkImport;
|
|
30
|
-
export const Zudoku = /*@__PURE__*/ ZudokuImport;
|
|
31
|
-
export const Typography = /*@__PURE__*/ TypographyImport;
|
|
32
|
-
export const Slot = /*@__PURE__*/ SlotImport;
|
|
33
|
-
export const ZudokuError = /*@__PURE__*/ ZudokuErrorImport;
|
|
15
|
+
//
|
|
34
16
|
|
|
35
17
|
/** @deprecated Import from `zudoku/hooks` instead */
|
|
36
|
-
export
|
|
18
|
+
export { useMDXComponents } from "@mdx-js/react";
|
|
37
19
|
/** @deprecated Import from `zudoku/hooks` instead */
|
|
38
|
-
export
|
|
20
|
+
export { useTheme } from "next-themes";
|
|
39
21
|
/** @deprecated Import from `zudoku/hooks` instead */
|
|
40
|
-
export
|
|
22
|
+
export { useAuth } from "../authentication/hook.js";
|
|
41
23
|
/** @deprecated Import from `zudoku/hooks` instead */
|
|
42
|
-
export
|
|
24
|
+
export { CACHE_KEYS, useCache } from "./cache.js";
|
|
43
25
|
/** @deprecated Import from `zudoku/hooks` instead */
|
|
44
|
-
export
|
|
45
|
-
/** @deprecated Import from `zudoku/hooks` instead */
|
|
46
|
-
export const useTheme = /*@__PURE__*/ useThemeImport;
|
|
26
|
+
export { useZudoku } from "./context/ZudokuContext.js";
|
|
@@ -2,6 +2,7 @@ import { VisuallyHidden } from "@radix-ui/react-visually-hidden";
|
|
|
2
2
|
import type { NavigationItem as NavigationItemType } from "../../../config/validators/NavigationSchema.js";
|
|
3
3
|
import { DrawerContent, DrawerTitle } from "../../ui/Drawer.js";
|
|
4
4
|
import { Slot } from "../Slot.js";
|
|
5
|
+
import { NavigationFilterProvider } from "./NavigationFilterContext.js";
|
|
5
6
|
import { NavigationItem } from "./NavigationItem.js";
|
|
6
7
|
import { NavigationWrapper } from "./NavigationWrapper.js";
|
|
7
8
|
|
|
@@ -12,7 +13,7 @@ export const Navigation = ({
|
|
|
12
13
|
onRequestClose?: () => void;
|
|
13
14
|
navigation: NavigationItemType[];
|
|
14
15
|
}) => (
|
|
15
|
-
|
|
16
|
+
<NavigationFilterProvider>
|
|
16
17
|
<NavigationWrapper>
|
|
17
18
|
<Slot.Target name="navigation-before" />
|
|
18
19
|
{navigation.map((item) => (
|
|
@@ -30,7 +31,7 @@ export const Navigation = ({
|
|
|
30
31
|
<Slot.Target name="navigation-after" />
|
|
31
32
|
</NavigationWrapper>
|
|
32
33
|
<DrawerContent
|
|
33
|
-
className="lg:hidden h-
|
|
34
|
+
className="lg:hidden h-dvh start-0 w-[320px] rounded-none"
|
|
34
35
|
aria-describedby={undefined}
|
|
35
36
|
>
|
|
36
37
|
<div className="p-4 overflow-y-auto overscroll-none">
|
|
@@ -46,5 +47,5 @@ export const Navigation = ({
|
|
|
46
47
|
))}
|
|
47
48
|
</div>
|
|
48
49
|
</DrawerContent>
|
|
49
|
-
|
|
50
|
+
</NavigationFilterProvider>
|
|
50
51
|
);
|
|
@@ -7,6 +7,7 @@ import { Button } from "zudoku/ui/Button.js";
|
|
|
7
7
|
import type { NavigationCategory as NavigationCategoryType } from "../../../config/validators/NavigationSchema.js";
|
|
8
8
|
import { cn } from "../../util/cn.js";
|
|
9
9
|
import { joinUrl } from "../../util/joinUrl.js";
|
|
10
|
+
import { useNavigationFilter } from "./NavigationFilterContext.js";
|
|
10
11
|
import { NavigationItem } from "./NavigationItem.js";
|
|
11
12
|
import { navigationListItem, useIsCategoryOpen } from "./utils.js";
|
|
12
13
|
|
|
@@ -20,6 +21,7 @@ const NavigationCategoryInner = ({
|
|
|
20
21
|
const isCategoryOpen = useIsCategoryOpen(category);
|
|
21
22
|
const [hasInteracted, setHasInteracted] = useState(false);
|
|
22
23
|
const location = useLocation();
|
|
24
|
+
const { query: filterQuery } = useNavigationFilter();
|
|
23
25
|
|
|
24
26
|
const isCollapsible = category.collapsible ?? true;
|
|
25
27
|
const isCollapsed = category.collapsed ?? true;
|
|
@@ -37,6 +39,13 @@ const NavigationCategoryInner = ({
|
|
|
37
39
|
}
|
|
38
40
|
}, [isCategoryOpen]);
|
|
39
41
|
|
|
42
|
+
// Auto-expand when there's an active filter query
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
if (filterQuery.trim()) {
|
|
45
|
+
setOpen(true);
|
|
46
|
+
}
|
|
47
|
+
}, [filterQuery]);
|
|
48
|
+
|
|
40
49
|
const ToggleButton = isCollapsible && (
|
|
41
50
|
<Button
|
|
42
51
|
onClick={(e) => {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createContext,
|
|
3
|
+
type PropsWithChildren,
|
|
4
|
+
useContext,
|
|
5
|
+
useState,
|
|
6
|
+
} from "react";
|
|
7
|
+
|
|
8
|
+
type NavigationFilterContextType = {
|
|
9
|
+
query: string;
|
|
10
|
+
setQuery: (query: string) => void;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const NavigationFilterContext = createContext<NavigationFilterContextType>({
|
|
14
|
+
query: "",
|
|
15
|
+
setQuery: () => {},
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export const NavigationFilterProvider = ({ children }: PropsWithChildren) => {
|
|
19
|
+
const [query, setQuery] = useState("");
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<NavigationFilterContext.Provider value={{ query, setQuery }}>
|
|
23
|
+
{children}
|
|
24
|
+
</NavigationFilterContext.Provider>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const useNavigationFilter = () => useContext(NavigationFilterContext);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { SearchIcon, XIcon } from "lucide-react";
|
|
2
|
+
import {
|
|
3
|
+
InputGroup,
|
|
4
|
+
InputGroupAddon,
|
|
5
|
+
InputGroupButton,
|
|
6
|
+
InputGroupInput,
|
|
7
|
+
} from "zudoku/ui/InputGroup.js";
|
|
8
|
+
import { useNavigationFilter } from "./NavigationFilterContext.js";
|
|
9
|
+
|
|
10
|
+
export const NavigationFilterInput = ({
|
|
11
|
+
placeholder,
|
|
12
|
+
}: {
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
}) => {
|
|
15
|
+
const { query, setQuery } = useNavigationFilter();
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<InputGroup className="my-2">
|
|
19
|
+
<InputGroupAddon>
|
|
20
|
+
<SearchIcon className="size-3.5" />
|
|
21
|
+
</InputGroupAddon>
|
|
22
|
+
<InputGroupInput
|
|
23
|
+
type="text"
|
|
24
|
+
placeholder={placeholder}
|
|
25
|
+
value={query}
|
|
26
|
+
onChange={(e) => setQuery(e.target.value)}
|
|
27
|
+
/>
|
|
28
|
+
{query && (
|
|
29
|
+
<InputGroupButton onClick={() => setQuery("")}>
|
|
30
|
+
<XIcon className="size-3" />
|
|
31
|
+
</InputGroupButton>
|
|
32
|
+
)}
|
|
33
|
+
</InputGroup>
|
|
34
|
+
);
|
|
35
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ExternalLinkIcon } from "lucide-react";
|
|
2
2
|
import { useEffect, useRef, useState } from "react";
|
|
3
3
|
import { NavLink, useLocation } from "react-router";
|
|
4
|
+
import { Separator } from "zudoku/ui/Separator.js";
|
|
4
5
|
import { Tooltip, TooltipContent, TooltipTrigger } from "zudoku/ui/Tooltip.js";
|
|
5
6
|
import type { NavigationItem as NavigationItemType } from "../../../config/validators/NavigationSchema.js";
|
|
6
7
|
import { useAuth } from "../../authentication/hook.js";
|
|
@@ -11,6 +12,8 @@ import { useViewportAnchor } from "../context/ViewportAnchorContext.js";
|
|
|
11
12
|
import { useZudoku } from "../context/ZudokuContext.js";
|
|
12
13
|
import { NavigationBadge } from "./NavigationBadge.js";
|
|
13
14
|
import { NavigationCategory } from "./NavigationCategory.js";
|
|
15
|
+
import { useNavigationFilter } from "./NavigationFilterContext.js";
|
|
16
|
+
import { NavigationFilterInput } from "./NavigationFilterInput.js";
|
|
14
17
|
import { navigationListItem, shouldShowItem } from "./utils.js";
|
|
15
18
|
|
|
16
19
|
const TruncatedLabel = ({
|
|
@@ -65,8 +68,9 @@ export const NavigationItem = ({
|
|
|
65
68
|
const { activeAnchor } = useViewportAnchor();
|
|
66
69
|
const auth = useAuth();
|
|
67
70
|
const context = useZudoku();
|
|
71
|
+
const { query } = useNavigationFilter();
|
|
68
72
|
|
|
69
|
-
if (!shouldShowItem(auth, context)(item)) {
|
|
73
|
+
if (!shouldShowItem(auth, context, query)(item)) {
|
|
70
74
|
return null;
|
|
71
75
|
}
|
|
72
76
|
|
|
@@ -75,6 +79,18 @@ export const NavigationItem = ({
|
|
|
75
79
|
return (
|
|
76
80
|
<NavigationCategory category={item} onRequestClose={onRequestClose} />
|
|
77
81
|
);
|
|
82
|
+
case "separator":
|
|
83
|
+
return (
|
|
84
|
+
<Separator className="my-1 mx-auto w-[calc(100%-var(--padding-nav-item)*2)]!" />
|
|
85
|
+
);
|
|
86
|
+
case "section":
|
|
87
|
+
return (
|
|
88
|
+
<div className="mt-4 px-(--padding-nav-item) text-xs font-semibold text-muted-foreground uppercase tracking-wider">
|
|
89
|
+
{item.label}
|
|
90
|
+
</div>
|
|
91
|
+
);
|
|
92
|
+
case "filter":
|
|
93
|
+
return <NavigationFilterInput placeholder={item.placeholder} />;
|
|
78
94
|
case "doc":
|
|
79
95
|
return (
|
|
80
96
|
<NavLink
|
|
@@ -86,6 +86,13 @@ export const usePrevNext = (): {
|
|
|
86
86
|
let foundCurrent = false;
|
|
87
87
|
|
|
88
88
|
traverseNavigation(navigation, (item) => {
|
|
89
|
+
if (
|
|
90
|
+
item.type === "separator" ||
|
|
91
|
+
item.type === "section" ||
|
|
92
|
+
item.type === "filter"
|
|
93
|
+
)
|
|
94
|
+
return;
|
|
95
|
+
|
|
89
96
|
const itemId =
|
|
90
97
|
item.type === "doc"
|
|
91
98
|
? joinUrl(item.path)
|
|
@@ -133,9 +140,33 @@ export const navigationListItem = cva(
|
|
|
133
140
|
},
|
|
134
141
|
);
|
|
135
142
|
|
|
143
|
+
export const itemMatchesFilter = (
|
|
144
|
+
item: NavigationItem,
|
|
145
|
+
query: string,
|
|
146
|
+
): boolean => {
|
|
147
|
+
if (["separator", "section", "filter"].includes(item.type)) {
|
|
148
|
+
return true;
|
|
149
|
+
}
|
|
150
|
+
if (item.label?.toLowerCase().includes(query.toLowerCase())) {
|
|
151
|
+
return true;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (item.type === "category") {
|
|
155
|
+
return item.items.some((child) => itemMatchesFilter(child, query));
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
return false;
|
|
159
|
+
};
|
|
160
|
+
|
|
136
161
|
export const shouldShowItem =
|
|
137
|
-
(auth: UseAuthReturn, context: ZudokuContext) =>
|
|
162
|
+
(auth: UseAuthReturn, context: ZudokuContext, filterQuery?: string) =>
|
|
138
163
|
(item: NavigationItem): boolean => {
|
|
164
|
+
if (item.type === "filter") return true;
|
|
165
|
+
|
|
166
|
+
if (filterQuery?.trim() && !itemMatchesFilter(item, filterQuery)) {
|
|
167
|
+
return false;
|
|
168
|
+
}
|
|
169
|
+
|
|
139
170
|
if (typeof item.display === "function") {
|
|
140
171
|
return item.display({ context, auth });
|
|
141
172
|
}
|
package/src/lib/hooks/index.ts
CHANGED
|
@@ -1,16 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export const useEvent = /*@__PURE__*/ useEventImport;
|
|
10
|
-
export const useTheme = /*@__PURE__*/ useThemeImport;
|
|
11
|
-
export const useExposedProps = /*@__PURE__*/ useExposedPropsImport;
|
|
12
|
-
export const useMDXComponents = /*@__PURE__*/ useMDXComponentsImport;
|
|
13
|
-
export const useAuth = /*@__PURE__*/ useAuthImport;
|
|
14
|
-
export const useZudoku = /*@__PURE__*/ useZudokuImport;
|
|
15
|
-
export const useCache = /*@__PURE__*/ useCacheImport;
|
|
16
|
-
export { CACHE_KEYS };
|
|
1
|
+
export { useMDXComponents } from "@mdx-js/react";
|
|
2
|
+
export { useTheme } from "next-themes";
|
|
3
|
+
export { useAuth } from "../authentication/hook.js";
|
|
4
|
+
export { CACHE_KEYS, useCache } from "../components/cache.js";
|
|
5
|
+
export { useZudoku } from "../components/context/ZudokuContext.js";
|
|
6
|
+
export { useExposedProps } from "../util/useExposedProps.js";
|
|
7
|
+
export { useEvent } from "./useEvent.js";
|
|
@@ -156,16 +156,20 @@ describe("handleCircularRefs", () => {
|
|
|
156
156
|
});
|
|
157
157
|
});
|
|
158
158
|
|
|
159
|
-
it("should
|
|
159
|
+
it("should handle shared object instances with __$ref without marking circular", () => {
|
|
160
160
|
const shared = { __$ref: "#/components/schemas/Foo", type: "string" };
|
|
161
161
|
const obj = { a: shared, b: shared };
|
|
162
162
|
const result = handleCircularRefs(obj);
|
|
163
163
|
|
|
164
|
+
// Both should return the cached result, not mark as circular
|
|
164
165
|
expect(result.a).toEqual({
|
|
165
166
|
__$ref: "#/components/schemas/Foo",
|
|
166
167
|
type: "string",
|
|
167
168
|
});
|
|
168
|
-
expect(result.b).
|
|
169
|
+
expect(result.b).toEqual({
|
|
170
|
+
__$ref: "#/components/schemas/Foo",
|
|
171
|
+
type: "string",
|
|
172
|
+
});
|
|
169
173
|
});
|
|
170
174
|
|
|
171
175
|
it("should mark circular ref with property name from path", () => {
|
|
@@ -183,4 +187,35 @@ describe("handleCircularRefs", () => {
|
|
|
183
187
|
|
|
184
188
|
expect(result.properties.child.properties.back).toContain(CIRCULAR_REF);
|
|
185
189
|
});
|
|
190
|
+
|
|
191
|
+
// Exact reproduction of #1869 - shared object instances with __$ref
|
|
192
|
+
it("should NOT mark shared object instances with __$ref as circular (issue #1869)", () => {
|
|
193
|
+
// When dereferencing, the SAME object instance is returned for all refs to the same schema
|
|
194
|
+
const timestampSchema = {
|
|
195
|
+
__$ref: "#/components/schemas/timestamp",
|
|
196
|
+
type: "string",
|
|
197
|
+
format: "date-time",
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
// Both created_at and updated_at point to the SAME object instance
|
|
201
|
+
const obj = {
|
|
202
|
+
type: "object",
|
|
203
|
+
properties: {
|
|
204
|
+
created_at: timestampSchema,
|
|
205
|
+
updated_at: timestampSchema,
|
|
206
|
+
},
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
const result = handleCircularRefs(obj);
|
|
210
|
+
|
|
211
|
+
// The first one should be fully expanded
|
|
212
|
+
expect(result.properties.created_at).toEqual({
|
|
213
|
+
__$ref: "#/components/schemas/timestamp",
|
|
214
|
+
type: "string",
|
|
215
|
+
format: "date-time",
|
|
216
|
+
});
|
|
217
|
+
// The second one should ALSO be fully expanded (not marked as circular)
|
|
218
|
+
expect(typeof result.properties.updated_at).toBe("object");
|
|
219
|
+
expect(result.properties.updated_at).not.toContain(CIRCULAR_REF);
|
|
220
|
+
});
|
|
186
221
|
});
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { GraphQLScalarType } from "graphql/index.js";
|
|
2
2
|
import { GraphQLJSON } from "graphql-type-json";
|
|
3
|
-
import type { RecordAny } from "../../util/traverse.js";
|
|
4
3
|
|
|
5
4
|
export const CIRCULAR_REF = "$[Circular Reference]";
|
|
6
5
|
export const SCHEMA_REF_PREFIX = "$ref:";
|
|
@@ -17,73 +16,48 @@ const OPENAPI_PROPS = new Set([
|
|
|
17
16
|
export const handleCircularRefs = (
|
|
18
17
|
// biome-ignore lint/suspicious/noExplicitAny: Allow any type
|
|
19
18
|
obj: any,
|
|
20
|
-
|
|
19
|
+
currentPath = new WeakSet(),
|
|
21
20
|
refs = new WeakMap(),
|
|
22
21
|
path: string[] = [],
|
|
23
|
-
|
|
22
|
+
currentRefPaths = new Set<string>(),
|
|
24
23
|
// biome-ignore lint/suspicious/noExplicitAny: Allow any type
|
|
25
24
|
): any => {
|
|
26
25
|
if (obj === null || typeof obj !== "object") return obj;
|
|
27
26
|
|
|
28
27
|
const refPath = obj.__$ref;
|
|
28
|
+
const isCircular =
|
|
29
|
+
currentPath.has(obj) ||
|
|
30
|
+
(typeof refPath === "string" && currentRefPaths.has(refPath));
|
|
29
31
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
// instead of the full data to avoid JSON.stringify serializing duplicates
|
|
33
|
-
if (typeof refPath === "string" && seenRefPaths.has(refPath)) {
|
|
34
|
-
return SCHEMA_REF_PREFIX + refPath;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if (visited.has(obj)) {
|
|
38
|
-
const cached = refs.get(obj);
|
|
39
|
-
if (cached) {
|
|
40
|
-
return typeof refPath === "string"
|
|
41
|
-
? // If already processed, return ref marker to avoid duplicate serialization
|
|
42
|
-
SCHEMA_REF_PREFIX + refPath
|
|
43
|
-
: cached;
|
|
44
|
-
}
|
|
32
|
+
if (isCircular) {
|
|
33
|
+
if (typeof refPath === "string") return SCHEMA_REF_PREFIX + refPath;
|
|
45
34
|
const circularProp = path.find((p) => !OPENAPI_PROPS.has(p)) || path[0];
|
|
46
|
-
|
|
47
35
|
return [CIRCULAR_REF, circularProp].filter(Boolean).join(":");
|
|
48
36
|
}
|
|
49
37
|
|
|
50
|
-
|
|
38
|
+
if (refs.has(obj)) return refs.get(obj);
|
|
51
39
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
if (typeof refPath === "string") {
|
|
55
|
-
seenRefPaths.add(refPath);
|
|
56
|
-
}
|
|
40
|
+
currentPath.add(obj);
|
|
41
|
+
if (typeof refPath === "string") currentRefPaths.add(refPath);
|
|
57
42
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
[...path, index.toString()],
|
|
66
|
-
seenRefPaths,
|
|
67
|
-
),
|
|
43
|
+
const recurse = (value: unknown, key: string) =>
|
|
44
|
+
handleCircularRefs(
|
|
45
|
+
value,
|
|
46
|
+
currentPath,
|
|
47
|
+
refs,
|
|
48
|
+
[...path, key],
|
|
49
|
+
currentRefPaths,
|
|
68
50
|
);
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
visited,
|
|
75
|
-
refs,
|
|
76
|
-
[...path, key],
|
|
77
|
-
seenRefPaths,
|
|
51
|
+
|
|
52
|
+
const result = Array.isArray(obj)
|
|
53
|
+
? obj.map((item, i) => recurse(item, i.toString()))
|
|
54
|
+
: Object.fromEntries(
|
|
55
|
+
Object.entries(obj).map(([k, v]) => [k, recurse(v, k)]),
|
|
78
56
|
);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
refs.set(obj, result);
|
|
82
57
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
58
|
+
refs.set(obj, result);
|
|
59
|
+
currentPath.delete(obj);
|
|
60
|
+
if (typeof refPath === "string") currentRefPaths.delete(refPath);
|
|
87
61
|
|
|
88
62
|
return result;
|
|
89
63
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { GraphQLError } from "graphql/error/index.js";
|
|
2
2
|
import { OpenAPIV3, type OpenAPIV3_1 } from "openapi-types";
|
|
3
|
-
import {
|
|
3
|
+
import { flattenAllOf } from "../../util/flattenAllOf.js";
|
|
4
|
+
import { traverse } from "../../util/traverse.js";
|
|
4
5
|
import { dereference, type JSONSchema } from "./dereference/index.js";
|
|
5
6
|
import { upgradeSchema } from "./upgrade/index.js";
|
|
6
7
|
|
|
@@ -104,11 +105,21 @@ export const validate = async (schemaInput: unknown) => {
|
|
|
104
105
|
const dereferenced = await dereference(schema);
|
|
105
106
|
const upgraded = upgradeSchema(dereferenced);
|
|
106
107
|
|
|
107
|
-
const flattened =
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
108
|
+
const flattened = traverse(upgraded, (spec) => {
|
|
109
|
+
if (!spec || typeof spec !== "object" || Array.isArray(spec)) {
|
|
110
|
+
return spec;
|
|
111
|
+
}
|
|
112
|
+
const isSchemaObject =
|
|
113
|
+
"type" in spec ||
|
|
114
|
+
"properties" in spec ||
|
|
115
|
+
"allOf" in spec ||
|
|
116
|
+
"anyOf" in spec ||
|
|
117
|
+
"oneOf" in spec;
|
|
118
|
+
|
|
119
|
+
if (!isSchemaObject) return spec;
|
|
120
|
+
|
|
121
|
+
return flattenAllOf(spec) as typeof spec;
|
|
122
|
+
}) as OpenAPIDocument;
|
|
112
123
|
|
|
113
124
|
return flattened;
|
|
114
125
|
};
|
|
@@ -4,6 +4,10 @@ export function isBinaryContentType(contentType: string) {
|
|
|
4
4
|
);
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
+
export function isAudioContentType(contentType: string) {
|
|
8
|
+
return /^audio\//i.test(contentType);
|
|
9
|
+
}
|
|
10
|
+
|
|
7
11
|
export const extractFileName = (
|
|
8
12
|
headers: Array<[string, string]>,
|
|
9
13
|
url: string,
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { DownloadIcon } from "lucide-react";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import { Button } from "zudoku/ui/Button.js";
|
|
4
|
+
import { humanFileSize } from "../../../../util/humanFileSize.js";
|
|
5
|
+
|
|
6
|
+
export const AudioPlayer = ({
|
|
7
|
+
blob,
|
|
8
|
+
fileName,
|
|
9
|
+
size,
|
|
10
|
+
onDownload,
|
|
11
|
+
}: {
|
|
12
|
+
blob: Blob;
|
|
13
|
+
fileName: string;
|
|
14
|
+
size: number;
|
|
15
|
+
onDownload: () => void;
|
|
16
|
+
}) => {
|
|
17
|
+
const [audioUrl, setAudioUrl] = useState<string | null>(null);
|
|
18
|
+
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
const url = URL.createObjectURL(blob);
|
|
21
|
+
setAudioUrl(url);
|
|
22
|
+
|
|
23
|
+
return () => {
|
|
24
|
+
URL.revokeObjectURL(url);
|
|
25
|
+
};
|
|
26
|
+
}, [blob]);
|
|
27
|
+
|
|
28
|
+
if (!audioUrl) {
|
|
29
|
+
return (
|
|
30
|
+
<div className="p-4 text-center">
|
|
31
|
+
<div className="text-sm text-muted-foreground">Loading audio...</div>
|
|
32
|
+
</div>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<div className="p-4 text-center">
|
|
38
|
+
<div className="flex flex-col items-center gap-4">
|
|
39
|
+
{/* biome-ignore lint/a11y/useMediaCaption: API response audio cannot have predefined captions */}
|
|
40
|
+
<audio controls src={audioUrl} className="w-full max-w-md">
|
|
41
|
+
Your browser does not support the audio element.
|
|
42
|
+
</audio>
|
|
43
|
+
<Button onClick={onDownload} className="flex items-center gap-2">
|
|
44
|
+
<DownloadIcon className="h-4 w-4" />
|
|
45
|
+
Download {fileName} ({humanFileSize(size)})
|
|
46
|
+
</Button>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
);
|
|
50
|
+
};
|
|
@@ -32,6 +32,8 @@ import {
|
|
|
32
32
|
CollapsibleHeader,
|
|
33
33
|
CollapsibleHeaderTrigger,
|
|
34
34
|
} from "../CollapsibleHeader.js";
|
|
35
|
+
import { isAudioContentType } from "../fileUtils.js";
|
|
36
|
+
import { AudioPlayer } from "./AudioPlayer.js";
|
|
35
37
|
import { convertToTypes } from "./convertToTypes.js";
|
|
36
38
|
|
|
37
39
|
const mimeTypeToLanguage = (mimeType: string) => {
|
|
@@ -50,9 +52,14 @@ const mimeTypeToLanguage = (mimeType: string) => {
|
|
|
50
52
|
)?.[1];
|
|
51
53
|
};
|
|
52
54
|
|
|
55
|
+
const getContentType = (headers: Array<[string, string]>) => {
|
|
56
|
+
return (
|
|
57
|
+
headers.find(([key]) => key.toLowerCase() === "content-type")?.[1] || ""
|
|
58
|
+
);
|
|
59
|
+
};
|
|
60
|
+
|
|
53
61
|
const detectLanguage = (headers: Array<[string, string]>) => {
|
|
54
|
-
const contentType =
|
|
55
|
-
headers.find(([key]) => key.toLowerCase() === "content-type")?.[1] || "";
|
|
62
|
+
const contentType = getContentType(headers);
|
|
56
63
|
return mimeTypeToLanguage(contentType);
|
|
57
64
|
};
|
|
58
65
|
|
|
@@ -293,23 +300,32 @@ export const ResponseTab = ({
|
|
|
293
300
|
</div>
|
|
294
301
|
<div className="flex-1">
|
|
295
302
|
{isBinary ? (
|
|
296
|
-
|
|
297
|
-
<
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
303
|
+
blob && isAudioContentType(getContentType(headers)) ? (
|
|
304
|
+
<AudioPlayer
|
|
305
|
+
blob={blob}
|
|
306
|
+
fileName={fileName ?? "audio"}
|
|
307
|
+
size={size}
|
|
308
|
+
onDownload={handleDownload}
|
|
309
|
+
/>
|
|
310
|
+
) : (
|
|
311
|
+
<div className="p-4 text-center">
|
|
312
|
+
<div className="flex flex-col items-center gap-4">
|
|
313
|
+
<div className="text-lg font-semibold">Binary Content</div>
|
|
314
|
+
<div className="text-sm text-muted-foreground">
|
|
315
|
+
This response contains binary data that cannot be displayed as
|
|
316
|
+
text.
|
|
317
|
+
</div>
|
|
318
|
+
<Button
|
|
319
|
+
onClick={handleDownload}
|
|
320
|
+
className="flex items-center gap-2"
|
|
321
|
+
disabled={!blob}
|
|
322
|
+
>
|
|
323
|
+
<DownloadIcon className="h-4 w-4" />
|
|
324
|
+
Download {fileName || "file"} ({humanFileSize(size)})
|
|
325
|
+
</Button>
|
|
302
326
|
</div>
|
|
303
|
-
<Button
|
|
304
|
-
onClick={handleDownload}
|
|
305
|
-
className="flex items-center gap-2"
|
|
306
|
-
disabled={!blob}
|
|
307
|
-
>
|
|
308
|
-
<DownloadIcon className="h-4 w-4" />
|
|
309
|
-
Download {fileName || "file"} ({humanFileSize(size)})
|
|
310
|
-
</Button>
|
|
311
327
|
</div>
|
|
312
|
-
|
|
328
|
+
)
|
|
313
329
|
) : (
|
|
314
330
|
<SyntaxHighlight
|
|
315
331
|
className="text-xs flex-1"
|