@vitnode/core 1.2.0-canary.52 → 1.2.0-canary.53
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/config/next.config.ts +3 -3
- package/dist/scripts/get-config.d.ts +2 -2
- package/dist/scripts/get-config.d.ts.map +1 -1
- package/dist/scripts/plugin.d.ts.map +1 -1
- package/dist/scripts/prepare-database.d.ts.map +1 -1
- package/dist/scripts/prepare-plugins-files.d.ts.map +1 -1
- package/dist/scripts/scripts.js +4 -4
- package/dist/scripts/shared/file-utils.d.ts.map +1 -1
- package/dist/src/api/adapters/email/nodemailer.d.ts +1 -1
- package/dist/src/api/adapters/email/nodemailer.js +3 -3
- package/dist/src/api/adapters/email/resend.d.ts +1 -1
- package/dist/src/api/adapters/email/resend.js +2 -2
- package/dist/src/api/adapters/sso/discord.d.ts +1 -1
- package/dist/src/api/adapters/sso/discord.d.ts.map +1 -1
- package/dist/src/api/adapters/sso/discord.js +21 -21
- package/dist/src/api/adapters/sso/facebook.d.ts +1 -1
- package/dist/src/api/adapters/sso/facebook.d.ts.map +1 -1
- package/dist/src/api/adapters/sso/facebook.js +23 -23
- package/dist/src/api/adapters/sso/google.d.ts +1 -1
- package/dist/src/api/adapters/sso/google.d.ts.map +1 -1
- package/dist/src/api/adapters/sso/google.js +21 -21
- package/dist/src/api/config.d.ts +3 -3
- package/dist/src/api/config.d.ts.map +1 -1
- package/dist/src/api/config.js +11 -11
- package/dist/src/api/lib/check-plugin-id.js +8 -8
- package/dist/src/api/lib/logger-middleware.d.ts +1 -1
- package/dist/src/api/lib/logger-middleware.js +9 -9
- package/dist/src/api/lib/module.d.ts +2 -2
- package/dist/src/api/lib/plugin.d.ts +2 -2
- package/dist/src/api/lib/plugin.d.ts.map +1 -1
- package/dist/src/api/lib/route.d.ts +2 -2
- package/dist/src/api/lib/route.d.ts.map +1 -1
- package/dist/src/api/lib/route.js +1 -1
- package/dist/src/api/lib/with-pagination.d.ts +7 -7
- package/dist/src/api/lib/with-pagination.d.ts.map +1 -1
- package/dist/src/api/lib/with-pagination.js +37 -24
- package/dist/src/api/middlewares/captcha.middleware.d.ts +1 -1
- package/dist/src/api/middlewares/captcha.middleware.d.ts.map +1 -1
- package/dist/src/api/middlewares/captcha.middleware.js +14 -13
- package/dist/src/api/middlewares/global.middleware.d.ts +12 -12
- package/dist/src/api/middlewares/global.middleware.d.ts.map +1 -1
- package/dist/src/api/middlewares/global.middleware.js +29 -28
- package/dist/src/api/middlewares/rate-limiter.middleware.d.ts +3 -3
- package/dist/src/api/middlewares/rate-limiter.middleware.d.ts.map +1 -1
- package/dist/src/api/middlewares/rate-limiter.middleware.js +4 -4
- package/dist/src/api/models/device.d.ts +1 -1
- package/dist/src/api/models/device.d.ts.map +1 -1
- package/dist/src/api/models/device.js +13 -13
- package/dist/src/api/models/email.d.ts +15 -15
- package/dist/src/api/models/email.d.ts.map +1 -1
- package/dist/src/api/models/email.js +11 -10
- package/dist/src/api/models/password.js +9 -9
- package/dist/src/api/models/session-admin.d.ts +1 -1
- package/dist/src/api/models/session-admin.d.ts.map +1 -1
- package/dist/src/api/models/session-admin.js +19 -19
- package/dist/src/api/models/session.d.ts +1 -1
- package/dist/src/api/models/session.d.ts.map +1 -1
- package/dist/src/api/models/session.js +17 -17
- package/dist/src/api/models/sso.d.ts +1 -1
- package/dist/src/api/models/sso.d.ts.map +1 -1
- package/dist/src/api/models/sso.js +22 -25
- package/dist/src/api/models/user/get-user-by-id.d.ts +1 -1
- package/dist/src/api/models/user/get-user-by-id.d.ts.map +1 -1
- package/dist/src/api/models/user/get-user-by-id.js +1 -1
- package/dist/src/api/models/user/sign-in-with-passwords.d.ts +1 -1
- package/dist/src/api/models/user/sign-in-with-passwords.d.ts.map +1 -1
- package/dist/src/api/models/user/sign-in-with-passwords.js +1 -1
- package/dist/src/api/models/user/sign-up.d.ts +1 -1
- package/dist/src/api/models/user/sign-up.d.ts.map +1 -1
- package/dist/src/api/models/user/sign-up.js +11 -12
- package/dist/src/api/models/user.d.ts.map +1 -1
- package/dist/src/api/modules/admin/admin.module.d.ts +3 -3
- package/dist/src/api/modules/admin/admin.module.js +1 -1
- package/dist/src/api/modules/admin/debug/debug.admin.module.d.ts +1 -1
- package/dist/src/api/modules/admin/debug/debug.admin.module.js +1 -1
- package/dist/src/api/modules/admin/debug/routes/logs.route.d.ts +2 -2
- package/dist/src/api/modules/admin/debug/routes/logs.route.js +16 -16
- package/dist/src/api/modules/admin/routes/session.route.d.ts +2 -2
- package/dist/src/api/modules/admin/routes/session.route.js +7 -7
- package/dist/src/api/modules/admin/users/routes/list.route.d.ts +2 -2
- package/dist/src/api/modules/admin/users/routes/list.route.js +12 -12
- package/dist/src/api/modules/admin/users/routes/users.route.d.ts +2 -2
- package/dist/src/api/modules/admin/users/routes/users.route.js +15 -15
- package/dist/src/api/modules/admin/users/users.admin.module.d.ts +1 -1
- package/dist/src/api/modules/admin/users/users.admin.module.js +1 -1
- package/dist/src/api/modules/middleware/middleware.module.d.ts +1 -1
- package/dist/src/api/modules/middleware/middleware.module.js +1 -1
- package/dist/src/api/modules/middleware/route.d.ts +2 -2
- package/dist/src/api/modules/middleware/route.js +12 -12
- package/dist/src/api/modules/users/routes/change-password.route.d.ts +2 -2
- package/dist/src/api/modules/users/routes/change-password.route.js +13 -13
- package/dist/src/api/modules/users/routes/reset-passowrd.route.d.ts +2 -2
- package/dist/src/api/modules/users/routes/reset-passowrd.route.js +17 -17
- package/dist/src/api/modules/users/routes/session.route.d.ts +2 -2
- package/dist/src/api/modules/users/routes/session.route.js +6 -6
- package/dist/src/api/modules/users/routes/sign-in.route.d.ts +3 -3
- package/dist/src/api/modules/users/routes/sign-in.route.js +10 -10
- package/dist/src/api/modules/users/routes/sign-out.route.d.ts +2 -2
- package/dist/src/api/modules/users/routes/sign-out.route.js +7 -7
- package/dist/src/api/modules/users/routes/sign-up.route.d.ts +3 -3
- package/dist/src/api/modules/users/routes/sign-up.route.js +14 -14
- package/dist/src/api/modules/users/routes/test.route.d.ts +3 -3
- package/dist/src/api/modules/users/routes/test.route.js +9 -9
- package/dist/src/api/modules/users/sso/routes/callback.route.d.ts +2 -2
- package/dist/src/api/modules/users/sso/routes/callback.route.js +8 -8
- package/dist/src/api/modules/users/sso/routes/create-url.route.d.ts +2 -2
- package/dist/src/api/modules/users/sso/routes/create-url.route.js +6 -6
- package/dist/src/api/modules/users/sso/sso.module.d.ts +2 -2
- package/dist/src/api/modules/users/sso/sso.module.js +1 -1
- package/dist/src/api/modules/users/users.module.d.ts +12 -12
- package/dist/src/api/modules/users/users.module.js +1 -1
- package/dist/src/app/login/page.d.ts +1 -1
- package/dist/src/app/login/page.js +2 -2
- package/dist/src/app/login/reset-password/page.d.ts +2 -2
- package/dist/src/app/login/reset-password/page.js +2 -2
- package/dist/src/app/register/page.d.ts +1 -1
- package/dist/src/app/register/page.js +2 -2
- package/dist/src/app_admin/core/debug/page.d.ts +1 -1
- package/dist/src/app_admin/core/debug/page.js +8 -8
- package/dist/src/app_admin/core/users/page.d.ts +2 -2
- package/dist/src/app_admin/core/users/page.d.ts.map +1 -1
- package/dist/src/app_admin/core/users/page.js +7 -7
- package/dist/src/components/avatar.d.ts +1 -1
- package/dist/src/components/avatar.js +1 -1
- package/dist/src/components/confirm-action/confirm-action-alert-dialog.d.ts +2 -2
- package/dist/src/components/confirm-action/confirm-action-alert-dialog.js +5 -5
- package/dist/src/components/confirm-action/content.d.ts.map +1 -1
- package/dist/src/components/confirm-action/content.js +3 -4
- package/dist/src/components/date-format.js +8 -8
- package/dist/src/components/form/auto-form.d.ts +16 -16
- package/dist/src/components/form/auto-form.d.ts.map +1 -1
- package/dist/src/components/form/auto-form.js +13 -12
- package/dist/src/components/form/common/desc.js +1 -1
- package/dist/src/components/form/common/label.d.ts +1 -1
- package/dist/src/components/form/common/label.js +1 -1
- package/dist/src/components/form/fields/checkbox.d.ts +2 -2
- package/dist/src/components/form/fields/checkbox.d.ts.map +1 -1
- package/dist/src/components/form/fields/combobox-async.d.ts +3 -3
- package/dist/src/components/form/fields/combobox-async.d.ts.map +1 -1
- package/dist/src/components/form/fields/combobox-async.js +29 -23
- package/dist/src/components/form/fields/combobox.d.ts +3 -3
- package/dist/src/components/form/fields/combobox.d.ts.map +1 -1
- package/dist/src/components/form/fields/combobox.js +6 -7
- package/dist/src/components/form/fields/input.d.ts +2 -2
- package/dist/src/components/form/fields/input.d.ts.map +1 -1
- package/dist/src/components/form/fields/input.js +2 -2
- package/dist/src/components/form/fields/radio-group.d.ts +3 -3
- package/dist/src/components/form/fields/radio-group.d.ts.map +1 -1
- package/dist/src/components/form/fields/radio-group.js +0 -1
- package/dist/src/components/form/fields/select.d.ts +3 -3
- package/dist/src/components/form/fields/select.d.ts.map +1 -1
- package/dist/src/components/form/fields/select.js +2 -3
- package/dist/src/components/form/fields/switch.d.ts +2 -2
- package/dist/src/components/form/fields/switch.d.ts.map +1 -1
- package/dist/src/components/form/fields/textarea.d.ts +3 -3
- package/dist/src/components/form/fields/textarea.d.ts.map +1 -1
- package/dist/src/components/form/fields/textarea.js +1 -2
- package/dist/src/components/i18n-provider.d.ts +2 -2
- package/dist/src/components/i18n-provider.js +3 -3
- package/dist/src/components/logo-vitnode.d.ts.map +1 -1
- package/dist/src/components/logo-vitnode.js +8 -2
- package/dist/src/components/switchers/langs/language-swietcher.d.ts +1 -1
- package/dist/src/components/switchers/langs/language-swietcher.d.ts.map +1 -1
- package/dist/src/components/switchers/langs/language-swietcher.js +3 -3
- package/dist/src/components/switchers/themes/theme-switcher.js +4 -4
- package/dist/src/components/table/content.d.ts +1 -1
- package/dist/src/components/table/content.d.ts.map +1 -1
- package/dist/src/components/table/content.js +5 -5
- package/dist/src/components/table/data-table.d.ts +7 -7
- package/dist/src/components/table/data-table.d.ts.map +1 -1
- package/dist/src/components/table/data-table.js +22 -15
- package/dist/src/components/table/order-table-head.d.ts +4 -4
- package/dist/src/components/table/order-table-head.d.ts.map +1 -1
- package/dist/src/components/table/order-table-head.js +20 -9
- package/dist/src/components/table/pagination.js +19 -19
- package/dist/src/components/ui/accordion.d.ts +2 -2
- package/dist/src/components/ui/accordion.d.ts.map +1 -1
- package/dist/src/components/ui/accordion.js +4 -5
- package/dist/src/components/ui/alert-dialog.d.ts +7 -7
- package/dist/src/components/ui/alert-dialog.d.ts.map +1 -1
- package/dist/src/components/ui/alert-dialog.js +12 -12
- package/dist/src/components/ui/alert.d.ts +5 -5
- package/dist/src/components/ui/alert.d.ts.map +1 -1
- package/dist/src/components/ui/alert.js +6 -7
- package/dist/src/components/ui/badge.d.ts +3 -3
- package/dist/src/components/ui/badge.d.ts.map +1 -1
- package/dist/src/components/ui/badge.js +7 -8
- package/dist/src/components/ui/button-client.d.ts +1 -1
- package/dist/src/components/ui/button-client.js +9 -9
- package/dist/src/components/ui/button.d.ts +8 -8
- package/dist/src/components/ui/button.d.ts.map +1 -1
- package/dist/src/components/ui/button.js +13 -14
- package/dist/src/components/ui/card.d.ts +8 -8
- package/dist/src/components/ui/card.js +7 -7
- package/dist/src/components/ui/checkbox.d.ts +2 -2
- package/dist/src/components/ui/checkbox.d.ts.map +1 -1
- package/dist/src/components/ui/checkbox.js +2 -3
- package/dist/src/components/ui/collapsible.d.ts +1 -1
- package/dist/src/components/ui/collapsible.js +1 -1
- package/dist/src/components/ui/command.d.ts +4 -4
- package/dist/src/components/ui/command.d.ts.map +1 -1
- package/dist/src/components/ui/command.js +9 -10
- package/dist/src/components/ui/context-menu.d.ts +4 -4
- package/dist/src/components/ui/context-menu.d.ts.map +1 -1
- package/dist/src/components/ui/context-menu.js +7 -8
- package/dist/src/components/ui/dialog.d.ts +6 -6
- package/dist/src/components/ui/dialog.d.ts.map +1 -1
- package/dist/src/components/ui/dialog.js +16 -16
- package/dist/src/components/ui/drawer.d.ts +4 -4
- package/dist/src/components/ui/drawer.d.ts.map +1 -1
- package/dist/src/components/ui/drawer.js +7 -8
- package/dist/src/components/ui/dropdown-menu.d.ts +4 -4
- package/dist/src/components/ui/dropdown-menu.d.ts.map +1 -1
- package/dist/src/components/ui/dropdown-menu.js +8 -9
- package/dist/src/components/ui/form.d.ts +10 -10
- package/dist/src/components/ui/form.d.ts.map +1 -1
- package/dist/src/components/ui/form.js +15 -15
- package/dist/src/components/ui/header-content.js +1 -1
- package/dist/src/components/ui/hover-card.d.ts +2 -2
- package/dist/src/components/ui/hover-card.d.ts.map +1 -1
- package/dist/src/components/ui/hover-card.js +3 -4
- package/dist/src/components/ui/input-otp.d.ts +5 -5
- package/dist/src/components/ui/input-otp.d.ts.map +1 -1
- package/dist/src/components/ui/input-otp.js +6 -7
- package/dist/src/components/ui/input.d.ts +2 -2
- package/dist/src/components/ui/input.d.ts.map +1 -1
- package/dist/src/components/ui/input.js +1 -2
- package/dist/src/components/ui/label.d.ts +2 -2
- package/dist/src/components/ui/label.d.ts.map +1 -1
- package/dist/src/components/ui/label.js +2 -3
- package/dist/src/components/ui/loader.js +3 -3
- package/dist/src/components/ui/menubar.d.ts +4 -4
- package/dist/src/components/ui/menubar.d.ts.map +1 -1
- package/dist/src/components/ui/menubar.js +11 -12
- package/dist/src/components/ui/navigation-menu.d.ts +2 -2
- package/dist/src/components/ui/navigation-menu.d.ts.map +1 -1
- package/dist/src/components/ui/navigation-menu.js +10 -11
- package/dist/src/components/ui/popover.d.ts +2 -2
- package/dist/src/components/ui/popover.d.ts.map +1 -1
- package/dist/src/components/ui/popover.js +3 -4
- package/dist/src/components/ui/progress.d.ts +2 -2
- package/dist/src/components/ui/progress.d.ts.map +1 -1
- package/dist/src/components/ui/progress.js +2 -3
- package/dist/src/components/ui/radio-group.d.ts +2 -2
- package/dist/src/components/ui/radio-group.d.ts.map +1 -1
- package/dist/src/components/ui/radio-group.js +3 -4
- package/dist/src/components/ui/select.d.ts +3 -3
- package/dist/src/components/ui/select.d.ts.map +1 -1
- package/dist/src/components/ui/select.js +9 -10
- package/dist/src/components/ui/separator.d.ts +2 -2
- package/dist/src/components/ui/separator.d.ts.map +1 -1
- package/dist/src/components/ui/separator.js +3 -4
- package/dist/src/components/ui/sheet.d.ts +5 -5
- package/dist/src/components/ui/sheet.d.ts.map +1 -1
- package/dist/src/components/ui/sheet.js +8 -9
- package/dist/src/components/ui/sidebar.d.ts +31 -31
- package/dist/src/components/ui/sidebar.d.ts.map +1 -1
- package/dist/src/components/ui/sidebar.js +67 -69
- package/dist/src/components/ui/skeleton.d.ts +1 -1
- package/dist/src/components/ui/skeleton.js +1 -1
- package/dist/src/components/ui/slider.d.ts +2 -2
- package/dist/src/components/ui/slider.d.ts.map +1 -1
- package/dist/src/components/ui/slider.js +16 -8
- package/dist/src/components/ui/sonner.d.ts +1 -1
- package/dist/src/components/ui/sonner.d.ts.map +1 -1
- package/dist/src/components/ui/sonner.js +6 -6
- package/dist/src/components/ui/switch.d.ts +2 -2
- package/dist/src/components/ui/switch.d.ts.map +1 -1
- package/dist/src/components/ui/switch.js +3 -4
- package/dist/src/components/ui/table.d.ts +9 -9
- package/dist/src/components/ui/table.d.ts.map +1 -1
- package/dist/src/components/ui/table.js +8 -9
- package/dist/src/components/ui/tabs.d.ts +2 -2
- package/dist/src/components/ui/tabs.d.ts.map +1 -1
- package/dist/src/components/ui/tabs.js +4 -5
- package/dist/src/components/ui/textarea.d.ts +2 -2
- package/dist/src/components/ui/textarea.d.ts.map +1 -1
- package/dist/src/components/ui/textarea.js +1 -2
- package/dist/src/components/ui/toggle-group.d.ts +4 -4
- package/dist/src/components/ui/toggle-group.d.ts.map +1 -1
- package/dist/src/components/ui/toggle-group.js +6 -6
- package/dist/src/components/ui/toggle.d.ts +3 -3
- package/dist/src/components/ui/toggle.d.ts.map +1 -1
- package/dist/src/components/ui/toggle.js +8 -9
- package/dist/src/components/ui/tooltip.d.ts +2 -2
- package/dist/src/components/ui/tooltip.d.ts.map +1 -1
- package/dist/src/components/ui/tooltip.js +2 -3
- package/dist/src/config.js +2 -2
- package/dist/src/database/admins.js +10 -10
- package/dist/src/database/languages.js +7 -7
- package/dist/src/database/logs.js +9 -9
- package/dist/src/database/moderators.js +5 -5
- package/dist/src/database/roles.js +1 -1
- package/dist/src/database/sessions.js +6 -6
- package/dist/src/database/users.js +13 -13
- package/dist/src/drizzle.config.d.ts +2 -2
- package/dist/src/drizzle.config.d.ts.map +1 -1
- package/dist/src/drizzle.config.js +19 -12
- package/dist/src/emails/default-template.d.ts +3 -3
- package/dist/src/emails/default-template.d.ts.map +1 -1
- package/dist/src/emails/default-template.js +39 -38
- package/dist/src/emails/reset-password.d.ts +1 -1
- package/dist/src/emails/reset-password.d.ts.map +1 -1
- package/dist/src/emails/reset-password.js +51 -51
- package/dist/src/emails/ui/button.d.ts +2 -2
- package/dist/src/emails/ui/button.js +13 -13
- package/dist/src/emails/ui/card.d.ts +1 -1
- package/dist/src/emails/ui/card.js +6 -6
- package/dist/src/hooks/use-before-unload.js +3 -3
- package/dist/src/hooks/use-captcha.d.ts +2 -2
- package/dist/src/hooks/use-captcha.d.ts.map +1 -1
- package/dist/src/hooks/use-captcha.js +29 -37
- package/dist/src/hooks/use-mobile.d.ts.map +1 -1
- package/dist/src/hooks/use-mobile.js +3 -4
- package/dist/src/lib/api/get-middleware-api.js +4 -4
- package/dist/src/lib/api/get-session-admin-api.js +5 -5
- package/dist/src/lib/api/get-session-api.js +4 -4
- package/dist/src/lib/colors.js +28 -19
- package/dist/src/lib/colors.test.js +60 -60
- package/dist/src/lib/config.js +3 -3
- package/dist/src/lib/fetcher/cookie-from-string-to-object.d.ts.map +1 -1
- package/dist/src/lib/fetcher/cookie-from-string-to-object.js +1 -1
- package/dist/src/lib/fetcher/cookie-from-string-to-object.test.js +27 -27
- package/dist/src/lib/fetcher/core.d.ts +5 -5
- package/dist/src/lib/fetcher/core.d.ts.map +1 -1
- package/dist/src/lib/fetcher/core.js +11 -10
- package/dist/src/lib/fetcher/helpers-server.d.ts +1 -1
- package/dist/src/lib/fetcher/helpers-server.js +1 -1
- package/dist/src/lib/fetcher/helpers.test.js +17 -17
- package/dist/src/lib/fetcher/types.d.ts +26 -26
- package/dist/src/lib/fetcher/types.d.ts.map +1 -1
- package/dist/src/lib/fetcher-client.d.ts +4 -4
- package/dist/src/lib/fetcher-client.d.ts.map +1 -1
- package/dist/src/lib/fetcher-client.js +3 -3
- package/dist/src/lib/fetcher.d.ts +5 -5
- package/dist/src/lib/fetcher.d.ts.map +1 -1
- package/dist/src/lib/fetcher.js +4 -4
- package/dist/src/lib/helpers/auto-form.d.ts +3 -3
- package/dist/src/lib/helpers/auto-form.d.ts.map +1 -1
- package/dist/src/lib/helpers/auto-form.js +16 -15
- package/dist/src/lib/helpers/auto-form.test.js +129 -129
- package/dist/src/lib/navigation.d.ts +2 -2
- package/dist/src/lib/navigation.d.ts.map +1 -1
- package/dist/src/lib/plugin.d.ts +3 -3
- package/dist/src/lib/special-characters.js +1 -1
- package/dist/src/lib/special-characters.test.js +36 -36
- package/dist/src/lib/utils.d.ts +1 -1
- package/dist/src/tests/setup.d.ts +1 -1
- package/dist/src/views/admin/layouts/admin-layout.d.ts +1 -1
- package/dist/src/views/admin/layouts/admin-layout.d.ts.map +1 -1
- package/dist/src/views/admin/layouts/admin-layout.js +4 -8
- package/dist/src/views/admin/layouts/sidebar/nav/item.d.ts.map +1 -1
- package/dist/src/views/admin/layouts/sidebar/nav/item.js +11 -12
- package/dist/src/views/admin/layouts/sidebar/nav/nav.d.ts +1 -1
- package/dist/src/views/admin/layouts/sidebar/nav/nav.js +11 -11
- package/dist/src/views/admin/layouts/sidebar/sidebar.d.ts +1 -1
- package/dist/src/views/admin/layouts/sidebar/sidebar.d.ts.map +1 -1
- package/dist/src/views/admin/layouts/sidebar/sidebar.js +1 -2
- package/dist/src/views/admin/layouts/sidebar/sign-out.js +1 -1
- package/dist/src/views/admin/layouts/user-bar/client.js +5 -5
- package/dist/src/views/admin/layouts/user-bar/user-bar.d.ts +1 -1
- package/dist/src/views/admin/layouts/user-bar/user-bar.d.ts.map +1 -1
- package/dist/src/views/admin/layouts/user-bar/user-bar.js +1 -1
- package/dist/src/views/admin/sign-in/sign-in-admin-view.js +1 -1
- package/dist/src/views/admin/views/core/dashboard/dashboard-admin-view.js +3 -3
- package/dist/src/views/admin/views/core/debug/actions/clear-cache/clear-cache.js +10 -10
- package/dist/src/views/admin/views/core/debug/actions/clear-cache/mutation-api.js +2 -2
- package/dist/src/views/admin/views/core/debug/system-logs/actions/more/content.d.ts +1 -1
- package/dist/src/views/admin/views/core/debug/system-logs/actions/more/content.d.ts.map +1 -1
- package/dist/src/views/admin/views/core/debug/system-logs/actions/more/content.js +15 -15
- package/dist/src/views/admin/views/core/debug/system-logs/actions/more/more.d.ts +1 -1
- package/dist/src/views/admin/views/core/debug/system-logs/actions/more/more.js +7 -7
- package/dist/src/views/admin/views/core/debug/system-logs/badges/badge-status.d.ts.map +1 -1
- package/dist/src/views/admin/views/core/debug/system-logs/badges/badge-status.js +7 -1
- package/dist/src/views/admin/views/core/debug/system-logs/badges/badge-type-log.d.ts +1 -1
- package/dist/src/views/admin/views/core/debug/system-logs/badges/badge-type-log.js +3 -3
- package/dist/src/views/admin/views/core/debug/system-logs/system-logs-view.js +25 -25
- package/dist/src/views/admin/views/core/test.js +43 -43
- package/dist/src/views/admin/views/core/users/users-admin-view.d.ts.map +1 -1
- package/dist/src/views/admin/views/core/users/users-admin-view.js +13 -14
- package/dist/src/views/auth/password-reset/change-password-form/form.js +9 -9
- package/dist/src/views/auth/password-reset/change-password-form/mutation-api.d.ts +2 -2
- package/dist/src/views/auth/password-reset/change-password-form/mutation-api.js +5 -5
- package/dist/src/views/auth/password-reset/change-password-form/use-form.d.ts +2 -2
- package/dist/src/views/auth/password-reset/change-password-form/use-form.d.ts.map +1 -1
- package/dist/src/views/auth/password-reset/change-password-form/use-form.js +7 -7
- package/dist/src/views/auth/password-reset/form/form.d.ts +2 -2
- package/dist/src/views/auth/password-reset/form/form.d.ts.map +1 -1
- package/dist/src/views/auth/password-reset/form/form.js +15 -15
- package/dist/src/views/auth/password-reset/form/mutation-api.js +5 -5
- package/dist/src/views/auth/password-reset/form/use-form.d.ts +2 -2
- package/dist/src/views/auth/password-reset/form/use-form.js +7 -7
- package/dist/src/views/auth/password-reset/password-reset-view.js +4 -4
- package/dist/src/views/auth/sign-in/form/form.js +9 -9
- package/dist/src/views/auth/sign-in/form/mutation-api.d.ts +2 -2
- package/dist/src/views/auth/sign-in/form/mutation-api.d.ts.map +1 -1
- package/dist/src/views/auth/sign-in/form/mutation-api.js +10 -10
- package/dist/src/views/auth/sign-in/form/use-form.d.ts +2 -2
- package/dist/src/views/auth/sign-in/form/use-form.js +11 -11
- package/dist/src/views/auth/sign-in/sign-in-view.js +5 -5
- package/dist/src/views/auth/sign-up/components/password-input.d.ts +3 -3
- package/dist/src/views/auth/sign-up/components/password-input.d.ts.map +1 -1
- package/dist/src/views/auth/sign-up/components/password-input.js +9 -10
- package/dist/src/views/auth/sign-up/email-confirmation-view.js +4 -4
- package/dist/src/views/auth/sign-up/form/form.d.ts +2 -2
- package/dist/src/views/auth/sign-up/form/form.d.ts.map +1 -1
- package/dist/src/views/auth/sign-up/form/form.js +18 -18
- package/dist/src/views/auth/sign-up/form/mutation-api.d.ts +2 -2
- package/dist/src/views/auth/sign-up/form/mutation-api.d.ts.map +1 -1
- package/dist/src/views/auth/sign-up/form/mutation-api.js +6 -6
- package/dist/src/views/auth/sign-up/form/use-form.d.ts +2 -2
- package/dist/src/views/auth/sign-up/form/use-form.js +21 -21
- package/dist/src/views/auth/sign-up/sign-up-view.js +5 -5
- package/dist/src/views/auth/sign-up/wrapper.d.ts +1 -1
- package/dist/src/views/auth/sign-up/wrapper.d.ts.map +1 -1
- package/dist/src/views/auth/sign-up/wrapper.js +5 -8
- package/dist/src/views/auth/sso/buttons/client.js +4 -4
- package/dist/src/views/auth/sso/buttons/mutation-api.js +5 -5
- package/dist/src/views/auth/sso/buttons/sso-buttons.js +2 -2
- package/dist/src/views/auth/sso/callback/callback-sso-view.js +6 -6
- package/dist/src/views/auth/sso/callback/client/client.d.ts +1 -1
- package/dist/src/views/auth/sso/callback/client/client.d.ts.map +1 -1
- package/dist/src/views/auth/sso/callback/client/client.js +9 -9
- package/dist/src/views/auth/sso/callback/client/mutation-api.js +7 -7
- package/dist/src/views/error/back-button.js +1 -1
- package/dist/src/views/error/error-view.js +4 -4
- package/dist/src/views/error/global-error-view.d.ts +3 -3
- package/dist/src/views/error/global-error-view.d.ts.map +1 -1
- package/dist/src/views/error/global-error-view.js +36 -44
- package/dist/src/views/layouts/provider.d.ts +4 -4
- package/dist/src/views/layouts/provider.d.ts.map +1 -1
- package/dist/src/views/layouts/provider.js +3 -3
- package/dist/src/views/layouts/root-layout.d.ts +3 -3
- package/dist/src/views/layouts/root-layout.d.ts.map +1 -1
- package/dist/src/views/layouts/root-layout.js +1 -2
- package/dist/src/views/layouts/theme/header/header.d.ts +2 -2
- package/dist/src/views/layouts/theme/header/header.d.ts.map +1 -1
- package/dist/src/views/layouts/theme/header/header.js +1 -1
- package/dist/src/views/layouts/theme/header/user/auth/client.d.ts +1 -1
- package/dist/src/views/layouts/theme/header/user/auth/client.d.ts.map +1 -1
- package/dist/src/views/layouts/theme/header/user/auth/client.js +4 -4
- package/dist/src/views/layouts/theme/header/user/auth/log-out-mutation-api.js +8 -8
- package/dist/src/views/layouts/theme/header/user/user.js +4 -4
- package/dist/src/views/layouts/theme/layout.d.ts +2 -2
- package/dist/src/views/layouts/theme/layout.js +1 -1
- package/dist/src/vitnode.config.d.ts +16 -16
- package/dist/src/vitnode.config.d.ts.map +1 -1
- package/dist/src/vitnode.config.js +3 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -5
- package/src/app/login/page.tsx +5 -5
- package/src/app/login/reset-password/page.tsx +5 -5
- package/src/app/login/sso/[providerId]/page.tsx +1 -1
- package/src/app/register/page.tsx +5 -5
- package/src/app_admin/core/debug/page.tsx +14 -14
- package/src/app_admin/core/page.tsx +1 -1
- package/src/app_admin/core/test/page.tsx +1 -1
- package/src/app_admin/core/users/page.tsx +12 -13
|
@@ -18,7 +18,7 @@ export declare const middlewareModule: import("../../../api/lib/module").BuildMo
|
|
|
18
18
|
responses: {
|
|
19
19
|
200: {
|
|
20
20
|
content: {
|
|
21
|
-
|
|
21
|
+
"application/json": {
|
|
22
22
|
schema: import("zod").ZodObject<{
|
|
23
23
|
sso: import("zod").ZodArray<import("zod").ZodObject<{
|
|
24
24
|
id: import("zod").ZodString;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { z } from
|
|
1
|
+
import { z } from "zod";
|
|
2
2
|
export declare const routeMiddlewareSchema: z.ZodObject<{
|
|
3
3
|
sso: z.ZodArray<z.ZodObject<{
|
|
4
4
|
id: z.ZodString;
|
|
@@ -33,7 +33,7 @@ export declare const routeMiddleware: {
|
|
|
33
33
|
responses: {
|
|
34
34
|
200: {
|
|
35
35
|
content: {
|
|
36
|
-
|
|
36
|
+
"application/json": {
|
|
37
37
|
schema: z.ZodObject<{
|
|
38
38
|
sso: z.ZodArray<z.ZodObject<{
|
|
39
39
|
id: z.ZodString;
|
|
@@ -10,39 +10,39 @@ export const routeMiddlewareSchema = z.object({
|
|
|
10
10
|
captcha: z.object({
|
|
11
11
|
siteKey: z.string(),
|
|
12
12
|
type: z.enum([
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
"cloudflare_turnstile",
|
|
14
|
+
"recaptcha_v3"
|
|
15
15
|
])
|
|
16
16
|
}).optional()
|
|
17
17
|
});
|
|
18
18
|
export const routeMiddleware = buildRoute({
|
|
19
19
|
...CONFIG_PLUGIN,
|
|
20
20
|
route: {
|
|
21
|
-
path:
|
|
22
|
-
method:
|
|
23
|
-
description:
|
|
21
|
+
path: "/",
|
|
22
|
+
method: "get",
|
|
23
|
+
description: "Middleware route with user authentication",
|
|
24
24
|
responses: {
|
|
25
25
|
200: {
|
|
26
26
|
content: {
|
|
27
|
-
|
|
27
|
+
"application/json": {
|
|
28
28
|
schema: routeMiddlewareSchema
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
|
-
description:
|
|
31
|
+
description: "Middleware route"
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
35
|
handler: (c)=>{
|
|
36
|
-
const sso = c.get(
|
|
36
|
+
const sso = c.get("core").authorization.ssoAdapters;
|
|
37
37
|
return c.json({
|
|
38
|
-
isEmail: !!c.get(
|
|
38
|
+
isEmail: !!c.get("core").email?.adapter,
|
|
39
39
|
sso: sso.map((s)=>({
|
|
40
40
|
id: s.id,
|
|
41
41
|
name: s.name
|
|
42
42
|
})),
|
|
43
|
-
captcha: c.get(
|
|
44
|
-
siteKey: c.get(
|
|
45
|
-
type: c.get(
|
|
43
|
+
captcha: c.get("core").captcha ? {
|
|
44
|
+
siteKey: c.get("core").captcha?.siteKey ?? "",
|
|
45
|
+
type: c.get("core").captcha?.type ?? "cloudflare_turnstile"
|
|
46
46
|
} : undefined
|
|
47
47
|
}, 200);
|
|
48
48
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { z } from
|
|
1
|
+
import { z } from "zod";
|
|
2
2
|
export declare const zodChangePasswordSchema: z.ZodObject<{
|
|
3
3
|
password: z.ZodString;
|
|
4
4
|
userId: z.ZodNumber;
|
|
@@ -30,7 +30,7 @@ export declare const changePasswordRoute: {
|
|
|
30
30
|
body: {
|
|
31
31
|
required: true;
|
|
32
32
|
content: {
|
|
33
|
-
|
|
33
|
+
"application/json": {
|
|
34
34
|
schema: z.ZodObject<{
|
|
35
35
|
password: z.ZodString;
|
|
36
36
|
userId: z.ZodNumber;
|
|
@@ -7,26 +7,26 @@ import { CONFIG_PLUGIN } from "../../../../config.js";
|
|
|
7
7
|
import { core_users, core_users_forgot_password } from "../../../../database/users.js";
|
|
8
8
|
export const zodChangePasswordSchema = z.object({
|
|
9
9
|
password: z.string().min(8).openapi({
|
|
10
|
-
example:
|
|
10
|
+
example: "Test123!"
|
|
11
11
|
}),
|
|
12
12
|
userId: z.number().openapi({
|
|
13
13
|
example: 123456
|
|
14
14
|
}),
|
|
15
15
|
token: z.string().openapi({
|
|
16
|
-
example:
|
|
16
|
+
example: "abcdefg12345"
|
|
17
17
|
})
|
|
18
18
|
});
|
|
19
19
|
export const changePasswordRoute = buildRoute({
|
|
20
20
|
...CONFIG_PLUGIN,
|
|
21
21
|
route: {
|
|
22
|
-
method:
|
|
23
|
-
description:
|
|
24
|
-
path:
|
|
22
|
+
method: "post",
|
|
23
|
+
description: "Change user password",
|
|
24
|
+
path: "/change-password",
|
|
25
25
|
request: {
|
|
26
26
|
body: {
|
|
27
27
|
required: true,
|
|
28
28
|
content: {
|
|
29
|
-
|
|
29
|
+
"application/json": {
|
|
30
30
|
schema: zodChangePasswordSchema
|
|
31
31
|
}
|
|
32
32
|
}
|
|
@@ -34,25 +34,25 @@ export const changePasswordRoute = buildRoute({
|
|
|
34
34
|
},
|
|
35
35
|
responses: {
|
|
36
36
|
201: {
|
|
37
|
-
description:
|
|
37
|
+
description: "Password changed"
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
41
|
handler: async (c)=>{
|
|
42
|
-
const { password, userId, token } = c.req.valid(
|
|
43
|
-
const [user] = await c.get(
|
|
42
|
+
const { password, userId, token } = c.req.valid("json");
|
|
43
|
+
const [user] = await c.get("db").select().from(core_users_forgot_password).where(and(eq(core_users_forgot_password.userId, userId), eq(core_users_forgot_password.token, token), gt(core_users_forgot_password.expiresAt, new Date()))).limit(1);
|
|
44
44
|
if (!user) {
|
|
45
45
|
throw new HTTPException(400, {
|
|
46
|
-
message:
|
|
46
|
+
message: "Invalid token"
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
const hashPassword = await new PasswordModel().encryptPassword(password);
|
|
50
50
|
await Promise.all([
|
|
51
|
-
c.get(
|
|
51
|
+
c.get("db").update(core_users).set({
|
|
52
52
|
password: hashPassword
|
|
53
53
|
}).where(eq(core_users.id, userId)),
|
|
54
|
-
c.get(
|
|
54
|
+
c.get("db").delete(core_users_forgot_password).where(eq(core_users_forgot_password.id, user.id))
|
|
55
55
|
]);
|
|
56
|
-
return c.text(
|
|
56
|
+
return c.text("Password changed", 201);
|
|
57
57
|
}
|
|
58
58
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { z } from
|
|
1
|
+
import { z } from "zod";
|
|
2
2
|
export declare const resetPasswordRoute: {
|
|
3
3
|
handler: (c: import("hono").Context<import("../../../middlewares/global.middleware").EnvVitNode, "/reset-password", {
|
|
4
4
|
in: {
|
|
@@ -22,7 +22,7 @@ export declare const resetPasswordRoute: {
|
|
|
22
22
|
body: {
|
|
23
23
|
required: true;
|
|
24
24
|
content: {
|
|
25
|
-
|
|
25
|
+
"application/json": {
|
|
26
26
|
schema: z.ZodObject<{
|
|
27
27
|
email: z.ZodEmail;
|
|
28
28
|
}, z.core.$strip>;
|
|
@@ -10,18 +10,18 @@ import { CONFIG } from "../../../../lib/config.js";
|
|
|
10
10
|
export const resetPasswordRoute = buildRoute({
|
|
11
11
|
...CONFIG_PLUGIN,
|
|
12
12
|
route: {
|
|
13
|
-
method:
|
|
14
|
-
description:
|
|
15
|
-
path:
|
|
13
|
+
method: "post",
|
|
14
|
+
description: "Request a password reset",
|
|
15
|
+
path: "/reset-password",
|
|
16
16
|
withCaptcha: true,
|
|
17
17
|
request: {
|
|
18
18
|
body: {
|
|
19
19
|
required: true,
|
|
20
20
|
content: {
|
|
21
|
-
|
|
21
|
+
"application/json": {
|
|
22
22
|
schema: z.object({
|
|
23
23
|
email: z.email().toLowerCase().openapi({
|
|
24
|
-
example:
|
|
24
|
+
example: "test@test.com"
|
|
25
25
|
})
|
|
26
26
|
})
|
|
27
27
|
}
|
|
@@ -30,14 +30,14 @@ export const resetPasswordRoute = buildRoute({
|
|
|
30
30
|
},
|
|
31
31
|
responses: {
|
|
32
32
|
201: {
|
|
33
|
-
description:
|
|
33
|
+
description: "Email sent"
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
37
|
handler: async (c)=>{
|
|
38
|
-
const RESPONSE_TEXT = c.text(
|
|
39
|
-
const { email } = c.req.valid(
|
|
40
|
-
const [findUser] = await c.get(
|
|
38
|
+
const RESPONSE_TEXT = c.text("Email sent", 201);
|
|
39
|
+
const { email } = c.req.valid("json");
|
|
40
|
+
const [findUser] = await c.get("db").select({
|
|
41
41
|
email: core_users.email,
|
|
42
42
|
id: core_users.id,
|
|
43
43
|
language: core_users.language
|
|
@@ -46,30 +46,30 @@ export const resetPasswordRoute = buildRoute({
|
|
|
46
46
|
return RESPONSE_TEXT;
|
|
47
47
|
}
|
|
48
48
|
const hashToken = new ForgotPasswordTokenModel().generateResetToken();
|
|
49
|
-
const [findLastRecord] = await c.get(
|
|
49
|
+
const [findLastRecord] = await c.get("db").select().from(core_users_forgot_password).where(eq(core_users_forgot_password.userId, findUser.id)).limit(1);
|
|
50
50
|
// If a record will be found with createdAt in the last 5 minutes, skip
|
|
51
51
|
if (findLastRecord?.createdAt > new Date(Date.now() - 1000 * 60 * 5)) {
|
|
52
52
|
return RESPONSE_TEXT;
|
|
53
53
|
}
|
|
54
54
|
const EXPIRES_AT = new Date(Date.now() + 1000 * 60 * 30); // 30 minutes
|
|
55
55
|
if (findLastRecord) {
|
|
56
|
-
await c.get(
|
|
56
|
+
await c.get("db").update(core_users_forgot_password).set({
|
|
57
57
|
createdAt: new Date(),
|
|
58
58
|
expiresAt: EXPIRES_AT,
|
|
59
59
|
token: hashToken,
|
|
60
|
-
ipAddress: c.get(
|
|
60
|
+
ipAddress: c.get("ipAddress")
|
|
61
61
|
}).where(eq(core_users_forgot_password.id, findLastRecord.id));
|
|
62
62
|
} else {
|
|
63
|
-
await c.get(
|
|
63
|
+
await c.get("db").insert(core_users_forgot_password).values({
|
|
64
64
|
token: hashToken,
|
|
65
|
-
ipAddress: c.get(
|
|
65
|
+
ipAddress: c.get("ipAddress"),
|
|
66
66
|
userId: findUser.id,
|
|
67
67
|
expiresAt: EXPIRES_AT
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
70
|
// Send email
|
|
71
71
|
const resetUrlNative = new URL(`login/reset-password?token=${hashToken}&userId=${findUser.id}`, CONFIG.web.href);
|
|
72
|
-
await c.get(
|
|
72
|
+
await c.get("email").send({
|
|
73
73
|
user: {
|
|
74
74
|
id: findUser.id,
|
|
75
75
|
email: findUser.email,
|
|
@@ -79,11 +79,11 @@ export const resetPasswordRoute = buildRoute({
|
|
|
79
79
|
...props,
|
|
80
80
|
resetUrl: resetUrlNative.href,
|
|
81
81
|
expiryDate: EXPIRES_AT,
|
|
82
|
-
userIpAddress: c.get(
|
|
82
|
+
userIpAddress: c.get("ipAddress")
|
|
83
83
|
}),
|
|
84
84
|
subject: ({ i18n })=>{
|
|
85
85
|
const t = createTranslator(i18n);
|
|
86
|
-
return t(
|
|
86
|
+
return t("core.auth.reset_password.email.subject");
|
|
87
87
|
}
|
|
88
88
|
});
|
|
89
89
|
return RESPONSE_TEXT;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { z } from
|
|
1
|
+
import { z } from "zod";
|
|
2
2
|
export declare const sessionRoute: {
|
|
3
3
|
handler: (c: import("hono").Context<import("../../../middlewares/global.middleware").EnvVitNode, "/session", {}>) => Promise<Response & import("hono").TypedResponse<{
|
|
4
4
|
user: {
|
|
@@ -23,7 +23,7 @@ export declare const sessionRoute: {
|
|
|
23
23
|
responses: {
|
|
24
24
|
200: {
|
|
25
25
|
content: {
|
|
26
|
-
|
|
26
|
+
"application/json": {
|
|
27
27
|
schema: z.ZodObject<{
|
|
28
28
|
user: z.ZodNullable<z.ZodObject<{
|
|
29
29
|
id: z.ZodNumber;
|
|
@@ -5,13 +5,13 @@ import { CONFIG_PLUGIN } from "../../../../config.js";
|
|
|
5
5
|
export const sessionRoute = buildRoute({
|
|
6
6
|
...CONFIG_PLUGIN,
|
|
7
7
|
route: {
|
|
8
|
-
method:
|
|
9
|
-
description:
|
|
10
|
-
path:
|
|
8
|
+
method: "get",
|
|
9
|
+
description: "Verify session",
|
|
10
|
+
path: "/session",
|
|
11
11
|
responses: {
|
|
12
12
|
200: {
|
|
13
13
|
content: {
|
|
14
|
-
|
|
14
|
+
"application/json": {
|
|
15
15
|
schema: z.object({
|
|
16
16
|
user: z.object({
|
|
17
17
|
id: z.number(),
|
|
@@ -29,12 +29,12 @@ export const sessionRoute = buildRoute({
|
|
|
29
29
|
})
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
|
-
description:
|
|
32
|
+
description: "User"
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
handler: async (c)=>{
|
|
37
|
-
const user = c.get(
|
|
37
|
+
const user = c.get("user");
|
|
38
38
|
const admin = new SessionAdminModel(c);
|
|
39
39
|
return c.json({
|
|
40
40
|
user: user ? {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { z } from
|
|
1
|
+
import { z } from "zod";
|
|
2
2
|
export declare const zodSignInSchema: z.ZodObject<{
|
|
3
3
|
email: z.ZodEmail;
|
|
4
4
|
password: z.ZodString;
|
|
@@ -33,7 +33,7 @@ export declare const signInRoute: {
|
|
|
33
33
|
body: {
|
|
34
34
|
required: true;
|
|
35
35
|
content: {
|
|
36
|
-
|
|
36
|
+
"application/json": {
|
|
37
37
|
schema: z.ZodObject<{
|
|
38
38
|
email: z.ZodEmail;
|
|
39
39
|
password: z.ZodString;
|
|
@@ -49,7 +49,7 @@ export declare const signInRoute: {
|
|
|
49
49
|
};
|
|
50
50
|
201: {
|
|
51
51
|
content: {
|
|
52
|
-
|
|
52
|
+
"application/json": {
|
|
53
53
|
schema: z.ZodObject<{
|
|
54
54
|
id: z.ZodNumber;
|
|
55
55
|
token: z.ZodString;
|
|
@@ -6,10 +6,10 @@ import { UserModel } from "../../../models/user.js";
|
|
|
6
6
|
import { CONFIG_PLUGIN } from "../../../../config.js";
|
|
7
7
|
export const zodSignInSchema = z.object({
|
|
8
8
|
email: z.email().toLowerCase().openapi({
|
|
9
|
-
example:
|
|
9
|
+
example: "test@test.com"
|
|
10
10
|
}),
|
|
11
11
|
password: z.string().openapi({
|
|
12
|
-
example:
|
|
12
|
+
example: "Test123!"
|
|
13
13
|
}),
|
|
14
14
|
isAdmin: z.boolean().optional().openapi({
|
|
15
15
|
example: false
|
|
@@ -18,14 +18,14 @@ export const zodSignInSchema = z.object({
|
|
|
18
18
|
export const signInRoute = buildRoute({
|
|
19
19
|
...CONFIG_PLUGIN,
|
|
20
20
|
route: {
|
|
21
|
-
method:
|
|
22
|
-
description:
|
|
23
|
-
path:
|
|
21
|
+
method: "post",
|
|
22
|
+
description: "Sign in with email and password",
|
|
23
|
+
path: "/sign_in",
|
|
24
24
|
request: {
|
|
25
25
|
body: {
|
|
26
26
|
required: true,
|
|
27
27
|
content: {
|
|
28
|
-
|
|
28
|
+
"application/json": {
|
|
29
29
|
schema: zodSignInSchema
|
|
30
30
|
}
|
|
31
31
|
}
|
|
@@ -33,23 +33,23 @@ export const signInRoute = buildRoute({
|
|
|
33
33
|
},
|
|
34
34
|
responses: {
|
|
35
35
|
403: {
|
|
36
|
-
description:
|
|
36
|
+
description: "Access Denied"
|
|
37
37
|
},
|
|
38
38
|
201: {
|
|
39
39
|
content: {
|
|
40
|
-
|
|
40
|
+
"application/json": {
|
|
41
41
|
schema: z.object({
|
|
42
42
|
id: z.number(),
|
|
43
43
|
token: z.string()
|
|
44
44
|
})
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
|
-
description:
|
|
47
|
+
description: "User signed in"
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
},
|
|
51
51
|
handler: async (c)=>{
|
|
52
|
-
const { password, isAdmin, email } = c.req.valid(
|
|
52
|
+
const { password, isAdmin, email } = c.req.valid("json");
|
|
53
53
|
const data = await new UserModel().signInWithPassword({
|
|
54
54
|
password,
|
|
55
55
|
email,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { z } from
|
|
1
|
+
import { z } from "@hono/zod-openapi";
|
|
2
2
|
export declare const signOutRoute: {
|
|
3
3
|
handler: (c: import("hono").Context<import("../../../middlewares/global.middleware").EnvVitNode, "/sign_out", {
|
|
4
4
|
in: {
|
|
@@ -20,7 +20,7 @@ export declare const signOutRoute: {
|
|
|
20
20
|
request: {
|
|
21
21
|
body: {
|
|
22
22
|
content: {
|
|
23
|
-
|
|
23
|
+
"application/json": {
|
|
24
24
|
schema: z.ZodObject<{
|
|
25
25
|
isAdmin: z.ZodOptional<z.ZodBoolean>;
|
|
26
26
|
}, z.core.$strip>;
|
|
@@ -6,13 +6,13 @@ import { CONFIG_PLUGIN } from "../../../../config.js";
|
|
|
6
6
|
export const signOutRoute = buildRoute({
|
|
7
7
|
...CONFIG_PLUGIN,
|
|
8
8
|
route: {
|
|
9
|
-
method:
|
|
10
|
-
description:
|
|
11
|
-
path:
|
|
9
|
+
method: "delete",
|
|
10
|
+
description: "Sign out the current admin",
|
|
11
|
+
path: "/sign_out",
|
|
12
12
|
request: {
|
|
13
13
|
body: {
|
|
14
14
|
content: {
|
|
15
|
-
|
|
15
|
+
"application/json": {
|
|
16
16
|
schema: z.object({
|
|
17
17
|
isAdmin: z.boolean().optional().openapi({
|
|
18
18
|
example: false
|
|
@@ -24,15 +24,15 @@ export const signOutRoute = buildRoute({
|
|
|
24
24
|
},
|
|
25
25
|
responses: {
|
|
26
26
|
200: {
|
|
27
|
-
description:
|
|
27
|
+
description: "User signed out"
|
|
28
28
|
},
|
|
29
29
|
403: {
|
|
30
|
-
description:
|
|
30
|
+
description: "Access Denied"
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
handler: async (c)=>{
|
|
35
|
-
const { isAdmin } = c.req.valid(
|
|
35
|
+
const { isAdmin } = c.req.valid("json");
|
|
36
36
|
if (isAdmin) {
|
|
37
37
|
await new SessionAdminModel(c).deleteSession();
|
|
38
38
|
return c.json({});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { z } from
|
|
1
|
+
import { z } from "zod";
|
|
2
2
|
export declare const zodSignUpSchema: z.ZodObject<{
|
|
3
3
|
email: z.ZodEmail;
|
|
4
4
|
name: z.ZodString;
|
|
@@ -38,7 +38,7 @@ export declare const signUpRoute: {
|
|
|
38
38
|
body: {
|
|
39
39
|
required: true;
|
|
40
40
|
content: {
|
|
41
|
-
|
|
41
|
+
"application/json": {
|
|
42
42
|
schema: z.ZodObject<{
|
|
43
43
|
email: z.ZodEmail;
|
|
44
44
|
name: z.ZodString;
|
|
@@ -52,7 +52,7 @@ export declare const signUpRoute: {
|
|
|
52
52
|
responses: {
|
|
53
53
|
201: {
|
|
54
54
|
content: {
|
|
55
|
-
|
|
55
|
+
"application/json": {
|
|
56
56
|
schema: z.ZodObject<{
|
|
57
57
|
id: z.ZodNumber;
|
|
58
58
|
emailVerified: z.ZodBoolean;
|
|
@@ -7,30 +7,30 @@ import { SessionModel } from "../../../models/session.js";
|
|
|
7
7
|
const nameRegex = /^(?!.* {2})[\p{L}\p{N}._@ -]*$/u;
|
|
8
8
|
export const zodSignUpSchema = z.object({
|
|
9
9
|
email: z.email().toLowerCase().openapi({
|
|
10
|
-
example:
|
|
10
|
+
example: "test@test.com"
|
|
11
11
|
}),
|
|
12
12
|
name: z.string().openapi({
|
|
13
|
-
example:
|
|
13
|
+
example: "test"
|
|
14
14
|
}).min(3).refine((val)=>nameRegex.test(val), {
|
|
15
|
-
message:
|
|
15
|
+
message: "Invalid name"
|
|
16
16
|
}),
|
|
17
17
|
password: z.string().min(8).openapi({
|
|
18
|
-
example:
|
|
18
|
+
example: "Test123!"
|
|
19
19
|
}),
|
|
20
20
|
newsletter: z.boolean().default(false).optional()
|
|
21
21
|
});
|
|
22
22
|
export const signUpRoute = buildRoute({
|
|
23
23
|
...CONFIG_PLUGIN,
|
|
24
24
|
route: {
|
|
25
|
-
method:
|
|
26
|
-
description:
|
|
27
|
-
path:
|
|
25
|
+
method: "post",
|
|
26
|
+
description: "Create a new user",
|
|
27
|
+
path: "/sign_up",
|
|
28
28
|
withCaptcha: true,
|
|
29
29
|
request: {
|
|
30
30
|
body: {
|
|
31
31
|
required: true,
|
|
32
32
|
content: {
|
|
33
|
-
|
|
33
|
+
"application/json": {
|
|
34
34
|
schema: zodSignUpSchema
|
|
35
35
|
}
|
|
36
36
|
}
|
|
@@ -39,7 +39,7 @@ export const signUpRoute = buildRoute({
|
|
|
39
39
|
responses: {
|
|
40
40
|
201: {
|
|
41
41
|
content: {
|
|
42
|
-
|
|
42
|
+
"application/json": {
|
|
43
43
|
schema: z.object({
|
|
44
44
|
id: z.number(),
|
|
45
45
|
emailVerified: z.boolean(),
|
|
@@ -47,20 +47,20 @@ export const signUpRoute = buildRoute({
|
|
|
47
47
|
})
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
|
-
description:
|
|
50
|
+
description: "User created"
|
|
51
51
|
},
|
|
52
52
|
400: {
|
|
53
|
-
description:
|
|
53
|
+
description: "Bad Request"
|
|
54
54
|
},
|
|
55
55
|
409: {
|
|
56
|
-
description:
|
|
56
|
+
description: "Email or name already exists"
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
},
|
|
60
60
|
handler: async (c)=>{
|
|
61
|
-
const hashedPassword = await new PasswordModel().encryptPassword(c.req.valid(
|
|
61
|
+
const hashedPassword = await new PasswordModel().encryptPassword(c.req.valid("json").password);
|
|
62
62
|
const data = await new UserModel().signUp({
|
|
63
|
-
...c.req.valid(
|
|
63
|
+
...c.req.valid("json"),
|
|
64
64
|
hashedPassword
|
|
65
65
|
}, c);
|
|
66
66
|
if (data.emailVerified) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { z } from
|
|
1
|
+
import { z } from "zod";
|
|
2
2
|
export declare const testRoute: {
|
|
3
3
|
handler: (c: import("hono").Context<import("../../../middlewares/global.middleware").EnvVitNode, "/test", {}>) => Promise<Response & import("hono").TypedResponse<"test", 200 | 201, "text">>;
|
|
4
4
|
pluginId: "@vitnode/core";
|
|
@@ -9,7 +9,7 @@ export declare const testRoute: {
|
|
|
9
9
|
responses: {
|
|
10
10
|
200: {
|
|
11
11
|
content: {
|
|
12
|
-
|
|
12
|
+
"text/plain": {
|
|
13
13
|
schema: z.ZodString;
|
|
14
14
|
};
|
|
15
15
|
};
|
|
@@ -17,7 +17,7 @@ export declare const testRoute: {
|
|
|
17
17
|
};
|
|
18
18
|
201: {
|
|
19
19
|
content: {
|
|
20
|
-
|
|
20
|
+
"text/plain": {
|
|
21
21
|
schema: z.ZodString;
|
|
22
22
|
};
|
|
23
23
|
};
|
|
@@ -4,30 +4,30 @@ import { CONFIG_PLUGIN } from "../../../../config.js";
|
|
|
4
4
|
export const testRoute = buildRoute({
|
|
5
5
|
...CONFIG_PLUGIN,
|
|
6
6
|
route: {
|
|
7
|
-
method:
|
|
8
|
-
description:
|
|
9
|
-
path:
|
|
7
|
+
method: "post",
|
|
8
|
+
description: "Test route",
|
|
9
|
+
path: "/test",
|
|
10
10
|
responses: {
|
|
11
11
|
200: {
|
|
12
12
|
content: {
|
|
13
|
-
|
|
13
|
+
"text/plain": {
|
|
14
14
|
schema: z.string()
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
|
-
description:
|
|
17
|
+
description: "User"
|
|
18
18
|
},
|
|
19
19
|
201: {
|
|
20
20
|
content: {
|
|
21
|
-
|
|
21
|
+
"text/plain": {
|
|
22
22
|
schema: z.string()
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
|
-
description:
|
|
25
|
+
description: "User"
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
29
|
handler: async (c)=>{
|
|
30
|
-
await c.get(
|
|
31
|
-
return c.text(
|
|
30
|
+
await c.get("log").warn("This is a test warn log");
|
|
31
|
+
return c.text("test");
|
|
32
32
|
}
|
|
33
33
|
});
|