Skip to content

Commit

Permalink
rename IUiSettingsService --> IUiSettingsClient
Browse files Browse the repository at this point in the history
  • Loading branch information
mshustov committed Oct 4, 2019
1 parent 0dcc00b commit 9d7d8bf
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions src/legacy/server/kbn_server.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import { CallClusterWithRequest, ElasticsearchPlugin } from '../core_plugins/ela
import { CapabilitiesModifier } from './capabilities';
import { IndexPatternsServiceFactory } from './index_patterns';
import { Capabilities } from '../../core/public';
import { IUiSettingsService } from '../../legacy/ui/ui_settings/ui_settings_service';
import { IUiSettingsClient } from '../../legacy/ui/ui_settings/ui_settings_service';
import { UiSettingsServiceFactoryOptions } from '../../legacy/ui/ui_settings/ui_settings_service_factory';

export interface KibanaConfig {
Expand Down Expand Up @@ -79,15 +79,15 @@ declare module 'hapi' {
name: string,
factoryFn: (request: Request) => Record<string, any>
) => void;
uiSettingsServiceFactory: (options?: UiSettingsServiceFactoryOptions) => IUiSettingsService;
uiSettingsServiceFactory: (options?: UiSettingsServiceFactoryOptions) => IUiSettingsClient;
logWithMetadata: (tags: string[], message: string, meta: Record<string, any>) => void;
}

interface Request {
getSavedObjectsClient(options?: SavedObjectsClientProviderOptions): SavedObjectsClientContract;
getBasePath(): string;
getDefaultRoute(): Promise<string>;
getUiSettingsService(): IUiSettingsService;
getUiSettingsService(): IUiSettingsClient;
getCapabilities(): Promise<Capabilities>;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { SavedObjectsClientContract } from 'src/core/server';
import KbnServer from '../../../../../server/kbn_server';
import { createTestServers } from '../../../../../../test_utils/kbn_server';
import { CallCluster } from '../../../../../../legacy/core_plugins/elasticsearch';
import { IUiSettingsService } from '../../../ui_settings_service';
import { IUiSettingsClient } from '../../../ui_settings_service';

let kbnServer: KbnServer;
let servers: ReturnType<typeof createTestServers>;
Expand All @@ -34,7 +34,7 @@ interface AllServices {
kbnServer: KbnServer;
savedObjectsClient: SavedObjectsClientContract;
callCluster: CallCluster;
uiSettings: IUiSettingsService;
uiSettings: IUiSettingsClient;
deleteKibanaIndex: typeof deleteKibanaIndex;
}

Expand Down
4 changes: 2 additions & 2 deletions src/legacy/ui/ui_settings/ui_settings_service.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
* under the License.
*/

import { IUiSettingsService } from './ui_settings_service';
import { IUiSettingsClient } from './ui_settings_service';

const createServiceMock = () => {
const mocked: jest.Mocked<IUiSettingsService> = {
const mocked: jest.Mocked<IUiSettingsClient> = {
getDefaults: jest.fn(),
get: jest.fn(),
getAll: jest.fn(),
Expand Down
4 changes: 2 additions & 2 deletions src/legacy/ui/ui_settings/ui_settings_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ interface UiSettingsParams {
type?: UiSettingsType;
}

export interface IUiSettingsService {
export interface IUiSettingsClient {
getDefaults: () => Promise<Record<string, UiSettingsParams>>;
get: <T extends SavedObjectAttribute = any>(key: string) => Promise<T>;
getAll: <T extends SavedObjectAttribute = any>() => Promise<Record<string, T>>;
Expand All @@ -77,7 +77,7 @@ export interface IUiSettingsService {
* Service that provides access to the UiSettings stored in elasticsearch.
* @class UiSettingsService
*/
export class UiSettingsService implements IUiSettingsService {
export class UiSettingsService implements IUiSettingsClient {
private readonly _type: UiSettingsServiceOptions['type'];
private readonly _id: UiSettingsServiceOptions['id'];
private readonly _buildNum: UiSettingsServiceOptions['buildNum'];
Expand Down
6 changes: 3 additions & 3 deletions src/legacy/ui/ui_settings/ui_settings_service_factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
import { Legacy } from 'kibana';
import {
IUiSettingsService,
IUiSettingsClient,
UiSettingsService,
UiSettingsServiceOptions,
} from './ui_settings_service';
Expand All @@ -31,12 +31,12 @@ export type UiSettingsServiceFactoryOptions = Pick<
* Create an instance of UiSettingsService that will use the
* passed `savedObjectsClient` to communicate with elasticsearch
*
* @return {IUiSettingsService}
* @return {IUiSettingsClient}
*/
export function uiSettingsServiceFactory(
server: Legacy.Server,
options: UiSettingsServiceFactoryOptions
): IUiSettingsService {
): IUiSettingsClient {
const config = server.config();

const { savedObjectsClient, getDefaults, overrides } = options;
Expand Down
6 changes: 3 additions & 3 deletions src/legacy/ui/ui_settings/ui_settings_service_for_request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import { Legacy } from 'kibana';
import { uiSettingsServiceFactory } from './ui_settings_service_factory';
import { IUiSettingsService, UiSettingsServiceOptions } from './ui_settings_service';
import { IUiSettingsClient, UiSettingsServiceOptions } from './ui_settings_service';

type Options = Pick<UiSettingsServiceOptions, 'getDefaults' | 'overrides'>;
/**
Expand All @@ -32,13 +32,13 @@ type Options = Pick<UiSettingsServiceOptions, 'getDefaults' | 'overrides'>;
* @param {Hapi.Request} request
* @param {Object} [options={}]
* @return {IUiSettingsService}
* @return {IUiSettingsClient}
*/
export function getUiSettingsServiceForRequest(
server: Legacy.Server,
request: Legacy.Request,
options: Options
): IUiSettingsService {
): IUiSettingsClient {
const { getDefaults, overrides } = options;

const uiSettingsService = uiSettingsServiceFactory(server, {
Expand Down

0 comments on commit 9d7d8bf

Please sign in to comment.