hazo_auth 1.3.0 → 1.4.0
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/README.md +383 -774
- package/dist/components/index.d.ts +3 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +5 -0
- package/dist/components/layouts/email_verification/config/email_verification_field_config.d.ts +23 -0
- package/dist/components/layouts/email_verification/config/email_verification_field_config.d.ts.map +1 -0
- package/dist/components/layouts/email_verification/config/email_verification_field_config.js +44 -0
- package/dist/components/layouts/email_verification/hooks/use_email_verification.d.ts +31 -0
- package/dist/components/layouts/email_verification/hooks/use_email_verification.d.ts.map +1 -0
- package/dist/components/layouts/email_verification/hooks/use_email_verification.js +222 -0
- package/dist/components/layouts/email_verification/index.d.ts +23 -0
- package/dist/components/layouts/email_verification/index.d.ts.map +1 -0
- package/dist/components/layouts/email_verification/index.js +61 -0
- package/dist/components/layouts/forgot_password/config/forgot_password_field_config.d.ts +10 -0
- package/dist/components/layouts/forgot_password/config/forgot_password_field_config.d.ts.map +1 -0
- package/dist/components/layouts/forgot_password/config/forgot_password_field_config.js +33 -0
- package/dist/components/layouts/forgot_password/hooks/use_forgot_password_form.d.ts +22 -0
- package/dist/components/layouts/forgot_password/hooks/use_forgot_password_form.d.ts.map +1 -0
- package/dist/components/layouts/forgot_password/hooks/use_forgot_password_form.js +127 -0
- package/dist/components/layouts/forgot_password/index.d.ts +18 -0
- package/dist/components/layouts/forgot_password/index.d.ts.map +1 -0
- package/dist/components/layouts/forgot_password/index.js +43 -0
- package/dist/components/layouts/index.d.ts +16 -0
- package/dist/components/layouts/index.d.ts.map +1 -0
- package/dist/components/layouts/index.js +11 -0
- package/dist/components/layouts/login/config/login_field_config.d.ts +11 -0
- package/dist/components/layouts/login/config/login_field_config.d.ts.map +1 -0
- package/dist/components/layouts/login/config/login_field_config.js +42 -0
- package/dist/components/layouts/login/hooks/use_login_form.d.ts +34 -0
- package/dist/components/layouts/login/hooks/use_login_form.d.ts.map +1 -0
- package/dist/components/layouts/login/hooks/use_login_form.js +196 -0
- package/dist/components/layouts/login/index.d.ts +31 -0
- package/dist/components/layouts/login/index.d.ts.map +1 -0
- package/dist/components/layouts/login/index.js +58 -0
- package/dist/components/layouts/my_settings/components/editable_field.d.ts +19 -0
- package/dist/components/layouts/my_settings/components/editable_field.d.ts.map +1 -0
- package/dist/components/layouts/my_settings/components/editable_field.js +73 -0
- package/dist/components/layouts/my_settings/components/password_change_dialog.d.ts +28 -0
- package/dist/components/layouts/my_settings/components/password_change_dialog.d.ts.map +1 -0
- package/dist/components/layouts/my_settings/components/password_change_dialog.js +138 -0
- package/dist/components/layouts/my_settings/components/profile_picture_dialog.d.ts +42 -0
- package/dist/components/layouts/my_settings/components/profile_picture_dialog.d.ts.map +1 -0
- package/dist/components/layouts/my_settings/components/profile_picture_dialog.js +198 -0
- package/dist/components/layouts/my_settings/components/profile_picture_display.d.ts +16 -0
- package/dist/components/layouts/my_settings/components/profile_picture_display.d.ts.map +1 -0
- package/dist/components/layouts/my_settings/components/profile_picture_display.js +33 -0
- package/dist/components/layouts/my_settings/components/profile_picture_gravatar_tab.d.ts +17 -0
- package/dist/components/layouts/my_settings/components/profile_picture_gravatar_tab.d.ts.map +1 -0
- package/dist/components/layouts/my_settings/components/profile_picture_gravatar_tab.js +48 -0
- package/dist/components/layouts/my_settings/components/profile_picture_library_tab.d.ts +21 -0
- package/dist/components/layouts/my_settings/components/profile_picture_library_tab.d.ts.map +1 -0
- package/dist/components/layouts/my_settings/components/profile_picture_library_tab.js +144 -0
- package/dist/components/layouts/my_settings/components/profile_picture_upload_tab.d.ts +23 -0
- package/dist/components/layouts/my_settings/components/profile_picture_upload_tab.d.ts.map +1 -0
- package/dist/components/layouts/my_settings/components/profile_picture_upload_tab.js +169 -0
- package/dist/components/layouts/my_settings/config/my_settings_field_config.d.ts +19 -0
- package/dist/components/layouts/my_settings/config/my_settings_field_config.d.ts.map +1 -0
- package/dist/components/layouts/my_settings/config/my_settings_field_config.js +26 -0
- package/dist/components/layouts/my_settings/hooks/use_my_settings.d.ts +46 -0
- package/dist/components/layouts/my_settings/hooks/use_my_settings.d.ts.map +1 -0
- package/dist/components/layouts/my_settings/hooks/use_my_settings.js +354 -0
- package/dist/components/layouts/my_settings/index.d.ts +64 -0
- package/dist/components/layouts/my_settings/index.d.ts.map +1 -0
- package/dist/components/layouts/my_settings/index.js +65 -0
- package/dist/components/layouts/register/config/register_field_config.d.ts +14 -0
- package/dist/components/layouts/register/config/register_field_config.d.ts.map +1 -0
- package/dist/components/layouts/register/config/register_field_config.js +69 -0
- package/dist/components/layouts/register/hooks/use_register_form.d.ts +30 -0
- package/dist/components/layouts/register/hooks/use_register_form.d.ts.map +1 -0
- package/dist/components/layouts/register/hooks/use_register_form.js +184 -0
- package/dist/components/layouts/register/index.d.ts +23 -0
- package/dist/components/layouts/register/index.d.ts.map +1 -0
- package/dist/components/layouts/register/index.js +58 -0
- package/dist/components/layouts/reset_password/config/reset_password_field_config.d.ts +13 -0
- package/dist/components/layouts/reset_password/config/reset_password_field_config.d.ts.map +1 -0
- package/dist/components/layouts/reset_password/config/reset_password_field_config.js +53 -0
- package/dist/components/layouts/reset_password/hooks/use_reset_password_form.d.ts +28 -0
- package/dist/components/layouts/reset_password/hooks/use_reset_password_form.d.ts.map +1 -0
- package/dist/components/layouts/reset_password/hooks/use_reset_password_form.js +201 -0
- package/dist/components/layouts/reset_password/index.d.ts +23 -0
- package/dist/components/layouts/reset_password/index.d.ts.map +1 -0
- package/dist/components/layouts/reset_password/index.js +53 -0
- package/dist/components/layouts/shared/components/already_logged_in_guard.d.ts +20 -0
- package/dist/components/layouts/shared/components/already_logged_in_guard.d.ts.map +1 -0
- package/dist/components/layouts/shared/components/already_logged_in_guard.js +32 -0
- package/dist/components/layouts/shared/components/auth_page_shell.d.ts +7 -0
- package/dist/components/layouts/shared/components/auth_page_shell.d.ts.map +1 -0
- package/dist/components/layouts/shared/components/auth_page_shell.js +12 -0
- package/dist/components/layouts/shared/components/field_error_message.d.ts +7 -0
- package/dist/components/layouts/shared/components/field_error_message.d.ts.map +1 -0
- package/dist/components/layouts/shared/components/field_error_message.js +6 -0
- package/dist/components/layouts/shared/components/form_action_buttons.d.ts +14 -0
- package/dist/components/layouts/shared/components/form_action_buttons.d.ts.map +1 -0
- package/dist/components/layouts/shared/components/form_action_buttons.js +15 -0
- package/dist/components/layouts/shared/components/form_field_wrapper.d.ts +11 -0
- package/dist/components/layouts/shared/components/form_field_wrapper.d.ts.map +1 -0
- package/dist/components/layouts/shared/components/form_field_wrapper.js +9 -0
- package/dist/components/layouts/shared/components/form_header.d.ts +10 -0
- package/dist/components/layouts/shared/components/form_header.d.ts.map +1 -0
- package/dist/components/layouts/shared/components/form_header.js +5 -0
- package/dist/components/layouts/shared/components/logout_button.d.ts +7 -0
- package/dist/components/layouts/shared/components/logout_button.d.ts.map +1 -0
- package/dist/components/layouts/shared/components/logout_button.js +44 -0
- package/dist/components/layouts/shared/components/password_field.d.ts +13 -0
- package/dist/components/layouts/shared/components/password_field.d.ts.map +1 -0
- package/dist/components/layouts/shared/components/password_field.js +13 -0
- package/dist/components/layouts/shared/components/profile_pic_menu.d.ts +22 -0
- package/dist/components/layouts/shared/components/profile_pic_menu.d.ts.map +1 -0
- package/dist/components/layouts/shared/components/profile_pic_menu.js +169 -0
- package/dist/components/layouts/shared/components/profile_pic_menu_wrapper.d.ts +12 -0
- package/dist/components/layouts/shared/components/profile_pic_menu_wrapper.d.ts.map +1 -0
- package/dist/components/layouts/shared/components/profile_pic_menu_wrapper.js +16 -0
- package/dist/components/layouts/shared/components/sidebar_layout_wrapper.d.ts +6 -0
- package/dist/components/layouts/shared/components/sidebar_layout_wrapper.d.ts.map +1 -0
- package/dist/components/layouts/shared/components/sidebar_layout_wrapper.js +15 -0
- package/dist/components/layouts/shared/components/standalone_layout_wrapper.d.ts +11 -0
- package/dist/components/layouts/shared/components/standalone_layout_wrapper.d.ts.map +1 -0
- package/dist/components/layouts/shared/components/standalone_layout_wrapper.js +10 -0
- package/dist/components/layouts/shared/components/two_column_auth_layout.d.ts +12 -0
- package/dist/components/layouts/shared/components/two_column_auth_layout.d.ts.map +1 -0
- package/dist/components/layouts/shared/components/two_column_auth_layout.js +8 -0
- package/dist/components/layouts/shared/components/unauthorized_guard.d.ts +14 -0
- package/dist/components/layouts/shared/components/unauthorized_guard.d.ts.map +1 -0
- package/dist/components/layouts/shared/components/unauthorized_guard.js +30 -0
- package/dist/components/layouts/shared/components/visual_panel.d.ts +9 -0
- package/dist/components/layouts/shared/components/visual_panel.d.ts.map +1 -0
- package/dist/components/layouts/shared/components/visual_panel.js +10 -0
- package/dist/components/layouts/shared/config/layout_customization.d.ts +38 -0
- package/dist/components/layouts/shared/config/layout_customization.d.ts.map +1 -0
- package/dist/components/layouts/shared/config/layout_customization.js +19 -0
- package/dist/components/layouts/shared/data/layout_data_client.d.ts +6 -0
- package/dist/components/layouts/shared/data/layout_data_client.d.ts.map +1 -0
- package/dist/components/layouts/shared/data/layout_data_client.js +9 -0
- package/dist/components/layouts/shared/hooks/use_auth_status.d.ts +20 -0
- package/dist/components/layouts/shared/hooks/use_auth_status.d.ts.map +1 -0
- package/dist/components/layouts/shared/hooks/use_auth_status.js +71 -0
- package/dist/components/layouts/shared/hooks/use_hazo_auth.d.ts +48 -0
- package/dist/components/layouts/shared/hooks/use_hazo_auth.d.ts.map +1 -0
- package/dist/components/layouts/shared/hooks/use_hazo_auth.js +90 -0
- package/dist/components/layouts/shared/index.d.ts +24 -0
- package/dist/components/layouts/shared/index.d.ts.map +1 -0
- package/dist/components/layouts/shared/index.js +27 -0
- package/dist/components/layouts/shared/utils/ip_address.d.ts +7 -0
- package/dist/components/layouts/shared/utils/ip_address.d.ts.map +1 -0
- package/dist/components/layouts/shared/utils/ip_address.js +34 -0
- package/dist/components/layouts/shared/utils/validation.d.ts +15 -0
- package/dist/components/layouts/shared/utils/validation.d.ts.map +1 -0
- package/dist/components/layouts/shared/utils/validation.js +45 -0
- package/dist/components/layouts/user_management/components/roles_matrix.d.ts +29 -0
- package/dist/components/layouts/user_management/components/roles_matrix.d.ts.map +1 -0
- package/dist/components/layouts/user_management/components/roles_matrix.js +287 -0
- package/dist/components/layouts/user_management/index.d.ts +13 -0
- package/dist/components/layouts/user_management/index.d.ts.map +1 -0
- package/dist/components/layouts/user_management/index.js +495 -0
- package/dist/components/ui/alert-dialog.d.ts +21 -0
- package/dist/components/ui/alert-dialog.d.ts.map +1 -0
- package/dist/components/ui/alert-dialog.js +62 -0
- package/dist/components/ui/avatar.d.ts +7 -0
- package/dist/components/ui/avatar.d.ts.map +1 -0
- package/dist/components/ui/avatar.js +32 -0
- package/dist/components/ui/button.d.ts +12 -0
- package/dist/components/ui/button.d.ts.map +1 -0
- package/dist/components/ui/button.js +45 -0
- package/dist/components/ui/checkbox.d.ts +5 -0
- package/dist/components/ui/checkbox.d.ts.map +1 -0
- package/dist/components/ui/checkbox.js +23 -0
- package/dist/components/ui/dialog.d.ts +20 -0
- package/dist/components/ui/dialog.d.ts.map +1 -0
- package/dist/components/ui/dialog.js +52 -0
- package/dist/components/ui/dropdown-menu.d.ts +28 -0
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/components/ui/dropdown-menu.js +72 -0
- package/dist/components/ui/hazo_ui_tooltip.d.ts +26 -0
- package/dist/components/ui/hazo_ui_tooltip.d.ts.map +1 -0
- package/dist/components/ui/hazo_ui_tooltip.js +17 -0
- package/dist/components/ui/index.d.ts +20 -0
- package/dist/components/ui/index.d.ts.map +1 -0
- package/dist/components/ui/index.js +21 -0
- package/dist/components/ui/input.d.ts +4 -0
- package/dist/components/ui/input.d.ts.map +1 -0
- package/dist/components/ui/input.js +20 -0
- package/dist/components/ui/label.d.ts +6 -0
- package/dist/components/ui/label.d.ts.map +1 -0
- package/dist/components/ui/label.js +24 -0
- package/dist/components/ui/separator.d.ts +5 -0
- package/dist/components/ui/separator.d.ts.map +1 -0
- package/dist/components/ui/separator.js +22 -0
- package/dist/components/ui/sheet.d.ts +23 -0
- package/dist/components/ui/sheet.d.ts.map +1 -0
- package/dist/components/ui/sheet.js +66 -0
- package/dist/components/ui/sidebar.d.ts +66 -0
- package/dist/components/ui/sidebar.d.ts.map +1 -0
- package/dist/components/ui/sidebar.js +267 -0
- package/dist/components/ui/skeleton.d.ts +3 -0
- package/dist/components/ui/skeleton.d.ts.map +1 -0
- package/dist/components/ui/skeleton.js +18 -0
- package/dist/components/ui/sonner.d.ts +5 -0
- package/dist/components/ui/sonner.d.ts.map +1 -0
- package/dist/components/ui/sonner.js +28 -0
- package/dist/components/ui/switch.d.ts +5 -0
- package/dist/components/ui/switch.d.ts.map +1 -0
- package/dist/components/ui/switch.js +22 -0
- package/dist/components/ui/table.d.ts +11 -0
- package/dist/components/ui/table.d.ts.map +1 -0
- package/dist/components/ui/table.js +55 -0
- package/dist/components/ui/tabs.d.ts +8 -0
- package/dist/components/ui/tabs.d.ts.map +1 -0
- package/dist/components/ui/tabs.js +33 -0
- package/dist/components/ui/tooltip.d.ts +8 -0
- package/dist/components/ui/tooltip.d.ts.map +1 -0
- package/dist/components/ui/tooltip.js +25 -0
- package/dist/components/ui/vertical-tabs.d.ts +8 -0
- package/dist/components/ui/vertical-tabs.d.ts.map +1 -0
- package/dist/components/ui/vertical-tabs.js +37 -0
- package/dist/hooks/use-mobile.d.ts +2 -0
- package/dist/hooks/use-mobile.d.ts.map +1 -0
- package/dist/hooks/use-mobile.js +15 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/lib/already_logged_in_config.server.d.ts +14 -0
- package/dist/lib/already_logged_in_config.server.d.ts.map +1 -0
- package/dist/lib/already_logged_in_config.server.js +29 -0
- package/dist/lib/app_logger.d.ts +12 -0
- package/dist/lib/app_logger.d.ts.map +1 -0
- package/dist/lib/app_logger.js +14 -0
- package/dist/lib/auth/auth_cache.d.ts +83 -0
- package/dist/lib/auth/auth_cache.d.ts.map +1 -0
- package/dist/lib/auth/auth_cache.js +158 -0
- package/dist/lib/auth/auth_rate_limiter.d.ts +39 -0
- package/dist/lib/auth/auth_rate_limiter.d.ts.map +1 -0
- package/dist/lib/auth/auth_rate_limiter.js +95 -0
- package/dist/lib/auth/auth_types.d.ts +53 -0
- package/dist/lib/auth/auth_types.d.ts.map +1 -0
- package/dist/lib/auth/auth_types.js +16 -0
- package/dist/lib/auth/auth_utils.server.d.ts +47 -0
- package/dist/lib/auth/auth_utils.server.d.ts.map +1 -0
- package/dist/lib/auth/auth_utils.server.js +150 -0
- package/dist/lib/auth/hazo_get_auth.server.d.ts +12 -0
- package/dist/lib/auth/hazo_get_auth.server.d.ts.map +1 -0
- package/dist/lib/auth/hazo_get_auth.server.js +256 -0
- package/dist/lib/auth/index.d.ts +9 -0
- package/dist/lib/auth/index.d.ts.map +1 -0
- package/dist/lib/auth/index.js +12 -0
- package/dist/lib/auth/server_auth.d.ts +26 -0
- package/dist/lib/auth/server_auth.d.ts.map +1 -0
- package/dist/lib/auth/server_auth.js +62 -0
- package/dist/lib/auth_utility_config.server.d.ts +20 -0
- package/dist/lib/auth_utility_config.server.d.ts.map +1 -0
- package/dist/lib/auth_utility_config.server.js +64 -0
- package/dist/lib/config/config_loader.server.d.ts +44 -0
- package/dist/lib/config/config_loader.server.d.ts.map +1 -0
- package/dist/lib/config/config_loader.server.js +122 -0
- package/dist/lib/email_verification_config.server.d.ts +14 -0
- package/dist/lib/email_verification_config.server.d.ts.map +1 -0
- package/dist/lib/email_verification_config.server.js +20 -0
- package/dist/lib/file_types_config.server.d.ts +11 -0
- package/dist/lib/file_types_config.server.d.ts.map +1 -0
- package/dist/lib/file_types_config.server.js +16 -0
- package/dist/lib/forgot_password_config.server.d.ts +14 -0
- package/dist/lib/forgot_password_config.server.d.ts.map +1 -0
- package/dist/lib/forgot_password_config.server.js +20 -0
- package/dist/lib/hazo_connect_instance.server.d.ts +17 -0
- package/dist/lib/hazo_connect_instance.server.d.ts.map +1 -0
- package/dist/lib/hazo_connect_instance.server.js +88 -0
- package/dist/lib/hazo_connect_setup.d.ts +2 -0
- package/dist/lib/hazo_connect_setup.d.ts.map +1 -0
- package/dist/lib/hazo_connect_setup.js +49 -0
- package/dist/lib/hazo_connect_setup.server.d.ts +20 -0
- package/dist/lib/hazo_connect_setup.server.d.ts.map +1 -0
- package/dist/lib/hazo_connect_setup.server.js +138 -0
- package/dist/lib/index.d.ts +28 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/index.js +35 -0
- package/dist/lib/login_config.server.d.ts +20 -0
- package/dist/lib/login_config.server.d.ts.map +1 -0
- package/dist/lib/login_config.server.js +37 -0
- package/dist/lib/messages_config.server.d.ts +13 -0
- package/dist/lib/messages_config.server.d.ts.map +1 -0
- package/dist/lib/messages_config.server.js +18 -0
- package/dist/lib/migrations/apply_migration.d.ts +22 -0
- package/dist/lib/migrations/apply_migration.d.ts.map +1 -0
- package/dist/lib/migrations/apply_migration.js +78 -0
- package/dist/lib/my_settings_config.server.d.ts +65 -0
- package/dist/lib/my_settings_config.server.d.ts.map +1 -0
- package/dist/lib/my_settings_config.server.js +67 -0
- package/dist/lib/password_requirements_config.server.d.ts +15 -0
- package/dist/lib/password_requirements_config.server.d.ts.map +1 -0
- package/dist/lib/password_requirements_config.server.js +26 -0
- package/dist/lib/profile_pic_menu_config.server.d.ts +26 -0
- package/dist/lib/profile_pic_menu_config.server.d.ts.map +1 -0
- package/dist/lib/profile_pic_menu_config.server.js +95 -0
- package/dist/lib/profile_picture_config.server.d.ts +16 -0
- package/dist/lib/profile_picture_config.server.d.ts.map +1 -0
- package/dist/lib/profile_picture_config.server.js +40 -0
- package/dist/lib/register_config.server.d.ts +24 -0
- package/dist/lib/register_config.server.d.ts.map +1 -0
- package/dist/lib/register_config.server.js +39 -0
- package/dist/lib/reset_password_config.server.d.ts +25 -0
- package/dist/lib/reset_password_config.server.d.ts.map +1 -0
- package/dist/lib/reset_password_config.server.js +38 -0
- package/dist/lib/services/email_service.d.ts +44 -0
- package/dist/lib/services/email_service.d.ts.map +1 -0
- package/dist/lib/services/email_service.js +480 -0
- package/dist/lib/services/email_verification_service.d.ts +35 -0
- package/dist/lib/services/email_verification_service.d.ts.map +1 -0
- package/dist/lib/services/email_verification_service.js +208 -0
- package/dist/lib/services/index.d.ts +13 -0
- package/dist/lib/services/index.d.ts.map +1 -0
- package/dist/lib/services/index.js +14 -0
- package/dist/lib/services/login_service.d.ts +20 -0
- package/dist/lib/services/login_service.d.ts.map +1 -0
- package/dist/lib/services/login_service.js +94 -0
- package/dist/lib/services/password_change_service.d.ts +19 -0
- package/dist/lib/services/password_change_service.d.ts.map +1 -0
- package/dist/lib/services/password_change_service.js +118 -0
- package/dist/lib/services/password_reset_service.d.ts +52 -0
- package/dist/lib/services/password_reset_service.d.ts.map +1 -0
- package/dist/lib/services/password_reset_service.js +318 -0
- package/dist/lib/services/profile_picture_remove_service.d.ts +15 -0
- package/dist/lib/services/profile_picture_remove_service.d.ts.map +1 -0
- package/dist/lib/services/profile_picture_remove_service.js +94 -0
- package/dist/lib/services/profile_picture_service.d.ts +45 -0
- package/dist/lib/services/profile_picture_service.d.ts.map +1 -0
- package/dist/lib/services/profile_picture_service.js +183 -0
- package/dist/lib/services/profile_picture_source_mapper.d.ts +23 -0
- package/dist/lib/services/profile_picture_source_mapper.d.ts.map +1 -0
- package/dist/lib/services/profile_picture_source_mapper.js +45 -0
- package/dist/lib/services/registration_service.d.ts +20 -0
- package/dist/lib/services/registration_service.d.ts.map +1 -0
- package/dist/lib/services/registration_service.js +147 -0
- package/dist/lib/services/token_service.d.ts +20 -0
- package/dist/lib/services/token_service.d.ts.map +1 -0
- package/dist/lib/services/token_service.js +201 -0
- package/dist/lib/services/user_profiles_service.d.ts +31 -0
- package/dist/lib/services/user_profiles_service.d.ts.map +1 -0
- package/dist/lib/services/user_profiles_service.js +99 -0
- package/dist/lib/services/user_update_service.d.ts +23 -0
- package/dist/lib/services/user_update_service.d.ts.map +1 -0
- package/dist/lib/services/user_update_service.js +103 -0
- package/dist/lib/ui_shell_config.server.d.ts +16 -0
- package/dist/lib/ui_shell_config.server.d.ts.map +1 -0
- package/dist/lib/ui_shell_config.server.js +28 -0
- package/dist/lib/ui_sizes_config.server.d.ts +17 -0
- package/dist/lib/ui_sizes_config.server.d.ts.map +1 -0
- package/dist/lib/ui_sizes_config.server.js +22 -0
- package/dist/lib/user_fields_config.server.d.ts +13 -0
- package/dist/lib/user_fields_config.server.d.ts.map +1 -0
- package/dist/lib/user_fields_config.server.js +21 -0
- package/dist/lib/user_management_config.server.d.ts +10 -0
- package/dist/lib/user_management_config.server.d.ts.map +1 -0
- package/dist/lib/user_management_config.server.js +26 -0
- package/dist/lib/utils/api_route_helpers.d.ts +13 -0
- package/dist/lib/utils/api_route_helpers.d.ts.map +1 -0
- package/dist/lib/utils/api_route_helpers.js +58 -0
- package/dist/lib/utils/error_sanitizer.d.ts +16 -0
- package/dist/lib/utils/error_sanitizer.d.ts.map +1 -0
- package/dist/lib/utils/error_sanitizer.js +39 -0
- package/dist/lib/utils.d.ts +4 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +9 -0
- package/dist/server/config/config_loader.d.ts +26 -0
- package/dist/server/config/config_loader.d.ts.map +1 -0
- package/dist/server/config/config_loader.js +329 -0
- package/dist/server/index.d.ts +2 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +32 -0
- package/dist/server/logging/logger_service.d.ts +3 -0
- package/dist/server/logging/logger_service.d.ts.map +1 -0
- package/dist/server/logging/logger_service.js +37 -0
- package/dist/server/routes/root_router.d.ts +3 -0
- package/dist/server/routes/root_router.d.ts.map +1 -0
- package/dist/server/routes/root_router.js +14 -0
- package/dist/server/server.d.ts +3 -0
- package/dist/server/server.d.ts.map +1 -0
- package/dist/server/server.js +25 -0
- package/dist/server/types/app_types.d.ts +53 -0
- package/dist/server/types/app_types.d.ts.map +1 -0
- package/dist/server/types/app_types.js +1 -0
- package/migrations/003_add_url_on_logon_to_hazo_users.sql +8 -0
- package/next.config.mjs +12 -0
- package/package.json +38 -1
- package/src/components/index.ts +7 -0
- package/src/components/layouts/email_verification/config/email_verification_field_config.ts +2 -2
- package/src/components/layouts/email_verification/hooks/use_email_verification.ts +3 -3
- package/src/components/layouts/email_verification/index.tsx +11 -11
- package/src/components/layouts/forgot_password/config/forgot_password_field_config.ts +2 -2
- package/src/components/layouts/forgot_password/hooks/use_forgot_password_form.ts +3 -3
- package/src/components/layouts/forgot_password/index.tsx +10 -10
- package/src/components/layouts/index.ts +26 -0
- package/src/components/layouts/login/config/login_field_config.ts +2 -2
- package/src/components/layouts/login/hooks/use_login_form.ts +5 -5
- package/src/components/layouts/login/index.tsx +11 -11
- package/src/components/layouts/my_settings/components/editable_field.tsx +3 -3
- package/src/components/layouts/my_settings/components/password_change_dialog.tsx +5 -5
- package/src/components/layouts/my_settings/components/profile_picture_dialog.tsx +7 -7
- package/src/components/layouts/my_settings/components/profile_picture_display.tsx +2 -2
- package/src/components/layouts/my_settings/components/profile_picture_gravatar_tab.tsx +3 -3
- package/src/components/layouts/my_settings/components/profile_picture_library_tab.tsx +5 -5
- package/src/components/layouts/my_settings/components/profile_picture_upload_tab.tsx +4 -4
- package/src/components/layouts/my_settings/config/my_settings_field_config.ts +2 -2
- package/src/components/layouts/my_settings/hooks/use_my_settings.ts +2 -2
- package/src/components/layouts/my_settings/index.tsx +10 -10
- package/src/components/layouts/register/config/register_field_config.ts +2 -2
- package/src/components/layouts/register/hooks/use_register_form.ts +4 -4
- package/src/components/layouts/register/index.tsx +11 -11
- package/src/components/layouts/reset_password/config/reset_password_field_config.ts +2 -2
- package/src/components/layouts/reset_password/hooks/use_reset_password_form.ts +4 -4
- package/src/components/layouts/reset_password/index.tsx +10 -10
- package/src/components/layouts/shared/components/already_logged_in_guard.tsx +4 -4
- package/src/components/layouts/shared/components/auth_page_shell.tsx +3 -3
- package/src/components/layouts/shared/components/form_action_buttons.tsx +2 -2
- package/src/components/layouts/shared/components/form_field_wrapper.tsx +2 -2
- package/src/components/layouts/shared/components/logout_button.tsx +2 -2
- package/src/components/layouts/shared/components/password_field.tsx +3 -3
- package/src/components/layouts/shared/components/profile_pic_menu.tsx +5 -5
- package/src/components/layouts/shared/components/profile_pic_menu_wrapper.tsx +2 -2
- package/src/components/layouts/shared/components/sidebar_layout_wrapper.tsx +3 -3
- package/src/components/layouts/shared/components/standalone_layout_wrapper.tsx +1 -1
- package/src/components/layouts/shared/components/two_column_auth_layout.tsx +1 -1
- package/src/components/layouts/shared/components/unauthorized_guard.tsx +2 -2
- package/src/components/layouts/shared/hooks/use_hazo_auth.ts +1 -1
- package/src/components/layouts/shared/index.ts +34 -0
- package/src/components/layouts/shared/utils/validation.ts +1 -1
- package/src/components/layouts/user_management/components/roles_matrix.tsx +7 -7
- package/src/components/layouts/user_management/index.tsx +11 -11
- package/src/components/ui/alert-dialog.tsx +2 -2
- package/src/components/ui/avatar.tsx +1 -1
- package/src/components/ui/button.tsx +1 -1
- package/src/components/ui/checkbox.tsx +1 -1
- package/src/components/ui/dialog.tsx +1 -1
- package/src/components/ui/dropdown-menu.tsx +1 -1
- package/src/components/ui/hazo_ui_tooltip.tsx +1 -1
- package/src/components/ui/index.ts +22 -0
- package/src/components/ui/input.tsx +1 -1
- package/src/components/ui/label.tsx +1 -1
- package/src/components/ui/separator.tsx +1 -1
- package/src/components/ui/sheet.tsx +1 -1
- package/src/components/ui/sidebar.tsx +8 -8
- package/src/components/ui/skeleton.tsx +1 -1
- package/src/components/ui/switch.tsx +1 -1
- package/src/components/ui/table.tsx +1 -1
- package/src/components/ui/tabs.tsx +1 -1
- package/src/components/ui/tooltip.tsx +1 -1
- package/src/components/ui/vertical-tabs.tsx +1 -1
- package/src/index.ts +7 -0
- package/src/lib/already_logged_in_config.server.ts +1 -1
- package/src/lib/app_logger.ts +1 -1
- package/src/lib/auth/auth_cache.ts +1 -1
- package/src/lib/auth/auth_utils.server.ts +2 -2
- package/src/lib/auth/hazo_get_auth.server.ts +8 -8
- package/src/lib/auth/index.ts +23 -0
- package/src/lib/auth/server_auth.ts +2 -2
- package/src/lib/auth_utility_config.server.ts +1 -1
- package/src/lib/config/config_loader.server.ts +1 -1
- package/src/lib/email_verification_config.server.ts +1 -1
- package/src/lib/file_types_config.server.ts +1 -1
- package/src/lib/forgot_password_config.server.ts +1 -1
- package/src/lib/hazo_connect_instance.server.ts +2 -2
- package/src/lib/hazo_connect_setup.server.ts +2 -2
- package/src/lib/index.ts +44 -0
- package/src/lib/login_config.server.ts +2 -2
- package/src/lib/messages_config.server.ts +1 -1
- package/src/lib/my_settings_config.server.ts +7 -7
- package/src/lib/password_requirements_config.server.ts +1 -1
- package/src/lib/profile_pic_menu_config.server.ts +1 -1
- package/src/lib/profile_picture_config.server.ts +2 -2
- package/src/lib/register_config.server.ts +4 -4
- package/src/lib/reset_password_config.server.ts +3 -3
- package/src/lib/services/email_service.ts +2 -2
- package/src/lib/services/email_verification_service.ts +3 -3
- package/src/lib/services/index.ts +15 -0
- package/src/lib/services/login_service.ts +3 -3
- package/src/lib/services/password_change_service.ts +3 -3
- package/src/lib/services/password_reset_service.ts +3 -3
- package/src/lib/services/profile_picture_remove_service.ts +3 -3
- package/src/lib/services/profile_picture_service.ts +5 -5
- package/src/lib/services/registration_service.ts +8 -8
- package/src/lib/services/token_service.ts +2 -2
- package/src/lib/services/user_profiles_service.ts +2 -2
- package/src/lib/services/user_update_service.ts +4 -4
- package/src/lib/ui_shell_config.server.ts +1 -1
- package/src/lib/ui_sizes_config.server.ts +1 -1
- package/src/lib/user_fields_config.server.ts +1 -1
- package/src/lib/user_management_config.server.ts +1 -2
- package/src/lib/utils/error_sanitizer.ts +1 -1
- package/src/routes/index.ts +34 -0
- package/src/server/config/config_loader.ts +2 -2
- package/src/server/index.ts +2 -2
- package/src/server/logging/logger_service.ts +1 -1
- package/src/server/server.ts +2 -2
- package/src/server/types/express.d.ts +1 -1
- package/tsconfig.build.json +39 -0
- package/tsconfig.json +5 -1
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
import * as React from "react";
|
|
15
|
+
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
|
16
|
+
import { cn } from "hazo_auth/lib/utils";
|
|
17
|
+
const Tabs = TabsPrimitive.Root;
|
|
18
|
+
const TabsList = React.forwardRef((_a, ref) => {
|
|
19
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
20
|
+
return (_jsx(TabsPrimitive.List, Object.assign({ ref: ref, className: cn("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground", className) }, props)));
|
|
21
|
+
});
|
|
22
|
+
TabsList.displayName = TabsPrimitive.List.displayName;
|
|
23
|
+
const TabsTrigger = React.forwardRef((_a, ref) => {
|
|
24
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
25
|
+
return (_jsx(TabsPrimitive.Trigger, Object.assign({ ref: ref, className: cn("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow", className) }, props)));
|
|
26
|
+
});
|
|
27
|
+
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
|
|
28
|
+
const TabsContent = React.forwardRef((_a, ref) => {
|
|
29
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
30
|
+
return (_jsx(TabsPrimitive.Content, Object.assign({ ref: ref, className: cn("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", className) }, props)));
|
|
31
|
+
});
|
|
32
|
+
TabsContent.displayName = TabsPrimitive.Content.displayName;
|
|
33
|
+
export { Tabs, TabsList, TabsTrigger, TabsContent };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
3
|
+
declare const TooltipProvider: React.FC<TooltipPrimitive.TooltipProviderProps>;
|
|
4
|
+
declare const Tooltip: React.FC<TooltipPrimitive.TooltipProps>;
|
|
5
|
+
declare const TooltipTrigger: React.ForwardRefExoticComponent<TooltipPrimitive.TooltipTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
6
|
+
declare const TooltipContent: React.ForwardRefExoticComponent<Omit<TooltipPrimitive.TooltipContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
7
|
+
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
|
|
8
|
+
//# sourceMappingURL=tooltip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../../src/components/ui/tooltip.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,gBAAgB,MAAM,yBAAyB,CAAA;AAI3D,QAAA,MAAM,eAAe,iDAA4B,CAAA;AAEjD,QAAA,MAAM,OAAO,yCAAwB,CAAA;AAErC,QAAA,MAAM,cAAc,gHAA2B,CAAA;AAE/C,QAAA,MAAM,cAAc,gKAelB,CAAA;AAGF,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
import * as React from "react";
|
|
15
|
+
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
16
|
+
import { cn } from "hazo_auth/lib/utils";
|
|
17
|
+
const TooltipProvider = TooltipPrimitive.Provider;
|
|
18
|
+
const Tooltip = TooltipPrimitive.Root;
|
|
19
|
+
const TooltipTrigger = TooltipPrimitive.Trigger;
|
|
20
|
+
const TooltipContent = React.forwardRef((_a, ref) => {
|
|
21
|
+
var { className, sideOffset = 4 } = _a, props = __rest(_a, ["className", "sideOffset"]);
|
|
22
|
+
return (_jsx(TooltipPrimitive.Portal, { children: _jsx(TooltipPrimitive.Content, Object.assign({ ref: ref, sideOffset: sideOffset, className: cn("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]", className) }, props)) }));
|
|
23
|
+
});
|
|
24
|
+
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
25
|
+
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
|
3
|
+
declare const VerticalTabs: React.ForwardRefExoticComponent<TabsPrimitive.TabsProps & React.RefAttributes<HTMLDivElement>>;
|
|
4
|
+
declare const VerticalTabsList: React.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsListProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
5
|
+
declare const VerticalTabsTrigger: React.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
6
|
+
declare const VerticalTabsContent: React.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
7
|
+
export { VerticalTabs, VerticalTabsList, VerticalTabsTrigger, VerticalTabsContent };
|
|
8
|
+
//# sourceMappingURL=vertical-tabs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vertical-tabs.d.ts","sourceRoot":"","sources":["../../../src/components/ui/vertical-tabs.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,aAAa,MAAM,sBAAsB,CAAC;AAItD,QAAA,MAAM,YAAY,gGAAqB,CAAC;AAExC,QAAA,MAAM,gBAAgB,uJAYpB,CAAC;AAGH,QAAA,MAAM,mBAAmB,gKAYvB,CAAC;AAGH,QAAA,MAAM,mBAAmB,0JAYvB,CAAC;AAGH,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// file_description: vertical tabs component for sidebar-style navigation
|
|
2
|
+
// section: client_directive
|
|
3
|
+
"use client";
|
|
4
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
5
|
+
var t = {};
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
9
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
10
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
11
|
+
t[p[i]] = s[p[i]];
|
|
12
|
+
}
|
|
13
|
+
return t;
|
|
14
|
+
};
|
|
15
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
|
+
// section: imports
|
|
17
|
+
import * as React from "react";
|
|
18
|
+
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
|
19
|
+
import { cn } from "hazo_auth/lib/utils";
|
|
20
|
+
// section: components
|
|
21
|
+
const VerticalTabs = TabsPrimitive.Root;
|
|
22
|
+
const VerticalTabsList = React.forwardRef((_a, ref) => {
|
|
23
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
24
|
+
return (_jsx(TabsPrimitive.List, Object.assign({ ref: ref, className: cn("inline-flex flex-col items-start justify-start rounded-md bg-muted p-1 text-muted-foreground", className) }, props)));
|
|
25
|
+
});
|
|
26
|
+
VerticalTabsList.displayName = "VerticalTabsList";
|
|
27
|
+
const VerticalTabsTrigger = React.forwardRef((_a, ref) => {
|
|
28
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
29
|
+
return (_jsx(TabsPrimitive.Trigger, Object.assign({ ref: ref, className: cn("inline-flex items-center justify-start whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow", className) }, props)));
|
|
30
|
+
});
|
|
31
|
+
VerticalTabsTrigger.displayName = "VerticalTabsTrigger";
|
|
32
|
+
const VerticalTabsContent = React.forwardRef((_a, ref) => {
|
|
33
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
34
|
+
return (_jsx(TabsPrimitive.Content, Object.assign({ ref: ref, className: cn("mt-0 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", className) }, props)));
|
|
35
|
+
});
|
|
36
|
+
VerticalTabsContent.displayName = "VerticalTabsContent";
|
|
37
|
+
export { VerticalTabs, VerticalTabsList, VerticalTabsTrigger, VerticalTabsContent };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-mobile.d.ts","sourceRoot":"","sources":["../../src/hooks/use-mobile.tsx"],"names":[],"mappings":"AAIA,wBAAgB,WAAW,YAc1B"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
const MOBILE_BREAKPOINT = 768;
|
|
3
|
+
export function useIsMobile() {
|
|
4
|
+
const [isMobile, setIsMobile] = React.useState(undefined);
|
|
5
|
+
React.useEffect(() => {
|
|
6
|
+
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
|
|
7
|
+
const onChange = () => {
|
|
8
|
+
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
9
|
+
};
|
|
10
|
+
mql.addEventListener("change", onChange);
|
|
11
|
+
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
12
|
+
return () => mql.removeEventListener("change", onChange);
|
|
13
|
+
}, []);
|
|
14
|
+
return !!isMobile;
|
|
15
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,oBAAoB,CAAC;AAGnC,cAAc,aAAa,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type AlreadyLoggedInConfig = {
|
|
2
|
+
message: string;
|
|
3
|
+
showLogoutButton: boolean;
|
|
4
|
+
showReturnHomeButton: boolean;
|
|
5
|
+
returnHomeButtonLabel: string;
|
|
6
|
+
returnHomePath: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Reads already logged in configuration from hazo_auth_config.ini file
|
|
10
|
+
* Falls back to defaults if hazo_auth_config.ini is not found or section is missing
|
|
11
|
+
* @returns Already logged in configuration options
|
|
12
|
+
*/
|
|
13
|
+
export declare function get_already_logged_in_config(): AlreadyLoggedInConfig;
|
|
14
|
+
//# sourceMappingURL=already_logged_in_config.server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"already_logged_in_config.server.d.ts","sourceRoot":"","sources":["../../src/lib/already_logged_in_config.server.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,oBAAoB,EAAE,OAAO,CAAC;IAC9B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAGF;;;;GAIG;AACH,wBAAgB,4BAA4B,IAAI,qBAAqB,CAyBpE"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// file_description: server-only helper to read already logged in configuration from hazo_auth_config.ini
|
|
2
|
+
// section: imports
|
|
3
|
+
import { get_config_value, get_config_boolean } from "hazo_auth/lib/config/config_loader.server";
|
|
4
|
+
// section: helpers
|
|
5
|
+
/**
|
|
6
|
+
* Reads already logged in configuration from hazo_auth_config.ini file
|
|
7
|
+
* Falls back to defaults if hazo_auth_config.ini is not found or section is missing
|
|
8
|
+
* @returns Already logged in configuration options
|
|
9
|
+
*/
|
|
10
|
+
export function get_already_logged_in_config() {
|
|
11
|
+
const section = "hazo_auth__already_logged_in";
|
|
12
|
+
// Read message (defaults to "You're already logged in.")
|
|
13
|
+
const message = get_config_value(section, "message", "You're already logged in.");
|
|
14
|
+
// Read show logout button (defaults to true)
|
|
15
|
+
const showLogoutButton = get_config_boolean(section, "show_logout_button", true);
|
|
16
|
+
// Read show return home button (defaults to false)
|
|
17
|
+
const showReturnHomeButton = get_config_boolean(section, "show_return_home_button", false);
|
|
18
|
+
// Read return home button label (defaults to "Return home")
|
|
19
|
+
const returnHomeButtonLabel = get_config_value(section, "return_home_button_label", "Return home");
|
|
20
|
+
// Read return home path (defaults to "/")
|
|
21
|
+
const returnHomePath = get_config_value(section, "return_home_path", "/");
|
|
22
|
+
return {
|
|
23
|
+
message,
|
|
24
|
+
showLogoutButton,
|
|
25
|
+
showReturnHomeButton,
|
|
26
|
+
returnHomeButtonLabel,
|
|
27
|
+
returnHomePath,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a logger service instance for use in UI components
|
|
3
|
+
* This uses the main app logging service and can be extended with an external logger
|
|
4
|
+
* when provided as part of component setup
|
|
5
|
+
*/
|
|
6
|
+
export declare const create_app_logger: (external_logger?: {
|
|
7
|
+
info?: (message: string, data?: Record<string, unknown>) => void;
|
|
8
|
+
error?: (message: string, data?: Record<string, unknown>) => void;
|
|
9
|
+
warn?: (message: string, data?: Record<string, unknown>) => void;
|
|
10
|
+
debug?: (message: string, data?: Record<string, unknown>) => void;
|
|
11
|
+
}) => import("../server/types/app_types").logger_service;
|
|
12
|
+
//# sourceMappingURL=app_logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app_logger.d.ts","sourceRoot":"","sources":["../../src/lib/app_logger.ts"],"names":[],"mappings":"AAQA;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAC5B,kBAAkB;IAChB,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IACjE,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IAClE,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IACjE,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;CACnE,uDAGF,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// file_description: client-accessible wrapper for the main app logging service
|
|
2
|
+
// section: imports
|
|
3
|
+
import { create_logger_service } from "hazo_auth/server/logging/logger_service";
|
|
4
|
+
// section: constants
|
|
5
|
+
const APP_NAMESPACE = "hazo_auth_ui";
|
|
6
|
+
// section: logger_instance
|
|
7
|
+
/**
|
|
8
|
+
* Creates a logger service instance for use in UI components
|
|
9
|
+
* This uses the main app logging service and can be extended with an external logger
|
|
10
|
+
* when provided as part of component setup
|
|
11
|
+
*/
|
|
12
|
+
export const create_app_logger = (external_logger) => {
|
|
13
|
+
return create_logger_service(APP_NAMESPACE, external_logger);
|
|
14
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { HazoAuthUser } from "hazo_auth/lib/auth/auth_types";
|
|
2
|
+
/**
|
|
3
|
+
* Cache entry structure
|
|
4
|
+
*/
|
|
5
|
+
type CacheEntry = {
|
|
6
|
+
user: HazoAuthUser;
|
|
7
|
+
permissions: string[];
|
|
8
|
+
role_ids: number[];
|
|
9
|
+
timestamp: number;
|
|
10
|
+
cache_version: number;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* LRU cache implementation with TTL and size limits
|
|
14
|
+
* Uses Map to maintain insertion order for LRU eviction
|
|
15
|
+
*/
|
|
16
|
+
declare class AuthCache {
|
|
17
|
+
private cache;
|
|
18
|
+
private max_size;
|
|
19
|
+
private ttl_ms;
|
|
20
|
+
private max_age_ms;
|
|
21
|
+
private role_version_map;
|
|
22
|
+
constructor(max_size: number, ttl_minutes: number, max_age_minutes: number);
|
|
23
|
+
/**
|
|
24
|
+
* Gets a cache entry for a user
|
|
25
|
+
* Returns undefined if not found, expired, or too old
|
|
26
|
+
* @param user_id - User ID to look up
|
|
27
|
+
* @returns Cache entry or undefined
|
|
28
|
+
*/
|
|
29
|
+
get(user_id: string): CacheEntry | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Sets a cache entry for a user
|
|
32
|
+
* Evicts least recently used entries if cache is full
|
|
33
|
+
* @param user_id - User ID
|
|
34
|
+
* @param user - User data
|
|
35
|
+
* @param permissions - User permissions
|
|
36
|
+
* @param role_ids - User role IDs
|
|
37
|
+
*/
|
|
38
|
+
set(user_id: string, user: HazoAuthUser, permissions: string[], role_ids: number[]): void;
|
|
39
|
+
/**
|
|
40
|
+
* Invalidates cache for a specific user
|
|
41
|
+
* @param user_id - User ID to invalidate
|
|
42
|
+
*/
|
|
43
|
+
invalidate_user(user_id: string): void;
|
|
44
|
+
/**
|
|
45
|
+
* Invalidates cache for all users with specific roles
|
|
46
|
+
* Uses cache version to determine if invalidation is needed
|
|
47
|
+
* @param role_ids - Array of role IDs to invalidate
|
|
48
|
+
*/
|
|
49
|
+
invalidate_by_roles(role_ids: number[]): void;
|
|
50
|
+
/**
|
|
51
|
+
* Invalidates all cache entries
|
|
52
|
+
*/
|
|
53
|
+
invalidate_all(): void;
|
|
54
|
+
/**
|
|
55
|
+
* Gets the maximum cache version for a set of roles
|
|
56
|
+
* Used to determine if cache entry is stale
|
|
57
|
+
* @param role_ids - Array of role IDs
|
|
58
|
+
* @returns Maximum version number
|
|
59
|
+
*/
|
|
60
|
+
private get_max_role_version;
|
|
61
|
+
/**
|
|
62
|
+
* Gets cache statistics
|
|
63
|
+
* @returns Object with cache size, max size, and hit rate estimate
|
|
64
|
+
*/
|
|
65
|
+
get_stats(): {
|
|
66
|
+
size: number;
|
|
67
|
+
max_size: number;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Gets or creates the global auth cache instance
|
|
72
|
+
* @param max_size - Maximum cache size (default: 10000)
|
|
73
|
+
* @param ttl_minutes - TTL in minutes (default: 15)
|
|
74
|
+
* @param max_age_minutes - Max age in minutes (default: 30)
|
|
75
|
+
* @returns Auth cache instance
|
|
76
|
+
*/
|
|
77
|
+
export declare function get_auth_cache(max_size?: number, ttl_minutes?: number, max_age_minutes?: number): AuthCache;
|
|
78
|
+
/**
|
|
79
|
+
* Resets the global cache instance (useful for testing)
|
|
80
|
+
*/
|
|
81
|
+
export declare function reset_auth_cache(): void;
|
|
82
|
+
export {};
|
|
83
|
+
//# sourceMappingURL=auth_cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth_cache.d.ts","sourceRoot":"","sources":["../../../src/lib/auth/auth_cache.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAIlE;;GAEG;AACH,KAAK,UAAU,GAAG;IAChB,IAAI,EAAE,YAAY,CAAC;IACnB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF;;;GAGG;AACH,cAAM,SAAS;IACb,OAAO,CAAC,KAAK,CAA0B;IACvC,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,gBAAgB,CAAsB;gBAG5C,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,EACnB,eAAe,EAAE,MAAM;IASzB;;;;;OAKG;IACH,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS;IA+B5C;;;;;;;OAOG;IACH,GAAG,CACD,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,YAAY,EAClB,WAAW,EAAE,MAAM,EAAE,EACrB,QAAQ,EAAE,MAAM,EAAE,GACjB,IAAI;IAyBP;;;OAGG;IACH,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAItC;;;;OAIG;IACH,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI;IAqB7C;;OAEG;IACH,cAAc,IAAI,IAAI;IAItB;;;;;OAKG;IACH,OAAO,CAAC,oBAAoB;IAc5B;;;OAGG;IACH,SAAS,IAAI;QACX,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;KAClB;CAMF;AAMD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,GAAE,MAAc,EACxB,WAAW,GAAE,MAAW,EACxB,eAAe,GAAE,MAAW,GAC3B,SAAS,CAKX;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAEvC"}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LRU cache implementation with TTL and size limits
|
|
3
|
+
* Uses Map to maintain insertion order for LRU eviction
|
|
4
|
+
*/
|
|
5
|
+
class AuthCache {
|
|
6
|
+
constructor(max_size, ttl_minutes, max_age_minutes) {
|
|
7
|
+
this.cache = new Map();
|
|
8
|
+
this.max_size = max_size;
|
|
9
|
+
this.ttl_ms = ttl_minutes * 60 * 1000;
|
|
10
|
+
this.max_age_ms = max_age_minutes * 60 * 1000;
|
|
11
|
+
this.role_version_map = new Map();
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Gets a cache entry for a user
|
|
15
|
+
* Returns undefined if not found, expired, or too old
|
|
16
|
+
* @param user_id - User ID to look up
|
|
17
|
+
* @returns Cache entry or undefined
|
|
18
|
+
*/
|
|
19
|
+
get(user_id) {
|
|
20
|
+
const entry = this.cache.get(user_id);
|
|
21
|
+
if (!entry) {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
const now = Date.now();
|
|
25
|
+
const age = now - entry.timestamp;
|
|
26
|
+
// Check if entry is expired (TTL)
|
|
27
|
+
if (age > this.ttl_ms) {
|
|
28
|
+
this.cache.delete(user_id);
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
// Check if entry is too old (force refresh threshold)
|
|
32
|
+
if (age > this.max_age_ms) {
|
|
33
|
+
// Don't delete, but mark as stale so caller can refresh
|
|
34
|
+
// Return undefined to force refresh
|
|
35
|
+
this.cache.delete(user_id);
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
// Move to end (most recently used)
|
|
39
|
+
this.cache.delete(user_id);
|
|
40
|
+
this.cache.set(user_id, entry);
|
|
41
|
+
return entry;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Sets a cache entry for a user
|
|
45
|
+
* Evicts least recently used entries if cache is full
|
|
46
|
+
* @param user_id - User ID
|
|
47
|
+
* @param user - User data
|
|
48
|
+
* @param permissions - User permissions
|
|
49
|
+
* @param role_ids - User role IDs
|
|
50
|
+
*/
|
|
51
|
+
set(user_id, user, permissions, role_ids) {
|
|
52
|
+
// Evict LRU entries if cache is full
|
|
53
|
+
while (this.cache.size >= this.max_size) {
|
|
54
|
+
const first_key = this.cache.keys().next().value;
|
|
55
|
+
if (first_key) {
|
|
56
|
+
this.cache.delete(first_key);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
// Get current cache version for user's roles
|
|
63
|
+
const cache_version = this.get_max_role_version(role_ids);
|
|
64
|
+
const entry = {
|
|
65
|
+
user,
|
|
66
|
+
permissions,
|
|
67
|
+
role_ids,
|
|
68
|
+
timestamp: Date.now(),
|
|
69
|
+
cache_version,
|
|
70
|
+
};
|
|
71
|
+
this.cache.set(user_id, entry);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Invalidates cache for a specific user
|
|
75
|
+
* @param user_id - User ID to invalidate
|
|
76
|
+
*/
|
|
77
|
+
invalidate_user(user_id) {
|
|
78
|
+
this.cache.delete(user_id);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Invalidates cache for all users with specific roles
|
|
82
|
+
* Uses cache version to determine if invalidation is needed
|
|
83
|
+
* @param role_ids - Array of role IDs to invalidate
|
|
84
|
+
*/
|
|
85
|
+
invalidate_by_roles(role_ids) {
|
|
86
|
+
// Increment version for affected roles
|
|
87
|
+
for (const role_id of role_ids) {
|
|
88
|
+
const current_version = this.role_version_map.get(role_id) || 0;
|
|
89
|
+
this.role_version_map.set(role_id, current_version + 1);
|
|
90
|
+
}
|
|
91
|
+
// Remove entries where cache version is older than role version
|
|
92
|
+
const entries_to_remove = [];
|
|
93
|
+
for (const [user_id, entry] of this.cache.entries()) {
|
|
94
|
+
const max_role_version = this.get_max_role_version(entry.role_ids);
|
|
95
|
+
if (max_role_version > entry.cache_version) {
|
|
96
|
+
entries_to_remove.push(user_id);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
for (const user_id of entries_to_remove) {
|
|
100
|
+
this.cache.delete(user_id);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Invalidates all cache entries
|
|
105
|
+
*/
|
|
106
|
+
invalidate_all() {
|
|
107
|
+
this.cache.clear();
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Gets the maximum cache version for a set of roles
|
|
111
|
+
* Used to determine if cache entry is stale
|
|
112
|
+
* @param role_ids - Array of role IDs
|
|
113
|
+
* @returns Maximum version number
|
|
114
|
+
*/
|
|
115
|
+
get_max_role_version(role_ids) {
|
|
116
|
+
if (role_ids.length === 0) {
|
|
117
|
+
return 0;
|
|
118
|
+
}
|
|
119
|
+
let max_version = 0;
|
|
120
|
+
for (const role_id of role_ids) {
|
|
121
|
+
const version = this.role_version_map.get(role_id) || 0;
|
|
122
|
+
max_version = Math.max(max_version, version);
|
|
123
|
+
}
|
|
124
|
+
return max_version;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Gets cache statistics
|
|
128
|
+
* @returns Object with cache size, max size, and hit rate estimate
|
|
129
|
+
*/
|
|
130
|
+
get_stats() {
|
|
131
|
+
return {
|
|
132
|
+
size: this.cache.size,
|
|
133
|
+
max_size: this.max_size,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
// section: singleton
|
|
138
|
+
// Global cache instance (initialized with defaults, will be configured on first use)
|
|
139
|
+
let auth_cache_instance = null;
|
|
140
|
+
/**
|
|
141
|
+
* Gets or creates the global auth cache instance
|
|
142
|
+
* @param max_size - Maximum cache size (default: 10000)
|
|
143
|
+
* @param ttl_minutes - TTL in minutes (default: 15)
|
|
144
|
+
* @param max_age_minutes - Max age in minutes (default: 30)
|
|
145
|
+
* @returns Auth cache instance
|
|
146
|
+
*/
|
|
147
|
+
export function get_auth_cache(max_size = 10000, ttl_minutes = 15, max_age_minutes = 30) {
|
|
148
|
+
if (!auth_cache_instance) {
|
|
149
|
+
auth_cache_instance = new AuthCache(max_size, ttl_minutes, max_age_minutes);
|
|
150
|
+
}
|
|
151
|
+
return auth_cache_instance;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Resets the global cache instance (useful for testing)
|
|
155
|
+
*/
|
|
156
|
+
export function reset_auth_cache() {
|
|
157
|
+
auth_cache_instance = null;
|
|
158
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simple in-memory rate limiter
|
|
3
|
+
* Tracks request counts per key within a time window
|
|
4
|
+
*/
|
|
5
|
+
declare class RateLimiter {
|
|
6
|
+
private limits;
|
|
7
|
+
private window_ms;
|
|
8
|
+
constructor();
|
|
9
|
+
/**
|
|
10
|
+
* Checks if a request should be allowed
|
|
11
|
+
* @param key - Rate limit key (e.g., "user:123" or "ip:192.168.1.1")
|
|
12
|
+
* @param max_requests - Maximum requests allowed per window
|
|
13
|
+
* @returns true if allowed, false if rate limited
|
|
14
|
+
*/
|
|
15
|
+
check(key: string, max_requests: number): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Cleans up old entries (call periodically to prevent memory leak)
|
|
18
|
+
* Removes entries older than 2 windows
|
|
19
|
+
*/
|
|
20
|
+
cleanup(): void;
|
|
21
|
+
/**
|
|
22
|
+
* Gets rate limit statistics
|
|
23
|
+
* @returns Object with current limit entries count
|
|
24
|
+
*/
|
|
25
|
+
get_stats(): {
|
|
26
|
+
active_limits: number;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Gets or creates the global rate limiter instance
|
|
31
|
+
* @returns Rate limiter instance
|
|
32
|
+
*/
|
|
33
|
+
export declare function get_rate_limiter(): RateLimiter;
|
|
34
|
+
/**
|
|
35
|
+
* Resets the global rate limiter instance (useful for testing)
|
|
36
|
+
*/
|
|
37
|
+
export declare function reset_rate_limiter(): void;
|
|
38
|
+
export {};
|
|
39
|
+
//# sourceMappingURL=auth_rate_limiter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth_rate_limiter.d.ts","sourceRoot":"","sources":["../../../src/lib/auth/auth_rate_limiter.ts"],"names":[],"mappings":"AAWA;;;GAGG;AACH,cAAM,WAAW;IACf,OAAO,CAAC,MAAM,CAA8B;IAC5C,OAAO,CAAC,SAAS,CAAS;;IAO1B;;;;;OAKG;IACH,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO;IAiCjD;;;OAGG;IACH,OAAO,IAAI,IAAI;IAgBf;;;OAGG;IACH,SAAS,IAAI;QAAE,aAAa,EAAE,MAAM,CAAA;KAAE;CAKvC;AAMD;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,WAAW,CAU9C;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CAEzC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
// file_description: Simple in-memory rate limiter for hazo_get_auth API endpoint
|
|
2
|
+
// section: types
|
|
3
|
+
/**
|
|
4
|
+
* Simple in-memory rate limiter
|
|
5
|
+
* Tracks request counts per key within a time window
|
|
6
|
+
*/
|
|
7
|
+
class RateLimiter {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.limits = new Map();
|
|
10
|
+
this.window_ms = 60 * 1000; // 1 minute window
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Checks if a request should be allowed
|
|
14
|
+
* @param key - Rate limit key (e.g., "user:123" or "ip:192.168.1.1")
|
|
15
|
+
* @param max_requests - Maximum requests allowed per window
|
|
16
|
+
* @returns true if allowed, false if rate limited
|
|
17
|
+
*/
|
|
18
|
+
check(key, max_requests) {
|
|
19
|
+
const now = Date.now();
|
|
20
|
+
const entry = this.limits.get(key);
|
|
21
|
+
if (!entry) {
|
|
22
|
+
// First request for this key
|
|
23
|
+
this.limits.set(key, {
|
|
24
|
+
count: 1,
|
|
25
|
+
window_start: now,
|
|
26
|
+
});
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
// Check if window has expired
|
|
30
|
+
if (now - entry.window_start >= this.window_ms) {
|
|
31
|
+
// Reset window
|
|
32
|
+
this.limits.set(key, {
|
|
33
|
+
count: 1,
|
|
34
|
+
window_start: now,
|
|
35
|
+
});
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
// Check if limit exceeded
|
|
39
|
+
if (entry.count >= max_requests) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
// Increment count
|
|
43
|
+
entry.count++;
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Cleans up old entries (call periodically to prevent memory leak)
|
|
48
|
+
* Removes entries older than 2 windows
|
|
49
|
+
*/
|
|
50
|
+
cleanup() {
|
|
51
|
+
const now = Date.now();
|
|
52
|
+
const cutoff = now - 2 * this.window_ms;
|
|
53
|
+
const keys_to_delete = [];
|
|
54
|
+
for (const [key, entry] of this.limits.entries()) {
|
|
55
|
+
if (entry.window_start < cutoff) {
|
|
56
|
+
keys_to_delete.push(key);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
for (const key of keys_to_delete) {
|
|
60
|
+
this.limits.delete(key);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Gets rate limit statistics
|
|
65
|
+
* @returns Object with current limit entries count
|
|
66
|
+
*/
|
|
67
|
+
get_stats() {
|
|
68
|
+
return {
|
|
69
|
+
active_limits: this.limits.size,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
// section: singleton
|
|
74
|
+
// Global rate limiter instance
|
|
75
|
+
let rate_limiter_instance = null;
|
|
76
|
+
/**
|
|
77
|
+
* Gets or creates the global rate limiter instance
|
|
78
|
+
* @returns Rate limiter instance
|
|
79
|
+
*/
|
|
80
|
+
export function get_rate_limiter() {
|
|
81
|
+
if (!rate_limiter_instance) {
|
|
82
|
+
rate_limiter_instance = new RateLimiter();
|
|
83
|
+
// Cleanup old entries every 5 minutes
|
|
84
|
+
setInterval(() => {
|
|
85
|
+
rate_limiter_instance === null || rate_limiter_instance === void 0 ? void 0 : rate_limiter_instance.cleanup();
|
|
86
|
+
}, 5 * 60 * 1000);
|
|
87
|
+
}
|
|
88
|
+
return rate_limiter_instance;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Resets the global rate limiter instance (useful for testing)
|
|
92
|
+
*/
|
|
93
|
+
export function reset_rate_limiter() {
|
|
94
|
+
rate_limiter_instance = null;
|
|
95
|
+
}
|