[ResponseOps] consistent-type-imports linting rule for RO packages/plugins - PR2 (#212366)

- Enabled @typescript-eslint/consistent-type-imports eslint rule for
ResponseOps packages and plugins:
- this rule ensures that imports used only for type declarations are
consistently written using import type syntax
    
- fixed eslint errors for:
    - `x-pack/platform/plugins/shared/actions`
    - `x-pack/platform/plugins/shared/stack_alerts`
    - `x-pack/platform/plugins/shared/stack_connectors`
    - `x-pack/platform/plugins/shared/triggers_actions_ui`

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Georgiana-Andreea Onoleață 2025-03-12 15:29:44 +02:00 committed by GitHub
parent 58fc183151
commit 6f07d18265
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
588 changed files with 1788 additions and 1749 deletions

View file

@ -1636,6 +1636,10 @@ module.exports = {
files: [
'src/platform/packages/shared/response-ops/**/*.{ts, tsx}',
'x-pack/platform/plugins/shared/alerting/**/*.{ts,tsx}',
'x-pack/platform/plugins/shared/actions/**/*.{ts,tsx}',
'x-pack/platform/plugins/shared/stack_alerts/**/*.{ts, tsx}',
'x-pack/platform/plugins/shared/stack_connectors/**/*.{ts, tsx}',
'x-pack/platform/plugins/shared/triggers_actions_ui/**/*.{ts, tsx}',
],
rules: {
'@typescript-eslint/consistent-type-imports': 'error',

View file

@ -6,6 +6,6 @@
*/
import type { TypeOf } from '@kbn/config-schema';
import { connectorTypesQuerySchemaV1 } from '..';
import type { connectorTypesQuerySchemaV1 } from '..';
export type ConnectorTypesRequestQuery = TypeOf<typeof connectorTypesQuerySchemaV1>;

View file

@ -6,7 +6,7 @@
*/
import type { TypeOf } from '@kbn/config-schema';
import { createConnectorRequestParamsSchemaV1, createConnectorRequestBodySchemaV1 } from '..';
import type { createConnectorRequestParamsSchemaV1, createConnectorRequestBodySchemaV1 } from '..';
export type CreateConnectorRequestParams = TypeOf<typeof createConnectorRequestParamsSchemaV1>;
export type CreateConnectorRequestBody = TypeOf<typeof createConnectorRequestBodySchemaV1>;

View file

@ -6,6 +6,6 @@
*/
import type { TypeOf } from '@kbn/config-schema';
import { deleteConnectorRequestParamsSchemaV1 } from '..';
import type { deleteConnectorRequestParamsSchemaV1 } from '..';
export type DeleteConnectorRequestParams = TypeOf<typeof deleteConnectorRequestParamsSchemaV1>;

View file

@ -6,7 +6,10 @@
*/
import type { TypeOf } from '@kbn/config-schema';
import { executeConnectorRequestParamsSchemaV1, executeConnectorRequestBodySchemaV1 } from '..';
import type {
executeConnectorRequestParamsSchemaV1,
executeConnectorRequestBodySchemaV1,
} from '..';
export type ExecuteConnectorRequestParams = TypeOf<typeof executeConnectorRequestParamsSchemaV1>;
export type ExecuteConnectorRequestBody = TypeOf<typeof executeConnectorRequestBodySchemaV1>;

View file

@ -6,6 +6,6 @@
*/
import type { TypeOf } from '@kbn/config-schema';
import { getConnectorParamsSchemaV1 } from '..';
import type { getConnectorParamsSchemaV1 } from '..';
export type GetConnectorParams = TypeOf<typeof getConnectorParamsSchemaV1>;

View file

@ -6,7 +6,7 @@
*/
import type { TypeOf } from '@kbn/config-schema';
import { updateConnectorBodySchemaV1, updateConnectorParamsSchemaV1 } from '..';
import type { updateConnectorBodySchemaV1, updateConnectorParamsSchemaV1 } from '..';
export type UpdateConnectorParams = TypeOf<typeof updateConnectorParamsSchemaV1>;
export type UpdateConnectorBody = TypeOf<typeof updateConnectorBodySchemaV1>;

View file

@ -5,8 +5,8 @@
* 2.0.
*/
import { TypeOf } from '@kbn/config-schema';
import {
import type { TypeOf } from '@kbn/config-schema';
import type {
connectorResponseSchemaV1,
connectorTypesResponseSchemaV1,
allConnectorsResponseSchema,

View file

@ -5,9 +5,9 @@
* 2.0.
*/
import { SUB_FEATURE } from '@kbn/actions-types';
import { LicenseType } from '@kbn/licensing-plugin/common/types';
import { TaskErrorSource } from '@kbn/task-manager-plugin/common';
import type { SUB_FEATURE } from '@kbn/actions-types';
import type { LicenseType } from '@kbn/licensing-plugin/common/types';
import type { TaskErrorSource } from '@kbn/task-manager-plugin/common';
export type SubFeature = keyof typeof SUB_FEATURE;

View file

@ -5,7 +5,8 @@
* 2.0.
*/
import { ValidatedEmail, InvalidEmailReason } from './types';
import type { ValidatedEmail } from './types';
import { InvalidEmailReason } from './types';
import {
validateEmailAddressesAsAlwaysValid,
validateEmailAddresses,

View file

@ -6,7 +6,8 @@
*/
import { parseAddressList } from 'email-addresses';
import { ValidatedEmail, InvalidEmailReason } from './types';
import type { ValidatedEmail } from './types';
import { InvalidEmailReason } from './types';
import { hasMustacheTemplate } from './mustache_template';
/** Options that can be used when validating email addresses */

View file

@ -5,8 +5,9 @@
* 2.0.
*/
import { PluginInitializerContext } from '@kbn/core/public';
import { Plugin, ActionsPublicPluginSetup } from './plugin';
import type { PluginInitializerContext } from '@kbn/core/public';
import type { ActionsPublicPluginSetup } from './plugin';
import { Plugin } from './plugin';
export type { ActionsPublicPluginSetup };
export { Plugin };

View file

@ -5,12 +5,9 @@
* 2.0.
*/
import { Plugin as CorePlugin, PluginInitializerContext } from '@kbn/core/public';
import {
ValidatedEmail,
validateEmailAddresses as validateEmails,
ValidateEmailAddressesOptions,
} from '../common';
import type { Plugin as CorePlugin, PluginInitializerContext } from '@kbn/core/public';
import type { ValidatedEmail, ValidateEmailAddressesOptions } from '../common';
import { validateEmailAddresses as validateEmails } from '../common';
export interface ActionsPublicPluginSetup {
validateEmailAddresses(

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { ActionTypeRegistryContract } from './types';
import type { ActionTypeRegistryContract } from './types';
const createActionTypeRegistryMock = () => {
const mocked: jest.Mocked<ActionTypeRegistryContract> = {

View file

@ -8,12 +8,14 @@
import { TaskCost } from '@kbn/task-manager-plugin/server';
import { taskManagerMock } from '@kbn/task-manager-plugin/server/mocks';
import { schema } from '@kbn/config-schema';
import { ActionTypeRegistry, ActionTypeRegistryOpts } from './action_type_registry';
import { ActionType, ExecutorType } from './types';
import { ActionExecutionSourceType, ActionExecutor, ILicenseState, TaskRunnerFactory } from './lib';
import type { ActionTypeRegistryOpts } from './action_type_registry';
import { ActionTypeRegistry } from './action_type_registry';
import type { ActionType, ExecutorType } from './types';
import type { ILicenseState } from './lib';
import { ActionExecutionSourceType, ActionExecutor, TaskRunnerFactory } from './lib';
import { actionsConfigMock } from './actions_config.mock';
import { licenseStateMock } from './lib/license_state.mock';
import { ActionsConfigurationUtilities } from './actions_config';
import type { ActionsConfigurationUtilities } from './actions_config';
import { licensingMock } from '@kbn/licensing-plugin/server/mocks';
import { inMemoryMetricsMock } from './monitoring/in_memory_metrics.mock';

View file

@ -7,17 +7,15 @@
import Boom from '@hapi/boom';
import { i18n } from '@kbn/i18n';
import { RunContext, TaskManagerSetupContract, TaskCost } from '@kbn/task-manager-plugin/server';
import { LicensingPluginSetup } from '@kbn/licensing-plugin/server';
import { ActionType as CommonActionType, areValidFeatures } from '../common';
import { ActionsConfigurationUtilities } from './actions_config';
import {
getActionTypeFeatureUsageName,
TaskRunnerFactory,
ILicenseState,
ActionExecutionSourceType,
} from './lib';
import {
import type { RunContext, TaskManagerSetupContract } from '@kbn/task-manager-plugin/server';
import { TaskCost } from '@kbn/task-manager-plugin/server';
import type { LicensingPluginSetup } from '@kbn/licensing-plugin/server';
import type { ActionType as CommonActionType } from '../common';
import { areValidFeatures } from '../common';
import type { ActionsConfigurationUtilities } from './actions_config';
import type { TaskRunnerFactory, ILicenseState, ActionExecutionSourceType } from './lib';
import { getActionTypeFeatureUsageName } from './lib';
import type {
ActionType,
InMemoryConnector,
ActionTypeConfig,

View file

@ -8,21 +8,19 @@
import { schema } from '@kbn/config-schema';
import moment from 'moment';
import { ByteSizeValue } from '@kbn/config-schema';
import { MockedLogger, loggerMock } from '@kbn/logging-mocks';
import type { MockedLogger } from '@kbn/logging-mocks';
import { loggerMock } from '@kbn/logging-mocks';
import {
DEFAULT_MICROSOFT_EXCHANGE_URL,
DEFAULT_MICROSOFT_GRAPH_API_SCOPE,
DEFAULT_MICROSOFT_GRAPH_API_URL,
} from '../../common';
import { ActionTypeRegistry, ActionTypeRegistryOpts } from '../action_type_registry';
import type { ActionTypeRegistryOpts } from '../action_type_registry';
import { ActionTypeRegistry } from '../action_type_registry';
import { ActionsClient } from './actions_client';
import { ExecutorType, ActionType } from '../types';
import {
ActionExecutor,
TaskRunnerFactory,
ILicenseState,
asHttpRequestExecutionSource,
} from '../lib';
import type { ExecutorType, ActionType } from '../types';
import type { ILicenseState } from '../lib';
import { ActionExecutor, TaskRunnerFactory, asHttpRequestExecutionSource } from '../lib';
import { taskManagerMock } from '@kbn/task-manager-plugin/server/mocks';
import { actionsConfigMock } from '../actions_config.mock';
import { getActionsConfigurationUtilities } from '../actions_config';
@ -38,18 +36,19 @@ import { auditLoggerMock } from '@kbn/security-plugin/server/audit/mocks';
import { usageCountersServiceMock } from '@kbn/usage-collection-plugin/server/usage_counters/usage_counters_service.mock';
import { actionExecutorMock } from '../lib/action_executor.mock';
import { v4 as uuidv4 } from 'uuid';
import { ActionsAuthorization } from '../authorization/actions_authorization';
import type { ActionsAuthorization } from '../authorization/actions_authorization';
import { actionsAuthorizationMock } from '../authorization/actions_authorization.mock';
import { ConnectorTokenClient } from '../lib/connector_token_client';
import { encryptedSavedObjectsMock } from '@kbn/encrypted-saved-objects-plugin/server/mocks';
import { SavedObject } from '@kbn/core/server';
import type { SavedObject } from '@kbn/core/server';
import { connectorTokenClientMock } from '../lib/connector_token_client.mock';
import { inMemoryMetricsMock } from '../monitoring/in_memory_metrics.mock';
import { getOAuthJwtAccessToken } from '../lib/get_oauth_jwt_access_token';
import { getOAuthClientCredentialsAccessToken } from '../lib/get_oauth_client_credentials_access_token';
import { OAuthParams } from '../routes/get_oauth_access_token';
import type { OAuthParams } from '../routes/get_oauth_access_token';
import { eventLogClientMock } from '@kbn/event-log-plugin/server/event_log_client.mock';
import { GetGlobalExecutionKPIParams, GetGlobalExecutionLogParams } from '../../common';
import type { GetGlobalExecutionKPIParams, GetGlobalExecutionLogParams } from '../../common';
import type { estypes } from '@elastic/elasticsearch';
import { DEFAULT_USAGE_API_URL } from '../config';
@ -103,7 +102,7 @@ const executor: ExecutorType<{}, {}, {}, void> = async (options) => {
const connectorTokenClient = connectorTokenClientMock.create();
const inMemoryMetrics = inMemoryMetricsMock.create();
const actionTypeIdFromSavedObjectMock = (actionTypeId: string = 'my-action-type') => {
const actionTypeIdFromSavedObjectMock = (actionTypeId = 'my-action-type') => {
return {
attributes: {
actionTypeId,

View file

@ -7,35 +7,36 @@
import Boom from '@hapi/boom';
import url from 'url';
import { UsageCounter } from '@kbn/usage-collection-plugin/server';
import type { UsageCounter } from '@kbn/usage-collection-plugin/server';
import { i18n } from '@kbn/i18n';
import { uniq } from 'lodash';
import {
import type {
IScopedClusterClient,
SavedObjectsClientContract,
KibanaRequest,
Logger,
} from '@kbn/core/server';
import { AuditLogger } from '@kbn/security-plugin/server';
import { IEventLogClient } from '@kbn/event-log-plugin/server';
import { KueryNode } from '@kbn/es-query';
import { Connector, ConnectorWithExtraFindData } from '../application/connector/types';
import { ConnectorType } from '../application/connector/types';
import type { AuditLogger } from '@kbn/security-plugin/server';
import type { IEventLogClient } from '@kbn/event-log-plugin/server';
import type { KueryNode } from '@kbn/es-query';
import type { Connector, ConnectorWithExtraFindData } from '../application/connector/types';
import type { ConnectorType } from '../application/connector/types';
import { get } from '../application/connector/methods/get';
import { getAll, getAllSystemConnectors } from '../application/connector/methods/get_all';
import { update } from '../application/connector/methods/update';
import { listTypes } from '../application/connector/methods/list_types';
import { create } from '../application/connector/methods/create';
import { execute } from '../application/connector/methods/execute';
import {
import type {
GetGlobalExecutionKPIParams,
GetGlobalExecutionLogParams,
IExecutionLogResult,
} from '../../common';
import { ActionTypeRegistry } from '../action_type_registry';
import { ActionExecutorContract, parseDate } from '../lib';
import {
import type { ActionTypeRegistry } from '../action_type_registry';
import type { ActionExecutorContract } from '../lib';
import { parseDate } from '../lib';
import type {
ActionResult,
RawAction,
InMemoryConnector,
@ -45,29 +46,26 @@ import {
ActionType,
} from '../types';
import { PreconfiguredActionDisabledModificationError } from '../lib/errors/preconfigured_action_disabled_modification';
import {
import type {
ExecuteOptions as EnqueueExecutionOptions,
BulkExecutionEnqueuer,
ExecutionResponse,
} from '../create_execute_function';
import { ActionsAuthorization } from '../authorization/actions_authorization';
import type { ActionsAuthorization } from '../authorization/actions_authorization';
import { connectorAuditEvent, ConnectorAuditAction } from '../lib/audit_events';
import { ActionsConfigurationUtilities } from '../actions_config';
import {
import type { ActionsConfigurationUtilities } from '../actions_config';
import type {
OAuthClientCredentialsParams,
OAuthJwtParams,
OAuthParams,
} from '../routes/get_oauth_access_token';
import {
getOAuthJwtAccessToken,
GetOAuthJwtConfig,
GetOAuthJwtSecrets,
} from '../lib/get_oauth_jwt_access_token';
import {
getOAuthClientCredentialsAccessToken,
import type { GetOAuthJwtConfig, GetOAuthJwtSecrets } from '../lib/get_oauth_jwt_access_token';
import { getOAuthJwtAccessToken } from '../lib/get_oauth_jwt_access_token';
import type {
GetOAuthClientCredentialsConfig,
GetOAuthClientCredentialsSecrets,
} from '../lib/get_oauth_client_credentials_access_token';
import { getOAuthClientCredentialsAccessToken } from '../lib/get_oauth_client_credentials_access_token';
import {
ACTION_FILTER,
formatExecutionKPIResult,
@ -76,12 +74,12 @@ import {
getExecutionLogAggregation,
} from '../lib/get_execution_log_aggregation';
import { connectorFromSavedObject, isConnectorDeprecated } from '../application/connector/lib';
import { ListTypesParams } from '../application/connector/methods/list_types/types';
import { ConnectorUpdateParams } from '../application/connector/methods/update/types';
import { ConnectorCreateParams } from '../application/connector/methods/create/types';
import type { ListTypesParams } from '../application/connector/methods/list_types/types';
import type { ConnectorUpdateParams } from '../application/connector/methods/update/types';
import type { ConnectorCreateParams } from '../application/connector/methods/create/types';
import { isPreconfigured } from '../lib/is_preconfigured';
import { isSystemAction } from '../lib/is_system_action';
import { ConnectorExecuteParams } from '../application/connector/methods/execute/types';
import type { ConnectorExecuteParams } from '../application/connector/methods/execute/types';
export interface ConstructorOptions {
logger: Logger;

View file

@ -7,11 +7,14 @@
import { omit } from 'lodash';
import { schema } from '@kbn/config-schema';
import { MockedLogger, loggerMock } from '@kbn/logging-mocks';
import { ActionTypeRegistry, ActionTypeRegistryOpts } from '../action_type_registry';
import type { MockedLogger } from '@kbn/logging-mocks';
import { loggerMock } from '@kbn/logging-mocks';
import type { ActionTypeRegistryOpts } from '../action_type_registry';
import { ActionTypeRegistry } from '../action_type_registry';
import { ActionsClient } from './actions_client';
import { ExecutorType } from '../types';
import { ActionExecutor, TaskRunnerFactory, ILicenseState } from '../lib';
import type { ExecutorType } from '../types';
import type { ILicenseState } from '../lib';
import { ActionExecutor, TaskRunnerFactory } from '../lib';
import { taskManagerMock } from '@kbn/task-manager-plugin/server/mocks';
import { actionsConfigMock } from '../actions_config.mock';
import { licenseStateMock } from '../lib/license_state.mock';
@ -24,7 +27,7 @@ import {
import { auditLoggerMock } from '@kbn/security-plugin/server/audit/mocks';
import { usageCountersServiceMock } from '@kbn/usage-collection-plugin/server/usage_counters/usage_counters_service.mock';
import { actionExecutorMock } from '../lib/action_executor.mock';
import { ActionsAuthorization } from '../authorization/actions_authorization';
import type { ActionsAuthorization } from '../authorization/actions_authorization';
import { actionsAuthorizationMock } from '../authorization/actions_authorization.mock';
import { connectorTokenClientMock } from '../lib/connector_token_client.mock';
import { inMemoryMetricsMock } from '../monitoring/in_memory_metrics.mock';

View file

@ -10,7 +10,7 @@ import {
DEFAULT_MICROSOFT_GRAPH_API_SCOPE,
DEFAULT_MICROSOFT_GRAPH_API_URL,
} from '../common';
import { ActionsConfigurationUtilities } from './actions_config';
import type { ActionsConfigurationUtilities } from './actions_config';
const createActionsConfigMock = () => {
const mocked: jest.Mocked<ActionsConfigurationUtilities> = {

View file

@ -6,7 +6,8 @@
*/
import { ByteSizeValue } from '@kbn/config-schema';
import { ActionsConfig, DEFAULT_USAGE_API_URL } from './config';
import type { ActionsConfig } from './config';
import { DEFAULT_USAGE_API_URL } from './config';
import {
DEFAULT_MICROSOFT_EXCHANGE_URL,
DEFAULT_MICROSOFT_GRAPH_API_SCOPE,
@ -18,7 +19,7 @@ import {
EnabledActionTypes,
} from './actions_config';
import { resolveCustomHosts } from './lib/custom_host_settings';
import { Logger } from '@kbn/core/server';
import type { Logger } from '@kbn/core/server';
import { loggingSystemMock } from '@kbn/core/server/mocks';
import moment from 'moment';

View file

@ -11,22 +11,14 @@ import url from 'url';
import { curry } from 'lodash';
import { pipe } from 'fp-ts/lib/pipeable';
import {
ActionsConfig,
AllowedHosts,
EnabledActionTypes,
CustomHostSettings,
DEFAULT_QUEUED_MAX,
} from './config';
import type { ActionsConfig, CustomHostSettings } from './config';
import { AllowedHosts, EnabledActionTypes, DEFAULT_QUEUED_MAX } from './config';
import { getCanonicalCustomHostUrl } from './lib/custom_host_settings';
import { ActionTypeDisabledError } from './lib';
import { ProxySettings, ResponseSettings, SSLSettings } from './types';
import type { ProxySettings, ResponseSettings, SSLSettings } from './types';
import { getSSLSettingsFromConfig } from './lib/get_node_ssl_options';
import {
ValidateEmailAddressesOptions,
validateEmailAddresses,
invalidEmailsAsMessage,
} from '../common';
import type { ValidateEmailAddressesOptions } from '../common';
import { validateEmailAddresses, invalidEmailsAsMessage } from '../common';
export { AllowedHosts, EnabledActionTypes } from './config';
enum AllowListingField {
@ -34,7 +26,7 @@ enum AllowListingField {
hostname = 'hostname',
}
export const DEFAULT_MAX_ATTEMPTS: number = 3;
export const DEFAULT_MAX_ATTEMPTS = 3;
export interface ActionsConfigurationUtilities {
isHostnameAllowed: (hostname: string) => boolean;

View file

@ -5,9 +5,9 @@
* 2.0.
*/
import { SavedObject } from '@kbn/core-saved-objects-common/src/server_types';
import { RawAction } from '../../../types';
import { Connector } from '../types';
import type { SavedObject } from '@kbn/core-saved-objects-common/src/server_types';
import type { RawAction } from '../../../types';
import type { Connector } from '../types';
export function connectorFromSavedObject(
savedObject: SavedObject<RawAction>,

View file

@ -6,7 +6,7 @@
*/
import { isPlainObject } from 'lodash';
import { RawAction, InMemoryConnector } from '../../../types';
import type { RawAction, InMemoryConnector } from '../../../types';
export type ConnectorWithOptionalDeprecation = Omit<InMemoryConnector, 'isDeprecated'> &
Pick<Partial<InMemoryConnector>, 'isDeprecated'>;

View file

@ -7,12 +7,13 @@
import Boom from '@hapi/boom';
import { i18n } from '@kbn/i18n';
import { SavedObjectAttributes, SavedObjectsUtils } from '@kbn/core/server';
import { ConnectorCreateParams } from './types';
import type { SavedObjectAttributes } from '@kbn/core/server';
import { SavedObjectsUtils } from '@kbn/core/server';
import type { ConnectorCreateParams } from './types';
import { ConnectorAuditAction, connectorAuditEvent } from '../../../../lib/audit_events';
import { validateConfig, validateConnector, validateSecrets } from '../../../../lib';
import { isConnectorDeprecated } from '../../lib';
import { HookServices, ActionResult } from '../../../../types';
import type { HookServices, ActionResult } from '../../../../types';
import { tryCatch } from '../../../../lib';
export async function create({

View file

@ -5,8 +5,8 @@
* 2.0.
*/
import { SavedObjectAttributes } from '@kbn/core/server';
import { ActionsClientContext } from '../../../../../actions_client';
import type { SavedObjectAttributes } from '@kbn/core/server';
import type { ActionsClientContext } from '../../../../../actions_client';
export interface ConnectorCreate {
actionTypeId: string;

View file

@ -6,13 +6,13 @@
*/
import { v4 as uuidv4 } from 'uuid';
import { RawAction, ActionTypeExecutorResult } from '../../../../types';
import type { RawAction, ActionTypeExecutorResult } from '../../../../types';
import { getActionKibanaPrivileges } from '../../../../lib/get_action_kibana_privileges';
import { isPreconfigured } from '../../../../lib/is_preconfigured';
import { isSystemAction } from '../../../../lib/is_system_action';
import { ConnectorExecuteParams } from './types';
import type { ConnectorExecuteParams } from './types';
import { ACTION_SAVED_OBJECT_TYPE } from '../../../../constants/saved_objects';
import { ActionsClientContext } from '../../../../actions_client';
import type { ActionsClientContext } from '../../../../actions_client';
export async function execute(
context: ActionsClientContext,

View file

@ -5,6 +5,6 @@
* 2.0.
*/
import { ExecuteOptions } from '../../../../../lib/action_executor';
import type { ExecuteOptions } from '../../../../../lib/action_executor';
export type ConnectorExecuteParams = Omit<ExecuteOptions, 'request' | 'actionExecutionId'>;

View file

@ -8,10 +8,10 @@
import Boom from '@hapi/boom';
import { getConnectorSo } from '../../../../data/connector';
import { connectorSchema } from '../../schemas';
import { Connector } from '../../types';
import type { Connector } from '../../types';
import { ConnectorAuditAction, connectorAuditEvent } from '../../../../lib/audit_events';
import { isConnectorDeprecated } from '../../lib';
import { GetParams } from './types';
import type { GetParams } from './types';
export async function get({
context,

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { ActionsClientContext } from '../../../../../actions_client';
import type { ActionsClientContext } from '../../../../../actions_client';
export interface GetParams {
context: ActionsClientContext;

View file

@ -6,7 +6,7 @@
*/
import { ActionsClient } from '../../../../actions_client';
import { ActionsAuthorization } from '../../../../authorization/actions_authorization';
import type { ActionsAuthorization } from '../../../../authorization/actions_authorization';
import { connectorTokenClientMock } from '../../../../lib/connector_token_client.mock';
import { getOAuthJwtAccessToken } from '../../../../lib/get_oauth_jwt_access_token';
import { getOAuthClientCredentialsAccessToken } from '../../../../lib/get_oauth_client_credentials_access_token';
@ -21,9 +21,9 @@ import { httpServerMock } from '@kbn/core-http-server-mocks';
import { auditLoggerMock } from '@kbn/security-plugin/server/audit/mocks';
import { usageCountersServiceMock } from '@kbn/usage-collection-plugin/server/usage_counters/usage_counters_service.mock';
import { loggingSystemMock } from '@kbn/core-logging-server-mocks';
import { Logger } from '@kbn/logging';
import type { Logger } from '@kbn/logging';
import { eventLogClientMock } from '@kbn/event-log-plugin/server/event_log_client.mock';
import { ActionTypeRegistry } from '../../../../action_type_registry';
import type { ActionTypeRegistry } from '../../../../action_type_registry';
import { getAllUnsecured } from './get_all';
jest.mock('@kbn/core-saved-objects-utils-server', () => {

View file

@ -8,19 +8,19 @@
/**
* Get all actions with in-memory connectors
*/
import type { estypes } from '@elastic/elasticsearch';
import { AuditLogger } from '@kbn/security-plugin-types-server';
import { ElasticsearchClient, Logger } from '@kbn/core/server';
import type * as estypes from '@elastic/elasticsearch/lib/api/types';
import type { AuditLogger } from '@kbn/security-plugin-types-server';
import type { ElasticsearchClient, Logger } from '@kbn/core/server';
import { omit } from 'lodash';
import { InMemoryConnector } from '../../../..';
import { SavedObjectClientForFind } from '../../../../data/connector/types/params';
import type { InMemoryConnector } from '../../../..';
import type { SavedObjectClientForFind } from '../../../../data/connector/types/params';
import { connectorWithExtraFindDataSchema } from '../../schemas';
import { findConnectorsSo, searchConnectorsSo } from '../../../../data/connector';
import { GetAllParams, InjectExtraFindDataParams } from './types';
import type { GetAllParams, InjectExtraFindDataParams } from './types';
import { ConnectorAuditAction, connectorAuditEvent } from '../../../../lib/audit_events';
import { connectorFromSavedObject, isConnectorDeprecated } from '../../lib';
import { ConnectorWithExtraFindData } from '../../types';
import { GetAllUnsecuredParams } from './types/params';
import type { ConnectorWithExtraFindData } from '../../types';
import type { GetAllUnsecuredParams } from './types/params';
interface GetAllHelperOpts {
auditLogger?: AuditLogger;

View file

@ -5,12 +5,12 @@
* 2.0.
*/
import { ElasticsearchClient } from '@kbn/core-elasticsearch-server';
import { ISavedObjectsRepository, Logger } from '@kbn/core/server';
import { AuditLogger } from '@kbn/security-plugin/server';
import { InMemoryConnector } from '../../../../..';
import { ActionsClientContext } from '../../../../../actions_client';
import { Connector } from '../../../types';
import type { ElasticsearchClient } from '@kbn/core-elasticsearch-server';
import type { ISavedObjectsRepository, Logger } from '@kbn/core/server';
import type { AuditLogger } from '@kbn/security-plugin/server';
import type { InMemoryConnector } from '../../../../..';
import type { ActionsClientContext } from '../../../../../actions_client';
import type { Connector } from '../../../types';
export interface GetAllParams {
includeSystemActions?: boolean;

View file

@ -6,9 +6,11 @@
*/
import { actionsConfigMock } from '../../../../actions_config.mock';
import { ActionTypeRegistry, ActionTypeRegistryOpts } from '../../../../action_type_registry';
import { ActionsAuthorization } from '../../../../authorization/actions_authorization';
import { ActionExecutor, ILicenseState, TaskRunnerFactory } from '../../../../lib';
import type { ActionTypeRegistryOpts } from '../../../../action_type_registry';
import { ActionTypeRegistry } from '../../../../action_type_registry';
import type { ActionsAuthorization } from '../../../../authorization/actions_authorization';
import type { ILicenseState } from '../../../../lib';
import { ActionExecutor, TaskRunnerFactory } from '../../../../lib';
import { actionExecutorMock } from '../../../../lib/action_executor.mock';
import { connectorTokenClientMock } from '../../../../lib/connector_token_client.mock';
import { licenseStateMock } from '../../../../lib/license_state.mock';
@ -24,7 +26,7 @@ import {
import { licensingMock } from '@kbn/licensing-plugin/server/mocks';
import { taskManagerMock } from '@kbn/task-manager-plugin/server/mocks';
import { ActionsClient } from '../../../../actions_client/actions_client';
import { ExecutorType } from '../../../../types';
import type { ExecutorType } from '../../../../types';
let mockedLicenseState: jest.Mocked<ILicenseState>;
let actionTypeRegistryParams: ActionTypeRegistryOpts;

View file

@ -6,10 +6,10 @@
*/
import Boom from '@hapi/boom';
import { ActionsClientContext } from '../../../../actions_client';
import { ConnectorType } from '../../types';
import type { ActionsClientContext } from '../../../../actions_client';
import type { ConnectorType } from '../../types';
import { listTypesParamsSchema } from './schemas';
import { ListTypesParams } from './types';
import type { ListTypesParams } from './types';
export async function listTypes(
context: ActionsClientContext,
@ -27,7 +27,7 @@ export async function listTypes(
const filteredConnectorTypes = includeSystemActionTypes
? connectorTypes
: connectorTypes.filter((type) => !Boolean(type.isSystemActionType));
: connectorTypes.filter((type) => !type.isSystemActionType);
return filteredConnectorTypes;
}

View file

@ -5,8 +5,8 @@
* 2.0.
*/
import { TypeOf } from '@kbn/config-schema';
import { listTypesParamsSchema } from '../schemas';
import type { TypeOf } from '@kbn/config-schema';
import type { listTypesParamsSchema } from '../schemas';
type ListTypesParamsType = TypeOf<typeof listTypesParamsSchema>;

View file

@ -5,8 +5,8 @@
* 2.0.
*/
import { SavedObjectAttributes } from '@kbn/core/server';
import { ActionsClientContext } from '../../../../../actions_client';
import type { SavedObjectAttributes } from '@kbn/core/server';
import type { ActionsClientContext } from '../../../../../actions_client';
export interface ConnectorUpdate {
name: string;

View file

@ -7,15 +7,15 @@
import Boom from '@hapi/boom';
import { i18n } from '@kbn/i18n';
import { SavedObjectAttributes } from '@kbn/core/server';
import type { SavedObjectAttributes } from '@kbn/core/server';
import { isUndefined, omitBy } from 'lodash';
import { Connector } from '../../types';
import { ConnectorUpdateParams } from './types';
import type { Connector } from '../../types';
import type { ConnectorUpdateParams } from './types';
import { PreconfiguredActionDisabledModificationError } from '../../../../lib/errors/preconfigured_action_disabled_modification';
import { ConnectorAuditAction, connectorAuditEvent } from '../../../../lib/audit_events';
import { validateConfig, validateConnector, validateSecrets } from '../../../../lib';
import { isConnectorDeprecated } from '../../lib';
import { RawAction, HookServices } from '../../../../types';
import type { RawAction, HookServices } from '../../../../types';
import { tryCatch } from '../../../../lib';
export async function update({ context, id, action }: ConnectorUpdateParams): Promise<Connector> {

View file

@ -5,8 +5,8 @@
* 2.0.
*/
import { TypeOf } from '@kbn/config-schema';
import { connectorSchema, connectorWithExtraFindDataSchema } from '../schemas';
import type { TypeOf } from '@kbn/config-schema';
import type { connectorSchema, connectorWithExtraFindDataSchema } from '../schemas';
type ConnectorSchemaType = TypeOf<typeof connectorSchema>;
type ConnectorWithExtraFindDataSchema = TypeOf<typeof connectorWithExtraFindDataSchema>;

View file

@ -5,8 +5,8 @@
* 2.0.
*/
import { TypeOf } from '@kbn/config-schema';
import { connectorTypeSchema } from '../schemas';
import type { TypeOf } from '@kbn/config-schema';
import type { connectorTypeSchema } from '../schemas';
type ConnectorTypeSchemaType = TypeOf<typeof connectorTypeSchema>;

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { KibanaRequest } from '@kbn/core/server';
import type { KibanaRequest } from '@kbn/core/server';
import { securityMock } from '@kbn/security-plugin/server/mocks';
import { ActionsAuthorization } from './actions_authorization';
import {

View file

@ -6,8 +6,8 @@
*/
import Boom from '@hapi/boom';
import { KibanaRequest } from '@kbn/core/server';
import { SecurityPluginSetup } from '@kbn/security-plugin/server';
import type { KibanaRequest } from '@kbn/core/server';
import type { SecurityPluginSetup } from '@kbn/security-plugin/server';
import {
ACTION_SAVED_OBJECT_TYPE,
ACTION_TASK_PARAMS_SAVED_OBJECT_TYPE,

View file

@ -5,8 +5,9 @@
* 2.0.
*/
import { configSchema, ActionsConfig, getValidatedConfig } from './config';
import { Logger } from '@kbn/core/server';
import type { ActionsConfig } from './config';
import { configSchema, getValidatedConfig } from './config';
import type { Logger } from '@kbn/core/server';
import { loggingSystemMock } from '@kbn/core/server/mocks';
const mockLogger = loggingSystemMock.create().get() as jest.Mocked<Logger>;

View file

@ -5,8 +5,9 @@
* 2.0.
*/
import { schema, TypeOf } from '@kbn/config-schema';
import { Logger } from '@kbn/core/server';
import type { TypeOf } from '@kbn/config-schema';
import { schema } from '@kbn/config-schema';
import type { Logger } from '@kbn/core/server';
import {
DEFAULT_MICROSOFT_EXCHANGE_URL,
DEFAULT_MICROSOFT_GRAPH_API_SCOPE,

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { LicenseType } from '@kbn/licensing-plugin/server';
import type { LicenseType } from '@kbn/licensing-plugin/server';
export const PLUGIN = {
ID: 'actions',

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { KibanaRequest, Logger } from '@kbn/core/server';
import type { KibanaRequest, Logger } from '@kbn/core/server';
import { v4 as uuidv4 } from 'uuid';
import { taskManagerMock } from '@kbn/task-manager-plugin/server/mocks';
import { createBulkExecutionEnqueuerFunction } from './create_execute_function';

View file

@ -5,13 +5,17 @@
* 2.0.
*/
import { SavedObjectsBulkResponse, SavedObjectsClientContract, Logger } from '@kbn/core/server';
import { TaskPriority, TaskManagerStartContract } from '@kbn/task-manager-plugin/server';
import { RawAction, ActionTypeRegistryContract, InMemoryConnector } from './types';
import type {
SavedObjectsBulkResponse,
SavedObjectsClientContract,
Logger,
} from '@kbn/core/server';
import type { TaskPriority, TaskManagerStartContract } from '@kbn/task-manager-plugin/server';
import type { RawAction, ActionTypeRegistryContract, InMemoryConnector } from './types';
import { ACTION_TASK_PARAMS_SAVED_OBJECT_TYPE } from './constants/saved_objects';
import { ExecuteOptions as ActionExecutorOptions } from './lib/action_executor';
import type { ExecuteOptions as ActionExecutorOptions } from './lib/action_executor';
import { extractSavedObjectReferences, isSavedObjectExecutionSource } from './lib';
import { ActionsConfigurationUtilities } from './actions_config';
import type { ActionsConfigurationUtilities } from './actions_config';
import { hasReachedTheQueuedActionsLimit } from './lib/has_reached_queued_actions_limit';
interface CreateExecuteFunctionOptions {

View file

@ -5,8 +5,8 @@
* 2.0.
*/
import { ActionType } from '../common';
import { InMemoryConnector } from './types';
import type { ActionType } from '../common';
import type { InMemoryConnector } from './types';
export const createSystemConnectors = (actionTypes: ActionType[]): InMemoryConnector[] => {
const systemActionTypes = actionTypes.filter((actionType) => actionType.isSystemActionType);

View file

@ -5,18 +5,19 @@
* 2.0.
*/
import { ISavedObjectsRepository, SavedObjectsBulkResponse } from '@kbn/core/server';
import { TaskManagerStartContract } from '@kbn/task-manager-plugin/server';
import {
import type { ISavedObjectsRepository, SavedObjectsBulkResponse } from '@kbn/core/server';
import type { TaskManagerStartContract } from '@kbn/task-manager-plugin/server';
import type {
ActionTypeRegistryContract as ConnectorTypeRegistryContract,
InMemoryConnector,
UNALLOWED_FOR_UNSECURE_EXECUTION_CONNECTOR_TYPE_IDS,
} from './types';
import { UNALLOWED_FOR_UNSECURE_EXECUTION_CONNECTOR_TYPE_IDS } from './types';
import { ACTION_TASK_PARAMS_SAVED_OBJECT_TYPE } from './constants/saved_objects';
import { ExecuteOptions as ActionExecutorOptions } from './lib/action_executor';
import type { ExecuteOptions as ActionExecutorOptions } from './lib/action_executor';
import { extractSavedObjectReferences, isSavedObjectExecutionSource } from './lib';
import { ExecutionResponseItem, ExecutionResponseType } from './create_execute_function';
import { ActionsConfigurationUtilities } from './actions_config';
import type { ExecutionResponseItem } from './create_execute_function';
import { ExecutionResponseType } from './create_execute_function';
import type { ActionsConfigurationUtilities } from './actions_config';
import { hasReachedTheQueuedActionsLimit } from './lib/has_reached_queued_actions_limit';
interface CreateBulkUnsecuredExecuteFunctionOptions {

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { FindConnectorsSoResult, FindConnectorsSoParams } from './types';
import type { FindConnectorsSoResult, FindConnectorsSoParams } from './types';
import { MAX_ACTIONS_RETURNED } from './constants';
export const findConnectorsSo = async ({

View file

@ -5,8 +5,8 @@
* 2.0.
*/
import { GetConnectorSoResult, GetConnectorSoParams } from './types';
import { RawAction } from '../../types';
import type { GetConnectorSoResult, GetConnectorSoParams } from './types';
import type { RawAction } from '../../types';
export const getConnectorSo = async ({
unsecuredSavedObjectsClient,

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { SearchConnectorsSoParams } from './types';
import type { SearchConnectorsSoParams } from './types';
export const searchConnectorsSo = async ({
esClient,

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { SavedObjectsFindResponse } from '@kbn/core-saved-objects-api-server';
import { RawAction } from '../../../types';
import type { SavedObjectsFindResponse } from '@kbn/core-saved-objects-api-server';
import type { RawAction } from '../../../types';
export type FindConnectorsSoResult = SavedObjectsFindResponse<RawAction>;

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { SavedObject } from '@kbn/core-saved-objects-common/src/server_types';
import { RawAction } from '../../../types';
import type { SavedObject } from '@kbn/core-saved-objects-common/src/server_types';
import type { RawAction } from '../../../types';
export type GetConnectorSoResult = SavedObject<RawAction>;

View file

@ -5,10 +5,10 @@
* 2.0.
*/
import { ElasticsearchClient } from '@kbn/core-elasticsearch-server';
import type { estypes } from '@elastic/elasticsearch';
import { SavedObjectsClientContract } from '@kbn/core-saved-objects-api-server';
import { SavedObjectsClient } from '@kbn/core/server';
import type { ElasticsearchClient } from '@kbn/core-elasticsearch-server';
import type * as estypes from '@elastic/elasticsearch/lib/api/types';
import type { SavedObjectsClientContract } from '@kbn/core-saved-objects-api-server';
import type { SavedObjectsClient } from '@kbn/core/server';
export type SavedObjectClientForFind = Pick<SavedObjectsClient, 'find'>;
export interface SearchConnectorsSoParams {

View file

@ -7,7 +7,8 @@
import { DEFAULT_APP_CATEGORIES } from '@kbn/core-application-common';
import { i18n } from '@kbn/i18n';
import { KibanaFeatureConfig, KibanaFeatureScope } from '@kbn/features-plugin/common';
import type { KibanaFeatureConfig } from '@kbn/features-plugin/common';
import { KibanaFeatureScope } from '@kbn/features-plugin/common';
import {
ACTION_SAVED_OBJECT_TYPE,
ACTION_TASK_PARAMS_SAVED_OBJECT_TYPE,

View file

@ -5,10 +5,11 @@
* 2.0.
*/
import type { PublicMethodsOf } from '@kbn/utility-types';
import { PluginInitializerContext, PluginConfigDescriptor } from '@kbn/core/server';
import { configSchema, ActionsConfig } from './config';
import { ActionsClient as ActionsClientClass } from './actions_client';
import { ActionsAuthorization as ActionsAuthorizationClass } from './authorization/actions_authorization';
import type { PluginInitializerContext, PluginConfigDescriptor } from '@kbn/core/server';
import type { ActionsConfig } from './config';
import { configSchema } from './config';
import type { ActionsClient as ActionsClientClass } from './actions_client';
import type { ActionsAuthorization as ActionsAuthorizationClass } from './authorization/actions_authorization';
export type { IUnsecuredActionsClient } from './unsecured_actions_client/unsecured_actions_client';
export { UnsecuredActionsClient } from './unsecured_actions_client/unsecured_actions_client';

View file

@ -17,11 +17,13 @@ import getPort from 'get-port';
import { request } from '../lib/axios_utils';
import { ByteSizeValue } from '@kbn/config-schema';
import { Logger } from '@kbn/core/server';
import type { Logger } from '@kbn/core/server';
import { loggingSystemMock } from '@kbn/core/server/mocks';
import { createReadySignal } from '@kbn/event-log-plugin/server/lib/ready_signal';
import { ActionsConfig, DEFAULT_USAGE_API_URL } from '../config';
import { ActionsConfigurationUtilities, getActionsConfigurationUtilities } from '../actions_config';
import type { ActionsConfig } from '../config';
import { DEFAULT_USAGE_API_URL } from '../config';
import type { ActionsConfigurationUtilities } from '../actions_config';
import { getActionsConfigurationUtilities } from '../actions_config';
import { resolveCustomHosts } from '../lib/custom_host_settings';
import {
DEFAULT_MICROSOFT_EXCHANGE_URL,

View file

@ -17,11 +17,13 @@ import getPort from 'get-port';
import { request } from '../lib/axios_utils';
import { ByteSizeValue } from '@kbn/config-schema';
import { Logger } from '@kbn/core/server';
import type { Logger } from '@kbn/core/server';
import { loggingSystemMock } from '@kbn/core/server/mocks';
import { createReadySignal } from '@kbn/event-log-plugin/server/lib/ready_signal';
import { ActionsConfig, DEFAULT_USAGE_API_URL } from '../config';
import { ActionsConfigurationUtilities, getActionsConfigurationUtilities } from '../actions_config';
import type { ActionsConfig } from '../config';
import { DEFAULT_USAGE_API_URL } from '../config';
import type { ActionsConfigurationUtilities } from '../actions_config';
import { getActionsConfigurationUtilities } from '../actions_config';
import { resolveCustomHosts } from '../lib/custom_host_settings';
import {
DEFAULT_MICROSOFT_GRAPH_API_URL,

View file

@ -6,7 +6,7 @@
*/
import type { TestElasticsearchUtils, TestKibanaUtils } from '@kbn/core-test-helpers-kbn-server';
import { ActionTypeRegistry } from '../action_type_registry';
import type { ActionTypeRegistry } from '../action_type_registry';
import { setupTestServers } from './lib';
import { connectorTypes } from './mocks/connector_types';
import { actionsConfigMock } from '../actions_config.mock';

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { KibanaRequest, SavedObjectReference } from '@kbn/core/server';
import type { KibanaRequest, SavedObjectReference } from '@kbn/core/server';
export enum ActionExecutionSourceType {
SAVED_OBJECT = 'SAVED_OBJECT',

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { ActionExecutorContract } from './action_executor';
import type { ActionExecutorContract } from './action_executor';
const createActionExecutorMock = () => {
const mocked: jest.Mocked<ActionExecutorContract> = {

View file

@ -4,7 +4,7 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { KibanaRequest } from '@kbn/core/server';
import type { KibanaRequest } from '@kbn/core/server';
import { schema } from '@kbn/config-schema';
import { ActionExecutor } from './action_executor';
import { actionTypeRegistryMock } from '../action_type_registry.mock';
@ -17,7 +17,8 @@ import {
} from '@kbn/core/server/mocks';
import { eventLoggerMock } from '@kbn/event-log-plugin/server/mocks';
import { spacesServiceMock } from '@kbn/spaces-plugin/server/spaces_service/spaces_service.mock';
import { ActionType as ConnectorType, ConnectorUsageCollector } from '../types';
import type { ActionType as ConnectorType } from '../types';
import { ConnectorUsageCollector } from '../types';
import { actionsAuthorizationMock, actionsMock } from '../mocks';
import {
ActionExecutionSourceType,

View file

@ -6,20 +6,19 @@
*/
import type { PublicMethodsOf } from '@kbn/utility-types';
import type { AnalyticsServiceStart, KibanaRequest, Logger } from '@kbn/core/server';
import {
type AuthenticatedUser,
type SecurityServiceStart,
AnalyticsServiceStart,
KibanaRequest,
Logger,
SavedObjectsErrorHelpers,
} from '@kbn/core/server';
import { cloneDeep } from 'lodash';
import { set } from '@kbn/safer-lodash-set';
import { withSpan } from '@kbn/apm-utils';
import { EncryptedSavedObjectsClient } from '@kbn/encrypted-saved-objects-plugin/server';
import { SpacesServiceStart } from '@kbn/spaces-plugin/server';
import { IEventLogger, SAVED_OBJECT_REL_PRIMARY } from '@kbn/event-log-plugin/server';
import type { EncryptedSavedObjectsClient } from '@kbn/encrypted-saved-objects-plugin/server';
import type { SpacesServiceStart } from '@kbn/spaces-plugin/server';
import type { IEventLogger } from '@kbn/event-log-plugin/server';
import { SAVED_OBJECT_REL_PRIMARY } from '@kbn/event-log-plugin/server';
import { createTaskRunError, TaskErrorSource } from '@kbn/task-manager-plugin/server';
import { getErrorSource } from '@kbn/task-manager-plugin/server/task_running';
import { GEN_AI_TOKEN_COUNT_EVENT } from './event_based_telemetry';
@ -31,7 +30,7 @@ import {
validateParams,
validateSecrets,
} from './validate_with_schema';
import {
import type {
ActionType,
ActionTypeConfig,
ActionTypeExecutorRawResult,
@ -43,13 +42,13 @@ import {
InMemoryConnector,
RawAction,
Services,
UNALLOWED_FOR_UNSECURE_EXECUTION_CONNECTOR_TYPE_IDS,
UnsecuredServices,
ValidatorServices,
} from '../types';
import { UNALLOWED_FOR_UNSECURE_EXECUTION_CONNECTOR_TYPE_IDS } from '../types';
import { EVENT_LOG_ACTIONS } from '../constants/event_log';
import { ActionExecutionSource, ActionExecutionSourceType } from './action_execution_source';
import { RelatedSavedObjects } from './related_saved_objects';
import type { ActionExecutionSource, ActionExecutionSourceType } from './action_execution_source';
import type { RelatedSavedObjects } from './related_saved_objects';
import { createActionEventLogRecordObject } from './create_action_event_log_record_object';
import { ActionExecutionError, ActionExecutionErrorReason } from './errors/action_execution_error';
import type { ActionsAuthorization } from '../authorization/actions_authorization';

View file

@ -5,8 +5,8 @@
* 2.0.
*/
import { SavedObjectAttribute, SavedObjectReference } from '@kbn/core/server';
import { RelatedSavedObjects } from './related_saved_objects';
import type { SavedObjectAttribute, SavedObjectReference } from '@kbn/core/server';
import type { RelatedSavedObjects } from './related_saved_objects';
export const ACTION_REF_NAME = `actionRef`;

View file

@ -6,8 +6,8 @@
*/
import type { EcsEvent } from '@kbn/core/server';
import { AuditEvent } from '@kbn/security-plugin/server';
import { ArrayElement } from '@kbn/utility-types';
import type { AuditEvent } from '@kbn/security-plugin/server';
import type { ArrayElement } from '@kbn/utility-types';
export enum ConnectorAuditAction {
CREATE = 'connector_create',

View file

@ -5,11 +5,12 @@
* 2.0.
*/
import axios, { AxiosError, AxiosInstance } from 'axios';
import type { AxiosInstance } from 'axios';
import axios, { AxiosError } from 'axios';
import { Agent as HttpsAgent } from 'https';
import HttpProxyAgent from 'http-proxy-agent';
import { HttpsProxyAgent } from 'https-proxy-agent';
import { Logger } from '@kbn/core/server';
import type { Logger } from '@kbn/core/server';
import {
addTimeZoneToDate,
request,

View file

@ -6,18 +6,18 @@
*/
import { isObjectLike, isEmpty } from 'lodash';
import {
import type {
AxiosInstance,
Method,
AxiosResponse,
AxiosRequestConfig,
AxiosHeaders,
AxiosHeaderValue,
} from 'axios';
import { Logger } from '@kbn/core/server';
import { AxiosHeaders } from 'axios';
import type { Logger } from '@kbn/core/server';
import { getCustomAgents } from './get_custom_agents';
import { ActionsConfigurationUtilities } from '../actions_config';
import { ConnectorUsageCollector, SSLSettings } from '../types';
import type { ActionsConfigurationUtilities } from '../actions_config';
import type { ConnectorUsageCollector, SSLSettings } from '../types';
import { combineHeadersWithBasicAuthHeader } from './get_basic_auth_header';
export const request = async <T = unknown>({

View file

@ -5,8 +5,8 @@
* 2.0.
*/
import { PublicMethodsOf } from '@kbn/utility-types';
import { ConnectorTokenClient } from './connector_token_client';
import type { PublicMethodsOf } from '@kbn/utility-types';
import type { ConnectorTokenClient } from './connector_token_client';
const createConnectorTokenClientMock = () => {
const mocked: jest.Mocked<PublicMethodsOf<ConnectorTokenClient>> = {

View file

@ -9,8 +9,8 @@ import sinon from 'sinon';
import { loggingSystemMock, savedObjectsClientMock } from '@kbn/core/server/mocks';
import { encryptedSavedObjectsMock } from '@kbn/encrypted-saved-objects-plugin/server/mocks';
import { ConnectorTokenClient } from './connector_token_client';
import { Logger } from '@kbn/core/server';
import { ConnectorToken } from '../types';
import type { Logger } from '@kbn/core/server';
import type { ConnectorToken } from '../types';
import * as allRetry from './retry_if_conflicts';
const logger = loggingSystemMock.create().get() as jest.Mocked<Logger>;

View file

@ -6,10 +6,11 @@
*/
import { omitBy, isUndefined } from 'lodash';
import { EncryptedSavedObjectsClient } from '@kbn/encrypted-saved-objects-plugin/server';
import { Logger, SavedObjectsClientContract, SavedObjectsUtils } from '@kbn/core/server';
import type { EncryptedSavedObjectsClient } from '@kbn/encrypted-saved-objects-plugin/server';
import type { Logger, SavedObjectsClientContract } from '@kbn/core/server';
import { SavedObjectsUtils } from '@kbn/core/server';
import { retryIfConflicts } from './retry_if_conflicts';
import { ConnectorToken } from '../types';
import type { ConnectorToken } from '../types';
import { CONNECTOR_TOKEN_SAVED_OBJECT_TYPE } from '../constants/saved_objects';
export const MAX_TOKENS_RETURNED = 1;

View file

@ -7,9 +7,11 @@
import { set } from '@kbn/safer-lodash-set';
import { isEmpty } from 'lodash';
import { IEvent, SAVED_OBJECT_REL_PRIMARY } from '@kbn/event-log-plugin/server';
import { RelatedSavedObjects } from './related_saved_objects';
import { ActionExecutionSource, isSavedObjectExecutionSource } from './action_execution_source';
import type { IEvent } from '@kbn/event-log-plugin/server';
import { SAVED_OBJECT_REL_PRIMARY } from '@kbn/event-log-plugin/server';
import type { RelatedSavedObjects } from './related_saved_objects';
import type { ActionExecutionSource } from './action_execution_source';
import { isSavedObjectExecutionSource } from './action_execution_source';
export type Event = Exclude<IEvent, undefined>;

View file

@ -10,7 +10,7 @@ jest.mock('jsonwebtoken', () => ({
}));
import jwt from 'jsonwebtoken';
import { Logger } from '@kbn/core/server';
import type { Logger } from '@kbn/core/server';
import { loggingSystemMock } from '@kbn/core/server/mocks';
import { createJWTAssertion } from './create_jwt_assertion';

View file

@ -5,8 +5,9 @@
* 2.0.
*/
import jwt, { Algorithm } from 'jsonwebtoken';
import { Logger } from '@kbn/core/server';
import type { Algorithm } from 'jsonwebtoken';
import jwt from 'jsonwebtoken';
import type { Logger } from '@kbn/core/server';
export interface JWTClaims {
audience: string;

View file

@ -10,8 +10,9 @@ import { resolve as pathResolve, join as pathJoin } from 'path';
import { ByteSizeValue } from '@kbn/config-schema';
import moment from 'moment';
import { ActionsConfig, DEFAULT_USAGE_API_URL } from '../config';
import { Logger } from '@kbn/core/server';
import type { ActionsConfig } from '../config';
import { DEFAULT_USAGE_API_URL } from '../config';
import type { Logger } from '@kbn/core/server';
import { loggingSystemMock } from '@kbn/core/server/mocks';
import { resolveCustomHosts, getCanonicalCustomHostUrl } from './custom_host_settings';

View file

@ -7,8 +7,8 @@
import { readFileSync } from 'fs';
import { cloneDeep } from 'lodash';
import { Logger } from '@kbn/core/server';
import { ActionsConfig, CustomHostSettings } from '../config';
import type { Logger } from '@kbn/core/server';
import type { ActionsConfig, CustomHostSettings } from '../config';
type DeepWriteable<T> = { -readonly [P in keyof T]: DeepWriteable<T[P]> };

View file

@ -6,7 +6,7 @@
*/
import { schema } from '@kbn/config-schema';
import { ActionType } from '../types';
import type { ActionType } from '../types';
import { ensureSufficientLicense } from './ensure_sufficient_license';
const sampleActionType: ActionType = {

View file

@ -6,8 +6,8 @@
*/
import { LICENSE_TYPE } from '@kbn/licensing-plugin/common/types';
import { ActionType } from '../types';
import { ActionTypeConfig, ActionTypeSecrets, ActionTypeParams } from '../types';
import type { ActionType } from '../types';
import type { ActionTypeConfig, ActionTypeSecrets, ActionTypeParams } from '../types';
const ServerLogActionTypeId = '.server-log';
const IndexActionTypeId = '.index';

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { ActionTypeExecutorResult } from '../../types';
import type { ActionTypeExecutorResult } from '../../types';
export enum ActionExecutionErrorReason {
Validation = 'validation',

View file

@ -5,8 +5,8 @@
* 2.0.
*/
import { KibanaResponseFactory } from '@kbn/core/server';
import { ErrorThatHandlesItsOwnResponse } from './types';
import type { KibanaResponseFactory } from '@kbn/core/server';
import type { ErrorThatHandlesItsOwnResponse } from './types';
export type ActionTypeDisabledReason =
| 'config'

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { ErrorThatHandlesItsOwnResponse } from './types';
import type { ErrorThatHandlesItsOwnResponse } from './types';
export function isErrorThatHandlesItsOwnResponse(
e: ErrorThatHandlesItsOwnResponse

View file

@ -5,8 +5,8 @@
* 2.0.
*/
import { KibanaResponseFactory } from '@kbn/core/server';
import { ErrorThatHandlesItsOwnResponse } from './types';
import type { KibanaResponseFactory } from '@kbn/core/server';
import type { ErrorThatHandlesItsOwnResponse } from './types';
export type PreconfiguredActionDisabledFrom = 'update' | 'delete';

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { KibanaResponseFactory, IKibanaResponse } from '@kbn/core/server';
import type { KibanaResponseFactory, IKibanaResponse } from '@kbn/core/server';
export interface ErrorThatHandlesItsOwnResponse extends Error {
sendResponse(res: KibanaResponseFactory): IKibanaResponse;

View file

@ -6,23 +6,19 @@
*/
import { PassThrough, Readable } from 'stream';
import { Logger } from '@kbn/logging';
import { Stream } from 'openai/streaming';
import { ChatCompletionChunk } from 'openai/resources/chat/completions';
import {
getTokensFromBedrockConverseStream,
SmithyStream,
} from './get_token_count_from_bedrock_converse';
import {
InvokeAsyncIteratorBody,
getTokenCountFromInvokeAsyncIterator,
} from './get_token_count_from_invoke_async_iterator';
import type { Logger } from '@kbn/logging';
import type { Stream } from 'openai/streaming';
import type { ChatCompletionChunk } from 'openai/resources/chat/completions';
import type { SmithyStream } from './get_token_count_from_bedrock_converse';
import { getTokensFromBedrockConverseStream } from './get_token_count_from_bedrock_converse';
import type { InvokeAsyncIteratorBody } from './get_token_count_from_invoke_async_iterator';
import { getTokenCountFromInvokeAsyncIterator } from './get_token_count_from_invoke_async_iterator';
import { getTokenCountFromBedrockInvoke } from './get_token_count_from_bedrock_invoke';
import { ActionTypeExecutorRawResult } from '../../common';
import type { ActionTypeExecutorRawResult } from '../../common';
import { getTokenCountFromOpenAIStream } from './get_token_count_from_openai_stream';
import type { InvokeBody } from './get_token_count_from_invoke_stream';
import {
getTokenCountFromInvokeStream,
InvokeBody,
parseGeminiStreamForUsageMetadata,
} from './get_token_count_from_invoke_stream';

View file

@ -5,9 +5,9 @@
* 2.0.
*/
import { ActionsClientContext } from '../actions_client';
import { ActionExecutionSourceType } from './action_execution_source';
import { ExecuteOptions } from './action_executor';
import type { ActionsClientContext } from '../actions_client';
import type { ActionExecutionSourceType } from './action_execution_source';
import type { ExecuteOptions } from './action_executor';
export function getActionKibanaPrivileges(
context: ActionsClientContext,

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { ActionType } from '../types';
import type { ActionType } from '../types';
export function getActionTypeFeatureUsageName(actionType: ActionType) {
return `Connector: ${actionType.name}`;

View file

@ -8,7 +8,7 @@
import { Agent as HttpsAgent } from 'https';
import { HttpProxyAgent } from 'http-proxy-agent';
import { HttpsProxyAgent } from 'https-proxy-agent';
import { Logger } from '@kbn/core/server';
import type { Logger } from '@kbn/core/server';
import { getCustomAgents } from './get_custom_agents';
import { loggingSystemMock } from '@kbn/core/server/mocks';
import { actionsConfigMock } from '../actions_config.mock';

View file

@ -5,14 +5,15 @@
* 2.0.
*/
import { Agent as HttpAgent } from 'http';
import { Agent as HttpsAgent, AgentOptions } from 'https';
import type { Agent as HttpAgent } from 'http';
import type { AgentOptions } from 'https';
import { Agent as HttpsAgent } from 'https';
import { HttpProxyAgent } from 'http-proxy-agent';
import { HttpsProxyAgent } from 'https-proxy-agent';
import { Logger } from '@kbn/core/server';
import { ActionsConfigurationUtilities } from '../actions_config';
import type { Logger } from '@kbn/core/server';
import type { ActionsConfigurationUtilities } from '../actions_config';
import { getNodeSSLOptions, getSSLSettingsFromConfig } from './get_node_ssl_options';
import { SSLSettings } from '../types';
import type { SSLSettings } from '../types';
interface GetCustomAgentsResponse {
httpAgent: HttpAgent | undefined;

View file

@ -7,10 +7,10 @@
import type { estypes } from '@elastic/elasticsearch';
import { fromKueryExpression } from '@kbn/es-query';
import type { ExecutionUuidAggResult } from './get_execution_log_aggregation';
import {
getExecutionLogAggregation,
formatExecutionLogResult,
ExecutionUuidAggResult,
getExecutionKPIAggregation,
formatExecutionKPIResult,
} from './get_execution_log_aggregation';

View file

@ -5,13 +5,15 @@
* 2.0.
*/
import { KueryNode } from '@kbn/es-query';
import type { estypes } from '@elastic/elasticsearch';
import type { KueryNode } from '@kbn/es-query';
import type * as estypes from '@elastic/elasticsearch/lib/api/types';
import Boom from '@hapi/boom';
import { flatMap, get, isEmpty } from 'lodash';
import { AggregateEventsBySavedObjectResult } from '@kbn/event-log-plugin/server';
import type { AggregateEventsBySavedObjectResult } from '@kbn/event-log-plugin/server';
import { fromKueryExpression, toElasticsearchQuery } from '@kbn/es-query';
import { IExecutionLog, IExecutionLogResult, EMPTY_EXECUTION_KPI_RESULT } from '../../common';
import type { IExecutionLog, IExecutionLogResult } from '../../common';
import { EMPTY_EXECUTION_KPI_RESULT } from '../../common';
const DEFAULT_MAX_BUCKETS_LIMIT = 1000; // do not retrieve more than this number of executions
const DEFAULT_MAX_KPI_BUCKETS_LIMIT = 10000;

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { Logger } from '@kbn/core/server';
import type { Logger } from '@kbn/core/server';
import { connectorTokenClientMock } from './connector_token_client.mock';
import { loggingSystemMock } from '@kbn/core/server/mocks';

View file

@ -4,9 +4,9 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { Logger } from '@kbn/core/server';
import type { Logger } from '@kbn/core/server';
import { GoogleAuth } from 'google-auth-library';
import { ConnectorToken, ConnectorTokenClientContract } from '../types';
import type { ConnectorToken, ConnectorTokenClientContract } from '../types';
interface GetOAuthJwtAccessTokenOpts {
connectorId?: string;
@ -22,7 +22,7 @@ export const getGoogleOAuthJwtAccessToken = async ({
}: GetOAuthJwtAccessTokenOpts) => {
let accessToken;
let connectorToken: ConnectorToken | null = null;
let hasErrors: boolean = false;
let hasErrors = false;
const expiresInSec = 3500;
if (connectorId && connectorTokenClient) {

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { getNodeSSLOptions, getSSLSettingsFromConfig } from './get_node_ssl_options';
import { Logger } from '@kbn/core/server';
import type { Logger } from '@kbn/core/server';
import { loggingSystemMock } from '@kbn/core/server/mocks';
const logger = loggingSystemMock.create().get() as jest.Mocked<Logger>;

View file

@ -5,9 +5,9 @@
* 2.0.
*/
import { PeerCertificate } from 'tls';
import { Logger } from '@kbn/core/server';
import { SSLSettings } from '../types';
import type { PeerCertificate } from 'tls';
import type { Logger } from '@kbn/core/server';
import type { SSLSettings } from '../types';
export function getNodeSSLOptions(
logger: Logger,
@ -31,7 +31,7 @@ export function getNodeSSLOptions(
passphrase?: string;
ca?: Buffer;
} = {};
if (!!verificationMode) {
if (verificationMode) {
switch (verificationMode) {
case 'none':
agentOptions.rejectUnauthorized = false;

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import sinon from 'sinon';
import { Logger } from '@kbn/core/server';
import type { Logger } from '@kbn/core/server';
import { asyncForEach } from '@kbn/std';
import { loggingSystemMock } from '@kbn/core/server/mocks';
import { actionsConfigMock } from '../actions_config.mock';

View file

@ -4,9 +4,9 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { Logger } from '@kbn/core/server';
import { ActionsConfigurationUtilities } from '../actions_config';
import { ConnectorToken, ConnectorTokenClientContract } from '../types';
import type { Logger } from '@kbn/core/server';
import type { ActionsConfigurationUtilities } from '../actions_config';
import type { ConnectorToken, ConnectorTokenClientContract } from '../types';
import { requestOAuthClientCredentialsToken } from './request_oauth_client_credentials_token';
export interface GetOAuthClientCredentialsConfig {
@ -50,7 +50,7 @@ export const getOAuthClientCredentialsAccessToken = async ({
let accessToken: string;
let connectorToken: ConnectorToken | null = null;
let hasErrors: boolean = false;
let hasErrors = false;
if (connectorId && connectorTokenClient) {
// Check if there is a token stored for this connector

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import sinon from 'sinon';
import { Logger } from '@kbn/core/server';
import type { Logger } from '@kbn/core/server';
import { asyncForEach } from '@kbn/std';
import { loggingSystemMock } from '@kbn/core/server/mocks';
import { actionsConfigMock } from '../actions_config.mock';

View file

@ -4,9 +4,9 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { Logger } from '@kbn/core/server';
import { ActionsConfigurationUtilities } from '../actions_config';
import { ConnectorToken, ConnectorTokenClientContract } from '../types';
import type { Logger } from '@kbn/core/server';
import type { ActionsConfigurationUtilities } from '../actions_config';
import type { ConnectorToken, ConnectorTokenClientContract } from '../types';
import { createJWTAssertion } from './create_jwt_assertion';
import { requestOAuthJWTToken } from './request_oauth_jwt_token';
@ -52,7 +52,7 @@ export const getOAuthJwtAccessToken = async ({
let accessToken: string;
let connectorToken: ConnectorToken | null = null;
let hasErrors: boolean = false;
let hasErrors = false;
if (connectorId && connectorTokenClient) {
// Check if there is a token stored for this connector

View file

@ -5,8 +5,8 @@
* 2.0.
*/
import { SmithyMessageDecoderStream } from '@smithy/eventstream-codec';
import { Logger } from '@kbn/logging';
import type { SmithyMessageDecoderStream } from '@smithy/eventstream-codec';
import type { Logger } from '@kbn/logging';
export type SmithyStream = SmithyMessageDecoderStream<{
metadata?: {

View file

@ -4,13 +4,11 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import {
getTokenCountFromInvokeAsyncIterator,
InvokeAsyncIteratorBody,
} from './get_token_count_from_invoke_async_iterator';
import type { InvokeAsyncIteratorBody } from './get_token_count_from_invoke_async_iterator';
import { getTokenCountFromInvokeAsyncIterator } from './get_token_count_from_invoke_async_iterator';
import { loggerMock } from '@kbn/logging-mocks';
import { Stream } from 'openai/streaming';
import { ChatCompletionChunk } from 'openai/resources/chat/completions';
import type { Stream } from 'openai/streaming';
import type { ChatCompletionChunk } from 'openai/resources/chat/completions';
const body: InvokeAsyncIteratorBody = {
messages: [

Some files were not shown because too many files have changed in this diff Show more