@vitnode/core 1.2.0-canary.10
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/LICENSE.md +21 -0
- package/dist/emails/my-email.d.ts +2 -0
- package/dist/emails/my-email.d.ts.map +1 -0
- package/dist/scripts/get-config.d.ts +3 -0
- package/dist/scripts/get-config.d.ts.map +1 -0
- package/dist/scripts/plugin.d.ts +4 -0
- package/dist/scripts/plugin.d.ts.map +1 -0
- package/dist/scripts/prepare-database.d.ts +7 -0
- package/dist/scripts/prepare-database.d.ts.map +1 -0
- package/dist/scripts/prepare-plugins-files.d.ts +2 -0
- package/dist/scripts/prepare-plugins-files.d.ts.map +1 -0
- package/dist/scripts/run-interactive-shell-command.d.ts +2 -0
- package/dist/scripts/run-interactive-shell-command.d.ts.map +1 -0
- package/dist/scripts/scripts.d.ts +3 -0
- package/dist/scripts/scripts.d.ts.map +1 -0
- package/dist/scripts/scripts.js +21 -0
- package/dist/scripts/shared/file-utils.d.ts +14 -0
- package/dist/scripts/shared/file-utils.d.ts.map +1 -0
- package/dist/src/api/config.d.ts +24 -0
- package/dist/src/api/config.d.ts.map +1 -0
- package/dist/src/api/config.js +50 -0
- package/dist/src/api/lib/check-plugin-id.d.ts +15 -0
- package/dist/src/api/lib/check-plugin-id.d.ts.map +1 -0
- package/dist/src/api/lib/check-plugin-id.js +15 -0
- package/dist/src/api/lib/get-user-ip.d.ts +3 -0
- package/dist/src/api/lib/get-user-ip.d.ts.map +1 -0
- package/dist/src/api/lib/get-user-ip.js +8 -0
- package/dist/src/api/lib/module.d.ts +23 -0
- package/dist/src/api/lib/module.d.ts.map +1 -0
- package/dist/src/api/lib/module.js +21 -0
- package/dist/src/api/lib/plugin.d.ts +11 -0
- package/dist/src/api/lib/plugin.d.ts.map +1 -0
- package/dist/src/api/lib/plugin.js +14 -0
- package/dist/src/api/lib/route.d.ts +26 -0
- package/dist/src/api/lib/route.d.ts.map +1 -0
- package/dist/src/api/lib/route.js +23 -0
- package/dist/src/api/lib/with-pagination.d.ts +72 -0
- package/dist/src/api/lib/with-pagination.d.ts.map +1 -0
- package/dist/src/api/lib/with-pagination.js +70 -0
- package/dist/src/api/middlewares/global/global.d.ts +66 -0
- package/dist/src/api/middlewares/global/global.d.ts.map +1 -0
- package/dist/src/api/middlewares/global/global.js +47 -0
- package/dist/src/api/models/device.d.ts +10 -0
- package/dist/src/api/models/device.d.ts.map +1 -0
- package/dist/src/api/models/device.js +54 -0
- package/dist/src/api/models/email.d.ts +22 -0
- package/dist/src/api/models/email.d.ts.map +1 -0
- package/dist/src/api/models/email.js +30 -0
- package/dist/src/api/models/password.d.ts +5 -0
- package/dist/src/api/models/password.d.ts.map +1 -0
- package/dist/src/api/models/password.js +21 -0
- package/dist/src/api/models/session-admin.d.ts +24 -0
- package/dist/src/api/models/session-admin.d.ts.map +1 -0
- package/dist/src/api/models/session-admin.js +73 -0
- package/dist/src/api/models/session.d.ts +23 -0
- package/dist/src/api/models/session.d.ts.map +1 -0
- package/dist/src/api/models/session.js +60 -0
- package/dist/src/api/models/sso.d.ts +38 -0
- package/dist/src/api/models/sso.d.ts.map +1 -0
- package/dist/src/api/models/sso.js +120 -0
- package/dist/src/api/models/user/get-user-by-id.d.ts +17 -0
- package/dist/src/api/models/user/get-user-by-id.d.ts.map +1 -0
- package/dist/src/api/models/user/get-user-by-id.js +18 -0
- package/dist/src/api/models/user/sign-in-with-passwords.d.ts +10 -0
- package/dist/src/api/models/user/sign-in-with-passwords.d.ts.map +1 -0
- package/dist/src/api/models/user/sign-in-with-passwords.js +22 -0
- package/dist/src/api/models/user/sign-up.d.ts +21 -0
- package/dist/src/api/models/user/sign-up.d.ts.map +1 -0
- package/dist/src/api/models/user/sign-up.js +75 -0
- package/dist/src/api/models/user.d.ts +45 -0
- package/dist/src/api/models/user.d.ts.map +1 -0
- package/dist/src/api/models/user.js +8 -0
- package/dist/src/api/modules/admin/admin.module.d.ts +294 -0
- package/dist/src/api/modules/admin/admin.module.d.ts.map +1 -0
- package/dist/src/api/modules/admin/admin.module.js +14 -0
- package/dist/src/api/modules/admin/routes/session.route.d.ts +108 -0
- package/dist/src/api/modules/admin/routes/session.route.d.ts.map +1 -0
- package/dist/src/api/modules/admin/routes/session.route.js +51 -0
- package/dist/src/api/modules/admin/users/routes/list.route.d.ts +190 -0
- package/dist/src/api/modules/admin/users/routes/list.route.d.ts.map +1 -0
- package/dist/src/api/modules/admin/users/routes/list.route.js +79 -0
- package/dist/src/api/modules/admin/users/routes/users.route.d.ts +193 -0
- package/dist/src/api/modules/admin/users/routes/users.route.d.ts.map +1 -0
- package/dist/src/api/modules/admin/users/routes/users.route.js +84 -0
- package/dist/src/api/modules/admin/users/users.admin.module.d.ts +189 -0
- package/dist/src/api/modules/admin/users/users.admin.module.d.ts.map +1 -0
- package/dist/src/api/modules/admin/users/users.admin.module.js +10 -0
- package/dist/src/api/modules/middleware/middleware.module.d.ts +52 -0
- package/dist/src/api/modules/middleware/middleware.module.d.ts.map +1 -0
- package/dist/src/api/modules/middleware/middleware.module.js +10 -0
- package/dist/src/api/modules/middleware/route.d.ts +53 -0
- package/dist/src/api/modules/middleware/route.d.ts.map +1 -0
- package/dist/src/api/modules/middleware/route.js +39 -0
- package/dist/src/api/modules/users/avatar-color.d.ts +2 -0
- package/dist/src/api/modules/users/avatar-color.d.ts.map +1 -0
- package/dist/src/api/modules/users/avatar-color.js +43 -0
- package/dist/src/api/modules/users/routes/session.route.d.ts +103 -0
- package/dist/src/api/modules/users/routes/session.route.d.ts.map +1 -0
- package/dist/src/api/modules/users/routes/session.route.js +46 -0
- package/dist/src/api/modules/users/routes/sign-in.route.d.ts +88 -0
- package/dist/src/api/modules/users/routes/sign-in.route.d.ts.map +1 -0
- package/dist/src/api/modules/users/routes/sign-in.route.js +71 -0
- package/dist/src/api/modules/users/routes/sign-out.route.d.ts +47 -0
- package/dist/src/api/modules/users/routes/sign-out.route.d.ts.map +1 -0
- package/dist/src/api/modules/users/routes/sign-out.route.js +43 -0
- package/dist/src/api/modules/users/routes/sign-up.route.d.ts +89 -0
- package/dist/src/api/modules/users/routes/sign-up.route.d.ts.map +1 -0
- package/dist/src/api/modules/users/routes/sign-up.route.js +60 -0
- package/dist/src/api/modules/users/routes/test.route.d.ts +31 -0
- package/dist/src/api/modules/users/routes/test.route.d.ts.map +1 -0
- package/dist/src/api/modules/users/routes/test.route.js +32 -0
- package/dist/src/api/modules/users/sso/routes/callback.route.d.ts +78 -0
- package/dist/src/api/modules/users/sso/routes/callback.route.d.ts.map +1 -0
- package/dist/src/api/modules/users/sso/routes/callback.route.js +49 -0
- package/dist/src/api/modules/users/sso/routes/create-url.route.d.ts +51 -0
- package/dist/src/api/modules/users/sso/routes/create-url.route.d.ts.map +1 -0
- package/dist/src/api/modules/users/sso/routes/create-url.route.js +36 -0
- package/dist/src/api/modules/users/sso/sso.module.d.ts +125 -0
- package/dist/src/api/modules/users/sso/sso.module.d.ts.map +1 -0
- package/dist/src/api/modules/users/sso/sso.module.js +12 -0
- package/dist/src/api/modules/users/users.module.d.ts +439 -0
- package/dist/src/api/modules/users/users.module.d.ts.map +1 -0
- package/dist/src/api/modules/users/users.module.js +22 -0
- package/dist/src/api/plugin.d.ts +2 -0
- package/dist/src/api/plugin.d.ts.map +1 -0
- package/dist/src/api/plugin.js +13 -0
- package/dist/src/api/plugins/email/nodemailer.d.ts +10 -0
- package/dist/src/api/plugins/email/nodemailer.d.ts.map +1 -0
- package/dist/src/api/plugins/email/nodemailer.js +30 -0
- package/dist/src/api/plugins/email/resend.d.ts +6 -0
- package/dist/src/api/plugins/email/resend.d.ts.map +1 -0
- package/dist/src/api/plugins/email/resend.js +21 -0
- package/dist/src/api/plugins/sso/discord.d.ts +6 -0
- package/dist/src/api/plugins/sso/discord.d.ts.map +1 -0
- package/dist/src/api/plugins/sso/discord.js +77 -0
- package/dist/src/api/plugins/sso/facebook.d.ts +6 -0
- package/dist/src/api/plugins/sso/facebook.d.ts.map +1 -0
- package/dist/src/api/plugins/sso/facebook.js +76 -0
- package/dist/src/api/plugins/sso/google.d.ts +6 -0
- package/dist/src/api/plugins/sso/google.d.ts.map +1 -0
- package/dist/src/api/plugins/sso/google.js +87 -0
- package/dist/src/app/login/page.d.ts +6 -0
- package/dist/src/app/login/page.d.ts.map +1 -0
- package/dist/src/app/login/page.js +15 -0
- package/dist/src/app/login/sso/[providerId]/page.d.ts +7 -0
- package/dist/src/app/login/sso/[providerId]/page.d.ts.map +1 -0
- package/dist/src/app/login/sso/[providerId]/page.js +10 -0
- package/dist/src/app/register/page.d.ts +6 -0
- package/dist/src/app/register/page.d.ts.map +1 -0
- package/dist/src/app/register/page.js +15 -0
- package/dist/src/app_admin/core/page.d.ts +2 -0
- package/dist/src/app_admin/core/page.d.ts.map +1 -0
- package/dist/src/app_admin/core/page.js +5 -0
- package/dist/src/app_admin/core/test/page.d.ts +2 -0
- package/dist/src/app_admin/core/test/page.d.ts.map +1 -0
- package/dist/src/app_admin/core/test/page.js +5 -0
- package/dist/src/app_admin/core/users/page.d.ts +6 -0
- package/dist/src/app_admin/core/users/page.d.ts.map +1 -0
- package/dist/src/app_admin/core/users/page.js +35 -0
- package/dist/src/components/avatar.d.ts +10 -0
- package/dist/src/components/avatar.d.ts.map +1 -0
- package/dist/src/components/avatar.js +14 -0
- package/dist/src/components/date-format.d.ts +5 -0
- package/dist/src/components/date-format.d.ts.map +1 -0
- package/dist/src/components/date-format.js +38 -0
- package/dist/src/components/form/auto-form.d.ts +12 -0
- package/dist/src/components/form/auto-form.d.ts.map +1 -0
- package/dist/src/components/form/auto-form.js +57 -0
- package/dist/src/components/form/common/desc.d.ts +2 -0
- package/dist/src/components/form/common/desc.d.ts.map +1 -0
- package/dist/src/components/form/common/desc.js +9 -0
- package/dist/src/components/form/common/label.d.ts +3 -0
- package/dist/src/components/form/common/label.d.ts.map +1 -0
- package/dist/src/components/form/common/label.js +8 -0
- package/dist/src/components/form/fields/checkbox.d.ts +8 -0
- package/dist/src/components/form/fields/checkbox.d.ts.map +1 -0
- package/dist/src/components/form/fields/checkbox.js +35 -0
- package/dist/src/components/form/fields/combobox.d.ts +14 -0
- package/dist/src/components/form/fields/combobox.d.ts.map +1 -0
- package/dist/src/components/form/fields/combobox.js +88 -0
- package/dist/src/components/form/fields/input.d.ts +9 -0
- package/dist/src/components/form/fields/input.d.ts.map +1 -0
- package/dist/src/components/form/fields/input.js +34 -0
- package/dist/src/components/form/fields/item.d.ts +14 -0
- package/dist/src/components/form/fields/item.d.ts.map +1 -0
- package/dist/src/components/form/fields/item.js +22 -0
- package/dist/src/components/form/fields/radio-group.d.ts +13 -0
- package/dist/src/components/form/fields/radio-group.d.ts.map +1 -0
- package/dist/src/components/form/fields/radio-group.js +51 -0
- package/dist/src/components/form/fields/select.d.ts +14 -0
- package/dist/src/components/form/fields/select.d.ts.map +1 -0
- package/dist/src/components/form/fields/select.js +59 -0
- package/dist/src/components/form/fields/switch.d.ts +8 -0
- package/dist/src/components/form/fields/switch.d.ts.map +1 -0
- package/dist/src/components/form/fields/switch.js +35 -0
- package/dist/src/components/form/fields/textarea.d.ts +9 -0
- package/dist/src/components/form/fields/textarea.d.ts.map +1 -0
- package/dist/src/components/form/fields/textarea.js +34 -0
- package/dist/src/components/i18n-provider.d.ts +7 -0
- package/dist/src/components/i18n-provider.d.ts.map +1 -0
- package/dist/src/components/i18n-provider.js +43 -0
- package/dist/src/components/logo-vitnode.d.ts +4 -0
- package/dist/src/components/logo-vitnode.d.ts.map +1 -0
- package/dist/src/components/logo-vitnode.js +113 -0
- package/dist/src/components/switchers/theme-switcher.d.ts +2 -0
- package/dist/src/components/switchers/theme-switcher.d.ts.map +1 -0
- package/dist/src/components/switchers/theme-switcher.js +25 -0
- package/dist/src/components/table/content.d.ts +3 -0
- package/dist/src/components/table/content.d.ts.map +1 -0
- package/dist/src/components/table/content.js +84 -0
- package/dist/src/components/table/data-table.d.ts +37 -0
- package/dist/src/components/table/data-table.d.ts.map +1 -0
- package/dist/src/components/table/data-table.js +69 -0
- package/dist/src/components/table/order-table-head.d.ts +7 -0
- package/dist/src/components/table/order-table-head.d.ts.map +1 -0
- package/dist/src/components/table/order-table-head.js +39 -0
- package/dist/src/components/table/pagination.d.ts +11 -0
- package/dist/src/components/table/pagination.d.ts.map +1 -0
- package/dist/src/components/table/pagination.js +122 -0
- package/dist/src/components/ui/accordion.d.ts +8 -0
- package/dist/src/components/ui/accordion.d.ts.map +1 -0
- package/dist/src/components/ui/accordion.js +47 -0
- package/dist/src/components/ui/alert-dialog.d.ts +15 -0
- package/dist/src/components/ui/alert-dialog.d.ts.map +1 -0
- package/dist/src/components/ui/alert-dialog.js +86 -0
- package/dist/src/components/ui/alert.d.ts +10 -0
- package/dist/src/components/ui/alert.d.ts.map +1 -0
- package/dist/src/components/ui/alert.js +40 -0
- package/dist/src/components/ui/badge.d.ts +10 -0
- package/dist/src/components/ui/badge.d.ts.map +1 -0
- package/dist/src/components/ui/badge.js +29 -0
- package/dist/src/components/ui/button.d.ts +13 -0
- package/dist/src/components/ui/button.d.ts.map +1 -0
- package/dist/src/components/ui/button.js +66 -0
- package/dist/src/components/ui/card.d.ts +10 -0
- package/dist/src/components/ui/card.d.ts.map +1 -0
- package/dist/src/components/ui/card.js +53 -0
- package/dist/src/components/ui/checkbox.d.ts +5 -0
- package/dist/src/components/ui/checkbox.d.ts.map +1 -0
- package/dist/src/components/ui/checkbox.js +21 -0
- package/dist/src/components/ui/collapsible.d.ts +6 -0
- package/dist/src/components/ui/collapsible.d.ts.map +1 -0
- package/dist/src/components/ui/collapsible.js +22 -0
- package/dist/src/components/ui/command.d.ts +19 -0
- package/dist/src/components/ui/command.d.ts.map +1 -0
- package/dist/src/components/ui/command.js +99 -0
- package/dist/src/components/ui/context-menu.d.ts +26 -0
- package/dist/src/components/ui/context-menu.d.ts.map +1 -0
- package/dist/src/components/ui/context-menu.js +141 -0
- package/dist/src/components/ui/dialog.d.ts +23 -0
- package/dist/src/components/ui/dialog.d.ts.map +1 -0
- package/dist/src/components/ui/dialog.js +181 -0
- package/dist/src/components/ui/drawer.d.ts +14 -0
- package/dist/src/components/ui/drawer.d.ts.map +1 -0
- package/dist/src/components/ui/drawer.js +84 -0
- package/dist/src/components/ui/dropdown-menu.d.ts +26 -0
- package/dist/src/components/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/src/components/ui/dropdown-menu.js +142 -0
- package/dist/src/components/ui/form.d.ts +33 -0
- package/dist/src/components/ui/form.d.ts.map +1 -0
- package/dist/src/components/ui/form.js +142 -0
- package/dist/src/components/ui/header-content.d.ts +17 -0
- package/dist/src/components/ui/header-content.d.ts.map +1 -0
- package/dist/src/components/ui/header-content.js +30 -0
- package/dist/src/components/ui/hover-card.d.ts +7 -0
- package/dist/src/components/ui/hover-card.d.ts.map +1 -0
- package/dist/src/components/ui/hover-card.js +30 -0
- package/dist/src/components/ui/input-otp.d.ts +12 -0
- package/dist/src/components/ui/input-otp.d.ts.map +1 -0
- package/dist/src/components/ui/input-otp.js +49 -0
- package/dist/src/components/ui/input.d.ts +4 -0
- package/dist/src/components/ui/input.d.ts.map +1 -0
- package/dist/src/components/ui/input.js +12 -0
- package/dist/src/components/ui/label.d.ts +5 -0
- package/dist/src/components/ui/label.d.ts.map +1 -0
- package/dist/src/components/ui/label.js +13 -0
- package/dist/src/components/ui/loader.d.ts +5 -0
- package/dist/src/components/ui/loader.d.ts.map +1 -0
- package/dist/src/components/ui/loader.js +16 -0
- package/dist/src/components/ui/menubar.d.ts +27 -0
- package/dist/src/components/ui/menubar.d.ts.map +1 -0
- package/dist/src/components/ui/menubar.js +152 -0
- package/dist/src/components/ui/navigation-menu.d.ts +15 -0
- package/dist/src/components/ui/navigation-menu.d.ts.map +1 -0
- package/dist/src/components/ui/navigation-menu.js +83 -0
- package/dist/src/components/ui/popover.d.ts +8 -0
- package/dist/src/components/ui/popover.d.ts.map +1 -0
- package/dist/src/components/ui/popover.js +35 -0
- package/dist/src/components/ui/progress.d.ts +5 -0
- package/dist/src/components/ui/progress.d.ts.map +1 -0
- package/dist/src/components/ui/progress.js +20 -0
- package/dist/src/components/ui/radio-group.d.ts +6 -0
- package/dist/src/components/ui/radio-group.d.ts.map +1 -0
- package/dist/src/components/ui/radio-group.js +28 -0
- package/dist/src/components/ui/select.d.ts +16 -0
- package/dist/src/components/ui/select.d.ts.map +1 -0
- package/dist/src/components/ui/select.js +114 -0
- package/dist/src/components/ui/separator.d.ts +5 -0
- package/dist/src/components/ui/separator.d.ts.map +1 -0
- package/dist/src/components/ui/separator.js +15 -0
- package/dist/src/components/ui/sheet.d.ts +14 -0
- package/dist/src/components/ui/sheet.d.ts.map +1 -0
- package/dist/src/components/ui/sheet.js +93 -0
- package/dist/src/components/ui/sidebar.d.ts +70 -0
- package/dist/src/components/ui/sidebar.d.ts.map +1 -0
- package/dist/src/components/ui/sidebar.js +437 -0
- package/dist/src/components/ui/skeleton.d.ts +3 -0
- package/dist/src/components/ui/skeleton.d.ts.map +1 -0
- package/dist/src/components/ui/skeleton.js +10 -0
- package/dist/src/components/ui/slider.d.ts +5 -0
- package/dist/src/components/ui/slider.d.ts.map +1 -0
- package/dist/src/components/ui/slider.js +42 -0
- package/dist/src/components/ui/sonner.d.ts +4 -0
- package/dist/src/components/ui/sonner.d.ts.map +1 -0
- package/dist/src/components/ui/sonner.js +26 -0
- package/dist/src/components/ui/switch.d.ts +5 -0
- package/dist/src/components/ui/switch.d.ts.map +1 -0
- package/dist/src/components/ui/switch.js +17 -0
- package/dist/src/components/ui/table.d.ts +11 -0
- package/dist/src/components/ui/table.d.ts.map +1 -0
- package/dist/src/components/ui/table.js +64 -0
- package/dist/src/components/ui/tabs.d.ts +8 -0
- package/dist/src/components/ui/tabs.d.ts.map +1 -0
- package/dist/src/components/ui/tabs.js +34 -0
- package/dist/src/components/ui/textarea.d.ts +4 -0
- package/dist/src/components/ui/textarea.d.ts.map +1 -0
- package/dist/src/components/ui/textarea.js +11 -0
- package/dist/src/components/ui/toggle-group.d.ts +8 -0
- package/dist/src/components/ui/toggle-group.d.ts.map +1 -0
- package/dist/src/components/ui/toggle-group.js +41 -0
- package/dist/src/components/ui/toggle.d.ts +10 -0
- package/dist/src/components/ui/toggle.d.ts.map +1 -0
- package/dist/src/components/ui/toggle.js +35 -0
- package/dist/src/components/ui/tooltip.d.ts +8 -0
- package/dist/src/components/ui/tooltip.d.ts.map +1 -0
- package/dist/src/components/ui/tooltip.js +43 -0
- package/dist/src/components/ui/unsaved-changes-dialog.d.ts +1 -0
- package/dist/src/components/ui/unsaved-changes-dialog.d.ts.map +1 -0
- package/dist/src/config.d.ts +5 -0
- package/dist/src/config.d.ts.map +1 -0
- package/dist/src/config.js +4 -0
- package/dist/src/database/admins.d.ts +246 -0
- package/dist/src/database/admins.d.ts.map +1 -0
- package/dist/src/database/admins.js +74 -0
- package/dist/src/database/languages.d.ts +321 -0
- package/dist/src/database/languages.d.ts.map +1 -0
- package/dist/src/database/languages.js +52 -0
- package/dist/src/database/moderators.d.ts +114 -0
- package/dist/src/database/moderators.d.ts.map +1 -0
- package/dist/src/database/moderators.js +37 -0
- package/dist/src/database/roles.d.ts +146 -0
- package/dist/src/database/roles.d.ts.map +1 -0
- package/dist/src/database/roles.js +13 -0
- package/dist/src/database/sessions.d.ts +196 -0
- package/dist/src/database/sessions.d.ts.map +1 -0
- package/dist/src/database/sessions.js +57 -0
- package/dist/src/database/users.d.ts +562 -0
- package/dist/src/database/users.d.ts.map +1 -0
- package/dist/src/database/users.js +142 -0
- package/dist/src/drizzle.config.d.ts +6 -0
- package/dist/src/drizzle.config.d.ts.map +1 -0
- package/dist/src/drizzle.config.js +37 -0
- package/dist/src/hooks/use-before-unload-with-dialog.d.ts +1 -0
- package/dist/src/hooks/use-before-unload-with-dialog.d.ts.map +1 -0
- package/dist/src/hooks/use-before-unload.d.ts +2 -0
- package/dist/src/hooks/use-before-unload.d.ts.map +1 -0
- package/dist/src/hooks/use-before-unload.js +30 -0
- package/dist/src/hooks/use-mobile.d.ts +2 -0
- package/dist/src/hooks/use-mobile.d.ts.map +1 -0
- package/dist/src/hooks/use-mobile.js +15 -0
- package/dist/src/hooks/use-unsaved-changes.d.ts +1 -0
- package/dist/src/hooks/use-unsaved-changes.d.ts.map +1 -0
- package/dist/src/lib/api/get-middleware-api.d.ts +8 -0
- package/dist/src/lib/api/get-middleware-api.d.ts.map +1 -0
- package/dist/src/lib/api/get-middleware-api.js +13 -0
- package/dist/src/lib/api/get-session-admin-api.d.ts +16 -0
- package/dist/src/lib/api/get-session-admin-api.d.ts.map +1 -0
- package/dist/src/lib/api/get-session-admin-api.js +19 -0
- package/dist/src/lib/api/get-session-api.d.ts +17 -0
- package/dist/src/lib/api/get-session-api.d.ts.map +1 -0
- package/dist/src/lib/api/get-session-api.js +14 -0
- package/dist/src/lib/colors.d.ts +23 -0
- package/dist/src/lib/colors.d.ts.map +1 -0
- package/dist/src/lib/colors.js +131 -0
- package/dist/src/lib/colors.test.d.ts +2 -0
- package/dist/src/lib/colors.test.d.ts.map +1 -0
- package/dist/src/lib/colors.test.js +173 -0
- package/dist/src/lib/config.d.ts +6 -0
- package/dist/src/lib/config.d.ts.map +1 -0
- package/dist/src/lib/config.js +15 -0
- package/dist/src/lib/fetcher/cookie-from-string-to-object.d.ts +10 -0
- package/dist/src/lib/fetcher/cookie-from-string-to-object.d.ts.map +1 -0
- package/dist/src/lib/fetcher/cookie-from-string-to-object.js +12 -0
- package/dist/src/lib/fetcher/cookie-from-string-to-object.test.d.ts +2 -0
- package/dist/src/lib/fetcher/cookie-from-string-to-object.test.d.ts.map +1 -0
- package/dist/src/lib/fetcher/cookie-from-string-to-object.test.js +78 -0
- package/dist/src/lib/fetcher/fetcher.d.ts +9 -0
- package/dist/src/lib/fetcher/fetcher.d.ts.map +1 -0
- package/dist/src/lib/fetcher/helpers.d.ts +3 -0
- package/dist/src/lib/fetcher/helpers.d.ts.map +1 -0
- package/dist/src/lib/fetcher/helpers.js +33 -0
- package/dist/src/lib/fetcher/helpers.test.d.ts +2 -0
- package/dist/src/lib/fetcher/helpers.test.d.ts.map +1 -0
- package/dist/src/lib/fetcher/helpers.test.js +37 -0
- package/dist/src/lib/fetcher/index.d.ts +34 -0
- package/dist/src/lib/fetcher/index.d.ts.map +1 -0
- package/dist/src/lib/fetcher/types.d.ts +120 -0
- package/dist/src/lib/fetcher/types.d.ts.map +1 -0
- package/dist/src/lib/fetcher/types.js +1 -0
- package/dist/src/lib/fetcher.d.ts +9 -0
- package/dist/src/lib/fetcher.d.ts.map +1 -0
- package/dist/src/lib/fetcher.js +47 -0
- package/dist/src/lib/helpers/auto-form.d.ts +10 -0
- package/dist/src/lib/helpers/auto-form.d.ts.map +1 -0
- package/dist/src/lib/helpers/auto-form.js +82 -0
- package/dist/src/lib/helpers/auto-form.test.d.ts +2 -0
- package/dist/src/lib/helpers/auto-form.test.d.ts.map +1 -0
- package/dist/src/lib/helpers/auto-form.test.js +126 -0
- package/dist/src/lib/navigation.d.ts +339 -0
- package/dist/src/lib/navigation.d.ts.map +1 -0
- package/dist/src/lib/navigation.js +11 -0
- package/dist/src/lib/plugin.d.ts +15 -0
- package/dist/src/lib/plugin.d.ts.map +1 -0
- package/dist/src/lib/plugin.js +3 -0
- package/dist/src/lib/special-characters.d.ts +3 -0
- package/dist/src/lib/special-characters.d.ts.map +1 -0
- package/dist/src/lib/special-characters.js +4 -0
- package/dist/src/lib/special-characters.test.d.ts +2 -0
- package/dist/src/lib/special-characters.test.d.ts.map +1 -0
- package/dist/src/lib/special-characters.test.js +56 -0
- package/dist/src/lib/utils.d.ts +3 -0
- package/dist/src/lib/utils.d.ts.map +1 -0
- package/dist/src/lib/utils.js +5 -0
- package/dist/src/tests/setup.d.ts +2 -0
- package/dist/src/tests/setup.d.ts.map +1 -0
- package/dist/src/tests/setup.js +6 -0
- package/dist/src/views/admin/layouts/admin-layout.d.ts +8 -0
- package/dist/src/views/admin/layouts/admin-layout.d.ts.map +1 -0
- package/dist/src/views/admin/layouts/admin-layout.js +70 -0
- package/dist/src/views/admin/layouts/sidebar/nav/item.d.ts +11 -0
- package/dist/src/views/admin/layouts/sidebar/nav/item.d.ts.map +1 -0
- package/dist/src/views/admin/layouts/sidebar/nav/item.js +70 -0
- package/dist/src/views/admin/layouts/sidebar/nav/nav.d.ts +10 -0
- package/dist/src/views/admin/layouts/sidebar/nav/nav.d.ts.map +1 -0
- package/dist/src/views/admin/layouts/sidebar/nav/nav.js +49 -0
- package/dist/src/views/admin/layouts/sidebar/sidebar.d.ts +3 -0
- package/dist/src/views/admin/layouts/sidebar/sidebar.d.ts.map +1 -0
- package/dist/src/views/admin/layouts/sidebar/sidebar.js +30 -0
- package/dist/src/views/admin/layouts/sidebar/sign-out.d.ts +4 -0
- package/dist/src/views/admin/layouts/sidebar/sign-out.d.ts.map +1 -0
- package/dist/src/views/admin/layouts/sidebar/sign-out.js +14 -0
- package/dist/src/views/admin/layouts/user-bar/client.d.ts +7 -0
- package/dist/src/views/admin/layouts/user-bar/client.d.ts.map +1 -0
- package/dist/src/views/admin/layouts/user-bar/client.js +61 -0
- package/dist/src/views/admin/layouts/user-bar/user-bar.d.ts +3 -0
- package/dist/src/views/admin/layouts/user-bar/user-bar.d.ts.map +1 -0
- package/dist/src/views/admin/layouts/user-bar/user-bar.js +31 -0
- package/dist/src/views/admin/sign-in/sign-in-admin-view.d.ts +2 -0
- package/dist/src/views/admin/sign-in/sign-in-admin-view.d.ts.map +1 -0
- package/dist/src/views/admin/sign-in/sign-in-admin-view.js +26 -0
- package/dist/src/views/admin/views/core/dashboard/dashboard-admin-view.d.ts +2 -0
- package/dist/src/views/admin/views/core/dashboard/dashboard-admin-view.d.ts.map +1 -0
- package/dist/src/views/admin/views/core/dashboard/dashboard-admin-view.js +44 -0
- package/dist/src/views/admin/views/core/test.d.ts +2 -0
- package/dist/src/views/admin/views/core/test.d.ts.map +1 -0
- package/dist/src/views/admin/views/core/test.js +146 -0
- package/dist/src/views/admin/views/core/users/users-admin-view.d.ts +4 -0
- package/dist/src/views/admin/views/core/users/users-admin-view.d.ts.map +1 -0
- package/dist/src/views/admin/views/core/users/users-admin-view.js +90 -0
- package/dist/src/views/auth/components/password-input.d.ts +4 -0
- package/dist/src/views/auth/components/password-input.d.ts.map +1 -0
- package/dist/src/views/auth/components/password-input.js +89 -0
- package/dist/src/views/auth/sign-in/form/form.d.ts +4 -0
- package/dist/src/views/auth/sign-in/form/form.d.ts.map +1 -0
- package/dist/src/views/auth/sign-in/form/form.js +59 -0
- package/dist/src/views/auth/sign-in/form/hooks/mutation-api.d.ts +10 -0
- package/dist/src/views/auth/sign-in/form/hooks/mutation-api.d.ts.map +1 -0
- package/dist/src/views/auth/sign-in/form/hooks/mutation-api.js +33 -0
- package/dist/src/views/auth/sign-in/form/hooks/use-form.d.ts +27 -0
- package/dist/src/views/auth/sign-in/form/hooks/use-form.d.ts.map +1 -0
- package/dist/src/views/auth/sign-in/form/hooks/use-form.js +38 -0
- package/dist/src/views/auth/sign-in/sign-in-view.d.ts +2 -0
- package/dist/src/views/auth/sign-in/sign-in-view.d.ts.map +1 -0
- package/dist/src/views/auth/sign-in/sign-in-view.js +55 -0
- package/dist/src/views/auth/sign-up/form/form.d.ts +4 -0
- package/dist/src/views/auth/sign-up/form/form.d.ts.map +1 -0
- package/dist/src/views/auth/sign-up/form/form.js +88 -0
- package/dist/src/views/auth/sign-up/form/hooks/mutation-api.d.ts +6 -0
- package/dist/src/views/auth/sign-up/form/hooks/mutation-api.d.ts.map +1 -0
- package/dist/src/views/auth/sign-up/form/hooks/mutation-api.js +18 -0
- package/dist/src/views/auth/sign-up/form/hooks/use-form.d.ts +61 -0
- package/dist/src/views/auth/sign-up/form/hooks/use-form.d.ts.map +1 -0
- package/dist/src/views/auth/sign-up/form/hooks/use-form.js +57 -0
- package/dist/src/views/auth/sign-up/sign-up-view.d.ts +2 -0
- package/dist/src/views/auth/sign-up/sign-up-view.d.ts.map +1 -0
- package/dist/src/views/auth/sign-up/sign-up-view.js +61 -0
- package/dist/src/views/auth/sso/buttons/client.d.ts +5 -0
- package/dist/src/views/auth/sso/buttons/client.d.ts.map +1 -0
- package/dist/src/views/auth/sso/buttons/client.js +22 -0
- package/dist/src/views/auth/sso/buttons/mutation-api.d.ts +4 -0
- package/dist/src/views/auth/sso/buttons/mutation-api.d.ts.map +1 -0
- package/dist/src/views/auth/sso/buttons/mutation-api.js +24 -0
- package/dist/src/views/auth/sso/buttons/sso-buttons.d.ts +3 -0
- package/dist/src/views/auth/sso/buttons/sso-buttons.d.ts.map +1 -0
- package/dist/src/views/auth/sso/buttons/sso-buttons.js +51 -0
- package/dist/src/views/auth/sso/callback/callback-sso-view.d.ts +5 -0
- package/dist/src/views/auth/sso/callback/callback-sso-view.d.ts.map +1 -0
- package/dist/src/views/auth/sso/callback/callback-sso-view.js +18 -0
- package/dist/src/views/auth/sso/callback/client/client.d.ts +6 -0
- package/dist/src/views/auth/sso/callback/client/client.d.ts.map +1 -0
- package/dist/src/views/auth/sso/callback/client/client.js +39 -0
- package/dist/src/views/auth/sso/callback/client/mutation-api.d.ts +8 -0
- package/dist/src/views/auth/sso/callback/client/mutation-api.d.ts.map +1 -0
- package/dist/src/views/auth/sso/callback/client/mutation-api.js +27 -0
- package/dist/src/views/error/back-button.d.ts +5 -0
- package/dist/src/views/error/back-button.d.ts.map +1 -0
- package/dist/src/views/error/back-button.js +14 -0
- package/dist/src/views/error/error-view.d.ts +5 -0
- package/dist/src/views/error/error-view.d.ts.map +1 -0
- package/dist/src/views/error/error-view.js +56 -0
- package/dist/src/views/error/global-error-view.d.ts +6 -0
- package/dist/src/views/error/global-error-view.d.ts.map +1 -0
- package/dist/src/views/error/global-error-view.js +57 -0
- package/dist/src/views/layouts/provider.d.ts +11 -0
- package/dist/src/views/layouts/provider.d.ts.map +1 -0
- package/dist/src/views/layouts/provider.js +43 -0
- package/dist/src/views/layouts/root-layout.d.ts +16 -0
- package/dist/src/views/layouts/root-layout.d.ts.map +1 -0
- package/dist/src/views/layouts/root-layout.js +38 -0
- package/dist/src/views/layouts/theme/header/header.d.ts +4 -0
- package/dist/src/views/layouts/theme/header/header.d.ts.map +1 -0
- package/dist/src/views/layouts/theme/header/header.js +32 -0
- package/dist/src/views/layouts/theme/header/user/auth/auth.d.ts +2 -0
- package/dist/src/views/layouts/theme/header/user/auth/auth.d.ts.map +1 -0
- package/dist/src/views/layouts/theme/header/user/auth/auth.js +33 -0
- package/dist/src/views/layouts/theme/header/user/auth/client.d.ts +5 -0
- package/dist/src/views/layouts/theme/header/user/auth/client.d.ts.map +1 -0
- package/dist/src/views/layouts/theme/header/user/auth/client.js +47 -0
- package/dist/src/views/layouts/theme/header/user/auth/log-out-mutation-api.d.ts +4 -0
- package/dist/src/views/layouts/theme/header/user/auth/log-out-mutation-api.d.ts.map +1 -0
- package/dist/src/views/layouts/theme/header/user/auth/log-out-mutation-api.js +27 -0
- package/dist/src/views/layouts/theme/header/user/user.d.ts +2 -0
- package/dist/src/views/layouts/theme/header/user/user.d.ts.map +1 -0
- package/dist/src/views/layouts/theme/header/user/user.js +34 -0
- package/dist/src/views/layouts/theme/layout.d.ts +5 -0
- package/dist/src/views/layouts/theme/layout.d.ts.map +1 -0
- package/dist/src/views/layouts/theme/layout.js +15 -0
- package/dist/src/vitnode.config.d.ts +50 -0
- package/dist/src/vitnode.config.d.ts.map +1 -0
- package/dist/src/vitnode.config.js +39 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/tsup.config.d.ts +3 -0
- package/dist/tsup.config.d.ts.map +1 -0
- package/dist/vitest.config.d.ts +3 -0
- package/dist/vitest.config.d.ts.map +1 -0
- package/package.json +94 -0
- package/src/app/login/page.tsx +21 -0
- package/src/app/login/sso/[providerId]/page.tsx +19 -0
- package/src/app/register/page.tsx +21 -0
- package/src/app_admin/core/page.tsx +5 -0
- package/src/app_admin/core/test/page.tsx +5 -0
- package/src/app_admin/core/users/page.tsx +35 -0
- package/src/database/admins.ts +87 -0
- package/src/database/languages.ts +54 -0
- package/src/database/moderators.ts +42 -0
- package/src/database/roles.ts +15 -0
- package/src/database/sessions.ts +59 -0
- package/src/database/users.ts +142 -0
- package/src/locales/en.json +156 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const routeMiddleware: {
|
|
3
|
+
handler: (c: import("hono").Context<import("../../middlewares/global/global").EnvVitNode, "/", {}>) => Response & import("hono").TypedResponse<{
|
|
4
|
+
isEmail: boolean;
|
|
5
|
+
sso: {
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
}[];
|
|
9
|
+
}, 200, "json">;
|
|
10
|
+
pluginId: "@vitnode/core";
|
|
11
|
+
route: {
|
|
12
|
+
path: "/";
|
|
13
|
+
method: "get";
|
|
14
|
+
description: string;
|
|
15
|
+
responses: {
|
|
16
|
+
200: {
|
|
17
|
+
content: {
|
|
18
|
+
'application/json': {
|
|
19
|
+
schema: z.ZodObject<{
|
|
20
|
+
sso: z.ZodArray<z.ZodObject<{
|
|
21
|
+
id: z.ZodString;
|
|
22
|
+
name: z.ZodString;
|
|
23
|
+
}, "strip", z.ZodTypeAny, {
|
|
24
|
+
id: string;
|
|
25
|
+
name: string;
|
|
26
|
+
}, {
|
|
27
|
+
id: string;
|
|
28
|
+
name: string;
|
|
29
|
+
}>, "many">;
|
|
30
|
+
isEmail: z.ZodBoolean;
|
|
31
|
+
}, "strip", z.ZodTypeAny, {
|
|
32
|
+
sso: {
|
|
33
|
+
id: string;
|
|
34
|
+
name: string;
|
|
35
|
+
}[];
|
|
36
|
+
isEmail: boolean;
|
|
37
|
+
}, {
|
|
38
|
+
sso: {
|
|
39
|
+
id: string;
|
|
40
|
+
name: string;
|
|
41
|
+
}[];
|
|
42
|
+
isEmail: boolean;
|
|
43
|
+
}>;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
description: string;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
} & {
|
|
50
|
+
getRoutingPath: () => "/";
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=route.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../src/api/modules/middleware/route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6B1B,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { buildRoute } from "../../lib/route";
|
|
3
|
+
import { EmailModel } from "../../models/email";
|
|
4
|
+
import { CONFIG_PLUGIN } from "../../../config";
|
|
5
|
+
export const routeMiddleware = buildRoute({
|
|
6
|
+
...CONFIG_PLUGIN,
|
|
7
|
+
route: {
|
|
8
|
+
path: '/',
|
|
9
|
+
method: 'get',
|
|
10
|
+
description: 'Middleware route with user authentication',
|
|
11
|
+
responses: {
|
|
12
|
+
200: {
|
|
13
|
+
content: {
|
|
14
|
+
'application/json': {
|
|
15
|
+
schema: z.object({
|
|
16
|
+
sso: z.array(z.object({
|
|
17
|
+
id: z.string(),
|
|
18
|
+
name: z.string()
|
|
19
|
+
})),
|
|
20
|
+
isEmail: z.boolean()
|
|
21
|
+
})
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
description: 'Middleware route'
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
handler: (c)=>{
|
|
29
|
+
const sso = c.get('core').authorization.ssoPlugins;
|
|
30
|
+
const email = new EmailModel(c);
|
|
31
|
+
return c.json({
|
|
32
|
+
isEmail: email.isAvailable(),
|
|
33
|
+
sso: sso.map((s)=>({
|
|
34
|
+
id: s.id,
|
|
35
|
+
name: s.name
|
|
36
|
+
}))
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"avatar-color.d.ts","sourceRoot":"","sources":["../../../../../src/api/modules/users/avatar-color.ts"],"names":[],"mappings":"AA6BA,eAAO,MAAM,mBAAmB,GAAI,MAAM,MAAM,KAAG,MAQlD,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { convertColor } from "../../../lib/colors";
|
|
2
|
+
const getHashOfString = (str)=>{
|
|
3
|
+
let hash = 0;
|
|
4
|
+
for(let i = 0; i < str.length; i++){
|
|
5
|
+
hash = str.charCodeAt(i) + ((hash << 5) - hash);
|
|
6
|
+
}
|
|
7
|
+
hash = Math.abs(hash);
|
|
8
|
+
return hash;
|
|
9
|
+
};
|
|
10
|
+
const normalizeHash = (hash, min, max)=>{
|
|
11
|
+
return Math.floor(hash % (max - min) + min);
|
|
12
|
+
};
|
|
13
|
+
const generateHSLFromName = (name)=>{
|
|
14
|
+
const hRange = [
|
|
15
|
+
0,
|
|
16
|
+
360
|
|
17
|
+
];
|
|
18
|
+
const lRange = [
|
|
19
|
+
25,
|
|
20
|
+
60
|
|
21
|
+
];
|
|
22
|
+
const sRange = [
|
|
23
|
+
50,
|
|
24
|
+
75
|
|
25
|
+
];
|
|
26
|
+
const hash = getHashOfString(name);
|
|
27
|
+
const h = normalizeHash(hash, hRange[0], hRange[1]);
|
|
28
|
+
const s = normalizeHash(hash, sRange[0], sRange[1]);
|
|
29
|
+
const l = normalizeHash(hash, lRange[0], lRange[1]);
|
|
30
|
+
return [
|
|
31
|
+
h,
|
|
32
|
+
s,
|
|
33
|
+
l
|
|
34
|
+
];
|
|
35
|
+
};
|
|
36
|
+
export const generateAvatarColor = (name)=>{
|
|
37
|
+
const hslName = generateHSLFromName(name);
|
|
38
|
+
return convertColor.hslToHex({
|
|
39
|
+
h: hslName[0],
|
|
40
|
+
s: hslName[1],
|
|
41
|
+
l: hslName[2]
|
|
42
|
+
});
|
|
43
|
+
};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const sessionRoute: {
|
|
3
|
+
handler: (c: import("hono").Context<import("../../../middlewares/global/global").EnvVitNode, "/session", {}>) => Promise<Response & import("hono").TypedResponse<{
|
|
4
|
+
user: {
|
|
5
|
+
isAdmin: boolean;
|
|
6
|
+
avatarColor: string;
|
|
7
|
+
birthday: string | null;
|
|
8
|
+
createdAt: string;
|
|
9
|
+
email: string;
|
|
10
|
+
emailVerified: boolean;
|
|
11
|
+
id: number;
|
|
12
|
+
name: string;
|
|
13
|
+
nameCode: string;
|
|
14
|
+
newsletter: boolean;
|
|
15
|
+
roleId: number;
|
|
16
|
+
} | null;
|
|
17
|
+
}, 200, "json">>;
|
|
18
|
+
pluginId: "@vitnode/core";
|
|
19
|
+
route: {
|
|
20
|
+
method: "get";
|
|
21
|
+
description: string;
|
|
22
|
+
path: "/session";
|
|
23
|
+
responses: {
|
|
24
|
+
200: {
|
|
25
|
+
content: {
|
|
26
|
+
'application/json': {
|
|
27
|
+
schema: z.ZodObject<{
|
|
28
|
+
user: z.ZodNullable<z.ZodObject<{
|
|
29
|
+
id: z.ZodNumber;
|
|
30
|
+
email: z.ZodString;
|
|
31
|
+
name: z.ZodString;
|
|
32
|
+
nameCode: z.ZodString;
|
|
33
|
+
createdAt: z.ZodDate;
|
|
34
|
+
newsletter: z.ZodBoolean;
|
|
35
|
+
avatarColor: z.ZodString;
|
|
36
|
+
emailVerified: z.ZodBoolean;
|
|
37
|
+
roleId: z.ZodNumber;
|
|
38
|
+
birthday: z.ZodNullable<z.ZodDate>;
|
|
39
|
+
isAdmin: z.ZodBoolean;
|
|
40
|
+
}, "strip", z.ZodTypeAny, {
|
|
41
|
+
id: number;
|
|
42
|
+
name: string;
|
|
43
|
+
nameCode: string;
|
|
44
|
+
email: string;
|
|
45
|
+
createdAt: Date;
|
|
46
|
+
newsletter: boolean;
|
|
47
|
+
avatarColor: string;
|
|
48
|
+
emailVerified: boolean;
|
|
49
|
+
roleId: number;
|
|
50
|
+
birthday: Date | null;
|
|
51
|
+
isAdmin: boolean;
|
|
52
|
+
}, {
|
|
53
|
+
id: number;
|
|
54
|
+
name: string;
|
|
55
|
+
nameCode: string;
|
|
56
|
+
email: string;
|
|
57
|
+
createdAt: Date;
|
|
58
|
+
newsletter: boolean;
|
|
59
|
+
avatarColor: string;
|
|
60
|
+
emailVerified: boolean;
|
|
61
|
+
roleId: number;
|
|
62
|
+
birthday: Date | null;
|
|
63
|
+
isAdmin: boolean;
|
|
64
|
+
}>>;
|
|
65
|
+
}, "strip", z.ZodTypeAny, {
|
|
66
|
+
user: {
|
|
67
|
+
id: number;
|
|
68
|
+
name: string;
|
|
69
|
+
nameCode: string;
|
|
70
|
+
email: string;
|
|
71
|
+
createdAt: Date;
|
|
72
|
+
newsletter: boolean;
|
|
73
|
+
avatarColor: string;
|
|
74
|
+
emailVerified: boolean;
|
|
75
|
+
roleId: number;
|
|
76
|
+
birthday: Date | null;
|
|
77
|
+
isAdmin: boolean;
|
|
78
|
+
} | null;
|
|
79
|
+
}, {
|
|
80
|
+
user: {
|
|
81
|
+
id: number;
|
|
82
|
+
name: string;
|
|
83
|
+
nameCode: string;
|
|
84
|
+
email: string;
|
|
85
|
+
createdAt: Date;
|
|
86
|
+
newsletter: boolean;
|
|
87
|
+
avatarColor: string;
|
|
88
|
+
emailVerified: boolean;
|
|
89
|
+
roleId: number;
|
|
90
|
+
birthday: Date | null;
|
|
91
|
+
isAdmin: boolean;
|
|
92
|
+
} | null;
|
|
93
|
+
}>;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
description: string;
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
} & {
|
|
100
|
+
getRoutingPath: () => "/session";
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
//# sourceMappingURL=session.route.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.route.d.ts","sourceRoot":"","sources":["../../../../../../src/api/modules/users/routes/session.route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8CvB,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { buildRoute } from "../../../lib/route";
|
|
3
|
+
import { SessionAdminModel } from "../../../models/session-admin";
|
|
4
|
+
import { CONFIG_PLUGIN } from "../../../../config";
|
|
5
|
+
export const sessionRoute = buildRoute({
|
|
6
|
+
...CONFIG_PLUGIN,
|
|
7
|
+
route: {
|
|
8
|
+
method: 'get',
|
|
9
|
+
description: 'Verify session',
|
|
10
|
+
path: '/session',
|
|
11
|
+
responses: {
|
|
12
|
+
200: {
|
|
13
|
+
content: {
|
|
14
|
+
'application/json': {
|
|
15
|
+
schema: z.object({
|
|
16
|
+
user: z.object({
|
|
17
|
+
id: z.number(),
|
|
18
|
+
email: z.string(),
|
|
19
|
+
name: z.string(),
|
|
20
|
+
nameCode: z.string(),
|
|
21
|
+
createdAt: z.date(),
|
|
22
|
+
newsletter: z.boolean(),
|
|
23
|
+
avatarColor: z.string(),
|
|
24
|
+
emailVerified: z.boolean(),
|
|
25
|
+
roleId: z.number(),
|
|
26
|
+
birthday: z.date().nullable(),
|
|
27
|
+
isAdmin: z.boolean()
|
|
28
|
+
}).nullable()
|
|
29
|
+
})
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
description: 'User'
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
handler: async (c)=>{
|
|
37
|
+
const user = c.get('user');
|
|
38
|
+
const admin = new SessionAdminModel(c);
|
|
39
|
+
return c.json({
|
|
40
|
+
user: user ? {
|
|
41
|
+
...user,
|
|
42
|
+
isAdmin: await admin.checkIfUserIsAdmin(user.id)
|
|
43
|
+
} : null
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
});
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const zodSignInSchema: z.ZodObject<{
|
|
3
|
+
email: z.ZodString;
|
|
4
|
+
password: z.ZodString;
|
|
5
|
+
isAdmin: z.ZodOptional<z.ZodBoolean>;
|
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
|
7
|
+
email: string;
|
|
8
|
+
password: string;
|
|
9
|
+
isAdmin?: boolean | undefined;
|
|
10
|
+
}, {
|
|
11
|
+
email: string;
|
|
12
|
+
password: string;
|
|
13
|
+
isAdmin?: boolean | undefined;
|
|
14
|
+
}>;
|
|
15
|
+
export declare const signInRoute: {
|
|
16
|
+
handler: (c: import("hono").Context<import("../../../middlewares/global/global").EnvVitNode, "/sign_in", {
|
|
17
|
+
in: {
|
|
18
|
+
json: {
|
|
19
|
+
email: string;
|
|
20
|
+
password: string;
|
|
21
|
+
isAdmin?: boolean | undefined;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
out: {
|
|
25
|
+
json: {
|
|
26
|
+
email: string;
|
|
27
|
+
password: string;
|
|
28
|
+
isAdmin?: boolean | undefined;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
}>) => Promise<Response & import("hono").TypedResponse<{
|
|
32
|
+
id: number;
|
|
33
|
+
token: string;
|
|
34
|
+
}, 201, "json">>;
|
|
35
|
+
pluginId: "@vitnode/core";
|
|
36
|
+
route: {
|
|
37
|
+
method: "post";
|
|
38
|
+
description: string;
|
|
39
|
+
path: "/sign_in";
|
|
40
|
+
request: {
|
|
41
|
+
body: {
|
|
42
|
+
required: true;
|
|
43
|
+
content: {
|
|
44
|
+
'application/json': {
|
|
45
|
+
schema: z.ZodObject<{
|
|
46
|
+
email: z.ZodString;
|
|
47
|
+
password: z.ZodString;
|
|
48
|
+
isAdmin: z.ZodOptional<z.ZodBoolean>;
|
|
49
|
+
}, "strip", z.ZodTypeAny, {
|
|
50
|
+
email: string;
|
|
51
|
+
password: string;
|
|
52
|
+
isAdmin?: boolean | undefined;
|
|
53
|
+
}, {
|
|
54
|
+
email: string;
|
|
55
|
+
password: string;
|
|
56
|
+
isAdmin?: boolean | undefined;
|
|
57
|
+
}>;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
responses: {
|
|
63
|
+
403: {
|
|
64
|
+
description: string;
|
|
65
|
+
};
|
|
66
|
+
201: {
|
|
67
|
+
content: {
|
|
68
|
+
'application/json': {
|
|
69
|
+
schema: z.ZodObject<{
|
|
70
|
+
id: z.ZodNumber;
|
|
71
|
+
token: z.ZodString;
|
|
72
|
+
}, "strip", z.ZodTypeAny, {
|
|
73
|
+
id: number;
|
|
74
|
+
token: string;
|
|
75
|
+
}, {
|
|
76
|
+
id: number;
|
|
77
|
+
token: string;
|
|
78
|
+
}>;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
description: string;
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
} & {
|
|
85
|
+
getRoutingPath: () => "/sign_in";
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
//# sourceMappingURL=sign-in.route.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sign-in.route.d.ts","sourceRoot":"","sources":["../../../../../../src/api/modules/users/routes/sign-in.route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,eAAO,MAAM,eAAe;;;;;;;;;;;;EAU1B,CAAC;AAEH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoDtB,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { buildRoute } from "../../../lib/route";
|
|
3
|
+
import { SessionModel } from "../../../models/session";
|
|
4
|
+
import { SessionAdminModel } from "../../../models/session-admin";
|
|
5
|
+
import { UserModel } from "../../../models/user";
|
|
6
|
+
import { CONFIG_PLUGIN } from "../../../../config";
|
|
7
|
+
export const zodSignInSchema = z.object({
|
|
8
|
+
email: z.string().email().toLowerCase().openapi({
|
|
9
|
+
example: 'test@test.com'
|
|
10
|
+
}),
|
|
11
|
+
password: z.string().openapi({
|
|
12
|
+
example: 'Test123!'
|
|
13
|
+
}),
|
|
14
|
+
isAdmin: z.boolean().optional().openapi({
|
|
15
|
+
example: false
|
|
16
|
+
})
|
|
17
|
+
});
|
|
18
|
+
export const signInRoute = buildRoute({
|
|
19
|
+
...CONFIG_PLUGIN,
|
|
20
|
+
route: {
|
|
21
|
+
method: 'post',
|
|
22
|
+
description: 'Sign in with email and password',
|
|
23
|
+
path: '/sign_in',
|
|
24
|
+
request: {
|
|
25
|
+
body: {
|
|
26
|
+
required: true,
|
|
27
|
+
content: {
|
|
28
|
+
'application/json': {
|
|
29
|
+
schema: zodSignInSchema
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
responses: {
|
|
35
|
+
403: {
|
|
36
|
+
description: 'Access Denied'
|
|
37
|
+
},
|
|
38
|
+
201: {
|
|
39
|
+
content: {
|
|
40
|
+
'application/json': {
|
|
41
|
+
schema: z.object({
|
|
42
|
+
id: z.number(),
|
|
43
|
+
token: z.string()
|
|
44
|
+
})
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
description: 'User signed in'
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
handler: async (c)=>{
|
|
52
|
+
const { password, isAdmin, email } = c.req.valid('json');
|
|
53
|
+
const data = await new UserModel().signInWithPassword({
|
|
54
|
+
password,
|
|
55
|
+
email,
|
|
56
|
+
c
|
|
57
|
+
});
|
|
58
|
+
if (isAdmin) {
|
|
59
|
+
const { token } = await new SessionAdminModel(c).createSessionByUserId(data.id);
|
|
60
|
+
return c.json({
|
|
61
|
+
id: data.id,
|
|
62
|
+
token
|
|
63
|
+
}, 201);
|
|
64
|
+
}
|
|
65
|
+
const { token } = await new SessionModel(c).createSessionByUserId(data.id);
|
|
66
|
+
return c.json({
|
|
67
|
+
id: data.id,
|
|
68
|
+
token
|
|
69
|
+
}, 201);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { z } from '@hono/zod-openapi';
|
|
2
|
+
export declare const signOutRoute: {
|
|
3
|
+
handler: (c: import("hono").Context<import("../../../middlewares/global/global").EnvVitNode, "/sign_out", {
|
|
4
|
+
in: {
|
|
5
|
+
json: {
|
|
6
|
+
isAdmin?: boolean | undefined;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
out: {
|
|
10
|
+
json: {
|
|
11
|
+
isAdmin?: boolean | undefined;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
}>) => Promise<Response & import("hono").TypedResponse<{}, 200 | 403, "json">>;
|
|
15
|
+
pluginId: "@vitnode/core";
|
|
16
|
+
route: {
|
|
17
|
+
method: "delete";
|
|
18
|
+
description: string;
|
|
19
|
+
path: "/sign_out";
|
|
20
|
+
request: {
|
|
21
|
+
body: {
|
|
22
|
+
content: {
|
|
23
|
+
'application/json': {
|
|
24
|
+
schema: z.ZodObject<{
|
|
25
|
+
isAdmin: z.ZodOptional<z.ZodBoolean>;
|
|
26
|
+
}, "strip", z.ZodTypeAny, {
|
|
27
|
+
isAdmin?: boolean | undefined;
|
|
28
|
+
}, {
|
|
29
|
+
isAdmin?: boolean | undefined;
|
|
30
|
+
}>;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
responses: {
|
|
36
|
+
200: {
|
|
37
|
+
description: string;
|
|
38
|
+
};
|
|
39
|
+
403: {
|
|
40
|
+
description: string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
} & {
|
|
44
|
+
getRoutingPath: () => "/sign_out";
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=sign-out.route.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sign-out.route.d.ts","sourceRoot":"","sources":["../../../../../../src/api/modules/users/routes/sign-out.route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAOtC,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuCvB,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { z } from "@hono/zod-openapi";
|
|
2
|
+
import { buildRoute } from "../../../lib/route";
|
|
3
|
+
import { SessionModel } from "../../../models/session";
|
|
4
|
+
import { SessionAdminModel } from "../../../models/session-admin";
|
|
5
|
+
import { CONFIG_PLUGIN } from "../../../../config";
|
|
6
|
+
export const signOutRoute = buildRoute({
|
|
7
|
+
...CONFIG_PLUGIN,
|
|
8
|
+
route: {
|
|
9
|
+
method: 'delete',
|
|
10
|
+
description: 'Sign out the current admin',
|
|
11
|
+
path: '/sign_out',
|
|
12
|
+
request: {
|
|
13
|
+
body: {
|
|
14
|
+
content: {
|
|
15
|
+
'application/json': {
|
|
16
|
+
schema: z.object({
|
|
17
|
+
isAdmin: z.boolean().optional().openapi({
|
|
18
|
+
example: false
|
|
19
|
+
})
|
|
20
|
+
})
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
responses: {
|
|
26
|
+
200: {
|
|
27
|
+
description: 'User signed out'
|
|
28
|
+
},
|
|
29
|
+
403: {
|
|
30
|
+
description: 'Access Denied'
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
handler: async (c)=>{
|
|
35
|
+
const { isAdmin } = c.req.valid('json');
|
|
36
|
+
if (isAdmin) {
|
|
37
|
+
await new SessionAdminModel(c).deleteSession();
|
|
38
|
+
return c.json({});
|
|
39
|
+
}
|
|
40
|
+
await new SessionModel(c).deleteSession();
|
|
41
|
+
return c.json({});
|
|
42
|
+
}
|
|
43
|
+
});
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const zodSignUpSchema: z.ZodObject<{
|
|
3
|
+
email: z.ZodString;
|
|
4
|
+
name: z.ZodEffects<z.ZodString, string, string>;
|
|
5
|
+
password: z.ZodString;
|
|
6
|
+
newsletter: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
name: string;
|
|
9
|
+
email: string;
|
|
10
|
+
password: string;
|
|
11
|
+
newsletter?: boolean | undefined;
|
|
12
|
+
}, {
|
|
13
|
+
name: string;
|
|
14
|
+
email: string;
|
|
15
|
+
password: string;
|
|
16
|
+
newsletter?: boolean | undefined;
|
|
17
|
+
}>;
|
|
18
|
+
export declare const signUpRoute: {
|
|
19
|
+
handler: (c: import("hono").Context<import("../../../middlewares/global/global").EnvVitNode, "/sign_up", {
|
|
20
|
+
in: {
|
|
21
|
+
json: {
|
|
22
|
+
name: string;
|
|
23
|
+
email: string;
|
|
24
|
+
password: string;
|
|
25
|
+
newsletter?: boolean | undefined;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
out: {
|
|
29
|
+
json: {
|
|
30
|
+
name: string;
|
|
31
|
+
email: string;
|
|
32
|
+
password: string;
|
|
33
|
+
newsletter?: boolean | undefined;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
}>) => Promise<Response & import("hono").TypedResponse<{
|
|
37
|
+
id: number;
|
|
38
|
+
}, 200, "json">>;
|
|
39
|
+
pluginId: "@vitnode/core";
|
|
40
|
+
route: {
|
|
41
|
+
method: "post";
|
|
42
|
+
description: string;
|
|
43
|
+
path: "/sign_up";
|
|
44
|
+
request: {
|
|
45
|
+
body: {
|
|
46
|
+
required: true;
|
|
47
|
+
content: {
|
|
48
|
+
'application/json': {
|
|
49
|
+
schema: z.ZodObject<{
|
|
50
|
+
email: z.ZodString;
|
|
51
|
+
name: z.ZodEffects<z.ZodString, string, string>;
|
|
52
|
+
password: z.ZodString;
|
|
53
|
+
newsletter: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
54
|
+
}, "strip", z.ZodTypeAny, {
|
|
55
|
+
name: string;
|
|
56
|
+
email: string;
|
|
57
|
+
password: string;
|
|
58
|
+
newsletter?: boolean | undefined;
|
|
59
|
+
}, {
|
|
60
|
+
name: string;
|
|
61
|
+
email: string;
|
|
62
|
+
password: string;
|
|
63
|
+
newsletter?: boolean | undefined;
|
|
64
|
+
}>;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
responses: {
|
|
70
|
+
200: {
|
|
71
|
+
content: {
|
|
72
|
+
'application/json': {
|
|
73
|
+
schema: z.ZodObject<{
|
|
74
|
+
id: z.ZodNumber;
|
|
75
|
+
}, "strip", z.ZodTypeAny, {
|
|
76
|
+
id: number;
|
|
77
|
+
}, {
|
|
78
|
+
id: number;
|
|
79
|
+
}>;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
description: string;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
} & {
|
|
86
|
+
getRoutingPath: () => "/sign_up";
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
//# sourceMappingURL=sign-up.route.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sign-up.route.d.ts","sourceRoot":"","sources":["../../../../../../src/api/modules/users/routes/sign-up.route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;EAe1B,CAAC;AAEH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwCtB,CAAC"}
|