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

[Move @kbn/config-schema to server] stack_connectors #191864

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
20 changes: 7 additions & 13 deletions x-pack/plugins/stack_connectors/common/auth/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,10 @@
* 2.0.
*/

import { TypeOf } from '@kbn/config-schema';
import {
AuthConfiguration,
authTypeSchema,
hasAuthSchema,
SecretConfigurationSchema,
} from './schema';

export type HasAuth = TypeOf<typeof hasAuthSchema>;
export type AuthTypeName = TypeOf<typeof authTypeSchema>;
export type SecretsConfigurationType = TypeOf<typeof SecretConfigurationSchema>;
export type CAType = TypeOf<typeof AuthConfiguration.ca>;
export type VerificationModeType = TypeOf<typeof AuthConfiguration.verificationMode>;
export type {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reexporting the types from common to avoid more changes in other parts of the code.

HasAuth,
AuthTypeName,
SecretsConfigurationType,
CAType,
VerificationModeType,
} from '../../server/connector_types/auth/schema';
48 changes: 16 additions & 32 deletions x-pack/plugins/stack_connectors/common/bedrock/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,19 @@
* 2.0.
*/

import { TypeOf } from '@kbn/config-schema';
import {
ConfigSchema,
DashboardActionParamsSchema,
DashboardActionResponseSchema,
SecretsSchema,
RunActionParamsSchema,
RunActionResponseSchema,
InvokeAIActionParamsSchema,
InvokeAIActionResponseSchema,
InvokeAIRawActionParamsSchema,
InvokeAIRawActionResponseSchema,
StreamingResponseSchema,
RunApiLatestResponseSchema,
BedrockMessageSchema,
BedrockToolChoiceSchema,
} from './schema';

export type Config = TypeOf<typeof ConfigSchema>;
export type Secrets = TypeOf<typeof SecretsSchema>;
export type RunActionParams = TypeOf<typeof RunActionParamsSchema>;
export type InvokeAIActionParams = TypeOf<typeof InvokeAIActionParamsSchema>;
export type InvokeAIActionResponse = TypeOf<typeof InvokeAIActionResponseSchema>;
export type InvokeAIRawActionParams = TypeOf<typeof InvokeAIRawActionParamsSchema>;
export type InvokeAIRawActionResponse = TypeOf<typeof InvokeAIRawActionResponseSchema>;
export type RunApiLatestResponse = TypeOf<typeof RunApiLatestResponseSchema>;
export type RunActionResponse = TypeOf<typeof RunActionResponseSchema>;
export type StreamingResponse = TypeOf<typeof StreamingResponseSchema>;
export type DashboardActionParams = TypeOf<typeof DashboardActionParamsSchema>;
export type DashboardActionResponse = TypeOf<typeof DashboardActionResponseSchema>;
export type BedRockMessage = TypeOf<typeof BedrockMessageSchema>;
export type BedrockToolChoice = TypeOf<typeof BedrockToolChoiceSchema>;
export type {
Config,
Secrets,
RunActionParams,
InvokeAIActionParams,
InvokeAIActionResponse,
InvokeAIRawActionParams,
InvokeAIRawActionResponse,
RunApiLatestResponse,
RunActionResponse,
StreamingResponse,
DashboardActionParams,
DashboardActionResponse,
BedRockMessage,
BedrockToolChoice,
} from '../../server/connector_types/bedrock/schema';
44 changes: 12 additions & 32 deletions x-pack/plugins/stack_connectors/common/crowdstrike/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,15 @@
* 2.0.
*/

import { TypeOf } from '@kbn/config-schema';
import {
CrowdstrikeBaseApiResponseSchema,
CrowdstrikeConfigSchema,
CrowdstrikeGetAgentsParamsSchema,
CrowdstrikeGetAgentOnlineStatusResponseSchema,
CrowdstrikeHostActionsParamsSchema,
CrowdstrikeSecretsSchema,
CrowdstrikeActionParamsSchema,
CrowdstrikeGetTokenResponseSchema,
CrowdstrikeGetAgentsResponseSchema,
RelaxedCrowdstrikeBaseApiResponseSchema,
} from './schema';

