From 681c6a95477c27549de73c29133d01029c7d2b51 Mon Sep 17 00:00:00 2001 From: Joe Portner <5295965+jportner@users.noreply.github.com> Date: Tue, 2 Mar 2021 11:18:00 -0500 Subject: [PATCH] Cleanup Security plugin imports (#93056) (#93214) # Conflicts: # .github/CODEOWNERS --- src/plugins/security_oss/.eslintrc.json | 5 ++ .../app_state/app_state_service.test.ts | 3 +- .../public/app_state/app_state_service.ts | 5 +- src/plugins/security_oss/public/index.ts | 3 +- .../components/default_alert.tsx | 7 ++- .../insecure_cluster_service.mock.tsx | 2 +- .../insecure_cluster_service.test.tsx | 4 +- .../insecure_cluster_service.tsx | 5 +- .../security_oss/public/plugin.mock.ts | 5 +- src/plugins/security_oss/public/plugin.ts | 7 ++- .../server/check_cluster_data.test.ts | 3 +- .../security_oss/server/check_cluster_data.ts | 2 +- src/plugins/security_oss/server/config.ts | 3 +- src/plugins/security_oss/server/index.ts | 4 +- .../security_oss/server/plugin.test.ts | 3 +- src/plugins/security_oss/server/plugin.ts | 11 ++-- .../routes/anonymous_access_capabilities.ts | 3 +- .../security_oss/server/routes/app_state.ts | 9 ++- .../anonymous_access_capabilities.test.ts | 8 ++- .../integration_tests/app_state.test.ts | 16 ++--- src/plugins/spaces_oss/.eslintrc.json | 5 ++ src/plugins/spaces_oss/public/api.mock.ts | 3 +- src/plugins/spaces_oss/public/api.ts | 5 +- src/plugins/spaces_oss/public/mocks/index.ts | 3 +- src/plugins/spaces_oss/public/plugin.ts | 7 ++- src/plugins/spaces_oss/public/types.ts | 2 +- .../encrypted_saved_objects/.eslintrc.json | 5 ++ .../server/audit/audit_logger.test.ts | 2 +- .../server/audit/audit_logger.ts | 5 +- .../server/audit/index.mock.ts | 2 +- .../encrypted_saved_objects/server/config.ts | 3 +- .../server/create_migration.test.ts | 5 +- .../server/create_migration.ts | 9 +-- ...ypted_saved_object_type_definition.test.ts | 2 +- .../encrypted_saved_object_type_definition.ts | 2 +- .../encrypted_saved_objects_service.mocks.ts | 2 +- .../encrypted_saved_objects_service.test.ts | 11 ++-- .../crypto/encrypted_saved_objects_service.ts | 14 +++-- .../encryption_key_rotation_service.mocks.ts | 2 +- .../encryption_key_rotation_service.test.ts | 14 ++--- .../crypto/encryption_key_rotation_service.ts | 7 ++- .../encrypted_saved_objects/server/index.ts | 3 +- .../encrypted_saved_objects/server/mocks.ts | 7 ++- .../server/plugin.test.ts | 6 +- .../encrypted_saved_objects/server/plugin.ts | 14 +++-- .../server/routes/index.mock.ts | 5 +- .../server/routes/index.ts | 6 +- .../server/routes/key_rotation.test.ts | 15 ++--- .../server/routes/key_rotation.ts | 3 +- ...ypted_saved_objects_client_wrapper.test.ts | 15 ++--- .../encrypted_saved_objects_client_wrapper.ts | 23 +++---- .../get_descriptor_namespace.test.ts | 1 + .../saved_objects/get_descriptor_namespace.ts | 4 +- .../server/saved_objects/index.test.ts | 19 +++--- .../server/saved_objects/index.ts | 13 ++-- x-pack/plugins/security/.eslintrc.json | 5 ++ .../security/common/licensing/index.mock.ts | 4 +- .../common/licensing/license_service.test.ts | 3 +- .../common/licensing/license_service.ts | 7 ++- x-pack/plugins/security/common/login_state.ts | 2 +- .../common/model/authenticated_user.mock.ts | 2 +- .../common/model/authenticated_user.test.ts | 3 +- .../common/model/authenticated_user.ts | 3 +- .../security/common/model/role.test.ts | 10 +-- x-pack/plugins/security/common/model/role.ts | 4 +- .../security/common/model/user.test.ts | 3 +- x-pack/plugins/security/common/parse_next.ts | 1 + .../account_management_app.test.ts | 9 +-- .../account_management_app.ts | 11 ++-- .../account_management_page.test.tsx | 10 +-- .../account_management_page.tsx | 13 ++-- .../change_password/change_password.tsx | 11 ++-- .../personal_info/personal_info.tsx | 6 +- .../access_agreement_app.test.ts | 6 +- .../access_agreement/access_agreement_app.ts | 2 +- .../access_agreement_page.test.tsx | 11 ++-- .../access_agreement_page.tsx | 12 ++-- .../authentication/authentication_service.ts | 17 ++--- .../capture_url/capture_url_app.test.ts | 6 +- .../capture_url/capture_url_app.ts | 3 +- .../authentication_state_page.test.tsx | 4 +- .../public/authentication/index.mock.ts | 2 +- .../logged_out/logged_out_app.test.ts | 6 +- .../logged_out/logged_out_app.ts | 4 +- .../logged_out/logged_out_page.test.tsx | 7 ++- .../logged_out/logged_out_page.tsx | 6 +- .../disabled_login_form.test.tsx | 1 + .../disabled_login_form.tsx | 3 +- .../components/login_form/login_form.test.tsx | 14 ++--- .../components/login_form/login_form.tsx | 23 ++++--- .../login_form/validate_login.test.ts | 3 +- .../authentication/login/login_app.test.ts | 6 +- .../public/authentication/login/login_app.ts | 9 +-- .../authentication/login/login_page.test.tsx | 12 ++-- .../authentication/login/login_page.tsx | 12 ++-- .../authentication/logout/logout_app.test.ts | 6 +- .../authentication/logout/logout_app.ts | 2 +- .../overwritten_session_app.test.ts | 6 +- .../overwritten_session_app.ts | 5 +- .../overwritten_session_page.test.tsx | 9 +-- .../overwritten_session_page.tsx | 8 ++- .../security/public/components/breadcrumb.tsx | 6 +- .../public/components/confirm_modal.tsx | 7 ++- .../security/public/components/doc_link.tsx | 7 ++- .../public/components/form_flyout.tsx | 22 ++++--- .../public/components/use_current_user.ts | 5 +- .../security/public/components/use_form.ts | 5 +- .../security/public/components/use_html_id.ts | 2 +- x-pack/plugins/security/public/index.ts | 12 ++-- .../api_keys/api_keys_api_client.test.ts | 4 +- .../api_keys/api_keys_api_client.ts | 5 +- .../api_keys_grid/api_keys_grid_page.test.tsx | 18 +++--- .../api_keys_grid/api_keys_grid_page.tsx | 17 ++--- .../empty_prompt/empty_prompt.tsx | 3 +- .../invalidate_provider.tsx | 12 ++-- .../api_keys_grid/not_enabled/not_enabled.tsx | 4 +- .../permission_denied/permission_denied.tsx | 3 +- .../api_keys/api_keys_management_app.test.tsx | 3 +- .../api_keys/api_keys_management_app.tsx | 8 ++- .../management/badges/deprecated_badge.tsx | 5 +- .../management/badges/disabled_badge.tsx | 5 +- .../management/badges/enabled_badge.tsx | 5 +- .../management/badges/optional_tooltip.tsx | 6 +- .../management/badges/reserved_badge.tsx | 5 +- .../management/management_service.test.ts | 19 +++--- .../public/management/management_service.ts | 18 +++--- .../role_combo_box/role_combo_box.test.tsx | 4 +- .../role_combo_box/role_combo_box.tsx | 21 ++----- .../delete_provider/delete_provider.test.tsx | 12 ++-- .../delete_provider/delete_provider.tsx | 11 ++-- .../no_compatible_realms.tsx | 4 +- .../permission_denied/permission_denied.tsx | 3 +- .../section_loading/section_loading.test.tsx | 4 +- .../section_loading/section_loading.tsx | 3 +- .../edit_role_mapping_page.test.tsx | 29 +++++---- .../edit_role_mapping_page.tsx | 28 +++++---- .../mapping_info_panel.test.tsx | 16 ++--- .../mapping_info_panel/mapping_info_panel.tsx | 23 ++++--- .../add_role_template_button.test.tsx | 4 +- .../add_role_template_button.tsx | 3 +- .../role_selector/role_selector.test.tsx | 15 ++--- .../role_selector/role_selector.tsx | 11 ++-- .../role_template_editor.test.tsx | 5 +- .../role_selector/role_template_editor.tsx | 18 +++--- .../role_template_type_select.tsx | 6 +- .../add_rule_button.test.tsx | 7 ++- .../rule_editor_panel/add_rule_button.tsx | 7 ++- .../field_rule_editor.test.tsx | 9 +-- .../rule_editor_panel/field_rule_editor.tsx | 16 +++-- .../json_rule_editor.test.tsx | 12 ++-- .../rule_editor_panel/json_rule_editor.tsx | 13 ++-- .../rule_editor_panel.test.tsx | 18 +++--- .../rule_editor_panel/rule_editor_panel.tsx | 25 ++++---- .../rule_group_editor.test.tsx | 13 ++-- .../rule_editor_panel/rule_group_editor.tsx | 14 +++-- .../rule_editor_panel/rule_group_title.tsx | 15 +++-- .../visual_rule_editor.test.tsx | 11 ++-- .../rule_editor_panel/visual_rule_editor.tsx | 11 ++-- .../services/is_rule_group.ts | 3 +- .../services/role_mapping_validation.test.ts | 4 +- .../services/role_mapping_validation.ts | 3 +- .../services/role_template_type.test.ts | 4 +- .../services/role_template_type.ts | 6 +- .../role_mappings/model/all_rule.test.ts | 7 ++- .../role_mappings/model/all_rule.ts | 3 +- .../role_mappings/model/any_rule.test.ts | 7 ++- .../role_mappings/model/any_rule.ts | 5 +- .../model/except_all_rule.test.ts | 7 ++- .../role_mappings/model/except_all_rule.ts | 3 +- .../model/except_any_rule.test.ts | 7 ++- .../role_mappings/model/except_any_rule.ts | 5 +- .../role_mappings/model/field_rule.test.ts | 2 +- .../role_mappings/model/field_rule.ts | 1 + .../role_mappings/model/rule_builder.test.ts | 5 +- .../role_mappings/model/rule_builder.ts | 10 +-- .../role_mappings/role_mappings_api_client.ts | 5 +- .../create_role_mapping_button.tsx | 8 ++- .../empty_prompt/empty_prompt.tsx | 6 +- .../role_mappings_grid_page.test.tsx | 47 +++++--------- .../role_mappings_grid_page.tsx | 24 +++---- .../role_mappings_management_app.test.tsx | 3 +- .../role_mappings_management_app.tsx | 12 ++-- .../role_table_display/role_table_display.tsx | 9 ++- .../roles/__fixtures__/kibana_features.ts | 3 +- .../roles/__fixtures__/kibana_privileges.ts | 9 ++- .../collapsible_panel.test.tsx | 2 + .../collapsible_panel/collapsible_panel.tsx | 6 +- .../edit_role/delete_role_button.test.tsx | 2 + .../roles/edit_role/delete_role_button.tsx | 3 +- .../roles/edit_role/edit_role_page.test.tsx | 27 ++++---- .../roles/edit_role/edit_role_page.tsx | 60 +++++++++--------- .../roles/edit_role/privilege_utils.ts | 2 +- .../privileges/es/cluster_privileges.test.tsx | 6 +- .../privileges/es/cluster_privileges.tsx | 6 +- .../es/elasticsearch_privileges.test.tsx | 9 +-- .../es/elasticsearch_privileges.tsx | 12 ++-- .../es/index_privilege_form.test.tsx | 2 + .../privileges/es/index_privilege_form.tsx | 13 ++-- .../privileges/es/index_privileges.test.tsx | 7 ++- .../privileges/es/index_privileges.tsx | 16 +++-- .../feature_table/__fixtures__/index.ts | 8 +-- .../feature_table/change_all_privileges.tsx | 9 ++- .../feature_table/feature_table.test.tsx | 15 ++--- .../kibana/feature_table/feature_table.tsx | 34 +++++----- .../feature_table_expanded_row.test.tsx | 11 ++-- .../feature_table_expanded_row.tsx | 11 ++-- .../feature_table/sub_feature_form.test.tsx | 12 ++-- .../kibana/feature_table/sub_feature_form.tsx | 11 ++-- .../feature_table_cell.test.tsx | 8 ++- .../feature_table_cell/feature_table_cell.tsx | 5 +- .../kibana/kibana_privileges_region.test.tsx | 7 ++- .../kibana/kibana_privileges_region.tsx | 12 ++-- .../privilege_form_calculator.test.ts | 4 +- .../privilege_form_calculator.ts | 4 +- .../privilege_summary/__fixtures__/index.ts | 8 +-- .../privilege_summary.test.tsx | 21 ++++--- .../privilege_summary/privilege_summary.tsx | 23 ++++--- .../privilege_summary_calculator.test.ts | 4 +- .../privilege_summary_calculator.ts | 6 +- .../privilege_summary_expanded_row.tsx | 12 +++- .../privilege_summary_table.test.tsx | 13 ++-- .../privilege_summary_table.tsx | 28 ++++----- .../space_column_header.test.tsx | 8 ++- .../privilege_summary/space_column_header.tsx | 6 +- .../privilege_selector.tsx | 4 +- .../simple_privilege_section.test.tsx | 9 ++- .../simple_privilege_section.tsx | 15 +++-- .../unsupported_space_privileges_warning.tsx | 3 +- .../privilege_display.test.tsx | 2 + .../privilege_display.tsx | 7 ++- .../privilege_space_form.test.tsx | 17 ++--- .../privilege_space_form.tsx | 21 ++++--- .../privilege_space_table.test.tsx | 17 ++--- .../privilege_space_table.tsx | 23 ++++--- .../space_aware_privilege_section.test.tsx | 8 ++- .../space_aware_privilege_section.tsx | 23 ++++--- .../space_selector.tsx | 10 ++- .../transform_error_section.tsx | 3 +- .../edit_role/reserved_role_badge.test.tsx | 3 +- .../roles/edit_role/reserved_role_badge.tsx | 6 +- .../spaces_popover_list.test.tsx | 16 ++--- .../spaces_popover_list.tsx | 6 +- .../roles/edit_role/validate_role.test.ts | 2 +- .../roles/edit_role/validate_role.ts | 5 +- .../management/roles/indices_api_client.ts | 2 +- .../roles/model/kibana_privileges.test.ts | 6 +- .../roles/model/kibana_privileges.ts | 6 +- .../roles/model/primary_feature_privilege.ts | 2 +- .../roles/model/privilege_collection.ts | 2 +- .../management/roles/model/secured_feature.ts | 5 +- .../roles/model/secured_sub_feature.ts | 3 +- .../roles/model/sub_feature_privilege.ts | 2 +- .../model/sub_feature_privilege_group.ts | 2 +- .../management/roles/privileges_api_client.ts | 5 +- .../management/roles/roles_api_client.test.ts | 5 +- .../management/roles/roles_api_client.ts | 6 +- .../confirm_delete/confirm_delete.tsx | 8 ++- .../permission_denied/permission_denied.tsx | 3 +- .../roles/roles_grid/roles_grid_page.test.tsx | 20 +++--- .../roles/roles_grid/roles_grid_page.tsx | 32 +++++----- .../roles/roles_management_app.test.tsx | 9 ++- .../management/roles/roles_management_app.tsx | 12 ++-- .../change_password_form.test.tsx | 9 +-- .../change_password_form.tsx | 11 ++-- .../confirm_delete_users.test.tsx | 7 ++- .../confirm_delete_users.tsx | 8 ++- .../edit_user/change_password_flyout.tsx | 14 +++-- .../users/edit_user/confirm_delete_users.tsx | 9 ++- .../users/edit_user/confirm_disable_users.tsx | 9 ++- .../users/edit_user/confirm_enable_users.tsx | 9 ++- .../users/edit_user/create_user_page.test.tsx | 8 ++- .../users/edit_user/create_user_page.tsx | 7 ++- .../users/edit_user/edit_user_page.test.tsx | 6 +- .../users/edit_user/edit_user_page.tsx | 19 +++--- .../management/users/edit_user/user_form.tsx | 21 ++++--- .../management/users/user_api_client.ts | 5 +- .../management/users/user_utils.test.ts | 4 +- .../public/management/users/user_utils.ts | 3 +- .../users/users_grid/users_grid_page.test.tsx | 49 ++++++--------- .../users/users_grid/users_grid_page.tsx | 33 +++++----- .../users/users_management_app.test.tsx | 3 +- .../management/users/users_management_app.tsx | 26 ++++---- x-pack/plugins/security/public/mocks.ts | 4 +- .../security/public/nav_control/index.mock.ts | 2 +- .../nav_control_component.test.tsx | 10 +-- .../nav_control/nav_control_component.tsx | 23 +++---- .../nav_control/nav_control_service.test.ts | 12 ++-- .../nav_control/nav_control_service.tsx | 16 ++--- .../plugins/security/public/plugin.test.tsx | 20 +++--- x-pack/plugins/security/public/plugin.tsx | 44 +++++++------ .../components/insecure_cluster_alert.tsx | 17 ++--- .../security_checkup_service.test.ts | 6 +- .../security_checkup_service.tsx | 10 +-- .../public/session/session_expired.mock.ts | 2 +- .../session_idle_timeout_warning.test.tsx | 2 + .../session/session_idle_timeout_warning.tsx | 6 +- .../session/session_lifespan_warning.tsx | 6 +- .../public/session/session_timeout.mock.ts | 2 +- .../public/session/session_timeout.test.tsx | 8 ++- .../public/session/session_timeout.tsx | 8 ++- .../session_timeout_http_interceptor.test.ts | 6 +- .../session_timeout_http_interceptor.ts | 4 +- ...thorized_response_http_interceptor.test.ts | 5 +- .../unauthorized_response_http_interceptor.ts | 6 +- .../anonymous_access_service.mock.ts | 4 +- .../anonymous_access_service.test.ts | 11 ++-- .../anonymous_access_service.ts | 15 +++-- .../server/audit/audit_events.test.ts | 14 +++-- .../security/server/audit/audit_events.ts | 5 +- .../server/audit/audit_service.test.ts | 28 +++++---- .../security/server/audit/audit_service.ts | 27 ++++---- .../security/server/audit/index.mock.ts | 4 +- .../server/audit/security_audit_logger.ts | 2 +- .../authentication/api_keys/api_keys.mock.ts | 3 +- .../authentication/api_keys/api_keys.test.ts | 10 +-- .../authentication/api_keys/api_keys.ts | 5 +- .../authentication_result.test.ts | 1 + .../authentication/authentication_result.ts | 5 +- .../authentication_service.mock.ts | 2 +- .../authentication_service.test.ts | 39 ++++++------ .../authentication/authentication_service.ts | 20 +++--- .../authentication/authenticator.test.ts | 23 ++++--- .../server/authentication/authenticator.ts | 35 +++++------ .../authentication/can_redirect_request.ts | 2 +- .../http_authorization_header.test.ts | 2 +- .../http_authorization_header.ts | 2 +- .../providers/anonymous.test.ts | 8 +-- .../authentication/providers/anonymous.ts | 6 +- .../authentication/providers/base.mock.ts | 6 +- .../server/authentication/providers/base.ts | 15 ++--- .../authentication/providers/basic.test.ts | 8 +-- .../server/authentication/providers/basic.ts | 7 ++- .../authentication/providers/http.test.ts | 9 +-- .../server/authentication/providers/http.ts | 6 +- .../authentication/providers/kerberos.test.ts | 11 ++-- .../authentication/providers/kerberos.ts | 11 ++-- .../authentication/providers/oidc.test.ts | 16 ++--- .../server/authentication/providers/oidc.ts | 14 ++--- .../authentication/providers/pki.test.ts | 16 ++--- .../server/authentication/providers/pki.ts | 8 ++- .../authentication/providers/saml.test.ts | 11 ++-- .../server/authentication/providers/saml.ts | 14 +++-- .../authentication/providers/token.test.ts | 11 ++-- .../server/authentication/providers/token.ts | 11 ++-- .../server/authentication/tokens.test.ts | 8 +-- .../security/server/authentication/tokens.ts | 3 +- .../authorization/actions/actions.mock.ts | 4 +- .../authorization/actions/actions.test.ts | 2 +- .../server/authorization/actions/actions.ts | 2 +- .../server/authorization/actions/ui.ts | 4 +- .../authorization/api_authorization.test.ts | 6 +- .../server/authorization/api_authorization.ts | 5 +- .../authorization/app_authorization.test.ts | 12 ++-- .../server/authorization/app_authorization.ts | 7 ++- .../authorization_service.test.ts | 22 +++---- .../authorization/authorization_service.tsx | 63 +++++++++---------- .../authorization/check_privileges.test.ts | 7 ++- .../server/authorization/check_privileges.ts | 12 ++-- .../check_privileges_dynamically.test.ts | 4 +- .../check_privileges_dynamically.ts | 12 ++-- .../check_saved_objects_privileges.test.ts | 8 +-- .../check_saved_objects_privileges.ts | 7 ++- .../disable_ui_capabilities.test.ts | 12 ++-- .../authorization/disable_ui_capabilities.ts | 19 +++--- .../server/authorization/index.mock.ts | 2 +- .../server/authorization/mode.test.ts | 8 +-- .../security/server/authorization/mode.ts | 5 +- .../alerting.test.ts | 3 +- .../feature_privilege_builder/alerting.ts | 3 +- .../feature_privilege_builder/api.ts | 2 +- .../feature_privilege_builder/app.ts | 2 +- .../feature_privilege_builder/catalogue.ts | 2 +- .../feature_privilege_builder.ts | 4 +- .../feature_privilege_builder/index.ts | 8 ++- .../feature_privilege_builder/management.ts | 2 +- .../feature_privilege_builder/navlink.ts | 2 +- .../feature_privilege_builder/saved_object.ts | 3 +- .../feature_privilege_builder/ui.ts | 2 +- .../feature_privilege_iterator.ts | 5 +- .../sub_feature_privilege_iterator.ts | 5 +- .../privileges/privileges.test.ts | 3 +- .../authorization/privileges/privileges.ts | 9 +-- .../authorization/privileges_serializer.ts | 2 +- .../register_privileges_with_cluster.test.ts | 8 +-- .../register_privileges_with_cluster.ts | 7 ++- .../authorization/reset_session_page.test.tsx | 3 +- .../authorization/reset_session_page.tsx | 10 +-- .../security/server/authorization/types.ts | 2 +- .../authorization/validate_es_response.ts | 3 +- .../validate_feature_privileges.ts | 2 +- .../validate_reserved_privileges.ts | 2 +- x-pack/plugins/security/server/config.test.ts | 5 +- x-pack/plugins/security/server/config.ts | 8 ++- .../server/config_deprecations.test.ts | 6 +- .../elasticsearch_service.test.ts | 12 ++-- .../elasticsearch/elasticsearch_service.ts | 10 ++- x-pack/plugins/security/server/errors.test.ts | 3 +- x-pack/plugins/security/server/errors.ts | 5 +- .../feature_usage/feature_usage_service.ts | 2 +- .../server/feature_usage/index.mock.ts | 2 +- .../server/features/security_features.ts | 2 +- x-pack/plugins/security/server/index.ts | 11 ++-- x-pack/plugins/security/server/mocks.ts | 5 +- x-pack/plugins/security/server/plugin.test.ts | 10 +-- x-pack/plugins/security/server/plugin.ts | 63 +++++++++++-------- .../server/routes/api_keys/enabled.test.ts | 11 ++-- .../server/routes/api_keys/enabled.ts | 2 +- .../server/routes/api_keys/get.test.ts | 11 ++-- .../security/server/routes/api_keys/get.ts | 5 +- .../security/server/routes/api_keys/index.ts | 6 +- .../server/routes/api_keys/invalidate.test.ts | 11 ++-- .../server/routes/api_keys/invalidate.ts | 7 ++- .../server/routes/api_keys/privileges.test.ts | 9 +-- .../server/routes/api_keys/privileges.ts | 2 +- .../routes/authentication/common.test.ts | 19 +++--- .../server/routes/authentication/common.ts | 12 ++-- .../routes/authentication/index.test.ts | 3 +- .../server/routes/authentication/index.ts | 4 +- .../server/routes/authentication/oidc.ts | 13 ++-- .../server/routes/authentication/saml.test.ts | 13 ++-- .../server/routes/authentication/saml.ts | 3 +- .../server/routes/authorization/index.ts | 4 +- .../authorization/privileges/get.test.ts | 12 ++-- .../routes/authorization/privileges/get.ts | 3 +- .../authorization/privileges/get_builtin.ts | 4 +- .../routes/authorization/privileges/index.ts | 2 +- .../authorization/reset_session_page.ts | 2 +- .../routes/authorization/roles/delete.test.ts | 9 +-- .../routes/authorization/roles/delete.ts | 5 +- .../routes/authorization/roles/get.test.ts | 9 +-- .../server/routes/authorization/roles/get.ts | 8 ++- .../authorization/roles/get_all.test.ts | 9 +-- .../routes/authorization/roles/get_all.ts | 7 ++- .../routes/authorization/roles/index.ts | 4 +- .../roles/model/elasticsearch_role.ts | 2 +- .../authorization/roles/model/put_payload.ts | 7 ++- .../routes/authorization/roles/put.test.ts | 14 ++--- .../server/routes/authorization/roles/put.ts | 17 +++-- .../share_saved_object_permissions.test.ts | 19 +++--- .../spaces/share_saved_object_permissions.ts | 5 +- .../security/server/routes/index.mock.ts | 13 ++-- .../plugins/security/server/routes/index.ts | 8 +-- .../server/routes/indices/get_fields.test.ts | 4 +- .../server/routes/indices/get_fields.ts | 3 +- .../security/server/routes/indices/index.ts | 2 +- .../server/routes/licensed_route_handler.ts | 3 +- .../server/routes/role_mapping/delete.test.ts | 5 +- .../server/routes/role_mapping/delete.ts | 5 +- .../routes/role_mapping/feature_check.test.ts | 7 ++- .../routes/role_mapping/feature_check.ts | 5 +- .../server/routes/role_mapping/get.test.ts | 6 +- .../server/routes/role_mapping/get.ts | 7 ++- .../server/routes/role_mapping/index.ts | 4 +- .../server/routes/role_mapping/post.test.ts | 5 +- .../server/routes/role_mapping/post.ts | 5 +- .../routes/session_management/extend.test.ts | 11 ++-- .../routes/session_management/extend.ts | 2 +- .../server/routes/session_management/index.ts | 2 +- .../routes/session_management/info.test.ts | 15 ++--- .../server/routes/session_management/info.ts | 4 +- .../routes/users/change_password.test.ts | 24 ++++--- .../server/routes/users/change_password.ts | 9 +-- .../server/routes/users/create_or_update.ts | 3 +- .../security/server/routes/users/delete.ts | 3 +- .../security/server/routes/users/disable.ts | 3 +- .../security/server/routes/users/enable.ts | 3 +- .../security/server/routes/users/get.ts | 3 +- .../security/server/routes/users/get_all.ts | 2 +- .../security/server/routes/users/index.ts | 8 +-- .../routes/views/access_agreement.test.ts | 24 +++---- .../server/routes/views/access_agreement.ts | 4 +- .../server/routes/views/account_management.ts | 2 +- .../server/routes/views/capture_url.test.ts | 12 ++-- .../server/routes/views/capture_url.ts | 3 +- .../server/routes/views/index.test.ts | 3 +- .../security/server/routes/views/index.ts | 4 +- .../server/routes/views/logged_out.test.ts | 8 +-- .../server/routes/views/logged_out.ts | 2 +- .../server/routes/views/login.test.ts | 25 ++++---- .../security/server/routes/views/login.ts | 9 +-- .../security/server/routes/views/logout.ts | 2 +- .../routes/views/overwritten_session.ts | 2 +- .../security/server/saved_objects/index.ts | 15 ++--- ...ecure_saved_objects_client_wrapper.test.ts | 18 +++--- .../secure_saved_objects_client_wrapper.ts | 24 +++---- .../server/session_management/session.mock.ts | 3 +- .../server/session_management/session.test.ts | 16 ++--- .../server/session_management/session.ts | 11 ++-- .../session_management/session_cookie.mock.ts | 3 +- .../session_management/session_cookie.test.ts | 13 ++-- .../session_management/session_cookie.ts | 7 ++- .../session_management/session_index.mock.ts | 3 +- .../session_management/session_index.test.ts | 11 ++-- .../session_management/session_index.ts | 3 +- .../session_management_service.test.ts | 26 ++++---- .../session_management_service.ts | 23 +++---- .../server/spaces/legacy_audit_logger.ts | 2 +- .../secure_spaces_client_wrapper.test.ts | 21 +++---- .../spaces/secure_spaces_client_wrapper.ts | 19 +++--- .../server/spaces/setup_spaces_client.test.ts | 3 +- .../server/spaces/setup_spaces_client.ts | 6 +- x-pack/plugins/security/server/types.ts | 1 + .../security_usage_collector.test.ts | 11 ++-- .../security_usage_collector.ts | 7 ++- 504 files changed, 2466 insertions(+), 1977 deletions(-) create mode 100644 src/plugins/security_oss/.eslintrc.json create mode 100644 src/plugins/spaces_oss/.eslintrc.json create mode 100644 x-pack/plugins/encrypted_saved_objects/.eslintrc.json create mode 100644 x-pack/plugins/security/.eslintrc.json diff --git a/src/plugins/security_oss/.eslintrc.json b/src/plugins/security_oss/.eslintrc.json new file mode 100644 index 0000000000000..2b63a9259d220 --- /dev/null +++ b/src/plugins/security_oss/.eslintrc.json @@ -0,0 +1,5 @@ +{ + "rules": { + "@typescript-eslint/consistent-type-imports": 1 + } +} diff --git a/src/plugins/security_oss/public/app_state/app_state_service.test.ts b/src/plugins/security_oss/public/app_state/app_state_service.test.ts index 7f2af2e895836..ec491e0faac2f 100644 --- a/src/plugins/security_oss/public/app_state/app_state_service.test.ts +++ b/src/plugins/security_oss/public/app_state/app_state_service.test.ts @@ -6,7 +6,8 @@ * Side Public License, v 1. */ -import { coreMock } from '../../../../core/public/mocks'; +import { coreMock } from 'src/core/public/mocks'; + import { AppStateService } from './app_state_service'; describe('AppStateService', () => { diff --git a/src/plugins/security_oss/public/app_state/app_state_service.ts b/src/plugins/security_oss/public/app_state/app_state_service.ts index 1fe9984c7d1da..8f6e9c0f08e77 100644 --- a/src/plugins/security_oss/public/app_state/app_state_service.ts +++ b/src/plugins/security_oss/public/app_state/app_state_service.ts @@ -6,8 +6,9 @@ * Side Public License, v 1. */ -import { CoreStart } from 'kibana/public'; -import { AppState } from '../../common'; +import type { CoreStart } from 'src/core/public'; + +import type { AppState } from '../../common'; const DEFAULT_APP_STATE = Object.freeze({ insecureClusterAlert: { displayAlert: false }, diff --git a/src/plugins/security_oss/public/index.ts b/src/plugins/security_oss/public/index.ts index bddf107758fde..0f67c6ed5442b 100644 --- a/src/plugins/security_oss/public/index.ts +++ b/src/plugins/security_oss/public/index.ts @@ -6,10 +6,11 @@ * Side Public License, v 1. */ -import { PluginInitializerContext } from 'kibana/public'; +import type { PluginInitializerContext } from 'src/core/public'; import { SecurityOssPlugin } from './plugin'; export { SecurityOssPluginSetup, SecurityOssPluginStart } from './plugin'; + export const plugin = (initializerContext: PluginInitializerContext) => new SecurityOssPlugin(initializerContext); diff --git a/src/plugins/security_oss/public/insecure_cluster_service/components/default_alert.tsx b/src/plugins/security_oss/public/insecure_cluster_service/components/default_alert.tsx index 5431d95b78296..288d49457a64f 100644 --- a/src/plugins/security_oss/public/insecure_cluster_service/components/default_alert.tsx +++ b/src/plugins/security_oss/public/insecure_cluster_service/components/default_alert.tsx @@ -14,12 +14,13 @@ import { EuiSpacer, EuiText, } from '@elastic/eui'; -import { i18n } from '@kbn/i18n'; -import { I18nProvider, FormattedMessage } from '@kbn/i18n/react'; -import { MountPoint } from 'kibana/public'; import React, { useState } from 'react'; import { render, unmountComponentAtNode } from 'react-dom'; +import { i18n } from '@kbn/i18n'; +import { FormattedMessage, I18nProvider } from '@kbn/i18n/react'; +import type { MountPoint } from 'src/core/public'; + export const defaultAlertTitle = i18n.translate('security.checkup.insecureClusterTitle', { defaultMessage: 'Your data is not secure', }); diff --git a/src/plugins/security_oss/public/insecure_cluster_service/insecure_cluster_service.mock.tsx b/src/plugins/security_oss/public/insecure_cluster_service/insecure_cluster_service.mock.tsx index c0f81ba276989..accf597aafa0b 100644 --- a/src/plugins/security_oss/public/insecure_cluster_service/insecure_cluster_service.mock.tsx +++ b/src/plugins/security_oss/public/insecure_cluster_service/insecure_cluster_service.mock.tsx @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { +import type { InsecureClusterServiceSetup, InsecureClusterServiceStart, } from './insecure_cluster_service'; diff --git a/src/plugins/security_oss/public/insecure_cluster_service/insecure_cluster_service.test.tsx b/src/plugins/security_oss/public/insecure_cluster_service/insecure_cluster_service.test.tsx index ef6ae18613f15..45240527d91ef 100644 --- a/src/plugins/security_oss/public/insecure_cluster_service/insecure_cluster_service.test.tsx +++ b/src/plugins/security_oss/public/insecure_cluster_service/insecure_cluster_service.test.tsx @@ -7,7 +7,9 @@ */ import { nextTick } from '@kbn/test/jest'; -import { coreMock } from '../../../../core/public/mocks'; + +import { coreMock } from 'src/core/public/mocks'; + import { mockAppStateService } from '../app_state/app_state_service.mock'; import type { ConfigType } from '../config'; import { InsecureClusterService } from './insecure_cluster_service'; diff --git a/src/plugins/security_oss/public/insecure_cluster_service/insecure_cluster_service.tsx b/src/plugins/security_oss/public/insecure_cluster_service/insecure_cluster_service.tsx index e8caa41391f27..6ad84b80eaf70 100644 --- a/src/plugins/security_oss/public/insecure_cluster_service/insecure_cluster_service.tsx +++ b/src/plugins/security_oss/public/insecure_cluster_service/insecure_cluster_service.tsx @@ -6,10 +6,11 @@ * Side Public License, v 1. */ -import { CoreSetup, CoreStart, MountPoint, Toast } from 'kibana/public'; - import { BehaviorSubject, combineLatest, from } from 'rxjs'; import { distinctUntilChanged, map } from 'rxjs/operators'; + +import type { CoreSetup, CoreStart, MountPoint, Toast } from 'src/core/public'; + import type { ConfigType } from '../config'; import type { AppStateServiceStart } from '../app_state'; import { defaultAlertText, defaultAlertTitle } from './components'; diff --git a/src/plugins/security_oss/public/plugin.mock.ts b/src/plugins/security_oss/public/plugin.mock.ts index f8b855803443d..324e0cdfd8524 100644 --- a/src/plugins/security_oss/public/plugin.mock.ts +++ b/src/plugins/security_oss/public/plugin.mock.ts @@ -7,9 +7,10 @@ */ import type { DeeplyMockedKeys } from '@kbn/utility-types/jest'; -import { InsecureClusterServiceStart } from './insecure_cluster_service'; + +import type { InsecureClusterServiceStart } from './insecure_cluster_service'; import { mockInsecureClusterService } from './insecure_cluster_service/insecure_cluster_service.mock'; -import { SecurityOssPluginSetup, SecurityOssPluginStart } from './plugin'; +import type { SecurityOssPluginSetup, SecurityOssPluginStart } from './plugin'; export const mockSecurityOssPlugin = { createSetup: () => { diff --git a/src/plugins/security_oss/public/plugin.ts b/src/plugins/security_oss/public/plugin.ts index 7b99e22de70f0..0104950f22366 100644 --- a/src/plugins/security_oss/public/plugin.ts +++ b/src/plugins/security_oss/public/plugin.ts @@ -13,13 +13,14 @@ import type { Plugin, PluginInitializerContext, } from 'src/core/public'; + +import { AppStateService } from './app_state'; import type { ConfigType } from './config'; -import { - InsecureClusterService, +import type { InsecureClusterServiceSetup, InsecureClusterServiceStart, } from './insecure_cluster_service'; -import { AppStateService } from './app_state'; +import { InsecureClusterService } from './insecure_cluster_service'; export interface SecurityOssPluginSetup { insecureCluster: InsecureClusterServiceSetup; diff --git a/src/plugins/security_oss/server/check_cluster_data.test.ts b/src/plugins/security_oss/server/check_cluster_data.test.ts index 21232d60ab293..0670eb3116b07 100644 --- a/src/plugins/security_oss/server/check_cluster_data.test.ts +++ b/src/plugins/security_oss/server/check_cluster_data.test.ts @@ -6,7 +6,8 @@ * Side Public License, v 1. */ -import { elasticsearchServiceMock, loggingSystemMock } from '../../../core/server/mocks'; +import { elasticsearchServiceMock, loggingSystemMock } from 'src/core/server/mocks'; + import { createClusterDataCheck } from './check_cluster_data'; describe('checkClusterForUserData', () => { diff --git a/src/plugins/security_oss/server/check_cluster_data.ts b/src/plugins/security_oss/server/check_cluster_data.ts index 99bedb84c8c38..c8c30196b485c 100644 --- a/src/plugins/security_oss/server/check_cluster_data.ts +++ b/src/plugins/security_oss/server/check_cluster_data.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { ElasticsearchClient, Logger } from 'kibana/server'; +import type { ElasticsearchClient, Logger } from 'src/core/server'; export const createClusterDataCheck = () => { let clusterHasUserData = false; diff --git a/src/plugins/security_oss/server/config.ts b/src/plugins/security_oss/server/config.ts index 0d650859c18f8..4be4bf96c2d82 100644 --- a/src/plugins/security_oss/server/config.ts +++ b/src/plugins/security_oss/server/config.ts @@ -6,7 +6,8 @@ * Side Public License, v 1. */ -import { schema, TypeOf } from '@kbn/config-schema'; +import type { TypeOf } from '@kbn/config-schema'; +import { schema } from '@kbn/config-schema'; export type ConfigType = TypeOf; diff --git a/src/plugins/security_oss/server/index.ts b/src/plugins/security_oss/server/index.ts index e69b2554aa6e4..42736302b5d26 100644 --- a/src/plugins/security_oss/server/index.ts +++ b/src/plugins/security_oss/server/index.ts @@ -6,9 +6,9 @@ * Side Public License, v 1. */ -import { TypeOf } from '@kbn/config-schema'; +import type { TypeOf } from '@kbn/config-schema'; +import type { PluginConfigDescriptor, PluginInitializerContext } from 'src/core/server'; -import { PluginConfigDescriptor, PluginInitializerContext } from 'kibana/server'; import { ConfigSchema } from './config'; import { SecurityOssPlugin } from './plugin'; diff --git a/src/plugins/security_oss/server/plugin.test.ts b/src/plugins/security_oss/server/plugin.test.ts index 7aaf259f3edfa..5858fabd6a706 100644 --- a/src/plugins/security_oss/server/plugin.test.ts +++ b/src/plugins/security_oss/server/plugin.test.ts @@ -6,7 +6,8 @@ * Side Public License, v 1. */ -import { coreMock } from '../../../core/server/mocks'; +import { coreMock } from 'src/core/server/mocks'; + import { SecurityOssPlugin } from './plugin'; describe('SecurityOss Plugin', () => { diff --git a/src/plugins/security_oss/server/plugin.ts b/src/plugins/security_oss/server/plugin.ts index 4fc157ef44339..6adea272ed490 100644 --- a/src/plugins/security_oss/server/plugin.ts +++ b/src/plugins/security_oss/server/plugin.ts @@ -6,6 +6,9 @@ * Side Public License, v 1. */ +import type { Observable } from 'rxjs'; +import { BehaviorSubject } from 'rxjs'; + import type { Capabilities, CoreSetup, @@ -13,11 +16,11 @@ import type { Logger, Plugin, PluginInitializerContext, -} from 'kibana/server'; -import { BehaviorSubject, Observable } from 'rxjs'; +} from 'src/core/server'; + import { createClusterDataCheck } from './check_cluster_data'; -import { ConfigType } from './config'; -import { setupAppStateRoute, setupAnonymousAccessCapabilitiesRoute } from './routes'; +import type { ConfigType } from './config'; +import { setupAnonymousAccessCapabilitiesRoute, setupAppStateRoute } from './routes'; export interface SecurityOssPluginSetup { /** diff --git a/src/plugins/security_oss/server/routes/anonymous_access_capabilities.ts b/src/plugins/security_oss/server/routes/anonymous_access_capabilities.ts index c9c4cd4ad903c..80273b41063ad 100644 --- a/src/plugins/security_oss/server/routes/anonymous_access_capabilities.ts +++ b/src/plugins/security_oss/server/routes/anonymous_access_capabilities.ts @@ -6,7 +6,8 @@ * Side Public License, v 1. */ -import type { IRouter } from 'kibana/server'; +import type { IRouter } from 'src/core/server'; + import type { AnonymousAccessService } from '../plugin'; interface Deps { diff --git a/src/plugins/security_oss/server/routes/app_state.ts b/src/plugins/security_oss/server/routes/app_state.ts index 7d6890cc46344..6ecac362559d1 100644 --- a/src/plugins/security_oss/server/routes/app_state.ts +++ b/src/plugins/security_oss/server/routes/app_state.ts @@ -6,10 +6,13 @@ * Side Public License, v 1. */ -import type { IRouter, Logger } from 'kibana/server'; -import { combineLatest, Observable } from 'rxjs'; +import type { Observable } from 'rxjs'; +import { combineLatest } from 'rxjs'; + +import type { IRouter, Logger } from 'src/core/server'; + import type { AppState } from '../../common'; -import { createClusterDataCheck } from '../check_cluster_data'; +import type { createClusterDataCheck } from '../check_cluster_data'; import type { ConfigType } from '../config'; import type { AnonymousAccessService } from '../plugin'; diff --git a/src/plugins/security_oss/server/routes/integration_tests/anonymous_access_capabilities.test.ts b/src/plugins/security_oss/server/routes/integration_tests/anonymous_access_capabilities.test.ts index ee0ef8eaa830a..0dba0433a3625 100644 --- a/src/plugins/security_oss/server/routes/integration_tests/anonymous_access_capabilities.test.ts +++ b/src/plugins/security_oss/server/routes/integration_tests/anonymous_access_capabilities.test.ts @@ -6,10 +6,12 @@ * Side Public License, v 1. */ -import type { UnwrapPromise } from '@kbn/utility-types'; import supertest from 'supertest'; -import { setupServer } from '../../../../../core/server/test_utils'; -import { AnonymousAccessService } from '../../plugin'; + +import type { UnwrapPromise } from '@kbn/utility-types'; +import { setupServer } from 'src/core/server/test_utils'; + +import type { AnonymousAccessService } from '../../plugin'; import { setupAnonymousAccessCapabilitiesRoute } from '../anonymous_access_capabilities'; type SetupServerReturn = UnwrapPromise>; diff --git a/src/plugins/security_oss/server/routes/integration_tests/app_state.test.ts b/src/plugins/security_oss/server/routes/integration_tests/app_state.test.ts index cec0b94cffa5f..82e7098760e18 100644 --- a/src/plugins/security_oss/server/routes/integration_tests/app_state.test.ts +++ b/src/plugins/security_oss/server/routes/integration_tests/app_state.test.ts @@ -6,16 +6,18 @@ * Side Public License, v 1. */ -import { loggingSystemMock } from '../../../../../core/server/mocks'; -import { setupServer } from '../../../../../core/server/test_utils'; -import { AnonymousAccessService } from '../../plugin'; -import { setupAppStateRoute } from '../app_state'; -import { ConfigType } from '../../config'; import { BehaviorSubject, of } from 'rxjs'; -import { UnwrapPromise } from '@kbn/utility-types'; -import { createClusterDataCheck } from '../../check_cluster_data'; import supertest from 'supertest'; +import type { UnwrapPromise } from '@kbn/utility-types'; +import { loggingSystemMock } from 'src/core/server/mocks'; +import { setupServer } from 'src/core/server/test_utils'; + +import type { createClusterDataCheck } from '../../check_cluster_data'; +import type { ConfigType } from '../../config'; +import type { AnonymousAccessService } from '../../plugin'; +import { setupAppStateRoute } from '../app_state'; + type SetupServerReturn = UnwrapPromise>; const pluginId = Symbol('securityOss'); diff --git a/src/plugins/spaces_oss/.eslintrc.json b/src/plugins/spaces_oss/.eslintrc.json new file mode 100644 index 0000000000000..2b63a9259d220 --- /dev/null +++ b/src/plugins/spaces_oss/.eslintrc.json @@ -0,0 +1,5 @@ +{ + "rules": { + "@typescript-eslint/consistent-type-imports": 1 + } +} diff --git a/src/plugins/spaces_oss/public/api.mock.ts b/src/plugins/spaces_oss/public/api.mock.ts index 1f0899ca1df60..84b22459a96e2 100644 --- a/src/plugins/spaces_oss/public/api.mock.ts +++ b/src/plugins/spaces_oss/public/api.mock.ts @@ -7,7 +7,8 @@ */ import { of } from 'rxjs'; -import { SpacesApi, SpacesApiUi, SpacesApiUiComponent } from './api'; + +import type { SpacesApi, SpacesApiUi, SpacesApiUiComponent } from './api'; const createApiMock = (): jest.Mocked => ({ activeSpace$: of(), diff --git a/src/plugins/spaces_oss/public/api.ts b/src/plugins/spaces_oss/public/api.ts index 3c10995b75003..1d33408d645ea 100644 --- a/src/plugins/spaces_oss/public/api.ts +++ b/src/plugins/spaces_oss/public/api.ts @@ -6,9 +6,10 @@ * Side Public License, v 1. */ -import { Observable } from 'rxjs'; +import type { Observable } from 'rxjs'; import type { ReactElement } from 'react'; -import { Space } from '../common'; + +import type { Space } from '../common'; /** * @public diff --git a/src/plugins/spaces_oss/public/mocks/index.ts b/src/plugins/spaces_oss/public/mocks/index.ts index c0ee76436f1f5..8061faa00b089 100644 --- a/src/plugins/spaces_oss/public/mocks/index.ts +++ b/src/plugins/spaces_oss/public/mocks/index.ts @@ -7,7 +7,8 @@ */ import { spacesApiMock } from '../api.mock'; -import { SpacesOssPluginSetup, SpacesOssPluginStart } from '..'; + +import type { SpacesOssPluginSetup, SpacesOssPluginStart } from '../'; const createSetupContract = (): jest.Mocked => ({ registerSpacesApi: jest.fn(), diff --git a/src/plugins/spaces_oss/public/plugin.ts b/src/plugins/spaces_oss/public/plugin.ts index e6823284d44ba..52a8fd0d570d2 100644 --- a/src/plugins/spaces_oss/public/plugin.ts +++ b/src/plugins/spaces_oss/public/plugin.ts @@ -6,9 +6,10 @@ * Side Public License, v 1. */ -import { Plugin } from 'src/core/public'; -import { SpacesOssPluginSetup, SpacesOssPluginStart } from './types'; -import { SpacesApi } from './api'; +import type { Plugin } from 'src/core/public'; + +import type { SpacesOssPluginSetup, SpacesOssPluginStart } from './types'; +import type { SpacesApi } from './api'; export class SpacesOssPlugin implements Plugin { private api?: SpacesApi; diff --git a/src/plugins/spaces_oss/public/types.ts b/src/plugins/spaces_oss/public/types.ts index 831aaa2c45943..22501d3abd832 100644 --- a/src/plugins/spaces_oss/public/types.ts +++ b/src/plugins/spaces_oss/public/types.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { SpacesApi } from './api'; +import type { SpacesApi } from './api'; export interface SpacesAvailableStartContract extends SpacesApi { isSpacesAvailable: true; diff --git a/x-pack/plugins/encrypted_saved_objects/.eslintrc.json b/x-pack/plugins/encrypted_saved_objects/.eslintrc.json new file mode 100644 index 0000000000000..2b63a9259d220 --- /dev/null +++ b/x-pack/plugins/encrypted_saved_objects/.eslintrc.json @@ -0,0 +1,5 @@ +{ + "rules": { + "@typescript-eslint/consistent-type-imports": 1 + } +} diff --git a/x-pack/plugins/encrypted_saved_objects/server/audit/audit_logger.test.ts b/x-pack/plugins/encrypted_saved_objects/server/audit/audit_logger.test.ts index cf772ab9ae21f..695dafe77d3bc 100644 --- a/x-pack/plugins/encrypted_saved_objects/server/audit/audit_logger.test.ts +++ b/x-pack/plugins/encrypted_saved_objects/server/audit/audit_logger.test.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { EncryptedSavedObjectsAuditLogger } from './audit_logger'; import { mockAuthenticatedUser } from '../../../security/common/model/authenticated_user.mock'; +import { EncryptedSavedObjectsAuditLogger } from './audit_logger'; it('properly logs audit events', () => { const mockInternalAuditLogger = { log: jest.fn() }; diff --git a/x-pack/plugins/encrypted_saved_objects/server/audit/audit_logger.ts b/x-pack/plugins/encrypted_saved_objects/server/audit/audit_logger.ts index 9af696abf373e..e6290e4cc4dd8 100644 --- a/x-pack/plugins/encrypted_saved_objects/server/audit/audit_logger.ts +++ b/x-pack/plugins/encrypted_saved_objects/server/audit/audit_logger.ts @@ -5,8 +5,9 @@ * 2.0. */ -import { LegacyAuditLogger, AuthenticatedUser } from '../../../security/server'; -import { SavedObjectDescriptor, descriptorToArray } from '../crypto'; +import type { AuthenticatedUser, LegacyAuditLogger } from '../../../security/server'; +import type { SavedObjectDescriptor } from '../crypto'; +import { descriptorToArray } from '../crypto'; /** * Represents all audit events the plugin can log. diff --git a/x-pack/plugins/encrypted_saved_objects/server/audit/index.mock.ts b/x-pack/plugins/encrypted_saved_objects/server/audit/index.mock.ts index e7463ae57ef95..4b8f183e4928c 100644 --- a/x-pack/plugins/encrypted_saved_objects/server/audit/index.mock.ts +++ b/x-pack/plugins/encrypted_saved_objects/server/audit/index.mock.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { EncryptedSavedObjectsAuditLogger } from './audit_logger'; +import type { EncryptedSavedObjectsAuditLogger } from './audit_logger'; export const encryptedSavedObjectsAuditLoggerMock = { create() { diff --git a/x-pack/plugins/encrypted_saved_objects/server/config.ts b/x-pack/plugins/encrypted_saved_objects/server/config.ts index 2bcf0e9b69511..fc86336d44836 100644 --- a/x-pack/plugins/encrypted_saved_objects/server/config.ts +++ b/x-pack/plugins/encrypted_saved_objects/server/config.ts @@ -5,7 +5,8 @@ * 2.0. */ -import { schema, TypeOf } from '@kbn/config-schema'; +import type { TypeOf } from '@kbn/config-schema'; +import { schema } from '@kbn/config-schema'; export type ConfigType = TypeOf; diff --git a/x-pack/plugins/encrypted_saved_objects/server/create_migration.test.ts b/x-pack/plugins/encrypted_saved_objects/server/create_migration.test.ts index 4df51af8b16b0..548340fbb6463 100644 --- a/x-pack/plugins/encrypted_saved_objects/server/create_migration.test.ts +++ b/x-pack/plugins/encrypted_saved_objects/server/create_migration.test.ts @@ -5,10 +5,11 @@ * 2.0. */ -import { SavedObjectUnsanitizedDoc } from 'kibana/server'; +import type { SavedObjectUnsanitizedDoc } from 'src/core/server'; import { migrationMocks } from 'src/core/server/mocks'; -import { encryptedSavedObjectsServiceMock } from './crypto/index.mock'; + import { getCreateMigration } from './create_migration'; +import { encryptedSavedObjectsServiceMock } from './crypto/index.mock'; afterEach(() => { jest.clearAllMocks(); diff --git a/x-pack/plugins/encrypted_saved_objects/server/create_migration.ts b/x-pack/plugins/encrypted_saved_objects/server/create_migration.ts index cf5357c40fa20..beace2b17fe08 100644 --- a/x-pack/plugins/encrypted_saved_objects/server/create_migration.ts +++ b/x-pack/plugins/encrypted_saved_objects/server/create_migration.ts @@ -5,12 +5,13 @@ * 2.0. */ -import { - SavedObjectUnsanitizedDoc, - SavedObjectMigrationFn, +import type { SavedObjectMigrationContext, + SavedObjectMigrationFn, + SavedObjectUnsanitizedDoc, } from 'src/core/server'; -import { EncryptedSavedObjectTypeRegistration, EncryptedSavedObjectsService } from './crypto'; + +import type { EncryptedSavedObjectsService, EncryptedSavedObjectTypeRegistration } from './crypto'; import { normalizeNamespace } from './saved_objects'; type SavedObjectOptionalMigrationFn = ( diff --git a/x-pack/plugins/encrypted_saved_objects/server/crypto/encrypted_saved_object_type_definition.test.ts b/x-pack/plugins/encrypted_saved_objects/server/crypto/encrypted_saved_object_type_definition.test.ts index 0e06fcc2f6a67..a8d6327cb4230 100644 --- a/x-pack/plugins/encrypted_saved_objects/server/crypto/encrypted_saved_object_type_definition.test.ts +++ b/x-pack/plugins/encrypted_saved_objects/server/crypto/encrypted_saved_object_type_definition.test.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { EncryptedSavedObjectTypeRegistration } from './encrypted_saved_objects_service'; import { EncryptedSavedObjectAttributesDefinition } from './encrypted_saved_object_type_definition'; +import type { EncryptedSavedObjectTypeRegistration } from './encrypted_saved_objects_service'; it('correctly determines attribute properties', () => { const attributes = ['attr#1', 'attr#2', 'attr#3', 'attr#4']; diff --git a/x-pack/plugins/encrypted_saved_objects/server/crypto/encrypted_saved_object_type_definition.ts b/x-pack/plugins/encrypted_saved_objects/server/crypto/encrypted_saved_object_type_definition.ts index b2b6bd16c12cd..561cb2b6b3f5b 100644 --- a/x-pack/plugins/encrypted_saved_objects/server/crypto/encrypted_saved_object_type_definition.ts +++ b/x-pack/plugins/encrypted_saved_objects/server/crypto/encrypted_saved_object_type_definition.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { EncryptedSavedObjectTypeRegistration } from './encrypted_saved_objects_service'; +import type { EncryptedSavedObjectTypeRegistration } from './encrypted_saved_objects_service'; /** * Represents the definition of the attributes of the specific saved object that are supposed to be diff --git a/x-pack/plugins/encrypted_saved_objects/server/crypto/encrypted_saved_objects_service.mocks.ts b/x-pack/plugins/encrypted_saved_objects/server/crypto/encrypted_saved_objects_service.mocks.ts index d2a16ebef9ef6..d7ff27ced38c6 100644 --- a/x-pack/plugins/encrypted_saved_objects/server/crypto/encrypted_saved_objects_service.mocks.ts +++ b/x-pack/plugins/encrypted_saved_objects/server/crypto/encrypted_saved_objects_service.mocks.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { +import type { EncryptedSavedObjectsService, EncryptedSavedObjectTypeRegistration, SavedObjectDescriptor, diff --git a/x-pack/plugins/encrypted_saved_objects/server/crypto/encrypted_saved_objects_service.test.ts b/x-pack/plugins/encrypted_saved_objects/server/crypto/encrypted_saved_objects_service.test.ts index 7bc08d0e7b30f..5ac6467e8d78b 100644 --- a/x-pack/plugins/encrypted_saved_objects/server/crypto/encrypted_saved_objects_service.test.ts +++ b/x-pack/plugins/encrypted_saved_objects/server/crypto/encrypted_saved_objects_service.test.ts @@ -5,16 +5,17 @@ * 2.0. */ -import nodeCrypto, { Crypto } from '@elastic/node-crypto'; +import type { Crypto } from '@elastic/node-crypto'; +import nodeCrypto from '@elastic/node-crypto'; + +import { loggingSystemMock } from 'src/core/server/mocks'; import { mockAuthenticatedUser } from '../../../security/common/model/authenticated_user.mock'; -import { EncryptedSavedObjectsAuditLogger } from '../audit'; +import type { EncryptedSavedObjectsAuditLogger } from '../audit'; +import { encryptedSavedObjectsAuditLoggerMock } from '../audit/index.mock'; import { EncryptedSavedObjectsService } from './encrypted_saved_objects_service'; import { EncryptionError } from './encryption_error'; -import { loggingSystemMock } from 'src/core/server/mocks'; -import { encryptedSavedObjectsAuditLoggerMock } from '../audit/index.mock'; - function createNodeCryptMock(encryptionKey: string) { const crypto = nodeCrypto({ encryptionKey }); const nodeCryptoMock: jest.Mocked = { diff --git a/x-pack/plugins/encrypted_saved_objects/server/crypto/encrypted_saved_objects_service.ts b/x-pack/plugins/encrypted_saved_objects/server/crypto/encrypted_saved_objects_service.ts index 17757c9d8b2ba..652a2c8b6870e 100644 --- a/x-pack/plugins/encrypted_saved_objects/server/crypto/encrypted_saved_objects_service.ts +++ b/x-pack/plugins/encrypted_saved_objects/server/crypto/encrypted_saved_objects_service.ts @@ -5,14 +5,16 @@ * 2.0. */ -import { Crypto, EncryptOutput } from '@elastic/node-crypto'; -import typeDetect from 'type-detect'; +import type { Crypto, EncryptOutput } from '@elastic/node-crypto'; import stringify from 'json-stable-stringify'; -import { Logger } from 'src/core/server'; -import { AuthenticatedUser } from '../../../security/common/model'; -import { EncryptedSavedObjectsAuditLogger } from '../audit'; -import { EncryptionError, EncryptionErrorOperation } from './encryption_error'; +import typeDetect from 'type-detect'; + +import type { Logger } from 'src/core/server'; + +import type { AuthenticatedUser } from '../../../security/common/model'; +import type { EncryptedSavedObjectsAuditLogger } from '../audit'; import { EncryptedSavedObjectAttributesDefinition } from './encrypted_saved_object_type_definition'; +import { EncryptionError, EncryptionErrorOperation } from './encryption_error'; /** * Describes the attributes to encrypt. By default, attribute values won't be exposed to end-users diff --git a/x-pack/plugins/encrypted_saved_objects/server/crypto/encryption_key_rotation_service.mocks.ts b/x-pack/plugins/encrypted_saved_objects/server/crypto/encryption_key_rotation_service.mocks.ts index 71dc7fabef612..a69154c0e7be3 100644 --- a/x-pack/plugins/encrypted_saved_objects/server/crypto/encryption_key_rotation_service.mocks.ts +++ b/x-pack/plugins/encrypted_saved_objects/server/crypto/encryption_key_rotation_service.mocks.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { EncryptionKeyRotationService } from './encryption_key_rotation_service'; +import type { EncryptionKeyRotationService } from './encryption_key_rotation_service'; function createEncryptionKeyRotationServiceMock() { return ({ rotate: jest.fn() } as unknown) as jest.Mocked; diff --git a/x-pack/plugins/encrypted_saved_objects/server/crypto/encryption_key_rotation_service.test.ts b/x-pack/plugins/encrypted_saved_objects/server/crypto/encryption_key_rotation_service.test.ts index 800b2b381e121..3f343f4a0e15b 100644 --- a/x-pack/plugins/encrypted_saved_objects/server/crypto/encryption_key_rotation_service.test.ts +++ b/x-pack/plugins/encrypted_saved_objects/server/crypto/encryption_key_rotation_service.test.ts @@ -5,22 +5,22 @@ * 2.0. */ -import { +import type { SavedObject, SavedObjectsClientContract, SavedObjectsServiceStart, -} from '../../../../../src/core/server'; -import { EncryptionError, EncryptionErrorOperation } from './encryption_error'; -import { EncryptionKeyRotationService } from './encryption_key_rotation_service'; -import { EncryptedSavedObjectsService } from './encrypted_saved_objects_service'; - +} from 'src/core/server'; import { coreMock, httpServerMock, loggingSystemMock, savedObjectsClientMock, savedObjectsTypeRegistryMock, -} from '../../../../../src/core/server/mocks'; +} from 'src/core/server/mocks'; + +import type { EncryptedSavedObjectsService } from './encrypted_saved_objects_service'; +import { EncryptionError, EncryptionErrorOperation } from './encryption_error'; +import { EncryptionKeyRotationService } from './encryption_key_rotation_service'; import { encryptedSavedObjectsServiceMock } from './index.mock'; function getMockSavedObject(savedObject?: Partial>) { diff --git a/x-pack/plugins/encrypted_saved_objects/server/crypto/encryption_key_rotation_service.ts b/x-pack/plugins/encrypted_saved_objects/server/crypto/encryption_key_rotation_service.ts index 73d304afa15c2..1a6d1173d1652 100644 --- a/x-pack/plugins/encrypted_saved_objects/server/crypto/encryption_key_rotation_service.ts +++ b/x-pack/plugins/encrypted_saved_objects/server/crypto/encryption_key_rotation_service.ts @@ -6,7 +6,7 @@ */ import type { PublicMethodsOf } from '@kbn/utility-types'; -import { +import type { ISavedObjectTypeRegistry, KibanaRequest, Logger, @@ -14,9 +14,10 @@ import { SavedObjectsBulkUpdateObject, StartServicesAccessor, } from 'src/core/server'; -import { AuthenticatedUser, SecurityPluginSetup } from '../../../security/server'; + +import type { AuthenticatedUser, SecurityPluginSetup } from '../../../security/server'; import { getDescriptorNamespace } from '../saved_objects/get_descriptor_namespace'; -import { EncryptedSavedObjectsService } from './encrypted_saved_objects_service'; +import type { EncryptedSavedObjectsService } from './encrypted_saved_objects_service'; import { EncryptionError } from './encryption_error'; interface EncryptionKeyRotationServiceOptions { diff --git a/x-pack/plugins/encrypted_saved_objects/server/index.ts b/x-pack/plugins/encrypted_saved_objects/server/index.ts index 53b020e5b8241..95337b8c92913 100644 --- a/x-pack/plugins/encrypted_saved_objects/server/index.ts +++ b/x-pack/plugins/encrypted_saved_objects/server/index.ts @@ -5,7 +5,8 @@ * 2.0. */ -import { PluginInitializerContext } from 'src/core/server'; +import type { PluginInitializerContext } from 'src/core/server'; + import { ConfigSchema } from './config'; import { EncryptedSavedObjectsPlugin } from './plugin'; diff --git a/x-pack/plugins/encrypted_saved_objects/server/mocks.ts b/x-pack/plugins/encrypted_saved_objects/server/mocks.ts index edb55513aabf5..5f80e5bab310f 100644 --- a/x-pack/plugins/encrypted_saved_objects/server/mocks.ts +++ b/x-pack/plugins/encrypted_saved_objects/server/mocks.ts @@ -5,8 +5,11 @@ * 2.0. */ -import { EncryptedSavedObjectsPluginSetup, EncryptedSavedObjectsPluginStart } from './plugin'; -import { EncryptedSavedObjectsClient, EncryptedSavedObjectsClientOptions } from './saved_objects'; +import type { EncryptedSavedObjectsPluginSetup, EncryptedSavedObjectsPluginStart } from './plugin'; +import type { + EncryptedSavedObjectsClient, + EncryptedSavedObjectsClientOptions, +} from './saved_objects'; function createEncryptedSavedObjectsSetupMock( { canEncrypt }: { canEncrypt: boolean } = { canEncrypt: false } diff --git a/x-pack/plugins/encrypted_saved_objects/server/plugin.test.ts b/x-pack/plugins/encrypted_saved_objects/server/plugin.test.ts index e71332b1c5aa7..9d345c5e0af0f 100644 --- a/x-pack/plugins/encrypted_saved_objects/server/plugin.test.ts +++ b/x-pack/plugins/encrypted_saved_objects/server/plugin.test.ts @@ -5,11 +5,11 @@ * 2.0. */ -import { EncryptedSavedObjectsPlugin } from './plugin'; -import { ConfigSchema } from './config'; - import { coreMock } from 'src/core/server/mocks'; + import { securityMock } from '../../security/server/mocks'; +import { ConfigSchema } from './config'; +import { EncryptedSavedObjectsPlugin } from './plugin'; describe('EncryptedSavedObjects Plugin', () => { describe('setup()', () => { diff --git a/x-pack/plugins/encrypted_saved_objects/server/plugin.ts b/x-pack/plugins/encrypted_saved_objects/server/plugin.ts index c99d6bd32287d..fa1b6415d206e 100644 --- a/x-pack/plugins/encrypted_saved_objects/server/plugin.ts +++ b/x-pack/plugins/encrypted_saved_objects/server/plugin.ts @@ -6,19 +6,23 @@ */ import nodeCrypto from '@elastic/node-crypto'; -import type { Logger, PluginInitializerContext, CoreSetup, Plugin } from 'src/core/server'; + +import type { CoreSetup, Logger, Plugin, PluginInitializerContext } from 'src/core/server'; + import type { SecurityPluginSetup } from '../../security/server'; +import { EncryptedSavedObjectsAuditLogger } from './audit'; import type { ConfigType } from './config'; +import type { CreateEncryptedSavedObjectsMigrationFn } from './create_migration'; +import { getCreateMigration } from './create_migration'; +import type { EncryptedSavedObjectTypeRegistration } from './crypto'; import { EncryptedSavedObjectsService, - EncryptedSavedObjectTypeRegistration, EncryptionError, EncryptionKeyRotationService, } from './crypto'; -import { EncryptedSavedObjectsAuditLogger } from './audit'; -import { setupSavedObjects, ClientInstanciator } from './saved_objects'; -import { getCreateMigration, CreateEncryptedSavedObjectsMigrationFn } from './create_migration'; import { defineRoutes } from './routes'; +import type { ClientInstanciator } from './saved_objects'; +import { setupSavedObjects } from './saved_objects'; export interface PluginsSetup { security?: SecurityPluginSetup; diff --git a/x-pack/plugins/encrypted_saved_objects/server/routes/index.mock.ts b/x-pack/plugins/encrypted_saved_objects/server/routes/index.mock.ts index 32ac1617f4a7e..9c8add9da3ad3 100644 --- a/x-pack/plugins/encrypted_saved_objects/server/routes/index.mock.ts +++ b/x-pack/plugins/encrypted_saved_objects/server/routes/index.mock.ts @@ -5,9 +5,10 @@ * 2.0. */ -import { ConfigSchema, ConfigType } from '../config'; +import { httpServiceMock, loggingSystemMock } from 'src/core/server/mocks'; -import { httpServiceMock, loggingSystemMock } from '../../../../../src/core/server/mocks'; +import type { ConfigType } from '../config'; +import { ConfigSchema } from '../config'; import { encryptionKeyRotationServiceMock } from '../crypto/index.mock'; export const routeDefinitionParamsMock = { diff --git a/x-pack/plugins/encrypted_saved_objects/server/routes/index.ts b/x-pack/plugins/encrypted_saved_objects/server/routes/index.ts index 6cab988257ea6..680ad0be015c0 100644 --- a/x-pack/plugins/encrypted_saved_objects/server/routes/index.ts +++ b/x-pack/plugins/encrypted_saved_objects/server/routes/index.ts @@ -6,10 +6,10 @@ */ import type { PublicMethodsOf } from '@kbn/utility-types'; -import { IRouter, Logger } from '../../../../../src/core/server'; -import { ConfigType } from '../config'; -import { EncryptionKeyRotationService } from '../crypto'; +import type { IRouter, Logger } from 'src/core/server'; +import type { ConfigType } from '../config'; +import type { EncryptionKeyRotationService } from '../crypto'; import { defineKeyRotationRoutes } from './key_rotation'; /** diff --git a/x-pack/plugins/encrypted_saved_objects/server/routes/key_rotation.test.ts b/x-pack/plugins/encrypted_saved_objects/server/routes/key_rotation.test.ts index 0fca4b36597b2..138d111cb8f9d 100644 --- a/x-pack/plugins/encrypted_saved_objects/server/routes/key_rotation.test.ts +++ b/x-pack/plugins/encrypted_saved_objects/server/routes/key_rotation.test.ts @@ -6,18 +6,13 @@ */ import { Type } from '@kbn/config-schema'; -import { - IRouter, - kibanaResponseFactory, - RequestHandler, - RequestHandlerContext, - RouteConfig, -} from '../../../../../src/core/server'; -import { defineKeyRotationRoutes } from './key_rotation'; +import type { IRouter, RequestHandler, RequestHandlerContext, RouteConfig } from 'src/core/server'; +import { kibanaResponseFactory } from 'src/core/server'; +import { httpServerMock } from 'src/core/server/mocks'; -import { httpServerMock } from '../../../../../src/core/server/mocks'; +import type { EncryptionKeyRotationService } from '../crypto'; import { routeDefinitionParamsMock } from './index.mock'; -import { EncryptionKeyRotationService } from '../crypto'; +import { defineKeyRotationRoutes } from './key_rotation'; describe('Key rotation routes', () => { let router: jest.Mocked; diff --git a/x-pack/plugins/encrypted_saved_objects/server/routes/key_rotation.ts b/x-pack/plugins/encrypted_saved_objects/server/routes/key_rotation.ts index e2c63f4b6f066..2a8076d537eb4 100644 --- a/x-pack/plugins/encrypted_saved_objects/server/routes/key_rotation.ts +++ b/x-pack/plugins/encrypted_saved_objects/server/routes/key_rotation.ts @@ -6,7 +6,8 @@ */ import { schema } from '@kbn/config-schema'; -import { RouteDefinitionParams } from '.'; + +import type { RouteDefinitionParams } from './'; /** * The default maximum value of from + size for searches to .kibana index. Since we cannot use scroll diff --git a/x-pack/plugins/encrypted_saved_objects/server/saved_objects/encrypted_saved_objects_client_wrapper.test.ts b/x-pack/plugins/encrypted_saved_objects/server/saved_objects/encrypted_saved_objects_client_wrapper.test.ts index 474a283b5e3cb..76f5cb49c7f07 100644 --- a/x-pack/plugins/encrypted_saved_objects/server/saved_objects/encrypted_saved_objects_client_wrapper.test.ts +++ b/x-pack/plugins/encrypted_saved_objects/server/saved_objects/encrypted_saved_objects_client_wrapper.test.ts @@ -5,18 +5,19 @@ * 2.0. */ -import { EncryptionErrorOperation } from '../crypto/encryption_error'; -import { SavedObjectsClientContract } from 'src/core/server'; -import { EncryptedSavedObjectsService, EncryptionError } from '../crypto'; -import { EncryptedSavedObjectsClientWrapper } from './encrypted_saved_objects_client_wrapper'; - +import type { SavedObjectsClientContract } from 'src/core/server'; import { savedObjectsClientMock, savedObjectsTypeRegistryMock } from 'src/core/server/mocks'; + import { mockAuthenticatedUser } from '../../../security/common/model/authenticated_user.mock'; +import type { EncryptedSavedObjectsService } from '../crypto'; +import { EncryptionError } from '../crypto'; +import { EncryptionErrorOperation } from '../crypto/encryption_error'; import { encryptedSavedObjectsServiceMock } from '../crypto/index.mock'; +import { EncryptedSavedObjectsClientWrapper } from './encrypted_saved_objects_client_wrapper'; -jest.mock('../../../../../src/core/server/saved_objects/service/lib/utils', () => { +jest.mock('src/core/server/saved_objects/service/lib/utils', () => { const { SavedObjectsUtils } = jest.requireActual( - '../../../../../src/core/server/saved_objects/service/lib/utils' + 'src/core/server/saved_objects/service/lib/utils' ); return { SavedObjectsUtils: { diff --git a/x-pack/plugins/encrypted_saved_objects/server/saved_objects/encrypted_saved_objects_client_wrapper.ts b/x-pack/plugins/encrypted_saved_objects/server/saved_objects/encrypted_saved_objects_client_wrapper.ts index a602f3606e0a9..6b06f7e4e68e9 100644 --- a/x-pack/plugins/encrypted_saved_objects/server/saved_objects/encrypted_saved_objects_client_wrapper.ts +++ b/x-pack/plugins/encrypted_saved_objects/server/saved_objects/encrypted_saved_objects_client_wrapper.ts @@ -5,32 +5,33 @@ * 2.0. */ -import { +import type { + ISavedObjectTypeRegistry, SavedObject, + SavedObjectsAddToNamespacesOptions, SavedObjectsBaseOptions, SavedObjectsBulkCreateObject, SavedObjectsBulkGetObject, - SavedObjectsBulkUpdateObject, SavedObjectsBulkResponse, + SavedObjectsBulkUpdateObject, SavedObjectsBulkUpdateResponse, SavedObjectsCheckConflictsObject, SavedObjectsClientContract, SavedObjectsClosePointInTimeOptions, SavedObjectsCreateOptions, + SavedObjectsDeleteFromNamespacesOptions, SavedObjectsFindOptions, SavedObjectsFindResponse, SavedObjectsOpenPointInTimeOptions, - SavedObjectsUpdateOptions, - SavedObjectsUpdateResponse, - SavedObjectsAddToNamespacesOptions, - SavedObjectsDeleteFromNamespacesOptions, SavedObjectsRemoveReferencesToOptions, - ISavedObjectTypeRegistry, SavedObjectsRemoveReferencesToResponse, - SavedObjectsUtils, -} from '../../../../../src/core/server'; -import { AuthenticatedUser } from '../../../security/common/model'; -import { EncryptedSavedObjectsService } from '../crypto'; + SavedObjectsUpdateOptions, + SavedObjectsUpdateResponse, +} from 'src/core/server'; + +import { SavedObjectsUtils } from '../../../../../src/core/server'; +import type { AuthenticatedUser } from '../../../security/common/model'; +import type { EncryptedSavedObjectsService } from '../crypto'; import { getDescriptorNamespace } from './get_descriptor_namespace'; interface EncryptedSavedObjectsClientOptions { diff --git a/x-pack/plugins/encrypted_saved_objects/server/saved_objects/get_descriptor_namespace.test.ts b/x-pack/plugins/encrypted_saved_objects/server/saved_objects/get_descriptor_namespace.test.ts index 2899f044cdb9a..bb4ae1f59f02f 100644 --- a/x-pack/plugins/encrypted_saved_objects/server/saved_objects/get_descriptor_namespace.test.ts +++ b/x-pack/plugins/encrypted_saved_objects/server/saved_objects/get_descriptor_namespace.test.ts @@ -6,6 +6,7 @@ */ import { savedObjectsTypeRegistryMock } from 'src/core/server/mocks'; + import { getDescriptorNamespace } from './get_descriptor_namespace'; describe('getDescriptorNamespace', () => { diff --git a/x-pack/plugins/encrypted_saved_objects/server/saved_objects/get_descriptor_namespace.ts b/x-pack/plugins/encrypted_saved_objects/server/saved_objects/get_descriptor_namespace.ts index 0f737995e8d2a..4e01c516dc3af 100644 --- a/x-pack/plugins/encrypted_saved_objects/server/saved_objects/get_descriptor_namespace.ts +++ b/x-pack/plugins/encrypted_saved_objects/server/saved_objects/get_descriptor_namespace.ts @@ -5,7 +5,9 @@ * 2.0. */ -import { ISavedObjectTypeRegistry, SavedObjectsUtils } from '../../../../../src/core/server'; +import type { ISavedObjectTypeRegistry } from 'src/core/server'; + +import { SavedObjectsUtils } from '../../../../../src/core/server'; export const getDescriptorNamespace = ( typeRegistry: ISavedObjectTypeRegistry, diff --git a/x-pack/plugins/encrypted_saved_objects/server/saved_objects/index.test.ts b/x-pack/plugins/encrypted_saved_objects/server/saved_objects/index.test.ts index 2c29bb2bb8a9d..972292670d05f 100644 --- a/x-pack/plugins/encrypted_saved_objects/server/saved_objects/index.test.ts +++ b/x-pack/plugins/encrypted_saved_objects/server/saved_objects/index.test.ts @@ -5,24 +5,25 @@ * 2.0. */ -import { ClientInstanciator, setupSavedObjects } from '.'; - +import type { + ISavedObjectsRepository, + ISavedObjectTypeRegistry, + SavedObject, +} from 'src/core/server'; import { coreMock, httpServerMock, savedObjectsClientMock, savedObjectsRepositoryMock, savedObjectsTypeRegistryMock, -} from '../../../../../src/core/server/mocks'; +} from 'src/core/server/mocks'; + import { securityMock } from '../../../security/server/mocks'; +import type { EncryptedSavedObjectsService } from '../crypto'; import { encryptedSavedObjectsServiceMock } from '../crypto/index.mock'; +import type { ClientInstanciator } from './'; +import { setupSavedObjects } from './'; import { EncryptedSavedObjectsClientWrapper } from './encrypted_saved_objects_client_wrapper'; -import { - ISavedObjectsRepository, - ISavedObjectTypeRegistry, - SavedObject, -} from '../../../../../src/core/server'; -import { EncryptedSavedObjectsService } from '../crypto'; describe('#setupSavedObjects', () => { let setupContract: ClientInstanciator; diff --git a/x-pack/plugins/encrypted_saved_objects/server/saved_objects/index.ts b/x-pack/plugins/encrypted_saved_objects/server/saved_objects/index.ts index 9e7c1f6592290..1268113eb19bb 100644 --- a/x-pack/plugins/encrypted_saved_objects/server/saved_objects/index.ts +++ b/x-pack/plugins/encrypted_saved_objects/server/saved_objects/index.ts @@ -6,16 +6,17 @@ */ import type { PublicMethodsOf } from '@kbn/utility-types'; -import { - StartServicesAccessor, +import type { + ISavedObjectsRepository, + ISavedObjectTypeRegistry, SavedObject, SavedObjectsBaseOptions, SavedObjectsServiceSetup, - ISavedObjectsRepository, - ISavedObjectTypeRegistry, + StartServicesAccessor, } from 'src/core/server'; -import { SecurityPluginSetup } from '../../../security/server'; -import { EncryptedSavedObjectsService } from '../crypto'; + +import type { SecurityPluginSetup } from '../../../security/server'; +import type { EncryptedSavedObjectsService } from '../crypto'; import { EncryptedSavedObjectsClientWrapper } from './encrypted_saved_objects_client_wrapper'; import { getDescriptorNamespace, normalizeNamespace } from './get_descriptor_namespace'; diff --git a/x-pack/plugins/security/.eslintrc.json b/x-pack/plugins/security/.eslintrc.json new file mode 100644 index 0000000000000..2b63a9259d220 --- /dev/null +++ b/x-pack/plugins/security/.eslintrc.json @@ -0,0 +1,5 @@ +{ + "rules": { + "@typescript-eslint/consistent-type-imports": 1 + } +} diff --git a/x-pack/plugins/security/common/licensing/index.mock.ts b/x-pack/plugins/security/common/licensing/index.mock.ts index fec78d018a38b..319faa1a5b344 100644 --- a/x-pack/plugins/security/common/licensing/index.mock.ts +++ b/x-pack/plugins/security/common/licensing/index.mock.ts @@ -6,7 +6,9 @@ */ import { of } from 'rxjs'; -import { SecurityLicense, SecurityLicenseFeatures } from '.'; + +import type { SecurityLicenseFeatures } from './license_features'; +import type { SecurityLicense } from './license_service'; export const licenseMock = { create: (features?: Partial): jest.Mocked => ({ diff --git a/x-pack/plugins/security/common/licensing/license_service.test.ts b/x-pack/plugins/security/common/licensing/license_service.test.ts index 2daf4efbc99b9..cdc80c1a038f1 100644 --- a/x-pack/plugins/security/common/licensing/license_service.test.ts +++ b/x-pack/plugins/security/common/licensing/license_service.test.ts @@ -5,7 +5,8 @@ * 2.0. */ -import { of, BehaviorSubject } from 'rxjs'; +import { BehaviorSubject, of } from 'rxjs'; + import { licenseMock } from '../../../licensing/common/licensing.mock'; import { SecurityLicenseService } from './license_service'; diff --git a/x-pack/plugins/security/common/licensing/license_service.ts b/x-pack/plugins/security/common/licensing/license_service.ts index 106581f8b61c9..7bebf65b48205 100644 --- a/x-pack/plugins/security/common/licensing/license_service.ts +++ b/x-pack/plugins/security/common/licensing/license_service.ts @@ -5,10 +5,11 @@ * 2.0. */ -import { Observable, Subscription } from 'rxjs'; +import type { Observable, Subscription } from 'rxjs'; import { map } from 'rxjs/operators'; -import { ILicense, LicenseType } from '../../../licensing/common/types'; -import { SecurityLicenseFeatures } from './license_features'; + +import type { ILicense, LicenseType } from '../../../licensing/common/types'; +import type { SecurityLicenseFeatures } from './license_features'; export interface SecurityLicense { isLicenseAvailable(): boolean; diff --git a/x-pack/plugins/security/common/login_state.ts b/x-pack/plugins/security/common/login_state.ts index a156a782e10a4..fe2c6380db3ee 100644 --- a/x-pack/plugins/security/common/login_state.ts +++ b/x-pack/plugins/security/common/login_state.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { LoginLayout } from './licensing'; +import type { LoginLayout } from './licensing'; export interface LoginSelectorProvider { type: string; diff --git a/x-pack/plugins/security/common/model/authenticated_user.mock.ts b/x-pack/plugins/security/common/model/authenticated_user.mock.ts index 7357b7d49ac7f..3715245b37e61 100644 --- a/x-pack/plugins/security/common/model/authenticated_user.mock.ts +++ b/x-pack/plugins/security/common/model/authenticated_user.mock.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { AuthenticatedUser } from './authenticated_user'; +import type { AuthenticatedUser } from './authenticated_user'; export function mockAuthenticatedUser(user: Partial = {}) { return { diff --git a/x-pack/plugins/security/common/model/authenticated_user.test.ts b/x-pack/plugins/security/common/model/authenticated_user.test.ts index 4d2b6f71b4bfb..86a976daf7bf6 100644 --- a/x-pack/plugins/security/common/model/authenticated_user.test.ts +++ b/x-pack/plugins/security/common/model/authenticated_user.test.ts @@ -5,7 +5,8 @@ * 2.0. */ -import { AuthenticatedUser, canUserChangePassword } from './authenticated_user'; +import type { AuthenticatedUser } from './authenticated_user'; +import { canUserChangePassword } from './authenticated_user'; describe('#canUserChangePassword', () => { ['reserved', 'native'].forEach((realm) => { diff --git a/x-pack/plugins/security/common/model/authenticated_user.ts b/x-pack/plugins/security/common/model/authenticated_user.ts index 590a191db85c1..d9fabc25df5ed 100644 --- a/x-pack/plugins/security/common/model/authenticated_user.ts +++ b/x-pack/plugins/security/common/model/authenticated_user.ts @@ -5,7 +5,8 @@ * 2.0. */ -import type { AuthenticationProvider, User } from '.'; +import type { AuthenticationProvider } from './authentication_provider'; +import type { User } from './user'; const REALMS_ELIGIBLE_FOR_PASSWORD_CHANGE = ['reserved', 'native']; diff --git a/x-pack/plugins/security/common/model/role.test.ts b/x-pack/plugins/security/common/model/role.test.ts index da386b74fae8c..0d08c60ff7115 100644 --- a/x-pack/plugins/security/common/model/role.test.ts +++ b/x-pack/plugins/security/common/model/role.test.ts @@ -5,15 +5,15 @@ * 2.0. */ +import type { Role } from '../../common/model'; import { - Role, - isRoleEnabled, - isRoleReserved, + copyRole, + getExtendedRoleDeprecationNotice, isRoleDeprecated, + isRoleEnabled, isRoleReadOnly, - copyRole, + isRoleReserved, prepareRoleClone, - getExtendedRoleDeprecationNotice, } from '../../common/model'; describe('role', () => { diff --git a/x-pack/plugins/security/common/model/role.ts b/x-pack/plugins/security/common/model/role.ts index 4e86494771a76..31ff3cc484b8f 100644 --- a/x-pack/plugins/security/common/model/role.ts +++ b/x-pack/plugins/security/common/model/role.ts @@ -6,8 +6,10 @@ */ import { cloneDeep } from 'lodash'; + import { i18n } from '@kbn/i18n'; -import { FeaturesPrivileges } from './features_privileges'; + +import type { FeaturesPrivileges } from './features_privileges'; export interface RoleIndexPrivilege { names: string[]; diff --git a/x-pack/plugins/security/common/model/user.test.ts b/x-pack/plugins/security/common/model/user.test.ts index 8822b82dd25b5..1f04456fbecf8 100644 --- a/x-pack/plugins/security/common/model/user.test.ts +++ b/x-pack/plugins/security/common/model/user.test.ts @@ -5,7 +5,8 @@ * 2.0. */ -import { getUserDisplayName, User } from './user'; +import type { User } from './user'; +import { getUserDisplayName } from './user'; describe('#getUserDisplayName', () => { it(`uses the full name when available`, () => { diff --git a/x-pack/plugins/security/common/parse_next.ts b/x-pack/plugins/security/common/parse_next.ts index 1485f85ab8fcb..bf7bb3b070736 100644 --- a/x-pack/plugins/security/common/parse_next.ts +++ b/x-pack/plugins/security/common/parse_next.ts @@ -6,6 +6,7 @@ */ import { parse } from 'url'; + import { NEXT_URL_QUERY_STRING_PARAMETER } from './constants'; import { isInternalURL } from './is_internal_url'; diff --git a/x-pack/plugins/security/public/account_management/account_management_app.test.ts b/x-pack/plugins/security/public/account_management/account_management_app.test.ts index 5e9494ec203e9..2dfc7fac90a29 100644 --- a/x-pack/plugins/security/public/account_management/account_management_app.test.ts +++ b/x-pack/plugins/security/public/account_management/account_management_app.test.ts @@ -7,12 +7,13 @@ jest.mock('./account_management_page'); -import { AppMount, AppNavLinkStatus } from 'src/core/public'; -import { UserAPIClient } from '../management'; -import { accountManagementApp } from './account_management_app'; +import type { AppMount } from 'src/core/public'; +import { AppNavLinkStatus } from 'src/core/public'; +import { coreMock, scopedHistoryMock } from 'src/core/public/mocks'; -import { coreMock, scopedHistoryMock } from '../../../../../src/core/public/mocks'; +import { UserAPIClient } from '../management'; import { securityMock } from '../mocks'; +import { accountManagementApp } from './account_management_app'; describe('accountManagementApp', () => { it('properly registers application', () => { diff --git a/x-pack/plugins/security/public/account_management/account_management_app.ts b/x-pack/plugins/security/public/account_management/account_management_app.ts index fd43609d9c3c2..e94f8862f1e59 100644 --- a/x-pack/plugins/security/public/account_management/account_management_app.ts +++ b/x-pack/plugins/security/public/account_management/account_management_app.ts @@ -6,13 +6,10 @@ */ import { i18n } from '@kbn/i18n'; -import { - ApplicationSetup, - AppMountParameters, - AppNavLinkStatus, - StartServicesAccessor, -} from '../../../../../src/core/public'; -import { AuthenticationServiceSetup } from '../authentication'; +import type { ApplicationSetup, AppMountParameters, StartServicesAccessor } from 'src/core/public'; + +import { AppNavLinkStatus } from '../../../../../src/core/public'; +import type { AuthenticationServiceSetup } from '../authentication'; interface CreateDeps { application: ApplicationSetup; diff --git a/x-pack/plugins/security/public/account_management/account_management_page.test.tsx b/x-pack/plugins/security/public/account_management/account_management_page.test.tsx index a439de9dff279..d45ba91bb35fb 100644 --- a/x-pack/plugins/security/public/account_management/account_management_page.test.tsx +++ b/x-pack/plugins/security/public/account_management/account_management_page.test.tsx @@ -5,15 +5,17 @@ * 2.0. */ -import React from 'react'; import { act } from '@testing-library/react'; +import React from 'react'; + import { mountWithIntl, nextTick } from '@kbn/test/jest'; -import { AuthenticatedUser } from '../../common/model'; -import { AccountManagementPage } from './account_management_page'; import { coreMock } from 'src/core/public/mocks'; + +import type { AuthenticatedUser } from '../../common/model'; import { mockAuthenticatedUser } from '../../common/model/authenticated_user.mock'; -import { securityMock } from '../mocks'; import { userAPIClientMock } from '../management/users/index.mock'; +import { securityMock } from '../mocks'; +import { AccountManagementPage } from './account_management_page'; interface Options { withFullName?: boolean; diff --git a/x-pack/plugins/security/public/account_management/account_management_page.tsx b/x-pack/plugins/security/public/account_management/account_management_page.tsx index 6bf34f7dc2f29..c8fe80e254a46 100644 --- a/x-pack/plugins/security/public/account_management/account_management_page.tsx +++ b/x-pack/plugins/security/public/account_management/account_management_page.tsx @@ -5,14 +5,17 @@ * 2.0. */ +import { EuiPage, EuiPageBody, EuiPanel, EuiSpacer, EuiText } from '@elastic/eui'; import React, { useEffect, useState } from 'react'; import ReactDOM from 'react-dom'; -import { EuiPage, EuiPageBody, EuiPanel, EuiSpacer, EuiText } from '@elastic/eui'; + import type { PublicMethodsOf } from '@kbn/utility-types'; -import { CoreStart, NotificationsStart } from 'src/core/public'; -import { getUserDisplayName, AuthenticatedUser } from '../../common/model'; -import { AuthenticationServiceSetup } from '../authentication'; -import { UserAPIClient } from '../management'; +import type { CoreStart, NotificationsStart } from 'src/core/public'; + +import type { AuthenticatedUser } from '../../common/model'; +import { getUserDisplayName } from '../../common/model'; +import type { AuthenticationServiceSetup } from '../authentication'; +import type { UserAPIClient } from '../management'; import { ChangePassword } from './change_password'; import { PersonalInfo } from './personal_info'; diff --git a/x-pack/plugins/security/public/account_management/change_password/change_password.tsx b/x-pack/plugins/security/public/account_management/change_password/change_password.tsx index 4e252c343dc56..90d63d8b43bc7 100644 --- a/x-pack/plugins/security/public/account_management/change_password/change_password.tsx +++ b/x-pack/plugins/security/public/account_management/change_password/change_password.tsx @@ -5,13 +5,16 @@ * 2.0. */ -import React, { Component } from 'react'; import { EuiDescribedFormGroup } from '@elastic/eui'; +import React, { Component } from 'react'; + import { FormattedMessage } from '@kbn/i18n/react'; import type { PublicMethodsOf } from '@kbn/utility-types'; -import { NotificationsSetup } from 'src/core/public'; -import { AuthenticatedUser, canUserChangePassword } from '../../../common/model'; -import { UserAPIClient } from '../../management/users'; +import type { NotificationsSetup } from 'src/core/public'; + +import type { AuthenticatedUser } from '../../../common/model'; +import { canUserChangePassword } from '../../../common/model'; +import type { UserAPIClient } from '../../management/users'; import { ChangePasswordForm } from '../../management/users/components/change_password_form'; interface Props { diff --git a/x-pack/plugins/security/public/account_management/personal_info/personal_info.tsx b/x-pack/plugins/security/public/account_management/personal_info/personal_info.tsx index ebfdb52bdf2cf..e9de2b8a69bfa 100644 --- a/x-pack/plugins/security/public/account_management/personal_info/personal_info.tsx +++ b/x-pack/plugins/security/public/account_management/personal_info/personal_info.tsx @@ -5,10 +5,12 @@ * 2.0. */ -import React from 'react'; import { EuiDescribedFormGroup, EuiFormRow, EuiText } from '@elastic/eui'; +import React from 'react'; + import { FormattedMessage } from '@kbn/i18n/react'; -import { AuthenticatedUser } from '../../../common/model'; + +import type { AuthenticatedUser } from '../../../common/model'; interface Props { user: AuthenticatedUser; diff --git a/x-pack/plugins/security/public/authentication/access_agreement/access_agreement_app.test.ts b/x-pack/plugins/security/public/authentication/access_agreement/access_agreement_app.test.ts index 56e51dda39f1a..fc3565adf5caf 100644 --- a/x-pack/plugins/security/public/authentication/access_agreement/access_agreement_app.test.ts +++ b/x-pack/plugins/security/public/authentication/access_agreement/access_agreement_app.test.ts @@ -7,10 +7,10 @@ jest.mock('./access_agreement_page'); -import { AppMount } from 'src/core/public'; -import { accessAgreementApp } from './access_agreement_app'; +import type { AppMount } from 'src/core/public'; +import { coreMock, scopedHistoryMock } from 'src/core/public/mocks'; -import { coreMock, scopedHistoryMock } from '../../../../../../src/core/public/mocks'; +import { accessAgreementApp } from './access_agreement_app'; describe('accessAgreementApp', () => { it('properly registers application', () => { diff --git a/x-pack/plugins/security/public/authentication/access_agreement/access_agreement_app.ts b/x-pack/plugins/security/public/authentication/access_agreement/access_agreement_app.ts index f1466dbd95348..27da278b8fa89 100644 --- a/x-pack/plugins/security/public/authentication/access_agreement/access_agreement_app.ts +++ b/x-pack/plugins/security/public/authentication/access_agreement/access_agreement_app.ts @@ -6,7 +6,7 @@ */ import { i18n } from '@kbn/i18n'; -import { StartServicesAccessor, ApplicationSetup, AppMountParameters } from 'src/core/public'; +import type { ApplicationSetup, AppMountParameters, StartServicesAccessor } from 'src/core/public'; interface CreateDeps { application: ApplicationSetup; diff --git a/x-pack/plugins/security/public/authentication/access_agreement/access_agreement_page.test.tsx b/x-pack/plugins/security/public/authentication/access_agreement/access_agreement_page.test.tsx index 396747a93cd08..f6fcf36a12ee6 100644 --- a/x-pack/plugins/security/public/authentication/access_agreement/access_agreement_page.test.tsx +++ b/x-pack/plugins/security/public/authentication/access_agreement/access_agreement_page.test.tsx @@ -5,13 +5,14 @@ * 2.0. */ -import React from 'react'; -import ReactMarkdown from 'react-markdown'; import { EuiLoadingContent } from '@elastic/eui'; import { act } from '@testing-library/react'; -import { mountWithIntl, nextTick } from '@kbn/test/jest'; -import { findTestSubject } from '@kbn/test/jest'; -import { coreMock } from '../../../../../../src/core/public/mocks'; +import React from 'react'; +import ReactMarkdown from 'react-markdown'; + +import { findTestSubject, mountWithIntl, nextTick } from '@kbn/test/jest'; +import { coreMock } from 'src/core/public/mocks'; + import { AccessAgreementPage } from './access_agreement_page'; describe('AccessAgreementPage', () => { diff --git a/x-pack/plugins/security/public/authentication/access_agreement/access_agreement_page.tsx b/x-pack/plugins/security/public/authentication/access_agreement/access_agreement_page.tsx index 856dcf56b1d14..78f36bb460f47 100644 --- a/x-pack/plugins/security/public/authentication/access_agreement/access_agreement_page.tsx +++ b/x-pack/plugins/security/public/authentication/access_agreement/access_agreement_page.tsx @@ -7,21 +7,23 @@ import './access_agreement_page.scss'; -import React, { FormEvent, MouseEvent, useCallback, useEffect, useState } from 'react'; -import ReactDOM from 'react-dom'; -import ReactMarkdown from 'react-markdown'; import { EuiButton, - EuiPanel, EuiFlexGroup, EuiFlexItem, EuiLoadingContent, + EuiPanel, EuiSpacer, EuiText, } from '@elastic/eui'; +import type { FormEvent, MouseEvent } from 'react'; +import React, { useCallback, useEffect, useState } from 'react'; +import ReactDOM from 'react-dom'; +import ReactMarkdown from 'react-markdown'; + import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; -import { CoreStart, FatalErrorsStart, HttpStart, NotificationsStart } from 'src/core/public'; +import type { CoreStart, FatalErrorsStart, HttpStart, NotificationsStart } from 'src/core/public'; import { parseNext } from '../../../common/parse_next'; import { AuthenticationStatePage } from '../components'; diff --git a/x-pack/plugins/security/public/authentication/authentication_service.ts b/x-pack/plugins/security/public/authentication/authentication_service.ts index 1d677391961ea..4f0f69ac68886 100644 --- a/x-pack/plugins/security/public/authentication/authentication_service.ts +++ b/x-pack/plugins/security/public/authentication/authentication_service.ts @@ -5,21 +5,22 @@ * 2.0. */ -import { +import type { ApplicationSetup, - StartServicesAccessor, - HttpSetup, FatalErrorsSetup, + HttpSetup, + StartServicesAccessor, } from 'src/core/public'; -import { AuthenticatedUser } from '../../common/model'; -import { ConfigType } from '../config'; -import { PluginStartDependencies } from '../plugin'; + +import type { AuthenticatedUser } from '../../common/model'; +import type { ConfigType } from '../config'; +import type { PluginStartDependencies } from '../plugin'; import { accessAgreementApp } from './access_agreement'; +import { captureURLApp } from './capture_url'; +import { loggedOutApp } from './logged_out'; import { loginApp } from './login'; import { logoutApp } from './logout'; -import { loggedOutApp } from './logged_out'; import { overwrittenSessionApp } from './overwritten_session'; -import { captureURLApp } from './capture_url'; interface SetupParams { application: ApplicationSetup; diff --git a/x-pack/plugins/security/public/authentication/capture_url/capture_url_app.test.ts b/x-pack/plugins/security/public/authentication/capture_url/capture_url_app.test.ts index 87d6edcb8e8c7..bf68d9f7a6e5e 100644 --- a/x-pack/plugins/security/public/authentication/capture_url/capture_url_app.test.ts +++ b/x-pack/plugins/security/public/authentication/capture_url/capture_url_app.test.ts @@ -5,10 +5,10 @@ * 2.0. */ -import { AppMount, ScopedHistory } from 'src/core/public'; -import { captureURLApp } from './capture_url_app'; +import type { AppMount, ScopedHistory } from 'src/core/public'; +import { coreMock, scopedHistoryMock } from 'src/core/public/mocks'; -import { coreMock, scopedHistoryMock } from '../../../../../../src/core/public/mocks'; +import { captureURLApp } from './capture_url_app'; describe('captureURLApp', () => { beforeAll(() => { diff --git a/x-pack/plugins/security/public/authentication/capture_url/capture_url_app.ts b/x-pack/plugins/security/public/authentication/capture_url/capture_url_app.ts index 464c89f2a9e30..7797ce4e62102 100644 --- a/x-pack/plugins/security/public/authentication/capture_url/capture_url_app.ts +++ b/x-pack/plugins/security/public/authentication/capture_url/capture_url_app.ts @@ -6,7 +6,8 @@ */ import { parse } from 'url'; -import { ApplicationSetup, FatalErrorsSetup, HttpSetup } from 'src/core/public'; + +import type { ApplicationSetup, FatalErrorsSetup, HttpSetup } from 'src/core/public'; interface CreateDeps { application: ApplicationSetup; diff --git a/x-pack/plugins/security/public/authentication/components/authentication_state_page/authentication_state_page.test.tsx b/x-pack/plugins/security/public/authentication/components/authentication_state_page/authentication_state_page.test.tsx index 8caefdb2af237..eba918e072110 100644 --- a/x-pack/plugins/security/public/authentication/components/authentication_state_page/authentication_state_page.test.tsx +++ b/x-pack/plugins/security/public/authentication/components/authentication_state_page/authentication_state_page.test.tsx @@ -5,9 +5,11 @@ * 2.0. */ +import React from 'react'; + import { shallowWithIntl } from '@kbn/test/jest'; + import { AuthenticationStatePage } from './authentication_state_page'; -import React from 'react'; describe('AuthenticationStatePage', () => { it('renders', () => { diff --git a/x-pack/plugins/security/public/authentication/index.mock.ts b/x-pack/plugins/security/public/authentication/index.mock.ts index ac8bf9dfe9687..47c9dad012eae 100644 --- a/x-pack/plugins/security/public/authentication/index.mock.ts +++ b/x-pack/plugins/security/public/authentication/index.mock.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { AuthenticationServiceSetup } from './authentication_service'; +import type { AuthenticationServiceSetup } from './authentication_service'; export const authenticationMock = { createSetup: (): jest.Mocked => ({ diff --git a/x-pack/plugins/security/public/authentication/logged_out/logged_out_app.test.ts b/x-pack/plugins/security/public/authentication/logged_out/logged_out_app.test.ts index 94ee1542c2570..6c6071e9af7ee 100644 --- a/x-pack/plugins/security/public/authentication/logged_out/logged_out_app.test.ts +++ b/x-pack/plugins/security/public/authentication/logged_out/logged_out_app.test.ts @@ -7,10 +7,10 @@ jest.mock('./logged_out_page'); -import { AppMount } from 'src/core/public'; -import { loggedOutApp } from './logged_out_app'; +import type { AppMount } from 'src/core/public'; +import { coreMock, scopedHistoryMock } from 'src/core/public/mocks'; -import { coreMock, scopedHistoryMock } from '../../../../../../src/core/public/mocks'; +import { loggedOutApp } from './logged_out_app'; describe('loggedOutApp', () => { it('properly registers application', () => { diff --git a/x-pack/plugins/security/public/authentication/logged_out/logged_out_app.ts b/x-pack/plugins/security/public/authentication/logged_out/logged_out_app.ts index 4514c2bc3146f..962524de6d1f0 100644 --- a/x-pack/plugins/security/public/authentication/logged_out/logged_out_app.ts +++ b/x-pack/plugins/security/public/authentication/logged_out/logged_out_app.ts @@ -6,11 +6,11 @@ */ import { i18n } from '@kbn/i18n'; -import { - StartServicesAccessor, +import type { ApplicationSetup, AppMountParameters, HttpSetup, + StartServicesAccessor, } from 'src/core/public'; interface CreateDeps { diff --git a/x-pack/plugins/security/public/authentication/logged_out/logged_out_page.test.tsx b/x-pack/plugins/security/public/authentication/logged_out/logged_out_page.test.tsx index c8078190ccc23..8647edd2ba06a 100644 --- a/x-pack/plugins/security/public/authentication/logged_out/logged_out_page.test.tsx +++ b/x-pack/plugins/security/public/authentication/logged_out/logged_out_page.test.tsx @@ -5,12 +5,13 @@ * 2.0. */ -import React from 'react'; import { EuiButton } from '@elastic/eui'; +import React from 'react'; + import { mountWithIntl } from '@kbn/test/jest'; -import { LoggedOutPage } from './logged_out_page'; +import { coreMock } from 'src/core/public/mocks'; -import { coreMock } from '../../../../../../src/core/public/mocks'; +import { LoggedOutPage } from './logged_out_page'; describe('LoggedOutPage', () => { beforeAll(() => { diff --git a/x-pack/plugins/security/public/authentication/logged_out/logged_out_page.tsx b/x-pack/plugins/security/public/authentication/logged_out/logged_out_page.tsx index 9190c58a57c5e..477a41e248858 100644 --- a/x-pack/plugins/security/public/authentication/logged_out/logged_out_page.tsx +++ b/x-pack/plugins/security/public/authentication/logged_out/logged_out_page.tsx @@ -5,11 +5,13 @@ * 2.0. */ +import { EuiButton } from '@elastic/eui'; import React from 'react'; import ReactDOM from 'react-dom'; -import { EuiButton } from '@elastic/eui'; + import { FormattedMessage } from '@kbn/i18n/react'; -import { CoreStart, IBasePath } from 'src/core/public'; +import type { CoreStart, IBasePath } from 'src/core/public'; + import { parseNext } from '../../../common/parse_next'; import { AuthenticationStatePage } from '../components'; diff --git a/x-pack/plugins/security/public/authentication/login/components/disabled_login_form/disabled_login_form.test.tsx b/x-pack/plugins/security/public/authentication/login/components/disabled_login_form/disabled_login_form.test.tsx index d280d24c9f9ae..a347ebd0a3317 100644 --- a/x-pack/plugins/security/public/authentication/login/components/disabled_login_form/disabled_login_form.test.tsx +++ b/x-pack/plugins/security/public/authentication/login/components/disabled_login_form/disabled_login_form.test.tsx @@ -7,6 +7,7 @@ import { shallow } from 'enzyme'; import React from 'react'; + import { DisabledLoginForm } from './disabled_login_form'; describe('DisabledLoginForm', () => { diff --git a/x-pack/plugins/security/public/authentication/login/components/disabled_login_form/disabled_login_form.tsx b/x-pack/plugins/security/public/authentication/login/components/disabled_login_form/disabled_login_form.tsx index 723f7b2d2f50b..56913ef684cc4 100644 --- a/x-pack/plugins/security/public/authentication/login/components/disabled_login_form/disabled_login_form.tsx +++ b/x-pack/plugins/security/public/authentication/login/components/disabled_login_form/disabled_login_form.tsx @@ -6,7 +6,8 @@ */ import { EuiPanel, EuiText } from '@elastic/eui'; -import React, { ReactNode } from 'react'; +import type { ReactNode } from 'react'; +import React from 'react'; interface Props { title: ReactNode; diff --git a/x-pack/plugins/security/public/authentication/login/components/login_form/login_form.test.tsx b/x-pack/plugins/security/public/authentication/login/components/login_form/login_form.test.tsx index a29e307cf7807..f58150d4580b8 100644 --- a/x-pack/plugins/security/public/authentication/login/components/login_form/login_form.test.tsx +++ b/x-pack/plugins/security/public/authentication/login/components/login_form/login_form.test.tsx @@ -5,16 +5,16 @@ * 2.0. */ +import { EuiButton, EuiCallOut, EuiIcon } from '@elastic/eui'; +import { act } from '@testing-library/react'; +import type { ReactWrapper } from 'enzyme'; import React from 'react'; import ReactMarkdown from 'react-markdown'; -import { act } from '@testing-library/react'; -import { EuiButton, EuiCallOut, EuiIcon } from '@elastic/eui'; -import { mountWithIntl, nextTick, shallowWithIntl } from '@kbn/test/jest'; -import { findTestSubject } from '@kbn/test/jest'; -import { LoginForm, PageMode } from './login_form'; -import { coreMock } from '../../../../../../../../src/core/public/mocks'; -import { ReactWrapper } from 'enzyme'; +import { findTestSubject, mountWithIntl, nextTick, shallowWithIntl } from '@kbn/test/jest'; +import { coreMock } from 'src/core/public/mocks'; + +import { LoginForm, PageMode } from './login_form'; function expectPageMode(wrapper: ReactWrapper, mode: PageMode) { const assertions: Array<[string, boolean]> = diff --git a/x-pack/plugins/security/public/authentication/login/components/login_form/login_form.tsx b/x-pack/plugins/security/public/authentication/login/components/login_form/login_form.tsx index d621e0c3ebd09..ca573ada36d22 100644 --- a/x-pack/plugins/security/public/authentication/login/components/login_form/login_form.tsx +++ b/x-pack/plugins/security/public/authentication/login/components/login_form/login_form.tsx @@ -7,29 +7,32 @@ import './login_form.scss'; -import React, { ChangeEvent, Component, FormEvent, Fragment, MouseEvent } from 'react'; -import ReactMarkdown from 'react-markdown'; import { EuiButton, - EuiIcon, + EuiButtonEmpty, EuiCallOut, EuiFieldPassword, EuiFieldText, + EuiFlexGroup, + EuiFlexItem, EuiFormRow, + EuiHorizontalRule, + EuiIcon, + EuiLink, + EuiLoadingSpinner, EuiPanel, EuiSpacer, EuiText, - EuiButtonEmpty, - EuiFlexGroup, - EuiFlexItem, EuiTitle, - EuiLoadingSpinner, - EuiLink, - EuiHorizontalRule, } from '@elastic/eui'; +import type { ChangeEvent, FormEvent, MouseEvent } from 'react'; +import React, { Component, Fragment } from 'react'; +import ReactMarkdown from 'react-markdown'; + import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; -import { HttpStart, IHttpFetchError, NotificationsStart } from 'src/core/public'; +import type { HttpStart, IHttpFetchError, NotificationsStart } from 'src/core/public'; + import type { LoginSelector, LoginSelectorProvider } from '../../../../../common/login_state'; import { LoginValidator } from './validate_login'; diff --git a/x-pack/plugins/security/public/authentication/login/components/login_form/validate_login.test.ts b/x-pack/plugins/security/public/authentication/login/components/login_form/validate_login.test.ts index ad1e487201d46..a4aa810c30e14 100644 --- a/x-pack/plugins/security/public/authentication/login/components/login_form/validate_login.test.ts +++ b/x-pack/plugins/security/public/authentication/login/components/login_form/validate_login.test.ts @@ -5,7 +5,8 @@ * 2.0. */ -import { LoginValidator, LoginValidationResult } from './validate_login'; +import type { LoginValidationResult } from './validate_login'; +import { LoginValidator } from './validate_login'; function expectValid(result: LoginValidationResult) { expect(result.isInvalid).toBe(false); diff --git a/x-pack/plugins/security/public/authentication/login/login_app.test.ts b/x-pack/plugins/security/public/authentication/login/login_app.test.ts index 183132e147bcd..2ee759c99f740 100644 --- a/x-pack/plugins/security/public/authentication/login/login_app.test.ts +++ b/x-pack/plugins/security/public/authentication/login/login_app.test.ts @@ -7,10 +7,10 @@ jest.mock('./login_page'); -import { AppMount } from 'src/core/public'; -import { loginApp } from './login_app'; +import type { AppMount } from 'src/core/public'; +import { coreMock, scopedHistoryMock } from 'src/core/public/mocks'; -import { coreMock, scopedHistoryMock } from '../../../../../../src/core/public/mocks'; +import { loginApp } from './login_app'; describe('loginApp', () => { it('properly registers application', () => { diff --git a/x-pack/plugins/security/public/authentication/login/login_app.ts b/x-pack/plugins/security/public/authentication/login/login_app.ts index ccdaeb0feaaa5..21937e937ccf1 100644 --- a/x-pack/plugins/security/public/authentication/login/login_app.ts +++ b/x-pack/plugins/security/public/authentication/login/login_app.ts @@ -6,13 +6,14 @@ */ import { i18n } from '@kbn/i18n'; -import { - StartServicesAccessor, - AppMountParameters, +import type { ApplicationSetup, + AppMountParameters, HttpSetup, + StartServicesAccessor, } from 'src/core/public'; -import { ConfigType } from '../../config'; + +import type { ConfigType } from '../../config'; interface CreateDeps { application: ApplicationSetup; diff --git a/x-pack/plugins/security/public/authentication/login/login_page.test.tsx b/x-pack/plugins/security/public/authentication/login/login_page.test.tsx index 247fad2c8e441..a9596aff3bf0e 100644 --- a/x-pack/plugins/security/public/authentication/login/login_page.test.tsx +++ b/x-pack/plugins/security/public/authentication/login/login_page.test.tsx @@ -5,15 +5,17 @@ * 2.0. */ -import React from 'react'; -import { shallow } from 'enzyme'; import { act } from '@testing-library/react'; +import { shallow } from 'enzyme'; +import React from 'react'; + import { nextTick } from '@kbn/test/jest'; +import { coreMock } from 'src/core/public/mocks'; + import { AUTH_PROVIDER_HINT_QUERY_STRING_PARAMETER } from '../../../common/constants'; -import { LoginState } from '../../../common/login_state'; -import { LoginPage } from './login_page'; -import { coreMock } from '../../../../../../src/core/public/mocks'; +import type { LoginState } from '../../../common/login_state'; import { DisabledLoginForm, LoginForm } from './components'; +import { LoginPage } from './login_page'; const createLoginState = (options?: Partial) => { return { diff --git a/x-pack/plugins/security/public/authentication/login/login_page.tsx b/x-pack/plugins/security/public/authentication/login/login_page.tsx index 7dec637bbe577..562adec7918d3 100644 --- a/x-pack/plugins/security/public/authentication/login/login_page.tsx +++ b/x-pack/plugins/security/public/authentication/login/login_page.tsx @@ -7,21 +7,23 @@ import './login_page.scss'; +import { EuiFlexGroup, EuiFlexItem, EuiIcon, EuiSpacer, EuiTitle } from '@elastic/eui'; +import classNames from 'classnames'; import React, { Component } from 'react'; import ReactDOM from 'react-dom'; -import classNames from 'classnames'; import { BehaviorSubject } from 'rxjs'; import { parse } from 'url'; -import { EuiFlexGroup, EuiFlexItem, EuiIcon, EuiSpacer, EuiTitle } from '@elastic/eui'; + import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; -import { CoreStart, FatalErrorsStart, HttpStart, NotificationsStart } from 'src/core/public'; +import type { CoreStart, FatalErrorsStart, HttpStart, NotificationsStart } from 'src/core/public'; + import { AUTH_PROVIDER_HINT_QUERY_STRING_PARAMETER, LOGOUT_REASON_QUERY_STRING_PARAMETER, } from '../../../common/constants'; -import { LoginState } from '../../../common/login_state'; -import { LoginForm, DisabledLoginForm } from './components'; +import type { LoginState } from '../../../common/login_state'; +import { DisabledLoginForm, LoginForm } from './components'; interface Props { http: HttpStart; diff --git a/x-pack/plugins/security/public/authentication/logout/logout_app.test.ts b/x-pack/plugins/security/public/authentication/logout/logout_app.test.ts index 4b1dd087e5a65..8fcccdf916e93 100644 --- a/x-pack/plugins/security/public/authentication/logout/logout_app.test.ts +++ b/x-pack/plugins/security/public/authentication/logout/logout_app.test.ts @@ -5,10 +5,10 @@ * 2.0. */ -import { AppMount } from 'src/core/public'; -import { logoutApp } from './logout_app'; +import type { AppMount } from 'src/core/public'; +import { coreMock, scopedHistoryMock } from 'src/core/public/mocks'; -import { coreMock, scopedHistoryMock } from '../../../../../../src/core/public/mocks'; +import { logoutApp } from './logout_app'; describe('logoutApp', () => { beforeAll(() => { diff --git a/x-pack/plugins/security/public/authentication/logout/logout_app.ts b/x-pack/plugins/security/public/authentication/logout/logout_app.ts index a9ab7b631d0d7..84fc510e96ced 100644 --- a/x-pack/plugins/security/public/authentication/logout/logout_app.ts +++ b/x-pack/plugins/security/public/authentication/logout/logout_app.ts @@ -6,7 +6,7 @@ */ import { i18n } from '@kbn/i18n'; -import { CoreSetup, HttpSetup } from 'src/core/public'; +import type { CoreSetup, HttpSetup } from 'src/core/public'; interface CreateDeps { application: CoreSetup['application']; diff --git a/x-pack/plugins/security/public/authentication/overwritten_session/overwritten_session_app.test.ts b/x-pack/plugins/security/public/authentication/overwritten_session/overwritten_session_app.test.ts index 211d9dd4f956b..9ea6293612968 100644 --- a/x-pack/plugins/security/public/authentication/overwritten_session/overwritten_session_app.test.ts +++ b/x-pack/plugins/security/public/authentication/overwritten_session/overwritten_session_app.test.ts @@ -7,11 +7,11 @@ jest.mock('./overwritten_session_page'); -import { AppMount } from 'src/core/public'; -import { overwrittenSessionApp } from './overwritten_session_app'; +import type { AppMount } from 'src/core/public'; +import { coreMock, scopedHistoryMock } from 'src/core/public/mocks'; -import { coreMock, scopedHistoryMock } from '../../../../../../src/core/public/mocks'; import { securityMock } from '../../mocks'; +import { overwrittenSessionApp } from './overwritten_session_app'; describe('overwrittenSessionApp', () => { it('properly registers application', () => { diff --git a/x-pack/plugins/security/public/authentication/overwritten_session/overwritten_session_app.ts b/x-pack/plugins/security/public/authentication/overwritten_session/overwritten_session_app.ts index b4d3e5da4eab0..715d732cd47e7 100644 --- a/x-pack/plugins/security/public/authentication/overwritten_session/overwritten_session_app.ts +++ b/x-pack/plugins/security/public/authentication/overwritten_session/overwritten_session_app.ts @@ -6,8 +6,9 @@ */ import { i18n } from '@kbn/i18n'; -import { StartServicesAccessor, ApplicationSetup, AppMountParameters } from 'src/core/public'; -import { AuthenticationServiceSetup } from '../authentication_service'; +import type { ApplicationSetup, AppMountParameters, StartServicesAccessor } from 'src/core/public'; + +import type { AuthenticationServiceSetup } from '../authentication_service'; interface CreateDeps { application: ApplicationSetup; diff --git a/x-pack/plugins/security/public/authentication/overwritten_session/overwritten_session_page.test.tsx b/x-pack/plugins/security/public/authentication/overwritten_session/overwritten_session_page.test.tsx index 962157431d6fe..42915e841b3a7 100644 --- a/x-pack/plugins/security/public/authentication/overwritten_session/overwritten_session_page.test.tsx +++ b/x-pack/plugins/security/public/authentication/overwritten_session/overwritten_session_page.test.tsx @@ -5,16 +5,17 @@ * 2.0. */ -import React from 'react'; import { EuiButton } from '@elastic/eui'; import { act } from '@testing-library/react'; +import React from 'react'; + import { mountWithIntl, nextTick } from '@kbn/test/jest'; -import { OverwrittenSessionPage } from './overwritten_session_page'; +import { coreMock } from 'src/core/public/mocks'; -import { coreMock } from '../../../../../../src/core/public/mocks'; -import { authenticationMock } from '../index.mock'; import { mockAuthenticatedUser } from '../../../common/model/authenticated_user.mock'; import { AuthenticationStatePage } from '../components/authentication_state_page'; +import { authenticationMock } from '../index.mock'; +import { OverwrittenSessionPage } from './overwritten_session_page'; describe('OverwrittenSessionPage', () => { beforeAll(() => { diff --git a/x-pack/plugins/security/public/authentication/overwritten_session/overwritten_session_page.tsx b/x-pack/plugins/security/public/authentication/overwritten_session/overwritten_session_page.tsx index c7127a69a38fb..4d9d62bb7c65f 100644 --- a/x-pack/plugins/security/public/authentication/overwritten_session/overwritten_session_page.tsx +++ b/x-pack/plugins/security/public/authentication/overwritten_session/overwritten_session_page.tsx @@ -5,13 +5,15 @@ * 2.0. */ +import { EuiButton } from '@elastic/eui'; import React, { useEffect, useState } from 'react'; import ReactDOM from 'react-dom'; -import { EuiButton } from '@elastic/eui'; + import { FormattedMessage } from '@kbn/i18n/react'; -import { CoreStart, IBasePath } from 'src/core/public'; +import type { CoreStart, IBasePath } from 'src/core/public'; + import { parseNext } from '../../../common/parse_next'; -import { AuthenticationServiceSetup } from '../authentication_service'; +import type { AuthenticationServiceSetup } from '../authentication_service'; import { AuthenticationStatePage } from '../components'; interface Props { diff --git a/x-pack/plugins/security/public/components/breadcrumb.tsx b/x-pack/plugins/security/public/components/breadcrumb.tsx index e713aecf46fd5..4462e2bce6abc 100644 --- a/x-pack/plugins/security/public/components/breadcrumb.tsx +++ b/x-pack/plugins/security/public/components/breadcrumb.tsx @@ -5,8 +5,10 @@ * 2.0. */ -import React, { createContext, useEffect, useRef, useContext, FunctionComponent } from 'react'; -import { EuiBreadcrumb } from '@elastic/eui'; +import type { EuiBreadcrumb } from '@elastic/eui'; +import type { FunctionComponent } from 'react'; +import React, { createContext, useContext, useEffect, useRef } from 'react'; + import { useKibana } from '../../../../../src/plugins/kibana_react/public'; interface BreadcrumbsContext { diff --git a/x-pack/plugins/security/public/components/confirm_modal.tsx b/x-pack/plugins/security/public/components/confirm_modal.tsx index 3802ee368d735..80c2008642d04 100644 --- a/x-pack/plugins/security/public/components/confirm_modal.tsx +++ b/x-pack/plugins/security/public/components/confirm_modal.tsx @@ -5,10 +5,9 @@ * 2.0. */ -import React, { FunctionComponent } from 'react'; +import type { EuiButtonProps, EuiModalProps } from '@elastic/eui'; import { EuiButton, - EuiButtonProps, EuiButtonEmpty, EuiFlexGroup, EuiFlexItem, @@ -17,8 +16,10 @@ import { EuiModalFooter, EuiModalHeader, EuiModalHeaderTitle, - EuiModalProps, } from '@elastic/eui'; +import type { FunctionComponent } from 'react'; +import React from 'react'; + import { FormattedMessage } from '@kbn/i18n/react'; export interface ConfirmModalProps extends Omit { diff --git a/x-pack/plugins/security/public/components/doc_link.tsx b/x-pack/plugins/security/public/components/doc_link.tsx index 569fe559ea1f1..b19883f6e58d7 100644 --- a/x-pack/plugins/security/public/components/doc_link.tsx +++ b/x-pack/plugins/security/public/components/doc_link.tsx @@ -5,10 +5,13 @@ * 2.0. */ -import React, { useCallback, FunctionComponent } from 'react'; import { EuiLink } from '@elastic/eui'; +import type { FunctionComponent } from 'react'; +import React, { useCallback } from 'react'; + +import type { CoreStart } from 'src/core/public'; + import { useKibana } from '../../../../../src/plugins/kibana_react/public'; -import { CoreStart } from '../../../../../src/core/public'; export type DocLinks = CoreStart['docLinks']['links']; export type GetDocLinkFunction = (app: string, doc: string) => string; diff --git a/x-pack/plugins/security/public/components/form_flyout.tsx b/x-pack/plugins/security/public/components/form_flyout.tsx index ba440befba0be..2af210b339320 100644 --- a/x-pack/plugins/security/public/components/form_flyout.tsx +++ b/x-pack/plugins/security/public/components/form_flyout.tsx @@ -5,22 +5,24 @@ * 2.0. */ -import React, { useEffect, FunctionComponent, RefObject } from 'react'; -import { FormattedMessage } from '@kbn/i18n/react'; +import type { EuiButtonProps, EuiFlyoutProps } from '@elastic/eui'; import { - EuiTitle, + EuiButton, + EuiButtonEmpty, + EuiFlexGroup, + EuiFlexItem, EuiFlyout, - EuiFlyoutProps, - EuiFlyoutHeader, EuiFlyoutBody, EuiFlyoutFooter, - EuiFlexGroup, - EuiFlexItem, - EuiButton, - EuiButtonProps, - EuiButtonEmpty, + EuiFlyoutHeader, EuiPortal, + EuiTitle, } from '@elastic/eui'; +import type { FunctionComponent, RefObject } from 'react'; +import React, { useEffect } from 'react'; + +import { FormattedMessage } from '@kbn/i18n/react'; + import { useHtmlId } from './use_html_id'; export interface FormFlyoutProps extends Omit { diff --git a/x-pack/plugins/security/public/components/use_current_user.ts b/x-pack/plugins/security/public/components/use_current_user.ts index e4fd021245b08..103952d7d34ef 100644 --- a/x-pack/plugins/security/public/components/use_current_user.ts +++ b/x-pack/plugins/security/public/components/use_current_user.ts @@ -5,9 +5,10 @@ * 2.0. */ -import useAsync from 'react-use/lib/useAsync'; import constate from 'constate'; -import { AuthenticationServiceSetup } from '../authentication'; +import useAsync from 'react-use/lib/useAsync'; + +import type { AuthenticationServiceSetup } from '../authentication'; export interface AuthenticationProviderProps { authc: AuthenticationServiceSetup; diff --git a/x-pack/plugins/security/public/components/use_form.ts b/x-pack/plugins/security/public/components/use_form.ts index 8be332466ee29..2b42fda5ba561 100644 --- a/x-pack/plugins/security/public/components/use_form.ts +++ b/x-pack/plugins/security/public/components/use_form.ts @@ -5,8 +5,9 @@ * 2.0. */ -import { ChangeEventHandler, FocusEventHandler, ReactEventHandler, useState } from 'react'; -import { get, set, cloneDeep, cloneDeepWith } from 'lodash'; +import { cloneDeep, cloneDeepWith, get, set } from 'lodash'; +import type { ChangeEventHandler, FocusEventHandler, ReactEventHandler } from 'react'; +import { useState } from 'react'; import useAsyncFn from 'react-use/lib/useAsyncFn'; export type FormReturnTuple = [FormState, FormProps]; diff --git a/x-pack/plugins/security/public/components/use_html_id.ts b/x-pack/plugins/security/public/components/use_html_id.ts index d31e01c822b89..97f56becbbdd6 100644 --- a/x-pack/plugins/security/public/components/use_html_id.ts +++ b/x-pack/plugins/security/public/components/use_html_id.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { useMemo } from 'react'; import { htmlIdGenerator } from '@elastic/eui'; +import { useMemo } from 'react'; /** * Generates an ID that can be used for HTML elements. diff --git a/x-pack/plugins/security/public/index.ts b/x-pack/plugins/security/public/index.ts index 5d508fb9e9a43..df074ab616369 100644 --- a/x-pack/plugins/security/public/index.ts +++ b/x-pack/plugins/security/public/index.ts @@ -5,14 +5,10 @@ * 2.0. */ -import { PluginInitializer, PluginInitializerContext } from 'src/core/public'; -import { - SecurityPlugin, - SecurityPluginSetup, - SecurityPluginStart, - PluginSetupDependencies, - PluginStartDependencies, -} from './plugin'; +import type { PluginInitializer, PluginInitializerContext } from 'src/core/public'; + +import type { PluginSetupDependencies, PluginStartDependencies } from './plugin'; +import { SecurityPlugin, SecurityPluginSetup, SecurityPluginStart } from './plugin'; export { SecurityPluginSetup, SecurityPluginStart }; export { AuthenticatedUser } from '../common/model'; diff --git a/x-pack/plugins/security/public/management/api_keys/api_keys_api_client.test.ts b/x-pack/plugins/security/public/management/api_keys/api_keys_api_client.test.ts index 1d1fc2b1afc2d..8c79ee5bb0be5 100644 --- a/x-pack/plugins/security/public/management/api_keys/api_keys_api_client.test.ts +++ b/x-pack/plugins/security/public/management/api_keys/api_keys_api_client.test.ts @@ -5,9 +5,9 @@ * 2.0. */ -import { APIKeysAPIClient } from './api_keys_api_client'; +import { httpServiceMock } from 'src/core/public/mocks'; -import { httpServiceMock } from '../../../../../../src/core/public/mocks'; +import { APIKeysAPIClient } from './api_keys_api_client'; describe('APIKeysAPIClient', () => { it('checkPrivileges() queries correct endpoint', async () => { diff --git a/x-pack/plugins/security/public/management/api_keys/api_keys_api_client.ts b/x-pack/plugins/security/public/management/api_keys/api_keys_api_client.ts index 52ec2eb68082e..318837f091327 100644 --- a/x-pack/plugins/security/public/management/api_keys/api_keys_api_client.ts +++ b/x-pack/plugins/security/public/management/api_keys/api_keys_api_client.ts @@ -5,8 +5,9 @@ * 2.0. */ -import { HttpStart } from 'src/core/public'; -import { ApiKey, ApiKeyToInvalidate } from '../../../common/model'; +import type { HttpStart } from 'src/core/public'; + +import type { ApiKey, ApiKeyToInvalidate } from '../../../common/model'; interface CheckPrivilegesResponse { areApiKeysEnabled: boolean; diff --git a/x-pack/plugins/security/public/management/api_keys/api_keys_grid/api_keys_grid_page.test.tsx b/x-pack/plugins/security/public/management/api_keys/api_keys_grid/api_keys_grid_page.test.tsx index b1e71322e4d3c..ff9fbad5c05b5 100644 --- a/x-pack/plugins/security/public/management/api_keys/api_keys_grid/api_keys_grid_page.test.tsx +++ b/x-pack/plugins/security/public/management/api_keys/api_keys_grid/api_keys_grid_page.test.tsx @@ -5,20 +5,20 @@ * 2.0. */ -import { mountWithIntl } from '@kbn/test/jest'; -import React from 'react'; -import { ReactWrapper } from 'enzyme'; import { EuiCallOut } from '@elastic/eui'; +import type { ReactWrapper } from 'enzyme'; +import React from 'react'; + +import { mountWithIntl } from '@kbn/test/jest'; import type { PublicMethodsOf } from '@kbn/utility-types'; +import { coreMock } from 'src/core/public/mocks'; +import { KibanaContextProvider } from 'src/plugins/kibana_react/public'; -import { KibanaContextProvider } from '../../../../../../../src/plugins/kibana_react/public'; +import type { APIKeysAPIClient } from '../api_keys_api_client'; +import { apiKeysAPIClientMock } from '../index.mock'; +import { APIKeysGridPage } from './api_keys_grid_page'; import { NotEnabled } from './not_enabled'; import { PermissionDenied } from './permission_denied'; -import { APIKeysAPIClient } from '../api_keys_api_client'; -import { APIKeysGridPage } from './api_keys_grid_page'; - -import { coreMock } from '../../../../../../../src/core/public/mocks'; -import { apiKeysAPIClientMock } from '../index.mock'; const mock500 = () => ({ body: { error: 'Internal Server Error', message: '', statusCode: 500 } }); diff --git a/x-pack/plugins/security/public/management/api_keys/api_keys_grid/api_keys_grid_page.tsx b/x-pack/plugins/security/public/management/api_keys/api_keys_grid/api_keys_grid_page.tsx index 8992e75389fd8..62ca51be2ede8 100644 --- a/x-pack/plugins/security/public/management/api_keys/api_keys_grid/api_keys_grid_page.tsx +++ b/x-pack/plugins/security/public/management/api_keys/api_keys_grid/api_keys_grid_page.tsx @@ -5,10 +5,9 @@ * 2.0. */ -import React, { Component } from 'react'; +import type { EuiBasicTableColumn, EuiInMemoryTableProps } from '@elastic/eui'; import { EuiBadge, - EuiBasicTableColumn, EuiButton, EuiButtonIcon, EuiCallOut, @@ -23,20 +22,22 @@ import { EuiText, EuiTitle, EuiToolTip, - EuiInMemoryTableProps, } from '@elastic/eui'; +import moment from 'moment-timezone'; +import React, { Component } from 'react'; + import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import type { PublicMethodsOf } from '@kbn/utility-types'; -import moment from 'moment-timezone'; import type { NotificationsStart } from 'src/core/public'; + import { SectionLoading } from '../../../../../../../src/plugins/es_ui_shared/public'; -import { ApiKey, ApiKeyToInvalidate } from '../../../../common/model'; -import { APIKeysAPIClient } from '../api_keys_api_client'; -import { PermissionDenied } from './permission_denied'; +import type { ApiKey, ApiKeyToInvalidate } from '../../../../common/model'; +import type { APIKeysAPIClient } from '../api_keys_api_client'; import { EmptyPrompt } from './empty_prompt'; -import { NotEnabled } from './not_enabled'; import { InvalidateProvider } from './invalidate_provider'; +import { NotEnabled } from './not_enabled'; +import { PermissionDenied } from './permission_denied'; interface Props { notifications: NotificationsStart; diff --git a/x-pack/plugins/security/public/management/api_keys/api_keys_grid/empty_prompt/empty_prompt.tsx b/x-pack/plugins/security/public/management/api_keys/api_keys_grid/empty_prompt/empty_prompt.tsx index 627717a20ee0b..0987f43a3d14d 100644 --- a/x-pack/plugins/security/public/management/api_keys/api_keys_grid/empty_prompt/empty_prompt.tsx +++ b/x-pack/plugins/security/public/management/api_keys/api_keys_grid/empty_prompt/empty_prompt.tsx @@ -5,10 +5,11 @@ * 2.0. */ +import { EuiButton, EuiEmptyPrompt, EuiLink } from '@elastic/eui'; import React, { Fragment } from 'react'; -import { EuiEmptyPrompt, EuiButton, EuiLink } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; + import { useKibana } from '../../../../../../../../src/plugins/kibana_react/public'; interface Props { diff --git a/x-pack/plugins/security/public/management/api_keys/api_keys_grid/invalidate_provider/invalidate_provider.tsx b/x-pack/plugins/security/public/management/api_keys/api_keys_grid/invalidate_provider/invalidate_provider.tsx index 232847b63cb1a..a68534db4fd85 100644 --- a/x-pack/plugins/security/public/management/api_keys/api_keys_grid/invalidate_provider/invalidate_provider.tsx +++ b/x-pack/plugins/security/public/management/api_keys/api_keys_grid/invalidate_provider/invalidate_provider.tsx @@ -5,13 +5,15 @@ * 2.0. */ -import React, { Fragment, useRef, useState } from 'react'; import { EuiConfirmModal } from '@elastic/eui'; -import type { PublicMethodsOf } from '@kbn/utility-types'; +import React, { Fragment, useRef, useState } from 'react'; + import { i18n } from '@kbn/i18n'; -import { NotificationsStart } from 'src/core/public'; -import { ApiKeyToInvalidate } from '../../../../../common/model'; -import { APIKeysAPIClient } from '../../api_keys_api_client'; +import type { PublicMethodsOf } from '@kbn/utility-types'; +import type { NotificationsStart } from 'src/core/public'; + +import type { ApiKeyToInvalidate } from '../../../../../common/model'; +import type { APIKeysAPIClient } from '../../api_keys_api_client'; interface Props { isAdmin: boolean; diff --git a/x-pack/plugins/security/public/management/api_keys/api_keys_grid/not_enabled/not_enabled.tsx b/x-pack/plugins/security/public/management/api_keys/api_keys_grid/not_enabled/not_enabled.tsx index 5da06d514bb24..cd74c0de4dfcf 100644 --- a/x-pack/plugins/security/public/management/api_keys/api_keys_grid/not_enabled/not_enabled.tsx +++ b/x-pack/plugins/security/public/management/api_keys/api_keys_grid/not_enabled/not_enabled.tsx @@ -5,9 +5,11 @@ * 2.0. */ -import React from 'react'; import { EuiCallOut, EuiLink } from '@elastic/eui'; +import React from 'react'; + import { FormattedMessage } from '@kbn/i18n/react'; + import { useKibana } from '../../../../../../../../src/plugins/kibana_react/public'; export const NotEnabled: React.FunctionComponent = () => { diff --git a/x-pack/plugins/security/public/management/api_keys/api_keys_grid/permission_denied/permission_denied.tsx b/x-pack/plugins/security/public/management/api_keys/api_keys_grid/permission_denied/permission_denied.tsx index 9d94ab117fbce..de97de0516e20 100644 --- a/x-pack/plugins/security/public/management/api_keys/api_keys_grid/permission_denied/permission_denied.tsx +++ b/x-pack/plugins/security/public/management/api_keys/api_keys_grid/permission_denied/permission_denied.tsx @@ -6,9 +6,10 @@ */ import { EuiEmptyPrompt, EuiFlexGroup, EuiPageContent } from '@elastic/eui'; -import { FormattedMessage } from '@kbn/i18n/react'; import React from 'react'; +import { FormattedMessage } from '@kbn/i18n/react'; + export const PermissionDenied = () => ( diff --git a/x-pack/plugins/security/public/management/api_keys/api_keys_management_app.test.tsx b/x-pack/plugins/security/public/management/api_keys/api_keys_management_app.test.tsx index ee69fa745f40c..d9bbc8bb74418 100644 --- a/x-pack/plugins/security/public/management/api_keys/api_keys_management_app.test.tsx +++ b/x-pack/plugins/security/public/management/api_keys/api_keys_management_app.test.tsx @@ -8,8 +8,9 @@ jest.mock('./api_keys_grid', () => ({ APIKeysGridPage: (props: any) => `Page: ${JSON.stringify(props)}`, })); +import { coreMock, scopedHistoryMock } from 'src/core/public/mocks'; + import { apiKeysManagementApp } from './api_keys_management_app'; -import { coreMock, scopedHistoryMock } from '../../../../../../src/core/public/mocks'; describe('apiKeysManagementApp', () => { it('create() returns proper management app descriptor', () => { diff --git a/x-pack/plugins/security/public/management/api_keys/api_keys_management_app.tsx b/x-pack/plugins/security/public/management/api_keys/api_keys_management_app.tsx index ca9f208f20c34..d36a0da0aee2d 100644 --- a/x-pack/plugins/security/public/management/api_keys/api_keys_management_app.tsx +++ b/x-pack/plugins/security/public/management/api_keys/api_keys_management_app.tsx @@ -7,11 +7,13 @@ import React from 'react'; import { render, unmountComponentAtNode } from 'react-dom'; + import { i18n } from '@kbn/i18n'; -import { StartServicesAccessor } from 'src/core/public'; -import { RegisterManagementAppArgs } from '../../../../../../src/plugins/management/public'; +import type { StartServicesAccessor } from 'src/core/public'; +import type { RegisterManagementAppArgs } from 'src/plugins/management/public'; + import { KibanaContextProvider } from '../../../../../../src/plugins/kibana_react/public'; -import { PluginStartDependencies } from '../../plugin'; +import type { PluginStartDependencies } from '../../plugin'; interface CreateParams { getStartServices: StartServicesAccessor; diff --git a/x-pack/plugins/security/public/management/badges/deprecated_badge.tsx b/x-pack/plugins/security/public/management/badges/deprecated_badge.tsx index c60bd5f8b1b39..471f4f1f9b31b 100644 --- a/x-pack/plugins/security/public/management/badges/deprecated_badge.tsx +++ b/x-pack/plugins/security/public/management/badges/deprecated_badge.tsx @@ -5,9 +5,12 @@ * 2.0. */ +import type { EuiToolTipProps } from '@elastic/eui'; +import { EuiBadge } from '@elastic/eui'; import React from 'react'; + import { FormattedMessage } from '@kbn/i18n/react'; -import { EuiBadge, EuiToolTipProps } from '@elastic/eui'; + import { OptionalToolTip } from './optional_tooltip'; interface Props { diff --git a/x-pack/plugins/security/public/management/badges/disabled_badge.tsx b/x-pack/plugins/security/public/management/badges/disabled_badge.tsx index f9612e9d2bb30..133baa3a6b2f1 100644 --- a/x-pack/plugins/security/public/management/badges/disabled_badge.tsx +++ b/x-pack/plugins/security/public/management/badges/disabled_badge.tsx @@ -5,9 +5,12 @@ * 2.0. */ +import type { EuiToolTipProps } from '@elastic/eui'; +import { EuiBadge } from '@elastic/eui'; import React from 'react'; + import { FormattedMessage } from '@kbn/i18n/react'; -import { EuiBadge, EuiToolTipProps } from '@elastic/eui'; + import { OptionalToolTip } from './optional_tooltip'; interface Props { diff --git a/x-pack/plugins/security/public/management/badges/enabled_badge.tsx b/x-pack/plugins/security/public/management/badges/enabled_badge.tsx index 0f7f74a7b38f8..f55914997c72e 100644 --- a/x-pack/plugins/security/public/management/badges/enabled_badge.tsx +++ b/x-pack/plugins/security/public/management/badges/enabled_badge.tsx @@ -5,9 +5,12 @@ * 2.0. */ +import type { EuiToolTipProps } from '@elastic/eui'; +import { EuiBadge } from '@elastic/eui'; import React from 'react'; + import { FormattedMessage } from '@kbn/i18n/react'; -import { EuiBadge, EuiToolTipProps } from '@elastic/eui'; + import { OptionalToolTip } from './optional_tooltip'; interface Props { diff --git a/x-pack/plugins/security/public/management/badges/optional_tooltip.tsx b/x-pack/plugins/security/public/management/badges/optional_tooltip.tsx index 060560587eac2..9e53e50a45910 100644 --- a/x-pack/plugins/security/public/management/badges/optional_tooltip.tsx +++ b/x-pack/plugins/security/public/management/badges/optional_tooltip.tsx @@ -5,8 +5,10 @@ * 2.0. */ -import React, { ReactElement } from 'react'; -import { EuiToolTipProps, EuiToolTip } from '@elastic/eui'; +import type { EuiToolTipProps } from '@elastic/eui'; +import { EuiToolTip } from '@elastic/eui'; +import type { ReactElement } from 'react'; +import React from 'react'; interface Props { children: ReactElement; diff --git a/x-pack/plugins/security/public/management/badges/reserved_badge.tsx b/x-pack/plugins/security/public/management/badges/reserved_badge.tsx index 5b09f88c6151d..9ad0c718a5612 100644 --- a/x-pack/plugins/security/public/management/badges/reserved_badge.tsx +++ b/x-pack/plugins/security/public/management/badges/reserved_badge.tsx @@ -5,9 +5,12 @@ * 2.0. */ +import type { EuiToolTipProps } from '@elastic/eui'; +import { EuiBadge } from '@elastic/eui'; import React from 'react'; + import { FormattedMessage } from '@kbn/i18n/react'; -import { EuiBadge, EuiToolTipProps } from '@elastic/eui'; + import { OptionalToolTip } from './optional_tooltip'; interface Props { diff --git a/x-pack/plugins/security/public/management/management_service.test.ts b/x-pack/plugins/security/public/management/management_service.test.ts index 9b316993a37f0..694f3cc3880a2 100644 --- a/x-pack/plugins/security/public/management/management_service.test.ts +++ b/x-pack/plugins/security/public/management/management_service.test.ts @@ -6,22 +6,23 @@ */ import { BehaviorSubject } from 'rxjs'; -import { + +import { coreMock } from 'src/core/public/mocks'; +import type { + DefinedSections, ManagementApp, ManagementSetup, - DefinedSections, -} from '../../../../../src/plugins/management/public'; -import { createManagementSectionMock } from '../../../../../src/plugins/management/public/mocks'; -import { SecurityLicenseFeatures } from '../../common/licensing/license_features'; -import { ManagementService } from './management_service'; -import { usersManagementApp } from './users'; +} from 'src/plugins/management/public'; +import { createManagementSectionMock } from 'src/plugins/management/public/mocks'; -import { coreMock } from '../../../../../src/core/public/mocks'; import { licenseMock } from '../../common/licensing/index.mock'; +import type { SecurityLicenseFeatures } from '../../common/licensing/license_features'; import { securityMock } from '../mocks'; -import { rolesManagementApp } from './roles'; import { apiKeysManagementApp } from './api_keys'; +import { ManagementService } from './management_service'; import { roleMappingsManagementApp } from './role_mappings'; +import { rolesManagementApp } from './roles'; +import { usersManagementApp } from './users'; const mockSection = createManagementSectionMock(); diff --git a/x-pack/plugins/security/public/management/management_service.ts b/x-pack/plugins/security/public/management/management_service.ts index 2600e15ad1359..7809a45db1660 100644 --- a/x-pack/plugins/security/public/management/management_service.ts +++ b/x-pack/plugins/security/public/management/management_service.ts @@ -5,16 +5,18 @@ * 2.0. */ -import { Subscription } from 'rxjs'; -import { StartServicesAccessor, FatalErrorsSetup, Capabilities } from 'src/core/public'; -import { +import type { Subscription } from 'rxjs'; + +import type { Capabilities, FatalErrorsSetup, StartServicesAccessor } from 'src/core/public'; +import type { ManagementApp, - ManagementSetup, ManagementSection, -} from '../../../../../src/plugins/management/public'; -import { SecurityLicense } from '../../common/licensing'; -import { AuthenticationServiceSetup } from '../authentication'; -import { PluginStartDependencies } from '../plugin'; + ManagementSetup, +} from 'src/plugins/management/public'; + +import type { SecurityLicense } from '../../common/licensing'; +import type { AuthenticationServiceSetup } from '../authentication'; +import type { PluginStartDependencies } from '../plugin'; import { apiKeysManagementApp } from './api_keys'; import { roleMappingsManagementApp } from './role_mappings'; import { rolesManagementApp } from './roles'; diff --git a/x-pack/plugins/security/public/management/role_combo_box/role_combo_box.test.tsx b/x-pack/plugins/security/public/management/role_combo_box/role_combo_box.test.tsx index 06a76cbf0b43e..3abcc07042e82 100644 --- a/x-pack/plugins/security/public/management/role_combo_box/role_combo_box.test.tsx +++ b/x-pack/plugins/security/public/management/role_combo_box/role_combo_box.test.tsx @@ -6,8 +6,10 @@ */ import React from 'react'; + import { shallowWithIntl } from '@kbn/test/jest'; -import { RoleComboBox } from '.'; + +import { RoleComboBox } from './role_combo_box'; describe('RoleComboBox', () => { it('renders roles grouped by custom, user, admin, system and deprecated roles with correct color', () => { diff --git a/x-pack/plugins/security/public/management/role_combo_box/role_combo_box.tsx b/x-pack/plugins/security/public/management/role_combo_box/role_combo_box.tsx index 84a02c6ab10ed..f894d59ce30c0 100644 --- a/x-pack/plugins/security/public/management/role_combo_box/role_combo_box.tsx +++ b/x-pack/plugins/security/public/management/role_combo_box/role_combo_box.tsx @@ -5,24 +5,15 @@ * 2.0. */ +import type { EuiComboBoxOptionOption, EuiComboBoxProps } from '@elastic/eui'; +import { EuiBadge, EuiComboBox, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; import React from 'react'; + import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; -import { - EuiBadge, - EuiComboBox, - EuiComboBoxProps, - EuiComboBoxOptionOption, - EuiFlexGroup, - EuiFlexItem, -} from '@elastic/eui'; -import { - Role, - isRoleSystem, - isRoleAdmin, - isRoleReserved, - isRoleDeprecated, -} from '../../../common/model'; + +import type { Role } from '../../../common/model'; +import { isRoleAdmin, isRoleDeprecated, isRoleReserved, isRoleSystem } from '../../../common/model'; interface Props extends Omit< diff --git a/x-pack/plugins/security/public/management/role_mappings/components/delete_provider/delete_provider.test.tsx b/x-pack/plugins/security/public/management/role_mappings/components/delete_provider/delete_provider.test.tsx index b2c7859404c96..17a6fb0bb84b3 100644 --- a/x-pack/plugins/security/public/management/role_mappings/components/delete_provider/delete_provider.test.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/components/delete_provider/delete_provider.test.tsx @@ -5,16 +5,16 @@ * 2.0. */ -import React from 'react'; import { EuiConfirmModal } from '@elastic/eui'; import { act } from '@testing-library/react'; -import { mountWithIntl, nextTick } from '@kbn/test/jest'; -import { findTestSubject } from '@kbn/test/jest'; -import { RoleMapping } from '../../../../../common/model'; -import { DeleteProvider } from '.'; +import React from 'react'; + +import { findTestSubject, mountWithIntl, nextTick } from '@kbn/test/jest'; +import { coreMock } from 'src/core/public/mocks'; +import type { RoleMapping } from '../../../../../common/model'; import { roleMappingsAPIClientMock } from '../../index.mock'; -import { coreMock } from '../../../../../../../../src/core/public/mocks'; +import { DeleteProvider } from './delete_provider'; describe('DeleteProvider', () => { beforeEach(() => { diff --git a/x-pack/plugins/security/public/management/role_mappings/components/delete_provider/delete_provider.tsx b/x-pack/plugins/security/public/management/role_mappings/components/delete_provider/delete_provider.tsx index 680a4a40a7d9a..f9194860ddded 100644 --- a/x-pack/plugins/security/public/management/role_mappings/components/delete_provider/delete_provider.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/components/delete_provider/delete_provider.tsx @@ -5,13 +5,16 @@ * 2.0. */ -import React, { Fragment, useRef, useState, ReactElement } from 'react'; import { EuiConfirmModal } from '@elastic/eui'; +import type { ReactElement } from 'react'; +import React, { Fragment, useRef, useState } from 'react'; + import { i18n } from '@kbn/i18n'; import type { PublicMethodsOf } from '@kbn/utility-types'; -import { NotificationsStart } from 'src/core/public'; -import { RoleMapping } from '../../../../../common/model'; -import { RoleMappingsAPIClient } from '../../role_mappings_api_client'; +import type { NotificationsStart } from 'src/core/public'; + +import type { RoleMapping } from '../../../../../common/model'; +import type { RoleMappingsAPIClient } from '../../role_mappings_api_client'; interface Props { roleMappingsAPI: PublicMethodsOf; diff --git a/x-pack/plugins/security/public/management/role_mappings/components/no_compatible_realms/no_compatible_realms.tsx b/x-pack/plugins/security/public/management/role_mappings/components/no_compatible_realms/no_compatible_realms.tsx index c71ac9443d0e0..facf543601d7d 100644 --- a/x-pack/plugins/security/public/management/role_mappings/components/no_compatible_realms/no_compatible_realms.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/components/no_compatible_realms/no_compatible_realms.tsx @@ -5,9 +5,11 @@ * 2.0. */ -import React from 'react'; import { EuiCallOut, EuiLink } from '@elastic/eui'; +import React from 'react'; + import { FormattedMessage } from '@kbn/i18n/react'; + import { useKibana } from '../../../../../../../../src/plugins/kibana_react/public'; export const NoCompatibleRealms: React.FunctionComponent = () => { diff --git a/x-pack/plugins/security/public/management/role_mappings/components/permission_denied/permission_denied.tsx b/x-pack/plugins/security/public/management/role_mappings/components/permission_denied/permission_denied.tsx index 51001bb88731a..65af6482a0b82 100644 --- a/x-pack/plugins/security/public/management/role_mappings/components/permission_denied/permission_denied.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/components/permission_denied/permission_denied.tsx @@ -6,9 +6,10 @@ */ import { EuiEmptyPrompt, EuiFlexGroup, EuiPageContent } from '@elastic/eui'; -import { FormattedMessage } from '@kbn/i18n/react'; import React from 'react'; +import { FormattedMessage } from '@kbn/i18n/react'; + export const PermissionDenied = () => ( diff --git a/x-pack/plugins/security/public/management/role_mappings/components/section_loading/section_loading.test.tsx b/x-pack/plugins/security/public/management/role_mappings/components/section_loading/section_loading.test.tsx index 5c06640ed1aff..e3e5929428164 100644 --- a/x-pack/plugins/security/public/management/role_mappings/components/section_loading/section_loading.test.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/components/section_loading/section_loading.test.tsx @@ -6,8 +6,10 @@ */ import React from 'react'; + import { shallowWithIntl } from '@kbn/test/jest'; -import { SectionLoading } from '.'; + +import { SectionLoading } from './section_loading'; describe('SectionLoading', () => { it('renders the default loading message', () => { diff --git a/x-pack/plugins/security/public/management/role_mappings/components/section_loading/section_loading.tsx b/x-pack/plugins/security/public/management/role_mappings/components/section_loading/section_loading.tsx index e3c3c4c074b29..3624f098ea65d 100644 --- a/x-pack/plugins/security/public/management/role_mappings/components/section_loading/section_loading.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/components/section_loading/section_loading.tsx @@ -5,8 +5,9 @@ * 2.0. */ -import React from 'react'; import { EuiEmptyPrompt, EuiLoadingSpinner, EuiText } from '@elastic/eui'; +import React from 'react'; + import { FormattedMessage } from '@kbn/i18n/react'; interface Props { diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/edit_role_mapping_page.test.tsx b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/edit_role_mapping_page.test.tsx index 28dc316d2d588..c0486ee7d0d82 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/edit_role_mapping_page.test.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/edit_role_mapping_page.test.tsx @@ -5,28 +5,27 @@ * 2.0. */ -import React from 'react'; -import type { PublicMethodsOf } from '@kbn/utility-types'; -import { mountWithIntl, nextTick } from '@kbn/test/jest'; -import { findTestSubject } from '@kbn/test/jest'; - // brace/ace uses the Worker class, which is not currently provided by JSDOM. // This is not required for the tests to pass, but it rather suppresses lengthy // warnings in the console which adds unnecessary noise to the test output. import '@kbn/test/target/jest/utils/stub_web_worker'; -import { EditRoleMappingPage } from '.'; -import { NoCompatibleRealms, SectionLoading, PermissionDenied } from '../components'; -import { VisualRuleEditor } from './rule_editor_panel/visual_rule_editor'; -import { JSONRuleEditor } from './rule_editor_panel/json_rule_editor'; -import { RolesAPIClient } from '../../roles'; -import { Role } from '../../../../common/model'; -import { KibanaContextProvider } from '../../../../../../../src/plugins/kibana_react/public'; +import React from 'react'; -import { coreMock, scopedHistoryMock } from '../../../../../../../src/core/public/mocks'; -import { roleMappingsAPIClientMock } from '../role_mappings_api_client.mock'; -import { rolesAPIClientMock } from '../../roles/roles_api_client.mock'; +import { findTestSubject, mountWithIntl, nextTick } from '@kbn/test/jest'; +import type { PublicMethodsOf } from '@kbn/utility-types'; +import { coreMock, scopedHistoryMock } from 'src/core/public/mocks'; +import { KibanaContextProvider } from 'src/plugins/kibana_react/public'; + +import type { Role } from '../../../../common/model'; import { RoleComboBox } from '../../role_combo_box'; +import type { RolesAPIClient } from '../../roles'; +import { rolesAPIClientMock } from '../../roles/roles_api_client.mock'; +import { NoCompatibleRealms, PermissionDenied, SectionLoading } from '../components'; +import { roleMappingsAPIClientMock } from '../role_mappings_api_client.mock'; +import { EditRoleMappingPage } from './edit_role_mapping_page'; +import { JSONRuleEditor } from './rule_editor_panel/json_rule_editor'; +import { VisualRuleEditor } from './rule_editor_panel/visual_rule_editor'; describe('EditRoleMappingPage', () => { const history = scopedHistoryMock.create(); diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/edit_role_mapping_page.tsx b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/edit_role_mapping_page.tsx index 73e231de3e05d..4f238f819f320 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/edit_role_mapping_page.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/edit_role_mapping_page.tsx @@ -5,35 +5,37 @@ * 2.0. */ -import React, { Component, Fragment } from 'react'; import { + EuiButton, + EuiButtonEmpty, + EuiFlexGroup, + EuiFlexItem, EuiForm, + EuiLink, EuiPageContent, EuiSpacer, EuiText, EuiTitle, - EuiFlexGroup, - EuiFlexItem, - EuiButtonEmpty, - EuiButton, - EuiLink, } from '@elastic/eui'; +import React, { Component, Fragment } from 'react'; + import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import type { PublicMethodsOf } from '@kbn/utility-types'; -import type { NotificationsStart, ScopedHistory, DocLinksStart } from 'src/core/public'; -import { RoleMapping } from '../../../../common/model'; -import { RuleEditorPanel } from './rule_editor_panel'; +import type { DocLinksStart, NotificationsStart, ScopedHistory } from 'src/core/public'; + +import type { RoleMapping } from '../../../../common/model'; +import type { RolesAPIClient } from '../../roles'; import { + DeleteProvider, NoCompatibleRealms, PermissionDenied, - DeleteProvider, SectionLoading, } from '../components'; -import { RolesAPIClient } from '../../roles'; -import { validateRoleMappingForSave } from './services/role_mapping_validation'; +import type { RoleMappingsAPIClient } from '../role_mappings_api_client'; import { MappingInfoPanel } from './mapping_info_panel'; -import { RoleMappingsAPIClient } from '../role_mappings_api_client'; +import { RuleEditorPanel } from './rule_editor_panel'; +import { validateRoleMappingForSave } from './services/role_mapping_validation'; interface State { loadState: 'loading' | 'permissionDenied' | 'ready' | 'saveInProgress'; diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/mapping_info_panel/mapping_info_panel.test.tsx b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/mapping_info_panel/mapping_info_panel.test.tsx index 8f1f57a123000..3e18437a52ece 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/mapping_info_panel/mapping_info_panel.test.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/mapping_info_panel/mapping_info_panel.test.tsx @@ -6,17 +6,17 @@ */ import React from 'react'; + +import { findTestSubject, mountWithIntl } from '@kbn/test/jest'; import type { PublicMethodsOf } from '@kbn/utility-types'; -import { mountWithIntl } from '@kbn/test/jest'; -import { findTestSubject } from '@kbn/test/jest'; -import { Role, RoleMapping } from '../../../../../common/model'; -import { RolesAPIClient } from '../../../roles'; -import { RoleSelector } from '../role_selector'; -import { RoleTemplateEditor } from '../role_selector/role_template_editor'; -import { MappingInfoPanel } from '.'; +import { coreMock } from 'src/core/public/mocks'; +import type { Role, RoleMapping } from '../../../../../common/model'; +import type { RolesAPIClient } from '../../../roles'; import { rolesAPIClientMock } from '../../../roles/roles_api_client.mock'; -import { coreMock } from '../../../../../../../../src/core/public/mocks'; +import { RoleSelector } from '../role_selector'; +import { RoleTemplateEditor } from '../role_selector/role_template_editor'; +import { MappingInfoPanel } from './mapping_info_panel'; describe('MappingInfoPanel', () => { let rolesAPI: PublicMethodsOf; diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/mapping_info_panel/mapping_info_panel.tsx b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/mapping_info_panel/mapping_info_panel.tsx index 228047b7bb776..3eb935e152f33 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/mapping_info_panel/mapping_info_panel.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/mapping_info_panel/mapping_info_panel.tsx @@ -5,31 +5,34 @@ * 2.0. */ -import React, { Component, ChangeEvent, Fragment } from 'react'; import { - EuiPanel, - EuiTitle, - EuiText, - EuiSpacer, EuiDescribedFormGroup, - EuiFormRow, EuiFieldText, - EuiLink, + EuiFormRow, EuiIcon, + EuiLink, + EuiPanel, + EuiSpacer, EuiSwitch, + EuiText, + EuiTitle, } from '@elastic/eui'; +import type { ChangeEvent } from 'react'; +import React, { Component, Fragment } from 'react'; + import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import type { PublicMethodsOf } from '@kbn/utility-types'; import type { DocLinksStart } from 'src/core/public'; -import { RoleMapping } from '../../../../../common/model'; -import { RolesAPIClient } from '../../../roles'; + +import type { RoleMapping } from '../../../../../common/model'; +import type { RolesAPIClient } from '../../../roles'; +import { RoleSelector } from '../role_selector'; import { validateRoleMappingName, validateRoleMappingRoles, validateRoleMappingRoleTemplates, } from '../services/role_mapping_validation'; -import { RoleSelector } from '../role_selector'; interface Props { roleMapping: RoleMapping; diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/role_selector/add_role_template_button.test.tsx b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/role_selector/add_role_template_button.test.tsx index 0688b9d307e61..a82b089f6630e 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/role_selector/add_role_template_button.test.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/role_selector/add_role_template_button.test.tsx @@ -6,7 +6,9 @@ */ import React from 'react'; -import { shallowWithIntl, mountWithIntl } from '@kbn/test/jest'; + +import { mountWithIntl, shallowWithIntl } from '@kbn/test/jest'; + import { AddRoleTemplateButton } from './add_role_template_button'; describe('AddRoleTemplateButton', () => { diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/role_selector/add_role_template_button.tsx b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/role_selector/add_role_template_button.tsx index 4e439b0f27721..c1649d437007f 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/role_selector/add_role_template_button.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/role_selector/add_role_template_button.tsx @@ -5,8 +5,9 @@ * 2.0. */ -import React from 'react'; import { EuiButtonEmpty, EuiCallOut } from '@elastic/eui'; +import React from 'react'; + import { FormattedMessage } from '@kbn/i18n/react'; interface Props { diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/role_selector/role_selector.test.tsx b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/role_selector/role_selector.test.tsx index 4b4e91f0a622c..367fdaadca96e 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/role_selector/role_selector.test.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/role_selector/role_selector.test.tsx @@ -5,17 +5,18 @@ * 2.0. */ -import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; -import { findTestSubject } from '@kbn/test/jest'; import { EuiComboBox } from '@elastic/eui'; +import React from 'react'; + +import { findTestSubject, mountWithIntl } from '@kbn/test/jest'; import type { PublicMethodsOf } from '@kbn/utility-types'; + +import type { Role, RoleMapping } from '../../../../../common/model'; +import type { RolesAPIClient } from '../../../roles'; +import { rolesAPIClientMock } from '../../../roles/roles_api_client.mock'; +import { AddRoleTemplateButton } from './add_role_template_button'; import { RoleSelector } from './role_selector'; -import { Role, RoleMapping } from '../../../../../common/model'; import { RoleTemplateEditor } from './role_template_editor'; -import { AddRoleTemplateButton } from './add_role_template_button'; -import { RolesAPIClient } from '../../../roles'; -import { rolesAPIClientMock } from '../../../roles/roles_api_client.mock'; describe('RoleSelector', () => { let rolesAPI: PublicMethodsOf; diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/role_selector/role_selector.tsx b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/role_selector/role_selector.tsx index b28b6f4ecac0c..e40edd880af09 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/role_selector/role_selector.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/role_selector/role_selector.tsx @@ -5,16 +5,19 @@ * 2.0. */ +import { EuiFormRow, EuiHorizontalRule } from '@elastic/eui'; import React, { Fragment } from 'react'; + import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; -import { EuiFormRow, EuiHorizontalRule } from '@elastic/eui'; import type { PublicMethodsOf } from '@kbn/utility-types'; -import { RoleMapping, Role, isRoleDeprecated } from '../../../../../common/model'; -import { RolesAPIClient } from '../../../roles'; + +import type { Role, RoleMapping } from '../../../../../common/model'; +import { isRoleDeprecated } from '../../../../../common/model'; +import { RoleComboBox } from '../../../role_combo_box'; +import type { RolesAPIClient } from '../../../roles'; import { AddRoleTemplateButton } from './add_role_template_button'; import { RoleTemplateEditor } from './role_template_editor'; -import { RoleComboBox } from '../../../role_combo_box'; interface Props { rolesAPIClient: PublicMethodsOf; diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/role_selector/role_template_editor.test.tsx b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/role_selector/role_template_editor.test.tsx index c402e7eb27da4..a4a388e20e66b 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/role_selector/role_template_editor.test.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/role_selector/role_template_editor.test.tsx @@ -6,9 +6,10 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; + +import { findTestSubject, mountWithIntl } from '@kbn/test/jest'; + import { RoleTemplateEditor } from './role_template_editor'; -import { findTestSubject } from '@kbn/test/jest'; describe('RoleTemplateEditor', () => { it('allows inline templates to be edited', () => { diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/role_selector/role_template_editor.tsx b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/role_selector/role_template_editor.tsx index a619e505b5523..3ae3a2c3132f0 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/role_selector/role_template_editor.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/role_selector/role_template_editor.tsx @@ -5,25 +5,27 @@ * 2.0. */ -import React, { Fragment } from 'react'; -import { FormattedMessage } from '@kbn/i18n/react'; import { EuiButtonEmpty, + EuiCallOut, + EuiFieldText, EuiFlexGroup, EuiFlexItem, EuiFormRow, - EuiFieldText, - EuiCallOut, - EuiText, - EuiSwitch, EuiSpacer, + EuiSwitch, + EuiText, } from '@elastic/eui'; +import React, { Fragment } from 'react'; + import { i18n } from '@kbn/i18n'; -import { RoleTemplate } from '../../../../../common/model'; +import { FormattedMessage } from '@kbn/i18n/react'; + +import type { RoleTemplate } from '../../../../../common/model'; import { isInlineRoleTemplate, - isStoredRoleTemplate, isInvalidRoleTemplate, + isStoredRoleTemplate, } from '../services/role_template_type'; import { RoleTemplateTypeSelect } from './role_template_type_select'; diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/role_selector/role_template_type_select.tsx b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/role_selector/role_template_type_select.tsx index 99dca8f0831b8..648d3cb7a8111 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/role_selector/role_template_type_select.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/role_selector/role_template_type_select.tsx @@ -5,10 +5,12 @@ * 2.0. */ +import { EuiComboBox } from '@elastic/eui'; import React from 'react'; + import { i18n } from '@kbn/i18n'; -import { EuiComboBox } from '@elastic/eui'; -import { RoleTemplate } from '../../../../../common/model'; + +import type { RoleTemplate } from '../../../../../common/model'; import { isInlineRoleTemplate, isStoredRoleTemplate } from '../services/role_template_type'; const templateTypeOptions = [ diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/add_rule_button.test.tsx b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/add_rule_button.test.tsx index 451ffd551edcc..399d2fc2d2c91 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/add_rule_button.test.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/add_rule_button.test.tsx @@ -6,10 +6,11 @@ */ import React from 'react'; + +import { findTestSubject, mountWithIntl } from '@kbn/test/jest'; + +import { AllRule, FieldRule } from '../../model'; import { AddRuleButton } from './add_rule_button'; -import { mountWithIntl } from '@kbn/test/jest'; -import { findTestSubject } from '@kbn/test/jest'; -import { FieldRule, AllRule } from '../../model'; describe('AddRuleButton', () => { it('allows a field rule to be created', () => { diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/add_rule_button.tsx b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/add_rule_button.tsx index 4497ba8fc85a6..dae00d4416a1d 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/add_rule_button.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/add_rule_button.tsx @@ -5,10 +5,13 @@ * 2.0. */ +import { EuiButtonEmpty, EuiContextMenuItem, EuiContextMenuPanel, EuiPopover } from '@elastic/eui'; import React, { useState } from 'react'; -import { EuiButtonEmpty, EuiPopover, EuiContextMenuPanel, EuiContextMenuItem } from '@elastic/eui'; + import { FormattedMessage } from '@kbn/i18n/react'; -import { Rule, FieldRule, AllRule } from '../../model'; + +import type { Rule } from '../../model'; +import { AllRule, FieldRule } from '../../model'; interface Props { onClick: (newRule: Rule) => void; diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/field_rule_editor.test.tsx b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/field_rule_editor.test.tsx index 97616066ea58a..c81f3cc9da595 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/field_rule_editor.test.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/field_rule_editor.test.tsx @@ -5,12 +5,13 @@ * 2.0. */ +import type { ReactWrapper } from 'enzyme'; import React from 'react'; -import { FieldRuleEditor } from './field_rule_editor'; -import { mountWithIntl } from '@kbn/test/jest'; + +import { findTestSubject, mountWithIntl } from '@kbn/test/jest'; + import { FieldRule } from '../../model'; -import { findTestSubject } from '@kbn/test/jest'; -import { ReactWrapper } from 'enzyme'; +import { FieldRuleEditor } from './field_rule_editor'; function assertField(wrapper: ReactWrapper, index: number, field: string) { const isFirst = index === 0; diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/field_rule_editor.tsx b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/field_rule_editor.tsx index e2f1a1c65c99c..2e510c9596a51 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/field_rule_editor.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/field_rule_editor.tsx @@ -5,21 +5,25 @@ * 2.0. */ -import React, { Component, ChangeEvent } from 'react'; import { EuiButtonIcon, + EuiComboBox, EuiExpression, + EuiFieldNumber, + EuiFieldText, EuiFlexGroup, EuiFlexItem, EuiFormRow, - EuiFieldText, - EuiComboBox, - EuiSelect, - EuiFieldNumber, EuiIcon, + EuiSelect, } from '@elastic/eui'; +import type { ChangeEvent } from 'react'; +import React, { Component } from 'react'; + import { i18n } from '@kbn/i18n'; -import { FieldRule, FieldRuleValue } from '../../model'; + +import type { FieldRuleValue } from '../../model'; +import { FieldRule } from '../../model'; interface Props { rule: FieldRule; diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/json_rule_editor.test.tsx b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/json_rule_editor.test.tsx index 5662c8217ef34..a4c000d324636 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/json_rule_editor.test.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/json_rule_editor.test.tsx @@ -7,21 +7,21 @@ import 'brace'; import 'brace/mode/json'; - // brace/ace uses the Worker class, which is not currently provided by JSDOM. // This is not required for the tests to pass, but it rather suppresses lengthy // warnings in the console which adds unnecessary noise to the test output. import '@kbn/test/target/jest/utils/stub_web_worker'; +import { EuiCodeEditor } from '@elastic/eui'; import React from 'react'; import { act } from 'react-dom/test-utils'; + import { mountWithIntl } from '@kbn/test/jest'; -import { JSONRuleEditor } from './json_rule_editor'; -import { EuiCodeEditor } from '@elastic/eui'; -import { KibanaContextProvider } from '../../../../../../../../src/plugins/kibana_react/public'; -import { AllRule, AnyRule, FieldRule, ExceptAnyRule, ExceptAllRule } from '../../model'; +import { coreMock } from 'src/core/public/mocks'; +import { KibanaContextProvider } from 'src/plugins/kibana_react/public'; -import { coreMock } from '../../../../../../../../src/core/public/mocks'; +import { AllRule, AnyRule, ExceptAllRule, ExceptAnyRule, FieldRule } from '../../model'; +import { JSONRuleEditor } from './json_rule_editor'; describe('JSONRuleEditor', () => { const renderView = (props: React.ComponentProps) => { diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/json_rule_editor.tsx b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/json_rule_editor.tsx index 49ec193b36e7d..ecbc71f295a94 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/json_rule_editor.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/json_rule_editor.tsx @@ -5,15 +5,18 @@ * 2.0. */ -import React, { useState, Fragment } from 'react'; - import 'brace/mode/json'; import 'brace/theme/github'; -import { EuiCodeEditor, EuiFormRow, EuiButton, EuiSpacer, EuiLink, EuiText } from '@elastic/eui'; -import { FormattedMessage } from '@kbn/i18n/react'; + +import { EuiButton, EuiCodeEditor, EuiFormRow, EuiLink, EuiSpacer, EuiText } from '@elastic/eui'; +import React, { Fragment, useState } from 'react'; + import { i18n } from '@kbn/i18n'; -import { Rule, RuleBuilderError, generateRulesFromRaw } from '../../model'; +import { FormattedMessage } from '@kbn/i18n/react'; + import { useKibana } from '../../../../../../../../src/plugins/kibana_react/public'; +import type { Rule } from '../../model'; +import { generateRulesFromRaw, RuleBuilderError } from '../../model'; interface Props { rules: Rule | null; diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/rule_editor_panel.test.tsx b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/rule_editor_panel.test.tsx index 4435aa9baa17e..01b4c0a0eab6d 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/rule_editor_panel.test.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/rule_editor_panel.test.tsx @@ -5,22 +5,22 @@ * 2.0. */ -import React from 'react'; -import { mountWithIntl, findTestSubject } from '@kbn/test/jest'; -import { RuleEditorPanel } from '.'; -import { VisualRuleEditor } from './visual_rule_editor'; -import { JSONRuleEditor } from './json_rule_editor'; - // brace/ace uses the Worker class, which is not currently provided by JSDOM. // This is not required for the tests to pass, but it rather suppresses lengthy // warnings in the console which adds unnecessary noise to the test output. import '@kbn/test/target/jest/utils/stub_web_worker'; -import { AllRule, FieldRule } from '../../model'; import { EuiErrorBoundary } from '@elastic/eui'; -import { KibanaContextProvider } from '../../../../../../../../src/plugins/kibana_react/public'; +import React from 'react'; + +import { findTestSubject, mountWithIntl } from '@kbn/test/jest'; +import { coreMock } from 'src/core/public/mocks'; +import { KibanaContextProvider } from 'src/plugins/kibana_react/public'; -import { coreMock } from '../../../../../../../../src/core/public/mocks'; +import { AllRule, FieldRule } from '../../model'; +import { JSONRuleEditor } from './json_rule_editor'; +import { RuleEditorPanel } from './rule_editor_panel'; +import { VisualRuleEditor } from './visual_rule_editor'; describe('RuleEditorPanel', () => { const renderView = (props: Omit, 'docLinks'>) => { diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/rule_editor_panel.tsx b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/rule_editor_panel.tsx index d027a1aeb7e1f..c8cd79fc5d7a6 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/rule_editor_panel.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/rule_editor_panel.tsx @@ -5,30 +5,33 @@ * 2.0. */ -import React, { Component, Fragment } from 'react'; import { - EuiSpacer, - EuiConfirmModal, EuiCallOut, + EuiConfirmModal, EuiErrorBoundary, - EuiIcon, - EuiLink, EuiFlexGroup, EuiFlexItem, - EuiText, EuiFormRow, + EuiIcon, + EuiLink, EuiPanel, + EuiSpacer, + EuiText, EuiTitle, } from '@elastic/eui'; -import { FormattedMessage } from '@kbn/i18n/react'; +import React, { Component, Fragment } from 'react'; + import { i18n } from '@kbn/i18n'; +import { FormattedMessage } from '@kbn/i18n/react'; import type { DocLinksStart } from 'src/core/public'; -import { RoleMapping } from '../../../../../common/model'; -import { VisualRuleEditor } from './visual_rule_editor'; -import { JSONRuleEditor } from './json_rule_editor'; + +import type { RoleMapping } from '../../../../../common/model'; +import type { Rule } from '../../model'; +import { generateRulesFromRaw } from '../../model'; import { VISUAL_MAX_RULE_DEPTH } from '../services/role_mapping_constants'; -import { Rule, generateRulesFromRaw } from '../../model'; import { validateRoleMappingRules } from '../services/role_mapping_validation'; +import { JSONRuleEditor } from './json_rule_editor'; +import { VisualRuleEditor } from './visual_rule_editor'; interface Props { rawRules: RoleMapping['rules']; diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/rule_group_editor.test.tsx b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/rule_group_editor.test.tsx index 3ef7aa48bb21c..8915bef293bc2 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/rule_group_editor.test.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/rule_group_editor.test.tsx @@ -5,14 +5,15 @@ * 2.0. */ +import { EuiContextMenuItem } from '@elastic/eui'; import React from 'react'; -import { RuleGroupEditor } from './rule_group_editor'; -import { shallowWithIntl, mountWithIntl, nextTick } from '@kbn/test/jest'; -import { AllRule, FieldRule, AnyRule, ExceptAnyRule } from '../../model'; -import { FieldRuleEditor } from './field_rule_editor'; + +import { findTestSubject, mountWithIntl, nextTick, shallowWithIntl } from '@kbn/test/jest'; + +import { AllRule, AnyRule, ExceptAnyRule, FieldRule } from '../../model'; import { AddRuleButton } from './add_rule_button'; -import { EuiContextMenuItem } from '@elastic/eui'; -import { findTestSubject } from '@kbn/test/jest'; +import { FieldRuleEditor } from './field_rule_editor'; +import { RuleGroupEditor } from './rule_group_editor'; describe('RuleGroupEditor', () => { it('renders an empty group', () => { diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/rule_group_editor.tsx b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/rule_group_editor.tsx index 107b439062497..b9ab88861bfda 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/rule_group_editor.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/rule_group_editor.tsx @@ -7,20 +7,22 @@ import './rule_group_editor.scss'; -import React, { Component, Fragment } from 'react'; import { - EuiPanel, + EuiButtonEmpty, EuiFlexGroup, EuiFlexItem, EuiHorizontalRule, - EuiButtonEmpty, + EuiPanel, } from '@elastic/eui'; +import React, { Component, Fragment } from 'react'; + import { FormattedMessage } from '@kbn/i18n/react'; + +import type { FieldRule, Rule, RuleGroup } from '../../model'; +import { isRuleGroup } from '../services/is_rule_group'; import { AddRuleButton } from './add_rule_button'; -import { RuleGroupTitle } from './rule_group_title'; import { FieldRuleEditor } from './field_rule_editor'; -import { RuleGroup, Rule, FieldRule } from '../../model'; -import { isRuleGroup } from '../services/is_rule_group'; +import { RuleGroupTitle } from './rule_group_title'; interface Props { rule: RuleGroup; diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/rule_group_title.tsx b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/rule_group_title.tsx index 478e8d87abf95..8285797c39e9a 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/rule_group_title.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/rule_group_title.tsx @@ -5,17 +5,20 @@ * 2.0. */ -import React, { useState } from 'react'; import { - EuiPopover, - EuiContextMenuPanel, + EuiConfirmModal, EuiContextMenuItem, - EuiLink, + EuiContextMenuPanel, EuiIcon, - EuiConfirmModal, + EuiLink, + EuiPopover, } from '@elastic/eui'; +import React, { useState } from 'react'; + import { FormattedMessage } from '@kbn/i18n/react'; -import { RuleGroup, AllRule, AnyRule, ExceptAllRule, ExceptAnyRule, FieldRule } from '../../model'; + +import type { RuleGroup } from '../../model'; +import { AllRule, AnyRule, ExceptAllRule, ExceptAnyRule, FieldRule } from '../../model'; interface Props { rule: RuleGroup; diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/visual_rule_editor.test.tsx b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/visual_rule_editor.test.tsx index cdff8abc2ba55..fc48e2e1c8c9e 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/visual_rule_editor.test.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/visual_rule_editor.test.tsx @@ -6,12 +6,13 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; -import { VisualRuleEditor } from './visual_rule_editor'; -import { findTestSubject } from '@kbn/test/jest'; -import { AnyRule, AllRule, FieldRule, ExceptAnyRule, ExceptAllRule } from '../../model'; -import { RuleGroupEditor } from './rule_group_editor'; + +import { findTestSubject, mountWithIntl } from '@kbn/test/jest'; + +import { AllRule, AnyRule, ExceptAllRule, ExceptAnyRule, FieldRule } from '../../model'; import { FieldRuleEditor } from './field_rule_editor'; +import { RuleGroupEditor } from './rule_group_editor'; +import { VisualRuleEditor } from './visual_rule_editor'; describe('VisualRuleEditor', () => { it('renders an empty prompt when no rules are defined', () => { diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/visual_rule_editor.tsx b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/visual_rule_editor.tsx index 3c0d5d89e06c5..ca418ac3749e5 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/visual_rule_editor.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/visual_rule_editor.tsx @@ -5,14 +5,17 @@ * 2.0. */ +import { EuiButton, EuiCallOut, EuiEmptyPrompt, EuiSpacer } from '@elastic/eui'; import React, { Component, Fragment } from 'react'; -import { EuiEmptyPrompt, EuiCallOut, EuiSpacer, EuiButton } from '@elastic/eui'; + import { FormattedMessage } from '@kbn/i18n/react'; + +import type { Rule, RuleGroup } from '../../model'; +import { AllRule, FieldRule } from '../../model'; +import { isRuleGroup } from '../services/is_rule_group'; +import { VISUAL_MAX_RULE_DEPTH } from '../services/role_mapping_constants'; import { FieldRuleEditor } from './field_rule_editor'; import { RuleGroupEditor } from './rule_group_editor'; -import { VISUAL_MAX_RULE_DEPTH } from '../services/role_mapping_constants'; -import { Rule, FieldRule, RuleGroup, AllRule } from '../../model'; -import { isRuleGroup } from '../services/is_rule_group'; interface Props { rules: Rule | null; diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/services/is_rule_group.ts b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/services/is_rule_group.ts index 0086ba0c61da1..08562e4cf2e3f 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/services/is_rule_group.ts +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/services/is_rule_group.ts @@ -5,7 +5,8 @@ * 2.0. */ -import { Rule, FieldRule } from '../../model'; +import type { Rule } from '../../model'; +import { FieldRule } from '../../model'; export function isRuleGroup(rule: Rule) { return !(rule instanceof FieldRule); diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/services/role_mapping_validation.test.ts b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/services/role_mapping_validation.test.ts index d7d20b14e0167..85029de671c3f 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/services/role_mapping_validation.test.ts +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/services/role_mapping_validation.test.ts @@ -5,14 +5,14 @@ * 2.0. */ +import type { RoleMapping } from '../../../../../common/model'; import { + validateRoleMappingForSave, validateRoleMappingName, validateRoleMappingRoles, validateRoleMappingRoleTemplates, validateRoleMappingRules, - validateRoleMappingForSave, } from './role_mapping_validation'; -import { RoleMapping } from '../../../../../common/model'; describe('validateRoleMappingName', () => { it('requires a value', () => { diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/services/role_mapping_validation.ts b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/services/role_mapping_validation.ts index f6c065391d6b8..d934e48df059e 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/services/role_mapping_validation.ts +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/services/role_mapping_validation.ts @@ -6,7 +6,8 @@ */ import { i18n } from '@kbn/i18n'; -import { RoleMapping } from '../../../../../common/model'; + +import type { RoleMapping } from '../../../../../common/model'; import { generateRulesFromRaw } from '../../model'; interface ValidationResult { diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/services/role_template_type.test.ts b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/services/role_template_type.test.ts index 96c56feaeba4a..22ff31acd0c7c 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/services/role_template_type.test.ts +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/services/role_template_type.test.ts @@ -5,12 +5,12 @@ * 2.0. */ +import type { RoleTemplate } from '../../../../../common/model'; import { - isStoredRoleTemplate, isInlineRoleTemplate, isInvalidRoleTemplate, + isStoredRoleTemplate, } from './role_template_type'; -import { RoleTemplate } from '../../../../../common/model'; describe('#isStoredRoleTemplate', () => { it('returns true for stored templates, false otherwise', () => { diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/services/role_template_type.ts b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/services/role_template_type.ts index 56b5a8131132a..0735e03f819cb 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/services/role_template_type.ts +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/services/role_template_type.ts @@ -5,11 +5,11 @@ * 2.0. */ -import { - RoleTemplate, - StoredRoleTemplate, +import type { InlineRoleTemplate, InvalidRoleTemplate, + RoleTemplate, + StoredRoleTemplate, } from '../../../../../common/model'; export function isStoredRoleTemplate( diff --git a/x-pack/plugins/security/public/management/role_mappings/model/all_rule.test.ts b/x-pack/plugins/security/public/management/role_mappings/model/all_rule.test.ts index 09a66e732c7b7..19c9314c5f365 100644 --- a/x-pack/plugins/security/public/management/role_mappings/model/all_rule.test.ts +++ b/x-pack/plugins/security/public/management/role_mappings/model/all_rule.test.ts @@ -5,7 +5,12 @@ * 2.0. */ -import { AllRule, AnyRule, FieldRule, ExceptAllRule, ExceptAnyRule, RuleGroup } from '.'; +import { AllRule } from './all_rule'; +import { AnyRule } from './any_rule'; +import { ExceptAllRule } from './except_all_rule'; +import { ExceptAnyRule } from './except_any_rule'; +import { FieldRule } from './field_rule'; +import type { RuleGroup } from './rule_group'; describe('All rule', () => { it('can be constructed without sub rules', () => { diff --git a/x-pack/plugins/security/public/management/role_mappings/model/all_rule.ts b/x-pack/plugins/security/public/management/role_mappings/model/all_rule.ts index 909d253a3ad6e..191d9072d12cb 100644 --- a/x-pack/plugins/security/public/management/role_mappings/model/all_rule.ts +++ b/x-pack/plugins/security/public/management/role_mappings/model/all_rule.ts @@ -6,8 +6,9 @@ */ import { i18n } from '@kbn/i18n'; + +import type { Rule } from './rule'; import { RuleGroup } from './rule_group'; -import { Rule } from './rule'; /** * Represents a group of rules which must all evaluate to true. diff --git a/x-pack/plugins/security/public/management/role_mappings/model/any_rule.test.ts b/x-pack/plugins/security/public/management/role_mappings/model/any_rule.test.ts index 5c0ff55dbf5ed..494729ce6288e 100644 --- a/x-pack/plugins/security/public/management/role_mappings/model/any_rule.test.ts +++ b/x-pack/plugins/security/public/management/role_mappings/model/any_rule.test.ts @@ -5,7 +5,12 @@ * 2.0. */ -import { AllRule, AnyRule, FieldRule, ExceptAllRule, ExceptAnyRule, RuleGroup } from '.'; +import { AllRule } from './all_rule'; +import { AnyRule } from './any_rule'; +import { ExceptAllRule } from './except_all_rule'; +import { ExceptAnyRule } from './except_any_rule'; +import { FieldRule } from './field_rule'; +import type { RuleGroup } from './rule_group'; describe('Any rule', () => { it('can be constructed without sub rules', () => { diff --git a/x-pack/plugins/security/public/management/role_mappings/model/any_rule.ts b/x-pack/plugins/security/public/management/role_mappings/model/any_rule.ts index bbe5a3f715aa0..c67fe02c63437 100644 --- a/x-pack/plugins/security/public/management/role_mappings/model/any_rule.ts +++ b/x-pack/plugins/security/public/management/role_mappings/model/any_rule.ts @@ -6,10 +6,11 @@ */ import { i18n } from '@kbn/i18n'; -import { RuleGroup } from './rule_group'; -import { Rule } from './rule'; + import { ExceptAllRule } from './except_all_rule'; import { ExceptAnyRule } from './except_any_rule'; +import type { Rule } from './rule'; +import { RuleGroup } from './rule_group'; /** * Represents a group of rules in which at least one must evaluate to true. diff --git a/x-pack/plugins/security/public/management/role_mappings/model/except_all_rule.test.ts b/x-pack/plugins/security/public/management/role_mappings/model/except_all_rule.test.ts index a3c9a674f03f7..2ab909f9a4385 100644 --- a/x-pack/plugins/security/public/management/role_mappings/model/except_all_rule.test.ts +++ b/x-pack/plugins/security/public/management/role_mappings/model/except_all_rule.test.ts @@ -5,7 +5,12 @@ * 2.0. */ -import { AllRule, AnyRule, FieldRule, ExceptAllRule, ExceptAnyRule, RuleGroup } from '.'; +import { AllRule } from './all_rule'; +import { AnyRule } from './any_rule'; +import { ExceptAllRule } from './except_all_rule'; +import { ExceptAnyRule } from './except_any_rule'; +import { FieldRule } from './field_rule'; +import type { RuleGroup } from './rule_group'; describe('Except All rule', () => { it('can be constructed without sub rules', () => { diff --git a/x-pack/plugins/security/public/management/role_mappings/model/except_all_rule.ts b/x-pack/plugins/security/public/management/role_mappings/model/except_all_rule.ts index e59475be1f58c..55d85e2bcd5af 100644 --- a/x-pack/plugins/security/public/management/role_mappings/model/except_all_rule.ts +++ b/x-pack/plugins/security/public/management/role_mappings/model/except_all_rule.ts @@ -6,8 +6,9 @@ */ import { i18n } from '@kbn/i18n'; + +import type { Rule } from './rule'; import { RuleGroup } from './rule_group'; -import { Rule } from './rule'; /** * Represents a group of rules in which at least one must evaluate to false. diff --git a/x-pack/plugins/security/public/management/role_mappings/model/except_any_rule.test.ts b/x-pack/plugins/security/public/management/role_mappings/model/except_any_rule.test.ts index f020bbf17ac2d..b5a6c8a889de9 100644 --- a/x-pack/plugins/security/public/management/role_mappings/model/except_any_rule.test.ts +++ b/x-pack/plugins/security/public/management/role_mappings/model/except_any_rule.test.ts @@ -5,7 +5,12 @@ * 2.0. */ -import { AllRule, AnyRule, FieldRule, ExceptAllRule, ExceptAnyRule, RuleGroup } from '.'; +import { AllRule } from './all_rule'; +import { AnyRule } from './any_rule'; +import { ExceptAllRule } from './except_all_rule'; +import { ExceptAnyRule } from './except_any_rule'; +import { FieldRule } from './field_rule'; +import type { RuleGroup } from './rule_group'; describe('Except Any rule', () => { it('can be constructed without sub rules', () => { diff --git a/x-pack/plugins/security/public/management/role_mappings/model/except_any_rule.ts b/x-pack/plugins/security/public/management/role_mappings/model/except_any_rule.ts index 1f22f241bbaf3..8123ed5b90b88 100644 --- a/x-pack/plugins/security/public/management/role_mappings/model/except_any_rule.ts +++ b/x-pack/plugins/security/public/management/role_mappings/model/except_any_rule.ts @@ -6,9 +6,10 @@ */ import { i18n } from '@kbn/i18n'; -import { RuleGroup } from './rule_group'; -import { Rule } from './rule'; + import { ExceptAllRule } from './except_all_rule'; +import type { Rule } from './rule'; +import { RuleGroup } from './rule_group'; /** * Represents a group of rules in which none can evaluate to true (all must evaluate to false). diff --git a/x-pack/plugins/security/public/management/role_mappings/model/field_rule.test.ts b/x-pack/plugins/security/public/management/role_mappings/model/field_rule.test.ts index 21cc1d052e677..5be756adf9bbb 100644 --- a/x-pack/plugins/security/public/management/role_mappings/model/field_rule.test.ts +++ b/x-pack/plugins/security/public/management/role_mappings/model/field_rule.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { FieldRule } from '.'; +import { FieldRule } from './field_rule'; describe('FieldRule', () => { ['*', 1, null, true, false].forEach((value) => { diff --git a/x-pack/plugins/security/public/management/role_mappings/model/field_rule.ts b/x-pack/plugins/security/public/management/role_mappings/model/field_rule.ts index f3e4dae7717cf..0b97a8c6e097e 100644 --- a/x-pack/plugins/security/public/management/role_mappings/model/field_rule.ts +++ b/x-pack/plugins/security/public/management/role_mappings/model/field_rule.ts @@ -6,6 +6,7 @@ */ import { i18n } from '@kbn/i18n'; + import { Rule } from './rule'; /** The allowed types for field rule values */ diff --git a/x-pack/plugins/security/public/management/role_mappings/model/rule_builder.test.ts b/x-pack/plugins/security/public/management/role_mappings/model/rule_builder.test.ts index 6859cd3323fbe..551c1d8ef964f 100644 --- a/x-pack/plugins/security/public/management/role_mappings/model/rule_builder.test.ts +++ b/x-pack/plugins/security/public/management/role_mappings/model/rule_builder.test.ts @@ -5,8 +5,9 @@ * 2.0. */ -import { generateRulesFromRaw, FieldRule } from '.'; -import { RoleMapping } from '../../../../common/model'; +import type { RoleMapping } from '../../../../common/model'; +import { FieldRule } from './field_rule'; +import { generateRulesFromRaw } from './rule_builder'; import { RuleBuilderError } from './rule_builder_error'; describe('generateRulesFromRaw', () => { diff --git a/x-pack/plugins/security/public/management/role_mappings/model/rule_builder.ts b/x-pack/plugins/security/public/management/role_mappings/model/rule_builder.ts index cbd08da4b76d4..f25f4fa7cda5f 100644 --- a/x-pack/plugins/security/public/management/role_mappings/model/rule_builder.ts +++ b/x-pack/plugins/security/public/management/role_mappings/model/rule_builder.ts @@ -6,14 +6,16 @@ */ import { i18n } from '@kbn/i18n'; -import { RoleMapping } from '../../../../common/model'; -import { FieldRule, FieldRuleValue } from './field_rule'; + +import type { RoleMapping } from '../../../../common/model'; import { AllRule } from './all_rule'; import { AnyRule } from './any_rule'; -import { Rule } from './rule'; import { ExceptAllRule } from './except_all_rule'; import { ExceptAnyRule } from './except_any_rule'; -import { RuleBuilderError } from '.'; +import type { FieldRuleValue } from './field_rule'; +import { FieldRule } from './field_rule'; +import type { Rule } from './rule'; +import { RuleBuilderError } from './rule_builder_error'; interface RuleBuilderResult { /** The maximum rule depth within the parsed rule set. */ diff --git a/x-pack/plugins/security/public/management/role_mappings/role_mappings_api_client.ts b/x-pack/plugins/security/public/management/role_mappings/role_mappings_api_client.ts index 4c391829592e2..f8474b91f26f4 100644 --- a/x-pack/plugins/security/public/management/role_mappings/role_mappings_api_client.ts +++ b/x-pack/plugins/security/public/management/role_mappings/role_mappings_api_client.ts @@ -5,8 +5,9 @@ * 2.0. */ -import { HttpStart } from 'src/core/public'; -import { RoleMapping } from '../../../common/model'; +import type { HttpStart } from 'src/core/public'; + +import type { RoleMapping } from '../../../common/model'; interface CheckRoleMappingFeaturesResponse { canManageRoleMappings: boolean; diff --git a/x-pack/plugins/security/public/management/role_mappings/role_mappings_grid/create_role_mapping_button/create_role_mapping_button.tsx b/x-pack/plugins/security/public/management/role_mappings/role_mappings_grid/create_role_mapping_button/create_role_mapping_button.tsx index 6986eec661f1b..b7f3261e18914 100644 --- a/x-pack/plugins/security/public/management/role_mappings/role_mappings_grid/create_role_mapping_button/create_role_mapping_button.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/role_mappings_grid/create_role_mapping_button/create_role_mapping_button.tsx @@ -5,12 +5,14 @@ * 2.0. */ -import React from 'react'; import { EuiButton } from '@elastic/eui'; +import React from 'react'; + import { FormattedMessage } from '@kbn/i18n/react'; -import { ScopedHistory } from 'kibana/public'; -import { EDIT_ROLE_MAPPING_PATH } from '../../../management_urls'; +import type { ScopedHistory } from 'src/core/public'; + import { reactRouterNavigate } from '../../../../../../../../src/plugins/kibana_react/public'; +import { EDIT_ROLE_MAPPING_PATH } from '../../../management_urls'; interface CreateRoleMappingButtonProps { history: ScopedHistory; diff --git a/x-pack/plugins/security/public/management/role_mappings/role_mappings_grid/empty_prompt/empty_prompt.tsx b/x-pack/plugins/security/public/management/role_mappings/role_mappings_grid/empty_prompt/empty_prompt.tsx index 8d08013a47981..cc0b41592e1f8 100644 --- a/x-pack/plugins/security/public/management/role_mappings/role_mappings_grid/empty_prompt/empty_prompt.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/role_mappings_grid/empty_prompt/empty_prompt.tsx @@ -5,10 +5,12 @@ * 2.0. */ -import React, { Fragment } from 'react'; import { EuiEmptyPrompt } from '@elastic/eui'; +import React, { Fragment } from 'react'; + import { FormattedMessage } from '@kbn/i18n/react'; -import { ScopedHistory } from 'kibana/public'; +import type { ScopedHistory } from 'src/core/public'; + import { CreateRoleMappingButton } from '../create_role_mapping_button'; interface EmptyPromptProps { diff --git a/x-pack/plugins/security/public/management/role_mappings/role_mappings_grid/role_mappings_grid_page.test.tsx b/x-pack/plugins/security/public/management/role_mappings/role_mappings_grid/role_mappings_grid_page.test.tsx index 10185cb5b4a06..5f237e6504d32 100644 --- a/x-pack/plugins/security/public/management/role_mappings/role_mappings_grid/role_mappings_grid_page.test.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/role_mappings_grid/role_mappings_grid_page.test.tsx @@ -5,20 +5,20 @@ * 2.0. */ -import React from 'react'; -import { CoreStart, ScopedHistory } from 'kibana/public'; -import { mountWithIntl, nextTick } from '@kbn/test/jest'; -import { RoleMappingsGridPage } from '.'; -import { SectionLoading, PermissionDenied, NoCompatibleRealms } from '../components'; -import { EmptyPrompt } from './empty_prompt'; -import { findTestSubject } from '@kbn/test/jest'; import { EuiLink } from '@elastic/eui'; import { act } from '@testing-library/react'; -import { KibanaContextProvider } from '../../../../../../../src/plugins/kibana_react/public'; +import React from 'react'; + +import { findTestSubject, mountWithIntl, nextTick } from '@kbn/test/jest'; +import type { CoreStart, ScopedHistory } from 'src/core/public'; +import { coreMock, scopedHistoryMock } from 'src/core/public/mocks'; +import { KibanaContextProvider } from 'src/plugins/kibana_react/public'; -import { coreMock, scopedHistoryMock } from '../../../../../../../src/core/public/mocks'; -import { roleMappingsAPIClientMock } from '../role_mappings_api_client.mock'; import { rolesAPIClientMock } from '../../roles/index.mock'; +import { NoCompatibleRealms, PermissionDenied, SectionLoading } from '../components'; +import { roleMappingsAPIClientMock } from '../role_mappings_api_client.mock'; +import { EmptyPrompt } from './empty_prompt'; +import { RoleMappingsGridPage } from './role_mappings_grid_page'; describe('RoleMappingsGridPage', () => { let history: ScopedHistory; @@ -238,25 +238,12 @@ describe('RoleMappingsGridPage', () => { await nextTick(); wrapper.update(); - const deprecationTooltip = wrapper.find('[data-test-subj="roleDeprecationTooltip"]').props(); - - expect(deprecationTooltip).toMatchInlineSnapshot(` - Object { - "children":
- kibana_user - - -
, - "content": "The kibana_user role is deprecated. I don't like you.", - "data-test-subj": "roleDeprecationTooltip", - "delay": "regular", - "position": "top", - } - `); + const deprecationTooltip = wrapper + .find('[data-test-subj="roleDeprecationTooltip"]') + .prop('content'); + + expect(deprecationTooltip).toMatchInlineSnapshot( + `"The kibana_user role is deprecated. I don't like you."` + ); }); }); diff --git a/x-pack/plugins/security/public/management/role_mappings/role_mappings_grid/role_mappings_grid_page.tsx b/x-pack/plugins/security/public/management/role_mappings/role_mappings_grid/role_mappings_grid_page.tsx index 33f969095a356..f5f6d2daf306d 100644 --- a/x-pack/plugins/security/public/management/role_mappings/role_mappings_grid/role_mappings_grid_page.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/role_mappings_grid/role_mappings_grid_page.tsx @@ -5,7 +5,6 @@ * 2.0. */ -import React, { Component, Fragment } from 'react'; import { EuiButton, EuiButtonIcon, @@ -23,29 +22,32 @@ import { EuiTitle, EuiToolTip, } from '@elastic/eui'; +import React, { Component, Fragment } from 'react'; + import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import type { PublicMethodsOf } from '@kbn/utility-types'; import type { - NotificationsStart, ApplicationStart, DocLinksStart, + NotificationsStart, ScopedHistory, } from 'src/core/public'; -import { RoleMapping, Role } from '../../../../common/model'; -import { EmptyPrompt } from './empty_prompt'; + +import { reactRouterNavigate } from '../../../../../../../src/plugins/kibana_react/public'; +import type { Role, RoleMapping } from '../../../../common/model'; +import { DisabledBadge, EnabledBadge } from '../../badges'; +import { EDIT_ROLE_MAPPING_PATH, getEditRoleMappingHref } from '../../management_urls'; +import { RoleTableDisplay } from '../../role_table_display'; +import type { RolesAPIClient } from '../../roles'; import { - NoCompatibleRealms, DeleteProvider, + NoCompatibleRealms, PermissionDenied, SectionLoading, } from '../components'; -import { EDIT_ROLE_MAPPING_PATH, getEditRoleMappingHref } from '../../management_urls'; -import { RoleMappingsAPIClient } from '../role_mappings_api_client'; -import { RoleTableDisplay } from '../../role_table_display'; -import { RolesAPIClient } from '../../roles'; -import { EnabledBadge, DisabledBadge } from '../../badges'; -import { reactRouterNavigate } from '../../../../../../../src/plugins/kibana_react/public'; +import type { RoleMappingsAPIClient } from '../role_mappings_api_client'; +import { EmptyPrompt } from './empty_prompt'; interface Props { rolesAPIClient: PublicMethodsOf; diff --git a/x-pack/plugins/security/public/management/role_mappings/role_mappings_management_app.test.tsx b/x-pack/plugins/security/public/management/role_mappings/role_mappings_management_app.test.tsx index eea505dafef69..27a579d5dd933 100644 --- a/x-pack/plugins/security/public/management/role_mappings/role_mappings_management_app.test.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/role_mappings_management_app.test.tsx @@ -23,8 +23,9 @@ jest.mock('./edit_role_mapping', () => ({ })}`, })); +import { coreMock, scopedHistoryMock } from 'src/core/public/mocks'; + import { roleMappingsManagementApp } from './role_mappings_management_app'; -import { coreMock, scopedHistoryMock } from '../../../../../../src/core/public/mocks'; async function mountApp(basePath: string, pathname: string) { const container = document.createElement('div'); diff --git a/x-pack/plugins/security/public/management/role_mappings/role_mappings_management_app.tsx b/x-pack/plugins/security/public/management/role_mappings/role_mappings_management_app.tsx index f6f49c8563cb5..1e2ce037b8fef 100644 --- a/x-pack/plugins/security/public/management/role_mappings/role_mappings_management_app.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/role_mappings_management_app.tsx @@ -7,13 +7,15 @@ import React from 'react'; import { render, unmountComponentAtNode } from 'react-dom'; -import { Router, Route, Switch, useParams } from 'react-router-dom'; +import { Route, Router, Switch, useParams } from 'react-router-dom'; + import { i18n } from '@kbn/i18n'; -import { StartServicesAccessor } from 'src/core/public'; -import { RegisterManagementAppArgs } from '../../../../../../src/plugins/management/public'; -import { PluginStartDependencies } from '../../plugin'; -import { tryDecodeURIComponent } from '../url_utils'; +import type { StartServicesAccessor } from 'src/core/public'; +import type { RegisterManagementAppArgs } from 'src/plugins/management/public'; + import { KibanaContextProvider } from '../../../../../../src/plugins/kibana_react/public'; +import type { PluginStartDependencies } from '../../plugin'; +import { tryDecodeURIComponent } from '../url_utils'; interface CreateParams { getStartServices: StartServicesAccessor; diff --git a/x-pack/plugins/security/public/management/role_table_display/role_table_display.tsx b/x-pack/plugins/security/public/management/role_table_display/role_table_display.tsx index d30fd1d0d6952..ac3ba0bd20118 100644 --- a/x-pack/plugins/security/public/management/role_table_display/role_table_display.tsx +++ b/x-pack/plugins/security/public/management/role_table_display/role_table_display.tsx @@ -5,10 +5,13 @@ * 2.0. */ +import { EuiIcon, EuiLink, EuiToolTip } from '@elastic/eui'; import React from 'react'; -import { EuiLink, EuiToolTip, EuiIcon } from '@elastic/eui'; -import { ApplicationStart } from 'kibana/public'; -import { Role, isRoleDeprecated, getExtendedRoleDeprecationNotice } from '../../../common/model'; + +import type { ApplicationStart } from 'src/core/public'; + +import type { Role } from '../../../common/model'; +import { getExtendedRoleDeprecationNotice, isRoleDeprecated } from '../../../common/model'; interface Props { role: Role | string; diff --git a/x-pack/plugins/security/public/management/roles/__fixtures__/kibana_features.ts b/x-pack/plugins/security/public/management/roles/__fixtures__/kibana_features.ts index 729ee7a661816..7bb0ba254c830 100644 --- a/x-pack/plugins/security/public/management/roles/__fixtures__/kibana_features.ts +++ b/x-pack/plugins/security/public/management/roles/__fixtures__/kibana_features.ts @@ -5,7 +5,8 @@ * 2.0. */ -import { KibanaFeature, KibanaFeatureConfig } from '../../../../../features/public'; +import type { KibanaFeatureConfig } from '../../../../../features/public'; +import { KibanaFeature } from '../../../../../features/public'; export const createFeature = ( config: Pick< diff --git a/x-pack/plugins/security/public/management/roles/__fixtures__/kibana_privileges.ts b/x-pack/plugins/security/public/management/roles/__fixtures__/kibana_privileges.ts index 97ac98b7a9f9c..de829ea003b00 100644 --- a/x-pack/plugins/security/public/management/roles/__fixtures__/kibana_privileges.ts +++ b/x-pack/plugins/security/public/management/roles/__fixtures__/kibana_privileges.ts @@ -5,16 +5,15 @@ * 2.0. */ +import type { KibanaFeature } from '../../../../../features/public'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { featuresPluginMock } from '../../../../../features/server/mocks'; +import type { SecurityLicenseFeatures } from '../../../../common/licensing'; // eslint-disable-next-line @kbn/eslint/no-restricted-paths import { Actions } from '../../../../server/authorization'; // eslint-disable-next-line @kbn/eslint/no-restricted-paths import { privilegesFactory } from '../../../../server/authorization/privileges'; -import { KibanaFeature } from '../../../../../features/public'; import { KibanaPrivileges } from '../model'; -import { SecurityLicenseFeatures } from '../../..'; - -// eslint-disable-next-line @kbn/eslint/no-restricted-paths -import { featuresPluginMock } from '../../../../../features/server/mocks'; export const createRawKibanaPrivileges = ( features: KibanaFeature[], diff --git a/x-pack/plugins/security/public/management/roles/edit_role/collapsible_panel/collapsible_panel.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/collapsible_panel/collapsible_panel.test.tsx index 2a7bc68797d86..e37b440d2c021 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/collapsible_panel/collapsible_panel.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/collapsible_panel/collapsible_panel.test.tsx @@ -7,7 +7,9 @@ import { EuiLink } from '@elastic/eui'; import React from 'react'; + import { mountWithIntl, shallowWithIntl } from '@kbn/test/jest'; + import { CollapsiblePanel } from './collapsible_panel'; test('it renders without blowing up', () => { diff --git a/x-pack/plugins/security/public/management/roles/edit_role/collapsible_panel/collapsible_panel.tsx b/x-pack/plugins/security/public/management/roles/edit_role/collapsible_panel/collapsible_panel.tsx index 87ce735c999eb..a8d98f5425657 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/collapsible_panel/collapsible_panel.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/collapsible_panel/collapsible_panel.tsx @@ -7,6 +7,7 @@ import './collapsible_panel.scss'; +import type { IconType } from '@elastic/eui'; import { EuiFlexGroup, EuiFlexItem, @@ -15,10 +16,11 @@ import { EuiPanel, EuiSpacer, EuiTitle, - IconType, } from '@elastic/eui'; +import type { ReactNode } from 'react'; +import React, { Component, Fragment } from 'react'; + import { FormattedMessage } from '@kbn/i18n/react'; -import React, { Component, Fragment, ReactNode } from 'react'; interface Props { iconType?: IconType; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/delete_role_button.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/delete_role_button.test.tsx index 735372fe87de8..1faf514e71925 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/delete_role_button.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/delete_role_button.test.tsx @@ -7,7 +7,9 @@ import { EuiButtonEmpty, EuiConfirmModal } from '@elastic/eui'; import React from 'react'; + import { mountWithIntl, shallowWithIntl } from '@kbn/test/jest'; + import { DeleteRoleButton } from './delete_role_button'; test('it renders without crashing', () => { diff --git a/x-pack/plugins/security/public/management/roles/edit_role/delete_role_button.tsx b/x-pack/plugins/security/public/management/roles/edit_role/delete_role_button.tsx index 1b3a7fa024dd1..0029e91cce780 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/delete_role_button.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/delete_role_button.tsx @@ -6,9 +6,10 @@ */ import { EuiButtonEmpty, EuiConfirmModal } from '@elastic/eui'; -import { FormattedMessage } from '@kbn/i18n/react'; import React, { Component, Fragment } from 'react'; +import { FormattedMessage } from '@kbn/i18n/react'; + interface Props { canDelete: boolean; onDelete: () => void; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/edit_role_page.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/edit_role_page.test.tsx index 6cda22c33ea42..3002db642bc1e 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/edit_role_page.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/edit_role_page.test.tsx @@ -5,25 +5,26 @@ * 2.0. */ -import { ReactWrapper } from 'enzyme'; -import React from 'react'; import { act } from '@testing-library/react'; +import type { ReactWrapper } from 'enzyme'; +import React from 'react'; + import { mountWithIntl, nextTick } from '@kbn/test/jest'; -import { Capabilities } from 'src/core/public'; -import { KibanaFeature } from '../../../../../features/public'; -import { Role } from '../../../../common/model'; -import { EditRolePage } from './edit_role_page'; -import { SimplePrivilegeSection } from './privileges/kibana/simple_privilege_section'; +import type { Capabilities } from 'src/core/public'; +import { coreMock, scopedHistoryMock } from 'src/core/public/mocks'; +import { dataPluginMock } from 'src/plugins/data/public/mocks'; -import { TransformErrorSection } from './privileges/kibana/transform_error_section'; -import { coreMock, scopedHistoryMock } from '../../../../../../../src/core/public/mocks'; -import { dataPluginMock } from '../../../../../../../src/plugins/data/public/mocks'; +import { KibanaFeature } from '../../../../../features/public'; +import type { Space } from '../../../../../spaces/public'; import { licenseMock } from '../../../../common/licensing/index.mock'; +import type { Role } from '../../../../common/model'; import { userAPIClientMock } from '../../users/index.mock'; -import { rolesAPIClientMock, indicesAPIClientMock, privilegesAPIClientMock } from '../index.mock'; -import { Space } from '../../../../../spaces/public'; -import { SpaceAwarePrivilegeSection } from './privileges/kibana/space_aware_privilege_section'; import { createRawKibanaPrivileges } from '../__fixtures__/kibana_privileges'; +import { indicesAPIClientMock, privilegesAPIClientMock, rolesAPIClientMock } from '../index.mock'; +import { EditRolePage } from './edit_role_page'; +import { SimplePrivilegeSection } from './privileges/kibana/simple_privilege_section'; +import { SpaceAwarePrivilegeSection } from './privileges/kibana/space_aware_privilege_section'; +import { TransformErrorSection } from './privileges/kibana/transform_error_section'; const buildFeatures = () => { return [ diff --git a/x-pack/plugins/security/public/management/roles/edit_role/edit_role_page.tsx b/x-pack/plugins/security/public/management/roles/edit_role/edit_role_page.tsx index 340cf4c72362d..cf9ac50b0daf0 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/edit_role_page.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/edit_role_page.tsx @@ -8,6 +8,7 @@ import { EuiButton, EuiButtonEmpty, + EuiCallOut, EuiFieldText, EuiFlexGroup, EuiFlexItem, @@ -17,57 +18,54 @@ import { EuiSpacer, EuiText, EuiTitle, - EuiCallOut, } from '@elastic/eui'; +import type { ChangeEvent, FunctionComponent, HTMLProps } from 'react'; +import React, { Fragment, useCallback, useEffect, useRef, useState } from 'react'; + import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; -import React, { - ChangeEvent, - Fragment, - FunctionComponent, - HTMLProps, - useCallback, - useEffect, - useRef, - useState, -} from 'react'; import type { PublicMethodsOf } from '@kbn/utility-types'; -import { +import type { Capabilities, + DocLinksStart, FatalErrorsSetup, HttpStart, IHttpFetchError, NotificationsStart, + ScopedHistory, } from 'src/core/public'; -import type { DocLinksStart, ScopedHistory } from 'kibana/public'; +import type { IndexPatternsContract } from 'src/plugins/data/public'; import type { SpacesApiUi } from 'src/plugins/spaces_oss/public'; -import { FeaturesPluginStart } from '../../../../../features/public'; -import { KibanaFeature } from '../../../../../features/common'; -import { IndexPatternsContract } from '../../../../../../../src/plugins/data/public'; -import { Space } from '../../../../../spaces/public'; -import { + +import { reactRouterNavigate } from '../../../../../../../src/plugins/kibana_react/public'; +import type { KibanaFeature } from '../../../../../features/common'; +import type { FeaturesPluginStart } from '../../../../../features/public'; +import type { Space } from '../../../../../spaces/public'; +import type { SecurityLicense } from '../../../../common/licensing'; +import type { + BuiltinESPrivileges, RawKibanaPrivileges, Role, - BuiltinESPrivileges, + RoleIndexPrivilege, +} from '../../../../common/model'; +import { + copyRole, + getExtendedRoleDeprecationNotice, + isRoleDeprecated as checkIfRoleDeprecated, isRoleReadOnly as checkIfRoleReadOnly, isRoleReserved as checkIfRoleReserved, - isRoleDeprecated as checkIfRoleDeprecated, - copyRole, prepareRoleClone, - RoleIndexPrivilege, - getExtendedRoleDeprecationNotice, } from '../../../../common/model'; -import { RoleValidationResult, RoleValidator } from './validate_role'; +import type { UserAPIClient } from '../../users'; +import type { IndicesAPIClient } from '../indices_api_client'; +import { KibanaPrivileges } from '../model'; +import type { PrivilegesAPIClient } from '../privileges_api_client'; +import type { RolesAPIClient } from '../roles_api_client'; import { DeleteRoleButton } from './delete_role_button'; import { ElasticsearchPrivileges, KibanaPrivilegesRegion } from './privileges'; import { ReservedRoleBadge } from './reserved_role_badge'; -import { SecurityLicense } from '../../../../common/licensing'; -import { UserAPIClient } from '../../users'; -import { IndicesAPIClient } from '../indices_api_client'; -import { RolesAPIClient } from '../roles_api_client'; -import { PrivilegesAPIClient } from '../privileges_api_client'; -import { KibanaPrivileges } from '../model'; -import { reactRouterNavigate } from '../../../../../../../src/plugins/kibana_react/public'; +import type { RoleValidationResult } from './validate_role'; +import { RoleValidator } from './validate_role'; interface Props { action: 'edit' | 'clone'; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privilege_utils.ts b/x-pack/plugins/security/public/management/roles/edit_role/privilege_utils.ts index a543aa769c093..170aa3f6e89fe 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privilege_utils.ts +++ b/x-pack/plugins/security/public/management/roles/edit_role/privilege_utils.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { RoleKibanaPrivilege } from '../../../../common/model'; +import type { RoleKibanaPrivilege } from '../../../../common/model'; /** * Determines if the passed privilege spec defines global privileges. diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/cluster_privileges.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/cluster_privileges.test.tsx index d6e841a7d37e8..baeba5829562e 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/cluster_privileges.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/cluster_privileges.test.tsx @@ -7,10 +7,12 @@ import { shallow } from 'enzyme'; import React from 'react'; -import { Role } from '../../../../../../common/model'; -import { ClusterPrivileges } from './cluster_privileges'; + import { mountWithIntl } from '@kbn/test/jest'; +import type { Role } from '../../../../../../common/model'; +import { ClusterPrivileges } from './cluster_privileges'; + test('it renders without crashing', () => { const role: Role = { name: '', diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/cluster_privileges.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/cluster_privileges.tsx index cb11dbc472e56..6d2643c4b6998 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/cluster_privileges.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/cluster_privileges.tsx @@ -6,9 +6,11 @@ */ import { EuiComboBox, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; -import React, { Component } from 'react'; import _ from 'lodash'; -import { Role, isRoleReadOnly } from '../../../../../../common/model'; +import React, { Component } from 'react'; + +import type { Role } from '../../../../../../common/model'; +import { isRoleReadOnly } from '../../../../../../common/model'; interface Props { role: Role; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/elasticsearch_privileges.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/elasticsearch_privileges.test.tsx index 7336207569fb5..0ed9362956960 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/elasticsearch_privileges.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/elasticsearch_privileges.test.tsx @@ -6,16 +6,17 @@ */ import React from 'react'; + import { mountWithIntl, shallowWithIntl } from '@kbn/test/jest'; +import { coreMock } from 'src/core/public/mocks'; + +import { licenseMock } from '../../../../../../common/licensing/index.mock'; +import { indicesAPIClientMock } from '../../../index.mock'; import { RoleValidator } from '../../validate_role'; import { ClusterPrivileges } from './cluster_privileges'; import { ElasticsearchPrivileges } from './elasticsearch_privileges'; import { IndexPrivileges } from './index_privileges'; -import { licenseMock } from '../../../../../../common/licensing/index.mock'; -import { indicesAPIClientMock } from '../../../index.mock'; -import { coreMock } from '../../../../../../../../../src/core/public/mocks'; - function getProps() { const license = licenseMock.create(); license.getFeatures.mockReturnValue({ diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/elasticsearch_privileges.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/elasticsearch_privileges.tsx index 42f18b846a60a..e1967491be1f7 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/elasticsearch_privileges.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/elasticsearch_privileges.tsx @@ -16,16 +16,18 @@ import { EuiText, EuiTitle, } from '@elastic/eui'; +import React, { Component, Fragment } from 'react'; + import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import type { PublicMethodsOf } from '@kbn/utility-types'; -import React, { Component, Fragment } from 'react'; import type { DocLinksStart } from 'src/core/public'; -import { Role, BuiltinESPrivileges } from '../../../../../../common/model'; -import { SecurityLicense } from '../../../../../../common/licensing'; -import { IndicesAPIClient } from '../../../indices_api_client'; -import { RoleValidator } from '../../validate_role'; + +import type { SecurityLicense } from '../../../../../../common/licensing'; +import type { BuiltinESPrivileges, Role } from '../../../../../../common/model'; +import type { IndicesAPIClient } from '../../../indices_api_client'; import { CollapsiblePanel } from '../../collapsible_panel'; +import type { RoleValidator } from '../../validate_role'; import { ClusterPrivileges } from './cluster_privileges'; import { IndexPrivileges } from './index_privileges'; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/index_privilege_form.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/index_privilege_form.test.tsx index 7819779eefa3c..221e0ec245fd4 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/index_privilege_form.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/index_privilege_form.test.tsx @@ -7,7 +7,9 @@ import { EuiButtonIcon, EuiTextArea } from '@elastic/eui'; import React from 'react'; + import { mountWithIntl, shallowWithIntl } from '@kbn/test/jest'; + import { RoleValidator } from '../../validate_role'; import { IndexPrivilegeForm } from './index_privilege_form'; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/index_privilege_form.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/index_privilege_form.tsx index c1c56e6082aef..697b5c1cac347 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/index_privilege_form.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/index_privilege_form.tsx @@ -5,10 +5,10 @@ * 2.0. */ +import type { EuiComboBoxOptionOption } from '@elastic/eui'; import { EuiButtonIcon, EuiComboBox, - EuiComboBoxOptionOption, EuiFlexGroup, EuiFlexItem, EuiFormRow, @@ -17,12 +17,15 @@ import { EuiSwitch, EuiTextArea, } from '@elastic/eui'; +import _ from 'lodash'; +import type { ChangeEvent } from 'react'; +import React, { Component, Fragment } from 'react'; + import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; -import _ from 'lodash'; -import React, { ChangeEvent, Component, Fragment } from 'react'; -import { RoleIndexPrivilege } from '../../../../../../common/model'; -import { RoleValidator } from '../../validate_role'; + +import type { RoleIndexPrivilege } from '../../../../../../common/model'; +import type { RoleValidator } from '../../validate_role'; const fromOption = (option: any) => option.label; const toOption = (value: string) => ({ label: value }); diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/index_privileges.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/index_privileges.test.tsx index 77ff8e8633add..5b7d703865b9c 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/index_privileges.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/index_privileges.test.tsx @@ -6,13 +6,14 @@ */ import React from 'react'; + import { mountWithIntl, shallowWithIntl } from '@kbn/test/jest'; -import { RoleValidator } from '../../validate_role'; -import { IndexPrivilegeForm } from './index_privilege_form'; -import { IndexPrivileges } from './index_privileges'; import { licenseMock } from '../../../../../../common/licensing/index.mock'; import { indicesAPIClientMock } from '../../../index.mock'; +import { RoleValidator } from '../../validate_role'; +import { IndexPrivilegeForm } from './index_privilege_form'; +import { IndexPrivileges } from './index_privileges'; // the IndexPrivileges post-mount hook kicks off some promises; // we need to wait for those promises to resolve to ensure any errors are properly caught diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/index_privileges.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/index_privileges.tsx index 34d11b3f9c159..2f6bb73fc62fb 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/index_privileges.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/index_privileges.tsx @@ -7,16 +7,14 @@ import _ from 'lodash'; import React, { Component, Fragment } from 'react'; + import type { PublicMethodsOf } from '@kbn/utility-types'; -import { - Role, - RoleIndexPrivilege, - isRoleReadOnly, - isRoleEnabled, -} from '../../../../../../common/model'; -import { SecurityLicense } from '../../../../../../common/licensing'; -import { IndicesAPIClient } from '../../../indices_api_client'; -import { RoleValidator } from '../../validate_role'; + +import type { SecurityLicense } from '../../../../../../common/licensing'; +import type { Role, RoleIndexPrivilege } from '../../../../../../common/model'; +import { isRoleEnabled, isRoleReadOnly } from '../../../../../../common/model'; +import type { IndicesAPIClient } from '../../../indices_api_client'; +import type { RoleValidator } from '../../validate_role'; import { IndexPrivilegeForm } from './index_privilege_form'; interface Props { diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/__fixtures__/index.ts b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/__fixtures__/index.ts index acfae9890d843..b43a6bee82e27 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/__fixtures__/index.ts +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/__fixtures__/index.ts @@ -5,12 +5,12 @@ * 2.0. */ -import { ReactWrapper } from 'enzyme'; - -import { EuiCheckbox, EuiCheckboxProps, EuiButtonGroup, EuiButtonGroupProps } from '@elastic/eui'; +import type { EuiButtonGroupProps, EuiCheckboxProps } from '@elastic/eui'; +import { EuiAccordion, EuiButtonGroup, EuiCheckbox } from '@elastic/eui'; +import type { ReactWrapper } from 'enzyme'; import { findTestSubject } from '@kbn/test/jest'; -import { EuiAccordion } from '@elastic/eui'; + import { SubFeatureForm } from '../sub_feature_form'; export function getDisplayedFeaturePrivileges(wrapper: ReactWrapper) { diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/change_all_privileges.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/change_all_privileges.tsx index 8cae425fa47b9..154fcda6fd4c7 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/change_all_privileges.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/change_all_privileges.tsx @@ -10,16 +10,19 @@ import './change_all_privileges.scss'; import { EuiContextMenuItem, EuiContextMenuPanel, + EuiIcon, EuiLink, EuiPopover, - EuiIcon, EuiText, } from '@elastic/eui'; -import { FormattedMessage } from '@kbn/i18n/react'; import _ from 'lodash'; import React, { Component } from 'react'; -import { KibanaPrivilege } from '../../../../model'; + +import { FormattedMessage } from '@kbn/i18n/react'; + +import type { KibanaPrivilege } from '../../../../model'; import { NO_PRIVILEGE_VALUE } from '../constants'; + interface Props { onChange: (privilege: string) => void; privileges: KibanaPrivilege[]; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/feature_table.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/feature_table.test.tsx index e805dbd6f48b2..216409642289b 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/feature_table.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/feature_table.test.tsx @@ -5,17 +5,18 @@ * 2.0. */ +import { EuiAccordion } from '@elastic/eui'; import React from 'react'; -import { FeatureTable } from './feature_table'; -import { Role } from '../../../../../../../common/model'; -import { mountWithIntl } from '@kbn/test/jest'; -import { KibanaFeature, SubFeatureConfig } from '../../../../../../../../features/public'; -import { kibanaFeatures, createFeature } from '../../../../__fixtures__/kibana_features'; + +import { findTestSubject, mountWithIntl } from '@kbn/test/jest'; + +import type { KibanaFeature, SubFeatureConfig } from '../../../../../../../../features/public'; +import type { Role } from '../../../../../../../common/model'; +import { createFeature, kibanaFeatures } from '../../../../__fixtures__/kibana_features'; import { createKibanaPrivileges } from '../../../../__fixtures__/kibana_privileges'; import { PrivilegeFormCalculator } from '../privilege_form_calculator'; import { getDisplayedFeaturePrivileges } from './__fixtures__'; -import { findTestSubject } from '@kbn/test/jest'; -import { EuiAccordion } from '@elastic/eui'; +import { FeatureTable } from './feature_table'; const createRole = (kibana: Role['kibana'] = []): Role => { return { diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/feature_table.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/feature_table.tsx index 327f740188cce..50d40fbdc4751 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/feature_table.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/feature_table.tsx @@ -5,32 +5,36 @@ * 2.0. */ +import './feature_table.scss'; + +import type { EuiAccordionProps } from '@elastic/eui'; import { - EuiAccordionProps, + EuiAccordion, EuiButtonGroup, - EuiIconTip, - EuiText, + EuiCallOut, EuiFlexGroup, EuiFlexItem, - EuiSpacer, - EuiCallOut, EuiHorizontalRule, - EuiAccordion, EuiIcon, + EuiIconTip, + EuiSpacer, + EuiText, EuiTitle, } from '@elastic/eui'; -import { FormattedMessage } from '@kbn/i18n/react'; +import type { ReactElement } from 'react'; +import React, { Component } from 'react'; + import { i18n } from '@kbn/i18n'; -import React, { Component, ReactElement } from 'react'; -import { AppCategory } from 'kibana/public'; -import { Role } from '../../../../../../../common/model'; -import { ChangeAllPrivilegesControl } from './change_all_privileges'; -import { FeatureTableExpandedRow } from './feature_table_expanded_row'; +import { FormattedMessage } from '@kbn/i18n/react'; +import type { AppCategory } from 'src/core/public'; + +import type { Role } from '../../../../../../../common/model'; +import type { KibanaPrivileges, SecuredFeature } from '../../../../model'; import { NO_PRIVILEGE_VALUE } from '../constants'; -import { PrivilegeFormCalculator } from '../privilege_form_calculator'; import { FeatureTableCell } from '../feature_table_cell'; -import { KibanaPrivileges, SecuredFeature } from '../../../../model'; -import './feature_table.scss'; +import type { PrivilegeFormCalculator } from '../privilege_form_calculator'; +import { ChangeAllPrivilegesControl } from './change_all_privileges'; +import { FeatureTableExpandedRow } from './feature_table_expanded_row'; interface Props { role: Role; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/feature_table_expanded_row.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/feature_table_expanded_row.test.tsx index e6daa851a7e90..cd1db2f9ce486 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/feature_table_expanded_row.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/feature_table_expanded_row.test.tsx @@ -5,15 +5,16 @@ * 2.0. */ +import { act } from '@testing-library/react'; import React from 'react'; -import { Role } from '../../../../../../../common/model'; -import { createKibanaPrivileges } from '../../../../__fixtures__/kibana_privileges'; + +import { findTestSubject, mountWithIntl } from '@kbn/test/jest'; + +import type { Role } from '../../../../../../../common/model'; import { kibanaFeatures } from '../../../../__fixtures__/kibana_features'; +import { createKibanaPrivileges } from '../../../../__fixtures__/kibana_privileges'; import { PrivilegeFormCalculator } from '../privilege_form_calculator'; -import { mountWithIntl } from '@kbn/test/jest'; import { FeatureTableExpandedRow } from './feature_table_expanded_row'; -import { findTestSubject } from '@kbn/test/jest'; -import { act } from '@testing-library/react'; const createRole = (kibana: Role['kibana'] = []): Role => { return { diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/feature_table_expanded_row.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/feature_table_expanded_row.tsx index 4670099362efe..e528a0fc4b850 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/feature_table_expanded_row.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/feature_table_expanded_row.tsx @@ -5,12 +5,15 @@ * 2.0. */ -import React, { useState, useEffect } from 'react'; +import type { EuiSwitchEvent } from '@elastic/eui'; +import { EuiFlexGroup, EuiFlexItem, EuiSwitch } from '@elastic/eui'; +import React, { useEffect, useState } from 'react'; + import { FormattedMessage } from '@kbn/i18n/react'; -import { EuiFlexItem, EuiFlexGroup, EuiSwitch, EuiSwitchEvent } from '@elastic/eui'; + +import type { SecuredFeature } from '../../../../model'; +import type { PrivilegeFormCalculator } from '../privilege_form_calculator'; import { SubFeatureForm } from './sub_feature_form'; -import { PrivilegeFormCalculator } from '../privilege_form_calculator'; -import { SecuredFeature } from '../../../../model'; interface Props { feature: SecuredFeature; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/sub_feature_form.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/sub_feature_form.test.tsx index b52315751e63b..d39d7acc6c3a1 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/sub_feature_form.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/sub_feature_form.test.tsx @@ -5,17 +5,19 @@ * 2.0. */ +import { EuiButtonGroup, EuiCheckbox } from '@elastic/eui'; +import { act } from '@testing-library/react'; import React from 'react'; + +import { mountWithIntl } from '@kbn/test/jest'; + +import { KibanaFeature } from '../../../../../../../../features/public'; +import type { Role } from '../../../../../../../common/model'; import { kibanaFeatures } from '../../../../__fixtures__/kibana_features'; import { createKibanaPrivileges } from '../../../../__fixtures__/kibana_privileges'; import { SecuredSubFeature } from '../../../../model'; import { PrivilegeFormCalculator } from '../privilege_form_calculator'; -import { Role } from '../../../../../../../common/model'; -import { mountWithIntl } from '@kbn/test/jest'; import { SubFeatureForm } from './sub_feature_form'; -import { EuiCheckbox, EuiButtonGroup } from '@elastic/eui'; -import { act } from '@testing-library/react'; -import { KibanaFeature } from '../../../../../../../../features/public'; // Note: these tests are not concerned with the proper display of privileges, // as that is verified by the feature_table and privilege_space_form tests. diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/sub_feature_form.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/sub_feature_form.tsx index 4cf8c49a4ec8a..494f3ec7d9acb 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/sub_feature_form.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/sub_feature_form.tsx @@ -5,17 +5,18 @@ * 2.0. */ +import { EuiButtonGroup, EuiCheckbox, EuiFlexGroup, EuiFlexItem, EuiText } from '@elastic/eui'; import React from 'react'; -import { EuiFlexGroup, EuiFlexItem, EuiText, EuiCheckbox, EuiButtonGroup } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { NO_PRIVILEGE_VALUE } from '../constants'; -import { PrivilegeFormCalculator } from '../privilege_form_calculator'; -import { + +import type { SecuredSubFeature, - SubFeaturePrivilegeGroup, SubFeaturePrivilege, + SubFeaturePrivilegeGroup, } from '../../../../model'; +import { NO_PRIVILEGE_VALUE } from '../constants'; +import type { PrivilegeFormCalculator } from '../privilege_form_calculator'; interface Props { featureId: string; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table_cell/feature_table_cell.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table_cell/feature_table_cell.test.tsx index 18e015964c355..dcd2170325006 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table_cell/feature_table_cell.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table_cell/feature_table_cell.test.tsx @@ -5,12 +5,14 @@ * 2.0. */ +import { EuiIconTip } from '@elastic/eui'; import React from 'react'; -import { createFeature } from '../../../../__fixtures__/kibana_features'; + import { mountWithIntl } from '@kbn/test/jest'; -import { FeatureTableCell } from '.'; + +import { createFeature } from '../../../../__fixtures__/kibana_features'; import { SecuredFeature } from '../../../../model'; -import { EuiIconTip } from '@elastic/eui'; +import { FeatureTableCell } from './feature_table_cell'; describe('FeatureTableCell', () => { it('renders the feature name', () => { diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table_cell/feature_table_cell.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table_cell/feature_table_cell.tsx index b9634939eee76..507416b51f9b6 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table_cell/feature_table_cell.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table_cell/feature_table_cell.tsx @@ -5,9 +5,10 @@ * 2.0. */ +import { EuiIconTip, EuiText } from '@elastic/eui'; import React from 'react'; -import { EuiText, EuiIconTip } from '@elastic/eui'; -import { SecuredFeature } from '../../../../model'; + +import type { SecuredFeature } from '../../../../model'; interface Props { feature: SecuredFeature; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/kibana_privileges_region.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/kibana_privileges_region.test.tsx index 4f08547c13d15..e27c2eb748560 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/kibana_privileges_region.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/kibana_privileges_region.test.tsx @@ -7,13 +7,14 @@ import { shallow } from 'enzyme'; import React from 'react'; -import { Role } from '../../../../../../common/model'; + +import type { Role } from '../../../../../../common/model'; +import { KibanaPrivileges } from '../../../model'; import { RoleValidator } from '../../validate_role'; import { KibanaPrivilegesRegion } from './kibana_privileges_region'; import { SimplePrivilegeSection } from './simple_privilege_section'; -import { TransformErrorSection } from './transform_error_section'; import { SpaceAwarePrivilegeSection } from './space_aware_privilege_section'; -import { KibanaPrivileges } from '../../../model'; +import { TransformErrorSection } from './transform_error_section'; const buildProps = (customProps = {}) => { return { diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/kibana_privileges_region.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/kibana_privileges_region.tsx index 308fe673c1cdb..486b1c8bc1d03 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/kibana_privileges_region.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/kibana_privileges_region.tsx @@ -6,16 +6,18 @@ */ import React, { Component } from 'react'; -import { Capabilities } from 'src/core/public'; + +import type { Capabilities } from 'src/core/public'; import type { SpacesApiUi } from 'src/plugins/spaces_oss/public'; -import { Space } from '../../../../../../../spaces/public'; -import { Role } from '../../../../../../common/model'; -import { RoleValidator } from '../../validate_role'; + +import type { Space } from '../../../../../../../spaces/public'; +import type { Role } from '../../../../../../common/model'; +import type { KibanaPrivileges } from '../../../model'; import { CollapsiblePanel } from '../../collapsible_panel'; +import type { RoleValidator } from '../../validate_role'; import { SimplePrivilegeSection } from './simple_privilege_section'; import { SpaceAwarePrivilegeSection } from './space_aware_privilege_section'; import { TransformErrorSection } from './transform_error_section'; -import { KibanaPrivileges } from '../../../model'; interface Props { role: Role; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_form_calculator/privilege_form_calculator.test.ts b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_form_calculator/privilege_form_calculator.test.ts index e8220b726a1b1..a640c5cbbf087 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_form_calculator/privilege_form_calculator.test.ts +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_form_calculator/privilege_form_calculator.test.ts @@ -5,9 +5,9 @@ * 2.0. */ -import { createKibanaPrivileges } from '../../../../__fixtures__/kibana_privileges'; +import type { Role } from '../../../../../../../common/model'; import { kibanaFeatures } from '../../../../__fixtures__/kibana_features'; -import { Role } from '../../../../../../../common/model'; +import { createKibanaPrivileges } from '../../../../__fixtures__/kibana_privileges'; import { PrivilegeFormCalculator } from './privilege_form_calculator'; const createRole = (kibana: Role['kibana'] = []): Role => { diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_form_calculator/privilege_form_calculator.ts b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_form_calculator/privilege_form_calculator.ts index 09374d13ad38e..f92d959a7208f 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_form_calculator/privilege_form_calculator.ts +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_form_calculator/privilege_form_calculator.ts @@ -5,9 +5,9 @@ * 2.0. */ -import { Role } from '../../../../../../../common/model'; +import type { Role } from '../../../../../../../common/model'; +import type { KibanaPrivileges, SubFeaturePrivilegeGroup } from '../../../../model'; import { isGlobalPrivilegeDefinition } from '../../../privilege_utils'; -import { KibanaPrivileges, SubFeaturePrivilegeGroup } from '../../../../model'; /** * Calculator responsible for determining the displayed and effective privilege values for the following interfaces: diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/__fixtures__/index.ts b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/__fixtures__/index.ts index 7e0ae311433b1..6f5c729784bb1 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/__fixtures__/index.ts +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/__fixtures__/index.ts @@ -5,14 +5,14 @@ * 2.0. */ -import { ReactWrapper } from 'enzyme'; - import { EuiTableRow } from '@elastic/eui'; +import type { ReactWrapper } from 'enzyme'; import { findTestSubject } from '@kbn/test/jest'; -import { Role, RoleKibanaPrivilege } from '../../../../../../../../common/model'; -import { PrivilegeSummaryExpandedRow } from '../privilege_summary_expanded_row'; + +import type { Role, RoleKibanaPrivilege } from '../../../../../../../../common/model'; import { FeatureTableCell } from '../../feature_table_cell'; +import { PrivilegeSummaryExpandedRow } from '../privilege_summary_expanded_row'; interface DisplayedFeaturePrivileges { [featureId: string]: { diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/privilege_summary.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/privilege_summary.test.tsx index e4ff169ed20df..b23566019b31a 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/privilege_summary.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/privilege_summary.test.tsx @@ -5,17 +5,19 @@ * 2.0. */ +import { act } from '@testing-library/react'; import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; + +import { findTestSubject, mountWithIntl } from '@kbn/test/jest'; +import { coreMock } from 'src/core/public/mocks'; + import { spacesManagerMock } from '../../../../../../../../spaces/public/spaces_manager/mocks'; import { getUiApi } from '../../../../../../../../spaces/public/ui_api'; -import { createKibanaPrivileges } from '../../../../__fixtures__/kibana_privileges'; +import type { RoleKibanaPrivilege } from '../../../../../../../common/model'; import { kibanaFeatures } from '../../../../__fixtures__/kibana_features'; -import { RoleKibanaPrivilege } from '../../../../../../../common/model'; -import { PrivilegeSummary } from '.'; -import { findTestSubject } from '@kbn/test/jest'; +import { createKibanaPrivileges } from '../../../../__fixtures__/kibana_privileges'; +import { PrivilegeSummary } from './privilege_summary'; import { PrivilegeSummaryTable } from './privilege_summary_table'; -import { coreMock } from 'src/core/public/mocks'; const createRole = (roleKibanaPrivileges: RoleKibanaPrivilege[]) => ({ name: 'some-role', @@ -64,7 +66,7 @@ describe('PrivilegeSummary', () => { expect(wrapper.find(PrivilegeSummaryTable)).toHaveLength(0); }); - it('clicking the button renders the privilege summary table', () => { + it('clicking the button renders the privilege summary table', async () => { const kibanaPrivileges = createKibanaPrivileges(kibanaFeatures); const role = createRole([ @@ -85,7 +87,10 @@ describe('PrivilegeSummary', () => { /> ); - findTestSubject(wrapper, 'viewPrivilegeSummaryButton').simulate('click'); + await act(async () => { + findTestSubject(wrapper, 'viewPrivilegeSummaryButton').simulate('click'); + }); + wrapper.update(); expect(wrapper.find(PrivilegeSummaryTable)).toHaveLength(1); }); }); diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/privilege_summary.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/privilege_summary.tsx index ebe2dc6a164c2..749c1c8ccb4e2 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/privilege_summary.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/privilege_summary.tsx @@ -5,16 +5,25 @@ * 2.0. */ -import React, { useState, Fragment } from 'react'; +import { + EuiButton, + EuiButtonEmpty, + EuiFlyout, + EuiFlyoutBody, + EuiFlyoutFooter, + EuiFlyoutHeader, + EuiOverlayMask, + EuiTitle, +} from '@elastic/eui'; +import React, { Fragment, useState } from 'react'; + import { FormattedMessage } from '@kbn/i18n/react'; -import { EuiButtonEmpty, EuiOverlayMask, EuiButton } from '@elastic/eui'; -import { EuiFlyout } from '@elastic/eui'; -import { EuiFlyoutHeader, EuiTitle, EuiFlyoutBody, EuiFlyoutFooter } from '@elastic/eui'; import type { SpacesApiUi } from 'src/plugins/spaces_oss/public'; -import { Space } from '../../../../../../../../spaces/public'; -import { Role } from '../../../../../../../common/model'; + +import type { Space } from '../../../../../../../../spaces/public'; +import type { Role } from '../../../../../../../common/model'; +import type { KibanaPrivileges } from '../../../../model'; import { PrivilegeSummaryTable } from './privilege_summary_table'; -import { KibanaPrivileges } from '../../../../model'; interface Props { role: Role; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/privilege_summary_calculator.test.ts b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/privilege_summary_calculator.test.ts index 7950bb4e91451..a6714cb7a2d83 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/privilege_summary_calculator.test.ts +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/privilege_summary_calculator.test.ts @@ -5,9 +5,9 @@ * 2.0. */ -import { Role } from '../../../../../../../common/model'; -import { createKibanaPrivileges } from '../../../../__fixtures__/kibana_privileges'; +import type { Role } from '../../../../../../../common/model'; import { kibanaFeatures } from '../../../../__fixtures__/kibana_features'; +import { createKibanaPrivileges } from '../../../../__fixtures__/kibana_privileges'; import { PrivilegeSummaryCalculator } from './privilege_summary_calculator'; const createRole = (kibana: Role['kibana'] = []): Role => { diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/privilege_summary_calculator.ts b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/privilege_summary_calculator.ts index e56d5e21c278e..14e2241cdf830 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/privilege_summary_calculator.ts +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/privilege_summary_calculator.ts @@ -5,10 +5,10 @@ * 2.0. */ -import { Role, RoleKibanaPrivilege } from '../../../../../../../common/model'; +import type { Role, RoleKibanaPrivilege } from '../../../../../../../common/model'; +import type { KibanaPrivileges, PrimaryFeaturePrivilege, SecuredFeature } from '../../../../model'; +import type { PrivilegeCollection } from '../../../../model/privilege_collection'; import { isGlobalPrivilegeDefinition } from '../../../privilege_utils'; -import { KibanaPrivileges, PrimaryFeaturePrivilege, SecuredFeature } from '../../../../model'; -import { PrivilegeCollection } from '../../../../model/privilege_collection'; export interface EffectiveFeaturePrivileges { [featureId: string]: { diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/privilege_summary_expanded_row.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/privilege_summary_expanded_row.tsx index 63ef3b0993af0..d81af7ae9de87 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/privilege_summary_expanded_row.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/privilege_summary_expanded_row.tsx @@ -5,11 +5,17 @@ * 2.0. */ +import { EuiFlexGroup, EuiFlexItem, EuiIconTip, EuiText } from '@elastic/eui'; import React from 'react'; + import { i18n } from '@kbn/i18n'; -import { EuiFlexGroup, EuiFlexItem, EuiText, EuiIconTip } from '@elastic/eui'; -import { SecuredFeature, SubFeaturePrivilegeGroup, SubFeaturePrivilege } from '../../../../model'; -import { EffectiveFeaturePrivileges } from './privilege_summary_calculator'; + +import type { + SecuredFeature, + SubFeaturePrivilege, + SubFeaturePrivilegeGroup, +} from '../../../../model'; +import type { EffectiveFeaturePrivileges } from './privilege_summary_calculator'; interface Props { feature: SecuredFeature; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/privilege_summary_table.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/privilege_summary_table.test.tsx index 1042eea3b0525..53a7084c7014e 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/privilege_summary_table.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/privilege_summary_table.test.tsx @@ -7,15 +7,18 @@ import { act } from '@testing-library/react'; import React from 'react'; + +import { mountWithIntl } from '@kbn/test/jest'; +import { coreMock } from 'src/core/public/mocks'; + import { spacesManagerMock } from '../../../../../../../../spaces/public/spaces_manager/mocks'; import { getUiApi } from '../../../../../../../../spaces/public/ui_api'; -import { createKibanaPrivileges } from '../../../../__fixtures__/kibana_privileges'; +import type { RoleKibanaPrivilege } from '../../../../../../../common/model'; import { kibanaFeatures } from '../../../../__fixtures__/kibana_features'; -import { mountWithIntl } from '@kbn/test/jest'; -import { PrivilegeSummaryTable, PrivilegeSummaryTableProps } from './privilege_summary_table'; -import { RoleKibanaPrivilege } from '../../../../../../../common/model'; +import { createKibanaPrivileges } from '../../../../__fixtures__/kibana_privileges'; import { getDisplayedFeaturePrivileges } from './__fixtures__'; -import { coreMock } from 'src/core/public/mocks'; +import type { PrivilegeSummaryTableProps } from './privilege_summary_table'; +import { PrivilegeSummaryTable } from './privilege_summary_table'; const createRole = (roleKibanaPrivileges: RoleKibanaPrivilege[]) => ({ name: 'some-role', diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/privilege_summary_table.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/privilege_summary_table.tsx index 693343889476a..582a7d6c5427e 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/privilege_summary_table.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/privilege_summary_table.tsx @@ -5,32 +5,32 @@ * 2.0. */ -import React, { useMemo, useState, Fragment } from 'react'; -import { FormattedMessage } from '@kbn/i18n/react'; +import type { EuiBasicTableColumn } from '@elastic/eui'; import { + EuiAccordion, + EuiButtonIcon, EuiFlexGroup, EuiFlexItem, - EuiInMemoryTable, - EuiBasicTableColumn, - EuiButtonIcon, EuiIcon, EuiIconTip, + EuiInMemoryTable, EuiSpacer, - EuiAccordion, EuiTitle, } from '@elastic/eui'; +import React, { Fragment, useMemo, useState } from 'react'; + +import { FormattedMessage } from '@kbn/i18n/react'; import type { SpacesApiUi } from 'src/plugins/spaces_oss/public'; -import { Space } from '../../../../../../../../spaces/public'; -import { Role, RoleKibanaPrivilege } from '../../../../../../../common/model'; + +import type { Space } from '../../../../../../../../spaces/public'; +import type { Role, RoleKibanaPrivilege } from '../../../../../../../common/model'; +import type { KibanaPrivileges, SecuredFeature } from '../../../../model'; import { isGlobalPrivilegeDefinition } from '../../../privilege_utils'; import { FeatureTableCell } from '../feature_table_cell'; -import { SpaceColumnHeader } from './space_column_header'; +import type { EffectiveFeaturePrivileges } from './privilege_summary_calculator'; +import { PrivilegeSummaryCalculator } from './privilege_summary_calculator'; import { PrivilegeSummaryExpandedRow } from './privilege_summary_expanded_row'; -import { SecuredFeature, KibanaPrivileges } from '../../../../model'; -import { - PrivilegeSummaryCalculator, - EffectiveFeaturePrivileges, -} from './privilege_summary_calculator'; +import { SpaceColumnHeader } from './space_column_header'; export interface PrivilegeSummaryTableProps { role: Role; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/space_column_header.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/space_column_header.test.tsx index 12eac1852c212..77c8cdd69ec44 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/space_column_header.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/space_column_header.test.tsx @@ -7,14 +7,16 @@ import { act } from '@testing-library/react'; import React from 'react'; + import { mountWithIntl } from '@kbn/test/jest'; +import { coreMock } from 'src/core/public/mocks'; + +import { SpaceAvatarInternal } from '../../../../../../../../spaces/public/space_avatar/space_avatar_internal'; import { spacesManagerMock } from '../../../../../../../../spaces/public/spaces_manager/mocks'; import { getUiApi } from '../../../../../../../../spaces/public/ui_api'; -import { SpaceAvatarInternal } from '../../../../../../../../spaces/public/space_avatar/space_avatar_internal'; import type { RoleKibanaPrivilege } from '../../../../../../../common/model'; -import { SpaceColumnHeader } from './space_column_header'; import { SpacesPopoverList } from '../../../spaces_popover_list'; -import { coreMock } from 'src/core/public/mocks'; +import { SpaceColumnHeader } from './space_column_header'; const spaces = [ { diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/space_column_header.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/space_column_header.tsx index 3c200fedf6ce0..fd535d20de557 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/space_column_header.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/space_column_header.tsx @@ -6,11 +6,13 @@ */ import React, { Fragment, useMemo } from 'react'; -import { FormattedMessage } from '@kbn/i18n/react'; + import { i18n } from '@kbn/i18n'; +import { FormattedMessage } from '@kbn/i18n/react'; import type { Space } from 'src/plugins/spaces_oss/common'; import type { SpacesApiUi } from 'src/plugins/spaces_oss/public'; -import { RoleKibanaPrivilege } from '../../../../../../../common/model'; + +import type { RoleKibanaPrivilege } from '../../../../../../../common/model'; import { isGlobalPrivilegeDefinition } from '../../../privilege_utils'; import { SpacesPopoverList } from '../../../spaces_popover_list'; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/simple_privilege_section/privilege_selector.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/simple_privilege_section/privilege_selector.tsx index d3734675babfc..72061958ecc35 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/simple_privilege_section/privilege_selector.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/simple_privilege_section/privilege_selector.tsx @@ -6,7 +6,9 @@ */ import { EuiSelect } from '@elastic/eui'; -import React, { ChangeEvent, Component } from 'react'; +import type { ChangeEvent } from 'react'; +import React, { Component } from 'react'; + import { NO_PRIVILEGE_VALUE } from '../constants'; interface Props { diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/simple_privilege_section/simple_privilege_section.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/simple_privilege_section/simple_privilege_section.test.tsx index 309391093929f..bb7124b6c8876 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/simple_privilege_section/simple_privilege_section.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/simple_privilege_section/simple_privilege_section.test.tsx @@ -5,13 +5,16 @@ * 2.0. */ -import { EuiButtonGroup, EuiButtonGroupProps, EuiComboBox, EuiSuperSelect } from '@elastic/eui'; +import type { EuiButtonGroupProps } from '@elastic/eui'; +import { EuiButtonGroup, EuiComboBox, EuiSuperSelect } from '@elastic/eui'; import React from 'react'; + import { mountWithIntl, shallowWithIntl } from '@kbn/test/jest'; -import { Role } from '../../../../../../../common/model'; + +import type { Role } from '../../../../../../../common/model'; +import { KibanaPrivileges, SecuredFeature } from '../../../../model'; import { SimplePrivilegeSection } from './simple_privilege_section'; import { UnsupportedSpacePrivilegesWarning } from './unsupported_space_privileges_warning'; -import { KibanaPrivileges, SecuredFeature } from '../../../../model'; const buildProps = (customProps: any = {}) => { const features = [ diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/simple_privilege_section/simple_privilege_section.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/simple_privilege_section/simple_privilege_section.tsx index fc0468dc4c615..dd1304ebdaac2 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/simple_privilege_section/simple_privilege_section.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/simple_privilege_section/simple_privilege_section.tsx @@ -7,21 +7,24 @@ import { EuiComboBox, + EuiFlexGroup, + EuiFlexItem, EuiFormRow, EuiSuperSelect, EuiText, - EuiFlexGroup, - EuiFlexItem, } from '@elastic/eui'; -import { FormattedMessage } from '@kbn/i18n/react'; import React, { Component, Fragment } from 'react'; -import { Role, RoleKibanaPrivilege, copyRole } from '../../../../../../../common/model'; + +import { FormattedMessage } from '@kbn/i18n/react'; + +import type { Role, RoleKibanaPrivilege } from '../../../../../../../common/model'; +import { copyRole } from '../../../../../../../common/model'; +import type { KibanaPrivileges } from '../../../../model'; import { isGlobalPrivilegeDefinition } from '../../../privilege_utils'; import { CUSTOM_PRIVILEGE_VALUE, NO_PRIVILEGE_VALUE } from '../constants'; import { FeatureTable } from '../feature_table'; -import { UnsupportedSpacePrivilegesWarning } from './unsupported_space_privileges_warning'; -import { KibanaPrivileges } from '../../../../model'; import { PrivilegeFormCalculator } from '../privilege_form_calculator'; +import { UnsupportedSpacePrivilegesWarning } from './unsupported_space_privileges_warning'; interface Props { role: Role; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/simple_privilege_section/unsupported_space_privileges_warning.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/simple_privilege_section/unsupported_space_privileges_warning.tsx index 39ebcafb435c2..6a81d22aceeb6 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/simple_privilege_section/unsupported_space_privileges_warning.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/simple_privilege_section/unsupported_space_privileges_warning.tsx @@ -6,9 +6,10 @@ */ import { EuiCallOut } from '@elastic/eui'; -import { FormattedMessage } from '@kbn/i18n/react'; import React, { Component } from 'react'; +import { FormattedMessage } from '@kbn/i18n/react'; + export class UnsupportedSpacePrivilegesWarning extends Component<{}, {}> { public render() { return ; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_display.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_display.test.tsx index 993e7eb2c05f4..8aa2b77f8fc12 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_display.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_display.test.tsx @@ -7,7 +7,9 @@ import { EuiText } from '@elastic/eui'; import React from 'react'; + import { mountWithIntl } from '@kbn/test/jest'; + import { PrivilegeDisplay } from './privilege_display'; describe('PrivilegeDisplay', () => { diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_display.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_display.tsx index c412b86f488f3..52e61c6e92603 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_display.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_display.tsx @@ -5,9 +5,12 @@ * 2.0. */ -import { EuiIcon, EuiText, PropsOf } from '@elastic/eui'; +import type { PropsOf } from '@elastic/eui'; +import { EuiIcon, EuiText } from '@elastic/eui'; import _ from 'lodash'; -import React, { ReactNode, FC } from 'react'; +import type { FC, ReactNode } from 'react'; +import React from 'react'; + import { NO_PRIVILEGE_VALUE } from '../constants'; interface Props extends PropsOf { diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_space_form.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_space_form.test.tsx index 2d79a8354645d..9312a2eb78018 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_space_form.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_space_form.test.tsx @@ -5,18 +5,19 @@ * 2.0. */ -import { Role } from '../../../../../../../common/model'; -import { createKibanaPrivileges } from '../../../../__fixtures__/kibana_privileges'; -import { kibanaFeatures } from '../../../../__fixtures__/kibana_features'; -import { mountWithIntl } from '@kbn/test/jest'; -import { PrivilegeSpaceForm } from './privilege_space_form'; +import { EuiButtonGroup } from '@elastic/eui'; import React from 'react'; -import { Space } from '../../../../../../../../spaces/public'; + +import { findTestSubject, mountWithIntl } from '@kbn/test/jest'; + +import type { Space } from '../../../../../../../../spaces/public'; +import type { Role } from '../../../../../../../common/model'; +import { kibanaFeatures } from '../../../../__fixtures__/kibana_features'; +import { createKibanaPrivileges } from '../../../../__fixtures__/kibana_privileges'; import { FeatureTable } from '../feature_table'; import { getDisplayedFeaturePrivileges } from '../feature_table/__fixtures__'; -import { findTestSubject } from '@kbn/test/jest'; +import { PrivilegeSpaceForm } from './privilege_space_form'; import { SpaceSelector } from './space_selector'; -import { EuiButtonGroup } from '@elastic/eui'; const createRole = (kibana: Role['kibana'] = []): Role => { return { diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_space_form.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_space_form.tsx index e146af39245f9..b290cb301866d 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_space_form.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_space_form.tsx @@ -5,11 +5,13 @@ * 2.0. */ +import type { ButtonColor } from '@elastic/eui'; import { - ButtonColor, EuiButton, EuiButtonEmpty, + EuiButtonGroup, EuiCallOut, + EuiErrorBoundary, EuiFlexGroup, EuiFlexItem, EuiFlyout, @@ -22,19 +24,20 @@ import { EuiSpacer, EuiText, EuiTitle, - EuiErrorBoundary, } from '@elastic/eui'; +import React, { Component, Fragment } from 'react'; + import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; -import React, { Component, Fragment } from 'react'; -import { EuiButtonGroup } from '@elastic/eui'; -import { Space } from '../../../../../../../../spaces/public'; -import { Role, copyRole } from '../../../../../../../common/model'; -import { SpaceSelector } from './space_selector'; -import { FeatureTable } from '../feature_table'; + +import type { Space } from '../../../../../../../../spaces/public'; +import type { Role } from '../../../../../../../common/model'; +import { copyRole } from '../../../../../../../common/model'; +import type { KibanaPrivileges } from '../../../../model'; import { CUSTOM_PRIVILEGE_VALUE } from '../constants'; +import { FeatureTable } from '../feature_table'; import { PrivilegeFormCalculator } from '../privilege_form_calculator'; -import { KibanaPrivileges } from '../../../../model'; +import { SpaceSelector } from './space_selector'; interface Props { role: Role; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_space_table.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_space_table.test.tsx index e1af748c8545a..4c657294c965c 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_space_table.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_space_table.test.tsx @@ -5,17 +5,18 @@ * 2.0. */ -import React from 'react'; import { EuiBadge, EuiInMemoryTable } from '@elastic/eui'; -import { mountWithIntl } from '@kbn/test/jest'; -import { ReactWrapper } from 'enzyme'; -import { PrivilegeSpaceTable } from './privilege_space_table'; -import { PrivilegeDisplay } from './privilege_display'; -import { Role, RoleKibanaPrivilege } from '../../../../../../../common/model'; +import type { ReactWrapper } from 'enzyme'; +import React from 'react'; + +import { findTestSubject, mountWithIntl } from '@kbn/test/jest'; + +import { KibanaFeature } from '../../../../../../../../features/public'; +import type { Role, RoleKibanaPrivilege } from '../../../../../../../common/model'; import { createKibanaPrivileges } from '../../../../__fixtures__/kibana_privileges'; import { PrivilegeFormCalculator } from '../privilege_form_calculator'; -import { KibanaFeature } from '../../../../../../../../features/public'; -import { findTestSubject } from '@kbn/test/jest'; +import { PrivilegeDisplay } from './privilege_display'; +import { PrivilegeSpaceTable } from './privilege_space_table'; interface TableRow { spaces: string[]; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_space_table.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_space_table.tsx index 0bf59feffebe8..f6f26141383f4 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_space_table.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_space_table.tsx @@ -7,27 +7,30 @@ import './privilege_space_table.scss'; +import type { EuiBadgeProps, EuiBasicTableColumn } from '@elastic/eui'; import { EuiBadge, - EuiBadgeProps, EuiButtonEmpty, EuiButtonIcon, - EuiInMemoryTable, - EuiBasicTableColumn, - EuiIcon, - EuiIconTip, EuiFlexGroup, EuiFlexItem, + EuiIcon, + EuiIconTip, + EuiInMemoryTable, } from '@elastic/eui'; +import React, { Component } from 'react'; + import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; -import React, { Component } from 'react'; -import { Space, getSpaceColor } from '../../../../../../../../spaces/public'; -import { FeaturesPrivileges, Role, copyRole } from '../../../../../../../common/model'; -import { PrivilegeDisplay } from './privilege_display'; + +import type { Space } from '../../../../../../../../spaces/public'; +import { getSpaceColor } from '../../../../../../../../spaces/public'; +import type { FeaturesPrivileges, Role } from '../../../../../../../common/model'; +import { copyRole } from '../../../../../../../common/model'; import { isGlobalPrivilegeDefinition } from '../../../privilege_utils'; -import { PrivilegeFormCalculator } from '../privilege_form_calculator'; import { CUSTOM_PRIVILEGE_VALUE } from '../constants'; +import type { PrivilegeFormCalculator } from '../privilege_form_calculator'; +import { PrivilegeDisplay } from './privilege_display'; const SPACES_DISPLAY_COUNT = 4; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/space_aware_privilege_section.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/space_aware_privilege_section.test.tsx index 11c8e5585c9d5..ebc82f28f5426 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/space_aware_privilege_section.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/space_aware_privilege_section.test.tsx @@ -6,14 +6,16 @@ */ import React from 'react'; + import { mountWithIntl, shallowWithIntl } from '@kbn/test/jest'; + +import { kibanaFeatures } from '../../../../__fixtures__/kibana_features'; +import { createKibanaPrivileges } from '../../../../__fixtures__/kibana_privileges'; import { RoleValidator } from '../../../validate_role'; +import { PrivilegeSummary } from '../privilege_summary'; import { PrivilegeSpaceForm } from './privilege_space_form'; import { PrivilegeSpaceTable } from './privilege_space_table'; import { SpaceAwarePrivilegeSection } from './space_aware_privilege_section'; -import { PrivilegeSummary } from '../privilege_summary'; -import { createKibanaPrivileges } from '../../../../__fixtures__/kibana_privileges'; -import { kibanaFeatures } from '../../../../__fixtures__/kibana_features'; const buildProps = (customProps: any = {}) => { return { diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/space_aware_privilege_section.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/space_aware_privilege_section.tsx index ae0a6a503c73a..08c220b54f471 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/space_aware_privilege_section.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/space_aware_privilege_section.tsx @@ -9,25 +9,28 @@ import { EuiButton, EuiCallOut, EuiEmptyPrompt, + EuiErrorBoundary, EuiFlexGroup, EuiFlexItem, EuiSpacer, - EuiErrorBoundary, } from '@elastic/eui'; -import { i18n } from '@kbn/i18n'; -import { FormattedMessage } from '@kbn/i18n/react'; import _ from 'lodash'; import React, { Component, Fragment } from 'react'; -import { Capabilities } from 'src/core/public'; + +import { i18n } from '@kbn/i18n'; +import { FormattedMessage } from '@kbn/i18n/react'; +import type { Capabilities } from 'src/core/public'; import type { SpacesApiUi } from 'src/plugins/spaces_oss/public'; -import { Space } from '../../../../../../../../spaces/public'; -import { Role, isRoleReserved } from '../../../../../../../common/model'; -import { RoleValidator } from '../../../validate_role'; -import { PrivilegeSpaceTable } from './privilege_space_table'; -import { PrivilegeSpaceForm } from './privilege_space_form'; + +import type { Space } from '../../../../../../../../spaces/public'; +import type { Role } from '../../../../../../../common/model'; +import { isRoleReserved } from '../../../../../../../common/model'; +import type { KibanaPrivileges } from '../../../../model'; +import type { RoleValidator } from '../../../validate_role'; import { PrivilegeFormCalculator } from '../privilege_form_calculator'; import { PrivilegeSummary } from '../privilege_summary'; -import { KibanaPrivileges } from '../../../../model'; +import { PrivilegeSpaceForm } from './privilege_space_form'; +import { PrivilegeSpaceTable } from './privilege_space_table'; interface Props { kibanaPrivileges: KibanaPrivileges; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/space_selector.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/space_selector.tsx index 99b15edb6563f..3e84e02a00008 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/space_selector.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/space_selector.tsx @@ -5,10 +5,14 @@ * 2.0. */ -import { EuiComboBox, EuiComboBoxOptionOption, EuiHealth, EuiHighlight } from '@elastic/eui'; -import { i18n } from '@kbn/i18n'; +import type { EuiComboBoxOptionOption } from '@elastic/eui'; +import { EuiComboBox, EuiHealth, EuiHighlight } from '@elastic/eui'; import React, { Component } from 'react'; -import { getSpaceColor, Space } from '../../../../../../../../spaces/public'; + +import { i18n } from '@kbn/i18n'; + +import type { Space } from '../../../../../../../../spaces/public'; +import { getSpaceColor } from '../../../../../../../../spaces/public'; const spaceToOption = (space?: Space, currentSelection?: 'global' | 'spaces') => { if (!space) { diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/transform_error_section/transform_error_section.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/transform_error_section/transform_error_section.tsx index 3a06f69ca795e..962fee3ffdc4d 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/transform_error_section/transform_error_section.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/transform_error_section/transform_error_section.tsx @@ -6,9 +6,10 @@ */ import { EuiEmptyPrompt } from '@elastic/eui'; -import { FormattedMessage } from '@kbn/i18n/react'; import React, { PureComponent } from 'react'; +import { FormattedMessage } from '@kbn/i18n/react'; + export class TransformErrorSection extends PureComponent<{}, {}> { public render() { return ( diff --git a/x-pack/plugins/security/public/management/roles/edit_role/reserved_role_badge.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/reserved_role_badge.test.tsx index 84bc51e765e67..3145c43f2be42 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/reserved_role_badge.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/reserved_role_badge.test.tsx @@ -8,7 +8,8 @@ import { EuiIcon } from '@elastic/eui'; import { shallow } from 'enzyme'; import React from 'react'; -import { Role } from '../../../../common/model'; + +import type { Role } from '../../../../common/model'; import { ReservedRoleBadge } from './reserved_role_badge'; const reservedRole: Role = { diff --git a/x-pack/plugins/security/public/management/roles/edit_role/reserved_role_badge.tsx b/x-pack/plugins/security/public/management/roles/edit_role/reserved_role_badge.tsx index 85d575d38ff6f..8445fa4e7569a 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/reserved_role_badge.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/reserved_role_badge.tsx @@ -5,11 +5,13 @@ * 2.0. */ +import { EuiIcon, EuiToolTip } from '@elastic/eui'; import React from 'react'; -import { EuiIcon, EuiToolTip } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; -import { Role, isRoleReserved } from '../../../../common/model'; + +import type { Role } from '../../../../common/model'; +import { isRoleReserved } from '../../../../common/model'; interface Props { role: Role; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/spaces_popover_list/spaces_popover_list.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/spaces_popover_list/spaces_popover_list.test.tsx index a9b49eb2b137c..673346a6f1444 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/spaces_popover_list/spaces_popover_list.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/spaces_popover_list/spaces_popover_list.test.tsx @@ -5,22 +5,24 @@ * 2.0. */ -import { act } from '@testing-library/react'; -import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; -import { SpacesPopoverList } from '.'; import { EuiButtonEmpty, - EuiContextMenuPanel, EuiContextMenuItem, + EuiContextMenuPanel, EuiFieldSearch, EuiPopover, } from '@elastic/eui'; +import { act } from '@testing-library/react'; +import React from 'react'; + +import { mountWithIntl } from '@kbn/test/jest'; +import { coreMock } from 'src/core/public/mocks'; import type { Space } from 'src/plugins/spaces_oss/common'; + +import { SpaceAvatarInternal } from '../../../../../../spaces/public/space_avatar/space_avatar_internal'; import { spacesManagerMock } from '../../../../../../spaces/public/spaces_manager/mocks'; import { getUiApi } from '../../../../../../spaces/public/ui_api'; -import { SpaceAvatarInternal } from '../../../../../../spaces/public/space_avatar/space_avatar_internal'; -import { coreMock } from 'src/core/public/mocks'; +import { SpacesPopoverList } from './spaces_popover_list'; const mockSpaces = [ { diff --git a/x-pack/plugins/security/public/management/roles/edit_role/spaces_popover_list/spaces_popover_list.tsx b/x-pack/plugins/security/public/management/roles/edit_role/spaces_popover_list/spaces_popover_list.tsx index 783fbf03f766d..9861b008beb9f 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/spaces_popover_list/spaces_popover_list.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/spaces_popover_list/spaces_popover_list.tsx @@ -15,11 +15,13 @@ import { EuiPopover, EuiText, } from '@elastic/eui'; -import { FormattedMessage } from '@kbn/i18n/react'; -import { i18n } from '@kbn/i18n'; import React, { Component, memo } from 'react'; + +import { i18n } from '@kbn/i18n'; +import { FormattedMessage } from '@kbn/i18n/react'; import type { Space } from 'src/plugins/spaces_oss/common'; import type { SpacesApiUi } from 'src/plugins/spaces_oss/public'; + import { SPACE_SEARCH_COUNT_THRESHOLD } from '../../../../../../spaces/common'; interface Props { diff --git a/x-pack/plugins/security/public/management/roles/edit_role/validate_role.test.ts b/x-pack/plugins/security/public/management/roles/edit_role/validate_role.test.ts index 780d393278fde..f508e444dc714 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/validate_role.test.ts +++ b/x-pack/plugins/security/public/management/roles/edit_role/validate_role.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { Role } from '../../../../common/model'; +import type { Role } from '../../../../common/model'; import { RoleValidator } from './validate_role'; let validator: RoleValidator; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/validate_role.ts b/x-pack/plugins/security/public/management/roles/edit_role/validate_role.ts index e70aba7308e43..ac509dba353d2 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/validate_role.ts +++ b/x-pack/plugins/security/public/management/roles/edit_role/validate_role.ts @@ -6,8 +6,9 @@ */ import { i18n } from '@kbn/i18n'; -import { Role, RoleIndexPrivilege } from '../../../../common/model'; -import { NAME_REGEX, MAX_NAME_LENGTH } from '../../../../common/constants'; + +import { MAX_NAME_LENGTH, NAME_REGEX } from '../../../../common/constants'; +import type { Role, RoleIndexPrivilege } from '../../../../common/model'; interface RoleValidatorOptions { shouldValidate?: boolean; diff --git a/x-pack/plugins/security/public/management/roles/indices_api_client.ts b/x-pack/plugins/security/public/management/roles/indices_api_client.ts index b55382332dec2..ebec4d858d7ad 100644 --- a/x-pack/plugins/security/public/management/roles/indices_api_client.ts +++ b/x-pack/plugins/security/public/management/roles/indices_api_client.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { HttpStart } from 'src/core/public'; +import type { HttpStart } from 'src/core/public'; export class IndicesAPIClient { constructor(private readonly http: HttpStart) {} diff --git a/x-pack/plugins/security/public/management/roles/model/kibana_privileges.test.ts b/x-pack/plugins/security/public/management/roles/model/kibana_privileges.test.ts index 4697481c4021d..7d26a08511e40 100644 --- a/x-pack/plugins/security/public/management/roles/model/kibana_privileges.test.ts +++ b/x-pack/plugins/security/public/management/roles/model/kibana_privileges.test.ts @@ -5,11 +5,11 @@ * 2.0. */ -import { createRawKibanaPrivileges } from '../__fixtures__/kibana_privileges'; +import type { RoleKibanaPrivilege } from '../../../../common/model'; import { kibanaFeatures } from '../__fixtures__/kibana_features'; -import { KibanaPrivileges } from './kibana_privileges'; -import { RoleKibanaPrivilege } from '../../../../common/model'; +import { createRawKibanaPrivileges } from '../__fixtures__/kibana_privileges'; import { KibanaPrivilege } from './kibana_privilege'; +import { KibanaPrivileges } from './kibana_privileges'; describe('KibanaPrivileges', () => { describe('#getBasePrivileges', () => { diff --git a/x-pack/plugins/security/public/management/roles/model/kibana_privileges.ts b/x-pack/plugins/security/public/management/roles/model/kibana_privileges.ts index ba6070393e255..c2dd66172f751 100644 --- a/x-pack/plugins/security/public/management/roles/model/kibana_privileges.ts +++ b/x-pack/plugins/security/public/management/roles/model/kibana_privileges.ts @@ -5,12 +5,12 @@ * 2.0. */ -import { RawKibanaPrivileges, RoleKibanaPrivilege } from '../../../../common/model'; +import type { KibanaFeature } from '../../../../../features/common'; +import type { RawKibanaPrivileges, RoleKibanaPrivilege } from '../../../../common/model'; +import { isGlobalPrivilegeDefinition } from '../edit_role/privilege_utils'; import { KibanaPrivilege } from './kibana_privilege'; import { PrivilegeCollection } from './privilege_collection'; import { SecuredFeature } from './secured_feature'; -import { KibanaFeature } from '../../../../../features/common'; -import { isGlobalPrivilegeDefinition } from '../edit_role/privilege_utils'; function toBasePrivilege(entry: [string, string[]]): [string, KibanaPrivilege] { const [privilegeId, actions] = entry; diff --git a/x-pack/plugins/security/public/management/roles/model/primary_feature_privilege.ts b/x-pack/plugins/security/public/management/roles/model/primary_feature_privilege.ts index 4d711297821e6..323575862de52 100644 --- a/x-pack/plugins/security/public/management/roles/model/primary_feature_privilege.ts +++ b/x-pack/plugins/security/public/management/roles/model/primary_feature_privilege.ts @@ -5,8 +5,8 @@ * 2.0. */ +import type { FeatureKibanaPrivileges } from '../../../../../features/public'; import { KibanaPrivilege } from './kibana_privilege'; -import { FeatureKibanaPrivileges } from '../../../../../features/public'; export class PrimaryFeaturePrivilege extends KibanaPrivilege { constructor( diff --git a/x-pack/plugins/security/public/management/roles/model/privilege_collection.ts b/x-pack/plugins/security/public/management/roles/model/privilege_collection.ts index 3d57f1fe875d6..e08b7d849402a 100644 --- a/x-pack/plugins/security/public/management/roles/model/privilege_collection.ts +++ b/x-pack/plugins/security/public/management/roles/model/privilege_collection.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { KibanaPrivilege } from './kibana_privilege'; +import type { KibanaPrivilege } from './kibana_privilege'; export class PrivilegeCollection { private actions: ReadonlySet; diff --git a/x-pack/plugins/security/public/management/roles/model/secured_feature.ts b/x-pack/plugins/security/public/management/roles/model/secured_feature.ts index 917ce634a2543..c5d879b9d2d54 100644 --- a/x-pack/plugins/security/public/management/roles/model/secured_feature.ts +++ b/x-pack/plugins/security/public/management/roles/model/secured_feature.ts @@ -5,10 +5,11 @@ * 2.0. */ -import { KibanaFeature, KibanaFeatureConfig } from '../../../../../features/common'; +import type { KibanaFeatureConfig } from '../../../../../features/common'; +import { KibanaFeature } from '../../../../../features/common'; import { PrimaryFeaturePrivilege } from './primary_feature_privilege'; import { SecuredSubFeature } from './secured_sub_feature'; -import { SubFeaturePrivilege } from './sub_feature_privilege'; +import type { SubFeaturePrivilege } from './sub_feature_privilege'; export class SecuredFeature extends KibanaFeature { private readonly primaryFeaturePrivileges: PrimaryFeaturePrivilege[]; diff --git a/x-pack/plugins/security/public/management/roles/model/secured_sub_feature.ts b/x-pack/plugins/security/public/management/roles/model/secured_sub_feature.ts index a3bf49f1bd39d..d143d7f217547 100644 --- a/x-pack/plugins/security/public/management/roles/model/secured_sub_feature.ts +++ b/x-pack/plugins/security/public/management/roles/model/secured_sub_feature.ts @@ -5,7 +5,8 @@ * 2.0. */ -import { SubFeature, SubFeatureConfig } from '../../../../../features/common'; +import type { SubFeatureConfig } from '../../../../../features/common'; +import { SubFeature } from '../../../../../features/common'; import { SubFeaturePrivilege } from './sub_feature_privilege'; import { SubFeaturePrivilegeGroup } from './sub_feature_privilege_group'; diff --git a/x-pack/plugins/security/public/management/roles/model/sub_feature_privilege.ts b/x-pack/plugins/security/public/management/roles/model/sub_feature_privilege.ts index e84153b6a6e72..a10c38cb3f818 100644 --- a/x-pack/plugins/security/public/management/roles/model/sub_feature_privilege.ts +++ b/x-pack/plugins/security/public/management/roles/model/sub_feature_privilege.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { SubFeaturePrivilegeConfig } from '../../../../../features/public'; +import type { SubFeaturePrivilegeConfig } from '../../../../../features/public'; import { KibanaPrivilege } from './kibana_privilege'; export class SubFeaturePrivilege extends KibanaPrivilege { diff --git a/x-pack/plugins/security/public/management/roles/model/sub_feature_privilege_group.ts b/x-pack/plugins/security/public/management/roles/model/sub_feature_privilege_group.ts index 6e2b61b439fea..ca18ef28e0a73 100644 --- a/x-pack/plugins/security/public/management/roles/model/sub_feature_privilege_group.ts +++ b/x-pack/plugins/security/public/management/roles/model/sub_feature_privilege_group.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { SubFeaturePrivilegeGroupConfig } from '../../../../../features/common'; +import type { SubFeaturePrivilegeGroupConfig } from '../../../../../features/common'; import { SubFeaturePrivilege } from './sub_feature_privilege'; export class SubFeaturePrivilegeGroup { diff --git a/x-pack/plugins/security/public/management/roles/privileges_api_client.ts b/x-pack/plugins/security/public/management/roles/privileges_api_client.ts index e9a6884790cba..0bb89eebb6b11 100644 --- a/x-pack/plugins/security/public/management/roles/privileges_api_client.ts +++ b/x-pack/plugins/security/public/management/roles/privileges_api_client.ts @@ -5,8 +5,9 @@ * 2.0. */ -import { HttpStart } from 'src/core/public'; -import { BuiltinESPrivileges, RawKibanaPrivileges } from '../../../common/model'; +import type { HttpStart } from 'src/core/public'; + +import type { BuiltinESPrivileges, RawKibanaPrivileges } from '../../../common/model'; export class PrivilegesAPIClient { constructor(private readonly http: HttpStart) {} diff --git a/x-pack/plugins/security/public/management/roles/roles_api_client.test.ts b/x-pack/plugins/security/public/management/roles/roles_api_client.test.ts index b2d0b4d2b7755..3bae230377b84 100644 --- a/x-pack/plugins/security/public/management/roles/roles_api_client.test.ts +++ b/x-pack/plugins/security/public/management/roles/roles_api_client.test.ts @@ -5,9 +5,10 @@ * 2.0. */ -import { Role } from '../../../common/model'; +import { httpServiceMock } from 'src/core/public/mocks'; + +import type { Role } from '../../../common/model'; import { RolesAPIClient } from './roles_api_client'; -import { httpServiceMock } from '../../../../../../src/core/public/mocks'; describe('RolesAPIClient', () => { async function saveRole(role: Role, spacesEnabled: boolean) { diff --git a/x-pack/plugins/security/public/management/roles/roles_api_client.ts b/x-pack/plugins/security/public/management/roles/roles_api_client.ts index c9cd5c11b2e0f..aff3a7ccacd66 100644 --- a/x-pack/plugins/security/public/management/roles/roles_api_client.ts +++ b/x-pack/plugins/security/public/management/roles/roles_api_client.ts @@ -5,8 +5,10 @@ * 2.0. */ -import { HttpStart } from 'src/core/public'; -import { Role, RoleIndexPrivilege, copyRole } from '../../../common/model'; +import type { HttpStart } from 'src/core/public'; + +import type { Role, RoleIndexPrivilege } from '../../../common/model'; +import { copyRole } from '../../../common/model'; import { isGlobalPrivilegeDefinition } from './edit_role/privilege_utils'; export class RolesAPIClient { diff --git a/x-pack/plugins/security/public/management/roles/roles_grid/confirm_delete/confirm_delete.tsx b/x-pack/plugins/security/public/management/roles/roles_grid/confirm_delete/confirm_delete.tsx index 81302465bb373..e5ec22507925e 100644 --- a/x-pack/plugins/security/public/management/roles/roles_grid/confirm_delete/confirm_delete.tsx +++ b/x-pack/plugins/security/public/management/roles/roles_grid/confirm_delete/confirm_delete.tsx @@ -5,7 +5,6 @@ * 2.0. */ -import React, { Component, Fragment } from 'react'; import { EuiButton, EuiButtonEmpty, @@ -16,11 +15,14 @@ import { EuiModalHeaderTitle, EuiText, } from '@elastic/eui'; +import React, { Component, Fragment } from 'react'; + import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import type { PublicMethodsOf } from '@kbn/utility-types'; -import { NotificationsStart } from 'src/core/public'; -import { RolesAPIClient } from '../../roles_api_client'; +import type { NotificationsStart } from 'src/core/public'; + +import type { RolesAPIClient } from '../../roles_api_client'; interface Props { rolesToDelete: string[]; diff --git a/x-pack/plugins/security/public/management/roles/roles_grid/permission_denied/permission_denied.tsx b/x-pack/plugins/security/public/management/roles/roles_grid/permission_denied/permission_denied.tsx index 43f7a6c671826..5506bce345ffb 100644 --- a/x-pack/plugins/security/public/management/roles/roles_grid/permission_denied/permission_denied.tsx +++ b/x-pack/plugins/security/public/management/roles/roles_grid/permission_denied/permission_denied.tsx @@ -6,9 +6,10 @@ */ import { EuiEmptyPrompt, EuiFlexGroup, EuiPageContent } from '@elastic/eui'; -import { FormattedMessage } from '@kbn/i18n/react'; import React from 'react'; +import { FormattedMessage } from '@kbn/i18n/react'; + export const PermissionDenied = () => ( diff --git a/x-pack/plugins/security/public/management/roles/roles_grid/roles_grid_page.test.tsx b/x-pack/plugins/security/public/management/roles/roles_grid/roles_grid_page.test.tsx index 025055d414a5c..9194fea271442 100644 --- a/x-pack/plugins/security/public/management/roles/roles_grid/roles_grid_page.test.tsx +++ b/x-pack/plugins/security/public/management/roles/roles_grid/roles_grid_page.test.tsx @@ -5,19 +5,19 @@ * 2.0. */ -import { EuiIcon, EuiBasicTable } from '@elastic/eui'; -import type { PublicMethodsOf } from '@kbn/utility-types'; -import { ReactWrapper } from 'enzyme'; +import { EuiBasicTable, EuiIcon } from '@elastic/eui'; +import type { ReactWrapper } from 'enzyme'; import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; -import { RolesAPIClient } from '../roles_api_client'; -import { PermissionDenied } from './permission_denied'; -import { RolesGridPage } from './roles_grid_page'; -import { coreMock, scopedHistoryMock } from '../../../../../../../src/core/public/mocks'; +import { findTestSubject, mountWithIntl } from '@kbn/test/jest'; +import type { PublicMethodsOf } from '@kbn/utility-types'; +import { coreMock, scopedHistoryMock } from 'src/core/public/mocks'; + +import { DisabledBadge, ReservedBadge } from '../../badges'; import { rolesAPIClientMock } from '../index.mock'; -import { ReservedBadge, DisabledBadge } from '../../badges'; -import { findTestSubject } from '@kbn/test/jest'; +import type { RolesAPIClient } from '../roles_api_client'; +import { PermissionDenied } from './permission_denied'; +import { RolesGridPage } from './roles_grid_page'; const mock403 = () => ({ body: { statusCode: 403 } }); diff --git a/x-pack/plugins/security/public/management/roles/roles_grid/roles_grid_page.tsx b/x-pack/plugins/security/public/management/roles/roles_grid/roles_grid_page.tsx index b23a5ee3d5322..5f90774d7dfed 100644 --- a/x-pack/plugins/security/public/management/roles/roles_grid/roles_grid_page.tsx +++ b/x-pack/plugins/security/public/management/roles/roles_grid/roles_grid_page.tsx @@ -5,43 +5,43 @@ * 2.0. */ -import _ from 'lodash'; -import React, { Component } from 'react'; +import type { EuiBasicTableColumn, EuiSwitchEvent } from '@elastic/eui'; import { EuiButton, + EuiButtonIcon, + EuiFlexGroup, + EuiFlexItem, EuiInMemoryTable, EuiLink, EuiPageContent, EuiPageContentBody, EuiPageContentHeader, EuiPageContentHeaderSection, + EuiSwitch, EuiText, EuiTitle, - EuiButtonIcon, - EuiBasicTableColumn, - EuiSwitchEvent, - EuiSwitch, - EuiFlexGroup, - EuiFlexItem, } from '@elastic/eui'; +import _ from 'lodash'; +import React, { Component } from 'react'; + import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import type { PublicMethodsOf } from '@kbn/utility-types'; -import { NotificationsStart } from 'src/core/public'; -import { ScopedHistory } from 'kibana/public'; +import type { NotificationsStart, ScopedHistory } from 'src/core/public'; + +import { reactRouterNavigate } from '../../../../../../../src/plugins/kibana_react/public'; +import type { Role } from '../../../../common/model'; import { - Role, + getExtendedRoleDeprecationNotice, + isRoleDeprecated, isRoleEnabled, isRoleReadOnly, isRoleReserved, - isRoleDeprecated, - getExtendedRoleDeprecationNotice, } from '../../../../common/model'; -import { RolesAPIClient } from '../roles_api_client'; +import { DeprecatedBadge, DisabledBadge, ReservedBadge } from '../../badges'; +import type { RolesAPIClient } from '../roles_api_client'; import { ConfirmDelete } from './confirm_delete'; import { PermissionDenied } from './permission_denied'; -import { DisabledBadge, DeprecatedBadge, ReservedBadge } from '../../badges'; -import { reactRouterNavigate } from '../../../../../../../src/plugins/kibana_react/public'; interface Props { notifications: NotificationsStart; diff --git a/x-pack/plugins/security/public/management/roles/roles_management_app.test.tsx b/x-pack/plugins/security/public/management/roles/roles_management_app.test.tsx index 19726720b5ea2..5c6547dee3cd3 100644 --- a/x-pack/plugins/security/public/management/roles/roles_management_app.test.tsx +++ b/x-pack/plugins/security/public/management/roles/roles_management_app.test.tsx @@ -5,7 +5,11 @@ * 2.0. */ +import { coreMock, scopedHistoryMock } from 'src/core/public/mocks'; + +import { featuresPluginMock } from '../../../../features/public/mocks'; import { licenseMock } from '../../../common/licensing/index.mock'; +import { rolesManagementApp } from './roles_management_app'; jest.mock('./roles_grid', () => ({ RolesGridPage: (props: any) => `Roles Page: ${JSON.stringify(props)}`, @@ -17,11 +21,6 @@ jest.mock('./edit_role', () => ({ `Role Edit Page: ${JSON.stringify({ ...props, docLinks: props.docLinks ? {} : undefined })}`, })); -import { rolesManagementApp } from './roles_management_app'; - -import { coreMock, scopedHistoryMock } from '../../../../../../src/core/public/mocks'; -import { featuresPluginMock } from '../../../../features/public/mocks'; - async function mountApp(basePath: string, pathname: string) { const { fatalErrors } = coreMock.createSetup(); const container = document.createElement('div'); diff --git a/x-pack/plugins/security/public/management/roles/roles_management_app.tsx b/x-pack/plugins/security/public/management/roles/roles_management_app.tsx index 72405b579b0c4..b635be8e0e49d 100644 --- a/x-pack/plugins/security/public/management/roles/roles_management_app.tsx +++ b/x-pack/plugins/security/public/management/roles/roles_management_app.tsx @@ -7,12 +7,14 @@ import React from 'react'; import { render, unmountComponentAtNode } from 'react-dom'; -import { Router, Route, Switch, useParams } from 'react-router-dom'; +import { Route, Router, Switch, useParams } from 'react-router-dom'; + import { i18n } from '@kbn/i18n'; -import { StartServicesAccessor, FatalErrorsSetup } from 'src/core/public'; -import { RegisterManagementAppArgs } from '../../../../../../src/plugins/management/public'; -import { SecurityLicense } from '../../../common/licensing'; -import { PluginStartDependencies } from '../../plugin'; +import type { FatalErrorsSetup, StartServicesAccessor } from 'src/core/public'; +import type { RegisterManagementAppArgs } from 'src/plugins/management/public'; + +import type { SecurityLicense } from '../../../common/licensing'; +import type { PluginStartDependencies } from '../../plugin'; import { tryDecodeURIComponent } from '../url_utils'; interface CreateParams { diff --git a/x-pack/plugins/security/public/management/users/components/change_password_form/change_password_form.test.tsx b/x-pack/plugins/security/public/management/users/components/change_password_form/change_password_form.test.tsx index 9631b457ca272..3d8c95d52f505 100644 --- a/x-pack/plugins/security/public/management/users/components/change_password_form/change_password_form.test.tsx +++ b/x-pack/plugins/security/public/management/users/components/change_password_form/change_password_form.test.tsx @@ -6,14 +6,15 @@ */ import { EuiFieldPassword } from '@elastic/eui'; -import { ReactWrapper } from 'enzyme'; +import type { ReactWrapper } from 'enzyme'; import React from 'react'; + import { mountWithIntl } from '@kbn/test/jest'; -import { User } from '../../../../../common/model'; -import { ChangePasswordForm } from './change_password_form'; +import { coreMock } from 'src/core/public/mocks'; -import { coreMock } from '../../../../../../../../src/core/public/mocks'; +import type { User } from '../../../../../common/model'; import { userAPIClientMock } from '../../index.mock'; +import { ChangePasswordForm } from './change_password_form'; function getCurrentPasswordField(wrapper: ReactWrapper) { return wrapper.find(EuiFieldPassword).filter('[data-test-subj="currentPassword"]'); diff --git a/x-pack/plugins/security/public/management/users/components/change_password_form/change_password_form.tsx b/x-pack/plugins/security/public/management/users/components/change_password_form/change_password_form.tsx index c8790daf64130..b412ef5350974 100644 --- a/x-pack/plugins/security/public/management/users/components/change_password_form/change_password_form.tsx +++ b/x-pack/plugins/security/public/management/users/components/change_password_form/change_password_form.tsx @@ -15,13 +15,16 @@ import { EuiFormRow, } from '@elastic/eui'; import _ from 'lodash'; +import type { ChangeEvent } from 'react'; +import React, { Component } from 'react'; + import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import type { PublicMethodsOf } from '@kbn/utility-types'; -import React, { ChangeEvent, Component } from 'react'; -import { NotificationsStart } from 'src/core/public'; -import { User } from '../../../../../common/model'; -import { UserAPIClient } from '../..'; +import type { NotificationsStart } from 'src/core/public'; + +import type { User } from '../../../../../common/model'; +import type { UserAPIClient } from '../../user_api_client'; interface Props { user: User; diff --git a/x-pack/plugins/security/public/management/users/components/confirm_delete_users/confirm_delete_users.test.tsx b/x-pack/plugins/security/public/management/users/components/confirm_delete_users/confirm_delete_users.test.tsx index c8d2f949949e5..5ce22b42e624f 100644 --- a/x-pack/plugins/security/public/management/users/components/confirm_delete_users/confirm_delete_users.test.tsx +++ b/x-pack/plugins/security/public/management/users/components/confirm_delete_users/confirm_delete_users.test.tsx @@ -5,12 +5,13 @@ * 2.0. */ -import { mountWithIntl } from '@kbn/test/jest'; -import { ConfirmDeleteUsers } from './confirm_delete_users'; import React from 'react'; -import { coreMock } from '../../../../../../../../src/core/public/mocks'; +import { mountWithIntl } from '@kbn/test/jest'; +import { coreMock } from 'src/core/public/mocks'; + import { userAPIClientMock } from '../../index.mock'; +import { ConfirmDeleteUsers } from './confirm_delete_users'; describe('ConfirmDeleteUsers', () => { it('renders a warning for a single user', () => { diff --git a/x-pack/plugins/security/public/management/users/components/confirm_delete_users/confirm_delete_users.tsx b/x-pack/plugins/security/public/management/users/components/confirm_delete_users/confirm_delete_users.tsx index 38adca145dfc5..ba3b29a92fd50 100644 --- a/x-pack/plugins/security/public/management/users/components/confirm_delete_users/confirm_delete_users.tsx +++ b/x-pack/plugins/security/public/management/users/components/confirm_delete_users/confirm_delete_users.tsx @@ -5,13 +5,15 @@ * 2.0. */ -import React, { Component, Fragment } from 'react'; import { EuiConfirmModal } from '@elastic/eui'; +import React, { Component, Fragment } from 'react'; + import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import type { PublicMethodsOf } from '@kbn/utility-types'; -import { NotificationsStart } from 'src/core/public'; -import { UserAPIClient } from '../..'; +import type { NotificationsStart } from 'src/core/public'; + +import type { UserAPIClient } from '../../user_api_client'; interface Props { usersToDelete: string[]; diff --git a/x-pack/plugins/security/public/management/users/edit_user/change_password_flyout.tsx b/x-pack/plugins/security/public/management/users/edit_user/change_password_flyout.tsx index 189ada7fcf8fa..01b387c9e1fc2 100644 --- a/x-pack/plugins/security/public/management/users/edit_user/change_password_flyout.tsx +++ b/x-pack/plugins/security/public/management/users/edit_user/change_password_flyout.tsx @@ -5,26 +5,30 @@ * 2.0. */ -import React, { FunctionComponent } from 'react'; import { EuiCallOut, EuiFieldPassword, EuiFlexGroup, + EuiFlexItem, EuiForm, EuiFormRow, EuiIcon, EuiLoadingContent, EuiSpacer, EuiText, - EuiFlexItem, } from '@elastic/eui'; +import type { FunctionComponent } from 'react'; +import React from 'react'; + import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; + import { useKibana } from '../../../../../../../src/plugins/kibana_react/public'; -import { useForm, ValidationErrors } from '../../../components/use_form'; -import { useCurrentUser } from '../../../components/use_current_user'; import { FormFlyout } from '../../../components/form_flyout'; -import { UserAPIClient } from '..'; +import { useCurrentUser } from '../../../components/use_current_user'; +import type { ValidationErrors } from '../../../components/use_form'; +import { useForm } from '../../../components/use_form'; +import { UserAPIClient } from '../user_api_client'; export interface ChangePasswordFormValues { current_password?: string; diff --git a/x-pack/plugins/security/public/management/users/edit_user/confirm_delete_users.tsx b/x-pack/plugins/security/public/management/users/edit_user/confirm_delete_users.tsx index 189f0c3845d63..b3c6f80812fab 100644 --- a/x-pack/plugins/security/public/management/users/edit_user/confirm_delete_users.tsx +++ b/x-pack/plugins/security/public/management/users/edit_user/confirm_delete_users.tsx @@ -5,14 +5,17 @@ * 2.0. */ -import React, { FunctionComponent } from 'react'; import { EuiText } from '@elastic/eui'; +import type { FunctionComponent } from 'react'; +import React from 'react'; +import useAsyncFn from 'react-use/lib/useAsyncFn'; + import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; -import useAsyncFn from 'react-use/lib/useAsyncFn'; + import { useKibana } from '../../../../../../../src/plugins/kibana_react/public'; import { ConfirmModal } from '../../../components/confirm_modal'; -import { UserAPIClient } from '..'; +import { UserAPIClient } from '../user_api_client'; export interface ConfirmDeleteUsersProps { usernames: string[]; diff --git a/x-pack/plugins/security/public/management/users/edit_user/confirm_disable_users.tsx b/x-pack/plugins/security/public/management/users/edit_user/confirm_disable_users.tsx index e0fb4e554ee3c..a3d36e19504e1 100644 --- a/x-pack/plugins/security/public/management/users/edit_user/confirm_disable_users.tsx +++ b/x-pack/plugins/security/public/management/users/edit_user/confirm_disable_users.tsx @@ -5,14 +5,17 @@ * 2.0. */ -import React, { FunctionComponent } from 'react'; import { EuiText } from '@elastic/eui'; +import type { FunctionComponent } from 'react'; +import React from 'react'; +import useAsyncFn from 'react-use/lib/useAsyncFn'; + import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; -import useAsyncFn from 'react-use/lib/useAsyncFn'; + import { useKibana } from '../../../../../../../src/plugins/kibana_react/public'; import { ConfirmModal } from '../../../components/confirm_modal'; -import { UserAPIClient } from '..'; +import { UserAPIClient } from '../user_api_client'; export interface ConfirmDisableUsersProps { usernames: string[]; diff --git a/x-pack/plugins/security/public/management/users/edit_user/confirm_enable_users.tsx b/x-pack/plugins/security/public/management/users/edit_user/confirm_enable_users.tsx index 2cb4cf8b4a9e2..24364d7b56d99 100644 --- a/x-pack/plugins/security/public/management/users/edit_user/confirm_enable_users.tsx +++ b/x-pack/plugins/security/public/management/users/edit_user/confirm_enable_users.tsx @@ -5,14 +5,17 @@ * 2.0. */ -import React, { FunctionComponent } from 'react'; import { EuiText } from '@elastic/eui'; +import type { FunctionComponent } from 'react'; +import React from 'react'; +import useAsyncFn from 'react-use/lib/useAsyncFn'; + import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; -import useAsyncFn from 'react-use/lib/useAsyncFn'; + import { useKibana } from '../../../../../../../src/plugins/kibana_react/public'; import { ConfirmModal } from '../../../components/confirm_modal'; -import { UserAPIClient } from '..'; +import { UserAPIClient } from '../user_api_client'; export interface ConfirmEnableUsersProps { usernames: string[]; diff --git a/x-pack/plugins/security/public/management/users/edit_user/create_user_page.test.tsx b/x-pack/plugins/security/public/management/users/edit_user/create_user_page.test.tsx index 018ed58c8e488..2c40fec2ec31d 100644 --- a/x-pack/plugins/security/public/management/users/edit_user/create_user_page.test.tsx +++ b/x-pack/plugins/security/public/management/users/edit_user/create_user_page.test.tsx @@ -5,10 +5,12 @@ * 2.0. */ -import React from 'react'; -import { render, fireEvent, waitFor, within } from '@testing-library/react'; +import { fireEvent, render, waitFor, within } from '@testing-library/react'; import { createMemoryHistory } from 'history'; -import { coreMock } from '../../../../../../../src/core/public/mocks'; +import React from 'react'; + +import { coreMock } from 'src/core/public/mocks'; + import { securityMock } from '../../../mocks'; import { Providers } from '../users_management_app'; import { CreateUserPage } from './create_user_page'; diff --git a/x-pack/plugins/security/public/management/users/edit_user/create_user_page.tsx b/x-pack/plugins/security/public/management/users/edit_user/create_user_page.tsx index a624f0f282e51..cb76d54981a11 100644 --- a/x-pack/plugins/security/public/management/users/edit_user/create_user_page.tsx +++ b/x-pack/plugins/security/public/management/users/edit_user/create_user_page.tsx @@ -5,7 +5,6 @@ * 2.0. */ -import React, { FunctionComponent } from 'react'; import { EuiHorizontalRule, EuiPageContent, @@ -14,8 +13,12 @@ import { EuiPageContentHeaderSection, EuiTitle, } from '@elastic/eui'; -import { FormattedMessage } from '@kbn/i18n/react'; +import type { FunctionComponent } from 'react'; +import React from 'react'; import { useHistory } from 'react-router-dom'; + +import { FormattedMessage } from '@kbn/i18n/react'; + import { UserForm } from './user_form'; export const CreateUserPage: FunctionComponent = () => { diff --git a/x-pack/plugins/security/public/management/users/edit_user/edit_user_page.test.tsx b/x-pack/plugins/security/public/management/users/edit_user/edit_user_page.test.tsx index 764ec95ee9853..fb01ea0e61865 100644 --- a/x-pack/plugins/security/public/management/users/edit_user/edit_user_page.test.tsx +++ b/x-pack/plugins/security/public/management/users/edit_user/edit_user_page.test.tsx @@ -5,7 +5,6 @@ * 2.0. */ -import React from 'react'; import { fireEvent, render, @@ -14,7 +13,10 @@ import { within, } from '@testing-library/react'; import { createMemoryHistory } from 'history'; -import { coreMock } from '../../../../../../../src/core/public/mocks'; +import React from 'react'; + +import { coreMock } from 'src/core/public/mocks'; + import { mockAuthenticatedUser } from '../../../../common/model/authenticated_user.mock'; import { securityMock } from '../../../mocks'; import { Providers } from '../users_management_app'; diff --git a/x-pack/plugins/security/public/management/users/edit_user/edit_user_page.tsx b/x-pack/plugins/security/public/management/users/edit_user/edit_user_page.tsx index 41d96231ee566..74a5a923aac68 100644 --- a/x-pack/plugins/security/public/management/users/edit_user/edit_user_page.tsx +++ b/x-pack/plugins/security/public/management/users/edit_user/edit_user_page.tsx @@ -5,11 +5,13 @@ * 2.0. */ -import React, { FunctionComponent, useState, useEffect } from 'react'; import { EuiAvatar, EuiButton, EuiCallOut, + EuiDescriptionList, + EuiDescriptionListDescription, + EuiDescriptionListTitle, EuiFlexGroup, EuiFlexItem, EuiHorizontalRule, @@ -21,22 +23,23 @@ import { EuiSpacer, EuiText, EuiTitle, - EuiDescriptionList, - EuiDescriptionListTitle, - EuiDescriptionListDescription, } from '@elastic/eui'; -import { FormattedMessage } from '@kbn/i18n/react'; +import type { FunctionComponent } from 'react'; +import React, { useEffect, useState } from 'react'; import { useHistory } from 'react-router-dom'; import useAsyncFn from 'react-use/lib/useAsyncFn'; + +import { FormattedMessage } from '@kbn/i18n/react'; + import { useKibana } from '../../../../../../../src/plugins/kibana_react/public'; import { getUserDisplayName } from '../../../../common/model'; +import { UserAPIClient } from '../user_api_client'; import { isUserDeprecated, isUserReserved } from '../user_utils'; -import { UserForm } from './user_form'; import { ChangePasswordFlyout } from './change_password_flyout'; +import { ConfirmDeleteUsers } from './confirm_delete_users'; import { ConfirmDisableUsers } from './confirm_disable_users'; import { ConfirmEnableUsers } from './confirm_enable_users'; -import { ConfirmDeleteUsers } from './confirm_delete_users'; -import { UserAPIClient } from '..'; +import { UserForm } from './user_form'; export interface EditUserPageProps { username: string; diff --git a/x-pack/plugins/security/public/management/users/edit_user/user_form.tsx b/x-pack/plugins/security/public/management/users/edit_user/user_form.tsx index 10e9e86e10f3a..8433f54a73343 100644 --- a/x-pack/plugins/security/public/management/users/edit_user/user_form.tsx +++ b/x-pack/plugins/security/public/management/users/edit_user/user_form.tsx @@ -5,7 +5,6 @@ * 2.0. */ -import React, { FunctionComponent, useEffect, useCallback } from 'react'; import { EuiButton, EuiButtonEmpty, @@ -19,18 +18,24 @@ import { EuiSpacer, EuiTextColor, } from '@elastic/eui'; +import { throttle } from 'lodash'; +import type { FunctionComponent } from 'react'; +import React, { useCallback, useEffect } from 'react'; +import useAsyncFn from 'react-use/lib/useAsyncFn'; + import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; -import useAsyncFn from 'react-use/lib/useAsyncFn'; -import { throttle } from 'lodash'; + import { useKibana } from '../../../../../../../src/plugins/kibana_react/public'; -import { User, Role, isRoleDeprecated } from '../../../../common/model'; -import { NAME_REGEX, MAX_NAME_LENGTH } from '../../../../common/constants'; -import { useForm, ValidationErrors } from '../../../components/use_form'; +import { MAX_NAME_LENGTH, NAME_REGEX } from '../../../../common/constants'; +import type { Role, User } from '../../../../common/model'; +import { isRoleDeprecated } from '../../../../common/model'; import { DocLink } from '../../../components/doc_link'; -import { RolesAPIClient } from '../../roles'; +import type { ValidationErrors } from '../../../components/use_form'; +import { useForm } from '../../../components/use_form'; import { RoleComboBox } from '../../role_combo_box'; -import { UserAPIClient } from '..'; +import { RolesAPIClient } from '../../roles'; +import { UserAPIClient } from '../user_api_client'; export const THROTTLE_USERS_WAIT = 10000; diff --git a/x-pack/plugins/security/public/management/users/user_api_client.ts b/x-pack/plugins/security/public/management/users/user_api_client.ts index 4fa033d70a039..9197634383504 100644 --- a/x-pack/plugins/security/public/management/users/user_api_client.ts +++ b/x-pack/plugins/security/public/management/users/user_api_client.ts @@ -5,8 +5,9 @@ * 2.0. */ -import { HttpStart } from 'src/core/public'; -import { User, EditUser } from '../../../common/model'; +import type { HttpStart } from 'src/core/public'; + +import type { EditUser, User } from '../../../common/model'; const usersUrl = '/internal/security/users'; diff --git a/x-pack/plugins/security/public/management/users/user_utils.test.ts b/x-pack/plugins/security/public/management/users/user_utils.test.ts index 6086766abd534..273086be971d1 100644 --- a/x-pack/plugins/security/public/management/users/user_utils.test.ts +++ b/x-pack/plugins/security/public/management/users/user_utils.test.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { User } from '../../../common/model'; -import { isUserReserved, isUserDeprecated, getExtendedUserDeprecationNotice } from './user_utils'; +import type { User } from '../../../common/model'; +import { getExtendedUserDeprecationNotice, isUserDeprecated, isUserReserved } from './user_utils'; describe('#isUserReserved', () => { it('returns false for a user with no metadata', () => { diff --git a/x-pack/plugins/security/public/management/users/user_utils.ts b/x-pack/plugins/security/public/management/users/user_utils.ts index 5ca5aff5d7c8a..bc7da560efcce 100644 --- a/x-pack/plugins/security/public/management/users/user_utils.ts +++ b/x-pack/plugins/security/public/management/users/user_utils.ts @@ -6,7 +6,8 @@ */ import { i18n } from '@kbn/i18n'; -import { User } from '../../../common/model'; + +import type { User } from '../../../common/model'; export const isUserReserved = (user: User) => user.metadata?._reserved ?? false; diff --git a/x-pack/plugins/security/public/management/users/users_grid/users_grid_page.test.tsx b/x-pack/plugins/security/public/management/users/users_grid/users_grid_page.test.tsx index d27c1eaa0449b..e3ad83fd0b934 100644 --- a/x-pack/plugins/security/public/management/users/users_grid/users_grid_page.test.tsx +++ b/x-pack/plugins/security/public/management/users/users_grid/users_grid_page.test.tsx @@ -5,19 +5,19 @@ * 2.0. */ -import { LocationDescriptorObject } from 'history'; -import { CoreStart, ScopedHistory } from 'kibana/public'; - -import { User } from '../../../../common/model'; -import { mountWithIntl, nextTick } from '@kbn/test/jest'; -import { UsersGridPage } from './users_grid_page'; +import { EuiBasicTable } from '@elastic/eui'; +import type { ReactWrapper } from 'enzyme'; +import type { LocationDescriptorObject } from 'history'; import React from 'react'; -import { ReactWrapper } from 'enzyme'; -import { userAPIClientMock } from '../index.mock'; -import { coreMock, scopedHistoryMock } from '../../../../../../../src/core/public/mocks'; + +import { findTestSubject, mountWithIntl, nextTick } from '@kbn/test/jest'; +import type { CoreStart, ScopedHistory } from 'src/core/public'; +import { coreMock, scopedHistoryMock } from 'src/core/public/mocks'; + +import type { User } from '../../../../common/model'; import { rolesAPIClientMock } from '../../roles/index.mock'; -import { findTestSubject } from '@kbn/test/jest'; -import { EuiBasicTable } from '@elastic/eui'; +import { userAPIClientMock } from '../index.mock'; +import { UsersGridPage } from './users_grid_page'; describe('UsersGridPage', () => { let history: ScopedHistory; @@ -236,26 +236,13 @@ describe('UsersGridPage', () => { await waitForRender(wrapper); - const deprecationTooltip = wrapper.find('[data-test-subj="roleDeprecationTooltip"]').props(); - - expect(deprecationTooltip).toMatchInlineSnapshot(` - Object { - "children":
- kibana_user - - -
, - "content": "The kibana_user role is deprecated. I don't like you.", - "data-test-subj": "roleDeprecationTooltip", - "delay": "regular", - "position": "top", - } - `); + const deprecationTooltip = wrapper + .find('[data-test-subj="roleDeprecationTooltip"]') + .prop('content'); + + expect(deprecationTooltip).toMatchInlineSnapshot( + `"The kibana_user role is deprecated. I don't like you."` + ); }); it('hides reserved users when instructed to', async () => { diff --git a/x-pack/plugins/security/public/management/users/users_grid/users_grid_page.tsx b/x-pack/plugins/security/public/management/users/users_grid/users_grid_page.tsx index 54e3fe9215f46..5b44c2f3c716c 100644 --- a/x-pack/plugins/security/public/management/users/users_grid/users_grid_page.tsx +++ b/x-pack/plugins/security/public/management/users/users_grid/users_grid_page.tsx @@ -5,35 +5,36 @@ * 2.0. */ -import React, { Component } from 'react'; +import type { EuiBasicTableColumn, EuiSwitchEvent } from '@elastic/eui'; import { EuiButton, - EuiLink, + EuiEmptyPrompt, EuiFlexGroup, + EuiFlexItem, EuiInMemoryTable, + EuiLink, EuiPageContent, - EuiTitle, + EuiPageContentBody, EuiPageContentHeader, EuiPageContentHeaderSection, - EuiPageContentBody, - EuiEmptyPrompt, - EuiBasicTableColumn, - EuiSwitchEvent, EuiSwitch, - EuiFlexItem, + EuiTitle, } from '@elastic/eui'; +import React, { Component } from 'react'; + import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import type { PublicMethodsOf } from '@kbn/utility-types'; -import { NotificationsStart, ApplicationStart, ScopedHistory } from 'src/core/public'; -import { User, Role } from '../../../../common/model'; -import { ConfirmDeleteUsers } from '../components'; -import { isUserReserved, getExtendedUserDeprecationNotice, isUserDeprecated } from '../user_utils'; -import { DisabledBadge, ReservedBadge, DeprecatedBadge } from '../../badges'; -import { RoleTableDisplay } from '../../role_table_display'; -import { RolesAPIClient } from '../../roles'; +import type { ApplicationStart, NotificationsStart, ScopedHistory } from 'src/core/public'; + import { reactRouterNavigate } from '../../../../../../../src/plugins/kibana_react/public'; -import { UserAPIClient } from '..'; +import type { Role, User } from '../../../../common/model'; +import { DeprecatedBadge, DisabledBadge, ReservedBadge } from '../../badges'; +import { RoleTableDisplay } from '../../role_table_display'; +import type { RolesAPIClient } from '../../roles'; +import { ConfirmDeleteUsers } from '../components'; +import type { UserAPIClient } from '../user_api_client'; +import { getExtendedUserDeprecationNotice, isUserDeprecated, isUserReserved } from '../user_utils'; interface Props { userAPIClient: PublicMethodsOf; diff --git a/x-pack/plugins/security/public/management/users/users_management_app.test.tsx b/x-pack/plugins/security/public/management/users/users_management_app.test.tsx index fd18de22726c6..f4fed153d9975 100644 --- a/x-pack/plugins/security/public/management/users/users_management_app.test.tsx +++ b/x-pack/plugins/security/public/management/users/users_management_app.test.tsx @@ -5,7 +5,8 @@ * 2.0. */ -import { coreMock, scopedHistoryMock } from '../../../../../../src/core/public/mocks'; +import { coreMock, scopedHistoryMock } from 'src/core/public/mocks'; + import { securityMock } from '../../mocks'; import { usersManagementApp } from './users_management_app'; diff --git a/x-pack/plugins/security/public/management/users/users_management_app.tsx b/x-pack/plugins/security/public/management/users/users_management_app.tsx index 136b13fa4610f..529a604fbc04c 100644 --- a/x-pack/plugins/security/public/management/users/users_management_app.tsx +++ b/x-pack/plugins/security/public/management/users/users_management_app.tsx @@ -5,24 +5,24 @@ * 2.0. */ -import React, { FunctionComponent } from 'react'; +import type { History } from 'history'; +import type { FunctionComponent } from 'react'; +import React from 'react'; import { render, unmountComponentAtNode } from 'react-dom'; -import { Router, Route, Switch, Redirect, RouteComponentProps } from 'react-router-dom'; -import { History } from 'history'; +import type { RouteComponentProps } from 'react-router-dom'; +import { Redirect, Route, Router, Switch } from 'react-router-dom'; + import { i18n } from '@kbn/i18n'; import { I18nProvider } from '@kbn/i18n/react'; -import { StartServicesAccessor, CoreStart } from '../../../../../../src/core/public'; -import { RegisterManagementAppArgs } from '../../../../../../src/plugins/management/public'; +import type { CoreStart, StartServicesAccessor } from 'src/core/public'; +import type { RegisterManagementAppArgs } from 'src/plugins/management/public'; + import { KibanaContextProvider } from '../../../../../../src/plugins/kibana_react/public'; -import { AuthenticationServiceSetup } from '../../authentication'; -import { PluginStartDependencies } from '../../plugin'; -import { - BreadcrumbsProvider, - BreadcrumbsChangeHandler, - Breadcrumb, - getDocTitle, -} from '../../components/breadcrumb'; +import type { AuthenticationServiceSetup } from '../../authentication'; +import type { BreadcrumbsChangeHandler } from '../../components/breadcrumb'; +import { Breadcrumb, BreadcrumbsProvider, getDocTitle } from '../../components/breadcrumb'; import { AuthenticationProvider } from '../../components/use_current_user'; +import type { PluginStartDependencies } from '../../plugin'; import { tryDecodeURIComponent } from '../url_utils'; interface CreateParams { diff --git a/x-pack/plugins/security/public/mocks.ts b/x-pack/plugins/security/public/mocks.ts index e2c2b182fa980..0502025e9bae8 100644 --- a/x-pack/plugins/security/public/mocks.ts +++ b/x-pack/plugins/security/public/mocks.ts @@ -5,10 +5,10 @@ * 2.0. */ -import { authenticationMock } from './authentication/index.mock'; -import { createSessionTimeoutMock } from './session/session_timeout.mock'; import { licenseMock } from '../common/licensing/index.mock'; +import { authenticationMock } from './authentication/index.mock'; import { navControlServiceMock } from './nav_control/index.mock'; +import { createSessionTimeoutMock } from './session/session_timeout.mock'; function createSetupMock() { return { diff --git a/x-pack/plugins/security/public/nav_control/index.mock.ts b/x-pack/plugins/security/public/nav_control/index.mock.ts index 59ff513dd4af8..769007d0bc0cd 100644 --- a/x-pack/plugins/security/public/nav_control/index.mock.ts +++ b/x-pack/plugins/security/public/nav_control/index.mock.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { SecurityNavControlServiceStart } from '.'; +import type { SecurityNavControlServiceStart } from './nav_control_service'; export const navControlServiceMock = { createStart: (): jest.Mocked => ({ diff --git a/x-pack/plugins/security/public/nav_control/nav_control_component.test.tsx b/x-pack/plugins/security/public/nav_control/nav_control_component.test.tsx index 6292d0b70efd1..bd338109a4460 100644 --- a/x-pack/plugins/security/public/nav_control/nav_control_component.test.tsx +++ b/x-pack/plugins/security/public/nav_control/nav_control_component.test.tsx @@ -5,15 +5,15 @@ * 2.0. */ +import { EuiHeaderSectionItemButton, EuiPopover } from '@elastic/eui'; import React from 'react'; import { BehaviorSubject } from 'rxjs'; -import { shallowWithIntl, nextTick, mountWithIntl } from '@kbn/test/jest'; -import { SecurityNavControl } from './nav_control_component'; -import type { AuthenticatedUser } from '../../common/model'; -import { EuiPopover, EuiHeaderSectionItemButton } from '@elastic/eui'; -import { findTestSubject } from '@kbn/test/jest'; +import { findTestSubject, mountWithIntl, nextTick, shallowWithIntl } from '@kbn/test/jest'; + +import type { AuthenticatedUser } from '../../common/model'; import { mockAuthenticatedUser } from '../../common/model/authenticated_user.mock'; +import { SecurityNavControl } from './nav_control_component'; describe('SecurityNavControl', () => { it(`renders a loading spinner when the user promise hasn't resolved yet.`, async () => { diff --git a/x-pack/plugins/security/public/nav_control/nav_control_component.tsx b/x-pack/plugins/security/public/nav_control/nav_control_component.tsx index 68f2701809501..c7649494bb810 100644 --- a/x-pack/plugins/security/public/nav_control/nav_control_component.tsx +++ b/x-pack/plugins/security/public/nav_control/nav_control_component.tsx @@ -5,24 +5,25 @@ * 2.0. */ -import { i18n } from '@kbn/i18n'; -import { FormattedMessage } from '@kbn/i18n/react'; -import React, { Component } from 'react'; -import { Observable, Subscription } from 'rxjs'; +import './nav_control_component.scss'; + +import type { EuiContextMenuPanelItemDescriptor, IconType } from '@elastic/eui'; import { EuiAvatar, + EuiContextMenu, EuiHeaderSectionItemButton, - EuiPopover, - EuiLoadingSpinner, EuiIcon, - EuiContextMenu, - EuiContextMenuPanelItemDescriptor, - IconType, + EuiLoadingSpinner, + EuiPopover, EuiText, } from '@elastic/eui'; -import { AuthenticatedUser } from '../../common/model'; +import React, { Component } from 'react'; +import type { Observable, Subscription } from 'rxjs'; -import './nav_control_component.scss'; +import { i18n } from '@kbn/i18n'; +import { FormattedMessage } from '@kbn/i18n/react'; + +import type { AuthenticatedUser } from '../../common/model'; export interface UserMenuLink { label: string; diff --git a/x-pack/plugins/security/public/nav_control/nav_control_service.test.ts b/x-pack/plugins/security/public/nav_control/nav_control_service.test.ts index 5409c6d61d13a..72a1a6f5817a5 100644 --- a/x-pack/plugins/security/public/nav_control/nav_control_service.test.ts +++ b/x-pack/plugins/security/public/nav_control/nav_control_service.test.ts @@ -5,14 +5,16 @@ * 2.0. */ -import { coreMock } from 'src/core/public/mocks'; import { BehaviorSubject } from 'rxjs'; -import { ILicense } from '../../../licensing/public'; -import { SecurityNavControlService } from '.'; -import { SecurityLicenseService } from '../../common/licensing'; + import { nextTick } from '@kbn/test/jest'; -import { securityMock } from '../mocks'; +import { coreMock } from 'src/core/public/mocks'; + +import type { ILicense } from '../../../licensing/public'; +import { SecurityLicenseService } from '../../common/licensing'; import { mockAuthenticatedUser } from '../../common/model/authenticated_user.mock'; +import { securityMock } from '../mocks'; +import { SecurityNavControlService } from './nav_control_service'; const validLicense = { isAvailable: true, diff --git a/x-pack/plugins/security/public/nav_control/nav_control_service.tsx b/x-pack/plugins/security/public/nav_control/nav_control_service.tsx index 02ef208ce42a3..fc9ba262a2026 100644 --- a/x-pack/plugins/security/public/nav_control/nav_control_service.tsx +++ b/x-pack/plugins/security/public/nav_control/nav_control_service.tsx @@ -6,16 +6,18 @@ */ import { sortBy } from 'lodash'; -import { Observable, Subscription, BehaviorSubject, ReplaySubject } from 'rxjs'; +import React from 'react'; +import ReactDOM from 'react-dom'; +import type { Observable, Subscription } from 'rxjs'; +import { BehaviorSubject, ReplaySubject } from 'rxjs'; import { map, takeUntil } from 'rxjs/operators'; -import { CoreStart } from 'src/core/public'; -import ReactDOM from 'react-dom'; -import React from 'react'; +import type { CoreStart } from 'src/core/public'; -import { SecurityLicense } from '../../common/licensing'; -import { SecurityNavControl, UserMenuLink } from './nav_control_component'; -import { AuthenticationServiceSetup } from '../authentication'; +import type { SecurityLicense } from '../../common/licensing'; +import type { AuthenticationServiceSetup } from '../authentication'; +import type { UserMenuLink } from './nav_control_component'; +import { SecurityNavControl } from './nav_control_component'; interface SetupDeps { securityLicense: SecurityLicense; diff --git a/x-pack/plugins/security/public/plugin.test.tsx b/x-pack/plugins/security/public/plugin.test.tsx index c29b8ab3c729d..fa9d11422e884 100644 --- a/x-pack/plugins/security/public/plugin.test.tsx +++ b/x-pack/plugins/security/public/plugin.test.tsx @@ -5,19 +5,21 @@ * 2.0. */ -import { Observable } from 'rxjs'; import BroadcastChannel from 'broadcast-channel'; -import { CoreSetup } from 'src/core/public'; -import { DataPublicPluginStart } from '../../../../src/plugins/data/public'; -import { mockSecurityOssPlugin } from '../../../../src/plugins/security_oss/public/mocks'; -import { SessionTimeout } from './session'; -import { PluginStartDependencies, SecurityPlugin } from './plugin'; +import { Observable } from 'rxjs'; -import { coreMock } from '../../../../src/core/public/mocks'; -import { managementPluginMock } from '../../../../src/plugins/management/public/mocks'; +import type { CoreSetup } from 'src/core/public'; +import { coreMock } from 'src/core/public/mocks'; +import type { DataPublicPluginStart } from 'src/plugins/data/public'; +import { managementPluginMock } from 'src/plugins/management/public/mocks'; +import { mockSecurityOssPlugin } from 'src/plugins/security_oss/public/mocks'; + +import type { FeaturesPluginStart } from '../../features/public'; import { licensingMock } from '../../licensing/public/mocks'; import { ManagementService } from './management'; -import { FeaturesPluginStart } from '../../features/public'; +import type { PluginStartDependencies } from './plugin'; +import { SecurityPlugin } from './plugin'; +import { SessionTimeout } from './session'; describe('Security Plugin', () => { beforeAll(() => { diff --git a/x-pack/plugins/security/public/plugin.tsx b/x-pack/plugins/security/public/plugin.tsx index 8da7e71241b81..5d86f15174633 100644 --- a/x-pack/plugins/security/public/plugin.tsx +++ b/x-pack/plugins/security/public/plugin.tsx @@ -6,36 +6,34 @@ */ import { i18n } from '@kbn/i18n'; -import { SecurityOssPluginSetup, SecurityOssPluginStart } from 'src/plugins/security_oss/public'; -import { - CoreSetup, - CoreStart, - Plugin, - PluginInitializerContext, -} from '../../../../src/core/public'; -import { FeaturesPluginStart } from '../../features/public'; +import type { CoreSetup, CoreStart, Plugin, PluginInitializerContext } from 'src/core/public'; +import type { DataPublicPluginStart } from 'src/plugins/data/public'; +import type { HomePublicPluginSetup } from 'src/plugins/home/public'; +import type { ManagementSetup, ManagementStart } from 'src/plugins/management/public'; +import type { + SecurityOssPluginSetup, + SecurityOssPluginStart, +} from 'src/plugins/security_oss/public'; + +import { FeatureCatalogueCategory } from '../../../../src/plugins/home/public'; +import type { FeaturesPluginStart } from '../../features/public'; +import type { LicensingPluginSetup } from '../../licensing/public'; import type { SpacesPluginStart } from '../../spaces/public'; -import { DataPublicPluginStart } from '../../../../src/plugins/data/public'; -import { - FeatureCatalogueCategory, - HomePublicPluginSetup, -} from '../../../../src/plugins/home/public'; -import { LicensingPluginSetup } from '../../licensing/public'; -import { ManagementSetup, ManagementStart } from '../../../../src/plugins/management/public'; +import { SecurityLicenseService } from '../common/licensing'; +import { accountManagementApp } from './account_management'; +import type { AuthenticationServiceSetup } from './authentication'; +import { AuthenticationService } from './authentication'; +import type { ConfigType } from './config'; +import { ManagementService } from './management'; +import { SecurityNavControlService } from './nav_control'; +import { SecurityCheckupService } from './security_checkup'; +import type { ISessionTimeout } from './session'; import { - ISessionTimeout, SessionExpired, SessionTimeout, SessionTimeoutHttpInterceptor, UnauthorizedResponseHttpInterceptor, } from './session'; -import { SecurityLicenseService } from '../common/licensing'; -import { SecurityNavControlService } from './nav_control'; -import { AuthenticationService, AuthenticationServiceSetup } from './authentication'; -import { ConfigType } from './config'; -import { ManagementService } from './management'; -import { accountManagementApp } from './account_management'; -import { SecurityCheckupService } from './security_checkup'; export interface PluginSetupDependencies { licensing: LicensingPluginSetup; diff --git a/x-pack/plugins/security/public/security_checkup/components/insecure_cluster_alert.tsx b/x-pack/plugins/security/public/security_checkup/components/insecure_cluster_alert.tsx index bbf3c508f9f2d..eeeac4533ed12 100644 --- a/x-pack/plugins/security/public/security_checkup/components/insecure_cluster_alert.tsx +++ b/x-pack/plugins/security/public/security_checkup/components/insecure_cluster_alert.tsx @@ -5,19 +5,20 @@ * 2.0. */ -import React, { useState } from 'react'; -import { i18n } from '@kbn/i18n'; -import { I18nProvider, FormattedMessage } from '@kbn/i18n/react'; -import { render, unmountComponentAtNode } from 'react-dom'; -import type { DocLinksStart, MountPoint } from 'kibana/public'; import { + EuiButton, EuiCheckbox, - EuiText, - EuiSpacer, EuiFlexGroup, EuiFlexItem, - EuiButton, + EuiSpacer, + EuiText, } from '@elastic/eui'; +import React, { useState } from 'react'; +import { render, unmountComponentAtNode } from 'react-dom'; + +import { i18n } from '@kbn/i18n'; +import { FormattedMessage, I18nProvider } from '@kbn/i18n/react'; +import type { DocLinksStart, MountPoint } from 'src/core/public'; export const insecureClusterAlertTitle = i18n.translate( 'xpack.security.checkup.insecureClusterTitle', diff --git a/x-pack/plugins/security/public/security_checkup/security_checkup_service.test.ts b/x-pack/plugins/security/public/security_checkup/security_checkup_service.test.ts index c86e40000bc53..29f1c2555e030 100644 --- a/x-pack/plugins/security/public/security_checkup/security_checkup_service.test.ts +++ b/x-pack/plugins/security/public/security_checkup/security_checkup_service.test.ts @@ -5,10 +5,10 @@ * 2.0. */ -import { MountPoint } from 'kibana/public'; +import type { MountPoint } from 'src/core/public'; +import { docLinksServiceMock } from 'src/core/public/mocks'; +import { mockSecurityOssPlugin } from 'src/plugins/security_oss/public/mocks'; -import { docLinksServiceMock } from '../../../../../src/core/public/mocks'; -import { mockSecurityOssPlugin } from '../../../../../src/plugins/security_oss/public/mocks'; import { insecureClusterAlertTitle } from './components'; import { SecurityCheckupService } from './security_checkup_service'; diff --git a/x-pack/plugins/security/public/security_checkup/security_checkup_service.tsx b/x-pack/plugins/security/public/security_checkup/security_checkup_service.tsx index 333f712d39508..02adb85c21a80 100644 --- a/x-pack/plugins/security/public/security_checkup/security_checkup_service.tsx +++ b/x-pack/plugins/security/public/security_checkup/security_checkup_service.tsx @@ -5,13 +5,13 @@ * 2.0. */ -import type { DocLinksStart } from 'kibana/public'; - -import { +import type { DocLinksStart } from 'src/core/public'; +import type { SecurityOssPluginSetup, SecurityOssPluginStart, -} from '../../../../../src/plugins/security_oss/public'; -import { insecureClusterAlertTitle, insecureClusterAlertText } from './components'; +} from 'src/plugins/security_oss/public'; + +import { insecureClusterAlertText, insecureClusterAlertTitle } from './components'; interface SetupDeps { securityOssSetup: SecurityOssPluginSetup; diff --git a/x-pack/plugins/security/public/session/session_expired.mock.ts b/x-pack/plugins/security/public/session/session_expired.mock.ts index 0c921386303a7..f3a0e2b88f7eb 100644 --- a/x-pack/plugins/security/public/session/session_expired.mock.ts +++ b/x-pack/plugins/security/public/session/session_expired.mock.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { ISessionExpired } from './session_expired'; +import type { ISessionExpired } from './session_expired'; export function createSessionExpiredMock() { return { diff --git a/x-pack/plugins/security/public/session/session_idle_timeout_warning.test.tsx b/x-pack/plugins/security/public/session/session_idle_timeout_warning.test.tsx index 53b88cd5ed58d..48a3bb482948e 100644 --- a/x-pack/plugins/security/public/session/session_idle_timeout_warning.test.tsx +++ b/x-pack/plugins/security/public/session/session_idle_timeout_warning.test.tsx @@ -6,7 +6,9 @@ */ import React from 'react'; + import { mountWithIntl } from '@kbn/test/jest'; + import { SessionIdleTimeoutWarning } from './session_idle_timeout_warning'; describe('SessionIdleTimeoutWarning', () => { diff --git a/x-pack/plugins/security/public/session/session_idle_timeout_warning.tsx b/x-pack/plugins/security/public/session/session_idle_timeout_warning.tsx index 92d8be8a4184f..47dce0aa9993e 100644 --- a/x-pack/plugins/security/public/session/session_idle_timeout_warning.tsx +++ b/x-pack/plugins/security/public/session/session_idle_timeout_warning.tsx @@ -5,11 +5,13 @@ * 2.0. */ -import { ToastInput } from 'src/core/public'; +import { EuiButton, EuiProgress } from '@elastic/eui'; import React from 'react'; + import { i18n } from '@kbn/i18n'; -import { EuiButton, EuiProgress } from '@elastic/eui'; import { FormattedMessage, FormattedRelative } from '@kbn/i18n/react'; +import type { ToastInput } from 'src/core/public'; + import { toMountPoint } from '../../../../../src/plugins/kibana_react/public'; interface Props { diff --git a/x-pack/plugins/security/public/session/session_lifespan_warning.tsx b/x-pack/plugins/security/public/session/session_lifespan_warning.tsx index 65ad6af0a5c68..e611c9aa2ac5f 100644 --- a/x-pack/plugins/security/public/session/session_lifespan_warning.tsx +++ b/x-pack/plugins/security/public/session/session_lifespan_warning.tsx @@ -5,11 +5,13 @@ * 2.0. */ -import { ToastInput } from 'src/core/public'; +import { EuiProgress } from '@elastic/eui'; import React from 'react'; + import { i18n } from '@kbn/i18n'; import { FormattedMessage, FormattedRelative } from '@kbn/i18n/react'; -import { EuiProgress } from '@elastic/eui'; +import type { ToastInput } from 'src/core/public'; + import { toMountPoint } from '../../../../../src/plugins/kibana_react/public'; interface Props { diff --git a/x-pack/plugins/security/public/session/session_timeout.mock.ts b/x-pack/plugins/security/public/session/session_timeout.mock.ts index 00b6899ea3a1d..47e16810f2c2b 100644 --- a/x-pack/plugins/security/public/session/session_timeout.mock.ts +++ b/x-pack/plugins/security/public/session/session_timeout.mock.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { ISessionTimeout } from './session_timeout'; +import type { ISessionTimeout } from './session_timeout'; export function createSessionTimeoutMock() { return { diff --git a/x-pack/plugins/security/public/session/session_timeout.test.tsx b/x-pack/plugins/security/public/session/session_timeout.test.tsx index df543a9343bc0..d224edb8cafd4 100644 --- a/x-pack/plugins/security/public/session/session_timeout.test.tsx +++ b/x-pack/plugins/security/public/session/session_timeout.test.tsx @@ -5,11 +5,13 @@ * 2.0. */ -import { coreMock } from 'src/core/public/mocks'; import BroadcastChannel from 'broadcast-channel'; -import { SessionTimeout } from './session_timeout'; -import { createSessionExpiredMock } from './session_expired.mock'; + import { mountWithIntl } from '@kbn/test/jest'; +import { coreMock } from 'src/core/public/mocks'; + +import { createSessionExpiredMock } from './session_expired.mock'; +import { SessionTimeout } from './session_timeout'; jest.useFakeTimers(); diff --git a/x-pack/plugins/security/public/session/session_timeout.tsx b/x-pack/plugins/security/public/session/session_timeout.tsx index ec0e4413be718..cc7eaa551b1b3 100644 --- a/x-pack/plugins/security/public/session/session_timeout.tsx +++ b/x-pack/plugins/security/public/session/session_timeout.tsx @@ -5,12 +5,14 @@ * 2.0. */ -import { NotificationsSetup, Toast, HttpSetup, ToastInput } from 'src/core/public'; import { BroadcastChannel } from 'broadcast-channel'; -import { SessionInfo } from '../../common/types'; + +import type { HttpSetup, NotificationsSetup, Toast, ToastInput } from 'src/core/public'; + +import type { SessionInfo } from '../../common/types'; +import type { ISessionExpired } from './session_expired'; import { createToast as createIdleTimeoutToast } from './session_idle_timeout_warning'; import { createToast as createLifespanToast } from './session_lifespan_warning'; -import { ISessionExpired } from './session_expired'; /** * Client session timeout is decreased by this number so that Kibana server diff --git a/x-pack/plugins/security/public/session/session_timeout_http_interceptor.test.ts b/x-pack/plugins/security/public/session/session_timeout_http_interceptor.test.ts index 9b1c52a6796a2..4f216d331c3f2 100644 --- a/x-pack/plugins/security/public/session/session_timeout_http_interceptor.test.ts +++ b/x-pack/plugins/security/public/session/session_timeout_http_interceptor.test.ts @@ -7,9 +7,11 @@ // @ts-ignore import fetchMock from 'fetch-mock/es5/client'; -import { SessionTimeoutHttpInterceptor } from './session_timeout_http_interceptor'; -import { setup } from '../../../../../src/core/test_helpers/http_test_setup'; + +import { setup } from 'src/core/test_helpers/http_test_setup'; + import { createSessionTimeoutMock } from './session_timeout.mock'; +import { SessionTimeoutHttpInterceptor } from './session_timeout_http_interceptor'; const mockCurrentUrl = (url: string) => window.history.pushState({}, '', url); diff --git a/x-pack/plugins/security/public/session/session_timeout_http_interceptor.ts b/x-pack/plugins/security/public/session/session_timeout_http_interceptor.ts index 35e302f9f8129..6fc7fb88578ff 100644 --- a/x-pack/plugins/security/public/session/session_timeout_http_interceptor.ts +++ b/x-pack/plugins/security/public/session/session_timeout_http_interceptor.ts @@ -5,14 +5,14 @@ * 2.0. */ -import { +import type { HttpInterceptor, HttpInterceptorResponseError, HttpResponse, IAnonymousPaths, } from 'src/core/public'; -import { ISessionTimeout } from './session_timeout'; +import type { ISessionTimeout } from './session_timeout'; export class SessionTimeoutHttpInterceptor implements HttpInterceptor { constructor(private sessionTimeout: ISessionTimeout, private anonymousPaths: IAnonymousPaths) {} diff --git a/x-pack/plugins/security/public/session/unauthorized_response_http_interceptor.test.ts b/x-pack/plugins/security/public/session/unauthorized_response_http_interceptor.test.ts index de7e1cc388189..35bdb911b6ed1 100644 --- a/x-pack/plugins/security/public/session/unauthorized_response_http_interceptor.test.ts +++ b/x-pack/plugins/security/public/session/unauthorized_response_http_interceptor.test.ts @@ -7,9 +7,12 @@ // @ts-ignore import fetchMock from 'fetch-mock/es5/client'; + +import { setup } from 'src/core/test_helpers/http_test_setup'; + import { SessionExpired } from './session_expired'; -import { setup } from '../../../../../src/core/test_helpers/http_test_setup'; import { UnauthorizedResponseHttpInterceptor } from './unauthorized_response_http_interceptor'; + jest.mock('./session_expired'); const drainPromiseQueue = () => { diff --git a/x-pack/plugins/security/public/session/unauthorized_response_http_interceptor.ts b/x-pack/plugins/security/public/session/unauthorized_response_http_interceptor.ts index 3fb8b467940a1..43945c8f43c0f 100644 --- a/x-pack/plugins/security/public/session/unauthorized_response_http_interceptor.ts +++ b/x-pack/plugins/security/public/session/unauthorized_response_http_interceptor.ts @@ -5,14 +5,14 @@ * 2.0. */ -import { +import type { HttpInterceptor, HttpInterceptorResponseError, - IHttpInterceptController, IAnonymousPaths, + IHttpInterceptController, } from 'src/core/public'; -import { SessionExpired } from './session_expired'; +import type { SessionExpired } from './session_expired'; export class UnauthorizedResponseHttpInterceptor implements HttpInterceptor { constructor(private sessionExpired: SessionExpired, private anonymousPaths: IAnonymousPaths) {} diff --git a/x-pack/plugins/security/server/anonymous_access/anonymous_access_service.mock.ts b/x-pack/plugins/security/server/anonymous_access/anonymous_access_service.mock.ts index a484dfb974517..b305685f9a233 100644 --- a/x-pack/plugins/security/server/anonymous_access/anonymous_access_service.mock.ts +++ b/x-pack/plugins/security/server/anonymous_access/anonymous_access_service.mock.ts @@ -5,9 +5,9 @@ * 2.0. */ -import type { AnonymousAccessServiceStart } from './anonymous_access_service'; +import { capabilitiesServiceMock } from 'src/core/server/mocks'; -import { capabilitiesServiceMock } from '../../../../../src/core/server/mocks'; +import type { AnonymousAccessServiceStart } from './anonymous_access_service'; export const anonymousAccessServiceMock = { createStart: (): jest.Mocked => ({ diff --git a/x-pack/plugins/security/server/anonymous_access/anonymous_access_service.test.ts b/x-pack/plugins/security/server/anonymous_access/anonymous_access_service.test.ts index 04aeb69bde1a3..3089ac580a39b 100644 --- a/x-pack/plugins/security/server/anonymous_access/anonymous_access_service.test.ts +++ b/x-pack/plugins/security/server/anonymous_access/anonymous_access_service.test.ts @@ -6,18 +6,19 @@ */ import { errors } from '@elastic/elasticsearch'; -import type { Logger } from '../../../../../src/core/server'; -import { ConfigSchema, createConfig } from '../config'; -import { AnonymousAccessService } from './anonymous_access_service'; +import type { Logger } from 'src/core/server'; import { coreMock, + elasticsearchServiceMock, httpServerMock, loggingSystemMock, - elasticsearchServiceMock, -} from '../../../../../src/core/server/mocks'; +} from 'src/core/server/mocks'; + import { spacesMock } from '../../../spaces/server/mocks'; +import { ConfigSchema, createConfig } from '../config'; import { securityMock } from '../mocks'; +import { AnonymousAccessService } from './anonymous_access_service'; const createSecurityConfig = (config: Record = {}) => { return createConfig(ConfigSchema.validate(config), loggingSystemMock.createLogger(), { diff --git a/x-pack/plugins/security/server/anonymous_access/anonymous_access_service.ts b/x-pack/plugins/security/server/anonymous_access/anonymous_access_service.ts index 30d4c22497ebe..ece0c63350995 100644 --- a/x-pack/plugins/security/server/anonymous_access/anonymous_access_service.ts +++ b/x-pack/plugins/security/server/anonymous_access/anonymous_access_service.ts @@ -6,18 +6,21 @@ */ import type { Request } from '@hapi/hapi'; -import { + +import type { + Capabilities, CapabilitiesStart, IBasePath, - KibanaRequest, - Logger, - Capabilities, IClusterClient, -} from '../../../../../src/core/server'; + Logger, +} from 'src/core/server'; + +import { KibanaRequest } from '../../../../../src/core/server'; import { addSpaceIdToPath } from '../../../spaces/common'; import type { SpacesServiceStart } from '../../../spaces/server'; import { AUTH_PROVIDER_HINT_QUERY_STRING_PARAMETER } from '../../common/constants'; -import { AnonymousAuthenticationProvider, HTTPAuthorizationHeader } from '../authentication'; +import type { HTTPAuthorizationHeader } from '../authentication'; +import { AnonymousAuthenticationProvider } from '../authentication'; import type { ConfigType } from '../config'; import { getDetailedErrorMessage, getErrorStatusCode } from '../errors'; diff --git a/x-pack/plugins/security/server/audit/audit_events.test.ts b/x-pack/plugins/security/server/audit/audit_events.test.ts index 984d1bdb66d92..f986c57987022 100644 --- a/x-pack/plugins/security/server/audit/audit_events.test.ts +++ b/x-pack/plugins/security/server/audit/audit_events.test.ts @@ -6,18 +6,20 @@ */ import { URL } from 'url'; + +import { httpServerMock } from 'src/core/server/mocks'; + +import { mockAuthenticatedUser } from '../../common/model/authenticated_user.mock'; +import { AuthenticationResult } from '../authentication'; import { EventOutcome, + httpRequestEvent, SavedObjectAction, savedObjectEvent, - userLoginEvent, - httpRequestEvent, - spaceAuditEvent, SpaceAuditAction, + spaceAuditEvent, + userLoginEvent, } from './audit_events'; -import { AuthenticationResult } from '../authentication'; -import { mockAuthenticatedUser } from '../../common/model/authenticated_user.mock'; -import { httpServerMock } from 'src/core/server/mocks'; describe('#savedObjectEvent', () => { test('creates event with `unknown` outcome', () => { diff --git a/x-pack/plugins/security/server/audit/audit_events.ts b/x-pack/plugins/security/server/audit/audit_events.ts index f353362e33513..00f77ff2bc5fd 100644 --- a/x-pack/plugins/security/server/audit/audit_events.ts +++ b/x-pack/plugins/security/server/audit/audit_events.ts @@ -5,8 +5,9 @@ * 2.0. */ -import { KibanaRequest } from 'src/core/server'; -import { AuthenticationResult } from '../authentication/authentication_result'; +import type { KibanaRequest } from 'src/core/server'; + +import type { AuthenticationResult } from '../authentication/authentication_result'; /** * Audit event schema using ECS format: https://www.elastic.co/guide/en/ecs/1.6/index.html diff --git a/x-pack/plugins/security/server/audit/audit_service.test.ts b/x-pack/plugins/security/server/audit/audit_service.test.ts index f59fd6ecdec91..ffacaff7237c5 100644 --- a/x-pack/plugins/security/server/audit/audit_service.test.ts +++ b/x-pack/plugins/security/server/audit/audit_service.test.ts @@ -5,23 +5,27 @@ * 2.0. */ -import { - AuditService, - filterEvent, - createLoggingConfig, - RECORD_USAGE_INTERVAL, -} from './audit_service'; -import { AuditEvent, EventCategory, EventType, EventOutcome } from './audit_events'; +import { BehaviorSubject, Observable, of } from 'rxjs'; + import { coreMock, - loggingSystemMock, - httpServiceMock, httpServerMock, + httpServiceMock, + loggingSystemMock, } from 'src/core/server/mocks'; + +import type { SecurityLicenseFeatures } from '../../common/licensing'; import { licenseMock } from '../../common/licensing/index.mock'; -import { ConfigSchema, ConfigType } from '../config'; -import { SecurityLicenseFeatures } from '../../common/licensing'; -import { BehaviorSubject, Observable, of } from 'rxjs'; +import type { ConfigType } from '../config'; +import { ConfigSchema } from '../config'; +import type { AuditEvent } from './audit_events'; +import { EventCategory, EventOutcome, EventType } from './audit_events'; +import { + AuditService, + createLoggingConfig, + filterEvent, + RECORD_USAGE_INTERVAL, +} from './audit_service'; jest.useFakeTimers(); diff --git a/x-pack/plugins/security/server/audit/audit_service.ts b/x-pack/plugins/security/server/audit/audit_service.ts index 99dd2c82ec9fe..7511e079b9adb 100644 --- a/x-pack/plugins/security/server/audit/audit_service.ts +++ b/x-pack/plugins/security/server/audit/audit_service.ts @@ -5,20 +5,23 @@ * 2.0. */ -import { Subscription } from 'rxjs'; -import { map, distinctUntilKeyChanged } from 'rxjs/operators'; -import { - Logger, - LoggingServiceSetup, - KibanaRequest, +import type { Subscription } from 'rxjs'; +import { distinctUntilKeyChanged, map } from 'rxjs/operators'; + +import type { HttpServiceSetup, + KibanaRequest, + Logger, LoggerContextConfigInput, -} from '../../../../../src/core/server'; -import { SecurityLicense, SecurityLicenseFeatures } from '../../common/licensing'; -import { ConfigType } from '../config'; -import { SpacesPluginSetup } from '../../../spaces/server'; -import { AuditEvent, httpRequestEvent } from './audit_events'; -import { SecurityPluginSetup } from '..'; + LoggingServiceSetup, +} from 'src/core/server'; + +import type { SpacesPluginSetup } from '../../../spaces/server'; +import type { SecurityLicense, SecurityLicenseFeatures } from '../../common/licensing'; +import type { ConfigType } from '../config'; +import type { SecurityPluginSetup } from '../plugin'; +import type { AuditEvent } from './audit_events'; +import { httpRequestEvent } from './audit_events'; export const ECS_VERSION = '1.6.0'; export const RECORD_USAGE_INTERVAL = 60 * 60 * 1000; // 1 hour diff --git a/x-pack/plugins/security/server/audit/index.mock.ts b/x-pack/plugins/security/server/audit/index.mock.ts index 7bea926830622..f8816f07ed3ae 100644 --- a/x-pack/plugins/security/server/audit/index.mock.ts +++ b/x-pack/plugins/security/server/audit/index.mock.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { SecurityAuditLogger } from './security_audit_logger'; -import { AuditService } from './audit_service'; +import type { AuditService } from './audit_service'; +import type { SecurityAuditLogger } from './security_audit_logger'; export const securityAuditLoggerMock = { create() { diff --git a/x-pack/plugins/security/server/audit/security_audit_logger.ts b/x-pack/plugins/security/server/audit/security_audit_logger.ts index 9d1d896470d77..280cc233fca17 100644 --- a/x-pack/plugins/security/server/audit/security_audit_logger.ts +++ b/x-pack/plugins/security/server/audit/security_audit_logger.ts @@ -6,7 +6,7 @@ */ import type { AuthenticationProvider } from '../../common/model'; -import { LegacyAuditLogger } from './audit_service'; +import type { LegacyAuditLogger } from './audit_service'; /** * @deprecated diff --git a/x-pack/plugins/security/server/authentication/api_keys/api_keys.mock.ts b/x-pack/plugins/security/server/authentication/api_keys/api_keys.mock.ts index 0b0310de271fa..e82efeb5168d9 100644 --- a/x-pack/plugins/security/server/authentication/api_keys/api_keys.mock.ts +++ b/x-pack/plugins/security/server/authentication/api_keys/api_keys.mock.ts @@ -6,7 +6,8 @@ */ import type { PublicMethodsOf } from '@kbn/utility-types'; -import type { APIKeys } from '.'; + +import type { APIKeys } from './api_keys'; export const apiKeysMock = { create: (): jest.Mocked> => ({ diff --git a/x-pack/plugins/security/server/authentication/api_keys/api_keys.test.ts b/x-pack/plugins/security/server/authentication/api_keys/api_keys.test.ts index a6855aaf705e6..f0a832f451cb8 100644 --- a/x-pack/plugins/security/server/authentication/api_keys/api_keys.test.ts +++ b/x-pack/plugins/security/server/authentication/api_keys/api_keys.test.ts @@ -5,16 +5,12 @@ * 2.0. */ -import type { SecurityLicense } from '../../../common/licensing'; -import { APIKeys } from './api_keys'; +import { elasticsearchServiceMock, httpServerMock, loggingSystemMock } from 'src/core/server/mocks'; -import { - httpServerMock, - loggingSystemMock, - elasticsearchServiceMock, -} from '../../../../../../src/core/server/mocks'; +import type { SecurityLicense } from '../../../common/licensing'; import { licenseMock } from '../../../common/licensing/index.mock'; import { securityMock } from '../../mocks'; +import { APIKeys } from './api_keys'; const encodeToBase64 = (str: string) => Buffer.from(str).toString('base64'); diff --git a/x-pack/plugins/security/server/authentication/api_keys/api_keys.ts b/x-pack/plugins/security/server/authentication/api_keys/api_keys.ts index e31f0583f45fe..1b4b9d04603fb 100644 --- a/x-pack/plugins/security/server/authentication/api_keys/api_keys.ts +++ b/x-pack/plugins/security/server/authentication/api_keys/api_keys.ts @@ -5,11 +5,12 @@ * 2.0. */ -import type { IClusterClient, KibanaRequest, Logger } from '../../../../../../src/core/server'; +import type { IClusterClient, KibanaRequest, Logger } from 'src/core/server'; + import type { SecurityLicense } from '../../../common/licensing'; import { - HTTPAuthorizationHeader, BasicHTTPAuthorizationHeaderCredentials, + HTTPAuthorizationHeader, } from '../http_authentication'; /** diff --git a/x-pack/plugins/security/server/authentication/authentication_result.test.ts b/x-pack/plugins/security/server/authentication/authentication_result.test.ts index cd120d0e23cb2..e890f99e0da6e 100644 --- a/x-pack/plugins/security/server/authentication/authentication_result.test.ts +++ b/x-pack/plugins/security/server/authentication/authentication_result.test.ts @@ -6,6 +6,7 @@ */ import Boom from '@hapi/boom'; + import { mockAuthenticatedUser } from '../../common/model/authenticated_user.mock'; import { AuthenticationResult } from './authentication_result'; diff --git a/x-pack/plugins/security/server/authentication/authentication_result.ts b/x-pack/plugins/security/server/authentication/authentication_result.ts index 7c1f6e9250d47..a5b1e11754d97 100644 --- a/x-pack/plugins/security/server/authentication/authentication_result.ts +++ b/x-pack/plugins/security/server/authentication/authentication_result.ts @@ -5,8 +5,9 @@ * 2.0. */ -import { AuthHeaders } from '../../../../../src/core/server'; -import { AuthenticatedUser } from '../../common/model'; +import type { AuthHeaders } from 'src/core/server'; + +import type { AuthenticatedUser } from '../../common/model'; /** * Represents status that `AuthenticationResult` can be in. diff --git a/x-pack/plugins/security/server/authentication/authentication_service.mock.ts b/x-pack/plugins/security/server/authentication/authentication_service.mock.ts index 864756d85fa45..ba3297aeb5493 100644 --- a/x-pack/plugins/security/server/authentication/authentication_service.mock.ts +++ b/x-pack/plugins/security/server/authentication/authentication_service.mock.ts @@ -6,9 +6,9 @@ */ import type { DeeplyMockedKeys } from '@kbn/utility-types/jest'; -import type { AuthenticationServiceStart } from './authentication_service'; import { apiKeysMock } from './api_keys/api_keys.mock'; +import type { AuthenticationServiceStart } from './authentication_service'; export const authenticationServiceMock = { createStart: (): DeeplyMockedKeys => ({ diff --git a/x-pack/plugins/security/server/authentication/authentication_service.test.ts b/x-pack/plugins/security/server/authentication/authentication_service.test.ts index b513a37a48f03..786e62de81535 100644 --- a/x-pack/plugins/security/server/authentication/authentication_service.test.ts +++ b/x-pack/plugins/security/server/authentication/authentication_service.test.ts @@ -8,36 +8,37 @@ jest.mock('./authenticator'); import Boom from '@hapi/boom'; -import type { PublicMethodsOf } from '@kbn/utility-types'; - -import { - loggingSystemMock, - coreMock, - httpServerMock, - httpServiceMock, - elasticsearchServiceMock, -} from '../../../../../src/core/server/mocks'; -import { licenseMock } from '../../common/licensing/index.mock'; -import { mockAuthenticatedUser } from '../../common/model/authenticated_user.mock'; -import { auditServiceMock, securityAuditLoggerMock } from '../audit/index.mock'; -import { securityFeatureUsageServiceMock } from '../feature_usage/index.mock'; -import { sessionMock } from '../session_management/session.mock'; +import type { PublicMethodsOf } from '@kbn/utility-types'; import type { AuthenticationHandler, AuthToolkit, + HttpServiceSetup, + HttpServiceStart, KibanaRequest, Logger, LoggerFactory, - HttpServiceSetup, - HttpServiceStart, -} from '../../../../../src/core/server'; -import type { AuthenticatedUser } from '../../common/model'; +} from 'src/core/server'; +import { + coreMock, + elasticsearchServiceMock, + httpServerMock, + httpServiceMock, + loggingSystemMock, +} from 'src/core/server/mocks'; + import type { SecurityLicense } from '../../common/licensing'; +import { licenseMock } from '../../common/licensing/index.mock'; +import type { AuthenticatedUser } from '../../common/model'; +import { mockAuthenticatedUser } from '../../common/model/authenticated_user.mock'; import type { AuditServiceSetup, SecurityAuditLogger } from '../audit'; +import { auditServiceMock, securityAuditLoggerMock } from '../audit/index.mock'; +import type { ConfigType } from '../config'; +import { ConfigSchema, createConfig } from '../config'; import type { SecurityFeatureUsageServiceStart } from '../feature_usage'; +import { securityFeatureUsageServiceMock } from '../feature_usage/index.mock'; import type { Session } from '../session_management'; -import { ConfigSchema, ConfigType, createConfig } from '../config'; +import { sessionMock } from '../session_management/session.mock'; import { AuthenticationResult } from './authentication_result'; import { AuthenticationService } from './authentication_service'; diff --git a/x-pack/plugins/security/server/authentication/authentication_service.ts b/x-pack/plugins/security/server/authentication/authentication_service.ts index e5043da406a3c..0710009fa58cc 100644 --- a/x-pack/plugins/security/server/authentication/authentication_service.ts +++ b/x-pack/plugins/security/server/authentication/authentication_service.ts @@ -7,24 +7,26 @@ import type { PublicMethodsOf } from '@kbn/utility-types'; import type { - LoggerFactory, - KibanaRequest, - Logger, HttpServiceSetup, - IClusterClient, HttpServiceStart, -} from '../../../../../src/core/server'; + IClusterClient, + KibanaRequest, + Logger, + LoggerFactory, +} from 'src/core/server'; + import type { SecurityLicense } from '../../common/licensing'; import type { AuthenticatedUser } from '../../common/model'; import type { AuditServiceSetup, SecurityAuditLogger } from '../audit'; import type { ConfigType } from '../config'; +import { getErrorStatusCode } from '../errors'; import type { SecurityFeatureUsageServiceStart } from '../feature_usage'; import type { Session } from '../session_management'; -import type { DeauthenticationResult } from './deauthentication_result'; -import type { AuthenticationResult } from './authentication_result'; -import { getErrorStatusCode } from '../errors'; import { APIKeys } from './api_keys'; -import { Authenticator, ProviderLoginAttempt } from './authenticator'; +import type { AuthenticationResult } from './authentication_result'; +import type { ProviderLoginAttempt } from './authenticator'; +import { Authenticator } from './authenticator'; +import type { DeauthenticationResult } from './deauthentication_result'; interface AuthenticationServiceSetupParams { http: Pick; diff --git a/x-pack/plugins/security/server/authentication/authenticator.test.ts b/x-pack/plugins/security/server/authentication/authenticator.test.ts index 8bbddce12d893..e96d51a7a2e91 100644 --- a/x-pack/plugins/security/server/authentication/authenticator.test.ts +++ b/x-pack/plugins/security/server/authentication/authenticator.test.ts @@ -11,25 +11,28 @@ jest.mock('./providers/saml'); jest.mock('./providers/http'); import Boom from '@hapi/boom'; + import type { PublicMethodsOf } from '@kbn/utility-types'; import { - loggingSystemMock, - httpServiceMock, - httpServerMock, elasticsearchServiceMock, -} from '../../../../../src/core/server/mocks'; + httpServerMock, + httpServiceMock, + loggingSystemMock, +} from 'src/core/server/mocks'; + +import type { SecurityLicenseFeatures } from '../../common/licensing'; import { licenseMock } from '../../common/licensing/index.mock'; import { mockAuthenticatedUser } from '../../common/model/authenticated_user.mock'; import { auditServiceMock, securityAuditLoggerMock } from '../audit/index.mock'; -import { sessionMock } from '../session_management/index.mock'; -import { SecurityLicenseFeatures } from '../../common/licensing'; import { ConfigSchema, createConfig } from '../config'; -import { SessionValue } from '../session_management'; +import { securityFeatureUsageServiceMock } from '../feature_usage/index.mock'; +import type { SessionValue } from '../session_management'; +import { sessionMock } from '../session_management/index.mock'; import { AuthenticationResult } from './authentication_result'; -import { Authenticator, AuthenticatorOptions } from './authenticator'; +import type { AuthenticatorOptions } from './authenticator'; +import { Authenticator } from './authenticator'; import { DeauthenticationResult } from './deauthentication_result'; -import { BasicAuthenticationProvider, SAMLAuthenticationProvider } from './providers'; -import { securityFeatureUsageServiceMock } from '../feature_usage/index.mock'; +import type { BasicAuthenticationProvider, SAMLAuthenticationProvider } from './providers'; function getMockOptions({ providers, diff --git a/x-pack/plugins/security/server/authentication/authenticator.ts b/x-pack/plugins/security/server/authentication/authenticator.ts index 82a15e177ccb4..6c9f4a6f53319 100644 --- a/x-pack/plugins/security/server/authentication/authenticator.ts +++ b/x-pack/plugins/security/server/authentication/authenticator.ts @@ -6,12 +6,9 @@ */ import type { PublicMethodsOf } from '@kbn/utility-types'; -import { - KibanaRequest, - LoggerFactory, - IBasePath, - IClusterClient, -} from '../../../../../src/core/server'; +import type { IBasePath, IClusterClient, LoggerFactory } from 'src/core/server'; + +import { KibanaRequest } from '../../../../../src/core/server'; import { AUTH_PROVIDER_HINT_QUERY_STRING_PARAMETER, LOGOUT_PROVIDER_QUERY_STRING_PARAMETER, @@ -21,30 +18,32 @@ import { import type { SecurityLicense } from '../../common/licensing'; import type { AuthenticatedUser, AuthenticationProvider } from '../../common/model'; import { shouldProviderUseLoginForm } from '../../common/model'; -import { SecurityAuditLogger, AuditServiceSetup, userLoginEvent } from '../audit'; +import type { AuditServiceSetup, SecurityAuditLogger } from '../audit'; +import { userLoginEvent } from '../audit'; import type { ConfigType } from '../config'; import { getErrorStatusCode } from '../errors'; import type { SecurityFeatureUsageServiceStart } from '../feature_usage'; -import type { SessionValue, Session } from '../session_management'; - -import { - AnonymousAuthenticationProvider, +import type { Session, SessionValue } from '../session_management'; +import { AuthenticationResult } from './authentication_result'; +import { canRedirectRequest } from './can_redirect_request'; +import { DeauthenticationResult } from './deauthentication_result'; +import { HTTPAuthorizationHeader } from './http_authentication'; +import type { AuthenticationProviderOptions, AuthenticationProviderSpecificOptions, BaseAuthenticationProvider, +} from './providers'; +import { + AnonymousAuthenticationProvider, BasicAuthenticationProvider, + HTTPAuthenticationProvider, KerberosAuthenticationProvider, - SAMLAuthenticationProvider, - TokenAuthenticationProvider, OIDCAuthenticationProvider, PKIAuthenticationProvider, - HTTPAuthenticationProvider, + SAMLAuthenticationProvider, + TokenAuthenticationProvider, } from './providers'; -import { AuthenticationResult } from './authentication_result'; -import { DeauthenticationResult } from './deauthentication_result'; import { Tokens } from './tokens'; -import { canRedirectRequest } from './can_redirect_request'; -import { HTTPAuthorizationHeader } from './http_authentication'; /** * The shape of the login attempt. diff --git a/x-pack/plugins/security/server/authentication/can_redirect_request.ts b/x-pack/plugins/security/server/authentication/can_redirect_request.ts index 8e6ad67da72dc..71c6365d9aea4 100644 --- a/x-pack/plugins/security/server/authentication/can_redirect_request.ts +++ b/x-pack/plugins/security/server/authentication/can_redirect_request.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { KibanaRequest } from '../../../../../src/core/server'; +import type { KibanaRequest } from 'src/core/server'; const ROUTE_TAG_API = 'api'; const KIBANA_XSRF_HEADER = 'kbn-xsrf'; diff --git a/x-pack/plugins/security/server/authentication/http_authentication/http_authorization_header.test.ts b/x-pack/plugins/security/server/authentication/http_authentication/http_authorization_header.test.ts index 16e976414fcda..008afcf2a9389 100644 --- a/x-pack/plugins/security/server/authentication/http_authentication/http_authorization_header.test.ts +++ b/x-pack/plugins/security/server/authentication/http_authentication/http_authorization_header.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { httpServerMock } from '../../../../../../src/core/server/mocks'; +import { httpServerMock } from 'src/core/server/mocks'; import { HTTPAuthorizationHeader } from './http_authorization_header'; diff --git a/x-pack/plugins/security/server/authentication/http_authentication/http_authorization_header.ts b/x-pack/plugins/security/server/authentication/http_authentication/http_authorization_header.ts index 1341e7afb270a..97d1f0c9b9c00 100644 --- a/x-pack/plugins/security/server/authentication/http_authentication/http_authorization_header.ts +++ b/x-pack/plugins/security/server/authentication/http_authentication/http_authorization_header.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { KibanaRequest } from '../../../../../../src/core/server'; +import type { KibanaRequest } from 'src/core/server'; export class HTTPAuthorizationHeader { /** diff --git a/x-pack/plugins/security/server/authentication/providers/anonymous.test.ts b/x-pack/plugins/security/server/authentication/providers/anonymous.test.ts index 5ae174b1e2273..124cdb0426518 100644 --- a/x-pack/plugins/security/server/authentication/providers/anonymous.test.ts +++ b/x-pack/plugins/security/server/authentication/providers/anonymous.test.ts @@ -7,12 +7,11 @@ import { errors } from '@elastic/elasticsearch'; -import { elasticsearchServiceMock, httpServerMock } from '../../../../../../src/core/server/mocks'; +import type { ScopeableRequest } from 'src/core/server'; +import { elasticsearchServiceMock, httpServerMock } from 'src/core/server/mocks'; + import { mockAuthenticatedUser } from '../../../common/model/authenticated_user.mock'; import { securityMock } from '../../mocks'; -import { mockAuthenticationProviderOptions } from './base.mock'; - -import { ScopeableRequest } from '../../../../../../src/core/server'; import { AuthenticationResult } from '../authentication_result'; import { DeauthenticationResult } from '../deauthentication_result'; import { @@ -20,6 +19,7 @@ import { HTTPAuthorizationHeader, } from '../http_authentication'; import { AnonymousAuthenticationProvider } from './anonymous'; +import { mockAuthenticationProviderOptions } from './base.mock'; function expectAuthenticateCall( mockClusterClient: ReturnType, diff --git a/x-pack/plugins/security/server/authentication/providers/anonymous.ts b/x-pack/plugins/security/server/authentication/providers/anonymous.ts index 8185882a31626..2efd26a9d2e19 100644 --- a/x-pack/plugins/security/server/authentication/providers/anonymous.ts +++ b/x-pack/plugins/security/server/authentication/providers/anonymous.ts @@ -5,7 +5,8 @@ * 2.0. */ -import { KibanaRequest } from '../../../../../../src/core/server'; +import type { KibanaRequest } from 'src/core/server'; + import { getErrorStatusCode } from '../../errors'; import { AuthenticationResult } from '../authentication_result'; import { canRedirectRequest } from '../can_redirect_request'; @@ -14,7 +15,8 @@ import { BasicHTTPAuthorizationHeaderCredentials, HTTPAuthorizationHeader, } from '../http_authentication'; -import { AuthenticationProviderOptions, BaseAuthenticationProvider } from './base'; +import type { AuthenticationProviderOptions } from './base'; +import { BaseAuthenticationProvider } from './base'; /** * Credentials that are based on the username and password. diff --git a/x-pack/plugins/security/server/authentication/providers/base.mock.ts b/x-pack/plugins/security/server/authentication/providers/base.mock.ts index ac6c256d0d4cb..64c97590141b6 100644 --- a/x-pack/plugins/security/server/authentication/providers/base.mock.ts +++ b/x-pack/plugins/security/server/authentication/providers/base.mock.ts @@ -6,10 +6,10 @@ */ import { - loggingSystemMock, - httpServiceMock, elasticsearchServiceMock, -} from '../../../../../../src/core/server/mocks'; + httpServiceMock, + loggingSystemMock, +} from 'src/core/server/mocks'; export type MockAuthenticationProviderOptions = ReturnType< typeof mockAuthenticationProviderOptions diff --git a/x-pack/plugins/security/server/authentication/providers/base.ts b/x-pack/plugins/security/server/authentication/providers/base.ts index 39a28eceefd5d..4750b9c325e9c 100644 --- a/x-pack/plugins/security/server/authentication/providers/base.ts +++ b/x-pack/plugins/security/server/authentication/providers/base.ts @@ -7,18 +7,19 @@ import { deepFreeze } from '@kbn/std'; import type { PublicMethodsOf } from '@kbn/utility-types'; -import { - KibanaRequest, - Logger, - HttpServiceSetup, +import type { Headers, + HttpServiceSetup, IClusterClient, -} from '../../../../../../src/core/server'; + KibanaRequest, + Logger, +} from 'src/core/server'; + import type { AuthenticatedUser } from '../../../common/model'; import type { AuthenticationInfo } from '../../elasticsearch'; import { AuthenticationResult } from '../authentication_result'; -import { DeauthenticationResult } from '../deauthentication_result'; -import { Tokens } from '../tokens'; +import type { DeauthenticationResult } from '../deauthentication_result'; +import type { Tokens } from '../tokens'; /** * Represents available provider options. diff --git a/x-pack/plugins/security/server/authentication/providers/basic.test.ts b/x-pack/plugins/security/server/authentication/providers/basic.test.ts index 8a7c7f141c9e3..025589bd25b40 100644 --- a/x-pack/plugins/security/server/authentication/providers/basic.test.ts +++ b/x-pack/plugins/security/server/authentication/providers/basic.test.ts @@ -7,14 +7,14 @@ import { errors } from '@elastic/elasticsearch'; -import { elasticsearchServiceMock, httpServerMock } from '../../../../../../src/core/server/mocks'; +import type { ScopeableRequest } from 'src/core/server'; +import { elasticsearchServiceMock, httpServerMock } from 'src/core/server/mocks'; + import { mockAuthenticatedUser } from '../../../common/model/authenticated_user.mock'; import { securityMock } from '../../mocks'; -import { mockAuthenticationProviderOptions } from './base.mock'; - -import { ScopeableRequest } from '../../../../../../src/core/server'; import { AuthenticationResult } from '../authentication_result'; import { DeauthenticationResult } from '../deauthentication_result'; +import { mockAuthenticationProviderOptions } from './base.mock'; import { BasicAuthenticationProvider } from './basic'; function generateAuthorizationHeader(username: string, password: string) { diff --git a/x-pack/plugins/security/server/authentication/providers/basic.ts b/x-pack/plugins/security/server/authentication/providers/basic.ts index f9b80720e58bb..d0a3a90cae908 100644 --- a/x-pack/plugins/security/server/authentication/providers/basic.ts +++ b/x-pack/plugins/security/server/authentication/providers/basic.ts @@ -5,14 +5,15 @@ * 2.0. */ -import { KibanaRequest } from '../../../../../../src/core/server'; +import type { KibanaRequest } from 'src/core/server'; + import { NEXT_URL_QUERY_STRING_PARAMETER } from '../../../common/constants'; -import { canRedirectRequest } from '../can_redirect_request'; import { AuthenticationResult } from '../authentication_result'; +import { canRedirectRequest } from '../can_redirect_request'; import { DeauthenticationResult } from '../deauthentication_result'; import { - HTTPAuthorizationHeader, BasicHTTPAuthorizationHeaderCredentials, + HTTPAuthorizationHeader, } from '../http_authentication'; import { BaseAuthenticationProvider } from './base'; diff --git a/x-pack/plugins/security/server/authentication/providers/http.test.ts b/x-pack/plugins/security/server/authentication/providers/http.test.ts index 908af3901ffbe..451be10685558 100644 --- a/x-pack/plugins/security/server/authentication/providers/http.test.ts +++ b/x-pack/plugins/security/server/authentication/providers/http.test.ts @@ -7,14 +7,15 @@ import { errors } from '@elastic/elasticsearch'; -import { elasticsearchServiceMock, httpServerMock } from '../../../../../../src/core/server/mocks'; +import type { ScopeableRequest } from 'src/core/server'; +import { elasticsearchServiceMock, httpServerMock } from 'src/core/server/mocks'; + import { mockAuthenticatedUser } from '../../../common/model/authenticated_user.mock'; import { securityMock } from '../../mocks'; -import { MockAuthenticationProviderOptions, mockAuthenticationProviderOptions } from './base.mock'; - -import { ScopeableRequest } from '../../../../../../src/core/server'; import { AuthenticationResult } from '../authentication_result'; import { DeauthenticationResult } from '../deauthentication_result'; +import type { MockAuthenticationProviderOptions } from './base.mock'; +import { mockAuthenticationProviderOptions } from './base.mock'; import { HTTPAuthenticationProvider } from './http'; function expectAuthenticateCall( diff --git a/x-pack/plugins/security/server/authentication/providers/http.ts b/x-pack/plugins/security/server/authentication/providers/http.ts index 6e15886d1bf1c..2d5b4c5e82772 100644 --- a/x-pack/plugins/security/server/authentication/providers/http.ts +++ b/x-pack/plugins/security/server/authentication/providers/http.ts @@ -5,11 +5,13 @@ * 2.0. */ -import { KibanaRequest } from '../../../../../../src/core/server'; +import type { KibanaRequest } from 'src/core/server'; + import { AuthenticationResult } from '../authentication_result'; import { DeauthenticationResult } from '../deauthentication_result'; import { HTTPAuthorizationHeader } from '../http_authentication'; -import { AuthenticationProviderOptions, BaseAuthenticationProvider } from './base'; +import type { AuthenticationProviderOptions } from './base'; +import { BaseAuthenticationProvider } from './base'; interface HTTPAuthenticationProviderOptions { supportedSchemes: Set; diff --git a/x-pack/plugins/security/server/authentication/providers/kerberos.test.ts b/x-pack/plugins/security/server/authentication/providers/kerberos.test.ts index 92675ad02979c..1bcb845ca5c08 100644 --- a/x-pack/plugins/security/server/authentication/providers/kerberos.test.ts +++ b/x-pack/plugins/security/server/authentication/providers/kerberos.test.ts @@ -5,17 +5,18 @@ * 2.0. */ -import Boom from '@hapi/boom'; import { errors } from '@elastic/elasticsearch'; +import Boom from '@hapi/boom'; + +import type { KibanaRequest, ScopeableRequest } from 'src/core/server'; +import { elasticsearchServiceMock, httpServerMock } from 'src/core/server/mocks'; -import { elasticsearchServiceMock, httpServerMock } from '../../../../../../src/core/server/mocks'; import { mockAuthenticatedUser } from '../../../common/model/authenticated_user.mock'; import { securityMock } from '../../mocks'; -import { MockAuthenticationProviderOptions, mockAuthenticationProviderOptions } from './base.mock'; - -import { KibanaRequest, ScopeableRequest } from '../../../../../../src/core/server'; import { AuthenticationResult } from '../authentication_result'; import { DeauthenticationResult } from '../deauthentication_result'; +import type { MockAuthenticationProviderOptions } from './base.mock'; +import { mockAuthenticationProviderOptions } from './base.mock'; import { KerberosAuthenticationProvider } from './kerberos'; function expectAuthenticateCall( diff --git a/x-pack/plugins/security/server/authentication/providers/kerberos.ts b/x-pack/plugins/security/server/authentication/providers/kerberos.ts index 6740b74d61386..0de8e8e10a630 100644 --- a/x-pack/plugins/security/server/authentication/providers/kerberos.ts +++ b/x-pack/plugins/security/server/authentication/providers/kerberos.ts @@ -5,16 +5,19 @@ * 2.0. */ -import Boom from '@hapi/boom'; import { errors } from '@elastic/elasticsearch'; -import type { KibanaRequest } from '../../../../../../src/core/server'; +import Boom from '@hapi/boom'; + +import type { KibanaRequest } from 'src/core/server'; + import type { AuthenticationInfo } from '../../elasticsearch'; import { getDetailedErrorMessage, getErrorStatusCode } from '../../errors'; import { AuthenticationResult } from '../authentication_result'; +import { canRedirectRequest } from '../can_redirect_request'; import { DeauthenticationResult } from '../deauthentication_result'; import { HTTPAuthorizationHeader } from '../http_authentication'; -import { canRedirectRequest } from '../can_redirect_request'; -import { Tokens, TokenPair, RefreshTokenResult } from '../tokens'; +import type { RefreshTokenResult, TokenPair } from '../tokens'; +import { Tokens } from '../tokens'; import { BaseAuthenticationProvider } from './base'; /** diff --git a/x-pack/plugins/security/server/authentication/providers/oidc.test.ts b/x-pack/plugins/security/server/authentication/providers/oidc.test.ts index 19ccc5a6e7524..f35545e5e5f3a 100644 --- a/x-pack/plugins/security/server/authentication/providers/oidc.test.ts +++ b/x-pack/plugins/security/server/authentication/providers/oidc.test.ts @@ -5,19 +5,21 @@ * 2.0. */ -import Boom from '@hapi/boom'; import { errors } from '@elastic/elasticsearch'; +import Boom from '@hapi/boom'; -import { elasticsearchServiceMock, httpServerMock } from '../../../../../../src/core/server/mocks'; +import type { KibanaRequest } from 'src/core/server'; +import { elasticsearchServiceMock, httpServerMock } from 'src/core/server/mocks'; + +import type { AuthenticatedUser } from '../../../common/model'; import { mockAuthenticatedUser } from '../../../common/model/authenticated_user.mock'; import { securityMock } from '../../mocks'; -import { MockAuthenticationProviderOptions, mockAuthenticationProviderOptions } from './base.mock'; - -import { KibanaRequest } from '../../../../../../src/core/server'; import { AuthenticationResult } from '../authentication_result'; import { DeauthenticationResult } from '../deauthentication_result'; -import { OIDCAuthenticationProvider, OIDCLogin, ProviderLoginAttempt } from './oidc'; -import { AuthenticatedUser } from '../../../common/model'; +import type { MockAuthenticationProviderOptions } from './base.mock'; +import { mockAuthenticationProviderOptions } from './base.mock'; +import type { ProviderLoginAttempt } from './oidc'; +import { OIDCAuthenticationProvider, OIDCLogin } from './oidc'; describe('OIDCAuthenticationProvider', () => { let provider: OIDCAuthenticationProvider; diff --git a/x-pack/plugins/security/server/authentication/providers/oidc.ts b/x-pack/plugins/security/server/authentication/providers/oidc.ts index 78842bef7f48b..2afa49fe6e082 100644 --- a/x-pack/plugins/security/server/authentication/providers/oidc.ts +++ b/x-pack/plugins/security/server/authentication/providers/oidc.ts @@ -7,19 +7,19 @@ import Boom from '@hapi/boom'; import type from 'type-detect'; -import { KibanaRequest } from '../../../../../../src/core/server'; + +import type { KibanaRequest } from 'src/core/server'; + import { NEXT_URL_QUERY_STRING_PARAMETER } from '../../../common/constants'; import type { AuthenticationInfo } from '../../elasticsearch'; import { AuthenticationResult } from '../authentication_result'; import { canRedirectRequest } from '../can_redirect_request'; import { DeauthenticationResult } from '../deauthentication_result'; import { HTTPAuthorizationHeader } from '../http_authentication'; -import { Tokens, TokenPair, RefreshTokenResult } from '../tokens'; -import { - AuthenticationProviderOptions, - BaseAuthenticationProvider, - AuthenticationProviderSpecificOptions, -} from './base'; +import type { RefreshTokenResult, TokenPair } from '../tokens'; +import { Tokens } from '../tokens'; +import type { AuthenticationProviderOptions, AuthenticationProviderSpecificOptions } from './base'; +import { BaseAuthenticationProvider } from './base'; /** * Describes possible OpenID Connect login flows. diff --git a/x-pack/plugins/security/server/authentication/providers/pki.test.ts b/x-pack/plugins/security/server/authentication/providers/pki.test.ts index 7063bfbf3b373..4ad6fe61e259c 100644 --- a/x-pack/plugins/security/server/authentication/providers/pki.test.ts +++ b/x-pack/plugins/security/server/authentication/providers/pki.test.ts @@ -8,19 +8,21 @@ jest.mock('net'); jest.mock('tls'); -import { Socket } from 'net'; -import { PeerCertificate, TLSSocket } from 'tls'; -import Boom from '@hapi/boom'; import { errors } from '@elastic/elasticsearch'; +import Boom from '@hapi/boom'; +import { Socket } from 'net'; +import type { PeerCertificate } from 'tls'; +import { TLSSocket } from 'tls'; + +import type { KibanaRequest, ScopeableRequest } from 'src/core/server'; +import { elasticsearchServiceMock, httpServerMock } from 'src/core/server/mocks'; -import { elasticsearchServiceMock, httpServerMock } from '../../../../../../src/core/server/mocks'; import { mockAuthenticatedUser } from '../../../common/model/authenticated_user.mock'; import { securityMock } from '../../mocks'; -import { MockAuthenticationProviderOptions, mockAuthenticationProviderOptions } from './base.mock'; - -import { KibanaRequest, ScopeableRequest } from '../../../../../../src/core/server'; import { AuthenticationResult } from '../authentication_result'; import { DeauthenticationResult } from '../deauthentication_result'; +import type { MockAuthenticationProviderOptions } from './base.mock'; +import { mockAuthenticationProviderOptions } from './base.mock'; import { PKIAuthenticationProvider } from './pki'; interface MockPeerCertificate extends Partial { diff --git a/x-pack/plugins/security/server/authentication/providers/pki.ts b/x-pack/plugins/security/server/authentication/providers/pki.ts index 6d65eafae9060..0c002f005bce3 100644 --- a/x-pack/plugins/security/server/authentication/providers/pki.ts +++ b/x-pack/plugins/security/server/authentication/providers/pki.ts @@ -6,13 +6,15 @@ */ import Boom from '@hapi/boom'; -import { DetailedPeerCertificate } from 'tls'; -import { KibanaRequest } from '../../../../../../src/core/server'; +import type { DetailedPeerCertificate } from 'tls'; + +import type { KibanaRequest } from 'src/core/server'; + import type { AuthenticationInfo } from '../../elasticsearch'; import { AuthenticationResult } from '../authentication_result'; +import { canRedirectRequest } from '../can_redirect_request'; import { DeauthenticationResult } from '../deauthentication_result'; import { HTTPAuthorizationHeader } from '../http_authentication'; -import { canRedirectRequest } from '../can_redirect_request'; import { Tokens } from '../tokens'; import { BaseAuthenticationProvider } from './base'; diff --git a/x-pack/plugins/security/server/authentication/providers/saml.test.ts b/x-pack/plugins/security/server/authentication/providers/saml.test.ts index f072e65d9f867..f52b9129cb335 100644 --- a/x-pack/plugins/security/server/authentication/providers/saml.test.ts +++ b/x-pack/plugins/security/server/authentication/providers/saml.test.ts @@ -5,18 +5,19 @@ * 2.0. */ -import Boom from '@hapi/boom'; import { errors } from '@elastic/elasticsearch'; +import Boom from '@hapi/boom'; -import { elasticsearchServiceMock, httpServerMock } from '../../../../../../src/core/server/mocks'; +import { elasticsearchServiceMock, httpServerMock } from 'src/core/server/mocks'; + +import type { AuthenticatedUser } from '../../../common/model'; import { mockAuthenticatedUser } from '../../../common/model/authenticated_user.mock'; import { securityMock } from '../../mocks'; -import { MockAuthenticationProviderOptions, mockAuthenticationProviderOptions } from './base.mock'; - import { AuthenticationResult } from '../authentication_result'; import { DeauthenticationResult } from '../deauthentication_result'; +import type { MockAuthenticationProviderOptions } from './base.mock'; +import { mockAuthenticationProviderOptions } from './base.mock'; import { SAMLAuthenticationProvider, SAMLLogin } from './saml'; -import { AuthenticatedUser } from '../../../common/model'; describe('SAMLAuthenticationProvider', () => { let provider: SAMLAuthenticationProvider; diff --git a/x-pack/plugins/security/server/authentication/providers/saml.ts b/x-pack/plugins/security/server/authentication/providers/saml.ts index b9b4a19ea4e2b..743ee4ba39e72 100644 --- a/x-pack/plugins/security/server/authentication/providers/saml.ts +++ b/x-pack/plugins/security/server/authentication/providers/saml.ts @@ -6,16 +6,20 @@ */ import Boom from '@hapi/boom'; -import { KibanaRequest } from '../../../../../../src/core/server'; -import { isInternalURL } from '../../../common/is_internal_url'; + +import type { KibanaRequest } from 'src/core/server'; + import { NEXT_URL_QUERY_STRING_PARAMETER } from '../../../common/constants'; +import { isInternalURL } from '../../../common/is_internal_url'; import type { AuthenticationInfo } from '../../elasticsearch'; import { AuthenticationResult } from '../authentication_result'; -import { DeauthenticationResult } from '../deauthentication_result'; import { canRedirectRequest } from '../can_redirect_request'; +import { DeauthenticationResult } from '../deauthentication_result'; import { HTTPAuthorizationHeader } from '../http_authentication'; -import { Tokens, TokenPair, RefreshTokenResult } from '../tokens'; -import { AuthenticationProviderOptions, BaseAuthenticationProvider } from './base'; +import type { RefreshTokenResult, TokenPair } from '../tokens'; +import { Tokens } from '../tokens'; +import type { AuthenticationProviderOptions } from './base'; +import { BaseAuthenticationProvider } from './base'; /** * The state supported by the provider (for the SAML handshake or established session). diff --git a/x-pack/plugins/security/server/authentication/providers/token.test.ts b/x-pack/plugins/security/server/authentication/providers/token.test.ts index 3f3d1373092a6..4d80250607121 100644 --- a/x-pack/plugins/security/server/authentication/providers/token.test.ts +++ b/x-pack/plugins/security/server/authentication/providers/token.test.ts @@ -5,17 +5,18 @@ * 2.0. */ -import Boom from '@hapi/boom'; import { errors } from '@elastic/elasticsearch'; +import Boom from '@hapi/boom'; + +import type { ScopeableRequest } from 'src/core/server'; +import { elasticsearchServiceMock, httpServerMock } from 'src/core/server/mocks'; -import { elasticsearchServiceMock, httpServerMock } from '../../../../../../src/core/server/mocks'; import { mockAuthenticatedUser } from '../../../common/model/authenticated_user.mock'; import { securityMock } from '../../mocks'; -import { MockAuthenticationProviderOptions, mockAuthenticationProviderOptions } from './base.mock'; - -import { ScopeableRequest } from '../../../../../../src/core/server'; import { AuthenticationResult } from '../authentication_result'; import { DeauthenticationResult } from '../deauthentication_result'; +import type { MockAuthenticationProviderOptions } from './base.mock'; +import { mockAuthenticationProviderOptions } from './base.mock'; import { TokenAuthenticationProvider } from './token'; function expectAuthenticateCall( diff --git a/x-pack/plugins/security/server/authentication/providers/token.ts b/x-pack/plugins/security/server/authentication/providers/token.ts index 7ce13cc707c21..f202a0bd43fcf 100644 --- a/x-pack/plugins/security/server/authentication/providers/token.ts +++ b/x-pack/plugins/security/server/authentication/providers/token.ts @@ -6,15 +6,18 @@ */ import Boom from '@hapi/boom'; -import { KibanaRequest } from '../../../../../../src/core/server'; + +import type { KibanaRequest } from 'src/core/server'; + import { NEXT_URL_QUERY_STRING_PARAMETER } from '../../../common/constants'; -import { AuthenticationInfo } from '../../elasticsearch'; +import type { AuthenticationInfo } from '../../elasticsearch'; import { getDetailedErrorMessage } from '../../errors'; import { AuthenticationResult } from '../authentication_result'; -import { DeauthenticationResult } from '../deauthentication_result'; import { canRedirectRequest } from '../can_redirect_request'; +import { DeauthenticationResult } from '../deauthentication_result'; import { HTTPAuthorizationHeader } from '../http_authentication'; -import { Tokens, TokenPair, RefreshTokenResult } from '../tokens'; +import type { RefreshTokenResult, TokenPair } from '../tokens'; +import { Tokens } from '../tokens'; import { BaseAuthenticationProvider } from './base'; /** diff --git a/x-pack/plugins/security/server/authentication/tokens.test.ts b/x-pack/plugins/security/server/authentication/tokens.test.ts index b787956f79c1c..a6d52e355b145 100644 --- a/x-pack/plugins/security/server/authentication/tokens.test.ts +++ b/x-pack/plugins/security/server/authentication/tokens.test.ts @@ -6,13 +6,13 @@ */ import { errors } from '@elastic/elasticsearch'; -import { DeeplyMockedKeys } from '@kbn/utility-types/jest'; -import { elasticsearchServiceMock, loggingSystemMock } from '../../../../../src/core/server/mocks'; +import type { DeeplyMockedKeys } from '@kbn/utility-types/jest'; +import type { ElasticsearchClient } from 'src/core/server'; +import { elasticsearchServiceMock, loggingSystemMock } from 'src/core/server/mocks'; + import { mockAuthenticatedUser } from '../../common/model/authenticated_user.mock'; import { securityMock } from '../mocks'; - -import { ElasticsearchClient } from '../../../../../src/core/server'; import { Tokens } from './tokens'; describe('Tokens', () => { diff --git a/x-pack/plugins/security/server/authentication/tokens.ts b/x-pack/plugins/security/server/authentication/tokens.ts index 755ff9ac9e73b..e3c4644775613 100644 --- a/x-pack/plugins/security/server/authentication/tokens.ts +++ b/x-pack/plugins/security/server/authentication/tokens.ts @@ -5,7 +5,8 @@ * 2.0. */ -import type { ElasticsearchClient, Logger } from '../../../../../src/core/server'; +import type { ElasticsearchClient, Logger } from 'src/core/server'; + import type { AuthenticationInfo } from '../elasticsearch'; import { getErrorStatusCode } from '../errors'; diff --git a/x-pack/plugins/security/server/authorization/actions/actions.mock.ts b/x-pack/plugins/security/server/authorization/actions/actions.mock.ts index e520e8e56473b..97890e21c0eb7 100644 --- a/x-pack/plugins/security/server/authorization/actions/actions.mock.ts +++ b/x-pack/plugins/security/server/authorization/actions/actions.mock.ts @@ -5,13 +5,13 @@ * 2.0. */ +import type { Actions } from './actions'; +import { AlertingActions } from './alerting'; import { ApiActions } from './api'; import { AppActions } from './app'; import { SavedObjectActions } from './saved_object'; import { SpaceActions } from './space'; import { UIActions } from './ui'; -import { AlertingActions } from './alerting'; -import { Actions } from './actions'; jest.mock('./api'); jest.mock('./app'); diff --git a/x-pack/plugins/security/server/authorization/actions/actions.test.ts b/x-pack/plugins/security/server/authorization/actions/actions.test.ts index 7234dabf0e223..7b9e836f4db57 100644 --- a/x-pack/plugins/security/server/authorization/actions/actions.test.ts +++ b/x-pack/plugins/security/server/authorization/actions/actions.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { Actions } from '.'; +import { Actions } from './actions'; describe('#constructor', () => { test(`doesn't allow an empty string`, () => { diff --git a/x-pack/plugins/security/server/authorization/actions/actions.ts b/x-pack/plugins/security/server/authorization/actions/actions.ts index ccd2480ec232a..23d07f73f04be 100644 --- a/x-pack/plugins/security/server/authorization/actions/actions.ts +++ b/x-pack/plugins/security/server/authorization/actions/actions.ts @@ -5,12 +5,12 @@ * 2.0. */ +import { AlertingActions } from './alerting'; import { ApiActions } from './api'; import { AppActions } from './app'; import { SavedObjectActions } from './saved_object'; import { SpaceActions } from './space'; import { UIActions } from './ui'; -import { AlertingActions } from './alerting'; /** Actions are used to create the "actions" that are associated with Elasticsearch's * application privileges, and are used to perform the authorization checks implemented diff --git a/x-pack/plugins/security/server/authorization/actions/ui.ts b/x-pack/plugins/security/server/authorization/actions/ui.ts index d91fdbb33f6c1..42513708def2a 100644 --- a/x-pack/plugins/security/server/authorization/actions/ui.ts +++ b/x-pack/plugins/security/server/authorization/actions/ui.ts @@ -6,7 +6,9 @@ */ import { isString } from 'lodash'; -import { Capabilities as UICapabilities } from '../../../../../../src/core/server'; + +import type { Capabilities as UICapabilities } from 'src/core/server'; + import { uiCapabilitiesRegex } from '../../../../features/server'; export class UIActions { diff --git a/x-pack/plugins/security/server/authorization/api_authorization.test.ts b/x-pack/plugins/security/server/authorization/api_authorization.test.ts index b8aa0951ac0a3..e34fc2cc2cdb2 100644 --- a/x-pack/plugins/security/server/authorization/api_authorization.test.ts +++ b/x-pack/plugins/security/server/authorization/api_authorization.test.ts @@ -5,14 +5,14 @@ * 2.0. */ -import { initAPIAuthorization } from './api_authorization'; - import { coreMock, httpServerMock, httpServiceMock, loggingSystemMock, -} from '../../../../../src/core/server/mocks'; +} from 'src/core/server/mocks'; + +import { initAPIAuthorization } from './api_authorization'; import { authorizationMock } from './index.mock'; describe('initAPIAuthorization', () => { diff --git a/x-pack/plugins/security/server/authorization/api_authorization.ts b/x-pack/plugins/security/server/authorization/api_authorization.ts index f9c94070aedc4..dbf99bbfdf5f2 100644 --- a/x-pack/plugins/security/server/authorization/api_authorization.ts +++ b/x-pack/plugins/security/server/authorization/api_authorization.ts @@ -5,8 +5,9 @@ * 2.0. */ -import { HttpServiceSetup, Logger } from '../../../../../src/core/server'; -import { AuthorizationServiceSetup } from '.'; +import type { HttpServiceSetup, Logger } from 'src/core/server'; + +import type { AuthorizationServiceSetup } from './authorization_service'; export function initAPIAuthorization( http: HttpServiceSetup, diff --git a/x-pack/plugins/security/server/authorization/app_authorization.test.ts b/x-pack/plugins/security/server/authorization/app_authorization.test.ts index 25a07b6a89428..0e4d902105efa 100644 --- a/x-pack/plugins/security/server/authorization/app_authorization.test.ts +++ b/x-pack/plugins/security/server/authorization/app_authorization.test.ts @@ -5,16 +5,16 @@ * 2.0. */ -import { PluginSetupContract as FeaturesSetupContract } from '../../../features/server'; -import { featuresPluginMock } from '../../../features/server/mocks'; -import { initAppAuthorization } from './app_authorization'; - import { - loggingSystemMock, coreMock, httpServerMock, httpServiceMock, -} from '../../../../../src/core/server/mocks'; + loggingSystemMock, +} from 'src/core/server/mocks'; + +import type { PluginSetupContract as FeaturesSetupContract } from '../../../features/server'; +import { featuresPluginMock } from '../../../features/server/mocks'; +import { initAppAuthorization } from './app_authorization'; import { authorizationMock } from './index.mock'; const createFeaturesSetupContractMock = (): FeaturesSetupContract => { diff --git a/x-pack/plugins/security/server/authorization/app_authorization.ts b/x-pack/plugins/security/server/authorization/app_authorization.ts index b34f2ebe16161..b57523581bc5c 100644 --- a/x-pack/plugins/security/server/authorization/app_authorization.ts +++ b/x-pack/plugins/security/server/authorization/app_authorization.ts @@ -5,9 +5,10 @@ * 2.0. */ -import { HttpServiceSetup, Logger } from '../../../../../src/core/server'; -import { PluginSetupContract as FeaturesPluginSetup } from '../../../features/server'; -import { AuthorizationServiceSetup } from '.'; +import type { HttpServiceSetup, Logger } from 'src/core/server'; + +import type { PluginSetupContract as FeaturesPluginSetup } from '../../../features/server'; +import type { AuthorizationServiceSetup } from './authorization_service'; class ProtectedApplications { private applications: Set | null = null; diff --git a/x-pack/plugins/security/server/authorization/authorization_service.test.ts b/x-pack/plugins/security/server/authorization/authorization_service.test.ts index 4259ded7f1a90..62c7dd9f8891c 100644 --- a/x-pack/plugins/security/server/authorization/authorization_service.test.ts +++ b/x-pack/plugins/security/server/authorization/authorization_service.test.ts @@ -5,6 +5,12 @@ * 2.0. */ +import { Subject } from 'rxjs'; + +import { nextTick } from '@kbn/test/jest'; +import { coreMock, elasticsearchServiceMock, loggingSystemMock } from 'src/core/server/mocks'; + +// Note: this import must be before other relative imports for the mocks to work as intended. import { mockAuthorizationModeFactory, mockCheckPrivilegesDynamicallyWithRequestFactory, @@ -14,23 +20,15 @@ import { mockRegisterPrivilegesWithCluster, } from './service.test.mocks'; -import { Subject } from 'rxjs'; -import { OnlineStatusRetryScheduler } from '../elasticsearch'; +import { featuresPluginMock } from '../../../features/server/mocks'; +import { licenseMock } from '../../common/licensing/index.mock'; +import type { OnlineStatusRetryScheduler } from '../elasticsearch'; +import { AuthorizationService } from './authorization_service'; import { checkPrivilegesWithRequestFactory } from './check_privileges'; import { checkPrivilegesDynamicallyWithRequestFactory } from './check_privileges_dynamically'; import { checkSavedObjectsPrivilegesWithRequestFactory } from './check_saved_objects_privileges'; import { authorizationModeFactory } from './mode'; import { privilegesFactory } from './privileges'; -import { AuthorizationService } from '.'; - -import { nextTick } from '@kbn/test/jest'; -import { - coreMock, - elasticsearchServiceMock, - loggingSystemMock, -} from '../../../../../src/core/server/mocks'; -import { featuresPluginMock } from '../../../features/server/mocks'; -import { licenseMock } from '../../common/licensing/index.mock'; const kibanaIndexName = '.a-kibana-index'; const application = `kibana-${kibanaIndexName}`; diff --git a/x-pack/plugins/security/server/authorization/authorization_service.tsx b/x-pack/plugins/security/server/authorization/authorization_service.tsx index 059d5c0cdebed..db3c84477ffb1 100644 --- a/x-pack/plugins/security/server/authorization/authorization_service.tsx +++ b/x-pack/plugins/security/server/authorization/authorization_service.tsx @@ -6,54 +6,49 @@ */ import querystring from 'querystring'; - import React from 'react'; import { renderToStaticMarkup } from 'react-dom/server'; -import { Subscription, Observable } from 'rxjs'; -import * as UiSharedDeps from '@kbn/ui-shared-deps'; +import type { Observable, Subscription } from 'rxjs'; -import type { Capabilities as UICapabilities } from '../../../../../src/core/types'; - -import { - LoggerFactory, - KibanaRequest, - Logger, - HttpServiceSetup, +import * as UiSharedDeps from '@kbn/ui-shared-deps'; +import type { CapabilitiesSetup, + HttpServiceSetup, IClusterClient, -} from '../../../../../src/core/server'; + KibanaRequest, + Logger, + LoggerFactory, +} from 'src/core/server'; +import type { Capabilities as UICapabilities } from 'src/core/types'; -import { +import type { PluginSetupContract as FeaturesPluginSetup, PluginStartContract as FeaturesPluginStart, } from '../../../features/server'; - -import { SpacesService } from '../plugin'; +import { APPLICATION_PREFIX } from '../../common/constants'; +import type { SecurityLicense } from '../../common/licensing'; +import type { AuthenticatedUser } from '../../common/model'; +import { canRedirectRequest } from '../authentication'; +import type { OnlineStatusRetryScheduler } from '../elasticsearch'; +import type { SpacesService } from '../plugin'; import { Actions } from './actions'; -import { checkPrivilegesWithRequestFactory } from './check_privileges'; -import { - CheckPrivilegesDynamicallyWithRequest, - checkPrivilegesDynamicallyWithRequestFactory, -} from './check_privileges_dynamically'; -import { - CheckSavedObjectsPrivilegesWithRequest, - checkSavedObjectsPrivilegesWithRequestFactory, -} from './check_saved_objects_privileges'; -import { AuthorizationMode, authorizationModeFactory } from './mode'; -import { privilegesFactory, PrivilegesService } from './privileges'; -import { initAppAuthorization } from './app_authorization'; import { initAPIAuthorization } from './api_authorization'; +import { initAppAuthorization } from './app_authorization'; +import { checkPrivilegesWithRequestFactory } from './check_privileges'; +import type { CheckPrivilegesDynamicallyWithRequest } from './check_privileges_dynamically'; +import { checkPrivilegesDynamicallyWithRequestFactory } from './check_privileges_dynamically'; +import type { CheckSavedObjectsPrivilegesWithRequest } from './check_saved_objects_privileges'; +import { checkSavedObjectsPrivilegesWithRequestFactory } from './check_saved_objects_privileges'; import { disableUICapabilitiesFactory } from './disable_ui_capabilities'; -import { validateFeaturePrivileges } from './validate_feature_privileges'; -import { validateReservedPrivileges } from './validate_reserved_privileges'; +import type { AuthorizationMode } from './mode'; +import { authorizationModeFactory } from './mode'; +import type { PrivilegesService } from './privileges'; +import { privilegesFactory } from './privileges'; import { registerPrivilegesWithCluster } from './register_privileges_with_cluster'; -import { APPLICATION_PREFIX } from '../../common/constants'; -import { SecurityLicense } from '../../common/licensing'; -import { CheckPrivilegesWithRequest } from './types'; -import { OnlineStatusRetryScheduler } from '../elasticsearch'; -import { canRedirectRequest } from '../authentication'; import { ResetSessionPage } from './reset_session_page'; -import { AuthenticatedUser } from '..'; +import type { CheckPrivilegesWithRequest } from './types'; +import { validateFeaturePrivileges } from './validate_feature_privileges'; +import { validateReservedPrivileges } from './validate_reserved_privileges'; export { Actions } from './actions'; export { CheckSavedObjectsPrivileges } from './check_saved_objects_privileges'; diff --git a/x-pack/plugins/security/server/authorization/check_privileges.test.ts b/x-pack/plugins/security/server/authorization/check_privileges.test.ts index 5bca46f22a512..2c1deed0f8c30 100644 --- a/x-pack/plugins/security/server/authorization/check_privileges.test.ts +++ b/x-pack/plugins/security/server/authorization/check_privileges.test.ts @@ -6,11 +6,12 @@ */ import { uniq } from 'lodash'; + +import { elasticsearchServiceMock, httpServerMock } from 'src/core/server/mocks'; + import { GLOBAL_RESOURCE } from '../../common/constants'; import { checkPrivilegesWithRequestFactory } from './check_privileges'; -import { HasPrivilegesResponse } from './types'; - -import { elasticsearchServiceMock, httpServerMock } from '../../../../../src/core/server/mocks'; +import type { HasPrivilegesResponse } from './types'; const application = 'kibana-our_application'; diff --git a/x-pack/plugins/security/server/authorization/check_privileges.ts b/x-pack/plugins/security/server/authorization/check_privileges.ts index c11be0e412d43..0fc11cddf9bbc 100644 --- a/x-pack/plugins/security/server/authorization/check_privileges.ts +++ b/x-pack/plugins/security/server/authorization/check_privileges.ts @@ -6,15 +6,17 @@ */ import { pick, transform, uniq } from 'lodash'; -import { IClusterClient, KibanaRequest } from '../../../../../src/core/server'; + +import type { IClusterClient, KibanaRequest } from 'src/core/server'; + import { GLOBAL_RESOURCE } from '../../common/constants'; import { ResourceSerializer } from './resource_serializer'; -import { - HasPrivilegesResponse, - HasPrivilegesResponseApplication, - CheckPrivilegesPayload, +import type { CheckPrivileges, + CheckPrivilegesPayload, CheckPrivilegesResponse, + HasPrivilegesResponse, + HasPrivilegesResponseApplication, } from './types'; import { validateEsPrivilegeResponse } from './validate_es_response'; diff --git a/x-pack/plugins/security/server/authorization/check_privileges_dynamically.test.ts b/x-pack/plugins/security/server/authorization/check_privileges_dynamically.test.ts index 10893313403f3..547782bbd1ba1 100644 --- a/x-pack/plugins/security/server/authorization/check_privileges_dynamically.test.ts +++ b/x-pack/plugins/security/server/authorization/check_privileges_dynamically.test.ts @@ -5,9 +5,9 @@ * 2.0. */ -import { checkPrivilegesDynamicallyWithRequestFactory } from './check_privileges_dynamically'; +import { httpServerMock } from 'src/core/server/mocks'; -import { httpServerMock } from '../../../../../src/core/server/mocks'; +import { checkPrivilegesDynamicallyWithRequestFactory } from './check_privileges_dynamically'; test(`checkPrivileges.atSpace when spaces is enabled`, async () => { const expectedResult = Symbol(); diff --git a/x-pack/plugins/security/server/authorization/check_privileges_dynamically.ts b/x-pack/plugins/security/server/authorization/check_privileges_dynamically.ts index d238f5f53895f..4ce59c8706270 100644 --- a/x-pack/plugins/security/server/authorization/check_privileges_dynamically.ts +++ b/x-pack/plugins/security/server/authorization/check_privileges_dynamically.ts @@ -5,10 +5,14 @@ * 2.0. */ -import { KibanaRequest } from '../../../../../src/core/server'; -import { SpacesService } from '../plugin'; -import { CheckPrivilegesResponse, CheckPrivilegesWithRequest } from './types'; -import { CheckPrivilegesPayload } from './types'; +import type { KibanaRequest } from 'src/core/server'; + +import type { SpacesService } from '../plugin'; +import type { + CheckPrivilegesPayload, + CheckPrivilegesResponse, + CheckPrivilegesWithRequest, +} from './types'; export type CheckPrivilegesDynamically = ( privileges: CheckPrivilegesPayload diff --git a/x-pack/plugins/security/server/authorization/check_saved_objects_privileges.test.ts b/x-pack/plugins/security/server/authorization/check_saved_objects_privileges.test.ts index bf09d390880cf..8436295b74989 100644 --- a/x-pack/plugins/security/server/authorization/check_saved_objects_privileges.test.ts +++ b/x-pack/plugins/security/server/authorization/check_saved_objects_privileges.test.ts @@ -5,11 +5,11 @@ * 2.0. */ -import { checkSavedObjectsPrivilegesWithRequestFactory } from './check_saved_objects_privileges'; +import { httpServerMock } from 'src/core/server/mocks'; -import { httpServerMock } from '../../../../../src/core/server/mocks'; -import { CheckPrivileges, CheckPrivilegesWithRequest } from './types'; -import { SpacesService } from '../plugin'; +import type { SpacesService } from '../plugin'; +import { checkSavedObjectsPrivilegesWithRequestFactory } from './check_saved_objects_privileges'; +import type { CheckPrivileges, CheckPrivilegesWithRequest } from './types'; let mockCheckPrivileges: jest.Mocked; let mockCheckPrivilegesWithRequest: jest.Mocked; diff --git a/x-pack/plugins/security/server/authorization/check_saved_objects_privileges.ts b/x-pack/plugins/security/server/authorization/check_saved_objects_privileges.ts index cf8447c145ad8..f640848c9b08e 100644 --- a/x-pack/plugins/security/server/authorization/check_saved_objects_privileges.ts +++ b/x-pack/plugins/security/server/authorization/check_saved_objects_privileges.ts @@ -5,10 +5,11 @@ * 2.0. */ -import { KibanaRequest } from '../../../../../src/core/server'; +import type { KibanaRequest } from 'src/core/server'; + import { ALL_SPACES_ID } from '../../common/constants'; -import { SpacesService } from '../plugin'; -import { CheckPrivilegesWithRequest, CheckPrivilegesResponse } from './types'; +import type { SpacesService } from '../plugin'; +import type { CheckPrivilegesResponse, CheckPrivilegesWithRequest } from './types'; export type CheckSavedObjectsPrivilegesWithRequest = ( request: KibanaRequest diff --git a/x-pack/plugins/security/server/authorization/disable_ui_capabilities.test.ts b/x-pack/plugins/security/server/authorization/disable_ui_capabilities.test.ts index e599d42861756..15fb7ab39a044 100644 --- a/x-pack/plugins/security/server/authorization/disable_ui_capabilities.test.ts +++ b/x-pack/plugins/security/server/authorization/disable_ui_capabilities.test.ts @@ -5,14 +5,14 @@ * 2.0. */ -import { Actions } from '.'; -import { disableUICapabilitiesFactory } from './disable_ui_capabilities'; +import { httpServerMock, loggingSystemMock } from 'src/core/server/mocks'; -import { httpServerMock, loggingSystemMock } from '../../../../../src/core/server/mocks'; +import { ElasticsearchFeature, KibanaFeature } from '../../../features/server'; +import type { AuthenticatedUser } from '../../common/model'; +import { Actions } from './actions'; +import { disableUICapabilitiesFactory } from './disable_ui_capabilities'; import { authorizationMock } from './index.mock'; -import { KibanaFeature, ElasticsearchFeature } from '../../../features/server'; -import { AuthenticatedUser } from '..'; -import { CheckPrivilegesResponse } from './types'; +import type { CheckPrivilegesResponse } from './types'; type MockAuthzOptions = | { rejectCheckPrivileges: any } diff --git a/x-pack/plugins/security/server/authorization/disable_ui_capabilities.ts b/x-pack/plugins/security/server/authorization/disable_ui_capabilities.ts index f59b2fcfde785..76f270f297820 100644 --- a/x-pack/plugins/security/server/authorization/disable_ui_capabilities.ts +++ b/x-pack/plugins/security/server/authorization/disable_ui_capabilities.ts @@ -6,18 +6,19 @@ */ import { flatten, isObject, mapValues } from 'lodash'; -import { RecursiveReadonly, RecursiveReadonlyArray } from '@kbn/utility-types'; -import type { Capabilities as UICapabilities } from '../../../../../src/core/types'; -import { KibanaRequest, Logger } from '../../../../../src/core/server'; -import { - KibanaFeature, + +import type { RecursiveReadonly, RecursiveReadonlyArray } from '@kbn/utility-types'; +import type { KibanaRequest, Logger } from 'src/core/server'; +import type { Capabilities as UICapabilities } from 'src/core/types'; + +import type { ElasticsearchFeature, FeatureElasticsearchPrivileges, + KibanaFeature, } from '../../../features/server'; - -import { CheckPrivilegesResponse } from './types'; -import { AuthorizationServiceSetup } from '.'; -import { AuthenticatedUser } from '..'; +import type { AuthenticatedUser } from '../../common/model'; +import type { AuthorizationServiceSetup } from './authorization_service'; +import type { CheckPrivilegesResponse } from './types'; export function disableUICapabilitiesFactory( request: KibanaRequest, diff --git a/x-pack/plugins/security/server/authorization/index.mock.ts b/x-pack/plugins/security/server/authorization/index.mock.ts index 53adb53ce3811..7416f2725938d 100644 --- a/x-pack/plugins/security/server/authorization/index.mock.ts +++ b/x-pack/plugins/security/server/authorization/index.mock.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { AuthorizationMode } from './mode'; import { actionsMock } from './actions/actions.mock'; +import type { AuthorizationMode } from './mode'; export const authorizationMock = { create: ({ diff --git a/x-pack/plugins/security/server/authorization/mode.test.ts b/x-pack/plugins/security/server/authorization/mode.test.ts index 6fe3b17e7f776..f0f01d500fede 100644 --- a/x-pack/plugins/security/server/authorization/mode.test.ts +++ b/x-pack/plugins/security/server/authorization/mode.test.ts @@ -5,12 +5,12 @@ * 2.0. */ -import { authorizationModeFactory } from './mode'; +import { httpServerMock } from 'src/core/server/mocks'; -import { httpServerMock } from '../../../../../src/core/server/mocks'; +import type { SecurityLicense } from '../../common/licensing'; import { licenseMock } from '../../common/licensing/index.mock'; -import { SecurityLicenseFeatures } from '../../common/licensing/license_features'; -import { SecurityLicense } from '../../common/licensing'; +import type { SecurityLicenseFeatures } from '../../common/licensing/license_features'; +import { authorizationModeFactory } from './mode'; describe(`#useRbacForRequest`, () => { let mockLicense: jest.Mocked; diff --git a/x-pack/plugins/security/server/authorization/mode.ts b/x-pack/plugins/security/server/authorization/mode.ts index 81122aabc8992..c2f6fcb0ac5cd 100644 --- a/x-pack/plugins/security/server/authorization/mode.ts +++ b/x-pack/plugins/security/server/authorization/mode.ts @@ -5,8 +5,9 @@ * 2.0. */ -import { KibanaRequest } from '../../../../../src/core/server'; -import { SecurityLicense } from '../../common/licensing'; +import type { KibanaRequest } from 'src/core/server'; + +import type { SecurityLicense } from '../../common/licensing'; export interface AuthorizationMode { useRbacForRequest(request: KibanaRequest): boolean; diff --git a/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/alerting.test.ts b/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/alerting.test.ts index f5d07525b8669..34bfb113ab0ea 100644 --- a/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/alerting.test.ts +++ b/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/alerting.test.ts @@ -5,9 +5,10 @@ * 2.0. */ +import type { FeatureKibanaPrivileges } from '../../../../../features/server'; +import { KibanaFeature } from '../../../../../features/server'; import { Actions } from '../../actions'; import { FeaturePrivilegeAlertingBuilder } from './alerting'; -import { KibanaFeature, FeatureKibanaPrivileges } from '../../../../../features/server'; const version = '1.0.0-zeta1'; diff --git a/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/alerting.ts b/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/alerting.ts index 2c31ec3f2255b..c813f0f935cf5 100644 --- a/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/alerting.ts +++ b/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/alerting.ts @@ -6,7 +6,8 @@ */ import { uniq } from 'lodash'; -import { KibanaFeature, FeatureKibanaPrivileges } from '../../../../../features/server'; + +import type { FeatureKibanaPrivileges, KibanaFeature } from '../../../../../features/server'; import { BaseFeaturePrivilegeBuilder } from './feature_privilege_builder'; const readOperations: string[] = ['get', 'getAlertState', 'getAlertInstanceSummary', 'find']; diff --git a/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/api.ts b/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/api.ts index 1e6eb65a9d9f3..5fe6b55f1c709 100644 --- a/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/api.ts +++ b/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/api.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { FeatureKibanaPrivileges } from '../../../../../features/server'; +import type { FeatureKibanaPrivileges } from '../../../../../features/server'; import { BaseFeaturePrivilegeBuilder } from './feature_privilege_builder'; export class FeaturePrivilegeApiBuilder extends BaseFeaturePrivilegeBuilder { diff --git a/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/app.ts b/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/app.ts index cfe8ffe8c84ad..f88d315fa1ef1 100644 --- a/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/app.ts +++ b/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/app.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { FeatureKibanaPrivileges } from '../../../../../features/server'; +import type { FeatureKibanaPrivileges } from '../../../../../features/server'; import { BaseFeaturePrivilegeBuilder } from './feature_privilege_builder'; export class FeaturePrivilegeAppBuilder extends BaseFeaturePrivilegeBuilder { diff --git a/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/catalogue.ts b/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/catalogue.ts index 14c5c70324295..0cfc31975cc2f 100644 --- a/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/catalogue.ts +++ b/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/catalogue.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { FeatureKibanaPrivileges } from '../../../../../features/server'; +import type { FeatureKibanaPrivileges } from '../../../../../features/server'; import { BaseFeaturePrivilegeBuilder } from './feature_privilege_builder'; export class FeaturePrivilegeCatalogueBuilder extends BaseFeaturePrivilegeBuilder { diff --git a/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/feature_privilege_builder.ts b/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/feature_privilege_builder.ts index 15e8536d15713..b62e5094ba09b 100644 --- a/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/feature_privilege_builder.ts +++ b/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/feature_privilege_builder.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { KibanaFeature, FeatureKibanaPrivileges } from '../../../../../features/server'; -import { Actions } from '../../actions'; +import type { FeatureKibanaPrivileges, KibanaFeature } from '../../../../../features/server'; +import type { Actions } from '../../actions'; export interface FeaturePrivilegeBuilder { getActions(privilegeDefinition: FeatureKibanaPrivileges, feature: KibanaFeature): string[]; diff --git a/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/index.ts b/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/index.ts index c63098c1d351f..21cf2421ce1b2 100644 --- a/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/index.ts +++ b/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/index.ts @@ -6,8 +6,10 @@ */ import { flatten } from 'lodash'; -import { KibanaFeature, FeatureKibanaPrivileges } from '../../../../../features/server'; -import { Actions } from '../../actions'; + +import type { FeatureKibanaPrivileges, KibanaFeature } from '../../../../../features/server'; +import type { Actions } from '../../actions'; +import { FeaturePrivilegeAlertingBuilder } from './alerting'; import { FeaturePrivilegeApiBuilder } from './api'; import { FeaturePrivilegeAppBuilder } from './app'; import { FeaturePrivilegeCatalogueBuilder } from './catalogue'; @@ -15,8 +17,8 @@ import { FeaturePrivilegeBuilder } from './feature_privilege_builder'; import { FeaturePrivilegeManagementBuilder } from './management'; import { FeaturePrivilegeNavlinkBuilder } from './navlink'; import { FeaturePrivilegeSavedObjectBuilder } from './saved_object'; -import { FeaturePrivilegeAlertingBuilder } from './alerting'; import { FeaturePrivilegeUIBuilder } from './ui'; + export { FeaturePrivilegeBuilder }; export const featurePrivilegeBuilderFactory = (actions: Actions): FeaturePrivilegeBuilder => { diff --git a/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/management.ts b/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/management.ts index 7d1fdc926ea8b..dd6a916618492 100644 --- a/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/management.ts +++ b/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/management.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { FeatureKibanaPrivileges } from '../../../../../features/server'; +import type { FeatureKibanaPrivileges } from '../../../../../features/server'; import { BaseFeaturePrivilegeBuilder } from './feature_privilege_builder'; export class FeaturePrivilegeManagementBuilder extends BaseFeaturePrivilegeBuilder { diff --git a/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/navlink.ts b/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/navlink.ts index 7d185d040e4c9..b1d9c06b4cef9 100644 --- a/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/navlink.ts +++ b/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/navlink.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { FeatureKibanaPrivileges } from '../../../../../features/server'; +import type { FeatureKibanaPrivileges } from '../../../../../features/server'; import { BaseFeaturePrivilegeBuilder } from './feature_privilege_builder'; export class FeaturePrivilegeNavlinkBuilder extends BaseFeaturePrivilegeBuilder { diff --git a/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/saved_object.ts b/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/saved_object.ts index 3a0d9f4a5a100..ea373b72aec24 100644 --- a/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/saved_object.ts +++ b/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/saved_object.ts @@ -6,7 +6,8 @@ */ import { flatten, uniq } from 'lodash'; -import { FeatureKibanaPrivileges } from '../../../../../features/server'; + +import type { FeatureKibanaPrivileges } from '../../../../../features/server'; import { BaseFeaturePrivilegeBuilder } from './feature_privilege_builder'; const readOperations: string[] = [ diff --git a/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/ui.ts b/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/ui.ts index 76a4fc8ef778c..e1d76d3d92022 100644 --- a/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/ui.ts +++ b/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/ui.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { KibanaFeature, FeatureKibanaPrivileges } from '../../../../../features/server'; +import type { FeatureKibanaPrivileges, KibanaFeature } from '../../../../../features/server'; import { BaseFeaturePrivilegeBuilder } from './feature_privilege_builder'; export class FeaturePrivilegeUIBuilder extends BaseFeaturePrivilegeBuilder { diff --git a/x-pack/plugins/security/server/authorization/privileges/feature_privilege_iterator/feature_privilege_iterator.ts b/x-pack/plugins/security/server/authorization/privileges/feature_privilege_iterator/feature_privilege_iterator.ts index d7f46840fa123..de2f44a446a19 100644 --- a/x-pack/plugins/security/server/authorization/privileges/feature_privilege_iterator/feature_privilege_iterator.ts +++ b/x-pack/plugins/security/server/authorization/privileges/feature_privilege_iterator/feature_privilege_iterator.ts @@ -6,8 +6,9 @@ */ import _ from 'lodash'; -import { LicenseType } from '../../../../../licensing/server'; -import { KibanaFeature, FeatureKibanaPrivileges } from '../../../../../features/server'; + +import type { FeatureKibanaPrivileges, KibanaFeature } from '../../../../../features/server'; +import type { LicenseType } from '../../../../../licensing/server'; import { subFeaturePrivilegeIterator } from './sub_feature_privilege_iterator'; interface IteratorOptions { diff --git a/x-pack/plugins/security/server/authorization/privileges/feature_privilege_iterator/sub_feature_privilege_iterator.ts b/x-pack/plugins/security/server/authorization/privileges/feature_privilege_iterator/sub_feature_privilege_iterator.ts index 481c3448b1029..4e71fb363b080 100644 --- a/x-pack/plugins/security/server/authorization/privileges/feature_privilege_iterator/sub_feature_privilege_iterator.ts +++ b/x-pack/plugins/security/server/authorization/privileges/feature_privilege_iterator/sub_feature_privilege_iterator.ts @@ -5,9 +5,8 @@ * 2.0. */ -import { LicenseType } from '../../../../../licensing/server'; - -import { KibanaFeature, SubFeaturePrivilegeConfig } from '../../../../../features/common'; +import type { KibanaFeature, SubFeaturePrivilegeConfig } from '../../../../../features/common'; +import type { LicenseType } from '../../../../../licensing/server'; export function* subFeaturePrivilegeIterator( feature: KibanaFeature, diff --git a/x-pack/plugins/security/server/authorization/privileges/privileges.test.ts b/x-pack/plugins/security/server/authorization/privileges/privileges.test.ts index da2639aba1c6b..4da0020e94b15 100644 --- a/x-pack/plugins/security/server/authorization/privileges/privileges.test.ts +++ b/x-pack/plugins/security/server/authorization/privileges/privileges.test.ts @@ -6,11 +6,10 @@ */ import { KibanaFeature } from '../../../../features/server'; +import { featuresPluginMock } from '../../../../features/server/mocks'; import { Actions } from '../actions'; import { privilegesFactory } from './privileges'; -import { featuresPluginMock } from '../../../../features/server/mocks'; - const actions = new Actions('1.0.0-zeta1'); describe('features', () => { diff --git a/x-pack/plugins/security/server/authorization/privileges/privileges.ts b/x-pack/plugins/security/server/authorization/privileges/privileges.ts index 49b566700f392..de0db392bdc86 100644 --- a/x-pack/plugins/security/server/authorization/privileges/privileges.ts +++ b/x-pack/plugins/security/server/authorization/privileges/privileges.ts @@ -6,13 +6,14 @@ */ import { uniq } from 'lodash'; -import { SecurityLicense } from '../../../common/licensing'; -import { + +import type { KibanaFeature, PluginSetupContract as FeaturesPluginSetup, } from '../../../../features/server'; -import { RawKibanaPrivileges } from '../../../common/model'; -import { Actions } from '../actions'; +import type { SecurityLicense } from '../../../common/licensing'; +import type { RawKibanaPrivileges } from '../../../common/model'; +import type { Actions } from '../actions'; import { featurePrivilegeBuilderFactory } from './feature_privilege_builder'; import { featurePrivilegeIterator, diff --git a/x-pack/plugins/security/server/authorization/privileges_serializer.ts b/x-pack/plugins/security/server/authorization/privileges_serializer.ts index 810065eb977bb..58b5ee50dc8f1 100644 --- a/x-pack/plugins/security/server/authorization/privileges_serializer.ts +++ b/x-pack/plugins/security/server/authorization/privileges_serializer.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { RawKibanaPrivileges } from '../../common/model'; +import type { RawKibanaPrivileges } from '../../common/model'; import { PrivilegeSerializer } from './privilege_serializer'; interface SerializedPrivilege { diff --git a/x-pack/plugins/security/server/authorization/register_privileges_with_cluster.test.ts b/x-pack/plugins/security/server/authorization/register_privileges_with_cluster.test.ts index e6ed329440e59..ee5d3373ffcdb 100644 --- a/x-pack/plugins/security/server/authorization/register_privileges_with_cluster.test.ts +++ b/x-pack/plugins/security/server/authorization/register_privileges_with_cluster.test.ts @@ -7,11 +7,11 @@ /* eslint-disable @typescript-eslint/naming-convention */ -import { Logger } from 'kibana/server'; -import { RawKibanaPrivileges } from '../../common/model'; -import { registerPrivilegesWithCluster } from './register_privileges_with_cluster'; +import type { Logger } from 'src/core/server'; +import { elasticsearchServiceMock, loggingSystemMock } from 'src/core/server/mocks'; -import { elasticsearchServiceMock, loggingSystemMock } from '../../../../../src/core/server/mocks'; +import type { RawKibanaPrivileges } from '../../common/model'; +import { registerPrivilegesWithCluster } from './register_privileges_with_cluster'; const application = 'default-application'; const registerPrivilegesWithClusterTest = ( diff --git a/x-pack/plugins/security/server/authorization/register_privileges_with_cluster.ts b/x-pack/plugins/security/server/authorization/register_privileges_with_cluster.ts index 15e62c317cb18..f32835e7727fc 100644 --- a/x-pack/plugins/security/server/authorization/register_privileges_with_cluster.ts +++ b/x-pack/plugins/security/server/authorization/register_privileges_with_cluster.ts @@ -5,11 +5,12 @@ * 2.0. */ -import { isEqual, isEqualWith, difference } from 'lodash'; -import { IClusterClient, Logger } from '../../../../../src/core/server'; +import { difference, isEqual, isEqualWith } from 'lodash'; +import type { IClusterClient, Logger } from 'src/core/server'; + +import type { PrivilegesService } from './privileges'; import { serializePrivileges } from './privileges_serializer'; -import { PrivilegesService } from './privileges'; export async function registerPrivilegesWithCluster( logger: Logger, diff --git a/x-pack/plugins/security/server/authorization/reset_session_page.test.tsx b/x-pack/plugins/security/server/authorization/reset_session_page.test.tsx index 8110000622452..e76c8ff138fcb 100644 --- a/x-pack/plugins/security/server/authorization/reset_session_page.test.tsx +++ b/x-pack/plugins/security/server/authorization/reset_session_page.test.tsx @@ -7,9 +7,10 @@ import React from 'react'; import { renderToStaticMarkup } from 'react-dom/server'; + import { ResetSessionPage } from './reset_session_page'; -jest.mock('../../../../../src/core/server/rendering/views/fonts', () => ({ +jest.mock('src/core/server/rendering/views/fonts', () => ({ Fonts: () => <>MockedFonts, })); diff --git a/x-pack/plugins/security/server/authorization/reset_session_page.tsx b/x-pack/plugins/security/server/authorization/reset_session_page.tsx index 30f4bf3854fd8..c2d43cd3dd030 100644 --- a/x-pack/plugins/security/server/authorization/reset_session_page.tsx +++ b/x-pack/plugins/security/server/authorization/reset_session_page.tsx @@ -5,20 +5,20 @@ * 2.0. */ -import React from 'react'; // @ts-expect-error no definitions in component folder import { EuiButton, EuiButtonEmpty } from '@elastic/eui/lib/components/button'; // @ts-expect-error no definitions in component folder -import { EuiPage, EuiPageBody, EuiPageContent } from '@elastic/eui/lib/components/page'; -// @ts-expect-error no definitions in component folder import { EuiEmptyPrompt } from '@elastic/eui/lib/components/empty_prompt'; // @ts-expect-error no definitions in component folder +import { icon as EuiIconAlert } from '@elastic/eui/lib/components/icon/assets/alert'; +// @ts-expect-error no definitions in component folder import { appendIconComponentCache } from '@elastic/eui/lib/components/icon/icon'; // @ts-expect-error no definitions in component folder -import { icon as EuiIconAlert } from '@elastic/eui/lib/components/icon/assets/alert'; +import { EuiPage, EuiPageBody, EuiPageContent } from '@elastic/eui/lib/components/page'; +import React from 'react'; -import { FormattedMessage, I18nProvider } from '@kbn/i18n/react'; import { i18n } from '@kbn/i18n'; +import { FormattedMessage, I18nProvider } from '@kbn/i18n/react'; // eslint-disable-next-line @kbn/eslint/no-restricted-paths import { Fonts } from '../../../../../src/core/server/rendering/views/fonts'; diff --git a/x-pack/plugins/security/server/authorization/types.ts b/x-pack/plugins/security/server/authorization/types.ts index 1e682b9c1b3b0..8bfe892840637 100644 --- a/x-pack/plugins/security/server/authorization/types.ts +++ b/x-pack/plugins/security/server/authorization/types.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { KibanaRequest } from 'src/core/server'; +import type { KibanaRequest } from 'src/core/server'; export interface HasPrivilegesResponseApplication { [resource: string]: { diff --git a/x-pack/plugins/security/server/authorization/validate_es_response.ts b/x-pack/plugins/security/server/authorization/validate_es_response.ts index 270ff26716e3f..d941b2d777c4f 100644 --- a/x-pack/plugins/security/server/authorization/validate_es_response.ts +++ b/x-pack/plugins/security/server/authorization/validate_es_response.ts @@ -6,7 +6,8 @@ */ import { schema } from '@kbn/config-schema'; -import { HasPrivilegesResponse } from './types'; + +import type { HasPrivilegesResponse } from './types'; /** * Validates an Elasticsearch "Has privileges" response against the expected application, actions, and resources. diff --git a/x-pack/plugins/security/server/authorization/validate_feature_privileges.ts b/x-pack/plugins/security/server/authorization/validate_feature_privileges.ts index 8df9c73a29d82..8bb53b076d46c 100644 --- a/x-pack/plugins/security/server/authorization/validate_feature_privileges.ts +++ b/x-pack/plugins/security/server/authorization/validate_feature_privileges.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { KibanaFeature } from '../../../features/server'; +import type { KibanaFeature } from '../../../features/server'; export function validateFeaturePrivileges(features: KibanaFeature[]) { for (const feature of features) { diff --git a/x-pack/plugins/security/server/authorization/validate_reserved_privileges.ts b/x-pack/plugins/security/server/authorization/validate_reserved_privileges.ts index 80adce08d6f22..7dd6ec21bdf30 100644 --- a/x-pack/plugins/security/server/authorization/validate_reserved_privileges.ts +++ b/x-pack/plugins/security/server/authorization/validate_reserved_privileges.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { KibanaFeature } from '../../../features/server'; +import type { KibanaFeature } from '../../../features/server'; export function validateReservedPrivileges(features: KibanaFeature[]) { const seenPrivilegeIds = new Set(); diff --git a/x-pack/plugins/security/server/config.test.ts b/x-pack/plugins/security/server/config.test.ts index 0e58f2e07f776..5930d29af7559 100644 --- a/x-pack/plugins/security/server/config.test.ts +++ b/x-pack/plugins/security/server/config.test.ts @@ -10,8 +10,9 @@ jest.mock('crypto', () => ({ constants: jest.requireActual('crypto').constants, })); -import { loggingSystemMock } from '../../../../src/core/server/mocks'; -import { createConfig, ConfigSchema } from './config'; +import { loggingSystemMock } from 'src/core/server/mocks'; + +import { ConfigSchema, createConfig } from './config'; describe('config schema', () => { it('generates proper defaults', () => { diff --git a/x-pack/plugins/security/server/config.ts b/x-pack/plugins/security/server/config.ts index 997c06d20bc7e..d5234a0935ca2 100644 --- a/x-pack/plugins/security/server/config.ts +++ b/x-pack/plugins/security/server/config.ts @@ -7,9 +7,13 @@ import crypto from 'crypto'; import type { Duration } from 'moment'; -import { schema, Type, TypeOf } from '@kbn/config-schema'; + +import type { Type, TypeOf } from '@kbn/config-schema'; +import { schema } from '@kbn/config-schema'; import { i18n } from '@kbn/i18n'; -import { Logger, config as coreConfig } from '../../../../src/core/server'; +import type { Logger } from 'src/core/server'; + +import { config as coreConfig } from '../../../../src/core/server'; import type { AuthenticationProvider } from '../common/model'; export type ConfigType = ReturnType; diff --git a/x-pack/plugins/security/server/config_deprecations.test.ts b/x-pack/plugins/security/server/config_deprecations.test.ts index c4c7f399e7b5d..2b6ad603e6163 100644 --- a/x-pack/plugins/security/server/config_deprecations.test.ts +++ b/x-pack/plugins/security/server/config_deprecations.test.ts @@ -5,10 +5,12 @@ * 2.0. */ -import { configDeprecationFactory, applyDeprecations } from '@kbn/config'; -import { securityConfigDeprecationProvider } from './config_deprecations'; import { cloneDeep } from 'lodash'; +import { applyDeprecations, configDeprecationFactory } from '@kbn/config'; + +import { securityConfigDeprecationProvider } from './config_deprecations'; + const applyConfigDeprecations = (settings: Record = {}) => { const deprecations = securityConfigDeprecationProvider(configDeprecationFactory); const deprecationMessages: string[] = []; diff --git a/x-pack/plugins/security/server/elasticsearch/elasticsearch_service.test.ts b/x-pack/plugins/security/server/elasticsearch/elasticsearch_service.test.ts index 1aed68220c839..15af59fdae7d1 100644 --- a/x-pack/plugins/security/server/elasticsearch/elasticsearch_service.test.ts +++ b/x-pack/plugins/security/server/elasticsearch/elasticsearch_service.test.ts @@ -6,13 +6,15 @@ */ import { BehaviorSubject } from 'rxjs'; -import { ServiceStatusLevels, CoreStatus } from '../../../../../src/core/server'; -import { SecurityLicense, SecurityLicenseFeatures } from '../../common/licensing'; -import { ElasticsearchService } from './elasticsearch_service'; -import { coreMock, loggingSystemMock } from '../../../../../src/core/server/mocks'; -import { licenseMock } from '../../common/licensing/index.mock'; import { nextTick } from '@kbn/test/jest'; +import type { CoreStatus } from 'src/core/server'; +import { ServiceStatusLevels } from 'src/core/server'; +import { coreMock, loggingSystemMock } from 'src/core/server/mocks'; + +import type { SecurityLicense, SecurityLicenseFeatures } from '../../common/licensing'; +import { licenseMock } from '../../common/licensing/index.mock'; +import { ElasticsearchService } from './elasticsearch_service'; describe('ElasticsearchService', () => { let service: ElasticsearchService; diff --git a/x-pack/plugins/security/server/elasticsearch/elasticsearch_service.ts b/x-pack/plugins/security/server/elasticsearch/elasticsearch_service.ts index 00fe140707ad5..873ed32d4b8a2 100644 --- a/x-pack/plugins/security/server/elasticsearch/elasticsearch_service.ts +++ b/x-pack/plugins/security/server/elasticsearch/elasticsearch_service.ts @@ -5,10 +5,14 @@ * 2.0. */ -import { BehaviorSubject, combineLatest, Observable } from 'rxjs'; +import type { Observable } from 'rxjs'; +import { BehaviorSubject, combineLatest } from 'rxjs'; import { distinctUntilChanged, filter, map, shareReplay, tap } from 'rxjs/operators'; -import { Logger, ServiceStatusLevels, StatusServiceSetup } from '../../../../../src/core/server'; -import { SecurityLicense } from '../../common/licensing'; + +import type { Logger, StatusServiceSetup } from 'src/core/server'; + +import { ServiceStatusLevels } from '../../../../../src/core/server'; +import type { SecurityLicense } from '../../common/licensing'; export interface ElasticsearchServiceSetupParams { readonly status: StatusServiceSetup; diff --git a/x-pack/plugins/security/server/errors.test.ts b/x-pack/plugins/security/server/errors.test.ts index 6070f8a779d85..9aa8635793281 100644 --- a/x-pack/plugins/security/server/errors.test.ts +++ b/x-pack/plugins/security/server/errors.test.ts @@ -5,9 +5,10 @@ * 2.0. */ -import Boom from '@hapi/boom'; import { errors as esErrors } from '@elastic/elasticsearch'; +import Boom from '@hapi/boom'; import { errors as legacyESErrors } from 'elasticsearch'; + import * as errors from './errors'; import { securityMock } from './mocks'; diff --git a/x-pack/plugins/security/server/errors.ts b/x-pack/plugins/security/server/errors.ts index b02945c5b3647..25d2aa44f3dc8 100644 --- a/x-pack/plugins/security/server/errors.ts +++ b/x-pack/plugins/security/server/errors.ts @@ -5,9 +5,10 @@ * 2.0. */ -import Boom from '@hapi/boom'; import { errors } from '@elastic/elasticsearch'; -import type { CustomHttpResponseOptions, ResponseError } from '../../../../src/core/server'; +import Boom from '@hapi/boom'; + +import type { CustomHttpResponseOptions, ResponseError } from 'src/core/server'; export function wrapError(error: any) { return Boom.boomify(error, { statusCode: getErrorStatusCode(error) }); diff --git a/x-pack/plugins/security/server/feature_usage/feature_usage_service.ts b/x-pack/plugins/security/server/feature_usage/feature_usage_service.ts index 9b82eaf200fcb..d8385867e93d6 100644 --- a/x-pack/plugins/security/server/feature_usage/feature_usage_service.ts +++ b/x-pack/plugins/security/server/feature_usage/feature_usage_service.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { FeatureUsageServiceSetup, FeatureUsageServiceStart } from '../../../licensing/server'; +import type { FeatureUsageServiceSetup, FeatureUsageServiceStart } from '../../../licensing/server'; interface SetupDeps { featureUsage: FeatureUsageServiceSetup; diff --git a/x-pack/plugins/security/server/feature_usage/index.mock.ts b/x-pack/plugins/security/server/feature_usage/index.mock.ts index 2c1a45e9f12f0..34cd61a761106 100644 --- a/x-pack/plugins/security/server/feature_usage/index.mock.ts +++ b/x-pack/plugins/security/server/feature_usage/index.mock.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { SecurityFeatureUsageServiceStart } from './feature_usage_service'; +import type { SecurityFeatureUsageServiceStart } from './feature_usage_service'; export const securityFeatureUsageServiceMock = { createStartContract() { diff --git a/x-pack/plugins/security/server/features/security_features.ts b/x-pack/plugins/security/server/features/security_features.ts index 7b40849aaeaaa..4477ca2409faa 100644 --- a/x-pack/plugins/security/server/features/security_features.ts +++ b/x-pack/plugins/security/server/features/security_features.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { ElasticsearchFeatureConfig } from '../../../features/server'; +import type { ElasticsearchFeatureConfig } from '../../../features/server'; const userManagementFeature: ElasticsearchFeatureConfig = { id: 'users', diff --git a/x-pack/plugins/security/server/index.ts b/x-pack/plugins/security/server/index.ts index 66b916ac7f70f..7120f480bbc42 100644 --- a/x-pack/plugins/security/server/index.ts +++ b/x-pack/plugins/security/server/index.ts @@ -11,15 +11,12 @@ import type { PluginConfigDescriptor, PluginInitializer, PluginInitializerContext, -} from '../../../../src/core/server'; +} from 'src/core/server'; + import { ConfigSchema } from './config'; import { securityConfigDeprecationProvider } from './config_deprecations'; -import { - SecurityPlugin, - SecurityPluginSetup, - SecurityPluginStart, - PluginSetupDependencies, -} from './plugin'; +import type { PluginSetupDependencies, SecurityPluginSetup, SecurityPluginStart } from './plugin'; +import { SecurityPlugin } from './plugin'; // These exports are part of public Security plugin contract, any change in signature of exported // functions or removal of exports should be considered as a breaking change. diff --git a/x-pack/plugins/security/server/mocks.ts b/x-pack/plugins/security/server/mocks.ts index c8d6c56a874ff..07f60ceb890f1 100644 --- a/x-pack/plugins/security/server/mocks.ts +++ b/x-pack/plugins/security/server/mocks.ts @@ -6,10 +6,11 @@ */ import type { ApiResponse } from '@elastic/elasticsearch'; -import { authenticationServiceMock } from './authentication/authentication_service.mock'; -import { authorizationMock } from './authorization/index.mock'; + import { licenseMock } from '../common/licensing/index.mock'; import { auditServiceMock } from './audit/index.mock'; +import { authenticationServiceMock } from './authentication/authentication_service.mock'; +import { authorizationMock } from './authorization/index.mock'; function createSetupMock() { const mockAuthz = authorizationMock.create(); diff --git a/x-pack/plugins/security/server/plugin.test.ts b/x-pack/plugins/security/server/plugin.test.ts index d57951ecb5b1d..0fa6c553c2e80 100644 --- a/x-pack/plugins/security/server/plugin.test.ts +++ b/x-pack/plugins/security/server/plugin.test.ts @@ -6,14 +6,16 @@ */ import { of } from 'rxjs'; + import { ByteSizeValue } from '@kbn/config-schema'; -import { ConfigSchema } from './config'; -import { SecurityPlugin, PluginSetupDependencies, PluginStartDependencies } from './plugin'; +import { coreMock } from 'src/core/server/mocks'; -import { coreMock } from '../../../../src/core/server/mocks'; import { featuresPluginMock } from '../../features/server/mocks'; -import { taskManagerMock } from '../../task_manager/server/mocks'; import { licensingMock } from '../../licensing/server/mocks'; +import { taskManagerMock } from '../../task_manager/server/mocks'; +import { ConfigSchema } from './config'; +import type { PluginSetupDependencies, PluginStartDependencies } from './plugin'; +import { SecurityPlugin } from './plugin'; describe('Security Plugin', () => { let plugin: SecurityPlugin; diff --git a/x-pack/plugins/security/server/plugin.ts b/x-pack/plugins/security/server/plugin.ts index cccfa7de6d177..586707dd8c9aa 100644 --- a/x-pack/plugins/security/server/plugin.ts +++ b/x-pack/plugins/security/server/plugin.ts @@ -5,44 +5,53 @@ * 2.0. */ -import { combineLatest, Subscription } from 'rxjs'; +import type { Subscription } from 'rxjs'; +import { combineLatest } from 'rxjs'; import { map } from 'rxjs/operators'; -import { TypeOf } from '@kbn/config-schema'; -import { RecursiveReadonly } from '@kbn/utility-types'; -import { UsageCollectionSetup } from 'src/plugins/usage_collection/server'; -import { SecurityOssPluginSetup } from 'src/plugins/security_oss/server'; -import { + +import type { TypeOf } from '@kbn/config-schema'; +import type { RecursiveReadonly } from '@kbn/utility-types'; +import type { CoreSetup, CoreStart, KibanaRequest, Logger, - PluginInitializerContext, Plugin, -} from '../../../../src/core/server'; -import { SpacesPluginSetup, SpacesPluginStart } from '../../spaces/server'; -import { PluginSetupContract as FeaturesSetupContract } from '../../features/server'; -import { + PluginInitializerContext, +} from 'src/core/server'; +import type { SecurityOssPluginSetup } from 'src/plugins/security_oss/server'; +import type { UsageCollectionSetup } from 'src/plugins/usage_collection/server'; + +import type { PluginSetupContract as FeaturesPluginSetup, PluginStartContract as FeaturesPluginStart, } from '../../features/server'; -import { LicensingPluginSetup, LicensingPluginStart } from '../../licensing/server'; -import { TaskManagerSetupContract, TaskManagerStartContract } from '../../task_manager/server'; - -import { AuthenticationService, AuthenticationServiceStart } from './authentication'; -import { AuthorizationService, AuthorizationServiceSetup } from './authorization'; -import { AnonymousAccessService, AnonymousAccessServiceStart } from './anonymous_access'; -import { ConfigSchema, ConfigType, createConfig } from './config'; +import type { LicensingPluginSetup, LicensingPluginStart } from '../../licensing/server'; +import type { SpacesPluginSetup, SpacesPluginStart } from '../../spaces/server'; +import type { TaskManagerSetupContract, TaskManagerStartContract } from '../../task_manager/server'; +import type { SecurityLicense } from '../common/licensing'; +import { SecurityLicenseService } from '../common/licensing'; +import type { AuthenticatedUser } from '../common/model'; +import type { AnonymousAccessServiceStart } from './anonymous_access'; +import { AnonymousAccessService } from './anonymous_access'; +import type { AuditServiceSetup } from './audit'; +import { AuditService, SecurityAuditLogger } from './audit'; +import type { AuthenticationServiceStart } from './authentication'; +import { AuthenticationService } from './authentication'; +import type { AuthorizationServiceSetup } from './authorization'; +import { AuthorizationService } from './authorization'; +import type { ConfigSchema, ConfigType } from './config'; +import { createConfig } from './config'; +import { ElasticsearchService } from './elasticsearch'; +import type { SecurityFeatureUsageServiceStart } from './feature_usage'; +import { SecurityFeatureUsageService } from './feature_usage'; +import { securityFeatures } from './features'; import { defineRoutes } from './routes'; -import { SecurityLicenseService, SecurityLicense } from '../common/licensing'; -import { AuthenticatedUser } from '../common/model'; import { setupSavedObjects } from './saved_objects'; -import { AuditService, SecurityAuditLogger, AuditServiceSetup } from './audit'; -import { SecurityFeatureUsageService, SecurityFeatureUsageServiceStart } from './feature_usage'; -import { securityFeatures } from './features'; -import { ElasticsearchService } from './elasticsearch'; -import { Session, SessionManagementService } from './session_management'; -import { registerSecurityUsageCollector } from './usage_collector'; +import type { Session } from './session_management'; +import { SessionManagementService } from './session_management'; import { setupSpacesClient } from './spaces'; +import { registerSecurityUsageCollector } from './usage_collector'; export type SpacesService = Pick< SpacesPluginSetup['spacesService'], @@ -50,7 +59,7 @@ export type SpacesService = Pick< >; export type FeaturesService = Pick< - FeaturesSetupContract, + FeaturesPluginSetup, 'getKibanaFeatures' | 'getElasticsearchFeatures' >; diff --git a/x-pack/plugins/security/server/routes/api_keys/enabled.test.ts b/x-pack/plugins/security/server/routes/api_keys/enabled.test.ts index cbd5e0ecc7f16..da097faf8c6b2 100644 --- a/x-pack/plugins/security/server/routes/api_keys/enabled.test.ts +++ b/x-pack/plugins/security/server/routes/api_keys/enabled.test.ts @@ -6,16 +6,17 @@ */ import Boom from '@hapi/boom'; -import type { DeeplyMockedKeys } from '@kbn/utility-types/jest'; -import { kibanaResponseFactory, RequestHandler } from '../../../../../../src/core/server'; -import { httpServerMock } from '../../../../../../src/core/server/mocks'; -import { routeDefinitionParamsMock } from '../index.mock'; +import type { DeeplyMockedKeys } from '@kbn/utility-types/jest'; +import type { RequestHandler } from 'src/core/server'; +import { kibanaResponseFactory } from 'src/core/server'; +import { httpServerMock } from 'src/core/server/mocks'; import type { AuthenticationServiceStart } from '../../authentication'; -import { defineEnabledApiKeysRoutes } from './enabled'; import { authenticationServiceMock } from '../../authentication/authentication_service.mock'; import type { SecurityRequestHandlerContext } from '../../types'; +import { routeDefinitionParamsMock } from '../index.mock'; +import { defineEnabledApiKeysRoutes } from './enabled'; describe('API keys enabled', () => { function getMockContext( diff --git a/x-pack/plugins/security/server/routes/api_keys/enabled.ts b/x-pack/plugins/security/server/routes/api_keys/enabled.ts index 4de4aaea696b7..e788f3e6ff950 100644 --- a/x-pack/plugins/security/server/routes/api_keys/enabled.ts +++ b/x-pack/plugins/security/server/routes/api_keys/enabled.ts @@ -5,9 +5,9 @@ * 2.0. */ +import type { RouteDefinitionParams } from '../'; import { wrapIntoCustomErrorResponse } from '../../errors'; import { createLicensedRouteHandler } from '../licensed_route_handler'; -import { RouteDefinitionParams } from '..'; export function defineEnabledApiKeysRoutes({ router, diff --git a/x-pack/plugins/security/server/routes/api_keys/get.test.ts b/x-pack/plugins/security/server/routes/api_keys/get.test.ts index ceef745f62904..e3a13eb6d1bda 100644 --- a/x-pack/plugins/security/server/routes/api_keys/get.test.ts +++ b/x-pack/plugins/security/server/routes/api_keys/get.test.ts @@ -5,13 +5,14 @@ * 2.0. */ -import { kibanaResponseFactory } from '../../../../../../src/core/server'; -import { LicenseCheck } from '../../../../licensing/server'; -import { defineGetApiKeysRoutes } from './get'; +import Boom from '@hapi/boom'; + +import { kibanaResponseFactory } from 'src/core/server'; +import { coreMock, httpServerMock } from 'src/core/server/mocks'; -import { httpServerMock, coreMock } from '../../../../../../src/core/server/mocks'; +import type { LicenseCheck } from '../../../../licensing/server'; import { routeDefinitionParamsMock } from '../index.mock'; -import Boom from '@hapi/boom'; +import { defineGetApiKeysRoutes } from './get'; interface TestOptions { isAdmin?: boolean; diff --git a/x-pack/plugins/security/server/routes/api_keys/get.ts b/x-pack/plugins/security/server/routes/api_keys/get.ts index aebafa4c44bc3..7862401e1b80c 100644 --- a/x-pack/plugins/security/server/routes/api_keys/get.ts +++ b/x-pack/plugins/security/server/routes/api_keys/get.ts @@ -6,10 +6,11 @@ */ import { schema } from '@kbn/config-schema'; -import { ApiKey } from '../../../common/model'; + +import type { RouteDefinitionParams } from '../'; +import type { ApiKey } from '../../../common/model'; import { wrapIntoCustomErrorResponse } from '../../errors'; import { createLicensedRouteHandler } from '../licensed_route_handler'; -import { RouteDefinitionParams } from '..'; export function defineGetApiKeysRoutes({ router }: RouteDefinitionParams) { router.get( diff --git a/x-pack/plugins/security/server/routes/api_keys/index.ts b/x-pack/plugins/security/server/routes/api_keys/index.ts index b74f912fe2187..e6a8711bdf19e 100644 --- a/x-pack/plugins/security/server/routes/api_keys/index.ts +++ b/x-pack/plugins/security/server/routes/api_keys/index.ts @@ -5,11 +5,11 @@ * 2.0. */ +import type { RouteDefinitionParams } from '../'; +import { defineEnabledApiKeysRoutes } from './enabled'; import { defineGetApiKeysRoutes } from './get'; -import { defineCheckPrivilegesRoutes } from './privileges'; import { defineInvalidateApiKeysRoutes } from './invalidate'; -import { defineEnabledApiKeysRoutes } from './enabled'; -import { RouteDefinitionParams } from '..'; +import { defineCheckPrivilegesRoutes } from './privileges'; export function defineApiKeysRoutes(params: RouteDefinitionParams) { defineEnabledApiKeysRoutes(params); diff --git a/x-pack/plugins/security/server/routes/api_keys/invalidate.test.ts b/x-pack/plugins/security/server/routes/api_keys/invalidate.test.ts index 6b3fc6b3e5771..061a4b0a6161a 100644 --- a/x-pack/plugins/security/server/routes/api_keys/invalidate.test.ts +++ b/x-pack/plugins/security/server/routes/api_keys/invalidate.test.ts @@ -6,13 +6,14 @@ */ import Boom from '@hapi/boom'; -import { Type } from '@kbn/config-schema'; -import { kibanaResponseFactory } from '../../../../../../src/core/server'; -import { LicenseCheck } from '../../../../licensing/server'; -import { defineInvalidateApiKeysRoutes } from './invalidate'; -import { coreMock, httpServerMock } from '../../../../../../src/core/server/mocks'; +import type { Type } from '@kbn/config-schema'; +import { kibanaResponseFactory } from 'src/core/server'; +import { coreMock, httpServerMock } from 'src/core/server/mocks'; + +import type { LicenseCheck } from '../../../../licensing/server'; import { routeDefinitionParamsMock } from '../index.mock'; +import { defineInvalidateApiKeysRoutes } from './invalidate'; interface TestOptions { licenseCheckResult?: LicenseCheck; diff --git a/x-pack/plugins/security/server/routes/api_keys/invalidate.ts b/x-pack/plugins/security/server/routes/api_keys/invalidate.ts index 91c632192c0c9..2fb99766434cd 100644 --- a/x-pack/plugins/security/server/routes/api_keys/invalidate.ts +++ b/x-pack/plugins/security/server/routes/api_keys/invalidate.ts @@ -6,10 +6,11 @@ */ import { schema } from '@kbn/config-schema'; -import { createLicensedRouteHandler } from '../licensed_route_handler'; -import { ApiKey } from '../../../common/model'; + +import type { RouteDefinitionParams } from '../'; +import type { ApiKey } from '../../../common/model'; import { wrapError, wrapIntoCustomErrorResponse } from '../../errors'; -import { RouteDefinitionParams } from '..'; +import { createLicensedRouteHandler } from '../licensed_route_handler'; interface ResponseType { itemsInvalidated: Array>; diff --git a/x-pack/plugins/security/server/routes/api_keys/privileges.test.ts b/x-pack/plugins/security/server/routes/api_keys/privileges.test.ts index a8a382d547d5a..019c61fd435be 100644 --- a/x-pack/plugins/security/server/routes/api_keys/privileges.test.ts +++ b/x-pack/plugins/security/server/routes/api_keys/privileges.test.ts @@ -6,13 +6,14 @@ */ import Boom from '@hapi/boom'; -import { LicenseCheck } from '../../../../licensing/server'; -import { kibanaResponseFactory } from '../../../../../../src/core/server'; -import { coreMock, httpServerMock } from '../../../../../../src/core/server/mocks'; +import { kibanaResponseFactory } from 'src/core/server'; +import { coreMock, httpServerMock } from 'src/core/server/mocks'; + +import type { LicenseCheck } from '../../../../licensing/server'; +import { authenticationServiceMock } from '../../authentication/authentication_service.mock'; import { routeDefinitionParamsMock } from '../index.mock'; import { defineCheckPrivilegesRoutes } from './privileges'; -import { authenticationServiceMock } from '../../authentication/authentication_service.mock'; interface TestOptions { licenseCheckResult?: LicenseCheck; diff --git a/x-pack/plugins/security/server/routes/api_keys/privileges.ts b/x-pack/plugins/security/server/routes/api_keys/privileges.ts index c1a1c0c24a5e8..18de00ed79956 100644 --- a/x-pack/plugins/security/server/routes/api_keys/privileges.ts +++ b/x-pack/plugins/security/server/routes/api_keys/privileges.ts @@ -5,9 +5,9 @@ * 2.0. */ +import type { RouteDefinitionParams } from '../'; import { wrapIntoCustomErrorResponse } from '../../errors'; import { createLicensedRouteHandler } from '../licensed_route_handler'; -import { RouteDefinitionParams } from '..'; export function defineCheckPrivilegesRoutes({ router, diff --git a/x-pack/plugins/security/server/routes/authentication/common.test.ts b/x-pack/plugins/security/server/routes/authentication/common.test.ts index 654e4fc18f195..6b3ce15669c27 100644 --- a/x-pack/plugins/security/server/routes/authentication/common.test.ts +++ b/x-pack/plugins/security/server/routes/authentication/common.test.ts @@ -7,26 +7,23 @@ import { Type } from '@kbn/config-schema'; import type { DeeplyMockedKeys } from '@kbn/utility-types/jest'; -import { - kibanaResponseFactory, - RequestHandler, - RouteConfig, -} from '../../../../../../src/core/server'; +import type { RequestHandler, RouteConfig } from 'src/core/server'; +import { kibanaResponseFactory } from 'src/core/server'; +import { httpServerMock } from 'src/core/server/mocks'; + import type { SecurityLicense, SecurityLicenseFeatures } from '../../../common/licensing'; +import { mockAuthenticatedUser } from '../../../common/model/authenticated_user.mock'; +import type { AuthenticationServiceStart } from '../../authentication'; import { AuthenticationResult, - AuthenticationServiceStart, DeauthenticationResult, OIDCLogin, SAMLLogin, } from '../../authentication'; -import { defineCommonRoutes } from './common'; +import { authenticationServiceMock } from '../../authentication/authentication_service.mock'; import type { SecurityRequestHandlerContext, SecurityRouter } from '../../types'; - -import { httpServerMock } from '../../../../../../src/core/server/mocks'; -import { mockAuthenticatedUser } from '../../../common/model/authenticated_user.mock'; import { routeDefinitionParamsMock } from '../index.mock'; -import { authenticationServiceMock } from '../../authentication/authentication_service.mock'; +import { defineCommonRoutes } from './common'; describe('Common authentication routes', () => { let router: jest.Mocked; diff --git a/x-pack/plugins/security/server/routes/authentication/common.ts b/x-pack/plugins/security/server/routes/authentication/common.ts index f1d9aab74548a..28c344785da4b 100644 --- a/x-pack/plugins/security/server/routes/authentication/common.ts +++ b/x-pack/plugins/security/server/routes/authentication/common.ts @@ -5,20 +5,22 @@ * 2.0. */ -import { schema, TypeOf } from '@kbn/config-schema'; +import type { TypeOf } from '@kbn/config-schema'; +import { schema } from '@kbn/config-schema'; + +import type { RouteDefinitionParams } from '../'; import { parseNext } from '../../../common/parse_next'; import { - canRedirectRequest, - OIDCLogin, - SAMLLogin, BasicAuthenticationProvider, + canRedirectRequest, OIDCAuthenticationProvider, + OIDCLogin, SAMLAuthenticationProvider, + SAMLLogin, TokenAuthenticationProvider, } from '../../authentication'; import { wrapIntoCustomErrorResponse } from '../../errors'; import { createLicensedRouteHandler } from '../licensed_route_handler'; -import { RouteDefinitionParams } from '..'; /** * Defines routes that are common to various authentication mechanisms. diff --git a/x-pack/plugins/security/server/routes/authentication/index.test.ts b/x-pack/plugins/security/server/routes/authentication/index.test.ts index aba68de145a8c..d1648797d45bf 100644 --- a/x-pack/plugins/security/server/routes/authentication/index.test.ts +++ b/x-pack/plugins/security/server/routes/authentication/index.test.ts @@ -5,9 +5,8 @@ * 2.0. */ -import { defineAuthenticationRoutes } from '.'; - import { routeDefinitionParamsMock } from '../index.mock'; +import { defineAuthenticationRoutes } from './'; describe('Authentication routes', () => { it('does not register any SAML related routes if SAML auth provider is not enabled', () => { diff --git a/x-pack/plugins/security/server/routes/authentication/index.ts b/x-pack/plugins/security/server/routes/authentication/index.ts index 1a924063c7713..3b879eadf240b 100644 --- a/x-pack/plugins/security/server/routes/authentication/index.ts +++ b/x-pack/plugins/security/server/routes/authentication/index.ts @@ -5,10 +5,10 @@ * 2.0. */ -import { defineSAMLRoutes } from './saml'; +import type { RouteDefinitionParams } from '../'; import { defineCommonRoutes } from './common'; import { defineOIDCRoutes } from './oidc'; -import { RouteDefinitionParams } from '..'; +import { defineSAMLRoutes } from './saml'; export function defineAuthenticationRoutes(params: RouteDefinitionParams) { defineCommonRoutes(params); diff --git a/x-pack/plugins/security/server/routes/authentication/oidc.ts b/x-pack/plugins/security/server/routes/authentication/oidc.ts index b0defe7662622..854b6721278ff 100644 --- a/x-pack/plugins/security/server/routes/authentication/oidc.ts +++ b/x-pack/plugins/security/server/routes/authentication/oidc.ts @@ -7,15 +7,14 @@ import { schema } from '@kbn/config-schema'; import { i18n } from '@kbn/i18n'; -import { KibanaRequest, KibanaResponseFactory } from '../../../../../../src/core/server'; +import type { KibanaRequest, KibanaResponseFactory } from 'src/core/server'; + +import type { RouteDefinitionParams } from '../'; import { OIDCLogin } from '../../authentication'; -import { createLicensedRouteHandler } from '../licensed_route_handler'; +import type { ProviderLoginAttempt } from '../../authentication/providers/oidc'; +import { OIDCAuthenticationProvider } from '../../authentication/providers/oidc'; import { wrapIntoCustomErrorResponse } from '../../errors'; -import { - OIDCAuthenticationProvider, - ProviderLoginAttempt, -} from '../../authentication/providers/oidc'; -import { RouteDefinitionParams } from '..'; +import { createLicensedRouteHandler } from '../licensed_route_handler'; /** * Defines routes required for SAML authentication. diff --git a/x-pack/plugins/security/server/routes/authentication/saml.test.ts b/x-pack/plugins/security/server/routes/authentication/saml.test.ts index 10508122a88e7..4c9a99adb02f4 100644 --- a/x-pack/plugins/security/server/routes/authentication/saml.test.ts +++ b/x-pack/plugins/security/server/routes/authentication/saml.test.ts @@ -7,15 +7,16 @@ import { Type } from '@kbn/config-schema'; import type { DeeplyMockedKeys } from '@kbn/utility-types/jest'; -import { AuthenticationResult, AuthenticationServiceStart, SAMLLogin } from '../../authentication'; -import { defineSAMLRoutes } from './saml'; -import type { RequestHandler, RouteConfig } from '../../../../../../src/core/server'; -import type { SecurityRouter } from '../../types'; +import type { RequestHandler, RouteConfig } from 'src/core/server'; +import { httpServerMock } from 'src/core/server/mocks'; -import { httpServerMock } from '../../../../../../src/core/server/mocks'; import { mockAuthenticatedUser } from '../../../common/model/authenticated_user.mock'; -import { routeDefinitionParamsMock } from '../index.mock'; +import type { AuthenticationServiceStart } from '../../authentication'; +import { AuthenticationResult, SAMLLogin } from '../../authentication'; import { authenticationServiceMock } from '../../authentication/authentication_service.mock'; +import type { SecurityRouter } from '../../types'; +import { routeDefinitionParamsMock } from '../index.mock'; +import { defineSAMLRoutes } from './saml'; describe('SAML authentication routes', () => { let router: jest.Mocked; diff --git a/x-pack/plugins/security/server/routes/authentication/saml.ts b/x-pack/plugins/security/server/routes/authentication/saml.ts index 2d6895ffe6986..12e7e9cf145e9 100644 --- a/x-pack/plugins/security/server/routes/authentication/saml.ts +++ b/x-pack/plugins/security/server/routes/authentication/saml.ts @@ -6,9 +6,10 @@ */ import { schema } from '@kbn/config-schema'; + +import type { RouteDefinitionParams } from '../'; import { SAMLLogin } from '../../authentication'; import { SAMLAuthenticationProvider } from '../../authentication/providers'; -import { RouteDefinitionParams } from '..'; /** * Defines routes required for SAML authentication. diff --git a/x-pack/plugins/security/server/routes/authorization/index.ts b/x-pack/plugins/security/server/routes/authorization/index.ts index be79254d658c5..1fecd45f795a3 100644 --- a/x-pack/plugins/security/server/routes/authorization/index.ts +++ b/x-pack/plugins/security/server/routes/authorization/index.ts @@ -5,11 +5,11 @@ * 2.0. */ +import type { RouteDefinitionParams } from '../'; import { definePrivilegesRoutes } from './privileges'; -import { defineRolesRoutes } from './roles'; import { resetSessionPageRoutes } from './reset_session_page'; +import { defineRolesRoutes } from './roles'; import { defineShareSavedObjectPermissionRoutes } from './spaces'; -import { RouteDefinitionParams } from '..'; export function defineAuthorizationRoutes(params: RouteDefinitionParams) { defineRolesRoutes(params); diff --git a/x-pack/plugins/security/server/routes/authorization/privileges/get.test.ts b/x-pack/plugins/security/server/routes/authorization/privileges/get.test.ts index bc4d12134ac67..26afb602afc90 100644 --- a/x-pack/plugins/security/server/routes/authorization/privileges/get.test.ts +++ b/x-pack/plugins/security/server/routes/authorization/privileges/get.test.ts @@ -5,14 +5,14 @@ * 2.0. */ -import { kibanaResponseFactory } from '../../../../../../../src/core/server'; -import { LicenseCheck } from '../../../../../licensing/server'; -import { RawKibanaPrivileges } from '../../../../common/model'; -import { defineGetPrivilegesRoutes } from './get'; -import type { SecurityRequestHandlerContext } from '../../../types'; +import { kibanaResponseFactory } from 'src/core/server'; +import { httpServerMock } from 'src/core/server/mocks'; -import { httpServerMock } from '../../../../../../../src/core/server/mocks'; +import type { LicenseCheck } from '../../../../../licensing/server'; +import type { RawKibanaPrivileges } from '../../../../common/model'; +import type { SecurityRequestHandlerContext } from '../../../types'; import { routeDefinitionParamsMock } from '../../index.mock'; +import { defineGetPrivilegesRoutes } from './get'; const createRawKibanaPrivileges: () => RawKibanaPrivileges = () => { return { diff --git a/x-pack/plugins/security/server/routes/authorization/privileges/get.ts b/x-pack/plugins/security/server/routes/authorization/privileges/get.ts index d7935989e6050..8724323fdf510 100644 --- a/x-pack/plugins/security/server/routes/authorization/privileges/get.ts +++ b/x-pack/plugins/security/server/routes/authorization/privileges/get.ts @@ -6,7 +6,8 @@ */ import { schema } from '@kbn/config-schema'; -import { RouteDefinitionParams } from '../..'; + +import type { RouteDefinitionParams } from '../..'; import { createLicensedRouteHandler } from '../../licensed_route_handler'; export function defineGetPrivilegesRoutes({ router, authz }: RouteDefinitionParams) { diff --git a/x-pack/plugins/security/server/routes/authorization/privileges/get_builtin.ts b/x-pack/plugins/security/server/routes/authorization/privileges/get_builtin.ts index 3720c4882669a..e2539695d54ee 100644 --- a/x-pack/plugins/security/server/routes/authorization/privileges/get_builtin.ts +++ b/x-pack/plugins/security/server/routes/authorization/privileges/get_builtin.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { BuiltinESPrivileges } from '../../../../common/model'; -import { RouteDefinitionParams } from '../..'; +import type { RouteDefinitionParams } from '../..'; +import type { BuiltinESPrivileges } from '../../../../common/model'; export function defineGetBuiltinPrivilegesRoutes({ router }: RouteDefinitionParams) { router.get( diff --git a/x-pack/plugins/security/server/routes/authorization/privileges/index.ts b/x-pack/plugins/security/server/routes/authorization/privileges/index.ts index ee24dcbbef835..572a7a2584dcc 100644 --- a/x-pack/plugins/security/server/routes/authorization/privileges/index.ts +++ b/x-pack/plugins/security/server/routes/authorization/privileges/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { RouteDefinitionParams } from '../..'; +import type { RouteDefinitionParams } from '../..'; import { defineGetPrivilegesRoutes } from './get'; import { defineGetBuiltinPrivilegesRoutes } from './get_builtin'; diff --git a/x-pack/plugins/security/server/routes/authorization/reset_session_page.ts b/x-pack/plugins/security/server/routes/authorization/reset_session_page.ts index 06d26467aad0c..05fe1a7d01175 100644 --- a/x-pack/plugins/security/server/routes/authorization/reset_session_page.ts +++ b/x-pack/plugins/security/server/routes/authorization/reset_session_page.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { RouteDefinitionParams } from '..'; +import type { RouteDefinitionParams } from '../'; export function resetSessionPageRoutes({ httpResources }: RouteDefinitionParams) { httpResources.register( diff --git a/x-pack/plugins/security/server/routes/authorization/roles/delete.test.ts b/x-pack/plugins/security/server/routes/authorization/roles/delete.test.ts index 44022691226b9..e2ecd92b9a942 100644 --- a/x-pack/plugins/security/server/routes/authorization/roles/delete.test.ts +++ b/x-pack/plugins/security/server/routes/authorization/roles/delete.test.ts @@ -6,12 +6,13 @@ */ import Boom from '@hapi/boom'; -import { kibanaResponseFactory } from '../../../../../../../src/core/server'; -import { LicenseCheck } from '../../../../../licensing/server'; -import { defineDeleteRolesRoutes } from './delete'; -import { coreMock, httpServerMock } from '../../../../../../../src/core/server/mocks'; +import { kibanaResponseFactory } from 'src/core/server'; +import { coreMock, httpServerMock } from 'src/core/server/mocks'; + +import type { LicenseCheck } from '../../../../../licensing/server'; import { routeDefinitionParamsMock } from '../../index.mock'; +import { defineDeleteRolesRoutes } from './delete'; interface TestOptions { licenseCheckResult?: LicenseCheck; diff --git a/x-pack/plugins/security/server/routes/authorization/roles/delete.ts b/x-pack/plugins/security/server/routes/authorization/roles/delete.ts index 85a42aa3c6415..aa2fc0e417e4d 100644 --- a/x-pack/plugins/security/server/routes/authorization/roles/delete.ts +++ b/x-pack/plugins/security/server/routes/authorization/roles/delete.ts @@ -6,9 +6,10 @@ */ import { schema } from '@kbn/config-schema'; -import { RouteDefinitionParams } from '../../index'; -import { createLicensedRouteHandler } from '../../licensed_route_handler'; + import { wrapIntoCustomErrorResponse } from '../../../errors'; +import type { RouteDefinitionParams } from '../../index'; +import { createLicensedRouteHandler } from '../../licensed_route_handler'; export function defineDeleteRolesRoutes({ router }: RouteDefinitionParams) { router.delete( diff --git a/x-pack/plugins/security/server/routes/authorization/roles/get.test.ts b/x-pack/plugins/security/server/routes/authorization/roles/get.test.ts index 836d6c1ab4f45..24366a250cf11 100644 --- a/x-pack/plugins/security/server/routes/authorization/roles/get.test.ts +++ b/x-pack/plugins/security/server/routes/authorization/roles/get.test.ts @@ -6,12 +6,13 @@ */ import Boom from '@hapi/boom'; -import { kibanaResponseFactory } from '../../../../../../../src/core/server'; -import { LicenseCheck } from '../../../../../licensing/server'; -import { defineGetRolesRoutes } from './get'; -import { coreMock, httpServerMock } from '../../../../../../../src/core/server/mocks'; +import { kibanaResponseFactory } from 'src/core/server'; +import { coreMock, httpServerMock } from 'src/core/server/mocks'; + +import type { LicenseCheck } from '../../../../../licensing/server'; import { routeDefinitionParamsMock } from '../../index.mock'; +import { defineGetRolesRoutes } from './get'; const application = 'kibana-.kibana'; const reservedPrivilegesApplicationWildcard = 'kibana-*'; diff --git a/x-pack/plugins/security/server/routes/authorization/roles/get.ts b/x-pack/plugins/security/server/routes/authorization/roles/get.ts index 354b286946a6e..3bfc5e5d4dda3 100644 --- a/x-pack/plugins/security/server/routes/authorization/roles/get.ts +++ b/x-pack/plugins/security/server/routes/authorization/roles/get.ts @@ -6,10 +6,12 @@ */ import { schema } from '@kbn/config-schema'; -import { RouteDefinitionParams } from '../..'; -import { createLicensedRouteHandler } from '../../licensed_route_handler'; + +import type { RouteDefinitionParams } from '../..'; import { wrapIntoCustomErrorResponse } from '../../../errors'; -import { ElasticsearchRole, transformElasticsearchRoleToRole } from './model'; +import { createLicensedRouteHandler } from '../../licensed_route_handler'; +import type { ElasticsearchRole } from './model'; +import { transformElasticsearchRoleToRole } from './model'; export function defineGetRolesRoutes({ router, authz }: RouteDefinitionParams) { router.get( diff --git a/x-pack/plugins/security/server/routes/authorization/roles/get_all.test.ts b/x-pack/plugins/security/server/routes/authorization/roles/get_all.test.ts index cc87d922fddac..d490153b30394 100644 --- a/x-pack/plugins/security/server/routes/authorization/roles/get_all.test.ts +++ b/x-pack/plugins/security/server/routes/authorization/roles/get_all.test.ts @@ -6,12 +6,13 @@ */ import Boom from '@hapi/boom'; -import { kibanaResponseFactory } from '../../../../../../../src/core/server'; -import { LicenseCheck } from '../../../../../licensing/server'; -import { defineGetAllRolesRoutes } from './get_all'; -import { coreMock, httpServerMock } from '../../../../../../../src/core/server/mocks'; +import { kibanaResponseFactory } from 'src/core/server'; +import { coreMock, httpServerMock } from 'src/core/server/mocks'; + +import type { LicenseCheck } from '../../../../../licensing/server'; import { routeDefinitionParamsMock } from '../../index.mock'; +import { defineGetAllRolesRoutes } from './get_all'; const application = 'kibana-.kibana'; const reservedPrivilegesApplicationWildcard = 'kibana-*'; diff --git a/x-pack/plugins/security/server/routes/authorization/roles/get_all.ts b/x-pack/plugins/security/server/routes/authorization/roles/get_all.ts index 318e8e9fa2e86..2994afd40f880 100644 --- a/x-pack/plugins/security/server/routes/authorization/roles/get_all.ts +++ b/x-pack/plugins/security/server/routes/authorization/roles/get_all.ts @@ -5,10 +5,11 @@ * 2.0. */ -import { RouteDefinitionParams } from '../..'; -import { createLicensedRouteHandler } from '../../licensed_route_handler'; +import type { RouteDefinitionParams } from '../..'; import { wrapIntoCustomErrorResponse } from '../../../errors'; -import { ElasticsearchRole, transformElasticsearchRoleToRole } from './model'; +import { createLicensedRouteHandler } from '../../licensed_route_handler'; +import type { ElasticsearchRole } from './model'; +import { transformElasticsearchRoleToRole } from './model'; export function defineGetAllRolesRoutes({ router, authz }: RouteDefinitionParams) { router.get( diff --git a/x-pack/plugins/security/server/routes/authorization/roles/index.ts b/x-pack/plugins/security/server/routes/authorization/roles/index.ts index e0f8675a5530a..e3ea1a3889b1f 100644 --- a/x-pack/plugins/security/server/routes/authorization/roles/index.ts +++ b/x-pack/plugins/security/server/routes/authorization/roles/index.ts @@ -5,10 +5,10 @@ * 2.0. */ -import { RouteDefinitionParams } from '../..'; +import type { RouteDefinitionParams } from '../..'; +import { defineDeleteRolesRoutes } from './delete'; import { defineGetRolesRoutes } from './get'; import { defineGetAllRolesRoutes } from './get_all'; -import { defineDeleteRolesRoutes } from './delete'; import { definePutRolesRoutes } from './put'; export function defineRolesRoutes(params: RouteDefinitionParams) { diff --git a/x-pack/plugins/security/server/routes/authorization/roles/model/elasticsearch_role.ts b/x-pack/plugins/security/server/routes/authorization/roles/model/elasticsearch_role.ts index b5ec2bbbe426f..f033b66805067 100644 --- a/x-pack/plugins/security/server/routes/authorization/roles/model/elasticsearch_role.ts +++ b/x-pack/plugins/security/server/routes/authorization/roles/model/elasticsearch_role.ts @@ -5,11 +5,11 @@ * 2.0. */ -import { Role, RoleKibanaPrivilege } from '../../../../../common/model'; import { GLOBAL_RESOURCE, RESERVED_PRIVILEGES_APPLICATION_WILDCARD, } from '../../../../../common/constants'; +import type { Role, RoleKibanaPrivilege } from '../../../../../common/model'; import { PrivilegeSerializer } from '../../../../authorization/privilege_serializer'; import { ResourceSerializer } from '../../../../authorization/resource_serializer'; diff --git a/x-pack/plugins/security/server/routes/authorization/roles/model/put_payload.ts b/x-pack/plugins/security/server/routes/authorization/roles/model/put_payload.ts index 6003c8028891b..8a560d7b6dd87 100644 --- a/x-pack/plugins/security/server/routes/authorization/roles/model/put_payload.ts +++ b/x-pack/plugins/security/server/routes/authorization/roles/model/put_payload.ts @@ -6,11 +6,14 @@ */ import _ from 'lodash'; -import { schema, TypeOf } from '@kbn/config-schema'; + +import type { TypeOf } from '@kbn/config-schema'; +import { schema } from '@kbn/config-schema'; + import { GLOBAL_RESOURCE } from '../../../../../common/constants'; import { PrivilegeSerializer } from '../../../../authorization/privilege_serializer'; import { ResourceSerializer } from '../../../../authorization/resource_serializer'; -import { ElasticsearchRole } from './elasticsearch_role'; +import type { ElasticsearchRole } from './elasticsearch_role'; /** * Elasticsearch specific portion of the role definition. diff --git a/x-pack/plugins/security/server/routes/authorization/roles/put.test.ts b/x-pack/plugins/security/server/routes/authorization/roles/put.test.ts index 0ca4b7e33a975..ae4647ca4f515 100644 --- a/x-pack/plugins/security/server/routes/authorization/roles/put.test.ts +++ b/x-pack/plugins/security/server/routes/authorization/roles/put.test.ts @@ -5,16 +5,16 @@ * 2.0. */ -import { Type } from '@kbn/config-schema'; -import { kibanaResponseFactory } from '../../../../../../../src/core/server'; -import { LicenseCheck } from '../../../../../licensing/server'; -import { GLOBAL_RESOURCE } from '../../../../common/constants'; -import { definePutRolesRoutes } from './put'; +import type { Type } from '@kbn/config-schema'; +import { kibanaResponseFactory } from 'src/core/server'; +import { coreMock, httpServerMock } from 'src/core/server/mocks'; -import { coreMock, httpServerMock } from '../../../../../../../src/core/server/mocks'; -import { routeDefinitionParamsMock } from '../../index.mock'; import { KibanaFeature } from '../../../../../features/server'; +import type { LicenseCheck } from '../../../../../licensing/server'; +import { GLOBAL_RESOURCE } from '../../../../common/constants'; import { securityFeatureUsageServiceMock } from '../../../feature_usage/index.mock'; +import { routeDefinitionParamsMock } from '../../index.mock'; +import { definePutRolesRoutes } from './put'; const application = 'kibana-.kibana'; const privilegeMap = { diff --git a/x-pack/plugins/security/server/routes/authorization/roles/put.ts b/x-pack/plugins/security/server/routes/authorization/roles/put.ts index f45aca8e0af19..aefcc0c72c6db 100644 --- a/x-pack/plugins/security/server/routes/authorization/roles/put.ts +++ b/x-pack/plugins/security/server/routes/authorization/roles/put.ts @@ -5,16 +5,15 @@ * 2.0. */ -import { schema, TypeOf } from '@kbn/config-schema'; -import { KibanaFeature } from '../../../../../features/common'; -import { RouteDefinitionParams } from '../../index'; -import { createLicensedRouteHandler } from '../../licensed_route_handler'; +import type { TypeOf } from '@kbn/config-schema'; +import { schema } from '@kbn/config-schema'; + +import type { KibanaFeature } from '../../../../../features/common'; import { wrapIntoCustomErrorResponse } from '../../../errors'; -import { - ElasticsearchRole, - getPutPayloadSchema, - transformPutPayloadToElasticsearchRole, -} from './model'; +import type { RouteDefinitionParams } from '../../index'; +import { createLicensedRouteHandler } from '../../licensed_route_handler'; +import type { ElasticsearchRole } from './model'; +import { getPutPayloadSchema, transformPutPayloadToElasticsearchRole } from './model'; const roleGrantsSubFeaturePrivileges = ( features: KibanaFeature[], diff --git a/x-pack/plugins/security/server/routes/authorization/spaces/share_saved_object_permissions.test.ts b/x-pack/plugins/security/server/routes/authorization/spaces/share_saved_object_permissions.test.ts index 69cb5e7f17af6..03736c3bfb4bc 100644 --- a/x-pack/plugins/security/server/routes/authorization/spaces/share_saved_object_permissions.test.ts +++ b/x-pack/plugins/security/server/routes/authorization/spaces/share_saved_object_permissions.test.ts @@ -5,19 +5,16 @@ * 2.0. */ -import { - kibanaResponseFactory, - RequestHandler, - RouteConfig, -} from '../../../../../../../src/core/server'; -import { defineShareSavedObjectPermissionRoutes } from './share_saved_object_permissions'; +import type { DeeplyMockedKeys } from '@kbn/utility-types/target/jest'; +import type { RequestHandler, RouteConfig } from 'src/core/server'; +import { kibanaResponseFactory } from 'src/core/server'; +import { httpServerMock } from 'src/core/server/mocks'; -import { httpServerMock } from '../../../../../../../src/core/server/mocks'; -import { routeDefinitionParamsMock } from '../../index.mock'; -import { RouteDefinitionParams } from '../..'; -import { DeeplyMockedKeys } from '@kbn/utility-types/target/jest'; -import { CheckPrivileges } from '../../../authorization/types'; +import type { RouteDefinitionParams } from '../..'; +import type { CheckPrivileges } from '../../../authorization/types'; import type { SecurityRequestHandlerContext, SecurityRouter } from '../../../types'; +import { routeDefinitionParamsMock } from '../../index.mock'; +import { defineShareSavedObjectPermissionRoutes } from './share_saved_object_permissions'; describe('Share Saved Object Permissions', () => { let router: jest.Mocked; diff --git a/x-pack/plugins/security/server/routes/authorization/spaces/share_saved_object_permissions.ts b/x-pack/plugins/security/server/routes/authorization/spaces/share_saved_object_permissions.ts index 849ab66d03bb0..07e4ac087f591 100644 --- a/x-pack/plugins/security/server/routes/authorization/spaces/share_saved_object_permissions.ts +++ b/x-pack/plugins/security/server/routes/authorization/spaces/share_saved_object_permissions.ts @@ -6,9 +6,10 @@ */ import { schema } from '@kbn/config-schema'; -import { RouteDefinitionParams } from '../../index'; -import { createLicensedRouteHandler } from '../../licensed_route_handler'; + import { wrapIntoCustomErrorResponse } from '../../../errors'; +import type { RouteDefinitionParams } from '../../index'; +import { createLicensedRouteHandler } from '../../licensed_route_handler'; export function defineShareSavedObjectPermissionRoutes({ router, authz }: RouteDefinitionParams) { router.get( diff --git a/x-pack/plugins/security/server/routes/index.mock.ts b/x-pack/plugins/security/server/routes/index.mock.ts index 9077f35b9efae..956de8c4036d3 100644 --- a/x-pack/plugins/security/server/routes/index.mock.ts +++ b/x-pack/plugins/security/server/routes/index.mock.ts @@ -6,17 +6,14 @@ */ import type { DeeplyMockedKeys } from '@kbn/utility-types/jest'; -import { - httpServiceMock, - loggingSystemMock, - httpResourcesMock, -} from '../../../../../src/core/server/mocks'; -import { authorizationMock } from '../authorization/index.mock'; -import { ConfigSchema, createConfig } from '../config'; +import { httpResourcesMock, httpServiceMock, loggingSystemMock } from 'src/core/server/mocks'; + import { licenseMock } from '../../common/licensing/index.mock'; import { authenticationServiceMock } from '../authentication/authentication_service.mock'; +import { authorizationMock } from '../authorization/index.mock'; +import { ConfigSchema, createConfig } from '../config'; import { sessionMock } from '../session_management/session.mock'; -import type { RouteDefinitionParams } from '.'; +import type { RouteDefinitionParams } from './'; export const routeDefinitionParamsMock = { create: (config: Record = {}) => diff --git a/x-pack/plugins/security/server/routes/index.ts b/x-pack/plugins/security/server/routes/index.ts index ba59d0f39692b..cdb3a2fa289fd 100644 --- a/x-pack/plugins/security/server/routes/index.ts +++ b/x-pack/plugins/security/server/routes/index.ts @@ -6,8 +6,9 @@ */ import type { PublicMethodsOf } from '@kbn/utility-types'; +import type { HttpResources, IBasePath, Logger } from 'src/core/server'; + import type { KibanaFeature } from '../../../features/server'; -import type { HttpResources, IBasePath, Logger } from '../../../../../src/core/server'; import type { SecurityLicense } from '../../common/licensing'; import type { AuthenticationServiceStart } from '../authentication'; import type { AuthorizationServiceSetup } from '../authorization'; @@ -15,14 +16,13 @@ import type { ConfigType } from '../config'; import type { SecurityFeatureUsageServiceStart } from '../feature_usage'; import type { Session } from '../session_management'; import type { SecurityRouter } from '../types'; - +import { defineApiKeysRoutes } from './api_keys'; import { defineAuthenticationRoutes } from './authentication'; import { defineAuthorizationRoutes } from './authorization'; -import { defineApiKeysRoutes } from './api_keys'; import { defineIndicesRoutes } from './indices'; -import { defineUsersRoutes } from './users'; import { defineRoleMappingRoutes } from './role_mapping'; import { defineSessionManagementRoutes } from './session_management'; +import { defineUsersRoutes } from './users'; import { defineViewRoutes } from './views'; /** diff --git a/x-pack/plugins/security/server/routes/indices/get_fields.test.ts b/x-pack/plugins/security/server/routes/indices/get_fields.test.ts index 33f2059dd0b35..20f9949f615cb 100644 --- a/x-pack/plugins/security/server/routes/indices/get_fields.test.ts +++ b/x-pack/plugins/security/server/routes/indices/get_fields.test.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { httpServerMock, coreMock } from '../../../../../../src/core/server/mocks'; -import { kibanaResponseFactory } from '../../../../../../src/core/server'; +import { kibanaResponseFactory } from 'src/core/server'; +import { coreMock, httpServerMock } from 'src/core/server/mocks'; import { routeDefinitionParamsMock } from '../index.mock'; import { defineGetFieldsRoutes } from './get_fields'; diff --git a/x-pack/plugins/security/server/routes/indices/get_fields.ts b/x-pack/plugins/security/server/routes/indices/get_fields.ts index 4df62df385db1..3ed7493ea1f0e 100644 --- a/x-pack/plugins/security/server/routes/indices/get_fields.ts +++ b/x-pack/plugins/security/server/routes/indices/get_fields.ts @@ -6,8 +6,9 @@ */ import { schema } from '@kbn/config-schema'; -import { RouteDefinitionParams } from '../index'; + import { wrapIntoCustomErrorResponse } from '../../errors'; +import type { RouteDefinitionParams } from '../index'; interface FieldMappingResponse { [indexName: string]: { diff --git a/x-pack/plugins/security/server/routes/indices/index.ts b/x-pack/plugins/security/server/routes/indices/index.ts index c26197c6045f1..bfc1d341b9f2f 100644 --- a/x-pack/plugins/security/server/routes/indices/index.ts +++ b/x-pack/plugins/security/server/routes/indices/index.ts @@ -5,8 +5,8 @@ * 2.0. */ +import type { RouteDefinitionParams } from '../'; import { defineGetFieldsRoutes } from './get_fields'; -import { RouteDefinitionParams } from '..'; export function defineIndicesRoutes(params: RouteDefinitionParams) { defineGetFieldsRoutes(params); diff --git a/x-pack/plugins/security/server/routes/licensed_route_handler.ts b/x-pack/plugins/security/server/routes/licensed_route_handler.ts index b03ee8ca8ae62..b4e6871c7a963 100644 --- a/x-pack/plugins/security/server/routes/licensed_route_handler.ts +++ b/x-pack/plugins/security/server/routes/licensed_route_handler.ts @@ -5,7 +5,8 @@ * 2.0. */ -import { KibanaResponseFactory, RequestHandler, RouteMethod } from 'kibana/server'; +import type { KibanaResponseFactory, RequestHandler, RouteMethod } from 'src/core/server'; + import type { SecurityRequestHandlerContext } from '../types'; export const createLicensedRouteHandler = < diff --git a/x-pack/plugins/security/server/routes/role_mapping/delete.test.ts b/x-pack/plugins/security/server/routes/role_mapping/delete.test.ts index c780dc6e5b4fc..64b1ae8af13c6 100644 --- a/x-pack/plugins/security/server/routes/role_mapping/delete.test.ts +++ b/x-pack/plugins/security/server/routes/role_mapping/delete.test.ts @@ -5,9 +5,10 @@ * 2.0. */ -import { routeDefinitionParamsMock } from '../index.mock'; +import { kibanaResponseFactory } from 'src/core/server'; import { coreMock, httpServerMock } from 'src/core/server/mocks'; -import { kibanaResponseFactory } from '../../../../../../src/core/server'; + +import { routeDefinitionParamsMock } from '../index.mock'; import { defineRoleMappingDeleteRoutes } from './delete'; describe('DELETE role mappings', () => { diff --git a/x-pack/plugins/security/server/routes/role_mapping/delete.ts b/x-pack/plugins/security/server/routes/role_mapping/delete.ts index f106a065b225f..c7266353eb235 100644 --- a/x-pack/plugins/security/server/routes/role_mapping/delete.ts +++ b/x-pack/plugins/security/server/routes/role_mapping/delete.ts @@ -6,9 +6,10 @@ */ import { schema } from '@kbn/config-schema'; -import { createLicensedRouteHandler } from '../licensed_route_handler'; + +import type { RouteDefinitionParams } from '../'; import { wrapError } from '../../errors'; -import { RouteDefinitionParams } from '..'; +import { createLicensedRouteHandler } from '../licensed_route_handler'; export function defineRoleMappingDeleteRoutes({ router }: RouteDefinitionParams) { router.delete( diff --git a/x-pack/plugins/security/server/routes/role_mapping/feature_check.test.ts b/x-pack/plugins/security/server/routes/role_mapping/feature_check.test.ts index 5ac386e5e75d6..a015fcd293e35 100644 --- a/x-pack/plugins/security/server/routes/role_mapping/feature_check.test.ts +++ b/x-pack/plugins/security/server/routes/role_mapping/feature_check.test.ts @@ -5,10 +5,11 @@ * 2.0. */ -import { routeDefinitionParamsMock } from '../index.mock'; +import { kibanaResponseFactory } from 'src/core/server'; import { coreMock, httpServerMock } from 'src/core/server/mocks'; -import { kibanaResponseFactory } from '../../../../../../src/core/server'; -import { LicenseCheck } from '../../../../licensing/server'; + +import type { LicenseCheck } from '../../../../licensing/server'; +import { routeDefinitionParamsMock } from '../index.mock'; import { defineRoleMappingFeatureCheckRoute } from './feature_check'; interface TestOptions { diff --git a/x-pack/plugins/security/server/routes/role_mapping/feature_check.ts b/x-pack/plugins/security/server/routes/role_mapping/feature_check.ts index 562e5f891ec37..95b5d56be9937 100644 --- a/x-pack/plugins/security/server/routes/role_mapping/feature_check.ts +++ b/x-pack/plugins/security/server/routes/role_mapping/feature_check.ts @@ -5,9 +5,10 @@ * 2.0. */ -import { ElasticsearchClient, Logger } from 'src/core/server'; +import type { ElasticsearchClient, Logger } from 'src/core/server'; + +import type { RouteDefinitionParams } from '../'; import { createLicensedRouteHandler } from '../licensed_route_handler'; -import { RouteDefinitionParams } from '..'; interface NodeSettingsResponse { nodes: { diff --git a/x-pack/plugins/security/server/routes/role_mapping/get.test.ts b/x-pack/plugins/security/server/routes/role_mapping/get.test.ts index dfd50be2d1356..b9511eac70af7 100644 --- a/x-pack/plugins/security/server/routes/role_mapping/get.test.ts +++ b/x-pack/plugins/security/server/routes/role_mapping/get.test.ts @@ -6,10 +6,12 @@ */ import Boom from '@hapi/boom'; -import { routeDefinitionParamsMock } from '../index.mock'; + +import { kibanaResponseFactory } from 'src/core/server'; import { coreMock, httpServerMock } from 'src/core/server/mocks'; + +import { routeDefinitionParamsMock } from '../index.mock'; import { defineRoleMappingGetRoutes } from './get'; -import { kibanaResponseFactory } from '../../../../../../src/core/server'; const mockRoleMappingResponse = { mapping1: { diff --git a/x-pack/plugins/security/server/routes/role_mapping/get.ts b/x-pack/plugins/security/server/routes/role_mapping/get.ts index ff4567d5d67a5..d060825a989d5 100644 --- a/x-pack/plugins/security/server/routes/role_mapping/get.ts +++ b/x-pack/plugins/security/server/routes/role_mapping/get.ts @@ -6,10 +6,11 @@ */ import { schema } from '@kbn/config-schema'; -import { RoleMapping } from '../../../common/model'; -import { createLicensedRouteHandler } from '../licensed_route_handler'; + +import type { RouteDefinitionParams } from '../'; +import type { RoleMapping } from '../../../common/model'; import { wrapError } from '../../errors'; -import { RouteDefinitionParams } from '..'; +import { createLicensedRouteHandler } from '../licensed_route_handler'; interface RoleMappingsResponse { [roleMappingName: string]: Omit; diff --git a/x-pack/plugins/security/server/routes/role_mapping/index.ts b/x-pack/plugins/security/server/routes/role_mapping/index.ts index f09909bc3bf86..acb14a072ef3f 100644 --- a/x-pack/plugins/security/server/routes/role_mapping/index.ts +++ b/x-pack/plugins/security/server/routes/role_mapping/index.ts @@ -5,11 +5,11 @@ * 2.0. */ +import type { RouteDefinitionParams } from '../'; +import { defineRoleMappingDeleteRoutes } from './delete'; import { defineRoleMappingFeatureCheckRoute } from './feature_check'; import { defineRoleMappingGetRoutes } from './get'; import { defineRoleMappingPostRoutes } from './post'; -import { defineRoleMappingDeleteRoutes } from './delete'; -import { RouteDefinitionParams } from '..'; export function defineRoleMappingRoutes(params: RouteDefinitionParams) { defineRoleMappingFeatureCheckRoute(params); diff --git a/x-pack/plugins/security/server/routes/role_mapping/post.test.ts b/x-pack/plugins/security/server/routes/role_mapping/post.test.ts index a0c4e481d467a..727f3ba597336 100644 --- a/x-pack/plugins/security/server/routes/role_mapping/post.test.ts +++ b/x-pack/plugins/security/server/routes/role_mapping/post.test.ts @@ -5,9 +5,10 @@ * 2.0. */ -import { routeDefinitionParamsMock } from '../index.mock'; +import { kibanaResponseFactory } from 'src/core/server'; import { coreMock, httpServerMock } from 'src/core/server/mocks'; -import { kibanaResponseFactory } from '../../../../../../src/core/server'; + +import { routeDefinitionParamsMock } from '../index.mock'; import { defineRoleMappingPostRoutes } from './post'; describe('POST role mappings', () => { diff --git a/x-pack/plugins/security/server/routes/role_mapping/post.ts b/x-pack/plugins/security/server/routes/role_mapping/post.ts index e986599309a53..c76a169137053 100644 --- a/x-pack/plugins/security/server/routes/role_mapping/post.ts +++ b/x-pack/plugins/security/server/routes/role_mapping/post.ts @@ -6,9 +6,10 @@ */ import { schema } from '@kbn/config-schema'; -import { createLicensedRouteHandler } from '../licensed_route_handler'; + +import type { RouteDefinitionParams } from '../'; import { wrapError } from '../../errors'; -import { RouteDefinitionParams } from '..'; +import { createLicensedRouteHandler } from '../licensed_route_handler'; export function defineRoleMappingPostRoutes({ router }: RouteDefinitionParams) { router.post( diff --git a/x-pack/plugins/security/server/routes/session_management/extend.test.ts b/x-pack/plugins/security/server/routes/session_management/extend.test.ts index 34696e63a309e..4286cbfd0ed30 100644 --- a/x-pack/plugins/security/server/routes/session_management/extend.test.ts +++ b/x-pack/plugins/security/server/routes/session_management/extend.test.ts @@ -5,16 +5,13 @@ * 2.0. */ -import { - kibanaResponseFactory, - RequestHandler, - RouteConfig, -} from '../../../../../../src/core/server'; -import { defineSessionExtendRoutes } from './extend'; +import type { RequestHandler, RouteConfig } from 'src/core/server'; +import { kibanaResponseFactory } from 'src/core/server'; +import { httpServerMock } from 'src/core/server/mocks'; -import { httpServerMock } from '../../../../../../src/core/server/mocks'; import type { SecurityRequestHandlerContext, SecurityRouter } from '../../types'; import { routeDefinitionParamsMock } from '../index.mock'; +import { defineSessionExtendRoutes } from './extend'; describe('Extend session routes', () => { let router: jest.Mocked; diff --git a/x-pack/plugins/security/server/routes/session_management/extend.ts b/x-pack/plugins/security/server/routes/session_management/extend.ts index 8d438c351e7ee..0e89d6cb67981 100644 --- a/x-pack/plugins/security/server/routes/session_management/extend.ts +++ b/x-pack/plugins/security/server/routes/session_management/extend.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { RouteDefinitionParams } from '..'; +import type { RouteDefinitionParams } from '../'; /** * Defines routes required for the session extension. diff --git a/x-pack/plugins/security/server/routes/session_management/index.ts b/x-pack/plugins/security/server/routes/session_management/index.ts index 0778cc0f0b2f6..1348179386ce0 100644 --- a/x-pack/plugins/security/server/routes/session_management/index.ts +++ b/x-pack/plugins/security/server/routes/session_management/index.ts @@ -5,9 +5,9 @@ * 2.0. */ +import type { RouteDefinitionParams } from '../'; import { defineSessionExtendRoutes } from './extend'; import { defineSessionInfoRoutes } from './info'; -import { RouteDefinitionParams } from '..'; export function defineSessionManagementRoutes(params: RouteDefinitionParams) { defineSessionInfoRoutes(params); diff --git a/x-pack/plugins/security/server/routes/session_management/info.test.ts b/x-pack/plugins/security/server/routes/session_management/info.test.ts index 84db94f38d582..29c0865b8c561 100644 --- a/x-pack/plugins/security/server/routes/session_management/info.test.ts +++ b/x-pack/plugins/security/server/routes/session_management/info.test.ts @@ -5,19 +5,16 @@ * 2.0. */ -import { - kibanaResponseFactory, - RequestHandler, - RouteConfig, -} from '../../../../../../src/core/server'; import type { PublicMethodsOf } from '@kbn/utility-types'; -import { Session } from '../../session_management'; -import { defineSessionInfoRoutes } from './info'; -import type { SecurityRequestHandlerContext, SecurityRouter } from '../../types'; +import type { RequestHandler, RouteConfig } from 'src/core/server'; +import { kibanaResponseFactory } from 'src/core/server'; +import { httpServerMock } from 'src/core/server/mocks'; -import { httpServerMock } from '../../../../../../src/core/server/mocks'; +import type { Session } from '../../session_management'; import { sessionMock } from '../../session_management/session.mock'; +import type { SecurityRequestHandlerContext, SecurityRouter } from '../../types'; import { routeDefinitionParamsMock } from '../index.mock'; +import { defineSessionInfoRoutes } from './info'; describe('Info session routes', () => { let router: jest.Mocked; diff --git a/x-pack/plugins/security/server/routes/session_management/info.ts b/x-pack/plugins/security/server/routes/session_management/info.ts index 6cab44509f162..cfd76bb8abbc0 100644 --- a/x-pack/plugins/security/server/routes/session_management/info.ts +++ b/x-pack/plugins/security/server/routes/session_management/info.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { SessionInfo } from '../../../common/types'; -import { RouteDefinitionParams } from '..'; +import type { RouteDefinitionParams } from '../'; +import type { SessionInfo } from '../../../common/types'; /** * Defines routes required for the session info. diff --git a/x-pack/plugins/security/server/routes/users/change_password.test.ts b/x-pack/plugins/security/server/routes/users/change_password.test.ts index 0258b1af051d4..a97fce7ea4b19 100644 --- a/x-pack/plugins/security/server/routes/users/change_password.test.ts +++ b/x-pack/plugins/security/server/routes/users/change_password.test.ts @@ -6,25 +6,23 @@ */ import { errors } from 'elasticsearch'; -import { ObjectType } from '@kbn/config-schema'; + +import type { ObjectType } from '@kbn/config-schema'; import type { PublicMethodsOf } from '@kbn/utility-types'; import type { DeeplyMockedKeys } from '@kbn/utility-types/jest'; -import type { SecurityRequestHandlerContext, SecurityRouter } from '../../types'; -import { - Headers, - kibanaResponseFactory, - RequestHandler, - RouteConfig, -} from '../../../../../../src/core/server'; -import { AuthenticationResult, AuthenticationServiceStart } from '../../authentication'; -import { Session } from '../../session_management'; -import { defineChangeUserPasswordRoutes } from './change_password'; +import type { Headers, RequestHandler, RouteConfig } from 'src/core/server'; +import { kibanaResponseFactory } from 'src/core/server'; +import { coreMock, httpServerMock } from 'src/core/server/mocks'; -import { coreMock, httpServerMock } from '../../../../../../src/core/server/mocks'; import { mockAuthenticatedUser } from '../../../common/model/authenticated_user.mock'; +import type { AuthenticationServiceStart } from '../../authentication'; +import { AuthenticationResult } from '../../authentication'; +import { authenticationServiceMock } from '../../authentication/authentication_service.mock'; +import type { Session } from '../../session_management'; import { sessionMock } from '../../session_management/session.mock'; +import type { SecurityRequestHandlerContext, SecurityRouter } from '../../types'; import { routeDefinitionParamsMock } from '../index.mock'; -import { authenticationServiceMock } from '../../authentication/authentication_service.mock'; +import { defineChangeUserPasswordRoutes } from './change_password'; describe('Change password', () => { let router: jest.Mocked; diff --git a/x-pack/plugins/security/server/routes/users/change_password.ts b/x-pack/plugins/security/server/routes/users/change_password.ts index a3d0295f08d6a..d9863b5061391 100644 --- a/x-pack/plugins/security/server/routes/users/change_password.ts +++ b/x-pack/plugins/security/server/routes/users/change_password.ts @@ -6,14 +6,15 @@ */ import { schema } from '@kbn/config-schema'; + +import type { RouteDefinitionParams } from '../'; import { canUserChangePassword } from '../../../common/model'; -import { getErrorStatusCode, wrapIntoCustomErrorResponse } from '../../errors'; -import { createLicensedRouteHandler } from '../licensed_route_handler'; import { - HTTPAuthorizationHeader, BasicHTTPAuthorizationHeaderCredentials, + HTTPAuthorizationHeader, } from '../../authentication'; -import { RouteDefinitionParams } from '..'; +import { getErrorStatusCode, wrapIntoCustomErrorResponse } from '../../errors'; +import { createLicensedRouteHandler } from '../licensed_route_handler'; export function defineChangeUserPasswordRoutes({ getAuthenticationService, diff --git a/x-pack/plugins/security/server/routes/users/create_or_update.ts b/x-pack/plugins/security/server/routes/users/create_or_update.ts index a68fadd7622a1..6527d9afc9842 100644 --- a/x-pack/plugins/security/server/routes/users/create_or_update.ts +++ b/x-pack/plugins/security/server/routes/users/create_or_update.ts @@ -6,9 +6,10 @@ */ import { schema } from '@kbn/config-schema'; + +import type { RouteDefinitionParams } from '../'; import { wrapIntoCustomErrorResponse } from '../../errors'; import { createLicensedRouteHandler } from '../licensed_route_handler'; -import { RouteDefinitionParams } from '..'; export function defineCreateOrUpdateUserRoutes({ router }: RouteDefinitionParams) { router.post( diff --git a/x-pack/plugins/security/server/routes/users/delete.ts b/x-pack/plugins/security/server/routes/users/delete.ts index 34e02c9167700..767cda4b566a5 100644 --- a/x-pack/plugins/security/server/routes/users/delete.ts +++ b/x-pack/plugins/security/server/routes/users/delete.ts @@ -6,8 +6,9 @@ */ import { schema } from '@kbn/config-schema'; -import { RouteDefinitionParams } from '../index'; + import { wrapIntoCustomErrorResponse } from '../../errors'; +import type { RouteDefinitionParams } from '../index'; import { createLicensedRouteHandler } from '../licensed_route_handler'; export function defineDeleteUserRoutes({ router }: RouteDefinitionParams) { diff --git a/x-pack/plugins/security/server/routes/users/disable.ts b/x-pack/plugins/security/server/routes/users/disable.ts index 4f5ed71010f9a..0a5c4c03f4fb0 100644 --- a/x-pack/plugins/security/server/routes/users/disable.ts +++ b/x-pack/plugins/security/server/routes/users/disable.ts @@ -6,8 +6,9 @@ */ import { schema } from '@kbn/config-schema'; -import { RouteDefinitionParams } from '../index'; + import { wrapIntoCustomErrorResponse } from '../../errors'; +import type { RouteDefinitionParams } from '../index'; import { createLicensedRouteHandler } from '../licensed_route_handler'; export function defineDisableUserRoutes({ router }: RouteDefinitionParams) { diff --git a/x-pack/plugins/security/server/routes/users/enable.ts b/x-pack/plugins/security/server/routes/users/enable.ts index 749688e084d19..8f8d91cf42aca 100644 --- a/x-pack/plugins/security/server/routes/users/enable.ts +++ b/x-pack/plugins/security/server/routes/users/enable.ts @@ -6,8 +6,9 @@ */ import { schema } from '@kbn/config-schema'; -import { RouteDefinitionParams } from '../index'; + import { wrapIntoCustomErrorResponse } from '../../errors'; +import type { RouteDefinitionParams } from '../index'; import { createLicensedRouteHandler } from '../licensed_route_handler'; export function defineEnableUserRoutes({ router }: RouteDefinitionParams) { diff --git a/x-pack/plugins/security/server/routes/users/get.ts b/x-pack/plugins/security/server/routes/users/get.ts index 252a9778dae0e..28165ef32356d 100644 --- a/x-pack/plugins/security/server/routes/users/get.ts +++ b/x-pack/plugins/security/server/routes/users/get.ts @@ -6,9 +6,10 @@ */ import { schema } from '@kbn/config-schema'; + +import type { RouteDefinitionParams } from '../'; import { wrapIntoCustomErrorResponse } from '../../errors'; import { createLicensedRouteHandler } from '../licensed_route_handler'; -import { RouteDefinitionParams } from '..'; export function defineGetUserRoutes({ router }: RouteDefinitionParams) { router.get( diff --git a/x-pack/plugins/security/server/routes/users/get_all.ts b/x-pack/plugins/security/server/routes/users/get_all.ts index 8c17f4bfcbb51..5d28d98b684ec 100644 --- a/x-pack/plugins/security/server/routes/users/get_all.ts +++ b/x-pack/plugins/security/server/routes/users/get_all.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { RouteDefinitionParams } from '../index'; import { wrapIntoCustomErrorResponse } from '../../errors'; +import type { RouteDefinitionParams } from '../index'; import { createLicensedRouteHandler } from '../licensed_route_handler'; export function defineGetAllUsersRoutes({ router }: RouteDefinitionParams) { diff --git a/x-pack/plugins/security/server/routes/users/index.ts b/x-pack/plugins/security/server/routes/users/index.ts index 312086914cbc6..b6bb694b5efe6 100644 --- a/x-pack/plugins/security/server/routes/users/index.ts +++ b/x-pack/plugins/security/server/routes/users/index.ts @@ -5,14 +5,14 @@ * 2.0. */ -import { RouteDefinitionParams } from '../index'; -import { defineGetUserRoutes } from './get'; -import { defineGetAllUsersRoutes } from './get_all'; +import type { RouteDefinitionParams } from '../index'; +import { defineChangeUserPasswordRoutes } from './change_password'; import { defineCreateOrUpdateUserRoutes } from './create_or_update'; import { defineDeleteUserRoutes } from './delete'; import { defineDisableUserRoutes } from './disable'; import { defineEnableUserRoutes } from './enable'; -import { defineChangeUserPasswordRoutes } from './change_password'; +import { defineGetUserRoutes } from './get'; +import { defineGetAllUsersRoutes } from './get_all'; export function defineUsersRoutes(params: RouteDefinitionParams) { defineGetUserRoutes(params); diff --git a/x-pack/plugins/security/server/routes/views/access_agreement.test.ts b/x-pack/plugins/security/server/routes/views/access_agreement.test.ts index e4b4a6232d5e9..2679616b2be16 100644 --- a/x-pack/plugins/security/server/routes/views/access_agreement.test.ts +++ b/x-pack/plugins/security/server/routes/views/access_agreement.test.ts @@ -6,23 +6,23 @@ */ import type { PublicMethodsOf } from '@kbn/utility-types'; -import { - RequestHandler, - RouteConfig, - kibanaResponseFactory, +import type { HttpResources, HttpResourcesRequestHandler, -} from '../../../../../../src/core/server'; -import { SecurityLicense, SecurityLicenseFeatures } from '../../../common/licensing'; -import type { AuthenticationProvider } from '../../../common/model'; -import { ConfigType } from '../../config'; -import { Session } from '../../session_management'; -import { defineAccessAgreementRoutes } from './access_agreement'; -import type { SecurityRouter, SecurityRequestHandlerContext } from '../../types'; + RequestHandler, + RouteConfig, +} from 'src/core/server'; +import { kibanaResponseFactory } from 'src/core/server'; +import { httpResourcesMock, httpServerMock } from 'src/core/server/mocks'; -import { httpResourcesMock, httpServerMock } from '../../../../../../src/core/server/mocks'; +import type { SecurityLicense, SecurityLicenseFeatures } from '../../../common/licensing'; +import type { AuthenticationProvider } from '../../../common/model'; +import type { ConfigType } from '../../config'; +import type { Session } from '../../session_management'; import { sessionMock } from '../../session_management/session.mock'; +import type { SecurityRequestHandlerContext, SecurityRouter } from '../../types'; import { routeDefinitionParamsMock } from '../index.mock'; +import { defineAccessAgreementRoutes } from './access_agreement'; describe('Access agreement view routes', () => { let httpResources: jest.Mocked; diff --git a/x-pack/plugins/security/server/routes/views/access_agreement.ts b/x-pack/plugins/security/server/routes/views/access_agreement.ts index daf697bd23448..292c484690ec8 100644 --- a/x-pack/plugins/security/server/routes/views/access_agreement.ts +++ b/x-pack/plugins/security/server/routes/views/access_agreement.ts @@ -5,9 +5,9 @@ * 2.0. */ -import { ConfigType } from '../../config'; +import type { RouteDefinitionParams } from '../'; +import type { ConfigType } from '../../config'; import { createLicensedRouteHandler } from '../licensed_route_handler'; -import { RouteDefinitionParams } from '..'; /** * Defines routes required for the Access Agreement view. diff --git a/x-pack/plugins/security/server/routes/views/account_management.ts b/x-pack/plugins/security/server/routes/views/account_management.ts index 55d9dd1603602..bab0faedcd9cc 100644 --- a/x-pack/plugins/security/server/routes/views/account_management.ts +++ b/x-pack/plugins/security/server/routes/views/account_management.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { RouteDefinitionParams } from '..'; +import type { RouteDefinitionParams } from '../'; /** * Defines routes required for the Account Management view. diff --git a/x-pack/plugins/security/server/routes/views/capture_url.test.ts b/x-pack/plugins/security/server/routes/views/capture_url.test.ts index fb9fa4031f51a..0393a69276ff3 100644 --- a/x-pack/plugins/security/server/routes/views/capture_url.test.ts +++ b/x-pack/plugins/security/server/routes/views/capture_url.test.ts @@ -6,16 +6,12 @@ */ import { Type } from '@kbn/config-schema'; -import { - RouteConfig, - HttpResources, - HttpResourcesRequestHandler, -} from '../../../../../../src/core/server'; -import { defineCaptureURLRoutes } from './capture_url'; +import type { HttpResources, HttpResourcesRequestHandler, RouteConfig } from 'src/core/server'; +import { httpResourcesMock, httpServerMock } from 'src/core/server/mocks'; -import { httpResourcesMock, httpServerMock } from '../../../../../../src/core/server/mocks'; -import { routeDefinitionParamsMock } from '../index.mock'; import type { SecurityRequestHandlerContext } from '../../types'; +import { routeDefinitionParamsMock } from '../index.mock'; +import { defineCaptureURLRoutes } from './capture_url'; describe('Capture URL view routes', () => { let httpResources: jest.Mocked; diff --git a/x-pack/plugins/security/server/routes/views/capture_url.ts b/x-pack/plugins/security/server/routes/views/capture_url.ts index 92a1984160c3d..1ea1c8ad620e4 100644 --- a/x-pack/plugins/security/server/routes/views/capture_url.ts +++ b/x-pack/plugins/security/server/routes/views/capture_url.ts @@ -6,7 +6,8 @@ */ import { schema } from '@kbn/config-schema'; -import { RouteDefinitionParams } from '..'; + +import type { RouteDefinitionParams } from '../'; /** * Defines routes required for the Capture URL view. diff --git a/x-pack/plugins/security/server/routes/views/index.test.ts b/x-pack/plugins/security/server/routes/views/index.test.ts index 57d0e9ffffcbd..be85498f0bb1e 100644 --- a/x-pack/plugins/security/server/routes/views/index.test.ts +++ b/x-pack/plugins/security/server/routes/views/index.test.ts @@ -5,9 +5,8 @@ * 2.0. */ -import { defineViewRoutes } from '.'; - import { routeDefinitionParamsMock } from '../index.mock'; +import { defineViewRoutes } from './'; describe('View routes', () => { it('does not register Login routes if both `basic` and `token` providers are disabled', () => { diff --git a/x-pack/plugins/security/server/routes/views/index.ts b/x-pack/plugins/security/server/routes/views/index.ts index 8cd6798ae58b0..5993808d0cfb0 100644 --- a/x-pack/plugins/security/server/routes/views/index.ts +++ b/x-pack/plugins/security/server/routes/views/index.ts @@ -5,14 +5,14 @@ * 2.0. */ +import type { RouteDefinitionParams } from '../'; import { defineAccessAgreementRoutes } from './access_agreement'; import { defineAccountManagementRoutes } from './account_management'; +import { defineCaptureURLRoutes } from './capture_url'; import { defineLoggedOutRoutes } from './logged_out'; import { defineLoginRoutes } from './login'; import { defineLogoutRoutes } from './logout'; import { defineOverwrittenSessionRoutes } from './overwritten_session'; -import { defineCaptureURLRoutes } from './capture_url'; -import { RouteDefinitionParams } from '..'; export function defineViewRoutes(params: RouteDefinitionParams) { if ( diff --git a/x-pack/plugins/security/server/routes/views/logged_out.test.ts b/x-pack/plugins/security/server/routes/views/logged_out.test.ts index 5c665b6737fae..af973d1e060db 100644 --- a/x-pack/plugins/security/server/routes/views/logged_out.test.ts +++ b/x-pack/plugins/security/server/routes/views/logged_out.test.ts @@ -6,13 +6,13 @@ */ import type { PublicMethodsOf } from '@kbn/utility-types'; -import { HttpResourcesRequestHandler, RouteConfig } from '../../../../../../src/core/server'; -import { Session } from '../../session_management'; -import { defineLoggedOutRoutes } from './logged_out'; +import type { HttpResourcesRequestHandler, RouteConfig } from 'src/core/server'; +import { httpResourcesMock, httpServerMock } from 'src/core/server/mocks'; -import { httpServerMock, httpResourcesMock } from '../../../../../../src/core/server/mocks'; +import type { Session } from '../../session_management'; import { sessionMock } from '../../session_management/session.mock'; import { routeDefinitionParamsMock } from '../index.mock'; +import { defineLoggedOutRoutes } from './logged_out'; describe('LoggedOut view routes', () => { let session: jest.Mocked>; diff --git a/x-pack/plugins/security/server/routes/views/logged_out.ts b/x-pack/plugins/security/server/routes/views/logged_out.ts index 6f7a92a4229ca..8d22e4efc3ddc 100644 --- a/x-pack/plugins/security/server/routes/views/logged_out.ts +++ b/x-pack/plugins/security/server/routes/views/logged_out.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { RouteDefinitionParams } from '..'; +import type { RouteDefinitionParams } from '../'; /** * Defines routes required for the Logged Out view. diff --git a/x-pack/plugins/security/server/routes/views/login.test.ts b/x-pack/plugins/security/server/routes/views/login.test.ts index 96b3b5379d44f..6def1b7d77df3 100644 --- a/x-pack/plugins/security/server/routes/views/login.test.ts +++ b/x-pack/plugins/security/server/routes/views/login.test.ts @@ -6,26 +6,23 @@ */ import { URL } from 'url'; + import { Type } from '@kbn/config-schema'; -import { +import type { HttpResources, HttpResourcesRequestHandler, RequestHandler, - kibanaResponseFactory, RouteConfig, -} from '../../../../../../src/core/server'; -import { SecurityLicense } from '../../../common/licensing'; -import { LoginSelectorProvider } from '../../../common/login_state'; -import { ConfigType } from '../../config'; -import { defineLoginRoutes } from './login'; -import type { SecurityRouter, SecurityRequestHandlerContext } from '../../types'; - -import { - coreMock, - httpServerMock, - httpResourcesMock, -} from '../../../../../../src/core/server/mocks'; +} from 'src/core/server'; +import { kibanaResponseFactory } from 'src/core/server'; +import { coreMock, httpResourcesMock, httpServerMock } from 'src/core/server/mocks'; + +import type { SecurityLicense } from '../../../common/licensing'; +import type { LoginSelectorProvider } from '../../../common/login_state'; +import type { ConfigType } from '../../config'; +import type { SecurityRequestHandlerContext, SecurityRouter } from '../../types'; import { routeDefinitionParamsMock } from '../index.mock'; +import { defineLoginRoutes } from './login'; describe('Login view routes', () => { let httpResources: jest.Mocked; diff --git a/x-pack/plugins/security/server/routes/views/login.ts b/x-pack/plugins/security/server/routes/views/login.ts index 607e11a8379c5..990ac4075efe0 100644 --- a/x-pack/plugins/security/server/routes/views/login.ts +++ b/x-pack/plugins/security/server/routes/views/login.ts @@ -6,14 +6,15 @@ */ import { schema } from '@kbn/config-schema'; -import { parseNext } from '../../../common/parse_next'; -import { LoginState } from '../../../common/login_state'; -import { shouldProviderUseLoginForm } from '../../../common/model'; + +import type { RouteDefinitionParams } from '../'; import { LOGOUT_REASON_QUERY_STRING_PARAMETER, NEXT_URL_QUERY_STRING_PARAMETER, } from '../../../common/constants'; -import { RouteDefinitionParams } from '..'; +import type { LoginState } from '../../../common/login_state'; +import { shouldProviderUseLoginForm } from '../../../common/model'; +import { parseNext } from '../../../common/parse_next'; /** * Defines routes required for the Login view. diff --git a/x-pack/plugins/security/server/routes/views/logout.ts b/x-pack/plugins/security/server/routes/views/logout.ts index 8c41a8443b497..5e5d5c0bb6f01 100644 --- a/x-pack/plugins/security/server/routes/views/logout.ts +++ b/x-pack/plugins/security/server/routes/views/logout.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { RouteDefinitionParams } from '..'; +import type { RouteDefinitionParams } from '../'; /** * Defines routes required for the Logout out view. diff --git a/x-pack/plugins/security/server/routes/views/overwritten_session.ts b/x-pack/plugins/security/server/routes/views/overwritten_session.ts index 9115044a77687..7ed5cffbc56f8 100644 --- a/x-pack/plugins/security/server/routes/views/overwritten_session.ts +++ b/x-pack/plugins/security/server/routes/views/overwritten_session.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { RouteDefinitionParams } from '..'; +import type { RouteDefinitionParams } from '../'; /** * Defines routes required for the Overwritten Session view. diff --git a/x-pack/plugins/security/server/saved_objects/index.ts b/x-pack/plugins/security/server/saved_objects/index.ts index 494adbd15c0df..e052fd1c7ab6a 100644 --- a/x-pack/plugins/security/server/saved_objects/index.ts +++ b/x-pack/plugins/security/server/saved_objects/index.ts @@ -5,16 +5,13 @@ * 2.0. */ -import { - CoreSetup, - KibanaRequest, - LegacyRequest, - SavedObjectsClient, -} from '../../../../../src/core/server'; +import type { CoreSetup, LegacyRequest } from 'src/core/server'; + +import { KibanaRequest, SavedObjectsClient } from '../../../../../src/core/server'; +import type { AuditServiceSetup, SecurityAuditLogger } from '../audit'; +import type { AuthorizationServiceSetup } from '../authorization'; +import type { SpacesService } from '../plugin'; import { SecureSavedObjectsClientWrapper } from './secure_saved_objects_client_wrapper'; -import { AuthorizationServiceSetup } from '../authorization'; -import { SecurityAuditLogger, AuditServiceSetup } from '../audit'; -import { SpacesService } from '../plugin'; interface SetupSavedObjectsParams { legacyAuditLogger: SecurityAuditLogger; diff --git a/x-pack/plugins/security/server/saved_objects/secure_saved_objects_client_wrapper.test.ts b/x-pack/plugins/security/server/saved_objects/secure_saved_objects_client_wrapper.test.ts index 1293d3f2c84a3..803b36e520a2f 100644 --- a/x-pack/plugins/security/server/saved_objects/secure_saved_objects_client_wrapper.test.ts +++ b/x-pack/plugins/security/server/saved_objects/secure_saved_objects_client_wrapper.test.ts @@ -5,17 +5,19 @@ * 2.0. */ -import { SecureSavedObjectsClientWrapper } from './secure_saved_objects_client_wrapper'; +import type { SavedObjectsClientContract } from 'src/core/server'; +import { httpServerMock, savedObjectsClientMock } from 'src/core/server/mocks'; + +import type { AuditEvent } from '../audit'; +import { EventOutcome } from '../audit'; +import { auditServiceMock, securityAuditLoggerMock } from '../audit/index.mock'; import { Actions } from '../authorization'; -import { securityAuditLoggerMock, auditServiceMock } from '../audit/index.mock'; -import { savedObjectsClientMock, httpServerMock } from '../../../../../src/core/server/mocks'; -import { SavedObjectsClientContract } from 'kibana/server'; -import { SavedObjectActions } from '../authorization/actions/saved_object'; -import { AuditEvent, EventOutcome } from '../audit'; +import type { SavedObjectActions } from '../authorization/actions/saved_object'; +import { SecureSavedObjectsClientWrapper } from './secure_saved_objects_client_wrapper'; -jest.mock('../../../../../src/core/server/saved_objects/service/lib/utils', () => { +jest.mock('src/core/server/saved_objects/service/lib/utils', () => { const { SavedObjectsUtils } = jest.requireActual( - '../../../../../src/core/server/saved_objects/service/lib/utils' + 'src/core/server/saved_objects/service/lib/utils' ); return { SavedObjectsUtils: { diff --git a/x-pack/plugins/security/server/saved_objects/secure_saved_objects_client_wrapper.ts b/x-pack/plugins/security/server/saved_objects/secure_saved_objects_client_wrapper.ts index 73bee302363ab..1858bc7108dc9 100644 --- a/x-pack/plugins/security/server/saved_objects/secure_saved_objects_client_wrapper.ts +++ b/x-pack/plugins/security/server/saved_objects/secure_saved_objects_client_wrapper.ts @@ -6,7 +6,7 @@ */ import type { PublicMethodsOf } from '@kbn/utility-types'; -import { +import type { SavedObjectsAddToNamespacesOptions, SavedObjectsBaseOptions, SavedObjectsBulkCreateObject, @@ -14,26 +14,22 @@ import { SavedObjectsBulkUpdateObject, SavedObjectsCheckConflictsObject, SavedObjectsClientContract, + SavedObjectsClosePointInTimeOptions, SavedObjectsCreateOptions, SavedObjectsDeleteFromNamespacesOptions, SavedObjectsFindOptions, SavedObjectsOpenPointInTimeOptions, - SavedObjectsClosePointInTimeOptions, SavedObjectsRemoveReferencesToOptions, SavedObjectsUpdateOptions, - SavedObjectsUtils, -} from '../../../../../src/core/server'; +} from 'src/core/server'; + +import { SavedObjectsUtils } from '../../../../../src/core/server'; import { ALL_SPACES_ID, UNKNOWN_SPACE } from '../../common/constants'; -import { - AuditLogger, - EventOutcome, - SavedObjectAction, - savedObjectEvent, - SecurityAuditLogger, -} from '../audit'; -import { Actions, CheckSavedObjectsPrivileges } from '../authorization'; -import { CheckPrivilegesResponse } from '../authorization/types'; -import { SpacesService } from '../plugin'; +import type { AuditLogger, SecurityAuditLogger } from '../audit'; +import { EventOutcome, SavedObjectAction, savedObjectEvent } from '../audit'; +import type { Actions, CheckSavedObjectsPrivileges } from '../authorization'; +import type { CheckPrivilegesResponse } from '../authorization/types'; +import type { SpacesService } from '../plugin'; interface SecureSavedObjectsClientWrapperOptions { actions: Actions; diff --git a/x-pack/plugins/security/server/session_management/session.mock.ts b/x-pack/plugins/security/server/session_management/session.mock.ts index 1be8adb94acbb..dfe1293f57e92 100644 --- a/x-pack/plugins/security/server/session_management/session.mock.ts +++ b/x-pack/plugins/security/server/session_management/session.mock.ts @@ -6,8 +6,9 @@ */ import type { PublicMethodsOf } from '@kbn/utility-types'; + import { mockAuthenticatedUser } from '../../common/model/authenticated_user.mock'; -import { Session, SessionValue } from './session'; +import type { Session, SessionValue } from './session'; import { sessionIndexMock } from './session_index.mock'; export const sessionMock = { diff --git a/x-pack/plugins/security/server/session_management/session.test.ts b/x-pack/plugins/security/server/session_management/session.test.ts index f3e3be79af655..bd94c9483d561 100644 --- a/x-pack/plugins/security/server/session_management/session.test.ts +++ b/x-pack/plugins/security/server/session_management/session.test.ts @@ -5,17 +5,19 @@ * 2.0. */ -import crypto from 'crypto'; import nodeCrypto from '@elastic/node-crypto'; +import crypto from 'crypto'; + import type { PublicMethodsOf } from '@kbn/utility-types'; -import { ConfigSchema, createConfig } from '../config'; -import { Session, SessionValueContentToEncrypt } from './session'; -import { SessionIndex } from './session_index'; -import { SessionCookie } from './session_cookie'; +import { httpServerMock, loggingSystemMock } from 'src/core/server/mocks'; -import { loggingSystemMock, httpServerMock } from '../../../../../src/core/server/mocks'; -import { sessionMock, sessionCookieMock, sessionIndexMock } from './index.mock'; import { mockAuthenticatedUser } from '../../common/model/authenticated_user.mock'; +import { ConfigSchema, createConfig } from '../config'; +import { sessionCookieMock, sessionIndexMock, sessionMock } from './index.mock'; +import type { SessionValueContentToEncrypt } from './session'; +import { Session } from './session'; +import type { SessionCookie } from './session_cookie'; +import type { SessionIndex } from './session_index'; describe('Session', () => { const now = 123456; diff --git a/x-pack/plugins/security/server/session_management/session.ts b/x-pack/plugins/security/server/session_management/session.ts index eaffe44976c7f..7fada4d1730cd 100644 --- a/x-pack/plugins/security/server/session_management/session.ts +++ b/x-pack/plugins/security/server/session_management/session.ts @@ -5,15 +5,18 @@ * 2.0. */ +import type { Crypto } from '@elastic/node-crypto'; +import nodeCrypto from '@elastic/node-crypto'; +import { createHash, randomBytes } from 'crypto'; import { promisify } from 'util'; -import { randomBytes, createHash } from 'crypto'; -import nodeCrypto, { Crypto } from '@elastic/node-crypto'; + import type { PublicMethodsOf } from '@kbn/utility-types'; -import type { KibanaRequest, Logger } from '../../../../../src/core/server'; +import type { KibanaRequest, Logger } from 'src/core/server'; + import type { AuthenticationProvider } from '../../common/model'; import type { ConfigType } from '../config'; -import type { SessionIndex, SessionIndexValue } from './session_index'; import type { SessionCookie } from './session_cookie'; +import type { SessionIndex, SessionIndexValue } from './session_index'; /** * The shape of the value that represents user's session information. diff --git a/x-pack/plugins/security/server/session_management/session_cookie.mock.ts b/x-pack/plugins/security/server/session_management/session_cookie.mock.ts index dc8a9ce1c717b..ff3b6e717e65c 100644 --- a/x-pack/plugins/security/server/session_management/session_cookie.mock.ts +++ b/x-pack/plugins/security/server/session_management/session_cookie.mock.ts @@ -6,7 +6,8 @@ */ import type { PublicMethodsOf } from '@kbn/utility-types'; -import { SessionCookie, SessionCookieValue } from './session_cookie'; + +import type { SessionCookie, SessionCookieValue } from './session_cookie'; export const sessionCookieMock = { create: (): jest.Mocked> => ({ diff --git a/x-pack/plugins/security/server/session_management/session_cookie.test.ts b/x-pack/plugins/security/server/session_management/session_cookie.test.ts index 58e08d8abb6b5..eeca0f23f22b8 100644 --- a/x-pack/plugins/security/server/session_management/session_cookie.test.ts +++ b/x-pack/plugins/security/server/session_management/session_cookie.test.ts @@ -5,15 +5,16 @@ * 2.0. */ -import { SessionStorage } from '../../../../../src/core/server'; -import { SessionCookie, SessionCookieOptions } from './session_cookie'; - +import type { SessionStorage } from 'src/core/server'; import { - loggingSystemMock, + httpServerMock, httpServiceMock, + loggingSystemMock, sessionStorageMock, - httpServerMock, -} from '../../../../../src/core/server/mocks'; +} from 'src/core/server/mocks'; + +import type { SessionCookieOptions } from './session_cookie'; +import { SessionCookie } from './session_cookie'; import { sessionCookieMock } from './session_cookie.mock'; describe('Session cookie', () => { diff --git a/x-pack/plugins/security/server/session_management/session_cookie.ts b/x-pack/plugins/security/server/session_management/session_cookie.ts index d4a5da46acc2e..964d3d07a39a2 100644 --- a/x-pack/plugins/security/server/session_management/session_cookie.ts +++ b/x-pack/plugins/security/server/session_management/session_cookie.ts @@ -5,13 +5,14 @@ * 2.0. */ -import { +import type { HttpServiceSetup, KibanaRequest, Logger, SessionStorageFactory, -} from '../../../../../src/core/server'; -import { ConfigType } from '../config'; +} from 'src/core/server'; + +import type { ConfigType } from '../config'; /** * Represents shape of the session value stored in the cookie. diff --git a/x-pack/plugins/security/server/session_management/session_index.mock.ts b/x-pack/plugins/security/server/session_management/session_index.mock.ts index ca727f1213048..56049a3ae9205 100644 --- a/x-pack/plugins/security/server/session_management/session_index.mock.ts +++ b/x-pack/plugins/security/server/session_management/session_index.mock.ts @@ -6,7 +6,8 @@ */ import type { PublicMethodsOf } from '@kbn/utility-types'; -import { SessionIndex, SessionIndexValue } from './session_index'; + +import type { SessionIndex, SessionIndexValue } from './session_index'; export const sessionIndexMock = { create: (): jest.Mocked> => ({ diff --git a/x-pack/plugins/security/server/session_management/session_index.test.ts b/x-pack/plugins/security/server/session_management/session_index.test.ts index b9d0f9506fec8..2b3ec0adeb51e 100644 --- a/x-pack/plugins/security/server/session_management/session_index.test.ts +++ b/x-pack/plugins/security/server/session_management/session_index.test.ts @@ -6,13 +6,14 @@ */ import { errors } from '@elastic/elasticsearch'; -import { DeeplyMockedKeys } from '@kbn/utility-types/jest'; -import { ElasticsearchClient } from '../../../../../src/core/server'; -import { ConfigSchema, createConfig } from '../config'; -import { getSessionIndexTemplate, SessionIndex } from './session_index'; -import { loggingSystemMock, elasticsearchServiceMock } from '../../../../../src/core/server/mocks'; +import type { DeeplyMockedKeys } from '@kbn/utility-types/jest'; +import type { ElasticsearchClient } from 'src/core/server'; +import { elasticsearchServiceMock, loggingSystemMock } from 'src/core/server/mocks'; + +import { ConfigSchema, createConfig } from '../config'; import { securityMock } from '../mocks'; +import { getSessionIndexTemplate, SessionIndex } from './session_index'; import { sessionIndexMock } from './session_index.mock'; describe('Session index', () => { diff --git a/x-pack/plugins/security/server/session_management/session_index.ts b/x-pack/plugins/security/server/session_management/session_index.ts index 934d43924c787..828c8fa11acdd 100644 --- a/x-pack/plugins/security/server/session_management/session_index.ts +++ b/x-pack/plugins/security/server/session_management/session_index.ts @@ -5,7 +5,8 @@ * 2.0. */ -import type { ElasticsearchClient, Logger } from '../../../../../src/core/server'; +import type { ElasticsearchClient, Logger } from 'src/core/server'; + import type { AuthenticationProvider } from '../../common/model'; import type { ConfigType } from '../config'; diff --git a/x-pack/plugins/security/server/session_management/session_management_service.test.ts b/x-pack/plugins/security/server/session_management/session_management_service.test.ts index baee05dce4585..7e99181981e85 100644 --- a/x-pack/plugins/security/server/session_management/session_management_service.test.ts +++ b/x-pack/plugins/security/server/session_management/session_management_service.test.ts @@ -6,23 +6,23 @@ */ import { Subject } from 'rxjs'; + +import { nextTick } from '@kbn/test/jest'; +import { coreMock, elasticsearchServiceMock, loggingSystemMock } from 'src/core/server/mocks'; + +import type { + TaskManagerStartContract, + TaskRunCreatorFunction, +} from '../../../task_manager/server'; +import { taskManagerMock } from '../../../task_manager/server/mocks'; import { ConfigSchema, createConfig } from '../config'; -import { OnlineStatusRetryScheduler } from '../elasticsearch'; -import { - SessionManagementService, - SESSION_INDEX_CLEANUP_TASK_NAME, -} from './session_management_service'; +import type { OnlineStatusRetryScheduler } from '../elasticsearch'; import { Session } from './session'; import { SessionIndex } from './session_index'; - -import { nextTick } from '@kbn/test/jest'; import { - coreMock, - elasticsearchServiceMock, - loggingSystemMock, -} from '../../../../../src/core/server/mocks'; -import { taskManagerMock } from '../../../task_manager/server/mocks'; -import { TaskManagerStartContract, TaskRunCreatorFunction } from '../../../task_manager/server'; + SESSION_INDEX_CLEANUP_TASK_NAME, + SessionManagementService, +} from './session_management_service'; describe('SessionManagementService', () => { let service: SessionManagementService; diff --git a/x-pack/plugins/security/server/session_management/session_management_service.ts b/x-pack/plugins/security/server/session_management/session_management_service.ts index a3b2c999115fd..fcd8e8c53cbe5 100644 --- a/x-pack/plugins/security/server/session_management/session_management_service.ts +++ b/x-pack/plugins/security/server/session_management/session_management_service.ts @@ -5,19 +5,20 @@ * 2.0. */ -import { Observable, Subscription } from 'rxjs'; -import { - ElasticsearchClient, - HttpServiceSetup, - Logger, - SavedObjectsErrorHelpers, -} from '../../../../../src/core/server'; -import { TaskManagerSetupContract, TaskManagerStartContract } from '../../../task_manager/server'; -import { ConfigType } from '../config'; -import { OnlineStatusRetryScheduler } from '../elasticsearch'; +import type { Observable, Subscription } from 'rxjs'; + +import type { ElasticsearchClient, HttpServiceSetup, Logger } from 'src/core/server'; + +import { SavedObjectsErrorHelpers } from '../../../../../src/core/server'; +import type { + TaskManagerSetupContract, + TaskManagerStartContract, +} from '../../../task_manager/server'; +import type { ConfigType } from '../config'; +import type { OnlineStatusRetryScheduler } from '../elasticsearch'; +import { Session } from './session'; import { SessionCookie } from './session_cookie'; import { SessionIndex } from './session_index'; -import { Session } from './session'; export interface SessionManagementServiceSetupParams { readonly http: Pick; diff --git a/x-pack/plugins/security/server/spaces/legacy_audit_logger.ts b/x-pack/plugins/security/server/spaces/legacy_audit_logger.ts index 0e36b29a5ba32..3ac4859eb7c8a 100644 --- a/x-pack/plugins/security/server/spaces/legacy_audit_logger.ts +++ b/x-pack/plugins/security/server/spaces/legacy_audit_logger.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { LegacyAuditLogger } from '../audit'; +import type { LegacyAuditLogger } from '../audit'; /** * @deprecated will be removed in 8.0 diff --git a/x-pack/plugins/security/server/spaces/secure_spaces_client_wrapper.test.ts b/x-pack/plugins/security/server/spaces/secure_spaces_client_wrapper.test.ts index fad839215392f..3f17d18bbe5f7 100644 --- a/x-pack/plugins/security/server/spaces/secure_spaces_client_wrapper.test.ts +++ b/x-pack/plugins/security/server/spaces/secure_spaces_client_wrapper.test.ts @@ -5,21 +5,20 @@ * 2.0. */ -import { httpServerMock } from '../../../../../src/core/server/mocks'; - -import { SecureSpacesClientWrapper } from './secure_spaces_client_wrapper'; +import { deepFreeze } from '@kbn/std'; +import { SavedObjectsErrorHelpers } from 'src/core/server'; +import { httpServerMock } from 'src/core/server/mocks'; +import type { GetAllSpacesPurpose, Space } from '../../../spaces/server'; import { spacesClientMock } from '../../../spaces/server/mocks'; +import type { AuditEvent, AuditLogger } from '../audit'; +import { EventOutcome, SpaceAuditAction } from '../audit'; import { auditServiceMock } from '../audit/index.mock'; -import { deepFreeze } from '@kbn/std'; -import { Space } from '../../../spaces/server'; +import type { AuthorizationServiceSetup } from '../authorization'; import { authorizationMock } from '../authorization/index.mock'; -import { AuthorizationServiceSetup } from '../authorization'; -import { GetAllSpacesPurpose } from '../../../spaces/server'; -import { CheckPrivilegesResponse } from '../authorization/types'; -import { LegacySpacesAuditLogger } from './legacy_audit_logger'; -import { SavedObjectsErrorHelpers } from 'src/core/server'; -import { AuditLogger, AuditEvent, EventOutcome, SpaceAuditAction } from '../audit'; +import type { CheckPrivilegesResponse } from '../authorization/types'; +import type { LegacySpacesAuditLogger } from './legacy_audit_logger'; +import { SecureSpacesClientWrapper } from './secure_spaces_client_wrapper'; interface Opts { securityEnabled?: boolean; diff --git a/x-pack/plugins/security/server/spaces/secure_spaces_client_wrapper.ts b/x-pack/plugins/security/server/spaces/secure_spaces_client_wrapper.ts index b25131e209fcf..7257dc625d4b4 100644 --- a/x-pack/plugins/security/server/spaces/secure_spaces_client_wrapper.ts +++ b/x-pack/plugins/security/server/spaces/secure_spaces_client_wrapper.ts @@ -6,18 +6,21 @@ */ import Boom from '@hapi/boom'; -import { KibanaRequest } from 'src/core/server'; -import { - Space, - ISpacesClient, + +import type { KibanaRequest } from 'src/core/server'; + +import type { GetAllSpacesOptions, GetAllSpacesPurpose, GetSpaceResult, + ISpacesClient, + Space, } from '../../../spaces/server'; -import { LegacySpacesAuditLogger } from './legacy_audit_logger'; -import { AuthorizationServiceSetup } from '../authorization'; -import { AuditLogger, EventOutcome, SpaceAuditAction, spaceAuditEvent } from '../audit'; -import { SecurityPluginSetup } from '..'; +import type { AuditLogger } from '../audit'; +import { EventOutcome, SpaceAuditAction, spaceAuditEvent } from '../audit'; +import type { AuthorizationServiceSetup } from '../authorization'; +import type { SecurityPluginSetup } from '../plugin'; +import type { LegacySpacesAuditLogger } from './legacy_audit_logger'; const PURPOSE_PRIVILEGE_MAP: Record< GetAllSpacesPurpose, diff --git a/x-pack/plugins/security/server/spaces/setup_spaces_client.test.ts b/x-pack/plugins/security/server/spaces/setup_spaces_client.test.ts index b3ee39425cb44..a6849c7ea9a86 100644 --- a/x-pack/plugins/security/server/spaces/setup_spaces_client.test.ts +++ b/x-pack/plugins/security/server/spaces/setup_spaces_client.test.ts @@ -5,10 +5,9 @@ * 2.0. */ -import { coreMock, httpServerMock } from '../../../../../src/core/server/mocks'; +import { coreMock, httpServerMock } from 'src/core/server/mocks'; import { spacesMock } from '../../../spaces/server/mocks'; - import { auditServiceMock } from '../audit/index.mock'; import { authorizationMock } from '../authorization/index.mock'; import { setupSpacesClient } from './setup_spaces_client'; diff --git a/x-pack/plugins/security/server/spaces/setup_spaces_client.ts b/x-pack/plugins/security/server/spaces/setup_spaces_client.ts index 6952117a82b32..2344d3e8c69d6 100644 --- a/x-pack/plugins/security/server/spaces/setup_spaces_client.ts +++ b/x-pack/plugins/security/server/spaces/setup_spaces_client.ts @@ -5,9 +5,9 @@ * 2.0. */ -import { SpacesPluginSetup } from '../../../spaces/server'; -import { AuditServiceSetup } from '../audit'; -import { AuthorizationServiceSetup } from '../authorization'; +import type { SpacesPluginSetup } from '../../../spaces/server'; +import type { AuditServiceSetup } from '../audit'; +import type { AuthorizationServiceSetup } from '../authorization'; import { LegacySpacesAuditLogger } from './legacy_audit_logger'; import { SecureSpacesClientWrapper } from './secure_spaces_client_wrapper'; diff --git a/x-pack/plugins/security/server/types.ts b/x-pack/plugins/security/server/types.ts index 5329b1721f226..1ce8a19d46180 100644 --- a/x-pack/plugins/security/server/types.ts +++ b/x-pack/plugins/security/server/types.ts @@ -6,6 +6,7 @@ */ import type { IRouter, RequestHandlerContext } from 'src/core/server'; + import type { LicensingApiRequestHandlerContext } from '../../licensing/server'; /** diff --git a/x-pack/plugins/security/server/usage_collector/security_usage_collector.test.ts b/x-pack/plugins/security/server/usage_collector/security_usage_collector.test.ts index b1fa04cc4e32b..6a1f6662e796e 100644 --- a/x-pack/plugins/security/server/usage_collector/security_usage_collector.test.ts +++ b/x-pack/plugins/security/server/usage_collector/security_usage_collector.test.ts @@ -5,16 +5,17 @@ * 2.0. */ -import { createConfig, ConfigSchema } from '../config'; +import type { TypeOf } from '@kbn/config-schema'; import { loggingSystemMock } from 'src/core/server/mocks'; -import { TypeOf } from '@kbn/config-schema'; import { - usageCollectionPluginMock, createCollectorFetchContextMock, + usageCollectionPluginMock, } from 'src/plugins/usage_collection/server/mocks'; -import { registerSecurityUsageCollector } from './security_usage_collector'; + +import type { SecurityLicenseFeatures } from '../../common/licensing'; import { licenseMock } from '../../common/licensing/index.mock'; -import { SecurityLicenseFeatures } from '../../common/licensing'; +import { ConfigSchema, createConfig } from '../config'; +import { registerSecurityUsageCollector } from './security_usage_collector'; describe('Security UsageCollector', () => { const createSecurityConfig = (config: TypeOf) => { diff --git a/x-pack/plugins/security/server/usage_collector/security_usage_collector.ts b/x-pack/plugins/security/server/usage_collector/security_usage_collector.ts index fd7be38f2ea36..a59951f5fcfe2 100644 --- a/x-pack/plugins/security/server/usage_collector/security_usage_collector.ts +++ b/x-pack/plugins/security/server/usage_collector/security_usage_collector.ts @@ -5,9 +5,10 @@ * 2.0. */ -import { UsageCollectionSetup } from 'src/plugins/usage_collection/server'; -import { ConfigType } from '../config'; -import { SecurityLicense } from '../../common/licensing'; +import type { UsageCollectionSetup } from 'src/plugins/usage_collection/server'; + +import type { SecurityLicense } from '../../common/licensing'; +import type { ConfigType } from '../config'; interface Usage { auditLoggingEnabled: boolean;