@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
|
@@ -1,70 +1,70 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { getDefaults, getNestedParam, getZodInputParams } from "./auto-form.js";
|
|
4
|
-
describe(
|
|
5
|
-
describe(
|
|
6
|
-
it(
|
|
4
|
+
describe("auto-form helpers", ()=>{
|
|
5
|
+
describe("getDefaults", ()=>{
|
|
6
|
+
it("should return empty object when no schema provided", ()=>{
|
|
7
7
|
expect(getDefaults()).toEqual({});
|
|
8
8
|
});
|
|
9
|
-
it(
|
|
9
|
+
it("should return empty object when schema has no properties", ()=>{
|
|
10
10
|
const schema = {};
|
|
11
11
|
expect(getDefaults(schema)).toEqual({});
|
|
12
12
|
});
|
|
13
|
-
it(
|
|
13
|
+
it("should extract default values from simple Zod schema", ()=>{
|
|
14
14
|
const zodSchema = z.object({
|
|
15
|
-
name: z.string().default(
|
|
15
|
+
name: z.string().default("John Doe"),
|
|
16
16
|
age: z.number().default(25),
|
|
17
17
|
active: z.boolean().default(true)
|
|
18
18
|
});
|
|
19
19
|
const jsonSchema = z.toJSONSchema(zodSchema);
|
|
20
20
|
const result = getDefaults(jsonSchema);
|
|
21
21
|
expect(result).toEqual({
|
|
22
|
-
name:
|
|
22
|
+
name: "John Doe",
|
|
23
23
|
age: 25,
|
|
24
24
|
active: true
|
|
25
25
|
});
|
|
26
26
|
});
|
|
27
|
-
it(
|
|
27
|
+
it("should handle nested Zod objects with defaults", ()=>{
|
|
28
28
|
const zodSchema = z.object({
|
|
29
29
|
user: z.object({
|
|
30
|
-
name: z.string().default(
|
|
30
|
+
name: z.string().default("Jane"),
|
|
31
31
|
settings: z.object({
|
|
32
|
-
theme: z.string().default(
|
|
32
|
+
theme: z.string().default("dark"),
|
|
33
33
|
notifications: z.boolean().default(false)
|
|
34
34
|
})
|
|
35
35
|
}),
|
|
36
|
-
title: z.string().default(
|
|
36
|
+
title: z.string().default("Hello")
|
|
37
37
|
});
|
|
38
38
|
const jsonSchema = z.toJSONSchema(zodSchema);
|
|
39
39
|
const result = getDefaults(jsonSchema);
|
|
40
40
|
expect(result).toEqual({
|
|
41
41
|
user: {
|
|
42
|
-
name:
|
|
42
|
+
name: "Jane",
|
|
43
43
|
settings: {
|
|
44
|
-
theme:
|
|
44
|
+
theme: "dark",
|
|
45
45
|
notifications: false
|
|
46
46
|
}
|
|
47
47
|
},
|
|
48
|
-
title:
|
|
48
|
+
title: "Hello"
|
|
49
49
|
});
|
|
50
50
|
});
|
|
51
|
-
it(
|
|
51
|
+
it("should skip nested objects with no default values", ()=>{
|
|
52
52
|
const zodSchema = z.object({
|
|
53
53
|
user: z.object({
|
|
54
54
|
name: z.string(),
|
|
55
55
|
email: z.string()
|
|
56
56
|
}),
|
|
57
|
-
title: z.string().default(
|
|
57
|
+
title: z.string().default("Hello")
|
|
58
58
|
});
|
|
59
59
|
const jsonSchema = z.toJSONSchema(zodSchema);
|
|
60
60
|
const result = getDefaults(jsonSchema);
|
|
61
61
|
expect(result).toEqual({
|
|
62
|
-
title:
|
|
62
|
+
title: "Hello"
|
|
63
63
|
});
|
|
64
64
|
});
|
|
65
|
-
it(
|
|
65
|
+
it("should handle mixed properties with and without defaults", ()=>{
|
|
66
66
|
const zodSchema = z.object({
|
|
67
|
-
name: z.string().default(
|
|
67
|
+
name: z.string().default("Test"),
|
|
68
68
|
email: z.string(),
|
|
69
69
|
age: z.number().default(30),
|
|
70
70
|
bio: z.string()
|
|
@@ -72,52 +72,52 @@ describe('auto-form helpers', ()=>{
|
|
|
72
72
|
const jsonSchema = z.toJSONSchema(zodSchema);
|
|
73
73
|
const result = getDefaults(jsonSchema);
|
|
74
74
|
expect(result).toEqual({
|
|
75
|
-
name:
|
|
75
|
+
name: "Test",
|
|
76
76
|
age: 30
|
|
77
77
|
});
|
|
78
78
|
});
|
|
79
79
|
});
|
|
80
|
-
describe(
|
|
81
|
-
it(
|
|
80
|
+
describe("getZodInputParams", ()=>{
|
|
81
|
+
it("should return empty object when no schema provided", ()=>{
|
|
82
82
|
expect(getZodInputParams()).toEqual({});
|
|
83
83
|
});
|
|
84
|
-
it(
|
|
84
|
+
it("should return empty object when schema has no properties", ()=>{
|
|
85
85
|
const schema = {};
|
|
86
86
|
expect(getZodInputParams(schema)).toEqual({});
|
|
87
87
|
});
|
|
88
|
-
it(
|
|
88
|
+
it("should extract basic string field parameters from Zod schema", ()=>{
|
|
89
89
|
const zodSchema = z.object({
|
|
90
|
-
name: z.string().min(2).max(50).regex(/^[a-zA-Z]+$/).describe(
|
|
90
|
+
name: z.string().min(2).max(50).regex(/^[a-zA-Z]+$/).describe("User name")
|
|
91
91
|
});
|
|
92
92
|
const jsonSchema = z.toJSONSchema(zodSchema);
|
|
93
93
|
const result = getZodInputParams(jsonSchema, [
|
|
94
|
-
|
|
94
|
+
"name"
|
|
95
95
|
]);
|
|
96
96
|
expect(result).toEqual({
|
|
97
97
|
name: {
|
|
98
|
-
type:
|
|
98
|
+
type: "text",
|
|
99
99
|
minLength: 2,
|
|
100
100
|
maxLength: 50,
|
|
101
|
-
pattern:
|
|
102
|
-
description:
|
|
101
|
+
pattern: "^[a-zA-Z]+$",
|
|
102
|
+
description: "User name",
|
|
103
103
|
required: true
|
|
104
104
|
}
|
|
105
105
|
});
|
|
106
106
|
});
|
|
107
|
-
it(
|
|
107
|
+
it("should handle email format from Zod schema", ()=>{
|
|
108
108
|
const zodSchema = z.object({
|
|
109
|
-
email: z.email().describe(
|
|
109
|
+
email: z.email().describe("Email address")
|
|
110
110
|
});
|
|
111
111
|
const jsonSchema = z.toJSONSchema(zodSchema);
|
|
112
112
|
const result = getZodInputParams(jsonSchema, [
|
|
113
|
-
|
|
113
|
+
"email"
|
|
114
114
|
]);
|
|
115
|
-
expect(result.email).toHaveProperty(
|
|
116
|
-
expect(result.email).toHaveProperty(
|
|
117
|
-
expect(result.email).toHaveProperty(
|
|
118
|
-
expect(result.email).toHaveProperty(
|
|
115
|
+
expect(result.email).toHaveProperty("type", "email");
|
|
116
|
+
expect(result.email).toHaveProperty("description", "Email address");
|
|
117
|
+
expect(result.email).toHaveProperty("required", true);
|
|
118
|
+
expect(result.email).toHaveProperty("pattern"); // Email pattern is generated
|
|
119
119
|
});
|
|
120
|
-
it(
|
|
120
|
+
it("should infer password type from field name", ()=>{
|
|
121
121
|
const zodSchema = z.object({
|
|
122
122
|
password: z.string(),
|
|
123
123
|
confirmPassword: z.string(),
|
|
@@ -125,14 +125,14 @@ describe('auto-form helpers', ()=>{
|
|
|
125
125
|
});
|
|
126
126
|
const jsonSchema = z.toJSONSchema(zodSchema);
|
|
127
127
|
const result = getZodInputParams(jsonSchema);
|
|
128
|
-
expect(result.password).toHaveProperty(
|
|
129
|
-
expect(result.password).toHaveProperty(
|
|
130
|
-
expect(result.confirmPassword).toHaveProperty(
|
|
131
|
-
expect(result.confirmPassword).toHaveProperty(
|
|
132
|
-
expect(result.userPassword).toHaveProperty(
|
|
133
|
-
expect(result.userPassword).toHaveProperty(
|
|
128
|
+
expect(result.password).toHaveProperty("type", "password");
|
|
129
|
+
expect(result.password).toHaveProperty("required", true);
|
|
130
|
+
expect(result.confirmPassword).toHaveProperty("type", "password");
|
|
131
|
+
expect(result.confirmPassword).toHaveProperty("required", true);
|
|
132
|
+
expect(result.userPassword).toHaveProperty("type", "password");
|
|
133
|
+
expect(result.userPassword).toHaveProperty("required", true);
|
|
134
134
|
});
|
|
135
|
-
it(
|
|
135
|
+
it("should handle number and boolean types from Zod schema", ()=>{
|
|
136
136
|
const zodSchema = z.object({
|
|
137
137
|
age: z.number(),
|
|
138
138
|
count: z.number().int(),
|
|
@@ -140,41 +140,41 @@ describe('auto-form helpers', ()=>{
|
|
|
140
140
|
});
|
|
141
141
|
const jsonSchema = z.toJSONSchema(zodSchema);
|
|
142
142
|
const result = getZodInputParams(jsonSchema);
|
|
143
|
-
expect(result.age).toHaveProperty(
|
|
144
|
-
expect(result.age).toHaveProperty(
|
|
145
|
-
expect(result.count).toHaveProperty(
|
|
146
|
-
expect(result.count).toHaveProperty(
|
|
147
|
-
expect(result.active).toHaveProperty(
|
|
148
|
-
expect(result.active).toHaveProperty(
|
|
143
|
+
expect(result.age).toHaveProperty("type", "number");
|
|
144
|
+
expect(result.age).toHaveProperty("required", true);
|
|
145
|
+
expect(result.count).toHaveProperty("type", "number");
|
|
146
|
+
expect(result.count).toHaveProperty("required", true);
|
|
147
|
+
expect(result.active).toHaveProperty("type", "checkbox");
|
|
148
|
+
expect(result.active).toHaveProperty("required", true);
|
|
149
149
|
});
|
|
150
|
-
it(
|
|
150
|
+
it("should handle enum values from Zod schema", ()=>{
|
|
151
151
|
const zodSchema = z.object({
|
|
152
152
|
role: z.enum([
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
153
|
+
"admin",
|
|
154
|
+
"user",
|
|
155
|
+
"guest"
|
|
156
156
|
])
|
|
157
157
|
});
|
|
158
158
|
const jsonSchema = z.toJSONSchema(zodSchema);
|
|
159
159
|
const result = getZodInputParams(jsonSchema);
|
|
160
|
-
expect(result.role).toHaveProperty(
|
|
161
|
-
expect(result.role).toHaveProperty(
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
160
|
+
expect(result.role).toHaveProperty("type", "text");
|
|
161
|
+
expect(result.role).toHaveProperty("enum", [
|
|
162
|
+
"admin",
|
|
163
|
+
"user",
|
|
164
|
+
"guest"
|
|
165
165
|
]);
|
|
166
|
-
expect(result.role).toHaveProperty(
|
|
166
|
+
expect(result.role).toHaveProperty("required", true);
|
|
167
167
|
});
|
|
168
|
-
it(
|
|
168
|
+
it("should handle complex password validation", ()=>{
|
|
169
169
|
const zodSchema = z.object({
|
|
170
|
-
password: z.string().min(8).regex(/(?=.*[a-z])/,
|
|
170
|
+
password: z.string().min(8).regex(/(?=.*[a-z])/, "Must contain lowercase").regex(/(?=.*[A-Z])/, "Must contain uppercase").regex(/(?=.*\d)/, "Must contain number")
|
|
171
171
|
});
|
|
172
172
|
const jsonSchema = z.toJSONSchema(zodSchema);
|
|
173
173
|
const result = getZodInputParams(jsonSchema);
|
|
174
|
-
expect(result.password).toHaveProperty(
|
|
175
|
-
expect(result.password).toHaveProperty(
|
|
174
|
+
expect(result.password).toHaveProperty("type", "password");
|
|
175
|
+
expect(result.password).toHaveProperty("minLength", 8);
|
|
176
176
|
});
|
|
177
|
-
it(
|
|
177
|
+
it("should handle nested objects from Zod schema", ()=>{
|
|
178
178
|
const zodSchema = z.object({
|
|
179
179
|
user: z.object({
|
|
180
180
|
name: z.string(),
|
|
@@ -182,22 +182,22 @@ describe('auto-form helpers', ()=>{
|
|
|
182
182
|
}),
|
|
183
183
|
settings: z.object({
|
|
184
184
|
theme: z.enum([
|
|
185
|
-
|
|
186
|
-
|
|
185
|
+
"light",
|
|
186
|
+
"dark"
|
|
187
187
|
]),
|
|
188
188
|
notifications: z.boolean()
|
|
189
189
|
})
|
|
190
190
|
});
|
|
191
191
|
const jsonSchema = z.toJSONSchema(zodSchema);
|
|
192
192
|
const result = getZodInputParams(jsonSchema, [
|
|
193
|
-
|
|
193
|
+
"user"
|
|
194
194
|
]);
|
|
195
|
-
expect(result.user).toHaveProperty(
|
|
196
|
-
expect(result.user).toHaveProperty(
|
|
197
|
-
expect(result.settings).toHaveProperty(
|
|
198
|
-
expect(result.settings).toHaveProperty(
|
|
195
|
+
expect(result.user).toHaveProperty("name");
|
|
196
|
+
expect(result.user).toHaveProperty("email");
|
|
197
|
+
expect(result.settings).toHaveProperty("theme");
|
|
198
|
+
expect(result.settings).toHaveProperty("notifications");
|
|
199
199
|
});
|
|
200
|
-
it(
|
|
200
|
+
it("should handle required fields from Zod schema", ()=>{
|
|
201
201
|
const zodSchema = z.object({
|
|
202
202
|
name: z.string(),
|
|
203
203
|
email: z.string(),
|
|
@@ -205,14 +205,14 @@ describe('auto-form helpers', ()=>{
|
|
|
205
205
|
});
|
|
206
206
|
const jsonSchema = z.toJSONSchema(zodSchema);
|
|
207
207
|
const result = getZodInputParams(jsonSchema, [
|
|
208
|
-
|
|
209
|
-
|
|
208
|
+
"name",
|
|
209
|
+
"email"
|
|
210
210
|
]);
|
|
211
|
-
expect(result.name).toHaveProperty(
|
|
212
|
-
expect(result.email).toHaveProperty(
|
|
213
|
-
expect(result.age).not.toHaveProperty(
|
|
211
|
+
expect(result.name).toHaveProperty("required", true);
|
|
212
|
+
expect(result.email).toHaveProperty("required", true);
|
|
213
|
+
expect(result.age).not.toHaveProperty("required");
|
|
214
214
|
});
|
|
215
|
-
it(
|
|
215
|
+
it("should handle optional fields from Zod schema", ()=>{
|
|
216
216
|
const zodSchema = z.object({
|
|
217
217
|
name: z.string(),
|
|
218
218
|
email: z.string().optional(),
|
|
@@ -220,116 +220,116 @@ describe('auto-form helpers', ()=>{
|
|
|
220
220
|
});
|
|
221
221
|
const jsonSchema = z.toJSONSchema(zodSchema);
|
|
222
222
|
const result = getZodInputParams(jsonSchema, [
|
|
223
|
-
|
|
223
|
+
"name"
|
|
224
224
|
]);
|
|
225
|
-
expect(result.name).toHaveProperty(
|
|
226
|
-
expect(result.email).not.toHaveProperty(
|
|
227
|
-
expect(result.age).not.toHaveProperty(
|
|
225
|
+
expect(result.name).toHaveProperty("required", true);
|
|
226
|
+
expect(result.email).not.toHaveProperty("required");
|
|
227
|
+
expect(result.age).not.toHaveProperty("required");
|
|
228
228
|
});
|
|
229
|
-
it(
|
|
229
|
+
it("should handle union types from Zod schema", ()=>{
|
|
230
230
|
const zodSchema = z.object({
|
|
231
231
|
status: z.union([
|
|
232
|
-
z.literal(
|
|
233
|
-
z.literal(
|
|
232
|
+
z.literal("active"),
|
|
233
|
+
z.literal("inactive")
|
|
234
234
|
]),
|
|
235
235
|
priority: z.number().or(z.string())
|
|
236
236
|
});
|
|
237
237
|
const jsonSchema = z.toJSONSchema(zodSchema);
|
|
238
238
|
const result = getZodInputParams(jsonSchema);
|
|
239
|
-
expect(result).toHaveProperty(
|
|
240
|
-
expect(result).toHaveProperty(
|
|
239
|
+
expect(result).toHaveProperty("status");
|
|
240
|
+
expect(result).toHaveProperty("priority");
|
|
241
241
|
});
|
|
242
|
-
it(
|
|
242
|
+
it("should handle array types from Zod schema", ()=>{
|
|
243
243
|
const zodSchema = z.object({
|
|
244
244
|
tags: z.array(z.string()),
|
|
245
245
|
numbers: z.array(z.number())
|
|
246
246
|
});
|
|
247
247
|
const jsonSchema = z.toJSONSchema(zodSchema);
|
|
248
248
|
const result = getZodInputParams(jsonSchema);
|
|
249
|
-
expect(result).toHaveProperty(
|
|
250
|
-
expect(result).toHaveProperty(
|
|
249
|
+
expect(result).toHaveProperty("tags");
|
|
250
|
+
expect(result).toHaveProperty("numbers");
|
|
251
251
|
});
|
|
252
252
|
});
|
|
253
|
-
describe(
|
|
253
|
+
describe("getNestedParam", ()=>{
|
|
254
254
|
const testObj = {
|
|
255
255
|
user: {
|
|
256
256
|
name: {
|
|
257
|
-
type:
|
|
257
|
+
type: "text",
|
|
258
258
|
required: true
|
|
259
259
|
},
|
|
260
260
|
email: {
|
|
261
|
-
type:
|
|
261
|
+
type: "email"
|
|
262
262
|
},
|
|
263
263
|
settings: {
|
|
264
264
|
theme: {
|
|
265
|
-
type:
|
|
265
|
+
type: "text",
|
|
266
266
|
enum: [
|
|
267
|
-
|
|
268
|
-
|
|
267
|
+
"light",
|
|
268
|
+
"dark"
|
|
269
269
|
]
|
|
270
270
|
},
|
|
271
271
|
notifications: {
|
|
272
|
-
type:
|
|
272
|
+
type: "checkbox"
|
|
273
273
|
}
|
|
274
274
|
}
|
|
275
275
|
},
|
|
276
276
|
title: {
|
|
277
|
-
type:
|
|
278
|
-
default:
|
|
277
|
+
type: "text",
|
|
278
|
+
default: "Hello"
|
|
279
279
|
}
|
|
280
280
|
};
|
|
281
|
-
it(
|
|
282
|
-
const result = getNestedParam(testObj,
|
|
281
|
+
it("should get top-level properties", ()=>{
|
|
282
|
+
const result = getNestedParam(testObj, "title");
|
|
283
283
|
expect(result).toEqual({
|
|
284
|
-
type:
|
|
285
|
-
default:
|
|
284
|
+
type: "text",
|
|
285
|
+
default: "Hello"
|
|
286
286
|
});
|
|
287
287
|
});
|
|
288
|
-
it(
|
|
289
|
-
const result = getNestedParam(testObj,
|
|
288
|
+
it("should get nested properties", ()=>{
|
|
289
|
+
const result = getNestedParam(testObj, "user.name");
|
|
290
290
|
expect(result).toEqual({
|
|
291
|
-
type:
|
|
291
|
+
type: "text",
|
|
292
292
|
required: true
|
|
293
293
|
});
|
|
294
294
|
});
|
|
295
|
-
it(
|
|
296
|
-
const result = getNestedParam(testObj,
|
|
295
|
+
it("should get deeply nested properties", ()=>{
|
|
296
|
+
const result = getNestedParam(testObj, "user.settings.theme");
|
|
297
297
|
expect(result).toEqual({
|
|
298
|
-
type:
|
|
298
|
+
type: "text",
|
|
299
299
|
enum: [
|
|
300
|
-
|
|
301
|
-
|
|
300
|
+
"light",
|
|
301
|
+
"dark"
|
|
302
302
|
]
|
|
303
303
|
});
|
|
304
304
|
});
|
|
305
|
-
it(
|
|
306
|
-
expect(getNestedParam(testObj,
|
|
307
|
-
expect(getNestedParam(testObj,
|
|
308
|
-
expect(getNestedParam(testObj,
|
|
305
|
+
it("should return undefined for non-existent paths", ()=>{
|
|
306
|
+
expect(getNestedParam(testObj, "nonexistent")).toBeUndefined();
|
|
307
|
+
expect(getNestedParam(testObj, "user.nonexistent")).toBeUndefined();
|
|
308
|
+
expect(getNestedParam(testObj, "user.settings.nonexistent")).toBeUndefined();
|
|
309
309
|
});
|
|
310
|
-
it(
|
|
311
|
-
expect(getNestedParam(testObj,
|
|
312
|
-
expect(getNestedParam(testObj,
|
|
310
|
+
it("should return undefined for invalid paths", ()=>{
|
|
311
|
+
expect(getNestedParam(testObj, "title.invalid")).toBeUndefined();
|
|
312
|
+
expect(getNestedParam(testObj, "user.name.invalid")).toBeUndefined();
|
|
313
313
|
});
|
|
314
|
-
it(
|
|
315
|
-
const result = getNestedParam(testObj,
|
|
314
|
+
it("should handle empty path", ()=>{
|
|
315
|
+
const result = getNestedParam(testObj, "");
|
|
316
316
|
expect(result).toBeUndefined(); // Empty string path returns undefined
|
|
317
317
|
});
|
|
318
|
-
it(
|
|
318
|
+
it("should handle paths with array values safely", ()=>{
|
|
319
319
|
const objWithArray = {
|
|
320
320
|
items: {
|
|
321
321
|
enum: [
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
322
|
+
"a",
|
|
323
|
+
"b",
|
|
324
|
+
"c"
|
|
325
325
|
]
|
|
326
326
|
}
|
|
327
327
|
};
|
|
328
|
-
const result = getNestedParam(objWithArray,
|
|
328
|
+
const result = getNestedParam(objWithArray, "items.enum");
|
|
329
329
|
expect(result).toEqual([
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
330
|
+
"a",
|
|
331
|
+
"b",
|
|
332
|
+
"c"
|
|
333
333
|
]); // Arrays are accessible as normal properties
|
|
334
334
|
});
|
|
335
335
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { RedirectType } from "next/navigation";
|
|
2
|
+
import type { QueryParams } from "next-intl/navigation";
|
|
3
3
|
declare const Link: import("react").ForwardRefExoticComponent<Omit<{
|
|
4
4
|
slot?: string | undefined | undefined;
|
|
5
5
|
style?: import("react").CSSProperties | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../../src/lib/navigation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../../src/lib/navigation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAKxD,QAAA,MACE,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+DAEJ,WAAW,gBACX,SAAS;;;;;cAmBgkyB,CAAC;;;;;;cAAuxC,CAAC;;;;;;cAAwxC,CAAC;;;;;GAlB3n3B,WAAW;;;;;;;YACS,CAAC;AAEvB,QAAA,MAAM,QAAQ,GACZ,MACI,MAAM,GACN;IACE,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB,EACL,OAAO,YAAY,kBAKpB,CAAC;AAEF,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC"}
|
package/dist/src/lib/plugin.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { ItemNavAdmin } from
|
|
2
|
-
interface AdminNavItem extends Pick<React.ComponentProps<typeof ItemNavAdmin>,
|
|
1
|
+
import type { ItemNavAdmin } from "../views/admin/layouts/sidebar/nav/item";
|
|
2
|
+
interface AdminNavItem extends Pick<React.ComponentProps<typeof ItemNavAdmin>, "href" | "icon" | "isOpenInNewTab"> {
|
|
3
3
|
id: string;
|
|
4
4
|
}
|
|
5
5
|
export interface BuildPluginReturn<P extends string = string> {
|
|
6
6
|
admin?: {
|
|
7
7
|
nav?: (AdminNavItem & {
|
|
8
|
-
items?: Omit<AdminNavItem,
|
|
8
|
+
items?: Omit<AdminNavItem, "icon">[];
|
|
9
9
|
})[];
|
|
10
10
|
};
|
|
11
11
|
pluginId: P;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const removeSpecialCharacters = (text, replaceSpace = true)=>text.trimStart().trimEnd().replace(/\s/g, replaceSpace ?
|
|
1
|
+
export const removeSpecialCharacters = (text, replaceSpace = true)=>text.trimStart().trimEnd().replace(/\s/g, replaceSpace ? "-" : " ").normalize("NFD").replace(/\p{Diacritic}/gu, "").replace(/[#%&?^|'{}\\/]/g, "").replace(/ł/gi, "l").replace(/@/g, "-at-").replace(/\./g, "-").replace(/-+/g, "-").trim();
|
|
2
2
|
export const checkSpecialCharacters = (text)=>{
|
|
3
3
|
return /^[a-z0-9-]+$/i.test(text);
|
|
4
4
|
};
|
|
@@ -1,56 +1,56 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
2
|
import { checkSpecialCharacters, removeSpecialCharacters } from "./special-characters.js";
|
|
3
|
-
describe(
|
|
4
|
-
it(
|
|
5
|
-
expect(removeSpecialCharacters(
|
|
3
|
+
describe("removeSpecialCharacters", ()=>{
|
|
4
|
+
it("should remove diacritics and replace spaces with hyphens", ()=>{
|
|
5
|
+
expect(removeSpecialCharacters("héllo wörld")).toBe("hello-world");
|
|
6
6
|
});
|
|
7
|
-
it(
|
|
8
|
-
expect(removeSpecialCharacters(
|
|
7
|
+
it("should keep spaces when replaceSpace is false", ()=>{
|
|
8
|
+
expect(removeSpecialCharacters("hello world", false)).toBe("hello world");
|
|
9
9
|
});
|
|
10
|
-
it(
|
|
11
|
-
expect(removeSpecialCharacters(
|
|
10
|
+
it("should remove special characters", ()=>{
|
|
11
|
+
expect(removeSpecialCharacters("hello#world%123")).toBe("helloworld123");
|
|
12
12
|
});
|
|
13
|
-
it(
|
|
14
|
-
expect(removeSpecialCharacters(
|
|
13
|
+
it("should replace @ with -at-", ()=>{
|
|
14
|
+
expect(removeSpecialCharacters("user@example.com")).toBe("user-at-example-com");
|
|
15
15
|
});
|
|
16
|
-
it(
|
|
17
|
-
expect(removeSpecialCharacters(
|
|
16
|
+
it("should replace dots with hyphens", ()=>{
|
|
17
|
+
expect(removeSpecialCharacters("file.name.txt")).toBe("file-name-txt");
|
|
18
18
|
});
|
|
19
|
-
it(
|
|
20
|
-
expect(removeSpecialCharacters(
|
|
19
|
+
it("should replace Polish ł with l", ()=>{
|
|
20
|
+
expect(removeSpecialCharacters("Łódź")).toBe("lodz");
|
|
21
21
|
});
|
|
22
|
-
it(
|
|
23
|
-
expect(removeSpecialCharacters(
|
|
22
|
+
it("should trim whitespace from start and end", ()=>{
|
|
23
|
+
expect(removeSpecialCharacters(" hello world ")).toBe("hello-world");
|
|
24
24
|
});
|
|
25
|
-
it(
|
|
26
|
-
expect(removeSpecialCharacters(
|
|
25
|
+
it("should handle empty string", ()=>{
|
|
26
|
+
expect(removeSpecialCharacters("")).toBe("");
|
|
27
27
|
});
|
|
28
|
-
it(
|
|
29
|
-
expect(removeSpecialCharacters(
|
|
28
|
+
it("should handle multiple special characters and spaces", ()=>{
|
|
29
|
+
expect(removeSpecialCharacters("Hello & World #123 {test}")).toBe("Hello-World-123-test");
|
|
30
30
|
});
|
|
31
31
|
});
|
|
32
|
-
describe(
|
|
33
|
-
it(
|
|
34
|
-
expect(checkSpecialCharacters(
|
|
32
|
+
describe("checkSpecialCharacters", ()=>{
|
|
33
|
+
it("should return true for alphanumeric characters and hyphens", ()=>{
|
|
34
|
+
expect(checkSpecialCharacters("hello-world-123")).toBe(true);
|
|
35
35
|
});
|
|
36
|
-
it(
|
|
37
|
-
expect(checkSpecialCharacters(
|
|
36
|
+
it("should return false for special characters", ()=>{
|
|
37
|
+
expect(checkSpecialCharacters("hello@world")).toBe(false);
|
|
38
38
|
});
|
|
39
|
-
it(
|
|
40
|
-
expect(checkSpecialCharacters(
|
|
39
|
+
it("should return false for spaces", ()=>{
|
|
40
|
+
expect(checkSpecialCharacters("hello world")).toBe(false);
|
|
41
41
|
});
|
|
42
|
-
it(
|
|
43
|
-
expect(checkSpecialCharacters(
|
|
42
|
+
it("should return true for uppercase letters", ()=>{
|
|
43
|
+
expect(checkSpecialCharacters("HelloWorld")).toBe(true);
|
|
44
44
|
});
|
|
45
|
-
it(
|
|
46
|
-
expect(checkSpecialCharacters(
|
|
45
|
+
it("should return true for numbers only", ()=>{
|
|
46
|
+
expect(checkSpecialCharacters("123")).toBe(true);
|
|
47
47
|
});
|
|
48
|
-
it(
|
|
49
|
-
expect(checkSpecialCharacters(
|
|
48
|
+
it("should return true for hyphens only", ()=>{
|
|
49
|
+
expect(checkSpecialCharacters("-")).toBe(true);
|
|
50
50
|
});
|
|
51
|
-
it(
|
|
52
|
-
expect(checkSpecialCharacters(
|
|
53
|
-
expect(checkSpecialCharacters(
|
|
54
|
-
expect(checkSpecialCharacters(
|
|
51
|
+
it("should return false for other special characters", ()=>{
|
|
52
|
+
expect(checkSpecialCharacters("hello#world")).toBe(false);
|
|
53
|
+
expect(checkSpecialCharacters("test.com")).toBe(false);
|
|
54
|
+
expect(checkSpecialCharacters("user&name")).toBe(false);
|
|
55
55
|
});
|
|
56
56
|
});
|
package/dist/src/lib/utils.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "@testing-library/react";
|
|
2
2
|
//# sourceMappingURL=setup.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin-layout.d.ts","sourceRoot":"","sources":["../../../../../src/views/admin/layouts/admin-layout.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"admin-layout.d.ts","sourceRoot":"","sources":["../../../../../src/views/admin/layouts/admin-layout.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAK7D,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,eAAO,MAAM,WAAW,GAAU,8BAG/B,gBAAgB,GAAG;IACpB,aAAa,EAAE,aAAa,CAAC;CAC9B,4DAiDA,CAAC"}
|