import { BasePluginType, plugin, PluginBlueprint } from "knub"; import * as t from "io-ts"; import { getPluginConfigPreprocessor } from "../pluginUtils"; import { TMarkdown } from "../types"; export interface ZeppelinPluginBlueprint extends PluginBlueprint { configSchema: t.TypeC; showInDocs?: boolean; info?: { prettyName: string; description?: TMarkdown; usageGuide?: TMarkdown; configurationGuide?: TMarkdown; }; } export function zeppelinPlugin>( name: string, blueprint: TPartialBlueprint, ): TPartialBlueprint & { name: string; configPreprocessor: ZeppelinPluginBlueprint["configPreprocessor"] }; export function zeppelinPlugin(): < TPartialBlueprint extends Omit, "name"> >( name: string, blueprint: TPartialBlueprint, ) => TPartialBlueprint & { name: string; configPreprocessor: ZeppelinPluginBlueprint["configPreprocessor"]; }; export function zeppelinPlugin(...args) { if (args.length) { const blueprint = (plugin(...(args as Parameters)) as unknown) as ZeppelinPluginBlueprint; blueprint.configPreprocessor = getPluginConfigPreprocessor(blueprint, blueprint.configPreprocessor); return blueprint; } else { return zeppelinPlugin as (name, blueprint) => ZeppelinPluginBlueprint; } }