Skip to content

Commit 76710b2

Browse files
committed
refactoring fetchOptions type
1 parent ce8f502 commit 76710b2

File tree

5 files changed

+21
-12
lines changed

5 files changed

+21
-12
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License;
4+
* you may not use this file except in compliance with the Elastic License.
5+
*/
6+
7+
import { HttpFetchOptions } from 'kibana/public';
8+
9+
export type FetchOptions = Omit<HttpFetchOptions, 'body'> & {
10+
pathname: string;
11+
isCachable?: boolean;
12+
method?: string;
13+
body?: any;
14+
};

x-pack/plugins/apm/public/hooks/useCallApi.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
*/
66

77
import { useMemo } from 'react';
8-
import { callApi, FetchOptions } from '../services/rest/callApi';
8+
import { callApi } from '../services/rest/callApi';
99
import { useApmPluginContext } from './useApmPluginContext';
10+
import { FetchOptions } from '../../common/fetch_options';
1011

1112
export function useCallApi() {
1213
const { http } = useApmPluginContext().core;

x-pack/plugins/apm/public/services/rest/callApi.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,11 @@
44
* you may not use this file except in compliance with the Elastic License.
55
*/
66

7+
import { HttpSetup } from 'kibana/public';
78
import { isString, startsWith } from 'lodash';
89
import LRU from 'lru-cache';
910
import hash from 'object-hash';
10-
import { HttpSetup, HttpFetchOptions } from 'kibana/public';
11-
12-
export type FetchOptions = Omit<HttpFetchOptions, 'body'> & {
13-
pathname: string;
14-
isCachable?: boolean;
15-
method?: string;
16-
body?: any;
17-
};
11+
import { FetchOptions } from '../../../common/fetch_options';
1812

1913
function fetchOptionsWithDebug(fetchOptions: FetchOptions) {
2014
const debugEnabled =

x-pack/plugins/apm/public/services/rest/createCallApmApi.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
* you may not use this file except in compliance with the Elastic License.
55
*/
66
import { HttpSetup } from 'kibana/public';
7-
import { callApi, FetchOptions } from './callApi';
7+
import { FetchOptions } from '../../../common/fetch_options';
8+
import { callApi } from './callApi';
89
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
910
import { APMAPI } from '../../../server/routes/create_apm_api';
1011
// eslint-disable-next-line @kbn/eslint/no-restricted-paths

x-pack/plugins/apm/server/routes/typings.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,9 @@ import { PickByValue, Optional } from 'utility-types';
1515
import { Observable } from 'rxjs';
1616
import { Server } from 'hapi';
1717
import { ObservabilityPluginSetup } from '../../../observability/server';
18-
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
19-
import { FetchOptions } from '../../public/services/rest/callApi';
2018
import { SecurityPluginSetup } from '../../../security/server';
2119
import { MlPluginSetup } from '../../../ml/server';
20+
import { FetchOptions } from '../../common/fetch_options';
2221
import { APMConfig } from '..';
2322

2423
export interface Params {

0 commit comments

Comments
 (0)