[6.x] [system-loader] remove I-prefixed interface names (#20362) (#20380)

Backports the following commits to 6.x:
 - [system-loader] remove I-prefixed interface names  (#20362)
This commit is contained in:
Spencer 2018-07-03 13:47:04 -07:00 committed by GitHub
parent a08520eb84
commit aecc9e24c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 14 deletions

View file

@ -18,11 +18,11 @@
*/
import {
IKibanaSystemClassStatic,
ISystemMetadata,
ISystemsType,
KibanaSystem,
KibanaSystemClassStatic,
SystemMetadata,
SystemName,
SystemsType,
} from './system_types';
function isPromise(obj: any) {
@ -31,12 +31,12 @@ function isPromise(obj: any) {
);
}
export class System<C, M extends ISystemMetadata, D extends ISystemsType, E> {
export class System<C, M extends SystemMetadata, D extends SystemsType, E> {
public readonly name: SystemName;
public readonly dependencies: SystemName[];
public readonly metadata?: M;
private readonly systemClass: IKibanaSystemClassStatic<C, D, E>;
private readonly systemClass: KibanaSystemClassStatic<C, D, E>;
private systemInstance?: KibanaSystem<C, D, E>;
private exposedValues?: E;
@ -45,7 +45,7 @@ export class System<C, M extends ISystemMetadata, D extends ISystemsType, E> {
config: {
metadata?: M;
dependencies?: SystemName[];
implementation: IKibanaSystemClassStatic<C, D, E>;
implementation: KibanaSystemClassStatic<C, D, E>;
}
) {
this.name = name;

View file

@ -19,14 +19,14 @@
import { getSortedSystemNames } from './sorted_systems';
import { System } from './system';
import { ISystemMetadata, ISystemsType, SystemName } from './system_types';
import { SystemMetadata, SystemName, SystemsType } from './system_types';
export type KibanaSystemApiFactory<C, M> = (
name: SystemName,
metadata?: M
) => C;
export class SystemLoader<C, M extends ISystemMetadata> {
export class SystemLoader<C, M extends SystemMetadata> {
private readonly systems = new Map<SystemName, System<C, M, any, any>>();
private startedSystems: SystemName[] = [];
@ -45,7 +45,7 @@ export class SystemLoader<C, M extends ISystemMetadata> {
});
}
public addSystem<D extends ISystemsType, E = void>(
public addSystem<D extends SystemsType, E = void>(
system: System<C, M, D, E>
) {
if (this.systems.has(system.name)) {
@ -92,7 +92,7 @@ export class SystemLoader<C, M extends ISystemMetadata> {
}
}
private startSystem<D extends ISystemsType, E = void>(
private startSystem<D extends SystemsType, E = void>(
system: System<C, M, D, E>
) {
const dependenciesValues = {} as D;

View file

@ -18,15 +18,15 @@
*/
export type SystemName = string;
export interface ISystemMetadata {
export interface SystemMetadata {
[key: string]: any;
}
export interface ISystemsType {
export interface SystemsType {
[systemName: string]: any;
}
export abstract class KibanaSystem<C, D extends ISystemsType, E = void> {
export abstract class KibanaSystem<C, D extends SystemsType, E = void> {
constructor(readonly kibana: C, readonly deps: D) {}
public abstract start(): E;
@ -46,6 +46,6 @@ export abstract class KibanaSystem<C, D extends ISystemsType, E = void> {
*
* See https://www.typescriptlang.org/docs/handbook/interfaces.html#difference-between-the-static-and-instance-sides-of-classes
*/
export interface IKibanaSystemClassStatic<C, D extends ISystemsType, E = void> {
export interface KibanaSystemClassStatic<C, D extends SystemsType, E = void> {
new (kibana: C, deps: D): KibanaSystem<C, D, E>;
}