@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":"init.d.mts","names":[],"sources":["../../../../src/modules/auth/handler/init.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;cAca,gBAAA;KAER,8BAA8B;MAC7B,eAAe;SACZ;UACC;MACJ,kBAAkB;6BAEF;;AART,iBAYG,QAZa,CAAA,gBAYY,eAZZ,CAAA,CAAA,KAAA,EAYoC,aAZpC,CAYkD,OAZlD,CAAA,CAAA,
|
|
1
|
+
{"version":3,"file":"init.d.mts","names":[],"sources":["../../../../src/modules/auth/handler/init.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;cAca,gBAAA;KAER,8BAA8B;MAC7B,eAAe;SACZ;UACC;MACJ,kBAAkB;6BAEF;;AART,iBAYG,QAZa,CAAA,gBAYY,eAZZ,CAAA,CAAA,KAAA,EAYoC,aAZpC,CAYkD,OAZlD,CAAA,CAAA,eAY0D,IAZ1D,CAAA;EAExB,QAAA,EAAA;IAA8B,YAAA,EAAA,MAAA;IACd,QAAA,EAAA;MAAf,UAAA,EAAA,GAAA,GAAA,KAAA;IACG,CAAA;EACC,CAAA;EACc,QAAA,EAAA,CAAA,OAAA,EAMsD,YAAA,CAAA,iBANtD,EAAA,yBAAA,gCAAA;EAAlB,gBAAA,EAAA;IAEgB,OAAA,EAAA,IAAA;EAAI,CAAA;EAIV,IAAA,EAAA;IAAyB,WAAA,EAAA;MAAsC,OAAA,EAAA,IAAA;IAAd,CAAA;IAAa,gBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAAS,EAAA,EAAA,MAAA;cAAA,SAAA,MAAA;cAoFjE,SAAqB,MAAlB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAAb,UAAA,GAAa,kBAAkB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ClientAuth } from "../handler/create-client.client.mjs";
|
|
2
|
+
import * as react_jsx_runtime66 from "react/jsx-runtime";
|
|
3
|
+
import * as react7 from "react";
|
|
4
|
+
import { PropsWithChildren } from "react";
|
|
5
|
+
import { AccessControl, Role } from "better-auth/plugins";
|
|
6
|
+
|
|
7
|
+
//#region src/modules/auth/hooks/use-auth-client.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* Auth client context
|
|
10
|
+
*/
|
|
11
|
+
declare const AuthClientContext: react7.Context<ClientAuth<never, never>>;
|
|
12
|
+
/**
|
|
13
|
+
* Use auth client
|
|
14
|
+
*/
|
|
15
|
+
declare function useAuthClient<TAccessControl extends AccessControl = never, TRoles extends { [key in string]: Role } = never>(): ClientAuth<TAccessControl, TRoles>;
|
|
16
|
+
/**
|
|
17
|
+
* Auth client provider
|
|
18
|
+
*/
|
|
19
|
+
declare function AuthProvider<TAccessControl extends AccessControl, TRoles extends { [key in string]: Role }>(props: PropsWithChildren<{
|
|
20
|
+
authClient: ClientAuth<TAccessControl, TRoles>;
|
|
21
|
+
}>): react_jsx_runtime66.JSX.Element;
|
|
22
|
+
//#endregion
|
|
23
|
+
export { AuthClientContext, AuthProvider, useAuthClient };
|
|
24
|
+
//# sourceMappingURL=use-auth-client.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-auth-client.d.mts","names":[],"sources":["../../../../src/modules/auth/hooks/use-auth-client.tsx"],"sourcesContent":[],"mappings":";;;;;;;;;;cAUa,mBAAiB,MAAA,CAAA,QAAA;AAA9B;AAKA;;AAEoC,iBAFpB,aAEoB,CAAA,uBADX,aACW,GAAA,KAAA,EAAA,eAAA,UAKL,MAAA,GALK,IAKL,EAAgB,GAAA,KAAA,CAAA,CAAA,CAAA,EAA3B,UAA2B,CAAhB,cAAgB,EAAA,MAAA,CAAA;;;AAM/C;AACyB,iBADT,YACS,CAAA,uBAAA,aAAA,EAAA,eAAA,UACW,MAAA,GAAA,IAAA,EACgB,CAAA,CAAA,KAAA,EAA3C,iBAA2C,CAAA;EAAgB,UAAA,EAA3B,UAA2B,CAAhB,cAAgB,EAAA,MAAA,CAAA;CAA3B,CAAA,CAAA,EAAqC,mBAAA,CAAA,GAAA,CAAA,OAArC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { createContext, use } from "react";
|
|
5
|
+
|
|
6
|
+
//#region src/modules/auth/hooks/use-auth-client.tsx
|
|
7
|
+
/**
|
|
8
|
+
* Auth client context
|
|
9
|
+
*/
|
|
10
|
+
const AuthClientContext = createContext(null);
|
|
11
|
+
/**
|
|
12
|
+
* Use auth client
|
|
13
|
+
*/
|
|
14
|
+
function useAuthClient() {
|
|
15
|
+
const context = use(AuthClientContext);
|
|
16
|
+
if (!context) throw new Error("Auth client is not provided");
|
|
17
|
+
return context;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Auth client provider
|
|
21
|
+
*/
|
|
22
|
+
function AuthProvider(props) {
|
|
23
|
+
return /* @__PURE__ */ jsx(AuthClientContext, {
|
|
24
|
+
value: props.authClient,
|
|
25
|
+
children: props.children
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
//#endregion
|
|
30
|
+
export { AuthClientContext, AuthProvider, useAuthClient };
|
|
31
|
+
//# sourceMappingURL=use-auth-client.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-auth-client.mjs","names":[],"sources":["../../../../src/modules/auth/hooks/use-auth-client.tsx"],"sourcesContent":["\"use client\";\n\nimport { AccessControl, Role } from \"better-auth/plugins\";\nimport { createContext, PropsWithChildren, use } from \"react\";\nimport { ClientAuth } from \"../handler/create-client.client\";\n\n/**\n * Auth client context\n */\n\nexport const AuthClientContext = createContext(null as unknown as ClientAuth<never, never>);\n\n/**\n * Use auth client\n */\nexport function useAuthClient<\n TAccessControl extends AccessControl = never,\n TRoles extends { [key in string]: Role } = never,\n>() {\n const context = use(AuthClientContext);\n if (!context) throw new Error(\"Auth client is not provided\");\n\n return context as ClientAuth<TAccessControl, TRoles>;\n}\n\n/**\n * Auth client provider\n */\nexport function AuthProvider<\n TAccessControl extends AccessControl,\n TRoles extends { [key in string]: Role },\n>(props: PropsWithChildren<{ authClient: ClientAuth<TAccessControl, TRoles> }>) {\n return (\n <AuthClientContext value={props.authClient as ClientAuth<never, never>}>\n {props.children}\n </AuthClientContext>\n );\n}\n"],"mappings":";;;;;;;;;AAUA,MAAa,oBAAoB,cAAc,KAA4C;;;;AAK3F,SAAgB,gBAGZ;CACF,MAAM,UAAU,IAAI,kBAAkB;AACtC,KAAI,CAAC,QAAS,OAAM,IAAI,MAAM,8BAA8B;AAE5D,QAAO;;;;;AAMT,SAAgB,aAGd,OAA8E;AAC9E,QACE,oBAAC;EAAkB,OAAO,MAAM;YAC7B,MAAM;GACW"}
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { Permission } from "../lib/permissions.mjs";
|
|
2
|
-
import * as _tanstack_react_query5 from "@tanstack/react-query";
|
|
3
2
|
|
|
4
3
|
//#region src/modules/auth/hooks/use-permission.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* UsePermission
|
|
7
|
-
*/
|
|
8
4
|
type UsePermissionProps = {
|
|
9
5
|
/**
|
|
10
6
|
* Strategy to use when checking multiple permissions
|
|
@@ -32,39 +28,16 @@ type UsePermissionProps = {
|
|
|
32
28
|
*/
|
|
33
29
|
permission?: Permission[];
|
|
34
30
|
};
|
|
35
|
-
declare function usePermission({
|
|
36
|
-
permission,
|
|
37
|
-
strategy
|
|
38
|
-
}: UsePermissionProps): _tanstack_react_query5.UseSuspenseQueryResult<{
|
|
39
|
-
permission: undefined;
|
|
40
|
-
success: boolean;
|
|
41
|
-
} | {
|
|
42
|
-
permission: Permission | Permission[];
|
|
43
|
-
success: boolean;
|
|
44
|
-
}, Error>;
|
|
45
31
|
/**
|
|
46
|
-
*
|
|
47
|
-
* @param permission
|
|
48
|
-
* @param strategy
|
|
49
|
-
* @returns
|
|
50
|
-
* @deprecated Use `usePermission` with strategy "any" or "all" instead
|
|
32
|
+
* UsePermission
|
|
51
33
|
*/
|
|
52
|
-
declare function
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
} | {
|
|
59
|
-
data: {
|
|
60
|
-
success: boolean;
|
|
61
|
-
values: {
|
|
62
|
-
permission: Permission;
|
|
63
|
-
success: boolean;
|
|
64
|
-
}[];
|
|
65
|
-
};
|
|
66
|
-
errors: null;
|
|
34
|
+
declare function usePermission({
|
|
35
|
+
strategy,
|
|
36
|
+
permission
|
|
37
|
+
}: UsePermissionProps): {
|
|
38
|
+
permission: Permission | Permission[] | undefined;
|
|
39
|
+
success: boolean;
|
|
67
40
|
};
|
|
68
41
|
//#endregion
|
|
69
|
-
export { UsePermissionProps, usePermission
|
|
42
|
+
export { UsePermissionProps, usePermission };
|
|
70
43
|
//# sourceMappingURL=use-permission.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-permission.d.mts","names":[],"sources":["../../../../src/modules/auth/hooks/use-permission.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-permission.d.mts","names":[],"sources":["../../../../src/modules/auth/hooks/use-permission.ts"],"sourcesContent":[],"mappings":";;;KAMY,kBAAA;;AAAZ;AAmCA;;;;;;;;;eArBmB;;;;;;;;;;;;;eAeA;;;;;iBAMH,aAAA;;;GAAgD"}
|
|
@@ -1,104 +1,58 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { useAuthClient } from "./use-auth-client.mjs";
|
|
4
4
|
import { useSession } from "./use-session.mjs";
|
|
5
|
-
import { useSuspenseQueries, useSuspenseQuery } from "@tanstack/react-query";
|
|
6
5
|
|
|
7
6
|
//#region src/modules/auth/hooks/use-permission.ts
|
|
8
|
-
function usePermission({ permission, strategy = "all" }) {
|
|
9
|
-
const sessionQuery = useSession();
|
|
10
|
-
return useSuspenseQuery({
|
|
11
|
-
queryKey: ["permission", {
|
|
12
|
-
permission,
|
|
13
|
-
strategy
|
|
14
|
-
}],
|
|
15
|
-
queryFn: async () => {
|
|
16
|
-
if (!permission) return {
|
|
17
|
-
permission,
|
|
18
|
-
success: true
|
|
19
|
-
};
|
|
20
|
-
if (!sessionQuery.data) return {
|
|
21
|
-
permission,
|
|
22
|
-
success: false
|
|
23
|
-
};
|
|
24
|
-
const userId = sessionQuery.data?.user.id;
|
|
25
|
-
if (!userId) return {
|
|
26
|
-
permission,
|
|
27
|
-
success: false
|
|
28
|
-
};
|
|
29
|
-
const permissions = Array.isArray(permission) ? permission : [permission];
|
|
30
|
-
const results = await Promise.all(permissions.map((permission$1) => authClient.admin.hasPermission({
|
|
31
|
-
permission: permission$1,
|
|
32
|
-
userId
|
|
33
|
-
})));
|
|
34
|
-
const data = results.map(({ data: data$1 }) => data$1).filter((data$1) => !!data$1);
|
|
35
|
-
const errors = results.filter(({ error }) => !!error).map(({ error }) => error);
|
|
36
|
-
if (errors.length > 0) {
|
|
37
|
-
console.error(...errors);
|
|
38
|
-
return {
|
|
39
|
-
permission,
|
|
40
|
-
success: false
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
return {
|
|
44
|
-
permission,
|
|
45
|
-
success: strategy === "all" ? data.every(({ success }) => success) : data.some(({ success }) => success)
|
|
46
|
-
};
|
|
47
|
-
},
|
|
48
|
-
staleTime: 300 * 1e3
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
7
|
/**
|
|
52
|
-
*
|
|
53
|
-
* @param permission
|
|
54
|
-
* @param strategy
|
|
55
|
-
* @returns
|
|
56
|
-
* @deprecated Use `usePermission` with strategy "any" or "all" instead
|
|
8
|
+
* UsePermission
|
|
57
9
|
*/
|
|
58
|
-
function
|
|
59
|
-
const
|
|
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
|
-
|
|
10
|
+
function usePermission({ strategy = "all", permission }) {
|
|
11
|
+
const authClient = useAuthClient();
|
|
12
|
+
/**
|
|
13
|
+
* If no role is found in the session, deny by default
|
|
14
|
+
*/
|
|
15
|
+
const role = useSession(authClient).data?.user.role;
|
|
16
|
+
if (!role) return {
|
|
17
|
+
permission,
|
|
18
|
+
success: false
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* If no permission is provided, allow by default
|
|
22
|
+
*/
|
|
23
|
+
if (!permission) return {
|
|
24
|
+
permission,
|
|
25
|
+
success: true
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* If the strategy is "any", check if the user has any of the permissions
|
|
29
|
+
*/
|
|
30
|
+
if (strategy === "any" && Array.isArray(permission)) return {
|
|
31
|
+
permission,
|
|
32
|
+
success: (Array.isArray(permission) ? permission : [permission]).some((permission$1) => authClient.admin.checkRolePermission({
|
|
33
|
+
role,
|
|
34
|
+
permissions: permission$1
|
|
35
|
+
}))
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* If the strategy is "all", check if the user has all of the permissions
|
|
39
|
+
*/
|
|
40
|
+
if (strategy === "all" && !Array.isArray(permission)) return {
|
|
41
|
+
permission,
|
|
42
|
+
success: authClient.admin.checkRolePermission({
|
|
43
|
+
role,
|
|
44
|
+
permissions: permission
|
|
45
|
+
})
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* If the strategy is not recognized, deny by default
|
|
49
|
+
*/
|
|
50
|
+
return {
|
|
51
|
+
permission,
|
|
52
|
+
success: false
|
|
53
|
+
};
|
|
100
54
|
}
|
|
101
55
|
|
|
102
56
|
//#endregion
|
|
103
|
-
export { usePermission
|
|
57
|
+
export { usePermission };
|
|
104
58
|
//# sourceMappingURL=use-permission.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-permission.mjs","names":["
|
|
1
|
+
{"version":3,"file":"use-permission.mjs","names":["permission"],"sources":["../../../../src/modules/auth/hooks/use-permission.ts"],"sourcesContent":["\"use client\";\n\nimport { type Permission } from \"../lib/permissions\";\nimport { useAuthClient } from \"./use-auth-client\";\nimport { useSession } from \"./use-session\";\n\nexport type UsePermissionProps =\n | {\n /**\n * Strategy to use when checking multiple permissions\n * - \"all\": all permissions must be allowed\n * - \"any\": at least one permission must be allowed\n * @default \"all\"\n */\n strategy?: \"all\";\n\n /**\n * Permission to check\n * @example { project: [\"view\", \"create\"] }\n */\n permission?: Permission;\n }\n | {\n /**\n * Strategy to use when checking multiple permissions\n * - \"all\": all permissions must be allowed\n * - \"any\": at least one permission must be allowed\n * @default \"all\"\n */\n strategy?: \"any\";\n\n /**\n * Permission to check\n * @example [{ project: [\"view\", \"create\"] }, { client: [\"view\"] }, { drive: [\"view\"] }]\n */\n permission?: Permission[];\n };\n\n/**\n * UsePermission\n */\nexport function usePermission({ strategy = \"all\", permission }: UsePermissionProps) {\n const authClient = useAuthClient();\n const sessionQuery = useSession(authClient);\n\n /**\n * If no role is found in the session, deny by default\n */\n const role = sessionQuery.data?.user.role;\n if (!role) return { permission, success: false };\n\n /**\n * If no permission is provided, allow by default\n */\n if (!permission) return { permission, success: true };\n\n /**\n * If the strategy is \"any\", check if the user has any of the permissions\n */\n if (strategy === \"any\" && Array.isArray(permission)) {\n const permissions = Array.isArray(permission) ? permission : [permission];\n\n const success = permissions.some((permission) =>\n authClient.admin.checkRolePermission({\n role,\n permissions: permission,\n }),\n );\n\n return { permission, success };\n }\n\n /**\n * If the strategy is \"all\", check if the user has all of the permissions\n */\n if (strategy === \"all\" && !Array.isArray(permission)) {\n const success = authClient.admin.checkRolePermission({\n role,\n permissions: permission,\n });\n\n return { permission, success };\n }\n\n /**\n * If the strategy is not recognized, deny by default\n */\n return { permission, success: false };\n}\n"],"mappings":";;;;;;;;;AAyCA,SAAgB,cAAc,EAAE,WAAW,OAAO,cAAkC;CAClF,MAAM,aAAa,eAAe;;;;CAMlC,MAAM,OALe,WAAW,WAAW,CAKjB,MAAM,KAAK;AACrC,KAAI,CAAC,KAAM,QAAO;EAAE;EAAY,SAAS;EAAO;;;;AAKhD,KAAI,CAAC,WAAY,QAAO;EAAE;EAAY,SAAS;EAAM;;;;AAKrD,KAAI,aAAa,SAAS,MAAM,QAAQ,WAAW,CAUjD,QAAO;EAAE;EAAY,UATD,MAAM,QAAQ,WAAW,GAAG,aAAa,CAAC,WAAW,EAE7C,MAAM,iBAChC,WAAW,MAAM,oBAAoB;GACnC;GACA,aAAaA;GACd,CAAC,CACH;EAE6B;;;;AAMhC,KAAI,aAAa,SAAS,CAAC,MAAM,QAAQ,WAAW,CAMlD,QAAO;EAAE;EAAY,SALL,WAAW,MAAM,oBAAoB;GACnD;GACA,aAAa;GACd,CAAC;EAE4B;;;;AAMhC,QAAO;EAAE;EAAY,SAAS;EAAO"}
|
|
@@ -1,123 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ClientAuth } from "../handler/create-client.client.mjs";
|
|
2
|
+
import "../../../auth/client.mjs";
|
|
3
|
+
import * as _tanstack_react_query0 from "@tanstack/react-query";
|
|
2
4
|
|
|
3
5
|
//#region src/modules/auth/hooks/use-session.d.ts
|
|
4
|
-
declare
|
|
5
|
-
user: {
|
|
6
|
-
id: string;
|
|
7
|
-
createdAt: Date;
|
|
8
|
-
updatedAt: Date;
|
|
9
|
-
email: string;
|
|
10
|
-
emailVerified: boolean;
|
|
11
|
-
name: string;
|
|
12
|
-
image?: string | null | undefined;
|
|
13
|
-
banned: boolean | null | undefined;
|
|
14
|
-
role?: string | null | undefined;
|
|
15
|
-
banReason?: string | null | undefined;
|
|
16
|
-
banExpires?: Date | null | undefined;
|
|
17
|
-
firstName: string;
|
|
18
|
-
lastName: string;
|
|
19
|
-
};
|
|
20
|
-
session: {
|
|
21
|
-
id: string;
|
|
22
|
-
createdAt: Date;
|
|
23
|
-
updatedAt: Date;
|
|
24
|
-
userId: string;
|
|
25
|
-
expiresAt: Date;
|
|
26
|
-
token: string;
|
|
27
|
-
ipAddress?: string | null | undefined;
|
|
28
|
-
userAgent?: string | null | undefined;
|
|
29
|
-
impersonatedBy?: string | null | undefined;
|
|
30
|
-
};
|
|
31
|
-
} | null, Error, {
|
|
32
|
-
user: {
|
|
33
|
-
id: string;
|
|
34
|
-
createdAt: Date;
|
|
35
|
-
updatedAt: Date;
|
|
36
|
-
email: string;
|
|
37
|
-
emailVerified: boolean;
|
|
38
|
-
name: string;
|
|
39
|
-
image?: string | null | undefined;
|
|
40
|
-
banned: boolean | null | undefined;
|
|
41
|
-
role?: string | null | undefined;
|
|
42
|
-
banReason?: string | null | undefined;
|
|
43
|
-
banExpires?: Date | null | undefined;
|
|
44
|
-
firstName: string;
|
|
45
|
-
lastName: string;
|
|
46
|
-
};
|
|
47
|
-
session: {
|
|
48
|
-
id: string;
|
|
49
|
-
createdAt: Date;
|
|
50
|
-
updatedAt: Date;
|
|
51
|
-
userId: string;
|
|
52
|
-
expiresAt: Date;
|
|
53
|
-
token: string;
|
|
54
|
-
ipAddress?: string | null | undefined;
|
|
55
|
-
userAgent?: string | null | undefined;
|
|
56
|
-
impersonatedBy?: string | null | undefined;
|
|
57
|
-
};
|
|
58
|
-
} | null, string[]>, "queryFn"> & {
|
|
59
|
-
queryFn?: _tanstack_react_query1.QueryFunction<{
|
|
60
|
-
user: {
|
|
61
|
-
id: string;
|
|
62
|
-
createdAt: Date;
|
|
63
|
-
updatedAt: Date;
|
|
64
|
-
email: string;
|
|
65
|
-
emailVerified: boolean;
|
|
66
|
-
name: string;
|
|
67
|
-
image?: string | null | undefined;
|
|
68
|
-
banned: boolean | null | undefined;
|
|
69
|
-
role?: string | null | undefined;
|
|
70
|
-
banReason?: string | null | undefined;
|
|
71
|
-
banExpires?: Date | null | undefined;
|
|
72
|
-
firstName: string;
|
|
73
|
-
lastName: string;
|
|
74
|
-
};
|
|
75
|
-
session: {
|
|
76
|
-
id: string;
|
|
77
|
-
createdAt: Date;
|
|
78
|
-
updatedAt: Date;
|
|
79
|
-
userId: string;
|
|
80
|
-
expiresAt: Date;
|
|
81
|
-
token: string;
|
|
82
|
-
ipAddress?: string | null | undefined;
|
|
83
|
-
userAgent?: string | null | undefined;
|
|
84
|
-
impersonatedBy?: string | null | undefined;
|
|
85
|
-
};
|
|
86
|
-
} | null, string[], never> | undefined;
|
|
87
|
-
} & {
|
|
88
|
-
queryKey: string[] & {
|
|
89
|
-
[dataTagSymbol]: {
|
|
90
|
-
user: {
|
|
91
|
-
id: string;
|
|
92
|
-
createdAt: Date;
|
|
93
|
-
updatedAt: Date;
|
|
94
|
-
email: string;
|
|
95
|
-
emailVerified: boolean;
|
|
96
|
-
name: string;
|
|
97
|
-
image?: string | null | undefined;
|
|
98
|
-
banned: boolean | null | undefined;
|
|
99
|
-
role?: string | null | undefined;
|
|
100
|
-
banReason?: string | null | undefined;
|
|
101
|
-
banExpires?: Date | null | undefined;
|
|
102
|
-
firstName: string;
|
|
103
|
-
lastName: string;
|
|
104
|
-
};
|
|
105
|
-
session: {
|
|
106
|
-
id: string;
|
|
107
|
-
createdAt: Date;
|
|
108
|
-
updatedAt: Date;
|
|
109
|
-
userId: string;
|
|
110
|
-
expiresAt: Date;
|
|
111
|
-
token: string;
|
|
112
|
-
ipAddress?: string | null | undefined;
|
|
113
|
-
userAgent?: string | null | undefined;
|
|
114
|
-
impersonatedBy?: string | null | undefined;
|
|
115
|
-
};
|
|
116
|
-
} | null;
|
|
117
|
-
[dataTagErrorSymbol]: Error;
|
|
118
|
-
};
|
|
119
|
-
};
|
|
120
|
-
declare function useSession(): _tanstack_react_query1.UseSuspenseQueryResult<{
|
|
6
|
+
declare function useSession(authClient: ClientAuth<never, never>): _tanstack_react_query0.UseSuspenseQueryResult<{
|
|
121
7
|
user: {
|
|
122
8
|
id: string;
|
|
123
9
|
createdAt: Date;
|
|
@@ -146,5 +32,5 @@ declare function useSession(): _tanstack_react_query1.UseSuspenseQueryResult<{
|
|
|
146
32
|
};
|
|
147
33
|
} | null, Error>;
|
|
148
34
|
//#endregion
|
|
149
|
-
export {
|
|
35
|
+
export { useSession };
|
|
150
36
|
//# sourceMappingURL=use-session.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-session.d.mts","names":[],"sources":["../../../../src/modules/auth/hooks/use-session.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-session.d.mts","names":[],"sources":["../../../../src/modules/auth/hooks/use-session.ts"],"sourcesContent":[],"mappings":";;;;;iBAKgB,UAAA,aAAuB,kDAAwB;;;;IAA/C,SAAU,MAAA;IAAa,KAAA,EAAA,MAAA;;;;;;;;qBAAwB;IAAA,QAAA,EAAA,MAAA"}
|
|
@@ -1,25 +1,23 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import { queryOptions, useSuspenseQuery } from "@tanstack/react-query";
|
|
3
|
+
import { useSuspenseQuery } from "@tanstack/react-query";
|
|
5
4
|
|
|
6
5
|
//#region src/modules/auth/hooks/use-session.ts
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return useSuspenseQuery(sessionQueryOptions);
|
|
6
|
+
function useSession(authClient) {
|
|
7
|
+
return useSuspenseQuery({
|
|
8
|
+
queryKey: ["session"],
|
|
9
|
+
queryFn: async () => {
|
|
10
|
+
const session = await authClient.getSession();
|
|
11
|
+
if (session.error) {
|
|
12
|
+
console.error(session.error);
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
return session.data;
|
|
16
|
+
},
|
|
17
|
+
staleTime: 1e3 * 60 * 60
|
|
18
|
+
});
|
|
21
19
|
}
|
|
22
20
|
|
|
23
21
|
//#endregion
|
|
24
|
-
export {
|
|
22
|
+
export { useSession };
|
|
25
23
|
//# sourceMappingURL=use-session.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-session.mjs","names":[],"sources":["../../../../src/modules/auth/hooks/use-session.ts"],"sourcesContent":["\"use client\";\n\nimport {
|
|
1
|
+
{"version":3,"file":"use-session.mjs","names":[],"sources":["../../../../src/modules/auth/hooks/use-session.ts"],"sourcesContent":["\"use client\";\n\nimport { useSuspenseQuery } from \"@tanstack/react-query\";\nimport { ClientAuth } from \"../entry.client\";\n\nexport function useSession(authClient: ClientAuth<never, never>) {\n const session = useSuspenseQuery({\n queryKey: [\"session\"],\n queryFn: async () => {\n const session = await authClient.getSession();\n \n\n if (session.error) {\n console.error(session.error);\n return null;\n }\n\n return session.data;\n },\n staleTime: 1000 * 60 * 60,\n });\n\n return session;\n}\n"],"mappings":";;;;;AAKA,SAAgB,WAAW,YAAsC;AAiB/D,QAhBgB,iBAAiB;EAC/B,UAAU,CAAC,UAAU;EACrB,SAAS,YAAY;GACnB,MAAM,UAAU,MAAM,WAAW,YAAY;AAG7C,OAAI,QAAQ,OAAO;AACjB,YAAQ,MAAM,QAAQ,MAAM;AAC5B,WAAO;;AAGT,UAAO,QAAQ;;EAEjB,WAAW,MAAO,KAAK;EACxB,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ServerError } from "../../router/lib/error.server.mjs";
|
|
2
2
|
import { users } from "../db/schema.mjs";
|
|
3
|
-
import { eq } from "drizzle-orm";
|
|
4
3
|
import "server-cli-only";
|
|
4
|
+
import { eq } from "drizzle-orm";
|
|
5
5
|
import { headers } from "next/headers";
|
|
6
6
|
|
|
7
7
|
//#region src/modules/auth/lib/helpers.server.ts
|
|
@@ -31,8 +31,8 @@ declare const forgotPasswordSchema: z$1.ZodObject<{
|
|
|
31
31
|
* Create user schema
|
|
32
32
|
*/
|
|
33
33
|
declare const createUserSchema: z$1.ZodObject<{
|
|
34
|
-
image: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
35
34
|
email: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<string, string>>;
|
|
35
|
+
image: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
36
36
|
firstName: z$1.ZodString;
|
|
37
37
|
lastName: z$1.ZodString;
|
|
38
38
|
password: z$1.ZodString;
|
|
@@ -43,10 +43,10 @@ type CreateUserSchema = z$1.infer<typeof createUserSchema>;
|
|
|
43
43
|
* Update user schema
|
|
44
44
|
*/
|
|
45
45
|
declare const updateUserSchema: z$1.ZodObject<{
|
|
46
|
-
image: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
47
46
|
firstName: z$1.ZodString;
|
|
48
47
|
lastName: z$1.ZodString;
|
|
49
48
|
email: z$1.ZodString;
|
|
49
|
+
image: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
50
50
|
}, {
|
|
51
51
|
out: {};
|
|
52
52
|
in: {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validators.d.mts","names":[],"sources":["../../../../src/modules/auth/lib/validators.ts"],"sourcesContent":[],"mappings":";;;;;;;AAQA;AAKa,KALD,IAAA,GAcV,OAdwB,KAAA,CAAM,YAc9B;;;;AATsB,cAAX,WAAW,EAAA,GAAA,CAAA,SAAA,CAAA;EAAA,KAAA,cAAA;EAcX,QAAA,eAAA;;;;;AAAmB,cAAnB,mBAAmB,EAAA,GAAA,CAAA,SAAA,CAAA;EAmBnB,QAAA,eAAA;;;;;AAUb;cAVa,sBAAoB,GAAA,CAAA;;;;;;cAUpB,kBAAgB,GAAA,CAAA;;;;;;EAAA,IAAA,iBAAA,cAAA,CAAA;CAAA,iBAAA,CAAA;AAajB,KAAA,gBAAA,GAAmB,GAAA,CAAE,KAAa,CAAA,OAAA,gBAAb,
|
|
1
|
+
{"version":3,"file":"validators.d.mts","names":[],"sources":["../../../../src/modules/auth/lib/validators.ts"],"sourcesContent":[],"mappings":";;;;;;;AAQA;AAKa,KALD,IAAA,GAcV,OAdwB,KAAA,CAAM,YAc9B;;;;AATsB,cAAX,WAAW,EAAA,GAAA,CAAA,SAAA,CAAA;EAAA,KAAA,cAAA;EAcX,QAAA,eAAA;;;;;AAAmB,cAAnB,mBAAmB,EAAA,GAAA,CAAA,SAAA,CAAA;EAmBnB,QAAA,eAAA;;;;;AAUb;cAVa,sBAAoB,GAAA,CAAA;;;;;;cAUpB,kBAAgB,GAAA,CAAA;;;;;;EAAA,IAAA,iBAAA,cAAA,CAAA;CAAA,iBAAA,CAAA;AAajB,KAAA,gBAAA,GAAmB,GAAA,CAAE,KAAa,CAAA,OAAA,gBAAb,CAAK;AAKtC;;;cAAa,kBAAgB,GAAA,CAAA;;;;EAAA,KAAA,iBAAA,gBAAA,cAAA,CAAA,CAAA;CAAA,EAAA;EAOjB,GAAA,EAAA,CAAA,CAAA;EAKC,EAAA,EAAA,CAAA,CAAA;;KALD,gBAAA,GAAmB,GAAA,CAAE,aAAa;;;AAS9C;cAJa,sBAAoB,GAAA,CAAA;;;KAIrB,oBAAA,GAAuB,GAAA,CAAE,aAAa"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime11 from "react/jsx-runtime";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { DefaultError, MutationOptions } from "@tanstack/react-query";
|
|
4
|
-
import { Keys } from "react-hotkeys-hook";
|
|
5
4
|
import { AlertDialogCancelProps, AlertDialogContentProps, AlertDialogProps } from "@radix-ui/react-alert-dialog";
|
|
5
|
+
import { Keys } from "react-hotkeys-hook";
|
|
6
6
|
|
|
7
7
|
//#region src/modules/commands/components/alert-dialog-command.client.d.ts
|
|
8
8
|
/**
|
|
@@ -11,7 +11,7 @@ import { AlertDialogCancelProps, AlertDialogContentProps, AlertDialogProps } fro
|
|
|
11
11
|
declare function CommandAlertDialog({
|
|
12
12
|
children,
|
|
13
13
|
...props
|
|
14
|
-
}: AlertDialogProps):
|
|
14
|
+
}: AlertDialogProps): react_jsx_runtime11.JSX.Element;
|
|
15
15
|
/**
|
|
16
16
|
* CommandAlertDialogTrigger
|
|
17
17
|
*/
|
|
@@ -28,49 +28,49 @@ declare function CommandAlertDialogTrigger({
|
|
|
28
28
|
children,
|
|
29
29
|
disabled,
|
|
30
30
|
...props
|
|
31
|
-
}: CommandAlertDialogTriggerProps):
|
|
31
|
+
}: CommandAlertDialogTriggerProps): react_jsx_runtime11.JSX.Element | undefined;
|
|
32
32
|
/**
|
|
33
33
|
* CommandAlertDialogContent
|
|
34
34
|
*/
|
|
35
35
|
declare function CommandAlertDialogContent({
|
|
36
36
|
children,
|
|
37
37
|
...props
|
|
38
|
-
}: AlertDialogContentProps):
|
|
38
|
+
}: AlertDialogContentProps): react_jsx_runtime11.JSX.Element;
|
|
39
39
|
/**
|
|
40
40
|
* CommandAlertDialogHeader
|
|
41
41
|
*/
|
|
42
42
|
declare function CommandAlertDialogHeader({
|
|
43
43
|
children,
|
|
44
44
|
...props
|
|
45
|
-
}: React.HTMLAttributes<HTMLElement>):
|
|
45
|
+
}: React.HTMLAttributes<HTMLElement>): react_jsx_runtime11.JSX.Element;
|
|
46
46
|
/**
|
|
47
47
|
* CommandAlertDialogTitle
|
|
48
48
|
*/
|
|
49
49
|
declare function CommandAlertDialogTitle({
|
|
50
50
|
children,
|
|
51
51
|
...props
|
|
52
|
-
}: React.HTMLAttributes<HTMLElement>):
|
|
52
|
+
}: React.HTMLAttributes<HTMLElement>): react_jsx_runtime11.JSX.Element;
|
|
53
53
|
/**
|
|
54
54
|
* CommandAlertDialogDescription
|
|
55
55
|
*/
|
|
56
56
|
declare function CommandAlertDialogDescription({
|
|
57
57
|
children,
|
|
58
58
|
...props
|
|
59
|
-
}: React.HTMLAttributes<HTMLElement>):
|
|
59
|
+
}: React.HTMLAttributes<HTMLElement>): react_jsx_runtime11.JSX.Element;
|
|
60
60
|
/**
|
|
61
61
|
* CommandAlertDialogFooter
|
|
62
62
|
*/
|
|
63
63
|
declare function CommandAlertDialogFooter({
|
|
64
64
|
children,
|
|
65
65
|
...props
|
|
66
|
-
}: React.HTMLAttributes<HTMLElement>):
|
|
66
|
+
}: React.HTMLAttributes<HTMLElement>): react_jsx_runtime11.JSX.Element;
|
|
67
67
|
/**
|
|
68
68
|
* CommandAlertDialogCancel
|
|
69
69
|
*/
|
|
70
70
|
declare function CommandAlertDialogCancel({
|
|
71
71
|
children,
|
|
72
72
|
...props
|
|
73
|
-
}: AlertDialogCancelProps):
|
|
73
|
+
}: AlertDialogCancelProps): react_jsx_runtime11.JSX.Element;
|
|
74
74
|
/**
|
|
75
75
|
* CommandAlertDialogAction
|
|
76
76
|
*/
|
|
@@ -87,7 +87,7 @@ declare function CommandAlertDialogAction<TData = unknown, TError = DefaultError
|
|
|
87
87
|
children,
|
|
88
88
|
disabled,
|
|
89
89
|
...props
|
|
90
|
-
}: CommandAlertDialogActionProps<TData, TError, TVariables, TOnMutateResult>):
|
|
90
|
+
}: CommandAlertDialogActionProps<TData, TError, TVariables, TOnMutateResult>): react_jsx_runtime11.JSX.Element;
|
|
91
91
|
//#endregion
|
|
92
92
|
export { CommandAlertDialog, CommandAlertDialogAction, CommandAlertDialogCancel, CommandAlertDialogContent, CommandAlertDialogDescription, CommandAlertDialogFooter, CommandAlertDialogHeader, CommandAlertDialogTitle, CommandAlertDialogTrigger };
|
|
93
93
|
//# sourceMappingURL=alert-dialog-command.client.d.mts.map
|