zudoku 0.42.1 → 0.42.2
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/lib/authentication/components/SignIn.d.ts +1 -1
- package/dist/lib/authentication/components/SignIn.js +5 -2
- package/dist/lib/authentication/components/SignIn.js.map +1 -1
- package/dist/lib/authentication/components/SignUp.d.ts +1 -1
- package/dist/lib/authentication/components/SignUp.js +4 -1
- package/dist/lib/authentication/components/SignUp.js.map +1 -1
- package/dist/lib/plugins/openapi/ParameterListItem.js +8 -1
- package/dist/lib/plugins/openapi/ParameterListItem.js.map +1 -1
- package/dist/lib/plugins/openapi/schema/SchemaPropertyItem.js +5 -3
- package/dist/lib/plugins/openapi/schema/SchemaPropertyItem.js.map +1 -1
- package/dist/lib/plugins/openapi/schema/SchemaView.js +1 -1
- package/dist/lib/plugins/openapi/schema/SchemaView.js.map +1 -1
- package/dist/lib/plugins/openapi/schema/utils.d.ts +1 -0
- package/dist/lib/plugins/openapi/schema/utils.js +3 -0
- package/dist/lib/plugins/openapi/schema/utils.js.map +1 -1
- package/lib/AuthenticationPlugin-ByDF051g.js +99 -0
- package/lib/AuthenticationPlugin-ByDF051g.js.map +1 -0
- package/lib/Card-BtheiD7j.js +61 -0
- package/lib/Card-BtheiD7j.js.map +1 -0
- package/lib/{OasProvider-CZiF_RMW.js → OasProvider-CDtbrUG_.js} +2 -2
- package/lib/{OasProvider-CZiF_RMW.js.map → OasProvider-CDtbrUG_.js.map} +1 -1
- package/lib/{OperationList-CMMzLfIZ.js → OperationList-DTyJIxKW.js} +1078 -1057
- package/lib/OperationList-DTyJIxKW.js.map +1 -0
- package/lib/{SchemaList-_d3Mf4IX.js → SchemaList-B9lvArDe.js} +3 -3
- package/lib/{SchemaList-_d3Mf4IX.js.map → SchemaList-B9lvArDe.js.map} +1 -1
- package/lib/{SchemaView-J7Srn-Iy.js → SchemaView-DXjql-Bl.js} +105 -106
- package/lib/SchemaView-DXjql-Bl.js.map +1 -0
- package/lib/{index-BPqJMdth.js → index-Ckl3s_w-.js} +393 -442
- package/lib/index-Ckl3s_w-.js.map +1 -0
- package/lib/zudoku.auth-clerk.js +1 -1
- package/lib/zudoku.auth-openid.js +1 -1
- package/lib/zudoku.plugin-openapi.js +1 -1
- package/package.json +3 -3
- package/src/lib/authentication/components/SignIn.tsx +35 -2
- package/src/lib/authentication/components/SignUp.tsx +35 -1
- package/src/lib/plugins/openapi/ParameterListItem.tsx +30 -0
- package/src/lib/plugins/openapi/schema/SchemaPropertyItem.tsx +7 -4
- package/src/lib/plugins/openapi/schema/SchemaView.tsx +1 -6
- package/src/lib/plugins/openapi/schema/utils.ts +5 -0
- package/lib/AuthenticationPlugin-DPCuR3xm.js +0 -58
- package/lib/AuthenticationPlugin-DPCuR3xm.js.map +0 -1
- package/lib/OperationList-CMMzLfIZ.js.map +0 -1
- package/lib/SchemaView-J7Srn-Iy.js.map +0 -1
- package/lib/index-BPqJMdth.js.map +0 -1
|
@@ -1,11 +1,45 @@
|
|
|
1
1
|
import { useEffect } from "react";
|
|
2
|
+
import { Button, Link } from "zudoku/components";
|
|
3
|
+
import {
|
|
4
|
+
Card,
|
|
5
|
+
CardContent,
|
|
6
|
+
CardDescription,
|
|
7
|
+
CardHeader,
|
|
8
|
+
CardTitle,
|
|
9
|
+
} from "zudoku/ui/Card.js";
|
|
2
10
|
import { useZudoku } from "../../components/context/ZudokuContext.js";
|
|
3
11
|
|
|
4
12
|
export const SignUp = () => {
|
|
5
13
|
const context = useZudoku();
|
|
14
|
+
|
|
6
15
|
useEffect(() => {
|
|
7
16
|
void (context.authentication?.signUp() ?? context.authentication?.signIn());
|
|
8
17
|
}, [context.authentication]);
|
|
9
18
|
|
|
10
|
-
return
|
|
19
|
+
return (
|
|
20
|
+
<div className="flex items-center justify-center mt-8">
|
|
21
|
+
<Card className="max-w-md w-full">
|
|
22
|
+
<CardHeader>
|
|
23
|
+
<CardTitle className="text-lg">Sign up</CardTitle>
|
|
24
|
+
<CardDescription>
|
|
25
|
+
You're being redirected to our secure login provider to complete
|
|
26
|
+
your sign up process.
|
|
27
|
+
</CardDescription>
|
|
28
|
+
</CardHeader>
|
|
29
|
+
<CardContent>
|
|
30
|
+
<div className="flex flex-col gap-2 justify-center">
|
|
31
|
+
<Button
|
|
32
|
+
onClick={() => context.authentication?.signIn()}
|
|
33
|
+
variant="default"
|
|
34
|
+
>
|
|
35
|
+
Register
|
|
36
|
+
</Button>
|
|
37
|
+
<Button variant="link" className="text-muted-foreground" asChild>
|
|
38
|
+
<Link to="/">Go home</Link>
|
|
39
|
+
</Button>
|
|
40
|
+
</div>
|
|
41
|
+
</CardContent>
|
|
42
|
+
</Card>
|
|
43
|
+
</div>
|
|
44
|
+
);
|
|
11
45
|
};
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
import * as Collapsible from "@radix-ui/react-collapsible";
|
|
2
|
+
import { MinusIcon, PlusIcon } from "lucide-react";
|
|
3
|
+
import { useState } from "react";
|
|
1
4
|
import { Markdown } from "../../components/Markdown.js";
|
|
2
5
|
import { type SchemaObject } from "../../oas/graphql/index.js";
|
|
6
|
+
import { Button } from "../../ui/Button.js";
|
|
3
7
|
import { ColorizedParam } from "./ColorizedParam.js";
|
|
4
8
|
import type { OperationListItemResult } from "./OperationList.js";
|
|
5
9
|
import type { ParameterGroup } from "./OperationListItem.js";
|
|
@@ -7,6 +11,8 @@ import { ParamInfos } from "./ParamInfos.js";
|
|
|
7
11
|
import { EnumValues } from "./components/EnumValues.js";
|
|
8
12
|
import { SelectOnClick } from "./components/SelectOnClick.js";
|
|
9
13
|
import { SchemaExampleAndDefault } from "./schema/SchemaExampleAndDefault.js";
|
|
14
|
+
import { SchemaView } from "./schema/SchemaView.js";
|
|
15
|
+
import { isArrayType } from "./schema/utils.js";
|
|
10
16
|
|
|
11
17
|
const getParameterSchema = (
|
|
12
18
|
parameter: ParameterListItemResult,
|
|
@@ -33,6 +39,7 @@ export const ParameterListItem = ({
|
|
|
33
39
|
id: string;
|
|
34
40
|
}) => {
|
|
35
41
|
const paramSchema = getParameterSchema(parameter);
|
|
42
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
36
43
|
|
|
37
44
|
return (
|
|
38
45
|
<li className="p-4 bg-border/20 text-sm flex flex-col gap-1.5">
|
|
@@ -74,6 +81,29 @@ export const ParameterListItem = ({
|
|
|
74
81
|
paramSchema.enum && <EnumValues values={paramSchema.enum} />
|
|
75
82
|
)}
|
|
76
83
|
<SchemaExampleAndDefault schema={paramSchema} />
|
|
84
|
+
{(paramSchema.type === "object" || isArrayType(paramSchema)) && (
|
|
85
|
+
<Collapsible.Root
|
|
86
|
+
defaultOpen={false}
|
|
87
|
+
onOpenChange={setIsOpen}
|
|
88
|
+
open={isOpen}
|
|
89
|
+
>
|
|
90
|
+
<Collapsible.Trigger asChild>
|
|
91
|
+
<Button variant="expand" size="sm">
|
|
92
|
+
{isOpen ? <MinusIcon size={12} /> : <PlusIcon size={12} />}
|
|
93
|
+
{isOpen ? "Hide properties" : "Show properties"}
|
|
94
|
+
</Button>
|
|
95
|
+
</Collapsible.Trigger>
|
|
96
|
+
<Collapsible.Content>
|
|
97
|
+
<div className="mt-2">
|
|
98
|
+
<SchemaView
|
|
99
|
+
schema={
|
|
100
|
+
"items" in paramSchema ? paramSchema.items : paramSchema
|
|
101
|
+
}
|
|
102
|
+
/>
|
|
103
|
+
</div>
|
|
104
|
+
</Collapsible.Content>
|
|
105
|
+
</Collapsible.Root>
|
|
106
|
+
)}
|
|
77
107
|
</li>
|
|
78
108
|
);
|
|
79
109
|
};
|
|
@@ -15,6 +15,7 @@ import { SchemaExampleAndDefault } from "./SchemaExampleAndDefault.js";
|
|
|
15
15
|
import { SchemaView } from "./SchemaView.js";
|
|
16
16
|
import {
|
|
17
17
|
hasLogicalGroupings,
|
|
18
|
+
isArrayType,
|
|
18
19
|
isCircularRef,
|
|
19
20
|
isComplexType,
|
|
20
21
|
LogicalSchemaTypeMap,
|
|
@@ -93,7 +94,7 @@ export const SchemaPropertyItem = ({
|
|
|
93
94
|
group !== "optional" && (
|
|
94
95
|
<span className="text-primary">required</span>
|
|
95
96
|
),
|
|
96
|
-
schema
|
|
97
|
+
isArrayType(schema) &&
|
|
97
98
|
"items" in schema &&
|
|
98
99
|
isCircularRef(schema.items) && <RecursiveIndicator />,
|
|
99
100
|
]}
|
|
@@ -110,7 +111,9 @@ export const SchemaPropertyItem = ({
|
|
|
110
111
|
)}
|
|
111
112
|
{schema.enum && <EnumValues values={schema.enum} />}
|
|
112
113
|
<SchemaExampleAndDefault schema={schema} />
|
|
113
|
-
{(hasLogicalGroupings(schema) ||
|
|
114
|
+
{(hasLogicalGroupings(schema) ||
|
|
115
|
+
isComplexType(schema) ||
|
|
116
|
+
isArrayType(schema)) && (
|
|
114
117
|
<Collapsible.Root
|
|
115
118
|
defaultOpen={defaultOpen}
|
|
116
119
|
open={isOpen}
|
|
@@ -118,7 +121,7 @@ export const SchemaPropertyItem = ({
|
|
|
118
121
|
>
|
|
119
122
|
{showCollapseButton && (
|
|
120
123
|
<Collapsible.Trigger asChild>
|
|
121
|
-
<Button variant="expand" size="sm"
|
|
124
|
+
<Button variant="expand" size="sm">
|
|
122
125
|
{isOpen ? <MinusIcon size={12} /> : <PlusIcon size={12} />}
|
|
123
126
|
{!isOpen ? "Show properties" : "Hide properties"}
|
|
124
127
|
</Button>
|
|
@@ -131,7 +134,7 @@ export const SchemaPropertyItem = ({
|
|
|
131
134
|
) : schema.type === "object" ? (
|
|
132
135
|
<SchemaView schema={schema} />
|
|
133
136
|
) : (
|
|
134
|
-
schema
|
|
137
|
+
isArrayType(schema) &&
|
|
135
138
|
"items" in schema &&
|
|
136
139
|
typeof schema.items === "object" &&
|
|
137
140
|
!isCircularRef(schema.items) && (
|
|
@@ -57,12 +57,7 @@ export const SchemaView = ({
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
if (schema.type === "array" && typeof schema.items === "object") {
|
|
60
|
-
return
|
|
61
|
-
<Card className="p-4 space-y-2 text-sm">
|
|
62
|
-
<ParamInfos schema={schema} />
|
|
63
|
-
<SchemaView schema={schema.items as SchemaObject} />
|
|
64
|
-
</Card>
|
|
65
|
-
);
|
|
60
|
+
return <SchemaView schema={schema.items as SchemaObject} />;
|
|
66
61
|
}
|
|
67
62
|
|
|
68
63
|
if (schema.type === "object") {
|
|
@@ -7,6 +7,11 @@ export const isBasicType = (
|
|
|
7
7
|
typeof type === "string" &&
|
|
8
8
|
["string", "number", "boolean", "integer", "null"].includes(type);
|
|
9
9
|
|
|
10
|
+
export const isArrayType = (value: SchemaObject) =>
|
|
11
|
+
value.type === "array" ||
|
|
12
|
+
// schema.type might be an array of types, so we need to check if "array" is one of them
|
|
13
|
+
(Array.isArray(value.type) && value.type.includes("array"));
|
|
14
|
+
|
|
10
15
|
export const isComplexType = (value: SchemaObject) =>
|
|
11
16
|
(value.type === "object" && Object.keys(value.properties ?? {}).length > 0) ||
|
|
12
17
|
(value.type === "array" &&
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { j as o } from "./jsx-runtime-C5mzlN2N.js";
|
|
2
|
-
import { LogOutIcon as a } from "lucide-react";
|
|
3
|
-
import { useEffect as i } from "react";
|
|
4
|
-
import { b as u, a as r } from "./chunk-BAXFHI7N-BVBOl9s0.js";
|
|
5
|
-
import { e as s } from "./hook-CldJlP5c.js";
|
|
6
|
-
const c = () => {
|
|
7
|
-
const t = s(), [e] = u();
|
|
8
|
-
return i(() => {
|
|
9
|
-
var n;
|
|
10
|
-
(n = t.authentication) == null || n.signIn({
|
|
11
|
-
redirectTo: e.get("redirect") ?? void 0
|
|
12
|
-
});
|
|
13
|
-
}, [t.authentication, e]), null;
|
|
14
|
-
}, g = () => {
|
|
15
|
-
const t = s(), e = r();
|
|
16
|
-
return i(() => {
|
|
17
|
-
var n;
|
|
18
|
-
(n = t.authentication) == null || n.signOut().then(() => e("/"));
|
|
19
|
-
}, []), null;
|
|
20
|
-
}, m = () => {
|
|
21
|
-
const t = s();
|
|
22
|
-
return i(() => {
|
|
23
|
-
var e, n;
|
|
24
|
-
((e = t.authentication) == null ? void 0 : e.signUp()) ?? ((n = t.authentication) == null || n.signIn());
|
|
25
|
-
}, [t.authentication]), null;
|
|
26
|
-
};
|
|
27
|
-
class d {
|
|
28
|
-
getRoutes() {
|
|
29
|
-
return [
|
|
30
|
-
{
|
|
31
|
-
path: "/signout",
|
|
32
|
-
element: /* @__PURE__ */ o.jsx(g, {})
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
path: "/signin",
|
|
36
|
-
element: /* @__PURE__ */ o.jsx(c, {})
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
path: "/signup",
|
|
40
|
-
element: /* @__PURE__ */ o.jsx(m, {})
|
|
41
|
-
}
|
|
42
|
-
];
|
|
43
|
-
}
|
|
44
|
-
getProfileMenuItems() {
|
|
45
|
-
return [
|
|
46
|
-
{
|
|
47
|
-
label: "Logout",
|
|
48
|
-
path: "/signout",
|
|
49
|
-
category: "bottom",
|
|
50
|
-
icon: a
|
|
51
|
-
}
|
|
52
|
-
];
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
export {
|
|
56
|
-
d as A
|
|
57
|
-
};
|
|
58
|
-
//# sourceMappingURL=AuthenticationPlugin-DPCuR3xm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AuthenticationPlugin-DPCuR3xm.js","sources":["../src/lib/authentication/components/SignIn.tsx","../src/lib/authentication/components/SignOut.tsx","../src/lib/authentication/components/SignUp.tsx","../src/lib/authentication/AuthenticationPlugin.tsx"],"sourcesContent":["import { useEffect } from \"react\";\nimport { useSearchParams } from \"react-router\";\nimport { useZudoku } from \"../../components/context/ZudokuContext.js\";\n\nexport const SignIn = () => {\n const context = useZudoku();\n const [search] = useSearchParams();\n useEffect(() => {\n void context.authentication?.signIn({\n redirectTo: search.get(\"redirect\") ?? undefined,\n });\n }, [context.authentication, search]);\n\n return null;\n};\n","import { useEffect } from \"react\";\nimport { useNavigate } from \"react-router\";\nimport { useZudoku } from \"../../components/context/ZudokuContext.js\";\n\nexport const SignOut = () => {\n const context = useZudoku();\n const navigate = useNavigate();\n\n useEffect(() => {\n void context.authentication?.signOut().then(() => navigate(\"/\"));\n }, []);\n\n return null;\n};\n","import { useEffect } from \"react\";\nimport { useZudoku } from \"../../components/context/ZudokuContext.js\";\n\nexport const SignUp = () => {\n const context = useZudoku();\n useEffect(() => {\n void (context.authentication?.signUp() ?? context.authentication?.signIn());\n }, [context.authentication]);\n\n return null;\n};\n","import { LogOutIcon } from \"lucide-react\";\nimport {\n CommonPlugin,\n NavigationPlugin,\n ProfileMenuPlugin,\n} from \"../core/plugins.js\";\nimport { SignIn } from \"./components/SignIn.js\";\nimport { SignOut } from \"./components/SignOut.js\";\nimport { SignUp } from \"./components/SignUp.js\";\n\ntype PluginInterface = NavigationPlugin & CommonPlugin & ProfileMenuPlugin;\n\nexport class AuthenticationPlugin implements PluginInterface {\n getRoutes() {\n return [\n {\n path: \"/signout\",\n element: <SignOut />,\n },\n {\n path: \"/signin\",\n element: <SignIn />,\n },\n {\n path: \"/signup\",\n element: <SignUp />,\n },\n ];\n }\n\n getProfileMenuItems() {\n return [\n {\n label: \"Logout\",\n path: \"/signout\",\n category: \"bottom\",\n icon: LogOutIcon,\n } as const,\n ];\n }\n}\n"],"names":["SignIn","context","useZudoku","search","useSearchParams","useEffect","_a","SignOut","navigate","useNavigate","SignUp","_b","AuthenticationPlugin","LogOutIcon"],"mappings":";;;;;AAIO,MAAMA,IAAS,MAAM;AAC1B,QAAMC,IAAUC,EAAU,GACpB,CAACC,CAAM,IAAIC,EAAgB;AACjC,SAAAC,EAAU,MAAM;;AACT,KAAAC,IAAAL,EAAQ,mBAAR,QAAAK,EAAwB,OAAO;AAAA,MAClC,YAAYH,EAAO,IAAI,UAAU,KAAK;AAAA,IAAA;AAAA,EAEvC,GAAA,CAACF,EAAQ,gBAAgBE,CAAM,CAAC,GAE5B;AACT,GCVaI,IAAU,MAAM;AAC3B,QAAMN,IAAUC,EAAU,GACpBM,IAAWC,EAAY;AAE7B,SAAAJ,EAAU,MAAM;;AACT,KAAAC,IAAAL,EAAQ,mBAAR,QAAAK,EAAwB,UAAU,KAAK,MAAME,EAAS,GAAG;AAAA,EAChE,GAAG,EAAE,GAEE;AACT,GCVaE,IAAS,MAAM;AAC1B,QAAMT,IAAUC,EAAU;AAC1B,SAAAG,EAAU,MAAM;;AACd,MAAMC,IAAAL,EAAQ,mBAAR,gBAAAK,EAAwB,eAAYK,IAAAV,EAAQ,mBAAR,QAAAU,EAAwB;AAAA,EAAO,GACxE,CAACV,EAAQ,cAAc,CAAC,GAEpB;AACT;ACEO,MAAMW,EAAgD;AAAA,EAC3D,YAAY;AACH,WAAA;AAAA,MACL;AAAA,QACE,MAAM;AAAA,QACN,+BAAUL,GAAQ,CAAA,CAAA;AAAA,MACpB;AAAA,MACA;AAAA,QACE,MAAM;AAAA,QACN,+BAAUP,GAAO,CAAA,CAAA;AAAA,MACnB;AAAA,MACA;AAAA,QACE,MAAM;AAAA,QACN,+BAAUU,GAAO,CAAA,CAAA;AAAA,MAAA;AAAA,IAErB;AAAA,EAAA;AAAA,EAGF,sBAAsB;AACb,WAAA;AAAA,MACL;AAAA,QACE,OAAO;AAAA,QACP,MAAM;AAAA,QACN,UAAU;AAAA,QACV,MAAMG;AAAA,MAAA;AAAA,IAEV;AAAA,EAAA;AAEJ;"}
|