zudoku 0.0.0-zacd7778d → 0.0.0-zf08a8f85
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/loader.js +3 -1
- package/dist/config/loader.js.map +1 -1
- package/dist/config/validators/InputNavigationSchema.d.ts +75 -75
- package/dist/config/validators/validate.d.ts +27 -9
- package/dist/config/validators/validate.js +6 -3
- package/dist/config/validators/validate.js.map +1 -1
- package/dist/flat-config.d.ts +26 -25
- package/dist/lib/core/plugins.d.ts +11 -1
- package/dist/lib/core/plugins.js +1 -0
- package/dist/lib/core/plugins.js.map +1 -1
- package/dist/lib/core/transform-config.d.ts +2 -0
- package/dist/lib/core/transform-config.js +22 -0
- package/dist/lib/core/transform-config.js.map +1 -0
- package/dist/lib/plugins/openapi/OasProvider.js +6 -2
- package/dist/lib/plugins/openapi/OasProvider.js.map +1 -1
- package/dist/lib/plugins/openapi/OperationList.js +4 -8
- package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
- package/dist/lib/plugins/openapi/interfaces.d.ts +3 -0
- package/dist/lib/plugins/openapi/util/getRoutes.d.ts +3 -0
- package/dist/lib/plugins/openapi/util/getRoutes.js +2 -1
- package/dist/lib/plugins/openapi/util/getRoutes.js.map +1 -1
- package/dist/lib/ui/Command.d.ts +3 -3
- package/dist/vite/api/SchemaManager.d.ts +11 -1
- package/dist/vite/api/SchemaManager.js +28 -17
- package/dist/vite/api/SchemaManager.js.map +1 -1
- package/dist/vite/api/SchemaManager.test.js +44 -0
- package/dist/vite/api/SchemaManager.test.js.map +1 -1
- package/dist/vite/error-handler.js +1 -5
- package/dist/vite/error-handler.js.map +1 -1
- package/dist/vite/plugin-api.js +5 -3
- package/dist/vite/plugin-api.js.map +1 -1
- package/lib/{ClaudeLogo-DHxJUhN_.js → ClaudeLogo-DJ9bU-sO.js} +2 -2
- package/lib/{ClaudeLogo-DHxJUhN_.js.map → ClaudeLogo-DJ9bU-sO.js.map} +1 -1
- package/lib/{MdxPage-CD36PJ17.js → MdxPage-stpAoBtx.js} +5 -5
- package/lib/{MdxPage-CD36PJ17.js.map → MdxPage-stpAoBtx.js.map} +1 -1
- package/lib/{OAuthErrorPage-4mN5DA86.js → OAuthErrorPage-DJ811Bn_.js} +3 -3
- package/lib/{OAuthErrorPage-4mN5DA86.js.map → OAuthErrorPage-DJ811Bn_.js.map} +1 -1
- package/lib/OasProvider-CS_ASmBB.js +48 -0
- package/lib/OasProvider-CS_ASmBB.js.map +1 -0
- package/lib/{OperationList-CaknPbvq.js → OperationList-Dq_AB4W9.js} +818 -821
- package/lib/{OperationList-CaknPbvq.js.map → OperationList-Dq_AB4W9.js.map} +1 -1
- package/lib/{SchemaList-Dw3-CJPb.js → SchemaList-BJZJv1gD.js} +6 -6
- package/lib/{SchemaList-Dw3-CJPb.js.map → SchemaList-BJZJv1gD.js.map} +1 -1
- package/lib/{SchemaView-DyJkiQkD.js → SchemaView-U4JMYB3N.js} +3 -3
- package/lib/{SchemaView-DyJkiQkD.js.map → SchemaView-U4JMYB3N.js.map} +1 -1
- package/lib/{SignUp-DRvN-8cq.js → SignUp-DCBViNUi.js} +2 -2
- package/lib/{SignUp-DRvN-8cq.js.map → SignUp-DCBViNUi.js.map} +1 -1
- package/lib/{SyntaxHighlight-klTH8c6-.js → SyntaxHighlight-Dshjn3Zf.js} +4 -3
- package/lib/SyntaxHighlight-Dshjn3Zf.js.map +1 -0
- package/lib/{Toc-PbuF-u9x.js → Toc-Cgz6CPiE.js} +2 -2
- package/lib/{Toc-PbuF-u9x.js.map → Toc-Cgz6CPiE.js.map} +1 -1
- package/lib/{circular-DFquXeY2.js → circular-BmMJjG1v.js} +2 -2
- package/lib/{circular-DFquXeY2.js.map → circular-BmMJjG1v.js.map} +1 -1
- package/lib/{createServer-BXZ0CAUn.js → createServer-CLSZ7hWJ.js} +4 -4
- package/lib/{createServer-BXZ0CAUn.js.map → createServer-CLSZ7hWJ.js.map} +1 -1
- package/lib/{errors-rWHkzVTd.js → errors-b9I-fAOY.js} +2 -2
- package/lib/{errors-rWHkzVTd.js.map → errors-b9I-fAOY.js.map} +1 -1
- package/lib/{firebase-BmGU1FuD.js → firebase-BCXX7Qv5.js} +10 -10
- package/lib/{firebase-BmGU1FuD.js.map → firebase-BCXX7Qv5.js.map} +1 -1
- package/lib/{index-BDsEwofZ.js → index-CL8eDnQW.js} +2 -2
- package/lib/{index-BDsEwofZ.js.map → index-CL8eDnQW.js.map} +1 -1
- package/lib/{index-BQB9hb6n.js → index-O9RHI87z.js} +53 -50
- package/lib/{index-BQB9hb6n.js.map → index-O9RHI87z.js.map} +1 -1
- package/lib/{index-DRBOFufT.js → index-UOLtazB8.js} +2 -2
- package/lib/{index-DRBOFufT.js.map → index-UOLtazB8.js.map} +1 -1
- package/lib/{index.esm-Cx8B1YJQ.js → index.esm-C5CBsVzN.js} +2 -2
- package/lib/index.esm-C5CBsVzN.js.map +1 -0
- package/lib/ui/SyntaxHighlight.js +1 -1
- package/lib/zudoku.__internal.js +1 -1
- package/lib/zudoku.auth-azureb2c.js +3 -3
- package/lib/zudoku.auth-clerk.js +1 -1
- package/lib/zudoku.auth-firebase.js +3 -3
- package/lib/zudoku.auth-openid.js +3 -3
- package/lib/zudoku.auth-supabase.js +3 -3
- package/lib/zudoku.components.js +1 -1
- package/lib/zudoku.plugin-api-catalog.js +2 -2
- package/lib/zudoku.plugin-api-keys.js +1 -1
- package/lib/zudoku.plugin-markdown.js +1 -1
- package/lib/zudoku.plugin-openapi.js +1 -1
- package/lib/zudoku.plugins.js +9 -8
- package/lib/zudoku.plugins.js.map +1 -1
- package/package.json +8 -7
- package/src/lib/core/plugins.ts +21 -1
- package/src/lib/core/transform-config.ts +29 -0
- package/src/lib/plugins/openapi/OasProvider.tsx +10 -2
- package/src/lib/plugins/openapi/OperationList.tsx +4 -9
- package/src/lib/plugins/openapi/interfaces.ts +6 -1
- package/src/lib/plugins/openapi/util/getRoutes.tsx +4 -1
- package/src/shiki/langs/c3.js +1 -0
- package/src/shiki/langs/gn.js +1 -0
- package/src/shiki/langs/moonbit.js +1 -0
- package/lib/OasProvider-DSe-hk5Y.js +0 -40
- package/lib/OasProvider-DSe-hk5Y.js.map +0 -1
- package/lib/SyntaxHighlight-klTH8c6-.js.map +0 -1
- package/lib/index.esm-Cx8B1YJQ.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as a, a as r, E as t, b as i, F as o, G as n, c as d, O as h, d as u, T as l, e as A, f as P, g as c, h as g, i as m, j as E, k as p, l as v, m as w, n as b, o as C, p as I, q as R, r as f, s as k, t as O, u as T, v as W, w as x, x as G } from "./firebase-
|
|
1
|
+
import { A as a, a as r, E as t, b as i, F as o, G as n, c as d, O as h, d as u, T as l, e as A, f as P, g as c, h as g, i as m, j as E, k as p, l as v, m as w, n as b, o as C, p as I, q as R, r as f, s as k, t as O, u as T, v as W, w as x, x as G } from "./firebase-BCXX7Qv5.js";
|
|
2
2
|
export {
|
|
3
3
|
a as ActionCodeURL,
|
|
4
4
|
r as AuthCredential,
|
|
@@ -31,4 +31,4 @@ export {
|
|
|
31
31
|
x as signInWithPopup,
|
|
32
32
|
G as signOut
|
|
33
33
|
};
|
|
34
|
-
//# sourceMappingURL=index.esm-
|
|
34
|
+
//# sourceMappingURL=index.esm-C5CBsVzN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.esm-C5CBsVzN.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "../jsx-runtime-BzflLqGi.js";
|
|
2
2
|
import "react";
|
|
3
3
|
import "../ZudokuContext-BZB1TWdT.js";
|
|
4
|
-
import { S as h } from "../SyntaxHighlight-
|
|
4
|
+
import { S as h } from "../SyntaxHighlight-Dshjn3Zf.js";
|
|
5
5
|
import "../invariant-BJAl77rw.js";
|
|
6
6
|
import "./CodeBlock.js";
|
|
7
7
|
import "./EmbeddedCodeBlock.js";
|
package/lib/zudoku.__internal.js
CHANGED
|
@@ -6,7 +6,7 @@ import * as F from "react";
|
|
|
6
6
|
import { StrictMode as Ne, useEffect as K, useRef as De, useState as vt, Suspense as wt } from "react";
|
|
7
7
|
import { n as zt, S as bt, a as Re, b3 as yt, O as kt, d as xt, L as Zt, h as $t, w as jt } from "./chunk-EPOLDU6W-C6C8jAwd.js";
|
|
8
8
|
import * as Et from "react-dom";
|
|
9
|
-
import { f as Pt, a as Tt, d as P, A as It, s as At, P as Ot, N as pe, g as St, h as Nt, i as Dt, T as Ce, H as Ue, D as Rt, j as Fe } from "./index-
|
|
9
|
+
import { f as Pt, a as Tt, d as P, A as It, s as At, P as Ot, N as pe, g as St, h as Nt, i as Dt, T as Ce, H as Ue, D as Rt, j as Fe } from "./index-CL8eDnQW.js";
|
|
10
10
|
import { B as Le, R as Ct } from "./RouteGuard--A04ESy8.js";
|
|
11
11
|
import { CircleFadingArrowUpIcon as Ut, LoaderCircleIcon as Ft, ExternalLink as Lt, PanelLeftIcon as Bt, UnlinkIcon as Mt } from "lucide-react";
|
|
12
12
|
import { Button as Wt } from "./ui/Button.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { j as n } from "./jsx-runtime-BzflLqGi.js";
|
|
2
2
|
import { PublicClientApplication as A, EventType as f } from "@azure/msal-browser";
|
|
3
|
-
import { E as I } from "./index-
|
|
3
|
+
import { E as I } from "./index-CL8eDnQW.js";
|
|
4
4
|
import { C as T } from "./ClientOnly-E7hGysn1.js";
|
|
5
5
|
import { j as S, u as h } from "./ZudokuContext-BZB1TWdT.js";
|
|
6
|
-
import { C, A as c } from "./errors-
|
|
7
|
-
import { C as k, O as w } from "./OAuthErrorPage-
|
|
6
|
+
import { C, A as c } from "./errors-b9I-fAOY.js";
|
|
7
|
+
import { C as k, O as w } from "./OAuthErrorPage-DJ811Bn_.js";
|
|
8
8
|
const u = "/oauth/callback";
|
|
9
9
|
class y extends C {
|
|
10
10
|
msalInstance;
|
package/lib/zudoku.auth-clerk.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { j as a } from "./jsx-runtime-BzflLqGi.js";
|
|
2
2
|
import { LogOutIcon as m } from "lucide-react";
|
|
3
|
-
import { S as p, a as f, b as h } from "./SignUp-
|
|
3
|
+
import { S as p, a as f, b as h } from "./SignUp-DCBViNUi.js";
|
|
4
4
|
import { u as r } from "./ZudokuContext-BZB1TWdT.js";
|
|
5
5
|
const R = ({
|
|
6
6
|
clerkPubKey: u,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "./jsx-runtime-BzflLqGi.js";
|
|
2
|
-
import { y as e } from "./firebase-
|
|
2
|
+
import { y as e } from "./firebase-BCXX7Qv5.js";
|
|
3
3
|
import "./invariant-BJAl77rw.js";
|
|
4
|
-
import "./errors-
|
|
5
|
-
import "./SignUp-
|
|
4
|
+
import "./errors-b9I-fAOY.js";
|
|
5
|
+
import "./SignUp-DCBViNUi.js";
|
|
6
6
|
import "./ZudokuContext-BZB1TWdT.js";
|
|
7
7
|
export {
|
|
8
8
|
e as default
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { j as D } from "./jsx-runtime-BzflLqGi.js";
|
|
2
2
|
import { a as Le } from "./invariant-BJAl77rw.js";
|
|
3
|
-
import { E as Ue } from "./index-
|
|
3
|
+
import { E as Ue } from "./index-CL8eDnQW.js";
|
|
4
4
|
import { C as xe } from "./ClientOnly-E7hGysn1.js";
|
|
5
5
|
import { j as Ce, u as S } from "./ZudokuContext-BZB1TWdT.js";
|
|
6
|
-
import { C as Ie, O as re, A as R } from "./errors-
|
|
7
|
-
import { C as je, O as Oe } from "./OAuthErrorPage-
|
|
6
|
+
import { C as Ie, O as re, A as R } from "./errors-b9I-fAOY.js";
|
|
7
|
+
import { C as je, O as Oe } from "./OAuthErrorPage-DJ811Bn_.js";
|
|
8
8
|
var J = { exports: {} }, De = J.exports, oe;
|
|
9
9
|
function Je() {
|
|
10
10
|
return oe || (oe = 1, (function(t) {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { j as a } from "./jsx-runtime-BzflLqGi.js";
|
|
2
2
|
import { createClient as g } from "@supabase/supabase-js";
|
|
3
|
-
import { C as m, A as h } from "./errors-
|
|
4
|
-
import { S as f } from "./SignUp-
|
|
3
|
+
import { C as m, A as h } from "./errors-b9I-fAOY.js";
|
|
4
|
+
import { S as f } from "./SignUp-DCBViNUi.js";
|
|
5
5
|
import { u } from "./ZudokuContext-BZB1TWdT.js";
|
|
6
6
|
import { Auth as v } from "@supabase/auth-ui-react";
|
|
7
7
|
import { ThemeSupa as S } from "@supabase/auth-ui-shared";
|
|
8
8
|
import { b as T } from "./chunk-EPOLDU6W-C6C8jAwd.js";
|
|
9
|
-
import { H as A } from "./index-
|
|
9
|
+
import { H as A } from "./index-CL8eDnQW.js";
|
|
10
10
|
const c = ({
|
|
11
11
|
client: i,
|
|
12
12
|
config: e,
|
package/lib/zudoku.components.js
CHANGED
|
@@ -7,7 +7,7 @@ import "./ui/Callout.js";
|
|
|
7
7
|
import "./invariant-BJAl77rw.js";
|
|
8
8
|
import "./ClientOnly-E7hGysn1.js";
|
|
9
9
|
import "./ZudokuContext-BZB1TWdT.js";
|
|
10
|
-
import { B as d, F as k, C as l, r as h, p as y, q as S, L as Z, o as E, v as H, S as g, t as w, Z as x, w as A, y as B, z as L, x as M, G as T, a as c } from "./index-
|
|
10
|
+
import { B as d, F as k, C as l, r as h, p as y, q as S, L as Z, o as E, v as H, S as g, t as w, Z as x, w as A, y as B, z as L, x as M, G as T, a as c } from "./index-CL8eDnQW.js";
|
|
11
11
|
import "./Spinner-CI6bRyZw.js";
|
|
12
12
|
export {
|
|
13
13
|
d as Button,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { j as t } from "./jsx-runtime-BzflLqGi.js";
|
|
2
|
-
import { s as f } from "./index-
|
|
2
|
+
import { s as f } from "./index-UOLtazB8.js";
|
|
3
3
|
import { c as b, m as j } from "./chunk-EPOLDU6W-C6C8jAwd.js";
|
|
4
4
|
import { u as x, j as d } from "./ZudokuContext-BZB1TWdT.js";
|
|
5
5
|
import { u as v } from "./useSuspenseQuery-CSB_rVek.js";
|
|
6
6
|
import { H as y } from "./index.esm-B_0dvNjB.js";
|
|
7
|
-
import { H as N, L as k, M as S } from "./index-
|
|
7
|
+
import { H as N, L as k, M as S } from "./index-CL8eDnQW.js";
|
|
8
8
|
const w = ({
|
|
9
9
|
items: o,
|
|
10
10
|
filterCatalogItems: r = (i) => i,
|
|
@@ -3,7 +3,7 @@ import { TrashIcon as me, CircleSlashIcon as z, CheckIcon as xe, XIcon as ye, Pe
|
|
|
3
3
|
import { Z as M, i as E } from "./invariant-BJAl77rw.js";
|
|
4
4
|
import * as F from "react";
|
|
5
5
|
import { createContext as Q, useRef as A, useLayoutEffect as Ce, useEffect as ie, useId as H, useContext as V, useInsertionEffect as we, useMemo as L, useCallback as ke, Children as Ee, isValidElement as Ie, useState as I } from "react";
|
|
6
|
-
import { D as be, c as Ke, d as ee, B as De, E as Pe } from "./index-
|
|
6
|
+
import { D as be, c as Ke, d as ee, B as De, E as Pe } from "./index-CL8eDnQW.js";
|
|
7
7
|
import { b as re } from "./index-DBjOT2H1.js";
|
|
8
8
|
import { F as Ae, g as Se, j as Re, h as Ne, d as Oe, I as Te, a as qe, b as Me, k as Fe, c as $e } from "./Frame-DKlOmSkU.js";
|
|
9
9
|
import { A as D, a as P, b as ae } from "./Mermaid-Koc3z8mU.js";
|
|
@@ -4,7 +4,7 @@ const p = (t) => ({
|
|
|
4
4
|
([e, a]) => ({
|
|
5
5
|
path: e,
|
|
6
6
|
lazy: async () => {
|
|
7
|
-
const { MdxPage: n } = await import("./MdxPage-
|
|
7
|
+
const { MdxPage: n } = await import("./MdxPage-stpAoBtx.js"), { default: o, ...s } = await a();
|
|
8
8
|
return {
|
|
9
9
|
element: /* @__PURE__ */ r.jsx(
|
|
10
10
|
n,
|
|
@@ -3,7 +3,7 @@ import "lucide-react";
|
|
|
3
3
|
import "./chunk-EPOLDU6W-C6C8jAwd.js";
|
|
4
4
|
import "./ui/Button.js";
|
|
5
5
|
import "./ZudokuContext-BZB1TWdT.js";
|
|
6
|
-
import { y as e, U as n, z as s } from "./index-
|
|
6
|
+
import { y as e, U as n, z as s } from "./index-O9RHI87z.js";
|
|
7
7
|
export {
|
|
8
8
|
e as GetNavigationOperationsQuery,
|
|
9
9
|
n as UNTAGGED_PATH,
|
package/lib/zudoku.plugins.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
const
|
|
1
|
+
const t = (n) => n, i = (n) => n, e = (n) => "events" in n && typeof n.events == "object", o = (n) => "getProfileMenuItems" in n && typeof n.getProfileMenuItems == "function", s = (n) => "getRoutes" in n && typeof n.getRoutes == "function", f = (n) => "signUp" in n && typeof n.signUp == "function", c = (n) => "renderSearch" in n && typeof n.renderSearch == "function", u = (n) => "initialize" in n && typeof n.initialize == "function", g = (n) => "getHead" in n && typeof n.getHead == "function", r = (n) => "getMdxComponents" in n && typeof n.getMdxComponents == "function", a = (n) => "getIdentities" in n && typeof n.getIdentities == "function", l = (n) => "transformConfig" in n && typeof n.transformConfig == "function";
|
|
2
2
|
export {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
t as createApiIdentityPlugin,
|
|
4
|
+
i as createProfileMenuPlugin,
|
|
5
|
+
g as hasHead,
|
|
6
6
|
a as isApiIdentityPlugin,
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
f as isAuthenticationPlugin,
|
|
8
|
+
e as isEventConsumerPlugin,
|
|
9
9
|
r as isMdxProviderPlugin,
|
|
10
10
|
s as isNavigationPlugin,
|
|
11
11
|
o as isProfileMenuPlugin,
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
c as isSearchPlugin,
|
|
13
|
+
l as isTransformConfigPlugin,
|
|
14
|
+
u as needsInitialization
|
|
14
15
|
};
|
|
15
16
|
//# sourceMappingURL=zudoku.plugins.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zudoku.plugins.js","sources":["../src/lib/core/plugins.ts"],"sourcesContent":["import type { LucideIcon } from \"lucide-react\";\nimport type { ReactNode } from \"react\";\nimport type { Location, RouteObject } from \"react-router\";\nimport type { Navigation } from \"../../config/validators/NavigationSchema.js\";\nimport type { ProtectedRoutesInput } from \"../../config/validators/ProtectedRoutesSchema.js\";\nimport type { AuthenticationPlugin } from \"../authentication/authentication.js\";\nimport type { MdxComponentsType } from \"../util/MdxComponents.js\";\nimport type {\n ApiIdentity,\n ZudokuContext,\n ZudokuEvents,\n} from \"./ZudokuContext.js\";\n\nexport type ZudokuPlugin =\n | CommonPlugin\n | ProfileMenuPlugin\n | NavigationPlugin\n | ApiIdentityPlugin\n | SearchProviderPlugin\n | EventConsumerPlugin\n | AuthenticationPlugin;\n\nexport type { AuthenticationPlugin, RouteObject };\n\nexport interface NavigationPlugin {\n getRoutes: () => RouteObject[];\n getNavigation?: (path: string, context: ZudokuContext) => Promise<Navigation>;\n getProtectedRoutes?: () => ProtectedRoutesInput;\n}\n\nexport const createApiIdentityPlugin = (\n plugin: ApiIdentityPlugin,\n): ApiIdentityPlugin => plugin;\n\nexport const createProfileMenuPlugin = (\n plugin: ProfileMenuPlugin,\n): ProfileMenuPlugin => plugin;\n\nexport interface ApiIdentityPlugin {\n getIdentities: (context: ZudokuContext) => Promise<ApiIdentity[]>;\n}\n\nexport interface SearchProviderPlugin {\n renderSearch: (o: {\n isOpen: boolean;\n onClose: () => void;\n }) => React.JSX.Element | null;\n}\n\nexport interface ProfileMenuPlugin {\n getProfileMenuItems: (context: ZudokuContext) => ProfileNavigationItem[];\n}\n\nexport type ProfileNavigationItem = {\n label: string;\n path?: string;\n weight?: number;\n category?: \"top\" | \"middle\" | \"bottom\";\n children?: ProfileNavigationItem[];\n icon?: LucideIcon;\n};\n\nexport interface CommonPlugin {\n initialize?: (\n context: ZudokuContext,\n ) => Promise<void | boolean> | void | boolean;\n getHead?: (args: { location: Location }) => ReactNode | undefined;\n getMdxComponents?: () => MdxComponentsType;\n}\n\nexport type EventConsumerPlugin<Event extends ZudokuEvents = ZudokuEvents> = {\n events: { [K in keyof Event]?: Event[K] };\n};\n\nexport const isEventConsumerPlugin = (\n obj: ZudokuPlugin,\n): obj is EventConsumerPlugin =>\n \"events\" in obj && typeof obj.events === \"object\";\n\nexport const isProfileMenuPlugin = (\n obj: ZudokuPlugin,\n): obj is ProfileMenuPlugin =>\n \"getProfileMenuItems\" in obj && typeof obj.getProfileMenuItems === \"function\";\n\nexport const isNavigationPlugin = (\n obj: ZudokuPlugin,\n): obj is NavigationPlugin =>\n \"getRoutes\" in obj && typeof obj.getRoutes === \"function\";\n\nexport const isAuthenticationPlugin = (\n obj: ZudokuPlugin,\n): obj is AuthenticationPlugin =>\n \"signUp\" in obj && typeof obj.signUp === \"function\";\n\nexport const isSearchPlugin = (\n obj: ZudokuPlugin,\n): obj is SearchProviderPlugin =>\n \"renderSearch\" in obj && typeof obj.renderSearch === \"function\";\n\nexport const needsInitialization = (obj: ZudokuPlugin): obj is CommonPlugin =>\n \"initialize\" in obj && typeof obj.initialize === \"function\";\n\nexport const hasHead = (obj: ZudokuPlugin): obj is CommonPlugin =>\n \"getHead\" in obj && typeof obj.getHead === \"function\";\n\nexport const isMdxProviderPlugin = (obj: ZudokuPlugin): obj is CommonPlugin =>\n \"getMdxComponents\" in obj && typeof obj.getMdxComponents === \"function\";\n\nexport const isApiIdentityPlugin = (\n obj: ZudokuPlugin,\n): obj is ApiIdentityPlugin =>\n \"getIdentities\" in obj && typeof obj.getIdentities === \"function\";\n"],"names":["createApiIdentityPlugin","plugin","createProfileMenuPlugin","isEventConsumerPlugin","obj","isProfileMenuPlugin","isNavigationPlugin","isAuthenticationPlugin","isSearchPlugin","needsInitialization","hasHead","isMdxProviderPlugin","isApiIdentityPlugin"],"mappings":"
|
|
1
|
+
{"version":3,"file":"zudoku.plugins.js","sources":["../src/lib/core/plugins.ts"],"sourcesContent":["import type { LucideIcon } from \"lucide-react\";\nimport type { ReactNode } from \"react\";\nimport type { Location, RouteObject } from \"react-router\";\nimport type { Navigation } from \"../../config/validators/NavigationSchema.js\";\nimport type { ProtectedRoutesInput } from \"../../config/validators/ProtectedRoutesSchema.js\";\nimport type { ZudokuConfig } from \"../../config/validators/validate.js\";\nimport type { AuthenticationPlugin } from \"../authentication/authentication.js\";\nimport type { MdxComponentsType } from \"../util/MdxComponents.js\";\nimport type {\n ApiIdentity,\n ZudokuContext,\n ZudokuEvents,\n} from \"./ZudokuContext.js\";\n\nexport type ZudokuPlugin =\n | CommonPlugin\n | ProfileMenuPlugin\n | NavigationPlugin\n | ApiIdentityPlugin\n | SearchProviderPlugin\n | EventConsumerPlugin\n | AuthenticationPlugin\n | TransformConfigPlugin;\n\nexport type { AuthenticationPlugin, RouteObject };\n\nexport interface NavigationPlugin {\n getRoutes: () => RouteObject[];\n getNavigation?: (path: string, context: ZudokuContext) => Promise<Navigation>;\n getProtectedRoutes?: () => ProtectedRoutesInput;\n}\n\nexport const createApiIdentityPlugin = (\n plugin: ApiIdentityPlugin,\n): ApiIdentityPlugin => plugin;\n\nexport const createProfileMenuPlugin = (\n plugin: ProfileMenuPlugin,\n): ProfileMenuPlugin => plugin;\n\nexport interface ApiIdentityPlugin {\n getIdentities: (context: ZudokuContext) => Promise<ApiIdentity[]>;\n}\n\nexport interface SearchProviderPlugin {\n renderSearch: (o: {\n isOpen: boolean;\n onClose: () => void;\n }) => React.JSX.Element | null;\n}\n\nexport interface ProfileMenuPlugin {\n getProfileMenuItems: (context: ZudokuContext) => ProfileNavigationItem[];\n}\n\nexport type ProfileNavigationItem = {\n label: string;\n path?: string;\n weight?: number;\n category?: \"top\" | \"middle\" | \"bottom\";\n children?: ProfileNavigationItem[];\n icon?: LucideIcon;\n};\n\nexport interface ConfigHookContext {\n mode: typeof process.env.ZUDOKU_ENV;\n rootDir: string;\n configPath: string;\n}\n\nexport interface TransformConfigPlugin {\n transformConfig?: (\n config: ZudokuConfig,\n ctx: ConfigHookContext,\n ) => Partial<ZudokuConfig> | void | Promise<Partial<ZudokuConfig> | void>;\n}\n\nexport interface CommonPlugin {\n initialize?: (\n context: ZudokuContext,\n ) => Promise<void | boolean> | void | boolean;\n getHead?: (args: { location: Location }) => ReactNode | undefined;\n getMdxComponents?: () => MdxComponentsType;\n}\n\nexport type EventConsumerPlugin<Event extends ZudokuEvents = ZudokuEvents> = {\n events: { [K in keyof Event]?: Event[K] };\n};\n\nexport const isEventConsumerPlugin = (\n obj: ZudokuPlugin,\n): obj is EventConsumerPlugin =>\n \"events\" in obj && typeof obj.events === \"object\";\n\nexport const isProfileMenuPlugin = (\n obj: ZudokuPlugin,\n): obj is ProfileMenuPlugin =>\n \"getProfileMenuItems\" in obj && typeof obj.getProfileMenuItems === \"function\";\n\nexport const isNavigationPlugin = (\n obj: ZudokuPlugin,\n): obj is NavigationPlugin =>\n \"getRoutes\" in obj && typeof obj.getRoutes === \"function\";\n\nexport const isAuthenticationPlugin = (\n obj: ZudokuPlugin,\n): obj is AuthenticationPlugin =>\n \"signUp\" in obj && typeof obj.signUp === \"function\";\n\nexport const isSearchPlugin = (\n obj: ZudokuPlugin,\n): obj is SearchProviderPlugin =>\n \"renderSearch\" in obj && typeof obj.renderSearch === \"function\";\n\nexport const needsInitialization = (obj: ZudokuPlugin): obj is CommonPlugin =>\n \"initialize\" in obj && typeof obj.initialize === \"function\";\n\nexport const hasHead = (obj: ZudokuPlugin): obj is CommonPlugin =>\n \"getHead\" in obj && typeof obj.getHead === \"function\";\n\nexport const isMdxProviderPlugin = (obj: ZudokuPlugin): obj is CommonPlugin =>\n \"getMdxComponents\" in obj && typeof obj.getMdxComponents === \"function\";\n\nexport const isApiIdentityPlugin = (\n obj: ZudokuPlugin,\n): obj is ApiIdentityPlugin =>\n \"getIdentities\" in obj && typeof obj.getIdentities === \"function\";\n\nexport const isTransformConfigPlugin = (\n obj: ZudokuPlugin,\n): obj is TransformConfigPlugin =>\n \"transformConfig\" in obj && typeof obj.transformConfig === \"function\";\n"],"names":["createApiIdentityPlugin","plugin","createProfileMenuPlugin","isEventConsumerPlugin","obj","isProfileMenuPlugin","isNavigationPlugin","isAuthenticationPlugin","isSearchPlugin","needsInitialization","hasHead","isMdxProviderPlugin","isApiIdentityPlugin","isTransformConfigPlugin"],"mappings":"AAgCO,MAAMA,IAA0B,CACrCC,MACsBA,GAEXC,IAA0B,CACrCD,MACsBA,GAmDXE,IAAwB,CACnCC,MAEA,YAAYA,KAAO,OAAOA,EAAI,UAAW,UAE9BC,IAAsB,CACjCD,MAEA,yBAAyBA,KAAO,OAAOA,EAAI,uBAAwB,YAExDE,IAAqB,CAChCF,MAEA,eAAeA,KAAO,OAAOA,EAAI,aAAc,YAEpCG,IAAyB,CACpCH,MAEA,YAAYA,KAAO,OAAOA,EAAI,UAAW,YAE9BI,IAAiB,CAC5BJ,MAEA,kBAAkBA,KAAO,OAAOA,EAAI,gBAAiB,YAE1CK,IAAsB,CAACL,MAClC,gBAAgBA,KAAO,OAAOA,EAAI,cAAe,YAEtCM,IAAU,CAACN,MACtB,aAAaA,KAAO,OAAOA,EAAI,WAAY,YAEhCO,IAAsB,CAACP,MAClC,sBAAsBA,KAAO,OAAOA,EAAI,oBAAqB,YAElDQ,IAAsB,CACjCR,MAEA,mBAAmBA,KAAO,OAAOA,EAAI,iBAAkB,YAE5CS,IAA0B,CACrCT,MAEA,qBAAqBA,KAAO,OAAOA,EAAI,mBAAoB;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zudoku",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-zf08a8f85",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"homepage": "https://zudoku.dev",
|
|
6
6
|
"repository": {
|
|
@@ -154,6 +154,7 @@
|
|
|
154
154
|
"dependencies": {
|
|
155
155
|
"@apidevtools/json-schema-ref-parser": "14.1.1",
|
|
156
156
|
"@envelop/core": "5.3.2",
|
|
157
|
+
"@fastify/deepmerge": "3.1.0",
|
|
157
158
|
"@graphql-typed-document-node/core": "3.2.0",
|
|
158
159
|
"@lekoarts/rehype-meta-as-attributes": "3.0.3",
|
|
159
160
|
"@mdx-js/react": "3.1.1",
|
|
@@ -184,11 +185,11 @@
|
|
|
184
185
|
"@radix-ui/react-visually-hidden": "1.2.4",
|
|
185
186
|
"@scalar/openapi-parser": "0.23.2",
|
|
186
187
|
"@sentry/node": "10.27.0",
|
|
187
|
-
"@shikijs/engine-javascript": "3.
|
|
188
|
-
"@shikijs/langs": "3.
|
|
189
|
-
"@shikijs/rehype": "3.
|
|
190
|
-
"@shikijs/themes": "3.
|
|
191
|
-
"@shikijs/transformers": "3.
|
|
188
|
+
"@shikijs/engine-javascript": "3.21.0",
|
|
189
|
+
"@shikijs/langs": "3.21.0",
|
|
190
|
+
"@shikijs/rehype": "3.21.0",
|
|
191
|
+
"@shikijs/themes": "3.21.0",
|
|
192
|
+
"@shikijs/transformers": "3.21.0",
|
|
192
193
|
"@sindresorhus/slugify": "3.0.0",
|
|
193
194
|
"@stefanprobst/rehype-extract-toc": "3.0.0",
|
|
194
195
|
"@tailwindcss/typography": "0.5.19",
|
|
@@ -249,7 +250,7 @@
|
|
|
249
250
|
"remark-mdx-frontmatter": "5.2.0",
|
|
250
251
|
"rollup": "4.52.5",
|
|
251
252
|
"semver": "7.7.2",
|
|
252
|
-
"shiki": "3.
|
|
253
|
+
"shiki": "3.21.0",
|
|
253
254
|
"sitemap": "9.0.0",
|
|
254
255
|
"strip-ansi": "7.1.2",
|
|
255
256
|
"tailwind-merge": "3.4.0",
|
package/src/lib/core/plugins.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { ReactNode } from "react";
|
|
|
3
3
|
import type { Location, RouteObject } from "react-router";
|
|
4
4
|
import type { Navigation } from "../../config/validators/NavigationSchema.js";
|
|
5
5
|
import type { ProtectedRoutesInput } from "../../config/validators/ProtectedRoutesSchema.js";
|
|
6
|
+
import type { ZudokuConfig } from "../../config/validators/validate.js";
|
|
6
7
|
import type { AuthenticationPlugin } from "../authentication/authentication.js";
|
|
7
8
|
import type { MdxComponentsType } from "../util/MdxComponents.js";
|
|
8
9
|
import type {
|
|
@@ -18,7 +19,8 @@ export type ZudokuPlugin =
|
|
|
18
19
|
| ApiIdentityPlugin
|
|
19
20
|
| SearchProviderPlugin
|
|
20
21
|
| EventConsumerPlugin
|
|
21
|
-
| AuthenticationPlugin
|
|
22
|
+
| AuthenticationPlugin
|
|
23
|
+
| TransformConfigPlugin;
|
|
22
24
|
|
|
23
25
|
export type { AuthenticationPlugin, RouteObject };
|
|
24
26
|
|
|
@@ -60,6 +62,19 @@ export type ProfileNavigationItem = {
|
|
|
60
62
|
icon?: LucideIcon;
|
|
61
63
|
};
|
|
62
64
|
|
|
65
|
+
export interface ConfigHookContext {
|
|
66
|
+
mode: typeof process.env.ZUDOKU_ENV;
|
|
67
|
+
rootDir: string;
|
|
68
|
+
configPath: string;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface TransformConfigPlugin {
|
|
72
|
+
transformConfig?: (
|
|
73
|
+
config: ZudokuConfig,
|
|
74
|
+
ctx: ConfigHookContext,
|
|
75
|
+
) => Partial<ZudokuConfig> | void | Promise<Partial<ZudokuConfig> | void>;
|
|
76
|
+
}
|
|
77
|
+
|
|
63
78
|
export interface CommonPlugin {
|
|
64
79
|
initialize?: (
|
|
65
80
|
context: ZudokuContext,
|
|
@@ -110,3 +125,8 @@ export const isApiIdentityPlugin = (
|
|
|
110
125
|
obj: ZudokuPlugin,
|
|
111
126
|
): obj is ApiIdentityPlugin =>
|
|
112
127
|
"getIdentities" in obj && typeof obj.getIdentities === "function";
|
|
128
|
+
|
|
129
|
+
export const isTransformConfigPlugin = (
|
|
130
|
+
obj: ZudokuPlugin,
|
|
131
|
+
): obj is TransformConfigPlugin =>
|
|
132
|
+
"transformConfig" in obj && typeof obj.transformConfig === "function";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import createDeepmerge from "@fastify/deepmerge";
|
|
2
|
+
import type { ConfigWithMeta } from "../../config/loader.js";
|
|
3
|
+
import { type ConfigHookContext, isTransformConfigPlugin } from "./plugins.js";
|
|
4
|
+
|
|
5
|
+
const mergeConfig = createDeepmerge({
|
|
6
|
+
mergeArray: (opt) => (_, source) => opt.clone(source),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export const runTransformConfigHooks = async (
|
|
10
|
+
config: ConfigWithMeta,
|
|
11
|
+
): Promise<ConfigWithMeta> => {
|
|
12
|
+
const ctx = {
|
|
13
|
+
mode: config.__meta.mode,
|
|
14
|
+
rootDir: config.__meta.rootDir,
|
|
15
|
+
configPath: config.__meta.configPath,
|
|
16
|
+
} satisfies ConfigHookContext;
|
|
17
|
+
const plugins = config.plugins ?? [];
|
|
18
|
+
|
|
19
|
+
let result = config;
|
|
20
|
+
|
|
21
|
+
for (const plugin of plugins.filter(isTransformConfigPlugin)) {
|
|
22
|
+
const partial = await plugin.transformConfig?.(result, ctx);
|
|
23
|
+
if (!partial) continue;
|
|
24
|
+
|
|
25
|
+
result = mergeConfig(result, partial) as ConfigWithMeta;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return result;
|
|
29
|
+
};
|
|
@@ -19,13 +19,21 @@ export const OasProvider = ({
|
|
|
19
19
|
client: GraphQLClient;
|
|
20
20
|
}) => {
|
|
21
21
|
const value = useMemo(() => {
|
|
22
|
-
const {
|
|
22
|
+
const {
|
|
23
|
+
versions: availableVersions,
|
|
24
|
+
labels,
|
|
25
|
+
downloadUrls,
|
|
26
|
+
} = getVersionMetadata(config);
|
|
23
27
|
const currentVersion = version ?? availableVersions.at(0);
|
|
24
28
|
|
|
25
29
|
const versionLinks = Object.fromEntries(
|
|
26
30
|
availableVersions.map((id) => [
|
|
27
31
|
id,
|
|
28
|
-
{
|
|
32
|
+
{
|
|
33
|
+
path: joinUrl(basePath, id),
|
|
34
|
+
label: labels[id] ?? id,
|
|
35
|
+
downloadUrl: downloadUrls[id],
|
|
36
|
+
},
|
|
29
37
|
]),
|
|
30
38
|
);
|
|
31
39
|
|
|
@@ -20,7 +20,6 @@ import { Heading } from "../../components/Heading.js";
|
|
|
20
20
|
import { Markdown } from "../../components/Markdown.js";
|
|
21
21
|
import { PagefindSearchMeta } from "../../components/PagefindSearchMeta.js";
|
|
22
22
|
import { Pagination } from "../../components/Pagination.js";
|
|
23
|
-
import { joinUrl } from "../../util/joinUrl.js";
|
|
24
23
|
import { useCreateQuery } from "./client/useCreateQuery.js";
|
|
25
24
|
import { useOasConfig } from "./context.js";
|
|
26
25
|
import { DownloadSchemaButton } from "./DownloadSchemaButton.js";
|
|
@@ -151,11 +150,6 @@ const OperationsForTagQuery = graphql(/* GraphQL */ `
|
|
|
151
150
|
|
|
152
151
|
const LAZY_OPERATION_LIST_THRESHOLD = 30;
|
|
153
152
|
|
|
154
|
-
const getFileExtension = (filename: string): string => {
|
|
155
|
-
const lastDotIndex = filename.lastIndexOf(".");
|
|
156
|
-
return lastDotIndex !== -1 ? filename.slice(lastDotIndex) : "";
|
|
157
|
-
};
|
|
158
|
-
|
|
159
153
|
export const OperationList = ({
|
|
160
154
|
tag,
|
|
161
155
|
untagged,
|
|
@@ -163,7 +157,7 @@ export const OperationList = ({
|
|
|
163
157
|
tag?: string;
|
|
164
158
|
untagged?: boolean;
|
|
165
159
|
}) => {
|
|
166
|
-
const {
|
|
160
|
+
const { input, type, versions, version, options } = useOasConfig();
|
|
167
161
|
const { tag: tagFromParams } = useParams<"tag">();
|
|
168
162
|
const query = useCreateQuery(OperationsForTagQuery, {
|
|
169
163
|
input,
|
|
@@ -252,11 +246,12 @@ export const OperationList = ({
|
|
|
252
246
|
const tagTitle = schema.tag.extensions?.["x-displayName"] ?? schema.tag.name;
|
|
253
247
|
const helmetTitle = [tagTitle, title].filter(Boolean).join(" - ");
|
|
254
248
|
|
|
249
|
+
const currentVersion = version != null ? versions[version] : undefined;
|
|
255
250
|
const downloadUrl =
|
|
256
251
|
typeof input === "string"
|
|
257
252
|
? type === "url"
|
|
258
253
|
? input
|
|
259
|
-
:
|
|
254
|
+
: currentVersion?.downloadUrl
|
|
260
255
|
: undefined;
|
|
261
256
|
|
|
262
257
|
return (
|
|
@@ -291,7 +286,7 @@ export const OperationList = ({
|
|
|
291
286
|
{showVersions && (
|
|
292
287
|
<span className="text-xl text-muted-foreground ms-1.5">
|
|
293
288
|
{" "}
|
|
294
|
-
({version})
|
|
289
|
+
({schema.version})
|
|
295
290
|
</span>
|
|
296
291
|
)}
|
|
297
292
|
</Heading>
|
|
@@ -7,6 +7,8 @@ type DynamicInput = () => Promise<unknown>;
|
|
|
7
7
|
|
|
8
8
|
export type VersionedInput<T> = Array<{
|
|
9
9
|
path: string;
|
|
10
|
+
version?: string;
|
|
11
|
+
downloadUrl?: string;
|
|
10
12
|
label?: string;
|
|
11
13
|
input: T;
|
|
12
14
|
}>;
|
|
@@ -85,5 +87,8 @@ export type OasPluginConfig = BaseOasConfig & OasSource;
|
|
|
85
87
|
export type OasPluginContext = BaseOasConfig &
|
|
86
88
|
ContextOasSource & {
|
|
87
89
|
version?: string;
|
|
88
|
-
versions: Record<
|
|
90
|
+
versions: Record<
|
|
91
|
+
string,
|
|
92
|
+
{ path: string; label: string; downloadUrl?: string }
|
|
93
|
+
>;
|
|
89
94
|
};
|
|
@@ -150,7 +150,7 @@ const createVersionRoutes = (
|
|
|
150
150
|
|
|
151
151
|
export const getVersionMetadata = (config: OasPluginConfig) => {
|
|
152
152
|
if (config.type === "raw" || !Array.isArray(config.input)) {
|
|
153
|
-
return { versions: [], labels: {} };
|
|
153
|
+
return { versions: [], labels: {}, downloadUrls: {} };
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
return {
|
|
@@ -158,6 +158,9 @@ export const getVersionMetadata = (config: OasPluginConfig) => {
|
|
|
158
158
|
labels: Object.fromEntries(
|
|
159
159
|
config.input.map((v) => [v.path, v.label ?? v.path]),
|
|
160
160
|
),
|
|
161
|
+
downloadUrls: Object.fromEntries(
|
|
162
|
+
config.input.map((v) => [v.path, v.downloadUrl]),
|
|
163
|
+
),
|
|
161
164
|
};
|
|
162
165
|
};
|
|
163
166
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@shikijs/langs/c3";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@shikijs/langs/gn";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@shikijs/langs/moonbit";
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { j as s } from "./jsx-runtime-BzflLqGi.js";
|
|
2
|
-
import { useMemo as v } from "react";
|
|
3
|
-
import { O as f } from "./chunk-EPOLDU6W-C6C8jAwd.js";
|
|
4
|
-
import { j } from "./ZudokuContext-BZB1TWdT.js";
|
|
5
|
-
import { g as c, O as x, G as O } from "./index-BQB9hb6n.js";
|
|
6
|
-
const y = ({
|
|
7
|
-
basePath: e,
|
|
8
|
-
version: n,
|
|
9
|
-
config: r,
|
|
10
|
-
client: a
|
|
11
|
-
}) => {
|
|
12
|
-
const p = v(() => {
|
|
13
|
-
const { versions: i, labels: u } = c(r), o = n ?? i.at(0), m = Object.fromEntries(
|
|
14
|
-
i.map((t) => [
|
|
15
|
-
t,
|
|
16
|
-
{ path: j(e, t), label: u[t] ?? t }
|
|
17
|
-
])
|
|
18
|
-
);
|
|
19
|
-
return {
|
|
20
|
-
config: {
|
|
21
|
-
...r,
|
|
22
|
-
version: o,
|
|
23
|
-
versions: m,
|
|
24
|
-
input: (() => {
|
|
25
|
-
if (!Array.isArray(r.input))
|
|
26
|
-
return r.input;
|
|
27
|
-
const t = o ? r.input.find((l) => l.path === o) : r.input[0];
|
|
28
|
-
if (!t)
|
|
29
|
-
throw new Error(`No input found for version: ${o}`);
|
|
30
|
-
return t.input;
|
|
31
|
-
})()
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
}, [r, e, n]);
|
|
35
|
-
return /* @__PURE__ */ s.jsx(x, { value: p, children: /* @__PURE__ */ s.jsx(O, { client: a, children: /* @__PURE__ */ s.jsx(f, {}) }) });
|
|
36
|
-
};
|
|
37
|
-
export {
|
|
38
|
-
y as OasProvider
|
|
39
|
-
};
|
|
40
|
-
//# sourceMappingURL=OasProvider-DSe-hk5Y.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OasProvider-DSe-hk5Y.js","sources":["../src/lib/plugins/openapi/OasProvider.tsx"],"sourcesContent":["import { useMemo } from \"react\";\nimport { Outlet } from \"react-router\";\nimport { joinUrl } from \"../../util/joinUrl.js\";\nimport type { GraphQLClient } from \"./client/GraphQLClient.js\";\nimport { GraphQLProvider } from \"./client/GraphQLContext.js\";\nimport { OasConfigProvider } from \"./context.js\";\nimport type { OasPluginConfig } from \"./interfaces.js\";\nimport { getVersionMetadata } from \"./util/getRoutes.js\";\n\nexport const OasProvider = ({\n basePath,\n version,\n config,\n client,\n}: {\n basePath: string;\n version?: string;\n config: OasPluginConfig;\n client: GraphQLClient;\n}) => {\n const value = useMemo(() => {\n const { versions: availableVersions, labels } = getVersionMetadata(config);\n const currentVersion = version ?? availableVersions.at(0);\n\n const versionLinks = Object.fromEntries(\n availableVersions.map((id) => [\n id,\n { path: joinUrl(basePath, id), label: labels[id] ?? id },\n ]),\n );\n\n const resolveInput = (): string | (() => Promise<unknown>) => {\n if (!Array.isArray(config.input)) {\n return config.input;\n }\n\n const versionConfig = currentVersion\n ? config.input.find((v) => v.path === currentVersion)\n : config.input[0];\n\n if (!versionConfig) {\n throw new Error(`No input found for version: ${currentVersion}`);\n }\n\n return versionConfig.input;\n };\n\n return {\n config: {\n ...config,\n version: currentVersion,\n versions: versionLinks,\n input: resolveInput(),\n },\n };\n }, [config, basePath, version]);\n\n return (\n <OasConfigProvider value={value}>\n <GraphQLProvider client={client}>\n <Outlet />\n </GraphQLProvider>\n </OasConfigProvider>\n );\n};\n"],"names":["OasProvider","basePath","version","config","client","value","useMemo","availableVersions","labels","getVersionMetadata","currentVersion","versionLinks","id","joinUrl","versionConfig","v","jsx","OasConfigProvider","GraphQLProvider","Outlet"],"mappings":";;;;;AASO,MAAMA,IAAc,CAAC;AAAA,EAC1B,UAAAC;AAAA,EACA,SAAAC;AAAA,EACA,QAAAC;AAAA,EACA,QAAAC;AACF,MAKM;AACJ,QAAMC,IAAQC,EAAQ,MAAM;AAC1B,UAAM,EAAE,UAAUC,GAAmB,QAAAC,EAAA,IAAWC,EAAmBN,CAAM,GACnEO,IAAiBR,KAAWK,EAAkB,GAAG,CAAC,GAElDI,IAAe,OAAO;AAAA,MAC1BJ,EAAkB,IAAI,CAACK,MAAO;AAAA,QAC5BA;AAAA,QACA,EAAE,MAAMC,EAAQZ,GAAUW,CAAE,GAAG,OAAOJ,EAAOI,CAAE,KAAKA,EAAA;AAAA,MAAG,CACxD;AAAA,IAAA;AAmBH,WAAO;AAAA,MACL,QAAQ;AAAA,QACN,GAAGT;AAAA,QACH,SAASO;AAAA,QACT,UAAUC;AAAA,QACV,QArBiB,MAAyC;AAC5D,cAAI,CAAC,MAAM,QAAQR,EAAO,KAAK;AAC7B,mBAAOA,EAAO;AAGhB,gBAAMW,IAAgBJ,IAClBP,EAAO,MAAM,KAAK,CAACY,MAAMA,EAAE,SAASL,CAAc,IAClDP,EAAO,MAAM,CAAC;AAElB,cAAI,CAACW;AACH,kBAAM,IAAI,MAAM,+BAA+BJ,CAAc,EAAE;AAGjE,iBAAOI,EAAc;AAAA,QACvB,GAOW;AAAA,MAAa;AAAA,IACtB;AAAA,EAEJ,GAAG,CAACX,GAAQF,GAAUC,CAAO,CAAC;AAE9B,SACEc,gBAAAA,EAAAA,IAACC,KAAkB,OAAAZ,GACjB,UAAAW,gBAAAA,EAAAA,IAACE,KAAgB,QAAAd,GACf,UAAAY,gBAAAA,EAAAA,IAACG,GAAA,CAAA,CAAO,EAAA,CACV,EAAA,CACF;AAEJ;"}
|