@lukoweb/apitogo 0.1.1 → 0.1.3
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/cli/cli.js +168 -57
- package/dist/declarations/lib/ui/Command.d.ts +1 -1
- package/dist/declarations/lib/util/MdxComponents.d.ts +1 -1
- package/package.json +2 -1
- package/src/app/main.tsx +150 -150
- package/src/config/loader.ts +245 -245
- package/src/index.ts +33 -33
- package/src/lib/authentication/components/CallbackHandler.tsx +45 -45
- package/src/lib/authentication/components/SignIn.tsx +46 -46
- package/src/lib/authentication/components/SignUp.tsx +48 -48
- package/src/lib/authentication/providers/clerk.tsx +224 -224
- package/src/lib/authentication/ui/AuthCard.tsx +7 -7
- package/src/lib/authentication/ui/EmailLinkCallbackUi.tsx +129 -125
- package/src/lib/authentication/ui/EmailLinkSentUi.tsx +105 -101
- package/src/lib/authentication/ui/EmailLinkSignInUi.tsx +100 -96
- package/src/lib/authentication/ui/EmailVerificationUi.tsx +128 -124
- package/src/lib/authentication/ui/ZudokuAuthUi.tsx +620 -616
- package/src/lib/components/AiAssistantMenuItems.tsx +102 -102
- package/src/lib/components/Autocomplete.tsx +123 -123
- package/src/lib/components/DeveloperHint.tsx +39 -35
- package/src/lib/components/Header.tsx +260 -260
- package/src/lib/components/Layout.tsx +53 -53
- package/src/lib/components/Main.tsx +51 -51
- package/src/lib/components/Mermaid.tsx +74 -70
- package/src/lib/components/MobileTopNavigation.tsx +276 -276
- package/src/lib/components/MultiSelect.tsx +86 -82
- package/src/lib/components/TopNavigation.tsx +103 -103
- package/src/lib/components/index.ts +26 -26
- package/src/lib/components/navigation/NavigationCategory.tsx +157 -157
- package/src/lib/components/navigation/NavigationFilterInput.tsx +35 -35
- package/src/lib/components/navigation/NavigationItem.tsx +181 -177
- package/src/lib/core/RouteGuard.tsx +193 -193
- package/src/lib/errors/ErrorMessage.tsx +50 -46
- package/src/lib/plugins/api-catalog/Catalog.tsx +80 -80
- package/src/lib/plugins/api-keys/CreateApiKey.tsx +128 -124
- package/src/lib/plugins/api-keys/CreateApiKeyDialog.tsx +49 -49
- package/src/lib/plugins/api-keys/SettingsApiKeys.tsx +72 -72
- package/src/lib/plugins/api-keys/settings/ApiKeyItem.tsx +342 -342
- package/src/lib/plugins/api-keys/settings/RevealApiKey.tsx +127 -127
- package/src/lib/plugins/markdown/MdxPage.tsx +285 -285
- package/src/lib/plugins/openapi/ApiHeader.tsx +96 -96
- package/src/lib/plugins/openapi/CollapsibleCode.tsx +88 -88
- package/src/lib/plugins/openapi/DownloadSchemaButton.tsx +94 -94
- package/src/lib/plugins/openapi/GeneratedExampleSidecarBox.tsx +52 -52
- package/src/lib/plugins/openapi/OperationListItem.tsx +183 -183
- package/src/lib/plugins/openapi/RequestBodySidecarBox.tsx +63 -63
- package/src/lib/plugins/openapi/ResponsesSidecarBox.tsx +120 -117
- package/src/lib/plugins/openapi/SchemaInfo.tsx +344 -344
- package/src/lib/plugins/openapi/SchemaList.tsx +113 -113
- package/src/lib/plugins/openapi/Sidecar.tsx +312 -309
- package/src/lib/plugins/openapi/SidecarExamples.tsx +177 -174
- package/src/lib/plugins/openapi/components/EnumValues.tsx +58 -58
- package/src/lib/plugins/openapi/components/ResponseContent.tsx +117 -114
- package/src/lib/plugins/openapi/playground/BodyPanel.tsx +274 -271
- package/src/lib/plugins/openapi/playground/CollapsibleHeader.tsx +51 -51
- package/src/lib/plugins/openapi/playground/ExamplesDropdown.tsx +60 -60
- package/src/lib/plugins/openapi/playground/Headers.tsx +188 -181
- package/src/lib/plugins/openapi/playground/IdentityDialog.tsx +75 -75
- package/src/lib/plugins/openapi/playground/IdentitySelector.tsx +38 -38
- package/src/lib/plugins/openapi/playground/ParamsGrid.tsx +45 -45
- package/src/lib/plugins/openapi/playground/Playground.tsx +602 -599
- package/src/lib/plugins/openapi/playground/PlaygroundDialog.tsx +56 -56
- package/src/lib/plugins/openapi/playground/QueryParams.tsx +151 -148
- package/src/lib/plugins/openapi/playground/RequestLoginDialog.tsx +70 -70
- package/src/lib/plugins/openapi/playground/request-panel/MultipartField.tsx +91 -91
- package/src/lib/plugins/openapi/playground/result-panel/AudioPlayer.tsx +50 -50
- package/src/lib/plugins/openapi/playground/result-panel/ResponseTab.tsx +355 -355
- package/src/lib/plugins/openapi/playground/result-panel/ResultPanel.tsx +106 -102
- package/src/lib/plugins/openapi/schema/SchemaPropertyItem.tsx +189 -184
- package/src/lib/plugins/openapi/schema/SchemaView.tsx +299 -299
- package/src/lib/plugins/search-pagefind/IndexingDialog.tsx +162 -162
- package/src/lib/plugins/search-pagefind/PagefindSearch.tsx +202 -202
- package/src/lib/plugins/search-pagefind/ResultList.tsx +122 -118
- package/src/lib/ui/ActionButton.tsx +21 -21
- package/src/lib/ui/Command.tsx +191 -191
- package/src/lib/util/MdxComponents.tsx +150 -150
- package/src/vite/config.ts +234 -231
- package/src/vite/dev-server.ts +291 -291
- package/src/vite/plugin-api-keys.ts +50 -50
- package/src/vite/plugin-api.ts +320 -318
- package/src/vite/plugin-auth.ts +38 -38
- package/src/vite/plugin-component.ts +45 -39
- package/src/vite/plugin-config.ts +75 -75
- package/src/vite/plugin-custom-pages.ts +36 -36
- package/src/vite/plugin-docs.ts +202 -202
- package/src/vite/plugin-markdown-export.ts +214 -214
- package/src/vite/plugin-mdx.ts +149 -149
- package/src/vite/plugin-navigation.ts +106 -106
- package/src/vite/plugin-search.ts +47 -47
- package/src/vite/plugin.ts +42 -42
- package/src/vite/prerender/prerender.ts +233 -233
|
@@ -1,96 +1,100 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
1
|
+
import { ActionButton } from "@lukoweb/apitogo/ui/ActionButton.js";
|
|
2
|
+
import {
|
|
3
|
+
Alert,
|
|
4
|
+
AlertDescription,
|
|
5
|
+
AlertTitle,
|
|
6
|
+
} from "@lukoweb/apitogo/ui/Alert.js";
|
|
7
|
+
import {
|
|
8
|
+
CardContent,
|
|
9
|
+
CardDescription,
|
|
10
|
+
CardHeader,
|
|
11
|
+
CardTitle,
|
|
12
|
+
} from "@lukoweb/apitogo/ui/Card.js";
|
|
13
|
+
import { Input } from "@lukoweb/apitogo/ui/Input.js";
|
|
14
|
+
import { useMutation } from "@tanstack/react-query";
|
|
15
|
+
import { useForm } from "react-hook-form";
|
|
16
|
+
import { Link, useNavigate, useSearchParams } from "react-router";
|
|
17
|
+
import {
|
|
18
|
+
Form,
|
|
19
|
+
FormControl,
|
|
20
|
+
FormItem,
|
|
21
|
+
FormLabel,
|
|
22
|
+
FormMessage,
|
|
23
|
+
} from "../../ui/Form.js";
|
|
24
|
+
import { AuthCard } from "./AuthCard.js";
|
|
25
|
+
|
|
26
|
+
type EmailLinkFormFields = {
|
|
27
|
+
email: string;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const EmailLinkSignInUi = ({
|
|
31
|
+
onSubmit,
|
|
32
|
+
}: {
|
|
33
|
+
onSubmit: (email: string, redirectTo?: string) => Promise<void>;
|
|
34
|
+
}) => {
|
|
35
|
+
const navigate = useNavigate();
|
|
36
|
+
const [searchParams] = useSearchParams();
|
|
37
|
+
const redirectTo = searchParams.get("redirectTo");
|
|
38
|
+
|
|
39
|
+
const mutation = useMutation({
|
|
40
|
+
mutationFn: ({ email }: EmailLinkFormFields) =>
|
|
41
|
+
onSubmit(email, redirectTo ?? undefined),
|
|
42
|
+
onSuccess: () => {
|
|
43
|
+
void navigate(
|
|
44
|
+
redirectTo
|
|
45
|
+
? `/signin/email-link-sent?redirectTo=${encodeURIComponent(redirectTo)}`
|
|
46
|
+
: "/signin/email-link-sent",
|
|
47
|
+
);
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const form = useForm<EmailLinkFormFields>({
|
|
52
|
+
defaultValues: { email: "" },
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<AuthCard>
|
|
57
|
+
<CardHeader>
|
|
58
|
+
<CardTitle>Sign in with email link</CardTitle>
|
|
59
|
+
<CardDescription>
|
|
60
|
+
Enter your email and we'll send you a link to sign in.
|
|
61
|
+
</CardDescription>
|
|
62
|
+
</CardHeader>
|
|
63
|
+
<CardContent className="flex flex-col gap-4">
|
|
64
|
+
{mutation.error && (
|
|
65
|
+
<Alert variant="destructive">
|
|
66
|
+
<AlertTitle>Error</AlertTitle>
|
|
67
|
+
<AlertDescription>{mutation.error.message}</AlertDescription>
|
|
68
|
+
</Alert>
|
|
69
|
+
)}
|
|
70
|
+
<Form {...form}>
|
|
71
|
+
<form
|
|
72
|
+
onSubmit={form.handleSubmit((data) =>
|
|
73
|
+
mutation.mutate({ email: data.email }),
|
|
74
|
+
)}
|
|
75
|
+
className="flex flex-col gap-2"
|
|
76
|
+
>
|
|
77
|
+
<FormItem>
|
|
78
|
+
<FormLabel>E-Mail</FormLabel>
|
|
79
|
+
<FormControl>
|
|
80
|
+
<Input
|
|
81
|
+
placeholder="you@example.com"
|
|
82
|
+
type="email"
|
|
83
|
+
required
|
|
84
|
+
{...form.register("email", { required: true })}
|
|
85
|
+
/>
|
|
86
|
+
</FormControl>
|
|
87
|
+
<FormMessage />
|
|
88
|
+
</FormItem>
|
|
89
|
+
<ActionButton type="submit" isPending={mutation.isPending}>
|
|
90
|
+
Send sign-in link
|
|
91
|
+
</ActionButton>
|
|
92
|
+
</form>
|
|
93
|
+
</Form>
|
|
94
|
+
<Link to="/signin" className="text-sm text-muted-foreground">
|
|
95
|
+
Back to sign in
|
|
96
|
+
</Link>
|
|
97
|
+
</CardContent>
|
|
98
|
+
</AuthCard>
|
|
99
|
+
);
|
|
100
|
+
};
|
|
@@ -1,124 +1,128 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
<
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
{resendMutation.
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
</
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
1
|
+
import { ActionButton } from "@lukoweb/apitogo/ui/ActionButton.js";
|
|
2
|
+
import {
|
|
3
|
+
Alert,
|
|
4
|
+
AlertDescription,
|
|
5
|
+
AlertTitle,
|
|
6
|
+
} from "@lukoweb/apitogo/ui/Alert.js";
|
|
7
|
+
import { Button } from "@lukoweb/apitogo/ui/Button.js";
|
|
8
|
+
import {
|
|
9
|
+
Card,
|
|
10
|
+
CardContent,
|
|
11
|
+
CardDescription,
|
|
12
|
+
CardHeader,
|
|
13
|
+
CardTitle,
|
|
14
|
+
} from "@lukoweb/apitogo/ui/Card.js";
|
|
15
|
+
import { useMutation, useQuery } from "@tanstack/react-query";
|
|
16
|
+
import { CheckIcon, MailCheck, RefreshCw } from "lucide-react";
|
|
17
|
+
import { Navigate, useSearchParams } from "react-router";
|
|
18
|
+
import createVariantComponent from "../../util/createVariantComponent.js";
|
|
19
|
+
import { getRelativeRedirectUrl } from "../utils/relativeRedirectUrl.js";
|
|
20
|
+
|
|
21
|
+
export const EmailVerificationUi = ({
|
|
22
|
+
onResendVerification,
|
|
23
|
+
onCheckVerification,
|
|
24
|
+
}: {
|
|
25
|
+
onResendVerification: () => Promise<void>;
|
|
26
|
+
onCheckVerification: () => Promise<boolean>;
|
|
27
|
+
}) => {
|
|
28
|
+
const [searchParams] = useSearchParams();
|
|
29
|
+
const redirectTo = searchParams.get("redirectTo");
|
|
30
|
+
const relativeRedirectTo = getRelativeRedirectUrl(redirectTo);
|
|
31
|
+
|
|
32
|
+
const resendMutation = useMutation({
|
|
33
|
+
mutationFn: () => onResendVerification(),
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const checkVerificationMutation = useQuery({
|
|
37
|
+
queryKey: ["check-verification"],
|
|
38
|
+
queryFn: () => onCheckVerification(),
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const error = resendMutation.error ?? checkVerificationMutation.error ?? null;
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<AuthCard>
|
|
45
|
+
{checkVerificationMutation.data === true && (
|
|
46
|
+
<Navigate to={relativeRedirectTo} />
|
|
47
|
+
)}
|
|
48
|
+
<CardHeader className="text-center">
|
|
49
|
+
<div className="mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-primary/10">
|
|
50
|
+
<MailCheck className="h-8 w-8 text-primary" />
|
|
51
|
+
</div>
|
|
52
|
+
<CardTitle>Verify your email</CardTitle>
|
|
53
|
+
<CardDescription>We've sent a verification link</CardDescription>
|
|
54
|
+
</CardHeader>
|
|
55
|
+
<CardContent className="flex flex-col gap-4">
|
|
56
|
+
{error && (
|
|
57
|
+
<Alert variant="destructive">
|
|
58
|
+
<AlertTitle>Error</AlertTitle>
|
|
59
|
+
<AlertDescription>{error?.message}</AlertDescription>
|
|
60
|
+
</Alert>
|
|
61
|
+
)}
|
|
62
|
+
|
|
63
|
+
{resendMutation.isSuccess && (
|
|
64
|
+
<Alert>
|
|
65
|
+
<AlertTitle>Email sent</AlertTitle>
|
|
66
|
+
<AlertDescription>
|
|
67
|
+
A new verification email has been sent. Please check your inbox.
|
|
68
|
+
</AlertDescription>
|
|
69
|
+
</Alert>
|
|
70
|
+
)}
|
|
71
|
+
|
|
72
|
+
{checkVerificationMutation.isSuccess &&
|
|
73
|
+
!checkVerificationMutation.data && (
|
|
74
|
+
<Alert>
|
|
75
|
+
<AlertDescription>
|
|
76
|
+
{checkVerificationMutation.isFetching
|
|
77
|
+
? "Checking verification..."
|
|
78
|
+
: "Your email hasn't been verified yet. Please check your inbox and click the verification link."}
|
|
79
|
+
</AlertDescription>
|
|
80
|
+
</Alert>
|
|
81
|
+
)}
|
|
82
|
+
|
|
83
|
+
<div className="space-y-4">
|
|
84
|
+
<ActionButton
|
|
85
|
+
onClick={() => void checkVerificationMutation.refetch()}
|
|
86
|
+
isPending={checkVerificationMutation.isFetching}
|
|
87
|
+
className="w-full"
|
|
88
|
+
>
|
|
89
|
+
<div className="flex items-center gap-2">
|
|
90
|
+
<CheckIcon className="h-4 w-4" /> Continue
|
|
91
|
+
</div>
|
|
92
|
+
</ActionButton>
|
|
93
|
+
|
|
94
|
+
<div className="relative">
|
|
95
|
+
<div className="absolute inset-0 flex items-center">
|
|
96
|
+
<span className="w-full border-t" />
|
|
97
|
+
</div>
|
|
98
|
+
<div className="relative flex justify-center text-sm">
|
|
99
|
+
<span className="bg-card px-2 text-muted-foreground">
|
|
100
|
+
Didn't receive the email?
|
|
101
|
+
</span>
|
|
102
|
+
</div>
|
|
103
|
+
</div>
|
|
104
|
+
|
|
105
|
+
<Button
|
|
106
|
+
variant="outline"
|
|
107
|
+
onClick={() => void resendMutation.mutate()}
|
|
108
|
+
disabled={resendMutation.isPending}
|
|
109
|
+
className="w-full gap-2"
|
|
110
|
+
>
|
|
111
|
+
{resendMutation.isPending ? (
|
|
112
|
+
<RefreshCw className="h-4 w-4 animate-spin" />
|
|
113
|
+
) : (
|
|
114
|
+
<RefreshCw className="h-4 w-4" />
|
|
115
|
+
)}
|
|
116
|
+
Resend verification email
|
|
117
|
+
</Button>
|
|
118
|
+
</div>
|
|
119
|
+
|
|
120
|
+
<p className="text-center text-xs text-muted-foreground">
|
|
121
|
+
Make sure to check your spam folder if you don't see the email.
|
|
122
|
+
</p>
|
|
123
|
+
</CardContent>
|
|
124
|
+
</AuthCard>
|
|
125
|
+
);
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
const AuthCard = createVariantComponent(Card, "max-w-md w-full mt-10 mx-auto");
|