Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7.x] security solution and lists to TS incremental builds (#100447) #100464

Merged
merged 1 commit into from
May 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/core/server/http/http_server.mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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>;
Expand Down
10 changes: 3 additions & 7 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
Expand Down Expand Up @@ -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" },
Expand All @@ -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" },
Expand Down
2 changes: 2 additions & 0 deletions tsconfig.refs.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,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" },
Expand All @@ -98,6 +99,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" },
Expand Down
23 changes: 23 additions & 0 deletions x-pack/plugins/lists/tsconfig.json
Original file line number Diff line number Diff line change
@@ -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"},
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -216,6 +216,7 @@ const {
patch: eqlPatchParams,
response: eqlResponseParams,
} = buildAPISchemas(eqlRuleParams);
export { eqlCreateParams };

const threatMatchRuleParams = {
required: {
Expand Down Expand Up @@ -244,6 +245,7 @@ const {
patch: threatMatchPatchParams,
response: threatMatchResponseParams,
} = buildAPISchemas(threatMatchRuleParams);
export { threatMatchCreateParams };

const queryRuleParams = {
required: {
Expand All @@ -265,6 +267,8 @@ const {
response: queryResponseParams,
} = buildAPISchemas(queryRuleParams);

export { queryCreateParams };

const savedQueryRuleParams = {
required: {
type: t.literal('saved_query'),
Expand All @@ -287,6 +291,8 @@ const {
response: savedQueryResponseParams,
} = buildAPISchemas(savedQueryRuleParams);

export { savedQueryCreateParams };

const thresholdRuleParams = {
required: {
type: t.literal('threshold'),
Expand All @@ -308,6 +314,8 @@ const {
response: thresholdResponseParams,
} = buildAPISchemas(thresholdRuleParams);

export { thresholdCreateParams };

const machineLearningRuleParams = {
required: {
type: t.literal('machine_learning'),
Expand All @@ -323,6 +331,8 @@ const {
response: machineLearningResponseParams,
} = buildAPISchemas(machineLearningRuleParams);

export { machineLearningCreateParams };

const createTypeSpecific = t.union([
eqlCreateParams,
threatMatchCreateParams,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
);
Original file line number Diff line number Diff line change
Expand Up @@ -16,120 +16,121 @@ 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;
autoRefreshInterval?: number;
};
}

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;
}
Expand Down
Loading