@jbrowse/core
Version:
JBrowse 2 core libraries used by plugins
140 lines (139 loc) • 8.06 kB
TypeScript
import PhasedScheduler from './PhasedScheduler';
import ReExports from './ReExports';
import AdapterType from './pluggableElementTypes/AdapterType';
import AddTrackWorkflowType from './pluggableElementTypes/AddTrackWorkflowType';
import ConnectionType from './pluggableElementTypes/ConnectionType';
import DisplayType from './pluggableElementTypes/DisplayType';
import InternetAccountType from './pluggableElementTypes/InternetAccountType';
import RpcMethodType from './pluggableElementTypes/RpcMethodType';
import TextSearchAdapterType from './pluggableElementTypes/TextSearchAdapterType';
import TrackType from './pluggableElementTypes/TrackType';
import ViewType from './pluggableElementTypes/ViewType';
import WidgetType from './pluggableElementTypes/WidgetType';
import RendererType from './pluggableElementTypes/renderers/RendererType';
import type Plugin from './Plugin';
import type { PluginDefinition } from './PluginLoader';
import type { PluggableElementMember, PluggableElementType } from './pluggableElementTypes';
import type PluggableElementBase from './pluggableElementTypes/PluggableElementBase';
import type { AbstractRootModel } from './util';
import type { IAnyModelType, IAnyType } from 'mobx-state-tree';
type PluggableElementTypeGroup = 'renderer' | 'adapter' | 'display' | 'track' | 'connection' | 'view' | 'widget' | 'rpc method' | 'internet account' | 'text search adapter' | 'add track workflow';
declare class TypeRecord<ElementClass extends PluggableElementBase> {
typeName: string;
baseClass: (new (...args: unknown[]) => ElementClass) | (Function & {
prototype: ElementClass;
});
registeredTypes: Record<string, ElementClass>;
constructor(typeName: string, baseClass: (new (...args: unknown[]) => ElementClass) | (Function & {
prototype: ElementClass;
}));
add(name: string, t: ElementClass): void;
has(name: string): boolean;
get(name: string): ElementClass | undefined;
all(): ElementClass[];
}
type AnyFunction = (...args: any) => any;
export type PluginMetadata = Record<string, unknown>;
export interface PluginLoadRecord {
metadata?: PluginMetadata;
plugin: Plugin;
}
export interface RuntimePluginLoadRecord extends PluginLoadRecord {
definition: PluginDefinition;
}
export default class PluginManager {
plugins: Plugin[];
jexl: {
addBinaryOp: (operator: string, precedence: number, fn: (left: any, right: any) => any) => void;
addUnaryOp: (operator: string, fn: (right: any) => any) => void;
addTransform: (name: string, fn: (value: any, ...args: any[]) => any) => void;
addTransforms: (map: {
[key: string]: (value: any, ...args: any[]) => any;
}) => void;
getTransform: (name: string) => (value: any, ...args: any[]) => any;
addFunction: (name: string, fn: (value: any, ...args: any[]) => any) => void;
addFunctions: (map: {
[key: string]: (value: any, ...args: any[]) => any;
}) => void;
getFunction: (name: string) => (value: any, ...args: any[]) => any;
eval: (expression: string, context?: import("jexl/Expression").Context) => Promise<any>;
evalSync: (expression: string, context?: import("jexl/Expression").Context) => any;
compile: (expression: string) => import("jexl/Expression").default;
createExpression: (expression: string) => import("jexl/Expression").default;
removeOp: (operator: string) => void;
_grammar: import("jexl/Grammar").default;
};
pluginMetadata: Record<string, PluginMetadata>;
runtimePluginDefinitions: PluginDefinition[];
elementCreationSchedule: PhasedScheduler<PluggableElementTypeGroup> | undefined;
rendererTypes: TypeRecord<RendererType>;
adapterTypes: TypeRecord<AdapterType>;
textSearchAdapterTypes: TypeRecord<TextSearchAdapterType>;
trackTypes: TypeRecord<TrackType>;
displayTypes: TypeRecord<DisplayType>;
connectionTypes: TypeRecord<ConnectionType>;
viewTypes: TypeRecord<ViewType>;
widgetTypes: TypeRecord<WidgetType>;
rpcMethods: TypeRecord<RpcMethodType>;
addTrackWidgets: TypeRecord<AddTrackWorkflowType>;
internetAccountTypes: TypeRecord<InternetAccountType>;
configured: boolean;
rootModel?: AbstractRootModel;
extensionPoints: Map<string, Function[]>;
constructor(initialPlugins?: (Plugin | PluginLoadRecord)[]);
pluginConfigurationNamespacedSchemas(): Record<string, unknown>;
pluginConfigurationUnnamespacedSchemas(): Record<string, unknown>;
pluginConfigurationRootSchemas(): Record<string, unknown>;
addPlugin(load: Plugin | PluginLoadRecord | RuntimePluginLoadRecord): this;
getPlugin(name: string): Plugin | undefined;
hasPlugin(name: string): boolean;
createPluggableElements(): this;
setRootModel(rootModel: AbstractRootModel): this;
configure(): this;
getElementTypeRecord(groupName: PluggableElementTypeGroup): TypeRecord<PluggableElementBase>;
addElementType(groupName: PluggableElementTypeGroup, creationCallback: (pluginManager: PluginManager) => PluggableElementType): this;
getElementType(groupName: PluggableElementTypeGroup, typeName: string): PluggableElementBase | undefined;
getElementTypesInGroup(groupName: PluggableElementTypeGroup): PluggableElementBase[];
getViewElements(): ViewType[];
getTrackElements(): TrackType[];
getConnectionElements(): ConnectionType[];
getAddTrackWorkflowElements(): AddTrackWorkflowType[];
getRpcElements(): RpcMethodType[];
getDisplayElements(): DisplayType[];
getAdapterElements(): AdapterType[];
pluggableMstType(groupName: PluggableElementTypeGroup, fieldName: PluggableElementMember, fallback?: IAnyType): IAnyType;
pluggableConfigSchemaType(typeGroup: PluggableElementTypeGroup, fieldName?: PluggableElementMember): IAnyModelType;
jbrequireCache: Map<any, any>;
lib: any;
load: <FTYPE extends AnyFunction>(lib: FTYPE) => ReturnType<FTYPE>;
jbrequire: (lib: keyof typeof ReExports | AnyFunction | {
default: AnyFunction;
}) => any;
getRendererType(typeName: string): RendererType | undefined;
getRendererTypes(): RendererType[];
getAdapterType(typeName: string): AdapterType | undefined;
getTextSearchAdapterType(typeName: string): TextSearchAdapterType | undefined;
getTrackType(typeName: string): TrackType | undefined;
getDisplayType(typeName: string): DisplayType | undefined;
getViewType(typeName: string): ViewType | undefined;
getAddTrackWorkflow(typeName: string): AddTrackWorkflowType | undefined;
getWidgetType(typeName: string): WidgetType | undefined;
getConnectionType(typeName: string): ConnectionType | undefined;
getRpcMethodType(methodName: string): RpcMethodType | undefined;
getInternetAccountType(name: string): InternetAccountType | undefined;
addRendererType(cb: (pm: PluginManager) => RendererType): this;
addAdapterType(cb: (pm: PluginManager) => AdapterType): this;
addTextSearchAdapterType(cb: (pm: PluginManager) => TextSearchAdapterType): this;
addTrackType(cb: (pm: PluginManager) => TrackType): this;
addDisplayType(cb: (pluginManager: PluginManager) => DisplayType): this;
addViewType(cb: (pluginManager: PluginManager) => ViewType): this;
addWidgetType(cb: (pm: PluginManager) => WidgetType): this;
addConnectionType(cb: (pm: PluginManager) => ConnectionType): this;
addRpcMethod(cb: (pm: PluginManager) => RpcMethodType): this;
addInternetAccountType(cb: (pm: PluginManager) => InternetAccountType): this;
addAddTrackWorkflowType(cb: (pm: PluginManager) => AddTrackWorkflowType): this;
addToExtensionPoint<T>(extensionPointName: string, callback: (extendee: T, props: Record<string, unknown>) => T): void;
evaluateExtensionPoint(extensionPointName: string, extendee: unknown, props?: Record<string, unknown>): unknown;
evaluateAsyncExtensionPoint(extensionPointName: string, extendee: unknown, props?: Record<string, unknown>): Promise<unknown>;
}
export {};