security solution and lists to TS incremental builds (#100447)

* lists to ts incremental builds

* security_solution to ts incremental

* import ResizeObserver explicitly as it is not declared in dom types
This commit is contained in:
Mikhail Shustov 2021-05-24 16:34:29 +02:00 committed by GitHub
parent 496999fbfc
commit 95e8eed7d1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 149 additions and 58 deletions

View file

@ -27,7 +27,10 @@ import { OnPreResponseToolkit } from './lifecycle/on_pre_response';
import { OnPostAuthToolkit } from './lifecycle/on_post_auth';
import { OnPreRoutingToolkit } from './lifecycle/on_pre_routing';
interface RequestFixtureOptions<P = any, Q = any, B = any> {
/**
* @internal
*/
export interface RequestFixtureOptions<P = any, Q = any, B = any> {
auth?: { isAuthenticated: boolean };
headers?: Record<string, string>;
params?: Record<string, any>;

View file

@ -13,15 +13,9 @@
"src/legacy/**/*",
"src/optimize/**/*",
"x-pack/mocks.ts",
"x-pack/typings/**/*",
"x-pack/tasks/**/*",
"x-pack/plugins/lists/**/*",
"x-pack/plugins/security_solution/**/*"
],
"exclude": [
"x-pack/plugins/security_solution/cypress/**/*"
],
"exclude": [],
"references": [
{ "path": "./src/core/tsconfig.json" },
{ "path": "./src/plugins/telemetry_management_section/tsconfig.json" },
@ -108,6 +102,7 @@
{ "path": "./x-pack/plugins/license_api_guard/tsconfig.json" },
{ "path": "./x-pack/plugins/license_management/tsconfig.json" },
{ "path": "./x-pack/plugins/licensing/tsconfig.json" },
{ "path": "./x-pack/plugins/lists/tsconfig.json" },
{ "path": "./x-pack/plugins/logstash/tsconfig.json" },
{ "path": "./x-pack/plugins/maps/tsconfig.json" },
{ "path": "./x-pack/plugins/metrics_entities/tsconfig.json" },
@ -119,6 +114,7 @@
{ "path": "./x-pack/plugins/saved_objects_tagging/tsconfig.json" },
{ "path": "./x-pack/plugins/searchprofiler/tsconfig.json" },
{ "path": "./x-pack/plugins/security/tsconfig.json" },
{ "path": "./x-pack/plugins/security_solution/tsconfig.json" },
{ "path": "./x-pack/plugins/snapshot_restore/tsconfig.json" },
{ "path": "./x-pack/plugins/spaces/tsconfig.json" },
{ "path": "./x-pack/plugins/stack_alerts/tsconfig.json" },

View file

@ -85,6 +85,7 @@
{ "path": "./x-pack/plugins/lens/tsconfig.json" },
{ "path": "./x-pack/plugins/license_management/tsconfig.json" },
{ "path": "./x-pack/plugins/licensing/tsconfig.json" },
{ "path": "./x-pack/plugins/lists/tsconfig.json" },
{ "path": "./x-pack/plugins/logstash/tsconfig.json" },
{ "path": "./x-pack/plugins/maps/tsconfig.json" },
{ "path": "./x-pack/plugins/metrics_entities/tsconfig.json" },
@ -97,6 +98,7 @@
{ "path": "./x-pack/plugins/saved_objects_tagging/tsconfig.json" },
{ "path": "./x-pack/plugins/searchprofiler/tsconfig.json" },
{ "path": "./x-pack/plugins/security/tsconfig.json" },
{ "path": "./x-pack/plugins/security_solution/tsconfig.json" },
{ "path": "./x-pack/plugins/snapshot_restore/tsconfig.json" },
{ "path": "./x-pack/plugins/spaces/tsconfig.json" },
{ "path": "./x-pack/plugins/stack_alerts/tsconfig.json" },

View file

@ -0,0 +1,23 @@
{
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
"emitDeclarationOnly": true,
"declaration": true,
"declarationMap": true
},
"include": [
"common/**/*",
"public/**/*",
"server/**/*",
// have to declare *.json explicitly due to https://github.com/microsoft/TypeScript/issues/25636
"server/**/*.json",
],
"references": [
{ "path": "../../../src/core/tsconfig.json" },
{ "path": "../spaces/tsconfig.json" },
{ "path": "../security/tsconfig.json"},
]
}

View file

@ -70,7 +70,7 @@ import {
last_failure_message,
} from '../common/schemas';
const createSchema = <
export const createSchema = <
Required extends t.Props,
Optional extends t.Props,
Defaultable extends t.Props
@ -118,7 +118,7 @@ const responseSchema = <
]);
};
const buildAPISchemas = <R extends t.Props, O extends t.Props, D extends t.Props>(
export const buildAPISchemas = <R extends t.Props, O extends t.Props, D extends t.Props>(
params: APIParams<R, O, D>
) => {
return {
@ -216,6 +216,7 @@ const {
patch: eqlPatchParams,
response: eqlResponseParams,
} = buildAPISchemas(eqlRuleParams);
export { eqlCreateParams };
const threatMatchRuleParams = {
required: {
@ -244,6 +245,7 @@ const {
patch: threatMatchPatchParams,
response: threatMatchResponseParams,
} = buildAPISchemas(threatMatchRuleParams);
export { threatMatchCreateParams };
const queryRuleParams = {
required: {
@ -265,6 +267,8 @@ const {
response: queryResponseParams,
} = buildAPISchemas(queryRuleParams);
export { queryCreateParams };
const savedQueryRuleParams = {
required: {
type: t.literal('saved_query'),
@ -287,6 +291,8 @@ const {
response: savedQueryResponseParams,
} = buildAPISchemas(savedQueryRuleParams);
export { savedQueryCreateParams };
const thresholdRuleParams = {
required: {
type: t.literal('threshold'),
@ -308,6 +314,8 @@ const {
response: thresholdResponseParams,
} = buildAPISchemas(thresholdRuleParams);
export { thresholdCreateParams };
const machineLearningRuleParams = {
required: {
type: t.literal('machine_learning'),
@ -323,6 +331,8 @@ const {
response: machineLearningResponseParams,
} = buildAPISchemas(machineLearningRuleParams);
export { machineLearningCreateParams };
const createTypeSpecific = t.union([
eqlCreateParams,
threatMatchCreateParams,

View file

@ -59,9 +59,9 @@ export type Immutable<T> = T extends undefined | null | boolean | string | numbe
: ImmutableObject<T>;
export type ImmutableArray<T> = ReadonlyArray<Immutable<T>>;
type ImmutableMap<K, V> = ReadonlyMap<Immutable<K>, Immutable<V>>;
type ImmutableSet<T> = ReadonlySet<Immutable<T>>;
type ImmutableObject<T> = { readonly [K in keyof T]: Immutable<T[K]> };
export type ImmutableMap<K, V> = ReadonlyMap<Immutable<K>, Immutable<V>>;
export type ImmutableSet<T> = ReadonlySet<Immutable<T>>;
export type ImmutableObject<T> = { readonly [K in keyof T]: Immutable<T[K]> };
/**
* Utility type that will return back a union of the given [T]ype and an Immutable version of it

View file

@ -14,7 +14,7 @@ import { useHttp } from '../../../lib/kibana';
import { useGetMlCapabilities } from '../hooks/use_get_ml_capabilities';
import * as i18n from './translations';
interface MlCapabilitiesProvider extends MlCapabilitiesResponse {
export interface MlCapabilitiesProvider extends MlCapabilitiesResponse {
capabilitiesFetched: boolean;
}

View file

@ -12,7 +12,7 @@ import React from 'react';
import { inputsModel } from '../../store';
import { GlobalTimeArgs } from '../../containers/use_global_time';
interface OwnProps extends Pick<GlobalTimeArgs, 'deleteQuery' | 'setQuery'> {
export interface OwnProps extends Pick<GlobalTimeArgs, 'deleteQuery' | 'setQuery'> {
headerChildren?: React.ReactNode;
id: string;
legendPosition?: Position;
@ -21,7 +21,9 @@ interface OwnProps extends Pick<GlobalTimeArgs, 'deleteQuery' | 'setQuery'> {
inspect?: inputsModel.InspectQuery;
}
export function manageQuery<T>(WrappedComponent: React.ComponentClass<T> | React.ComponentType<T>) {
export function manageQuery<T>(
WrappedComponent: React.ComponentClass<T> | React.ComponentType<T>
): React.ComponentClass<OwnProps & T> {
class ManageQuery extends React.PureComponent<OwnProps & T> {
static displayName: string;
public componentDidUpdate(prevProps: OwnProps) {

View file

@ -47,13 +47,13 @@ interface Range {
display: string;
}
interface UpdateReduxTime extends OnTimeChangeProps {
export interface UpdateReduxTime extends OnTimeChangeProps {
id: InputsModelId;
kql?: inputsModel.GlobalKqlQuery | undefined;
timelineId?: string;
}
interface ReturnUpdateReduxTime {
export interface ReturnUpdateReduxTime {
kqlHaveBeenUpdated: boolean;
}

View file

@ -73,7 +73,7 @@ const connector = connect(makeMapStateToProps);
// this component is rendered in the context of the active timeline. This
// behavior enables the 'All events' view by appending the alerts index
// to the index pattern.
interface OwnProps {
export interface OwnProps {
browserFields: BrowserFields;
field: string;
indexPattern: IIndexPattern;
@ -172,4 +172,6 @@ const StatefulTopNComponent: React.FC<Props> = ({
StatefulTopNComponent.displayName = 'StatefulTopNComponent';
export const StatefulTopN = connector(React.memo(StatefulTopNComponent));
export const StatefulTopN: React.FunctionComponent<OwnProps> = connector(
React.memo(StatefulTopNComponent)
);

View file

@ -18,93 +18,94 @@ import { GetPackagesResponse } from '../../../../../../fleet/common';
import { EndpointState } from '../types';
import { IIndexPattern } from '../../../../../../../../src/plugins/data/public';
interface ServerReturnedEndpointList {
export interface ServerReturnedEndpointList {
type: 'serverReturnedEndpointList';
payload: HostResultList;
}
interface ServerFailedToReturnEndpointList {
export interface ServerFailedToReturnEndpointList {
type: 'serverFailedToReturnEndpointList';
payload: ServerApiError;
}
interface ServerReturnedEndpointDetails {
export interface ServerReturnedEndpointDetails {
type: 'serverReturnedEndpointDetails';
payload: HostInfo;
}
interface ServerFailedToReturnEndpointDetails {
export interface ServerFailedToReturnEndpointDetails {
type: 'serverFailedToReturnEndpointDetails';
payload: ServerApiError;
}
interface ServerReturnedEndpointPolicyResponse {
export interface ServerReturnedEndpointPolicyResponse {
type: 'serverReturnedEndpointPolicyResponse';
payload: GetHostPolicyResponse;
}
interface ServerFailedToReturnEndpointPolicyResponse {
export interface ServerFailedToReturnEndpointPolicyResponse {
type: 'serverFailedToReturnEndpointPolicyResponse';
payload: ServerApiError;
}
interface ServerReturnedPoliciesForOnboarding {
export interface ServerReturnedPoliciesForOnboarding {
type: 'serverReturnedPoliciesForOnboarding';
payload: {
policyItems: GetPolicyListResponse['items'];
};
}
interface ServerFailedToReturnPoliciesForOnboarding {
export interface ServerFailedToReturnPoliciesForOnboarding {
type: 'serverFailedToReturnPoliciesForOnboarding';
payload: ServerApiError;
}
interface UserSelectedEndpointPolicy {
export interface UserSelectedEndpointPolicy {
type: 'userSelectedEndpointPolicy';
payload: {
selectedPolicyId: string;
};
}
interface ServerCancelledEndpointListLoading {
export interface ServerCancelledEndpointListLoading {
type: 'serverCancelledEndpointListLoading';
}
interface ServerCancelledPolicyItemsLoading {
export interface ServerCancelledPolicyItemsLoading {
type: 'serverCancelledPolicyItemsLoading';
}
interface ServerReturnedEndpointPackageInfo {
export interface ServerReturnedEndpointPackageInfo {
type: 'serverReturnedEndpointPackageInfo';
payload: GetPackagesResponse['response'][0];
}
interface ServerReturnedEndpointNonExistingPolicies {
export interface ServerReturnedEndpointNonExistingPolicies {
type: 'serverReturnedEndpointNonExistingPolicies';
payload: EndpointState['nonExistingPolicies'];
}
interface ServerReturnedEndpointAgentPolicies {
export interface ServerReturnedEndpointAgentPolicies {
type: 'serverReturnedEndpointAgentPolicies';
payload: EndpointState['agentPolicies'];
}
interface ServerReturnedEndpointExistValue {
export interface ServerReturnedEndpointExistValue {
type: 'serverReturnedEndpointExistValue';
payload: boolean;
}
interface ServerReturnedMetadataPatterns {
export interface ServerReturnedMetadataPatterns {
type: 'serverReturnedMetadataPatterns';
payload: IIndexPattern[];
}
interface ServerFailedToReturnMetadataPatterns {
export interface ServerFailedToReturnMetadataPatterns {
type: 'serverFailedToReturnMetadataPatterns';
payload: ServerApiError;
}
interface UserUpdatedEndpointListRefreshOptions {
export interface UserUpdatedEndpointListRefreshOptions {
type: 'userUpdatedEndpointListRefreshOptions';
payload: {
isAutoRefreshEnabled?: boolean;
@ -112,26 +113,26 @@ interface UserUpdatedEndpointListRefreshOptions {
};
}
interface AppRequestedEndpointList {
export interface AppRequestedEndpointList {
type: 'appRequestedEndpointList';
}
interface ServerReturnedAgenstWithEndpointsTotal {
export interface ServerReturnedAgenstWithEndpointsTotal {
type: 'serverReturnedAgenstWithEndpointsTotal';
payload: number;
}
interface ServerFailedToReturnAgenstWithEndpointsTotal {
export interface ServerFailedToReturnAgenstWithEndpointsTotal {
type: 'serverFailedToReturnAgenstWithEndpointsTotal';
payload: ServerApiError;
}
interface ServerReturnedEndpointsTotal {
export interface ServerReturnedEndpointsTotal {
type: 'serverReturnedEndpointsTotal';
payload: number;
}
interface ServerFailedToReturnEndpointsTotal {
export interface ServerFailedToReturnEndpointsTotal {
type: 'serverFailedToReturnEndpointsTotal';
payload: ServerApiError;
}

View file

@ -11,14 +11,14 @@ import { PolicyData, UIPolicyConfig } from '../../../../../../common/endpoint/ty
import { ServerApiError } from '../../../../../common/types';
import { PolicyDetailsState } from '../../types';
interface ServerReturnedPolicyDetailsData {
export interface ServerReturnedPolicyDetailsData {
type: 'serverReturnedPolicyDetailsData';
payload: {
policyItem: PolicyData | undefined;
};
}
interface ServerFailedToReturnPolicyDetailsData {
export interface ServerFailedToReturnPolicyDetailsData {
type: 'serverFailedToReturnPolicyDetailsData';
payload: ServerApiError;
}
@ -26,33 +26,33 @@ interface ServerFailedToReturnPolicyDetailsData {
/**
* When users change a policy via forms, this action is dispatched with a payload that modifies the configuration of a cloned policy config.
*/
interface UserChangedPolicyConfig {
export interface UserChangedPolicyConfig {
type: 'userChangedPolicyConfig';
payload: {
policyConfig: UIPolicyConfig;
};
}
interface UserChangedAntivirusRegistration {
export interface UserChangedAntivirusRegistration {
type: 'userChangedAntivirusRegistration';
payload: {
enabled: boolean;
};
}
interface ServerReturnedPolicyDetailsAgentSummaryData {
export interface ServerReturnedPolicyDetailsAgentSummaryData {
type: 'serverReturnedPolicyDetailsAgentSummaryData';
payload: {
agentStatusSummary: GetAgentStatusResponse['results'];
};
}
interface ServerReturnedPolicyDetailsUpdateFailure {
export interface ServerReturnedPolicyDetailsUpdateFailure {
type: 'serverReturnedPolicyDetailsUpdateFailure';
payload: PolicyDetailsState['updateStatus'];
}
interface ServerReturnedUpdatedPolicyDetailsData {
export interface ServerReturnedUpdatedPolicyDetailsData {
type: 'serverReturnedUpdatedPolicyDetailsData';
payload: {
policyItem: PolicyData;
@ -60,11 +60,11 @@ interface ServerReturnedUpdatedPolicyDetailsData {
};
}
interface UserClickedPolicyDetailsSaveButton {
export interface UserClickedPolicyDetailsSaveButton {
type: 'userClickedPolicyDetailsSaveButton';
}
interface LicenseChanged {
export interface LicenseChanged {
type: 'licenseChanged';
payload: ILicense;
}

View file

@ -19,7 +19,7 @@ import {
import * as scalingConstants from './scaling_constants';
import { Vector2, CameraState, AABB, Matrix3, CameraAnimationState } from '../../types';
interface ClippingPlanes {
export interface ClippingPlanes {
renderWidth: number;
renderHeight: number;
clippingPlaneRight: number;

View file

@ -6,6 +6,7 @@
*/
/* eslint-disable no-duplicate-imports */
import type ResizeObserver from 'resize-observer-polyfill';
import type React from 'react';
import { Store } from 'redux';
import { Middleware, Dispatch } from 'redux';

View file

@ -10,7 +10,7 @@ import { IScopedClusterClient, SavedObjectsClientContract } from '../../../../..
import { listMock } from '../../../lists/server/mocks';
import { securityMock } from '../../../security/server/mocks';
import { alertsMock } from '../../../alerting/server/mocks';
import { xpackMocks } from '../../../../mocks';
import { xpackMocks } from '../fixtures';
import { FleetStartContract, ExternalCallback, PackageService } from '../../../fleet/server';
import {
createPackagePolicyServiceMock,

View file

@ -7,7 +7,7 @@
import { KibanaResponseFactory } from 'kibana/server';
import { xpackMocks } from '../../../../../../mocks';
import { xpackMocks } from '../../../fixtures';
import { loggingSystemMock, httpServerMock } from '../../../../../../../src/core/server/mocks';
import { ExceptionListItemSchema } from '@kbn/securitysolution-io-ts-list-types';
import { listMock } from '../../../../../lists/server/mocks';

View file

@ -5,8 +5,8 @@
* 2.0.
*/
import { coreMock } from '../src/core/server/mocks';
import { licensingMock } from './plugins/licensing/server/mocks';
import { coreMock } from '../../../../src/core/server/mocks';
import { licensingMock } from '../../licensing/server/mocks';
function createCoreRequestHandlerContextMock() {
return {

View file

@ -17,7 +17,10 @@ interface ResponseCall {
status: number;
}
interface Response extends ResponseCall {
/**
* @internal
*/
export interface Response extends ResponseCall {
calls: ResponseCall[];
}

View file

@ -0,0 +1,46 @@
{
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
"emitDeclarationOnly": true,
"declaration": true,
"declarationMap": true
},
"include": [
"common/**/*",
"public/**/*",
"server/**/*",
"scripts/**/*",
// have to declare *.json explicitly due to https://github.com/microsoft/TypeScript/issues/25636
"server/**/*.json",
"public/**/*.json",
"../../../typings/**/*"
],
"references": [
{ "path": "../../../src/core/tsconfig.json" },
{ "path": "../../../src/plugins/data/tsconfig.json" },
{ "path": "../../../src/plugins/embeddable/tsconfig.json" },
{ "path": "../../../src/plugins/home/tsconfig.json" },
{ "path": "../../../src/plugins/inspector/tsconfig.json" },
{ "path": "../../../src/plugins/ui_actions/tsconfig.json" },
{ "path": "../../../src/plugins/newsfeed/tsconfig.json" },
{ "path": "../../../src/plugins/usage_collection/tsconfig.json" },
{ "path": "../../../src/plugins/telemetry/tsconfig.json" },
{ "path": "../../../src/plugins/telemetry_management_section/tsconfig.json" },
{ "path": "../actions/tsconfig.json" },
{ "path": "../alerting/tsconfig.json" },
{ "path": "../cases/tsconfig.json" },
{ "path": "../data_enhanced/tsconfig.json" },
{ "path": "../encrypted_saved_objects/tsconfig.json" },
{ "path": "../features/tsconfig.json" },
{ "path": "../fleet/tsconfig.json" },
{ "path": "../licensing/tsconfig.json" },
{ "path": "../lists/tsconfig.json" },
{ "path": "../maps/tsconfig.json" },
{ "path": "../ml/tsconfig.json" },
{ "path": "../spaces/tsconfig.json" },
{ "path": "../security/tsconfig.json"},
]
}

View file

@ -68,6 +68,7 @@
{ "path": "../plugins/lens/tsconfig.json" },
{ "path": "../plugins/license_management/tsconfig.json" },
{ "path": "../plugins/licensing/tsconfig.json" },
{ "path": "../plugins/lists/tsconfig.json" },
{ "path": "../plugins/logstash/tsconfig.json" },
{ "path": "../plugins/metrics_entities/tsconfig.json" },
{ "path": "../plugins/ml/tsconfig.json" },
@ -78,6 +79,7 @@
{ "path": "../plugins/runtime_fields/tsconfig.json" },
{ "path": "../plugins/saved_objects_tagging/tsconfig.json" },
{ "path": "../plugins/security/tsconfig.json" },
{ "path": "../plugins/security_solution/tsconfig.json" },
{ "path": "../plugins/snapshot_restore/tsconfig.json" },
{ "path": "../plugins/spaces/tsconfig.json" },
{ "path": "../plugins/stack_alerts/tsconfig.json" },