Skip to content

Commit

Permalink
moved rewrite_request_case to the common folder
Browse files Browse the repository at this point in the history
  • Loading branch information
YulNaumenko committed Mar 15, 2021
1 parent d02ef98 commit 5c1aca4
Show file tree
Hide file tree
Showing 13 changed files with 17 additions and 34 deletions.
2 changes: 2 additions & 0 deletions x-pack/plugins/actions/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@
export * from './types';

export const BASE_ACTION_API_PATH = '/api/actions';

export * from './rewrite_request_case';
3 changes: 1 addition & 2 deletions x-pack/plugins/actions/server/routes/connector_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@

import { IRouter } from 'kibana/server';
import { ILicenseState } from '../lib';
import { ActionType, BASE_ACTION_API_PATH } from '../../common';
import { ActionType, BASE_ACTION_API_PATH, RewriteResponseCase } from '../../common';
import { ActionsRequestHandlerContext } from '../types';
import { verifyAccessAndContext } from './verify_access_and_context';
import { RewriteResponseCase } from './rewrite_request_case';

const rewriteBodyRes: RewriteResponseCase<ActionType[]> = (results) => {
return results.map(({ enabledInConfig, enabledInLicense, minimumLicenseRequired, ...res }) => ({
Expand Down
3 changes: 1 addition & 2 deletions x-pack/plugins/actions/server/routes/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ import { schema } from '@kbn/config-schema';
import { IRouter } from 'kibana/server';
import { ActionResult, ActionsRequestHandlerContext } from '../types';
import { ILicenseState } from '../lib';
import { BASE_ACTION_API_PATH } from '../../common';
import { BASE_ACTION_API_PATH, RewriteRequestCase, RewriteResponseCase } from '../../common';
import { verifyAccessAndContext } from './verify_access_and_context';
import { RewriteRequestCase, RewriteResponseCase } from './rewrite_request_case';
import { CreateOptions } from '../actions_client';

export const bodySchema = schema.object({
Expand Down
3 changes: 1 addition & 2 deletions x-pack/plugins/actions/server/routes/execute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ import { IRouter } from 'kibana/server';
import { ILicenseState } from '../lib';

import { ActionTypeExecutorResult, ActionsRequestHandlerContext } from '../types';
import { BASE_ACTION_API_PATH } from '../../common';
import { BASE_ACTION_API_PATH, RewriteResponseCase } from '../../common';
import { asHttpRequestExecutionSource } from '../lib/action_execution_source';
import { verifyAccessAndContext } from './verify_access_and_context';
import { RewriteResponseCase } from './rewrite_request_case';

const paramSchema = schema.object({
id: schema.string(),
Expand Down
3 changes: 1 addition & 2 deletions x-pack/plugins/actions/server/routes/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@
import { schema } from '@kbn/config-schema';
import { IRouter } from 'kibana/server';
import { ILicenseState } from '../lib';
import { BASE_ACTION_API_PATH } from '../../common';
import { BASE_ACTION_API_PATH, RewriteResponseCase } from '../../common';
import { ActionResult, ActionsRequestHandlerContext } from '../types';
import { verifyAccessAndContext } from './verify_access_and_context';
import { RewriteResponseCase } from './rewrite_request_case';

const paramSchema = schema.object({
id: schema.string(),
Expand Down
3 changes: 1 addition & 2 deletions x-pack/plugins/actions/server/routes/get_all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@

import { IRouter } from 'kibana/server';
import { ILicenseState } from '../lib';
import { BASE_ACTION_API_PATH } from '../../common';
import { BASE_ACTION_API_PATH, RewriteResponseCase } from '../../common';
import { ActionsRequestHandlerContext, FindActionResult } from '../types';
import { verifyAccessAndContext } from './verify_access_and_context';
import { RewriteResponseCase } from './rewrite_request_case';

const rewriteBodyRes: RewriteResponseCase<FindActionResult[]> = (results) => {
return results.map(({ actionTypeId, isPreconfigured, referencedByCount, ...res }) => ({
Expand Down
3 changes: 1 addition & 2 deletions x-pack/plugins/actions/server/routes/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@
import { schema } from '@kbn/config-schema';
import { IRouter } from 'kibana/server';
import { ILicenseState } from '../lib';
import { BASE_ACTION_API_PATH } from '../../common';
import { BASE_ACTION_API_PATH, RewriteResponseCase } from '../../common';
import { ActionResult, ActionsRequestHandlerContext } from '../types';
import { verifyAccessAndContext } from './verify_access_and_context';
import { RewriteResponseCase } from './rewrite_request_case';

const paramSchema = schema.object({
id: schema.string(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@
* 2.0.
*/
import { HttpSetup } from 'kibana/public';
import {
AsApiContract,
RewriteRequestCase,
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
} from '../../../../../actions/server/routes/rewrite_request_case';

import { AsApiContract, RewriteRequestCase } from '../../../../../actions/common';
import { BASE_ACTION_API_PATH } from '../../constants';
import type { ActionType } from '../../../types';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@
* 2.0.
*/
import { HttpSetup } from 'kibana/public';
import {
AsApiContract,
RewriteRequestCase,
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
} from '../../../../../actions/server/routes/rewrite_request_case';
import { AsApiContract, RewriteRequestCase } from '../../../../../actions/common';
import { BASE_ACTION_API_PATH } from '../../constants';
import type { ActionConnector, ActionConnectorProps } from '../../../types';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@
* 2.0.
*/
import { HttpSetup } from 'kibana/public';
import {
RewriteRequestCase,
RewriteResponseCase,
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
} from '../../../../../actions/server/routes/rewrite_request_case';
import { RewriteRequestCase, RewriteResponseCase } from '../../../../../actions/common';
import { BASE_ACTION_API_PATH } from '../../constants';
import type {
ActionConnector,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
*/

import { HttpSetup } from 'kibana/public';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { RewriteRequestCase } from '../../../../../actions/server/routes/rewrite_request_case';
import { ActionTypeExecutorResult } from '../../../../../../plugins/actions/common';
import {
ActionTypeExecutorResult,
RewriteRequestCase,
} from '../../../../../../plugins/actions/common';
import { BASE_ACTION_API_PATH } from '../../constants';

const rewriteBodyRes: RewriteRequestCase<ActionTypeExecutorResult<unknown>> = ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
* 2.0.
*/
import { HttpSetup } from 'kibana/public';
import {
RewriteRequestCase,
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
} from '../../../../../actions/server/routes/rewrite_request_case';
import { RewriteRequestCase } from '../../../../../actions/common';
import { BASE_ACTION_API_PATH } from '../../constants';
import type {
ActionConnector,
Expand Down

0 comments on commit 5c1aca4

Please sign in to comment.