@vitnode/core 1.2.0-canary.51 → 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 -20
- 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 +27 -11
- package/dist/src/api/models/email.d.ts.map +1 -1
- package/dist/src/api/models/email.js +35 -22
- package/dist/src/api/models/password.d.ts +4 -0
- package/dist/src/api/models/password.d.ts.map +1 -1
- package/dist/src/api/models/password.js +15 -7
- package/dist/src/api/models/session-admin.d.ts +2 -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 +2 -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 +24 -24
- package/dist/src/api/models/user/get-user-by-id.d.ts +2 -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 +3 -2
- 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 +13 -14
- package/dist/src/api/models/user.d.ts +1 -0
- 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 +52 -0
- package/dist/src/api/modules/users/routes/change-password.route.d.ts.map +1 -0
- package/dist/src/api/modules/users/routes/change-password.route.js +58 -0
- package/dist/src/api/modules/users/routes/reset-passowrd.route.d.ts +42 -0
- package/dist/src/api/modules/users/routes/reset-passowrd.route.d.ts.map +1 -0
- package/dist/src/api/modules/users/routes/reset-passowrd.route.js +91 -0
- 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 +9 -3
- package/dist/src/api/modules/users/routes/sign-up.route.d.ts.map +1 -1
- package/dist/src/api/modules/users/routes/sign-up.route.js +18 -12
- package/dist/src/api/modules/users/routes/test.route.d.ts +3 -3
- package/dist/src/api/modules/users/routes/test.route.d.ts.map +1 -1
- package/dist/src/api/modules/users/routes/test.route.js +9 -15
- package/dist/src/api/modules/users/sso/routes/callback.route.d.ts +6 -3
- package/dist/src/api/modules/users/sso/routes/callback.route.d.ts.map +1 -1
- package/dist/src/api/modules/users/sso/routes/callback.route.js +10 -7
- 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 +6 -3
- package/dist/src/api/modules/users/sso/sso.module.d.ts.map +1 -1
- package/dist/src/api/modules/users/sso/sso.module.js +1 -1
- package/dist/src/api/modules/users/users.module.d.ts +103 -11
- package/dist/src/api/modules/users/users.module.d.ts.map +1 -1
- package/dist/src/api/modules/users/users.module.js +6 -2
- 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 +9 -0
- package/dist/src/app/login/reset-password/page.d.ts.map +1 -0
- package/dist/src/app/login/reset-password/page.js +18 -0
- 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 +17 -16
- package/dist/src/components/form/auto-form.d.ts.map +1 -1
- package/dist/src/components/form/auto-form.js +15 -13
- package/dist/src/components/form/common/desc.js +1 -1
- package/dist/src/components/form/common/label.d.ts +4 -2
- package/dist/src/components/form/common/label.d.ts.map +1 -1
- package/dist/src/components/form/common/label.js +14 -4
- package/dist/src/components/form/fields/checkbox.d.ts +3 -3
- package/dist/src/components/form/fields/checkbox.d.ts.map +1 -1
- package/dist/src/components/form/fields/checkbox.js +2 -1
- package/dist/src/components/form/fields/combobox-async.d.ts +4 -4
- package/dist/src/components/form/fields/combobox-async.d.ts.map +1 -1
- package/dist/src/components/form/fields/combobox-async.js +31 -24
- package/dist/src/components/form/fields/combobox.d.ts +4 -4
- package/dist/src/components/form/fields/combobox.d.ts.map +1 -1
- package/dist/src/components/form/fields/combobox.js +8 -8
- package/dist/src/components/form/fields/input.d.ts +3 -3
- package/dist/src/components/form/fields/input.d.ts.map +1 -1
- package/dist/src/components/form/fields/input.js +4 -3
- package/dist/src/components/form/fields/radio-group.d.ts +4 -4
- package/dist/src/components/form/fields/radio-group.d.ts.map +1 -1
- package/dist/src/components/form/fields/radio-group.js +2 -2
- package/dist/src/components/form/fields/select.d.ts +4 -4
- package/dist/src/components/form/fields/select.d.ts.map +1 -1
- package/dist/src/components/form/fields/select.js +4 -4
- package/dist/src/components/form/fields/switch.d.ts +3 -3
- package/dist/src/components/form/fields/switch.d.ts.map +1 -1
- package/dist/src/components/form/fields/switch.js +2 -1
- package/dist/src/components/form/fields/textarea.d.ts +4 -4
- package/dist/src/components/form/fields/textarea.d.ts.map +1 -1
- package/dist/src/components/form/fields/textarea.js +3 -3
- 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 +13 -14
- package/dist/src/components/ui/alert.d.ts +6 -6
- 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 +4 -4
- 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 +9 -9
- package/dist/src/components/ui/button.d.ts.map +1 -1
- package/dist/src/components/ui/button.js +14 -15
- package/dist/src/components/ui/card.d.ts +8 -8
- package/dist/src/components/ui/card.d.ts.map +1 -1
- package/dist/src/components/ui/card.js +7 -8
- 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 +3 -3
- package/dist/src/components/ui/popover.d.ts.map +1 -1
- package/dist/src/components/ui/popover.js +4 -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 +3 -3
- package/dist/src/components/ui/tooltip.d.ts.map +1 -1
- package/dist/src/components/ui/tooltip.js +8 -10
- 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.d.ts +21 -2
- package/dist/src/database/users.d.ts.map +1 -1
- package/dist/src/database/users.js +18 -15
- 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 +34 -22
- package/dist/src/emails/default-template.d.ts.map +1 -1
- package/dist/src/emails/default-template.js +61 -66
- package/dist/src/emails/reset-password.d.ts +56 -0
- package/dist/src/emails/reset-password.d.ts.map +1 -0
- package/dist/src/emails/reset-password.js +132 -0
- package/dist/src/emails/ui/button.d.ts +9 -0
- package/dist/src/emails/ui/button.d.ts.map +1 -0
- package/dist/src/emails/ui/button.js +36 -0
- package/dist/src/emails/ui/card.d.ts +8 -0
- package/dist/src/emails/ui/card.d.ts.map +1 -0
- package/dist/src/emails/ui/card.js +39 -0
- 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 +64 -40
- 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 +16 -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 +3 -2
- 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.d.ts +5 -0
- package/dist/src/views/auth/password-reset/change-password-form/form.d.ts.map +1 -0
- package/dist/src/views/auth/password-reset/change-password-form/form.js +48 -0
- package/dist/src/views/auth/password-reset/change-password-form/mutation-api.d.ts +6 -0
- package/dist/src/views/auth/password-reset/change-password-form/mutation-api.d.ts.map +1 -0
- package/dist/src/views/auth/password-reset/change-password-form/mutation-api.js +22 -0
- package/dist/src/views/auth/password-reset/change-password-form/use-form.d.ts +11 -0
- package/dist/src/views/auth/password-reset/change-password-form/use-form.d.ts.map +1 -0
- package/dist/src/views/auth/password-reset/change-password-form/use-form.js +36 -0
- package/dist/src/views/auth/password-reset/form/form.d.ts +6 -0
- package/dist/src/views/auth/password-reset/form/form.d.ts.map +1 -0
- package/dist/src/views/auth/password-reset/form/form.js +104 -0
- package/dist/src/views/auth/password-reset/form/mutation-api.d.ts +7 -0
- package/dist/src/views/auth/password-reset/form/mutation-api.d.ts.map +1 -0
- package/dist/src/views/auth/password-reset/form/mutation-api.js +21 -0
- package/dist/src/views/auth/password-reset/form/use-form.d.ts +12 -0
- package/dist/src/views/auth/password-reset/form/use-form.d.ts.map +1 -0
- package/dist/src/views/auth/password-reset/form/use-form.js +33 -0
- package/dist/src/views/auth/password-reset/password-reset-view.d.ts +7 -0
- package/dist/src/views/auth/password-reset/password-reset-view.d.ts.map +1 -0
- package/dist/src/views/auth/password-reset/password-reset-view.js +37 -0
- package/dist/src/views/auth/sign-in/form/form.d.ts +2 -1
- package/dist/src/views/auth/sign-in/form/form.d.ts.map +1 -1
- package/dist/src/views/auth/sign-in/form/form.js +15 -10
- 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.d.ts.map +1 -1
- package/dist/src/views/auth/sign-in/sign-in-view.js +13 -7
- package/dist/src/views/auth/{components → sign-up/components}/password-input.d.ts +3 -3
- package/dist/src/views/auth/sign-up/components/password-input.d.ts.map +1 -0
- package/dist/src/views/auth/{components → sign-up/components}/password-input.js +13 -14
- 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 +20 -33
- package/dist/src/views/auth/sign-up/form/mutation-api.d.ts +3 -3
- 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 +3 -8
- package/dist/src/views/auth/sign-up/form/use-form.d.ts.map +1 -1
- package/dist/src/views/auth/sign-up/form/use-form.js +27 -24
- package/dist/src/views/auth/sign-up/sign-up-view.js +6 -6
- 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.d.ts.map +1 -1
- package/dist/src/views/auth/sso/callback/callback-sso-view.js +21 -7
- package/dist/src/views/auth/sso/callback/client/client.d.ts +3 -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 +36 -7
- package/dist/src/views/auth/sso/callback/client/mutation-api.d.ts.map +1 -1
- package/dist/src/views/auth/sso/callback/client/mutation-api.js +11 -6
- package/dist/src/views/error/back-button.js +1 -1
- package/dist/src/views/error/error-view.d.ts +5 -3
- package/dist/src/views/error/error-view.d.ts.map +1 -1
- package/dist/src/views/error/error-view.js +25 -23
- 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 -13
- 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 +44 -46
- package/src/app/login/page.tsx +5 -5
- package/src/app/login/reset-password/page.tsx +27 -0
- 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
- package/src/locales/en.json +42 -2
- package/dist/src/views/auth/components/password-input.d.ts.map +0 -1
package/dist/src/lib/colors.js
CHANGED
|
@@ -5,19 +5,21 @@ export const convertColor = {
|
|
|
5
5
|
const f = (n)=>{
|
|
6
6
|
const k = (n + h / 30) % 12;
|
|
7
7
|
const color = l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);
|
|
8
|
-
return Math.round(255 * color).toString(16).padStart(2,
|
|
8
|
+
return Math.round(255 * color).toString(16).padStart(2, "0");
|
|
9
9
|
};
|
|
10
10
|
return `${f(0)}${f(8)}${f(4)}`;
|
|
11
11
|
},
|
|
12
12
|
hexToHSL: (hex)=>{
|
|
13
13
|
if (!hexRegex.test(hex)) return undefined;
|
|
14
|
-
let b = 0
|
|
14
|
+
let b = 0;
|
|
15
|
+
let g = 0;
|
|
16
|
+
let r = 0;
|
|
15
17
|
// 3 digits
|
|
16
|
-
if (hex.length
|
|
18
|
+
if (hex.length === 4) {
|
|
17
19
|
r = parseInt(hex[1] + hex[1], 16);
|
|
18
20
|
g = parseInt(hex[2] + hex[2], 16);
|
|
19
21
|
b = parseInt(hex[3] + hex[3], 16);
|
|
20
|
-
} else if (hex.length
|
|
22
|
+
} else if (hex.length === 7) {
|
|
21
23
|
r = parseInt(hex[1] + hex[2], 16);
|
|
22
24
|
g = parseInt(hex[3] + hex[4], 16);
|
|
23
25
|
b = parseInt(hex[5] + hex[6], 16);
|
|
@@ -25,15 +27,18 @@ export const convertColor = {
|
|
|
25
27
|
return undefined;
|
|
26
28
|
}
|
|
27
29
|
// Check if any of the parsed values are NaN
|
|
28
|
-
if (isNaN(r) || isNaN(g) || isNaN(b)) {
|
|
30
|
+
if (Number.isNaN(r) || Number.isNaN(g) || Number.isNaN(b)) {
|
|
29
31
|
return undefined;
|
|
30
32
|
}
|
|
31
33
|
r /= 255;
|
|
32
34
|
g /= 255;
|
|
33
35
|
b /= 255;
|
|
34
|
-
const max = Math.max(r, g, b)
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
const max = Math.max(r, g, b);
|
|
37
|
+
const min = Math.min(r, g, b);
|
|
38
|
+
const l = (max + min) / 2;
|
|
39
|
+
let h = 0;
|
|
40
|
+
let s = 0;
|
|
41
|
+
if (max === min) {
|
|
37
42
|
h = s = 0; // achromatic
|
|
38
43
|
} else {
|
|
39
44
|
const d = max - min;
|
|
@@ -63,12 +68,16 @@ export const convertColor = {
|
|
|
63
68
|
g /= 255;
|
|
64
69
|
b /= 255;
|
|
65
70
|
// Find greatest and smallest channel values
|
|
66
|
-
const cmax = Math.max(r, g, b)
|
|
67
|
-
|
|
71
|
+
const cmax = Math.max(r, g, b);
|
|
72
|
+
const cmin = Math.min(r, g, b);
|
|
73
|
+
const delta = cmax - cmin;
|
|
74
|
+
let h = 0;
|
|
75
|
+
let l = 0;
|
|
76
|
+
let s = 0;
|
|
68
77
|
// Calculate hue
|
|
69
|
-
if (delta
|
|
70
|
-
else if (cmax
|
|
71
|
-
else if (cmax
|
|
78
|
+
if (delta === 0) h = 0;
|
|
79
|
+
else if (cmax === r) h = (g - b) / delta % 6;
|
|
80
|
+
else if (cmax === g) h = (b - r) / delta + 2;
|
|
72
81
|
else h = (r - g) / delta + 4;
|
|
73
82
|
h = Math.round(h * 60);
|
|
74
83
|
// Make negative hues positive behind 360°
|
|
@@ -76,7 +85,7 @@ export const convertColor = {
|
|
|
76
85
|
// Calculate lightness
|
|
77
86
|
l = (cmax + cmin) / 2;
|
|
78
87
|
// Calculate saturation
|
|
79
|
-
s = delta
|
|
88
|
+
s = delta === 0 ? 0 : delta / (1 - Math.abs(2 * l - 1));
|
|
80
89
|
// Multiply l and s by 100
|
|
81
90
|
s = +(s * 100).toFixed(1);
|
|
82
91
|
l = +(l * 100).toFixed(1);
|
|
@@ -92,7 +101,7 @@ export const convertColor = {
|
|
|
92
101
|
const f = (n)=>{
|
|
93
102
|
const k = (n + h / 30) % 12;
|
|
94
103
|
const color = l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);
|
|
95
|
-
return Math.round(255 * color).toString(16).padStart(2,
|
|
104
|
+
return Math.round(255 * color).toString(16).padStart(2, "0"); // convert to Hex and prefix "0" if needed
|
|
96
105
|
};
|
|
97
106
|
return {
|
|
98
107
|
r: f(0),
|
|
@@ -107,19 +116,19 @@ export const rgbWithCommaRegex = /^rgb\(\s*([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][
|
|
|
107
116
|
export const rgbWithoutCommaRegex = /^rgb\(\s*([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\s+([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\s+([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\s*\)$/;
|
|
108
117
|
export const checkColorType = (strColor)=>{
|
|
109
118
|
if (hexRegex.test(strColor)) {
|
|
110
|
-
return
|
|
119
|
+
return "hex";
|
|
111
120
|
}
|
|
112
121
|
if (hslRegex.test(strColor)) {
|
|
113
|
-
return
|
|
122
|
+
return "hsl";
|
|
114
123
|
}
|
|
115
124
|
if (rgbWithoutCommaRegex.test(strColor) || rgbWithCommaRegex.test(strColor)) {
|
|
116
|
-
return
|
|
125
|
+
return "rgb";
|
|
117
126
|
}
|
|
118
127
|
return null;
|
|
119
128
|
};
|
|
120
129
|
export const getHSLFromString = (string)=>{
|
|
121
130
|
if (!hslRegex.test(string)) return null;
|
|
122
|
-
const [h, s, l] = string.replaceAll(
|
|
131
|
+
const [h, s, l] = string.replaceAll("hsl(", "").replaceAll(")", "").replaceAll("%", "").split(",").map(Number);
|
|
123
132
|
return {
|
|
124
133
|
h,
|
|
125
134
|
s,
|
|
@@ -1,71 +1,71 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
2
|
import { checkColorType, convertColor, getHSLFromString, getStringFromHSL } from "./colors.js";
|
|
3
|
-
describe(
|
|
4
|
-
describe(
|
|
5
|
-
it(
|
|
3
|
+
describe("convertColor", ()=>{
|
|
4
|
+
describe("hslToHex", ()=>{
|
|
5
|
+
it("should convert HSL to hex correctly", ()=>{
|
|
6
6
|
const hsl = {
|
|
7
7
|
h: 0,
|
|
8
8
|
s: 100,
|
|
9
9
|
l: 50
|
|
10
10
|
}; // Red
|
|
11
|
-
expect(convertColor.hslToHex(hsl)).toBe(
|
|
11
|
+
expect(convertColor.hslToHex(hsl)).toBe("ff0000");
|
|
12
12
|
const hsl2 = {
|
|
13
13
|
h: 120,
|
|
14
14
|
s: 100,
|
|
15
15
|
l: 50
|
|
16
16
|
}; // Green
|
|
17
|
-
expect(convertColor.hslToHex(hsl2)).toBe(
|
|
17
|
+
expect(convertColor.hslToHex(hsl2)).toBe("00ff00");
|
|
18
18
|
const hsl3 = {
|
|
19
19
|
h: 240,
|
|
20
20
|
s: 100,
|
|
21
21
|
l: 50
|
|
22
22
|
}; // Blue
|
|
23
|
-
expect(convertColor.hslToHex(hsl3)).toBe(
|
|
23
|
+
expect(convertColor.hslToHex(hsl3)).toBe("0000ff");
|
|
24
24
|
});
|
|
25
25
|
});
|
|
26
|
-
describe(
|
|
27
|
-
it(
|
|
28
|
-
expect(convertColor.hexToHSL(
|
|
26
|
+
describe("hexToHSL", ()=>{
|
|
27
|
+
it("should convert 6-digit hex to HSL correctly", ()=>{
|
|
28
|
+
expect(convertColor.hexToHSL("#ff0000")).toEqual({
|
|
29
29
|
h: 0,
|
|
30
30
|
s: 100,
|
|
31
31
|
l: 50
|
|
32
32
|
});
|
|
33
|
-
expect(convertColor.hexToHSL(
|
|
33
|
+
expect(convertColor.hexToHSL("#00ff00")).toEqual({
|
|
34
34
|
h: 120,
|
|
35
35
|
s: 100,
|
|
36
36
|
l: 50
|
|
37
37
|
});
|
|
38
|
-
expect(convertColor.hexToHSL(
|
|
38
|
+
expect(convertColor.hexToHSL("#0000ff")).toEqual({
|
|
39
39
|
h: 240,
|
|
40
40
|
s: 100,
|
|
41
41
|
l: 50
|
|
42
42
|
});
|
|
43
43
|
});
|
|
44
|
-
it(
|
|
45
|
-
expect(convertColor.hexToHSL(
|
|
44
|
+
it("should convert 3-digit hex to HSL correctly", ()=>{
|
|
45
|
+
expect(convertColor.hexToHSL("#f00")).toEqual({
|
|
46
46
|
h: 0,
|
|
47
47
|
s: 100,
|
|
48
48
|
l: 50
|
|
49
49
|
});
|
|
50
|
-
expect(convertColor.hexToHSL(
|
|
50
|
+
expect(convertColor.hexToHSL("#0f0")).toEqual({
|
|
51
51
|
h: 120,
|
|
52
52
|
s: 100,
|
|
53
53
|
l: 50
|
|
54
54
|
});
|
|
55
|
-
expect(convertColor.hexToHSL(
|
|
55
|
+
expect(convertColor.hexToHSL("#00f")).toEqual({
|
|
56
56
|
h: 240,
|
|
57
57
|
s: 100,
|
|
58
58
|
l: 50
|
|
59
59
|
});
|
|
60
60
|
});
|
|
61
|
-
it(
|
|
62
|
-
expect(convertColor.hexToHSL(
|
|
63
|
-
expect(convertColor.hexToHSL(
|
|
64
|
-
expect(convertColor.hexToHSL(
|
|
61
|
+
it("should return undefined for invalid hex values", ()=>{
|
|
62
|
+
expect(convertColor.hexToHSL("#xyz")).toBeUndefined();
|
|
63
|
+
expect(convertColor.hexToHSL("#12")).toBeUndefined();
|
|
64
|
+
expect(convertColor.hexToHSL("invalid")).toBeUndefined();
|
|
65
65
|
});
|
|
66
66
|
});
|
|
67
|
-
describe(
|
|
68
|
-
it(
|
|
67
|
+
describe("RGBToHSL", ()=>{
|
|
68
|
+
it("should convert RGB to HSL correctly", ()=>{
|
|
69
69
|
expect(convertColor.RGBToHSL(255, 0, 0)).toEqual({
|
|
70
70
|
h: 0,
|
|
71
71
|
s: 100,
|
|
@@ -93,81 +93,81 @@ describe('convertColor', ()=>{
|
|
|
93
93
|
});
|
|
94
94
|
});
|
|
95
95
|
});
|
|
96
|
-
describe(
|
|
97
|
-
it(
|
|
96
|
+
describe("hslToRgb", ()=>{
|
|
97
|
+
it("should convert HSL to RGB correctly", ()=>{
|
|
98
98
|
expect(convertColor.hslToRgb(0, 100, 50)).toEqual({
|
|
99
|
-
r:
|
|
100
|
-
g:
|
|
101
|
-
b:
|
|
99
|
+
r: "ff",
|
|
100
|
+
g: "00",
|
|
101
|
+
b: "00"
|
|
102
102
|
});
|
|
103
103
|
expect(convertColor.hslToRgb(120, 100, 50)).toEqual({
|
|
104
|
-
r:
|
|
105
|
-
g:
|
|
106
|
-
b:
|
|
104
|
+
r: "00",
|
|
105
|
+
g: "ff",
|
|
106
|
+
b: "00"
|
|
107
107
|
});
|
|
108
108
|
expect(convertColor.hslToRgb(240, 100, 50)).toEqual({
|
|
109
|
-
r:
|
|
110
|
-
g:
|
|
111
|
-
b:
|
|
109
|
+
r: "00",
|
|
110
|
+
g: "00",
|
|
111
|
+
b: "ff"
|
|
112
112
|
});
|
|
113
113
|
});
|
|
114
114
|
});
|
|
115
115
|
});
|
|
116
|
-
describe(
|
|
117
|
-
it(
|
|
118
|
-
expect(checkColorType(
|
|
119
|
-
expect(checkColorType(
|
|
120
|
-
expect(checkColorType(
|
|
116
|
+
describe("checkColorType", ()=>{
|
|
117
|
+
it("should identify hex colors correctly", ()=>{
|
|
118
|
+
expect(checkColorType("#fff")).toBe("hex");
|
|
119
|
+
expect(checkColorType("#ffffff")).toBe("hex");
|
|
120
|
+
expect(checkColorType("#FF0000")).toBe("hex");
|
|
121
121
|
});
|
|
122
|
-
it(
|
|
123
|
-
expect(checkColorType(
|
|
124
|
-
expect(checkColorType(
|
|
122
|
+
it("should identify HSL colors correctly", ()=>{
|
|
123
|
+
expect(checkColorType("hsl(0, 100%, 50%)")).toBe("hsl");
|
|
124
|
+
expect(checkColorType("hsl(120, 60%, 70%)")).toBe("hsl");
|
|
125
125
|
});
|
|
126
|
-
it(
|
|
127
|
-
expect(checkColorType(
|
|
128
|
-
expect(checkColorType(
|
|
126
|
+
it("should identify RGB colors correctly", ()=>{
|
|
127
|
+
expect(checkColorType("rgb(255, 0, 0)")).toBe("rgb");
|
|
128
|
+
expect(checkColorType("rgb(255 0 0)")).toBe("rgb");
|
|
129
129
|
});
|
|
130
|
-
it(
|
|
131
|
-
expect(checkColorType(
|
|
132
|
-
expect(checkColorType(
|
|
133
|
-
expect(checkColorType(
|
|
130
|
+
it("should return null for invalid colors", ()=>{
|
|
131
|
+
expect(checkColorType("invalid")).toBeNull();
|
|
132
|
+
expect(checkColorType("rgb(300, 0, 0)")).toBeNull();
|
|
133
|
+
expect(checkColorType("hsl(400, 100%, 50%)")).toBeNull();
|
|
134
134
|
});
|
|
135
135
|
});
|
|
136
|
-
describe(
|
|
137
|
-
it(
|
|
138
|
-
expect(getHSLFromString(
|
|
136
|
+
describe("getHSLFromString", ()=>{
|
|
137
|
+
it("should parse valid HSL strings correctly", ()=>{
|
|
138
|
+
expect(getHSLFromString("hsl(0, 100%, 50%)")).toEqual({
|
|
139
139
|
h: 0,
|
|
140
140
|
s: 100,
|
|
141
141
|
l: 50
|
|
142
142
|
});
|
|
143
|
-
expect(getHSLFromString(
|
|
143
|
+
expect(getHSLFromString("hsl(120, 60%, 70%)")).toEqual({
|
|
144
144
|
h: 120,
|
|
145
145
|
s: 60,
|
|
146
146
|
l: 70
|
|
147
147
|
});
|
|
148
148
|
});
|
|
149
|
-
it(
|
|
150
|
-
expect(getHSLFromString(
|
|
151
|
-
expect(getHSLFromString(
|
|
152
|
-
expect(getHSLFromString(
|
|
149
|
+
it("should return null for invalid HSL strings", ()=>{
|
|
150
|
+
expect(getHSLFromString("invalid")).toBeNull();
|
|
151
|
+
expect(getHSLFromString("rgb(255, 0, 0)")).toBeNull();
|
|
152
|
+
expect(getHSLFromString("hsl(400, 100%, 50%")).toBeNull();
|
|
153
153
|
});
|
|
154
154
|
});
|
|
155
|
-
describe(
|
|
156
|
-
it(
|
|
155
|
+
describe("getStringFromHSL", ()=>{
|
|
156
|
+
it("should format HSL color object to string correctly", ()=>{
|
|
157
157
|
expect(getStringFromHSL({
|
|
158
158
|
h: 0,
|
|
159
159
|
s: 100,
|
|
160
160
|
l: 50
|
|
161
|
-
})).toBe(
|
|
161
|
+
})).toBe("hsl(0, 100%, 50%)");
|
|
162
162
|
expect(getStringFromHSL({
|
|
163
163
|
h: 120,
|
|
164
164
|
s: 60,
|
|
165
165
|
l: 70
|
|
166
|
-
})).toBe(
|
|
166
|
+
})).toBe("hsl(120, 60%, 70%)");
|
|
167
167
|
expect(getStringFromHSL({
|
|
168
168
|
h: 240,
|
|
169
169
|
s: 50,
|
|
170
170
|
l: 30
|
|
171
|
-
})).toBe(
|
|
171
|
+
})).toBe("hsl(240, 50%, 30%)");
|
|
172
172
|
});
|
|
173
173
|
});
|
package/dist/src/lib/config.js
CHANGED
|
@@ -3,10 +3,10 @@ const ENVS = {
|
|
|
3
3
|
web_url: process.env.NEXT_PUBLIC_WEB_URL
|
|
4
4
|
};
|
|
5
5
|
const urls = {
|
|
6
|
-
api: new URL(ENVS.api_url ??
|
|
7
|
-
web: new URL(ENVS.web_url ??
|
|
6
|
+
api: new URL(ENVS.api_url ?? "http://localhost:3000"),
|
|
7
|
+
web: new URL(ENVS.web_url ?? "http://localhost:3000")
|
|
8
8
|
};
|
|
9
9
|
export const CONFIG = {
|
|
10
|
-
node_development: process.env.NODE_ENV ===
|
|
10
|
+
node_development: process.env.NODE_ENV === "development",
|
|
11
11
|
...urls
|
|
12
12
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cookie-from-string-to-object.d.ts","sourceRoot":"","sources":["../../../../src/lib/fetcher/cookie-from-string-to-object.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,wBAAwB,GACnC,KAAK,MAAM,EAAE,KACZ;
|
|
1
|
+
{"version":3,"file":"cookie-from-string-to-object.d.ts","sourceRoot":"","sources":["../../../../src/lib/fetcher/cookie-from-string-to-object.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,wBAAwB,GACnC,KAAK,MAAM,EAAE,KACZ;IACD,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC;IACxE,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,KAAK,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAC;IAC1D,MAAM,EAAE,OAAO,CAAC;CACjB,EAcA,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const cookieFromStringToObject = (str)=>{
|
|
2
|
-
return str.map((item)=>Object.fromEntries(item.split(
|
|
2
|
+
return str.map((item)=>Object.fromEntries(item.split("; ").map((v)=>{
|
|
3
3
|
const current = v.split(/=(.*)/s).map(decodeURIComponent);
|
|
4
4
|
if (current.length === 1) {
|
|
5
5
|
return [
|
|
@@ -1,75 +1,75 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
2
|
import { cookieFromStringToObject } from "./cookie-from-string-to-object.js";
|
|
3
|
-
describe(
|
|
4
|
-
it(
|
|
3
|
+
describe("cookieFromStringToObject", ()=>{
|
|
4
|
+
it("should parse a simple cookie string", ()=>{
|
|
5
5
|
const cookies = [
|
|
6
|
-
|
|
6
|
+
"token=abc123; Path=/; HttpOnly"
|
|
7
7
|
];
|
|
8
8
|
const result = cookieFromStringToObject(cookies);
|
|
9
9
|
expect(result).toEqual([
|
|
10
10
|
{
|
|
11
|
-
token:
|
|
12
|
-
Path:
|
|
11
|
+
token: "abc123",
|
|
12
|
+
Path: "/",
|
|
13
13
|
HttpOnly: true
|
|
14
14
|
}
|
|
15
15
|
]);
|
|
16
16
|
});
|
|
17
|
-
it(
|
|
17
|
+
it("should parse multiple cookie attributes", ()=>{
|
|
18
18
|
const cookies = [
|
|
19
|
-
|
|
19
|
+
"sessionId=xyz789; Domain=example.com; Path=/; HttpOnly; Secure; SameSite=strict; Expires=Wed, 21 Oct 2025 07:28:00 GMT"
|
|
20
20
|
];
|
|
21
21
|
const result = cookieFromStringToObject(cookies);
|
|
22
22
|
expect(result).toEqual([
|
|
23
23
|
{
|
|
24
|
-
sessionId:
|
|
25
|
-
Domain:
|
|
26
|
-
Path:
|
|
24
|
+
sessionId: "xyz789",
|
|
25
|
+
Domain: "example.com",
|
|
26
|
+
Path: "/",
|
|
27
27
|
HttpOnly: true,
|
|
28
28
|
Secure: true,
|
|
29
|
-
SameSite:
|
|
30
|
-
Expires:
|
|
29
|
+
SameSite: "strict",
|
|
30
|
+
Expires: "Wed, 21 Oct 2025 07:28:00 GMT"
|
|
31
31
|
}
|
|
32
32
|
]);
|
|
33
33
|
});
|
|
34
|
-
it(
|
|
34
|
+
it("should handle multiple cookies", ()=>{
|
|
35
35
|
const cookies = [
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
"token=abc123; Path=/; HttpOnly",
|
|
37
|
+
"theme=dark; Path=/; SameSite=lax"
|
|
38
38
|
];
|
|
39
39
|
const result = cookieFromStringToObject(cookies);
|
|
40
40
|
expect(result).toEqual([
|
|
41
41
|
{
|
|
42
|
-
token:
|
|
43
|
-
Path:
|
|
42
|
+
token: "abc123",
|
|
43
|
+
Path: "/",
|
|
44
44
|
HttpOnly: true
|
|
45
45
|
},
|
|
46
46
|
{
|
|
47
|
-
theme:
|
|
48
|
-
Path:
|
|
49
|
-
SameSite:
|
|
47
|
+
theme: "dark",
|
|
48
|
+
Path: "/",
|
|
49
|
+
SameSite: "lax"
|
|
50
50
|
}
|
|
51
51
|
]);
|
|
52
52
|
});
|
|
53
|
-
it(
|
|
53
|
+
it("should handle URL encoded values", ()=>{
|
|
54
54
|
const cookies = [
|
|
55
|
-
|
|
55
|
+
"data=hello%20world; Path=/"
|
|
56
56
|
];
|
|
57
57
|
const result = cookieFromStringToObject(cookies);
|
|
58
58
|
expect(result).toEqual([
|
|
59
59
|
{
|
|
60
|
-
data:
|
|
61
|
-
Path:
|
|
60
|
+
data: "hello world",
|
|
61
|
+
Path: "/"
|
|
62
62
|
}
|
|
63
63
|
]);
|
|
64
64
|
});
|
|
65
|
-
it(
|
|
65
|
+
it("should handle boolean flags without values", ()=>{
|
|
66
66
|
const cookies = [
|
|
67
|
-
|
|
67
|
+
"token=123; HttpOnly; Secure"
|
|
68
68
|
];
|
|
69
69
|
const result = cookieFromStringToObject(cookies);
|
|
70
70
|
expect(result).toEqual([
|
|
71
71
|
{
|
|
72
|
-
token:
|
|
72
|
+
token: "123",
|
|
73
73
|
HttpOnly: true,
|
|
74
74
|
Secure: true
|
|
75
75
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { BaseBuildModuleReturn, BuildModuleReturn } from
|
|
2
|
-
import type { Route } from
|
|
3
|
-
import type { FetcherParams, GetModulePaths, GetValidMethodForPath, GetValidPathsForModule, InferResponseType } from
|
|
1
|
+
import type { BaseBuildModuleReturn, BuildModuleReturn } from "../../api/lib/module";
|
|
2
|
+
import type { Route } from "../../api/lib/route";
|
|
3
|
+
import type { FetcherParams, GetModulePaths, GetValidMethodForPath, GetValidPathsForModule, InferResponseType } from "./types";
|
|
4
4
|
interface CoreFetcherOptions<M extends string, Routes extends Route[], Modules extends BaseBuildModuleReturn[], ModuleName extends GetModulePaths<M, Modules>, SelectedPath extends GetValidPathsForModule<ModuleName, M, Routes, Modules>, Method extends GetValidMethodForPath<ModuleName, SelectedPath, M, Routes, Modules> = GetValidMethodForPath<ModuleName, SelectedPath, M, Routes, Modules>> {
|
|
5
5
|
additionalHeaders?: HeadersInit;
|
|
6
|
-
args?: FetcherParams<M, Routes, Modules, ModuleName, SelectedPath, Method>[
|
|
6
|
+
args?: FetcherParams<M, Routes, Modules, ModuleName, SelectedPath, Method>["args"];
|
|
7
7
|
method: Method;
|
|
8
8
|
module: ModuleName;
|
|
9
|
-
options?: Omit<RequestInit,
|
|
9
|
+
options?: Omit<RequestInit, "body" | "headers">;
|
|
10
10
|
path: SelectedPath;
|
|
11
11
|
prefixPath?: string;
|
|
12
12
|
withPagination?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../src/lib/fetcher/core.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,iBAAiB,EAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../src/lib/fetcher/core.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,iBAAiB,EAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAG7C,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EACd,qBAAqB,EACrB,sBAAsB,EACtB,iBAAiB,EAClB,MAAM,SAAS,CAAC;AAEjB,UAAU,kBAAkB,CAC1B,CAAC,SAAS,MAAM,EAChB,MAAM,SAAS,KAAK,EAAE,EACtB,OAAO,SAAS,qBAAqB,EAAE,EACvC,UAAU,SAAS,cAAc,CAAC,CAAC,EAAE,OAAO,CAAC,EAC7C,YAAY,SAAS,sBAAsB,CAAC,UAAU,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAC3E,MAAM,SAAS,qBAAqB,CAClC,UAAU,EACV,YAAY,EACZ,CAAC,EACD,MAAM,EACN,OAAO,CACR,GAAG,qBAAqB,CAAC,UAAU,EAAE,YAAY,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC;IAEvE,iBAAiB,CAAC,EAAE,WAAW,CAAC;IAChC,IAAI,CAAC,EAAE,aAAa,CAClB,CAAC,EACD,MAAM,EACN,OAAO,EACP,UAAU,EACV,YAAY,EACZ,MAAM,CACP,CAAC,MAAM,CAAC,CAAC;IACV,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,UAAU,CAAC;IACnB,OAAO,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IAChD,IAAI,EAAE,YAAY,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAGD,wBAAsB,WAAW,CAC/B,CAAC,SAAS,MAAM,EAChB,MAAM,SAAS,KAAK,EAAE,EACtB,OAAO,SAAS,qBAAqB,EAAE,EACvC,UAAU,SAAS,cAAc,CAAC,CAAC,EAAE,OAAO,CAAC,EAC7C,YAAY,SAAS,sBAAsB,CAAC,UAAU,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAC3E,MAAM,SAAS,qBAAqB,CAClC,UAAU,EACV,YAAY,EACZ,CAAC,EACD,MAAM,EACN,OAAO,CACR,GAAG,qBAAqB,CAAC,UAAU,EAAE,YAAY,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAEvE,EAAE,QAAQ,EAAE,EAAE,iBAAiB,CAAC,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAC3D,EACE,IAAI,EACJ,MAAM,EACN,MAAM,EACN,IAAI,EACJ,OAAO,EACP,iBAAsB,EACtB,cAAsB,EACtB,UAAe,GAChB,EAAE,kBAAkB,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,CAAC,GAC1E,OAAO,CACR,iBAAiB,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,CAAC,CACxE,CAuEA"}
|
|
@@ -1,43 +1,49 @@
|
|
|
1
1
|
import { CONFIG } from "../config.js";
|
|
2
2
|
import { buildSearchParams } from "./helpers.js";
|
|
3
|
-
|
|
3
|
+
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: <it's very complex and needs to be>
|
|
4
|
+
export async function coreFetcher({ pluginId }, { path, method, module, args, options, additionalHeaders = {}, withPagination = false, prefixPath = "" }) {
|
|
4
5
|
let currentPath = path;
|
|
5
6
|
// Replace path parameters
|
|
6
|
-
if (args &&
|
|
7
|
+
if (args && "params" in args && args.params) {
|
|
7
8
|
for (const [key, value] of Object.entries(args.params)){
|
|
8
9
|
currentPath = currentPath.replaceAll(`{${key}}`, String(value));
|
|
9
10
|
}
|
|
10
11
|
}
|
|
11
12
|
// Ensure path starts with a slash
|
|
12
|
-
const formattedPath = currentPath.startsWith(
|
|
13
|
+
const formattedPath = currentPath.startsWith("/") ? currentPath : `/${currentPath}`;
|
|
13
14
|
// Construct the base URL
|
|
14
|
-
const url = new URL(`/api/${pluginId}${prefixPath}/${module}${formattedPath ===
|
|
15
|
+
const url = new URL(`/api/${pluginId}${prefixPath}/${module}${formattedPath === "/" ? "" : formattedPath}`, CONFIG.api.origin);
|
|
15
16
|
// Add query parameters if they exist
|
|
16
|
-
if (args &&
|
|
17
|
+
if (args && "query" in args && args.query) {
|
|
17
18
|
const queryParams = args.query;
|
|
18
19
|
const searchParams = buildSearchParams({
|
|
19
20
|
...args.query,
|
|
20
21
|
...withPagination && {
|
|
21
|
-
first:
|
|
22
|
-
search: queryParams.search ??
|
|
22
|
+
first: queryParams.last ? undefined : queryParams.first ?? "10",
|
|
23
|
+
search: queryParams.search ?? ""
|
|
23
24
|
}
|
|
24
25
|
});
|
|
25
26
|
url.search = searchParams.toString();
|
|
26
27
|
}
|
|
27
28
|
// Build headers
|
|
28
29
|
const headers = new Headers({
|
|
29
|
-
|
|
30
|
+
"Content-Type": "application/json",
|
|
30
31
|
...additionalHeaders
|
|
31
32
|
});
|
|
32
33
|
const response = await fetch(url, {
|
|
33
34
|
method: method.toUpperCase(),
|
|
34
35
|
headers,
|
|
35
|
-
body: args &&
|
|
36
|
+
body: args && "body" in args ? JSON.stringify(args.body) : undefined,
|
|
36
37
|
...options
|
|
37
38
|
});
|
|
38
|
-
if (
|
|
39
|
+
if (response.status === 500) {
|
|
39
40
|
const errorText = await response.text();
|
|
40
41
|
throw new Error(`${response.status} - ${url.toString()}\n${response.statusText ?? errorText}`);
|
|
41
42
|
}
|
|
43
|
+
if (response.status >= 400) {
|
|
44
|
+
const errorText = await response.text();
|
|
45
|
+
// biome-ignore lint/suspicious/noConsole: <needed for error logging>
|
|
46
|
+
console.error(`\x1b[34m[VitNode - API]\x1b[0m \x1b[31m${response.status}\x1b[0m - \x1b[33m${url.toString()}\x1b[0m\n\x1b[36mError: ${errorText}\x1b[0m`);
|
|
47
|
+
}
|
|
42
48
|
return response;
|
|
43
49
|
}
|
|
@@ -5,7 +5,7 @@ export const handleSetCookiesFetcher = async (res)=>{
|
|
|
5
5
|
await Promise.all(cookieFromStringToObject(res.headers.getSetCookie()).map(async (cookie)=>{
|
|
6
6
|
const key = Object.keys(cookie)[0];
|
|
7
7
|
const value = Object.values(cookie)[0];
|
|
8
|
-
if (typeof value !==
|
|
8
|
+
if (typeof value !== "string" || typeof key !== "string") return;
|
|
9
9
|
(await cookies()).set(key, value, {
|
|
10
10
|
domain: cookie.Domain,
|
|
11
11
|
path: cookie.Path,
|
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
2
|
import { buildSearchParams } from "./helpers.js";
|
|
3
|
-
describe(
|
|
4
|
-
it(
|
|
3
|
+
describe("buildSearchParams", ()=>{
|
|
4
|
+
it("should handle empty query object", ()=>{
|
|
5
5
|
const params = buildSearchParams({});
|
|
6
|
-
expect(params.toString()).toBe(
|
|
6
|
+
expect(params.toString()).toBe("");
|
|
7
7
|
});
|
|
8
|
-
it(
|
|
8
|
+
it("should handle single string values", ()=>{
|
|
9
9
|
const params = buildSearchParams({
|
|
10
|
-
key:
|
|
10
|
+
key: "value"
|
|
11
11
|
});
|
|
12
|
-
expect(params.toString()).toBe(
|
|
12
|
+
expect(params.toString()).toBe("key=value");
|
|
13
13
|
});
|
|
14
|
-
it(
|
|
14
|
+
it("should handle multiple string values", ()=>{
|
|
15
15
|
const params = buildSearchParams({
|
|
16
|
-
key1:
|
|
17
|
-
key2:
|
|
16
|
+
key1: "value1",
|
|
17
|
+
key2: "value2"
|
|
18
18
|
});
|
|
19
|
-
expect(params.toString()).toBe(
|
|
19
|
+
expect(params.toString()).toBe("key1=value1&key2=value2");
|
|
20
20
|
});
|
|
21
|
-
it(
|
|
21
|
+
it("should handle array values", ()=>{
|
|
22
22
|
const params = buildSearchParams({
|
|
23
23
|
key: [
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
"value1",
|
|
25
|
+
"value2"
|
|
26
26
|
]
|
|
27
27
|
});
|
|
28
|
-
expect(params.toString()).toBe(
|
|
28
|
+
expect(params.toString()).toBe("key=value1&key=value2");
|
|
29
29
|
});
|
|
30
|
-
it(
|
|
30
|
+
it("should skip undefined values", ()=>{
|
|
31
31
|
const params = buildSearchParams({
|
|
32
|
-
key1:
|
|
32
|
+
key1: "value1",
|
|
33
33
|
key2: undefined
|
|
34
34
|
});
|
|
35
|
-
expect(params.toString()).toBe(
|
|
35
|
+
expect(params.toString()).toBe("key1=value1");
|
|
36
36
|
});
|
|
37
37
|
});
|