export type CrowdstrikeConfig = TypeOf<typeof CrowdstrikeConfigSchema>;
export type CrowdstrikeSecrets = TypeOf<typeof CrowdstrikeSecretsSchema>;

export type CrowdstrikeBaseApiResponse = TypeOf<typeof CrowdstrikeBaseApiResponseSchema>;
export type RelaxedCrowdstrikeBaseApiResponse = TypeOf<
typeof RelaxedCrowdstrikeBaseApiResponseSchema
>;

export type CrowdstrikeGetAgentsParams = Partial<TypeOf<typeof CrowdstrikeGetAgentsParamsSchema>>;
export type CrowdstrikeGetAgentsResponse = TypeOf<typeof CrowdstrikeGetAgentsResponseSchema>;
export type CrowdstrikeGetAgentOnlineStatusResponse = TypeOf<
typeof CrowdstrikeGetAgentOnlineStatusResponseSchema
>;
export type CrowdstrikeGetTokenResponse = TypeOf<typeof CrowdstrikeGetTokenResponseSchema>;

export type CrowdstrikeHostActionsParams = TypeOf<typeof CrowdstrikeHostActionsParamsSchema>;

export type CrowdstrikeActionParams = TypeOf<typeof CrowdstrikeActionParamsSchema>;
export type {
CrowdstrikeConfig,
CrowdstrikeSecrets,
CrowdstrikeBaseApiResponse,
RelaxedCrowdstrikeBaseApiResponse,
CrowdstrikeGetAgentsParams,
CrowdstrikeGetAgentsResponse,
CrowdstrikeGetAgentOnlineStatusResponse,
CrowdstrikeGetTokenResponse,
CrowdstrikeHostActionsParams,
CrowdstrikeActionParams,
} from '../../server/connector_types/crowdstrike/schema';
18 changes: 6 additions & 12 deletions x-pack/plugins/stack_connectors/common/d3security/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,9 @@
* 2.0.
*/

import { TypeOf } from '@kbn/config-schema';
import {
D3SecurityConfigSchema,
D3SecuritySecretsSchema,
D3SecurityRunActionParamsSchema,
D3SecurityRunActionResponseSchema,
} from './schema';

export type D3SecurityConfig = TypeOf<typeof D3SecurityConfigSchema>;
export type D3SecuritySecrets = TypeOf<typeof D3SecuritySecretsSchema>;
export type D3SecurityRunActionParams = TypeOf<typeof D3SecurityRunActionParamsSchema>;
export type D3SecurityRunActionResponse = TypeOf<typeof D3SecurityRunActionResponseSchema>;
export type {
D3SecurityConfig,
D3SecuritySecrets,
D3SecurityRunActionParams,
D3SecurityRunActionResponse,
} from '../../server/connector_types/d3security/schema';
45 changes: 15 additions & 30 deletions x-pack/plugins/stack_connectors/common/gemini/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,18 @@
* 2.0.
*/

import { TypeOf } from '@kbn/config-schema';
import {
ConfigSchema,
DashboardActionParamsSchema,
DashboardActionResponseSchema,
SecretsSchema,
RunActionParamsSchema,
RunActionResponseSchema,
RunActionRawResponseSchema,
RunApiResponseSchema,
InvokeAIActionParamsSchema,
InvokeAIActionResponseSchema,
InvokeAIRawActionParamsSchema,
InvokeAIRawActionResponseSchema,
StreamingResponseSchema,
} from './schema';

