@tulip-systems/core 0.5.13 → 0.5.15
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/auth/client.d.mts +5 -4
- package/dist/auth/client.mjs +6 -5
- package/dist/auth.mjs +2 -2
- package/dist/components/client.mjs +2 -2
- package/dist/components/common/icons.d.mts +52 -52
- package/dist/components/common/status.d.mts +3 -3
- package/dist/components/editor/components/content.client.d.mts +2 -2
- package/dist/components/editor/components/editor.client.d.mts +6 -6
- package/dist/components/editor/components/editor.client.d.mts.map +1 -1
- package/dist/components/editor/components/menu.client.d.mts +3 -3
- package/dist/components/header/back-button.client.d.mts +2 -2
- package/dist/components/header/bottom-bar.client.d.mts +3 -3
- package/dist/components/header/breadcrumbs.client.d.mts +7 -7
- package/dist/components/header/header.client.d.mts +2 -2
- package/dist/components/header/mobile-nav-switcher.client.d.mts +2 -2
- package/dist/components/header/top-bar.client.d.mts +4 -4
- package/dist/components/layouts/admin-content.client.d.mts +2 -2
- package/dist/components/layouts/admin-error-pages.d.mts +4 -4
- package/dist/components/layouts/admin-layout.d.mts +2 -2
- package/dist/components/layouts/admin-layout.mjs +1 -1
- package/dist/components/layouts/admin-layout.mjs.map +1 -1
- package/dist/components/layouts/admin-loading.d.mts +2 -2
- package/dist/components/layouts/empty-page.d.mts +4 -4
- package/dist/components/layouts/error-page.d.mts +9 -9
- package/dist/components/layouts/error-sections.d.mts +5 -5
- package/dist/components/layouts/list-layout.d.mts +2 -2
- package/dist/components/layouts/providers.client.d.mts +2 -2
- package/dist/components/layouts/root-error-pages.d.mts +2 -2
- package/dist/components/layouts/root-layout.server.d.mts +4 -4
- package/dist/components/layouts/root-layout.server.d.mts.map +1 -1
- package/dist/components/layouts/root-loading.d.mts +2 -2
- package/dist/components/layouts/tab-layout.d.mts +2 -2
- package/dist/components/lists/data-list.d.mts +5 -5
- package/dist/components/lists/data-stack.d.mts +8 -8
- package/dist/components/navigation/admin-sidebar-header.client.mjs +3 -2
- package/dist/components/navigation/admin-sidebar-header.client.mjs.map +1 -1
- package/dist/components/navigation/admin-sidebar-paths.client.d.mts +10 -10
- package/dist/components/ui/accordion.d.mts +5 -5
- package/dist/components/ui/alert-dialog.d.mts +12 -12
- package/dist/components/ui/alert.d.mts +6 -6
- package/dist/components/ui/aspect-ratio.d.mts +2 -2
- package/dist/components/ui/avatar.client.d.mts +4 -4
- package/dist/components/ui/badge.d.mts +4 -4
- package/dist/components/ui/breadcrumb.d.mts +8 -8
- package/dist/components/ui/button.d.mts +4 -4
- package/dist/components/ui/calendar.d.mts +3 -3
- package/dist/components/ui/card.d.mts +7 -7
- package/dist/components/ui/carousel.d.mts +6 -6
- package/dist/components/ui/chart.client.d.mts +5 -5
- package/dist/components/ui/checkbox.d.mts +2 -2
- package/dist/components/ui/collapsible.client.d.mts +4 -4
- package/dist/components/ui/color-picker.client.d.mts +2 -2
- package/dist/components/ui/combobox-dropdown.client.d.mts +2 -2
- package/dist/components/ui/combobox.client.d.mts +2 -2
- package/dist/components/ui/command.d.mts +10 -10
- package/dist/components/ui/context-menu.d.mts +16 -16
- package/dist/components/ui/date-picker.client.d.mts +2 -2
- package/dist/components/ui/dialog.client.d.mts +11 -11
- package/dist/components/ui/drawer.client.d.mts +11 -11
- package/dist/components/ui/dropdown-menu.d.mts +16 -16
- package/dist/components/ui/form.client.d.mts +7 -7
- package/dist/components/ui/hover-card.client.d.mts +4 -4
- package/dist/components/ui/input-recipient.d.mts +2 -2
- package/dist/components/ui/input.d.mts +2 -2
- package/dist/components/ui/label.d.mts +2 -2
- package/dist/components/ui/navigation-menu.d.mts +11 -11
- package/dist/components/ui/pagination.d.mts +8 -8
- package/dist/components/ui/popover.d.mts +5 -5
- package/dist/components/ui/progress.client.d.mts +2 -2
- package/dist/components/ui/radio-group.d.mts +3 -3
- package/dist/components/ui/resizable.client.d.mts +4 -4
- package/dist/components/ui/scroll-area.d.mts +3 -3
- package/dist/components/ui/select.client.d.mts +11 -11
- package/dist/components/ui/separator.d.mts +2 -2
- package/dist/components/ui/sheet.client.d.mts +9 -9
- package/dist/components/ui/sidebar.client.d.mts +26 -26
- package/dist/components/ui/skeleton.d.mts +2 -2
- package/dist/components/ui/slider.d.mts +2 -2
- package/dist/components/ui/sonner.client.d.mts +2 -2
- package/dist/components/ui/sonner.client.mjs +1 -1
- package/dist/components/ui/switch.d.mts +2 -2
- package/dist/components/ui/tabs.d.mts +5 -5
- package/dist/components/ui/textarea.d.mts +2 -2
- package/dist/components/ui/time-input.client.d.mts +2 -2
- package/dist/components/ui/toggle-group.client.d.mts +3 -3
- package/dist/components/ui/toggle.d.mts +4 -4
- package/dist/components/ui/toggle.d.mts.map +1 -1
- package/dist/components/ui/tooltip.client.d.mts +5 -5
- package/dist/components.mjs +2 -2
- package/dist/lib/client.mjs +1 -1
- package/dist/lib/hooks/use-action.d.mts +2 -2
- package/dist/lib/hooks/use-indicator.d.mts +2 -2
- package/dist/modules/auth/components/allowed.client.d.mts +2 -2
- package/dist/modules/auth/components/allowed.client.mjs +2 -3
- package/dist/modules/auth/components/allowed.client.mjs.map +1 -1
- package/dist/modules/auth/components/auth-layout.server.d.mts +2 -2
- package/dist/modules/auth/components/auth-layout.server.d.mts.map +1 -1
- package/dist/modules/auth/components/auth-loading.d.mts +2 -2
- package/dist/modules/auth/components/create-first-user-page.client.d.mts +2 -2
- package/dist/modules/auth/components/create-first-user-page.client.mjs +4 -3
- package/dist/modules/auth/components/create-first-user-page.client.mjs.map +1 -1
- package/dist/modules/auth/components/forget-password-page.client.d.mts +2 -2
- package/dist/modules/auth/components/forget-password-page.client.mjs +4 -3
- package/dist/modules/auth/components/forget-password-page.client.mjs.map +1 -1
- package/dist/modules/auth/components/guard-first-user.server.d.mts +2 -2
- package/dist/modules/auth/components/guard-first-user.server.d.mts.map +1 -1
- package/dist/modules/auth/components/guard.server.d.mts +3 -2
- package/dist/modules/auth/components/guard.server.d.mts.map +1 -1
- package/dist/modules/auth/components/guard.server.mjs +1 -0
- package/dist/modules/auth/components/guard.server.mjs.map +1 -1
- package/dist/modules/auth/components/login-page.client.d.mts +2 -2
- package/dist/modules/auth/components/login-page.client.mjs +4 -3
- package/dist/modules/auth/components/login-page.client.mjs.map +1 -1
- package/dist/modules/auth/components/reset-password-page.client.d.mts +2 -2
- package/dist/modules/auth/components/reset-password-page.client.mjs +4 -3
- package/dist/modules/auth/components/reset-password-page.client.mjs.map +1 -1
- package/dist/modules/auth/components/update-password-command.d.mts +2 -2
- package/dist/modules/auth/components/update-password-command.mjs +1 -1
- package/dist/modules/auth/handler/{client.client.d.mts → create-client.client.d.mts} +288 -168
- package/dist/modules/auth/handler/create-client.client.d.mts.map +1 -0
- package/dist/modules/auth/handler/create-client.client.mjs +26 -0
- package/dist/modules/auth/handler/create-client.client.mjs.map +1 -0
- package/dist/modules/auth/handler/init.d.mts +133 -133
- package/dist/modules/auth/handler/init.d.mts.map +1 -1
- package/dist/modules/auth/hooks/use-auth-client.d.mts +24 -0
- package/dist/modules/auth/hooks/use-auth-client.d.mts.map +1 -0
- package/dist/modules/auth/hooks/use-auth-client.mjs +31 -0
- package/dist/modules/auth/hooks/use-auth-client.mjs.map +1 -0
- package/dist/modules/auth/hooks/use-permission.d.mts +8 -35
- package/dist/modules/auth/hooks/use-permission.d.mts.map +1 -1
- package/dist/modules/auth/hooks/use-permission.mjs +47 -93
- package/dist/modules/auth/hooks/use-permission.mjs.map +1 -1
- package/dist/modules/auth/hooks/use-session.d.mts +5 -119
- package/dist/modules/auth/hooks/use-session.d.mts.map +1 -1
- package/dist/modules/auth/hooks/use-session.mjs +15 -17
- package/dist/modules/auth/hooks/use-session.mjs.map +1 -1
- package/dist/modules/auth/lib/helpers.server.mjs +1 -1
- package/dist/modules/auth/lib/validators.d.mts +2 -2
- package/dist/modules/auth/lib/validators.d.mts.map +1 -1
- package/dist/modules/commands/components/alert-dialog-command.client.d.mts +11 -11
- package/dist/modules/commands/components/click-command.client.d.mts +2 -2
- package/dist/modules/commands/components/command-trigger.client.d.mts +4 -4
- package/dist/modules/commands/components/dialog-command.client.d.mts +8 -8
- package/dist/modules/commands/components/dropdown-command.client.d.mts +5 -5
- package/dist/modules/commands/components/empty-command.client.d.mts +2 -2
- package/dist/modules/commands/components/form-dialog-command.client.d.mts +12 -12
- package/dist/modules/commands/hooks/use-command-menu.client.mjs.map +1 -1
- package/dist/modules/commands/hooks/use-command-mutation.client.mjs +1 -1
- package/dist/modules/commands/menus/context-menu.client.d.mts +2 -2
- package/dist/modules/commands/menus/dropdown-menu.client.d.mts +3 -3
- package/dist/modules/commands/menus/inline-menu.client.d.mts +3 -3
- package/dist/modules/commands/menus/responsive-menu.client.d.mts +3 -3
- package/dist/modules/commands/utils/archive-command.client.d.mts +3 -3
- package/dist/modules/commands/utils/delete-command.client.d.mts +3 -3
- package/dist/modules/config/db/helpers.d.mts +5 -5
- package/dist/modules/config/db/helpers.d.mts.map +1 -1
- package/dist/modules/config/lib/config.d.mts +1 -1
- package/dist/modules/config/lib/config.mjs.map +1 -1
- package/dist/modules/data-tables/components/cell/common.client.d.mts +5 -5
- package/dist/modules/data-tables/components/filters/combobox.client.d.mts +2 -2
- package/dist/modules/data-tables/components/filters/slider.client.d.mts +2 -2
- package/dist/modules/data-tables/components/search-input.client.d.mts +2 -2
- package/dist/modules/data-tables/hooks/use-context.client.d.mts +2 -2
- package/dist/modules/data-tables/strategies/helpers/sorting.mjs +1 -1
- package/dist/modules/data-tables/tables/data-table/components/table.d.mts +2 -2
- package/dist/modules/data-tables/tables/inline-table/components/cells/common.d.mts +2 -2
- package/dist/modules/data-tables/tables/inline-table/components/cells/drag-handle.client.d.mts +2 -2
- package/dist/modules/data-tables/tables/inline-table/components/cells/read-only.d.mts +2 -2
- package/dist/modules/data-tables/tables/inline-table/components/table.d.mts +2 -2
- package/dist/modules/data-tables/tables/inline-table/hooks/context.client.d.mts +2 -2
- package/dist/modules/inline-edit/components/combobox-dropdown.client.d.mts +2 -2
- package/dist/modules/inline-edit/components/combobox-dropdown.client.d.mts.map +1 -1
- package/dist/modules/inline-edit/components/combobox.client.d.mts +2 -2
- package/dist/modules/inline-edit/components/combobox.client.d.mts.map +1 -1
- package/dist/modules/inline-edit/components/date-input.client.d.mts +2 -2
- package/dist/modules/inline-edit/components/date-input.client.d.mts.map +1 -1
- package/dist/modules/inline-edit/components/date-picker.client.d.mts +2 -2
- package/dist/modules/inline-edit/components/date-picker.client.d.mts.map +1 -1
- package/dist/modules/inline-edit/components/editor.client.d.mts +2 -2
- package/dist/modules/inline-edit/components/input-recipient.client.d.mts +2 -2
- package/dist/modules/inline-edit/components/input-toggle.client.d.mts +2 -2
- package/dist/modules/inline-edit/components/input.client.d.mts +4 -4
- package/dist/modules/inline-edit/components/select.client.d.mts +6 -6
- package/dist/modules/inline-edit/components/switch.client.d.mts +2 -2
- package/dist/modules/inline-edit/components/toggle.client.d.mts +2 -2
- package/dist/modules/inline-edit/hooks/context.client.d.mts +2 -2
- package/dist/modules/inline-edit/hooks/context.client.d.mts.map +1 -1
- package/dist/modules/inline-edit/hooks/use-inline.client.mjs +2 -6
- package/dist/modules/inline-edit/hooks/use-inline.client.mjs.map +1 -1
- package/dist/modules/storage/components/dropzone.client.d.mts +4 -4
- package/dist/modules/storage/components/image-grid.client.d.mts +3 -3
- package/dist/modules/storage/components/image-grid.client.mjs +1 -1
- package/dist/modules/storage/components/upload-zone.client.d.mts +2 -2
- package/dist/modules/storage/components/upload-zone.client.mjs +1 -2
- package/dist/modules/storage/components/upload-zone.client.mjs.map +1 -1
- package/dist/modules/storage/lib/create-upload.client.d.mts.map +1 -1
- package/dist/modules/storage/lib/proxy.server.mjs +1 -1
- package/dist/modules/storage/lib/router.server.d.mts +2354 -2324
- package/dist/modules/storage/lib/router.server.d.mts.map +1 -1
- package/dist/modules/storage/lib/router.server.mjs +2 -3
- package/dist/modules/storage/lib/router.server.mjs.map +1 -1
- package/dist/modules/storage/lib/service.server.d.mts +18 -18
- package/dist/modules/storage/lib/validators.d.mts +90 -90
- package/dist/modules/storage/lib/validators.d.mts.map +1 -1
- package/package.json +1 -1
- package/src/components/layouts/admin-layout.tsx +1 -3
- package/src/components/navigation/admin-sidebar-header.client.tsx +3 -20
- package/src/modules/auth/components/allowed.client.tsx +2 -2
- package/src/modules/auth/components/create-first-user-page.client.tsx +3 -2
- package/src/modules/auth/components/forget-password-page.client.tsx +2 -1
- package/src/modules/auth/components/guard.server.tsx +2 -0
- package/src/modules/auth/components/login-page.client.tsx +2 -1
- package/src/modules/auth/components/reset-password-page.client.tsx +3 -1
- package/src/modules/auth/entry.client.ts +13 -1
- package/src/modules/auth/entry.ts +11 -0
- package/src/modules/auth/handler/create-client.client.ts +53 -0
- package/src/modules/auth/hooks/use-auth-client.tsx +38 -0
- package/src/modules/auth/hooks/use-permission.ts +49 -94
- package/src/modules/auth/hooks/use-session.ts +16 -16
- package/src/modules/commands/hooks/use-command-menu.client.tsx +0 -6
- package/src/modules/config/lib/config.ts +3 -2
- package/src/modules/inline-edit/hooks/use-inline.client.tsx +1 -1
- package/src/modules/storage/components/upload-zone.client.tsx +0 -2
- package/src/modules/storage/lib/router.server.ts +5 -4
- package/dist/modules/auth/handler/client.client.d.mts.map +0 -1
- package/dist/modules/auth/handler/client.client.mjs +0 -21
- package/dist/modules/auth/handler/client.client.mjs.map +0 -1
- package/src/modules/auth/components/guard.client.tsx +0 -12
- package/src/modules/auth/handler/client.client.ts +0 -16
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validators.d.mts","names":[],"sources":["../../../../src/modules/storage/lib/validators.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;KAYY,IAAA,UAAc,KAAA,CAAM;AAApB,KACA,QAAA,GADc,OACI,KAAA,CAAM,YADQ,GAAA;EAChC,IAAA,EAAA,MAAQ;AACpB,CAAA;AAKa,KALD,UAAA,GAKiD,OAL7B,KAAA,CAAM,YAKX,GAAA;EACf,IAAA,EAAA,QAAQ;AAKpB,CAAA;;;;cANa,gBAAc,GAAA,CAAA;;;;KACf,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAI7B,gBAAA,GAAmB,GAAA,CAAE,aAAa;KAClC,4BAAA,GAA+B,GAAA,CAAE,aAAa;;;;cAK7C,yBAAuB,GAAA,CAAA,QAAA,GAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAaxB,iBAAA,GAAoB,GAAA,CAAE,aAAa;;;;cAKlC,wBAAsB,GAAA,CAAA;;;;;;;;;;;;;;;;;;;;;KAOvB,sBAAA,GAAyB,GAAA,CAAE,aAAa;;;;cAKvC,kBAAgB,GAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAEjB,gBAAA,GAAmB,GAAA,CAAE,aAAa;;;;cAKjC,mBAAiB,GAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAElB,iBAAA,GAAoB,GAAA,CAAE,aAAa;;;;cAKlC;;;;cAEA,kBAAgB,GAAA,CAAA;;;;;;;;;;KAKjB,eAAA,GAAkB,GAAA,CAAE,aAAa;KACjC,gBAAA,GAAmB,GAAA,CAAE,aAAa;;;;cAKjC,0BAAwB,GAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAIzB,uBAAA,GAA0B,GAAA,CAAE,aAAa;;;;cAKxC,iBAAe,GAAA,CAAA;;;;;;;;KAMhB,cAAA,GAAiB,GAAA,CAAE,aAAa;KAChC,eAAA,GAAkB,GAAA,CAAE,aAAa;;;;cAKhC,iBAAe,GAAA,CAAA;;;;;;;;;;;KAShB,cAAA,GAAiB,GAAA,CAAE,aAAa;SACnC;;KAGG,eAAA,GAAkB,GAAA,CAAE,aAAa"}
|
package/package.json
CHANGED
|
@@ -3,8 +3,6 @@ import { SidebarProvider } from "../ui/sidebar.client";
|
|
|
3
3
|
|
|
4
4
|
export function AdminLayout(props: PropsWithChildren) {
|
|
5
5
|
return (
|
|
6
|
-
<SidebarProvider className="max-h-
|
|
7
|
-
{props.children}
|
|
8
|
-
</SidebarProvider>
|
|
6
|
+
<SidebarProvider className="max-h-dvh overflow-hidden border">{props.children}</SidebarProvider>
|
|
9
7
|
);
|
|
10
8
|
}
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
DropdownMenuTrigger,
|
|
14
14
|
} from "@/components/ui/dropdown-menu";
|
|
15
15
|
import { cn } from "@/lib/utils/cn";
|
|
16
|
-
import {
|
|
16
|
+
import { useAuthClient } from "@/modules/auth/hooks/use-auth-client";
|
|
17
17
|
import { useSession } from "@/modules/auth/hooks/use-session";
|
|
18
18
|
import {
|
|
19
19
|
ChevronsUpDownIcon,
|
|
@@ -32,13 +32,14 @@ import { SidebarHeader, useSidebar } from "../ui/sidebar.client";
|
|
|
32
32
|
|
|
33
33
|
export function AdminSidebarHeader() {
|
|
34
34
|
const router = useRouter();
|
|
35
|
+
const authClient = useAuthClient();
|
|
35
36
|
const { theme, setTheme } = useTheme();
|
|
36
37
|
|
|
37
38
|
const [open, setOpen] = React.useState(false);
|
|
38
39
|
|
|
39
40
|
const { setOpenMobile } = useSidebar();
|
|
40
41
|
|
|
41
|
-
const sessionQuery = useSession();
|
|
42
|
+
const sessionQuery = useSession(authClient);
|
|
42
43
|
|
|
43
44
|
return (
|
|
44
45
|
<SidebarHeader>
|
|
@@ -105,24 +106,6 @@ export function AdminSidebarHeader() {
|
|
|
105
106
|
</DropdownMenuSubContent>
|
|
106
107
|
</DropdownMenuSub>
|
|
107
108
|
|
|
108
|
-
{/*
|
|
109
|
-
<DropdownMenuItem
|
|
110
|
-
onClick={() => {
|
|
111
|
-
setOpenMobile(false);
|
|
112
|
-
setOpen(false);
|
|
113
|
-
authClient.passkey.addPasskey({
|
|
114
|
-
fetchOptions: {
|
|
115
|
-
onSuccess: () => {
|
|
116
|
-
toast.success("Passkey succesvol toegevoegd");
|
|
117
|
-
},
|
|
118
|
-
},
|
|
119
|
-
});
|
|
120
|
-
}}
|
|
121
|
-
>
|
|
122
|
-
<Icons.add className="mr-2 h-4 w-4" />
|
|
123
|
-
<span>Passkey</span>
|
|
124
|
-
</DropdownMenuItem> */}
|
|
125
|
-
|
|
126
109
|
<DropdownMenuItem
|
|
127
110
|
onClick={() => {
|
|
128
111
|
setOpenMobile(false);
|
|
@@ -42,9 +42,9 @@ export type AllowedProps = UsePermissionProps & {
|
|
|
42
42
|
* Allowed
|
|
43
43
|
*/
|
|
44
44
|
export function Allowed({ permission, strategy, fallback, children }: AllowedProps) {
|
|
45
|
-
const
|
|
45
|
+
const data = usePermission({ permission, strategy } as UsePermissionProps);
|
|
46
46
|
|
|
47
|
-
if (data
|
|
47
|
+
if (data.success) return <>{children}</>;
|
|
48
48
|
|
|
49
49
|
return <>{fallback}</>;
|
|
50
50
|
}
|
|
@@ -22,10 +22,11 @@ import { Eye, EyeOff } from "lucide-react";
|
|
|
22
22
|
import { useRouter } from "next/navigation";
|
|
23
23
|
import { useState } from "react";
|
|
24
24
|
import { useForm } from "react-hook-form";
|
|
25
|
-
import {
|
|
25
|
+
import { useAuthClient } from "../hooks/use-auth-client";
|
|
26
26
|
|
|
27
27
|
export function CreateFirstUserPage() {
|
|
28
28
|
const router = useRouter();
|
|
29
|
+
const authClient = useAuthClient();
|
|
29
30
|
const [callbackURL] = useQueryState("callbackURL", parseAsString);
|
|
30
31
|
const [showPassword, setShowPassword] = useState(false);
|
|
31
32
|
|
|
@@ -62,7 +63,7 @@ export function CreateFirstUserPage() {
|
|
|
62
63
|
disabled,
|
|
63
64
|
});
|
|
64
65
|
|
|
65
|
-
if(Object.keys(form.formState.errors).length > 0) {
|
|
66
|
+
if (Object.keys(form.formState.errors).length > 0) {
|
|
66
67
|
console.error(form.formState.errors);
|
|
67
68
|
}
|
|
68
69
|
|
|
@@ -9,10 +9,11 @@ import React from "react";
|
|
|
9
9
|
import { useForm } from "react-hook-form";
|
|
10
10
|
import { toast } from "sonner";
|
|
11
11
|
import * as z from "zod";
|
|
12
|
-
import {
|
|
12
|
+
import { useAuthClient } from "../hooks/use-auth-client";
|
|
13
13
|
import { forgotPasswordSchema } from "../lib/validators";
|
|
14
14
|
|
|
15
15
|
export function ForgetPasswordPage() {
|
|
16
|
+
const authClient = useAuthClient();
|
|
16
17
|
const [isPending, startTransition] = React.useTransition();
|
|
17
18
|
|
|
18
19
|
const form = useForm<z.infer<typeof forgotPasswordSchema>>({
|
|
@@ -14,7 +14,7 @@ import { useState } from "react";
|
|
|
14
14
|
import { useForm } from "react-hook-form";
|
|
15
15
|
import { toast } from "sonner";
|
|
16
16
|
import * as z from "zod";
|
|
17
|
-
import {
|
|
17
|
+
import { useAuthClient } from "../hooks/use-auth-client";
|
|
18
18
|
import { loginSchema } from "../lib/validators";
|
|
19
19
|
|
|
20
20
|
type LoginPageProps = {
|
|
@@ -25,6 +25,7 @@ type LoginPageProps = {
|
|
|
25
25
|
|
|
26
26
|
export function LoginPage(props: LoginPageProps) {
|
|
27
27
|
const router = useRouter();
|
|
28
|
+
const authClient = useAuthClient();
|
|
28
29
|
const [callbackURL] = useQueryState("callbackURL", parseAsString);
|
|
29
30
|
const [showPassword, setShowPassword] = useState(false);
|
|
30
31
|
|
|
@@ -18,7 +18,7 @@ import React, { use, useState } from "react";
|
|
|
18
18
|
import { useForm } from "react-hook-form";
|
|
19
19
|
import { toast } from "sonner";
|
|
20
20
|
import * as z from "zod";
|
|
21
|
-
import {
|
|
21
|
+
import { useAuthClient } from "../hooks/use-auth-client";
|
|
22
22
|
import { resetPasswordSchema } from "../lib/validators";
|
|
23
23
|
|
|
24
24
|
export function ResetPasswordPage(params: {
|
|
@@ -27,6 +27,8 @@ export function ResetPasswordPage(params: {
|
|
|
27
27
|
const { email, otp } = use(params.searchParams);
|
|
28
28
|
|
|
29
29
|
const router = useRouter();
|
|
30
|
+
const authClient = useAuthClient();
|
|
31
|
+
|
|
30
32
|
const [showPassword, setShowPassword] = useState(false);
|
|
31
33
|
const [showPasswordConfirm, setShowPasswordConfirm] = useState(false);
|
|
32
34
|
|
|
@@ -1,9 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Components
|
|
3
|
+
*/
|
|
1
4
|
export * from "./components/allowed.client";
|
|
2
5
|
export * from "./components/create-first-user-page.client";
|
|
3
6
|
export * from "./components/forget-password-page.client";
|
|
4
7
|
export * from "./components/login-page.client";
|
|
5
8
|
export * from "./components/reset-password-page.client";
|
|
6
9
|
export * from "./components/update-password-command";
|
|
7
|
-
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Handlers
|
|
13
|
+
*/
|
|
14
|
+
export * from "./handler/create-client.client";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Hooks
|
|
18
|
+
*/
|
|
19
|
+
export * from "./hooks/use-auth-client";
|
|
8
20
|
export * from "./hooks/use-permission";
|
|
9
21
|
export * from "./hooks/use-session";
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import "client-only";
|
|
2
|
+
|
|
3
|
+
import { url } from "@/lib/utils/url";
|
|
4
|
+
import { passkeyClient } from "@better-auth/passkey/client";
|
|
5
|
+
import { adminClient, emailOTPClient, inferAdditionalFields } from "better-auth/client/plugins";
|
|
6
|
+
import { AccessControl, Role } from "better-auth/plugins";
|
|
7
|
+
import { createAuthClient as createBetterAuthClient } from "better-auth/react";
|
|
8
|
+
import { AuthClient } from "./init";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Create auth client
|
|
12
|
+
*/
|
|
13
|
+
export type CreateAuthClientProps<
|
|
14
|
+
TAccessControl extends AccessControl,
|
|
15
|
+
TRoles extends { [key in string]: Role },
|
|
16
|
+
> = {
|
|
17
|
+
/**
|
|
18
|
+
* Base URL for the auth client
|
|
19
|
+
*/
|
|
20
|
+
baseURL?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Access control instance
|
|
23
|
+
*/
|
|
24
|
+
ac: TAccessControl;
|
|
25
|
+
roles: TRoles;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export function createAuthClient<
|
|
29
|
+
TAccessControl extends AccessControl,
|
|
30
|
+
TRoles extends { [key in string]: Role },
|
|
31
|
+
>(props: CreateAuthClientProps<TAccessControl, TRoles>) {
|
|
32
|
+
const { ac, roles } = props;
|
|
33
|
+
|
|
34
|
+
const baseURL = props.baseURL ?? url();
|
|
35
|
+
|
|
36
|
+
return createBetterAuthClient({
|
|
37
|
+
baseURL,
|
|
38
|
+
plugins: [
|
|
39
|
+
emailOTPClient(),
|
|
40
|
+
passkeyClient(),
|
|
41
|
+
adminClient({ ac, roles }),
|
|
42
|
+
inferAdditionalFields<AuthClient>(),
|
|
43
|
+
],
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Client auth type
|
|
49
|
+
*/
|
|
50
|
+
export type ClientAuth<
|
|
51
|
+
TAccessControl extends AccessControl,
|
|
52
|
+
TRoles extends { [key in string]: Role },
|
|
53
|
+
> = ReturnType<typeof createAuthClient<TAccessControl, TRoles>>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { AccessControl, Role } from "better-auth/plugins";
|
|
4
|
+
import { createContext, PropsWithChildren, use } from "react";
|
|
5
|
+
import { ClientAuth } from "../handler/create-client.client";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Auth client context
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
export const AuthClientContext = createContext(null as unknown as ClientAuth<never, never>);
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Use auth client
|
|
15
|
+
*/
|
|
16
|
+
export function useAuthClient<
|
|
17
|
+
TAccessControl extends AccessControl = never,
|
|
18
|
+
TRoles extends { [key in string]: Role } = never,
|
|
19
|
+
>() {
|
|
20
|
+
const context = use(AuthClientContext);
|
|
21
|
+
if (!context) throw new Error("Auth client is not provided");
|
|
22
|
+
|
|
23
|
+
return context as ClientAuth<TAccessControl, TRoles>;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Auth client provider
|
|
28
|
+
*/
|
|
29
|
+
export function AuthProvider<
|
|
30
|
+
TAccessControl extends AccessControl,
|
|
31
|
+
TRoles extends { [key in string]: Role },
|
|
32
|
+
>(props: PropsWithChildren<{ authClient: ClientAuth<TAccessControl, TRoles> }>) {
|
|
33
|
+
return (
|
|
34
|
+
<AuthClientContext value={props.authClient as ClientAuth<never, never>}>
|
|
35
|
+
{props.children}
|
|
36
|
+
</AuthClientContext>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { useSuspenseQueries, useSuspenseQuery } from "@tanstack/react-query";
|
|
4
|
-
import { authClient } from "../handler/client.client";
|
|
5
3
|
import { type Permission } from "../lib/permissions";
|
|
4
|
+
import { useAuthClient } from "./use-auth-client";
|
|
6
5
|
import { useSession } from "./use-session";
|
|
7
6
|
|
|
8
|
-
/**
|
|
9
|
-
* UsePermission
|
|
10
|
-
*/
|
|
11
7
|
export type UsePermissionProps =
|
|
12
8
|
| {
|
|
13
9
|
/**
|
|
@@ -40,95 +36,54 @@ export type UsePermissionProps =
|
|
|
40
36
|
permission?: Permission[];
|
|
41
37
|
};
|
|
42
38
|
|
|
43
|
-
export function usePermission({ permission, strategy = "all" }: UsePermissionProps) {
|
|
44
|
-
const sessionQuery = useSession();
|
|
45
|
-
|
|
46
|
-
return useSuspenseQuery({
|
|
47
|
-
queryKey: ["permission", { permission, strategy }],
|
|
48
|
-
queryFn: async () => {
|
|
49
|
-
// If no permission is provided, allow by default
|
|
50
|
-
if (!permission) return { permission, success: true };
|
|
51
|
-
|
|
52
|
-
// If no user is logged in, deny by default
|
|
53
|
-
if (!sessionQuery.data) return { permission, success: false };
|
|
54
|
-
const userId = sessionQuery.data?.user.id;
|
|
55
|
-
if (!userId) return { permission, success: false };
|
|
56
|
-
|
|
57
|
-
// If the strategy is "any", check if the user has any of the permissions
|
|
58
|
-
const permissions = Array.isArray(permission) ? permission : [permission];
|
|
59
|
-
|
|
60
|
-
// Check if the user has the permission
|
|
61
|
-
const results = await Promise.all(
|
|
62
|
-
permissions.map((permission) => authClient.admin.hasPermission({ permission, userId })),
|
|
63
|
-
);
|
|
64
|
-
|
|
65
|
-
const data = results.map(({ data }) => data).filter((data) => !!data);
|
|
66
|
-
const errors = results.filter(({ error }) => !!error).map(({ error }) => error);
|
|
67
|
-
|
|
68
|
-
// If there is an error, log it and return false
|
|
69
|
-
if (errors.length > 0) {
|
|
70
|
-
console.error(...errors);
|
|
71
|
-
return { permission, success: false };
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// Determine if the user has the permission based on the strategy
|
|
75
|
-
const success =
|
|
76
|
-
strategy === "all"
|
|
77
|
-
? data.every(({ success }) => success)
|
|
78
|
-
: data.some(({ success }) => success);
|
|
79
|
-
|
|
80
|
-
// Return the result
|
|
81
|
-
return {
|
|
82
|
-
permission,
|
|
83
|
-
success,
|
|
84
|
-
};
|
|
85
|
-
},
|
|
86
|
-
staleTime: 5 * 60 * 1000, // 5 minutes
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
|
|
90
39
|
/**
|
|
91
|
-
*
|
|
92
|
-
* @param permission
|
|
93
|
-
* @param strategy
|
|
94
|
-
* @returns
|
|
95
|
-
* @deprecated Use `usePermission` with strategy "any" or "all" instead
|
|
40
|
+
* UsePermission
|
|
96
41
|
*/
|
|
97
|
-
export function
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
42
|
+
export function usePermission({ strategy = "all", permission }: UsePermissionProps) {
|
|
43
|
+
const authClient = useAuthClient();
|
|
44
|
+
const sessionQuery = useSession(authClient);
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* If no role is found in the session, deny by default
|
|
48
|
+
*/
|
|
49
|
+
const role = sessionQuery.data?.user.role;
|
|
50
|
+
if (!role) return { permission, success: false };
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* If no permission is provided, allow by default
|
|
54
|
+
*/
|
|
55
|
+
if (!permission) return { permission, success: true };
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* If the strategy is "any", check if the user has any of the permissions
|
|
59
|
+
*/
|
|
60
|
+
if (strategy === "any" && Array.isArray(permission)) {
|
|
61
|
+
const permissions = Array.isArray(permission) ? permission : [permission];
|
|
62
|
+
|
|
63
|
+
const success = permissions.some((permission) =>
|
|
64
|
+
authClient.admin.checkRolePermission({
|
|
65
|
+
role,
|
|
66
|
+
permissions: permission,
|
|
67
|
+
}),
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
return { permission, success };
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* If the strategy is "all", check if the user has all of the permissions
|
|
75
|
+
*/
|
|
76
|
+
if (strategy === "all" && !Array.isArray(permission)) {
|
|
77
|
+
const success = authClient.admin.checkRolePermission({
|
|
78
|
+
role,
|
|
79
|
+
permissions: permission,
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
return { permission, success };
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* If the strategy is not recognized, deny by default
|
|
87
|
+
*/
|
|
88
|
+
return { permission, success: false };
|
|
134
89
|
}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { useSuspenseQuery } from "@tanstack/react-query";
|
|
4
|
+
import { ClientAuth } from "../entry.client";
|
|
5
5
|
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
export function useSession(authClient: ClientAuth<never, never>) {
|
|
7
|
+
const session = useSuspenseQuery({
|
|
8
|
+
queryKey: ["session"],
|
|
9
|
+
queryFn: async () => {
|
|
10
|
+
const session = await authClient.getSession();
|
|
11
|
+
|
|
10
12
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
if (session.error) {
|
|
14
|
+
console.error(session.error);
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
});
|
|
18
|
+
return session.data;
|
|
19
|
+
},
|
|
20
|
+
staleTime: 1000 * 60 * 60,
|
|
21
|
+
});
|
|
20
22
|
|
|
21
|
-
export function useSession() {
|
|
22
|
-
const session = useSuspenseQuery(sessionQueryOptions);
|
|
23
23
|
return session;
|
|
24
24
|
}
|
|
@@ -112,9 +112,6 @@ export function useSingleCommandMenu<TData, TMeta>({
|
|
|
112
112
|
commands,
|
|
113
113
|
meta,
|
|
114
114
|
}: SingleCommandMenuProps<TData, TMeta> & { data: TData }) {
|
|
115
|
-
// const permissions = commands.map((command) => command.permission).filter(Boolean) as Permission[];
|
|
116
|
-
// usePermission(mergePermissions(permissions));
|
|
117
|
-
|
|
118
115
|
// filter out commands that don't have valid conditions
|
|
119
116
|
const validCommands = commands.filter((command) =>
|
|
120
117
|
command.mode === "single"
|
|
@@ -139,9 +136,6 @@ export function useBulkCommandMenu<TData, TMeta>({
|
|
|
139
136
|
commands,
|
|
140
137
|
meta,
|
|
141
138
|
}: BulkCommandMenuProps<TData, TMeta>) {
|
|
142
|
-
// const permissions = commands.map((command) => command.permission).filter(Boolean) as Permission[];
|
|
143
|
-
// usePermission(mergePermissions(permissions));
|
|
144
|
-
|
|
145
139
|
/**
|
|
146
140
|
* Filter out commands that don't have valid conditions
|
|
147
141
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type TulipConfig<TValues> = {
|
|
1
|
+
export type TulipConfig<TValues = object> = {
|
|
2
2
|
general: {
|
|
3
3
|
name: string;
|
|
4
4
|
shortName: string;
|
|
@@ -12,4 +12,5 @@ export type TulipConfig<TValues> = {
|
|
|
12
12
|
* Build the Tulip config
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
export const defineTulipConfig = <TValues>(config: TulipConfig<TValues>): TulipConfig<TValues> =>
|
|
15
|
+
export const defineTulipConfig = <TValues>(config: TulipConfig<TValues>): TulipConfig<TValues> =>
|
|
16
|
+
config;
|
|
@@ -86,7 +86,7 @@ export function useInlineEdit<
|
|
|
86
86
|
/**
|
|
87
87
|
* Permission guard
|
|
88
88
|
*/
|
|
89
|
-
const
|
|
89
|
+
const data = usePermission(props.permission ?? context.permission ?? {});
|
|
90
90
|
const isAllowed = data?.success;
|
|
91
91
|
|
|
92
92
|
/**
|
|
@@ -108,8 +108,6 @@ export function UploadZone({
|
|
|
108
108
|
|
|
109
109
|
const { getRootProps, getInputProps, isDragActive } = useDropzone({ onDrop, noClick: true });
|
|
110
110
|
|
|
111
|
-
console.log("isDragActive", isDragActive);
|
|
112
|
-
|
|
113
111
|
return (
|
|
114
112
|
<div {...props} {...getRootProps()} className={cn("relative z-0", className)}>
|
|
115
113
|
<input {...getInputProps()} />
|
|
@@ -2,6 +2,7 @@ import { bulkActionSchema } from "@/modules/router/entry";
|
|
|
2
2
|
import { ServerError } from "@/modules/router/entry.server";
|
|
3
3
|
import { initRPC } from "@/modules/router/handler/init.server";
|
|
4
4
|
import { and, eq, sql } from "drizzle-orm";
|
|
5
|
+
import { QueryResult } from "pg";
|
|
5
6
|
import { z } from "zod";
|
|
6
7
|
import { isFolder } from "./helpers";
|
|
7
8
|
import { DriveSchema, nodes } from "./schema";
|
|
@@ -9,6 +10,7 @@ import {
|
|
|
9
10
|
createFolderNodeSchema,
|
|
10
11
|
getFileURLSchema,
|
|
11
12
|
getNodesByParentIdSchema,
|
|
13
|
+
Node,
|
|
12
14
|
presignFileSchema,
|
|
13
15
|
selectNodeSchema,
|
|
14
16
|
selectNodeWithChildrenSchema,
|
|
@@ -76,11 +78,10 @@ export function createDriveBaseProcedures() {
|
|
|
76
78
|
);
|
|
77
79
|
|
|
78
80
|
const result = (await context.db.execute(
|
|
79
|
-
sql`WITH RECURSIVE ${recursiveQueryName} AS ${recursiveQuery}
|
|
80
|
-
|
|
81
|
-
)) as Awaited<ReturnType<(typeof recursiveQuery)["execute"]>>;
|
|
81
|
+
sql`WITH RECURSIVE ${recursiveQueryName} AS ${recursiveQuery} SELECT * FROM ${recursiveQueryName}`,
|
|
82
|
+
)) as QueryResult<Pick<Node, "id" | "name" | "parentId"> & { depth: number }>;
|
|
82
83
|
|
|
83
|
-
return result
|
|
84
|
+
return result?.rows?.toSorted((a, b) => Number(b.depth) - Number(a.depth)) ?? [];
|
|
84
85
|
}),
|
|
85
86
|
/**
|
|
86
87
|
* Get presigned url for opening a file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.client.d.mts","names":[],"sources":["../../../../src/modules/auth/handler/client.client.ts"],"sourcesContent":[],"mappings":";;;;;;;cAQa;;UAGX,qBAAA,CAAA,OAAA;;;;yBAAA;MAHW,KAGX,CAAA,eAK6pI,kBAL7pI;IAAA,CAAA,GAAA,SAAA,EAAA,UAAA,CAAA,IAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;2BAA3wB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAA0vG,kBAAA,CAAA;;;;;;;;;;;;;;;;;YAAx5D;;eAA4D,eAAA;;;;;eAA+U;kBAA+C;;;WAAwG;eAAwC;;qBAAqF;cAAyC;;0BAAA,kBAAA,CAA+E,oBAAA;;;;;qBAAA,kBAAA,CAAA;;;;;;;;;;;;;;;;;;;;+BAA27B,YAAA;;cAAA,kBAAA,CAAmG,gBAAA,UAAA,cAAA;kBAAA,kBAAA,CAAmG,gBAAA;;;;;uBAAuM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAH9hM,UAAA,UAAoB;KAEpB,aAAA,UAAuB,UAAA,CAAW,MAAA,CAAO"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { url } from "../../../lib/utils/url.mjs";
|
|
4
|
-
import { passkeyClient } from "@better-auth/passkey/client";
|
|
5
|
-
import { adminClient, emailOTPClient, inferAdditionalFields } from "better-auth/client/plugins";
|
|
6
|
-
import { createAuthClient } from "better-auth/react";
|
|
7
|
-
|
|
8
|
-
//#region src/modules/auth/handler/client.client.ts
|
|
9
|
-
const authClient = createAuthClient({
|
|
10
|
-
baseURL: url(),
|
|
11
|
-
plugins: [
|
|
12
|
-
emailOTPClient(),
|
|
13
|
-
passkeyClient(),
|
|
14
|
-
adminClient(),
|
|
15
|
-
inferAdditionalFields()
|
|
16
|
-
]
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
//#endregion
|
|
20
|
-
export { authClient };
|
|
21
|
-
//# sourceMappingURL=client.client.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.client.mjs","names":[],"sources":["../../../../src/modules/auth/handler/client.client.ts"],"sourcesContent":["\"use client\";\n\nimport { passkeyClient } from \"@better-auth/passkey/client\";\nimport { adminClient, emailOTPClient, inferAdditionalFields } from \"better-auth/client/plugins\";\nimport { createAuthClient } from \"better-auth/react\";\nimport { AuthClient } from \"./init\";\nimport { url } from \"@/lib/utils/url\";\n\nexport const authClient = createAuthClient({\n baseURL: url(),\n plugins: [emailOTPClient(), passkeyClient(), adminClient(), inferAdditionalFields<AuthClient>()],\n});\n\nexport type ClientAuth = typeof authClient;\n\nexport type ClientSession = typeof authClient.$Infer.Session;\n"],"mappings":";;;;;;;;AAQA,MAAa,aAAa,iBAAiB;CACzC,SAAS,KAAK;CACd,SAAS;EAAC,gBAAgB;EAAE,eAAe;EAAE,aAAa;EAAE,uBAAmC;EAAC;CACjG,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { redirect } from "next/navigation";
|
|
4
|
-
import { PropsWithChildren } from "react";
|
|
5
|
-
import { useSession } from "../hooks/use-session";
|
|
6
|
-
|
|
7
|
-
export function AuthGuard({ children }: PropsWithChildren) {
|
|
8
|
-
const session = useSession();
|
|
9
|
-
if (!session.data) redirect("/auth/login");
|
|
10
|
-
|
|
11
|
-
return <>{children}</>;
|
|
12
|
-
}
|