Skip to content

Commit

Permalink
[7.x] [Security Solution][Case] Improve ServiceConnectorCaseParams ty…
Browse files Browse the repository at this point in the history
…pe (#80109) (#80340)

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
cnasikas and kibanamachine authored Oct 13, 2020
1 parent b81bce9 commit c7bcf00
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
9 changes: 7 additions & 2 deletions x-pack/plugins/case/common/api/cases/case.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { NumberFromString } from '../saved_object';
import { UserRT } from '../user';
import { CommentResponseRt } from './comment';
import { CasesStatusResponseRt } from './status';
import { CaseConnectorRt, ESCaseConnector } from '../connectors';
import { CaseConnectorRt, ESCaseConnector, ConnectorPartialFieldsRt } from '../connectors';

// eslint-disable-next-line @kbn/eslint/no-restricted-paths
export { ActionTypeExecutorResult } from '../../../../actions/server/types';
Expand Down Expand Up @@ -133,7 +133,7 @@ export const ServiceConnectorCommentParamsRt = rt.type({
updatedBy: rt.union([ServiceConnectorUserParams, rt.null]),
});

export const ServiceConnectorCaseParamsRt = rt.type({
export const ServiceConnectorBasicCaseParamsRt = rt.type({
comments: rt.union([rt.array(ServiceConnectorCommentParamsRt), rt.null]),
createdAt: rt.string,
createdBy: ServiceConnectorUserParams,
Expand All @@ -145,6 +145,11 @@ export const ServiceConnectorCaseParamsRt = rt.type({
updatedBy: rt.union([ServiceConnectorUserParams, rt.null]),
});

export const ServiceConnectorCaseParamsRt = rt.intersection([
ServiceConnectorBasicCaseParamsRt,
ConnectorPartialFieldsRt,
]);

export const ServiceConnectorCaseResponseRt = rt.intersection([
rt.type({
title: rt.string,
Expand Down
6 changes: 6 additions & 0 deletions x-pack/plugins/case/common/api/connectors/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ export const ConnectorFieldsRt = rt.union([
rt.null,
]);

export const ConnectorPartialFieldsRt = rt.partial({
...JiraFieldsRT.props,
...ResilientFieldsRT.props,
...ServiceNowFieldsRT.props,
});

export enum ConnectorTypes {
jira = '.jira',
resilient = '.resilient',
Expand Down

0 comments on commit c7bcf00

Please sign in to comment.