export type Config = TypeOf<typeof ConfigSchema>;
export type Secrets = TypeOf<typeof SecretsSchema>;
export type RunActionParams = TypeOf<typeof RunActionParamsSchema>;
export type RunApiResponse = TypeOf<typeof RunApiResponseSchema>;
export type RunActionResponse = TypeOf<typeof RunActionResponseSchema>;
export type RunActionRawResponse = TypeOf<typeof RunActionRawResponseSchema>;
export type DashboardActionParams = TypeOf<typeof DashboardActionParamsSchema>;
export type DashboardActionResponse = TypeOf<typeof DashboardActionResponseSchema>;
export type InvokeAIActionParams = TypeOf<typeof InvokeAIActionParamsSchema>;
export type InvokeAIActionResponse = TypeOf<typeof InvokeAIActionResponseSchema>;
export type InvokeAIRawActionParams = TypeOf<typeof InvokeAIRawActionParamsSchema>;
export type InvokeAIRawActionResponse = TypeOf<typeof InvokeAIRawActionResponseSchema>;
export type StreamingResponse = TypeOf<typeof StreamingResponseSchema>;
export type {
Config,
Secrets,
RunActionParams,
RunApiResponse,
RunActionResponse,
RunActionRawResponse,
DashboardActionParams,
DashboardActionResponse,
InvokeAIActionParams,
InvokeAIActionResponse,
InvokeAIRawActionParams,
InvokeAIRawActionResponse,
StreamingResponse,
} from '../../server/connector_types/gemini/schema';
33 changes: 11 additions & 22 deletions x-pack/plugins/stack_connectors/common/openai/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,14 @@
* 2.0.
*/

import { TypeOf } from '@kbn/config-schema';
import {
ConfigSchema,
SecretsSchema,
RunActionParamsSchema,
RunActionResponseSchema,
DashboardActionParamsSchema,
DashboardActionResponseSchema,
StreamActionParamsSchema,
InvokeAIActionParamsSchema,
InvokeAIActionResponseSchema,
} from './schema';

export type Config = TypeOf<typeof ConfigSchema>;
export type Secrets = TypeOf<typeof SecretsSchema>;
export type RunActionParams = TypeOf<typeof RunActionParamsSchema>;
export type InvokeAIActionParams = TypeOf<typeof InvokeAIActionParamsSchema>;
export type InvokeAIActionResponse = TypeOf<typeof InvokeAIActionResponseSchema>;
export type RunActionResponse = TypeOf<typeof RunActionResponseSchema>;
export type DashboardActionParams = TypeOf<typeof DashboardActionParamsSchema>;
export type DashboardActionResponse = TypeOf<typeof DashboardActionResponseSchema>;
export type StreamActionParams = TypeOf<typeof StreamActionParamsSchema>;
export type {
Config,
Secrets,
RunActionParams,
InvokeAIActionParams,
InvokeAIActionResponse,
RunActionResponse,
DashboardActionParams,
DashboardActionResponse,
StreamActionParams,
} from '../../server/connector_types/openai/schema';
109 changes: 22 additions & 87 deletions x-pack/plugins/stack_connectors/common/sentinelone/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,28 @@
* 2.0.
*/

import { TypeOf } from '@kbn/config-schema';
import { Mutable } from 'utility-types';
import {
SentinelOneBaseApiResponseSchema,
SentinelOneConfigSchema,
SentinelOneExecuteScriptParamsSchema,
SentinelOneGetAgentsParamsSchema,
SentinelOneGetAgentsResponseSchema,
SentinelOneGetRemoteScriptsParamsSchema,
SentinelOneGetRemoteScriptsResponseSchema,
SentinelOneGetRemoteScriptStatusParamsSchema,
SentinelOneIsolateHostParamsSchema,
SentinelOneSecretsSchema,
SentinelOneActionParamsSchema,
SentinelOneFetchAgentFilesParamsSchema,
SentinelOneFetchAgentFilesResponseSchema,
SentinelOneDownloadAgentFileParamsSchema,
SentinelOneGetActivitiesParamsSchema,
SentinelOneGetActivitiesResponseSchema,
SentinelOneExecuteScriptResponseSchema,
SentinelOneGetRemoteScriptResultsParamsSchema,
SentinelOneDownloadRemoteScriptResultsParamsSchema,
} from './schema';
export type {
SentinelOneConfig,
SentinelOneSecrets,
SentinelOneBaseApiResponse,
SentinelOneGetAgentsParams,
SentinelOneGetAgentsResponse,
SentinelOneExecuteScriptParams,
SentinelOneExecuteScriptResponse,
SentinelOneGetRemoteScriptStatusParams,
SentinelOneGetRemoteScriptResultsParams,
SentinelOneDownloadRemoteScriptResultsParams,
SentinelOneGetRemoteScriptsParams,
SentinelOneGetRemoteScriptsResponse,
SentinelOneFetchAgentFilesParams,
SentinelOneFetchAgentFilesResponse,
SentinelOneDownloadAgentFileParams,
SentinelOneActivityRecord,
SentinelOneGetActivitiesParams,
SentinelOneGetActivitiesResponse,
SentinelOneIsolateHostParams,
SentinelOneActionParams,
} from '../../server/connector_types/sentinelone/schema';

interface SentinelOnePagination {
pagination: {
Expand All @@ -42,19 +41,6 @@ interface SentinelOneErrors {

export type SentinelOneOsType = 'linux' | 'macos' | 'windows';

export type SentinelOneConfig = TypeOf<typeof SentinelOneConfigSchema>;
export type SentinelOneSecrets = TypeOf<typeof SentinelOneSecretsSchema>;

export type SentinelOneBaseApiResponse = TypeOf<typeof SentinelOneBaseApiResponseSchema>;

export type SentinelOneGetAgentsParams = Partial<TypeOf<typeof SentinelOneGetAgentsParamsSchema>>;
export type SentinelOneGetAgentsResponse = TypeOf<typeof SentinelOneGetAgentsResponseSchema>;

export type SentinelOneExecuteScriptParams = TypeOf<typeof SentinelOneExecuteScriptParamsSchema>;
export type SentinelOneExecuteScriptResponse = TypeOf<
typeof SentinelOneExecuteScriptResponseSchema
>;

export interface SentinelOneRemoteScriptExecutionStatus {
accountId: string;
accountName: string;
Expand Down Expand Up @@ -96,20 +82,12 @@ export interface SentinelOneRemoteScriptExecutionStatus {
updatedAt: string;
}

export type SentinelOneGetRemoteScriptStatusParams = TypeOf<
typeof SentinelOneGetRemoteScriptStatusParamsSchema
>;

export interface SentinelOneGetRemoteScriptStatusApiResponse
extends SentinelOnePagination,
SentinelOneErrors {
data: SentinelOneRemoteScriptExecutionStatus[];
}

export type SentinelOneGetRemoteScriptResultsParams = TypeOf<
typeof SentinelOneGetRemoteScriptResultsParamsSchema
>;

export interface SentinelOneGetRemoteScriptResults {
download_links: Array<{
downloadUrl: string;
Expand All @@ -125,46 +103,3 @@ export interface SentinelOneGetRemoteScriptResults {
export interface SentinelOneGetRemoteScriptResultsApiResponse extends SentinelOneErrors {
data: SentinelOneGetRemoteScriptResults;
}

export type SentinelOneDownloadRemoteScriptResultsParams = TypeOf<
typeof SentinelOneDownloadRemoteScriptResultsParamsSchema
>;

export type SentinelOneGetRemoteScriptsParams = TypeOf<
typeof SentinelOneGetRemoteScriptsParamsSchema
>;

export type SentinelOneGetRemoteScriptsResponse = TypeOf<
typeof SentinelOneGetRemoteScriptsResponseSchema
>;

export type SentinelOneFetchAgentFilesParams = Mutable<
TypeOf<typeof SentinelOneFetchAgentFilesParamsSchema>
>;
export type SentinelOneFetchAgentFilesResponse = TypeOf<
typeof SentinelOneFetchAgentFilesResponseSchema
>;

export type SentinelOneDownloadAgentFileParams = Mutable<
TypeOf<typeof SentinelOneDownloadAgentFileParamsSchema>
>;

export type SentinelOneActivityRecord<TData = unknown> = Omit<
TypeOf<typeof SentinelOneGetActivitiesResponseSchema>['data'][number],
'data'
> & {
data: TData;
};

export type SentinelOneGetActivitiesParams = TypeOf<typeof SentinelOneGetActivitiesParamsSchema>;

export type SentinelOneGetActivitiesResponse<TData = unknown> = Omit<
TypeOf<typeof SentinelOneGetActivitiesResponseSchema>,
'data'
> & { data: Array<SentinelOneActivityRecord<TData>> };

export type SentinelOneIsolateHostParams = Partial<
Mutable<TypeOf<typeof SentinelOneIsolateHostParamsSchema>>
>;

export type SentinelOneActionParams = TypeOf<typeof SentinelOneActionParamsSchema>;
Loading