@team-falkor/plugin-sdk
Version:
A TypeScript SDK for building Falkor plugins with Elysia framework integration
130 lines (126 loc) • 3.79 kB
TypeScript
// Generated by dts-bundle-generator v9.5.1
import { PluginSearchResponse, PluginSetupJSON } from '@team-falkor/shared-types';
import Elysia from 'elysia';
/**
* A modern color utility class for terminal text styling.
*/
export declare class Colors {
private str;
private codes;
private prefix;
private prefixColor;
private suffix;
private suffixColor;
private showTimestamp;
private timestampColor;
constructor(str?: string);
/**
* Construct the final string with color codes, prefix, suffix, and optional timestamp.
*/
private wrap;
get black(): Colors;
get red(): Colors;
get green(): Colors;
get yellow(): Colors;
get blue(): Colors;
get magenta(): Colors;
get cyan(): Colors;
get white(): Colors;
get brightBlack(): Colors;
get brightRed(): Colors;
get brightGreen(): Colors;
get brightYellow(): Colors;
get brightBlue(): Colors;
get brightMagenta(): Colors;
get brightCyan(): Colors;
get brightWhite(): Colors;
get bgBlack(): Colors;
get bgRed(): Colors;
get bgGreen(): Colors;
get bgYellow(): Colors;
get bgBlue(): Colors;
get bgMagenta(): Colors;
get bgCyan(): Colors;
get bgWhite(): Colors;
get bgBrightBlack(): Colors;
get bgBrightRed(): Colors;
get bgBrightGreen(): Colors;
get bgBrightYellow(): Colors;
get bgBrightBlue(): Colors;
get bgBrightMagenta(): Colors;
get bgBrightCyan(): Colors;
get bgBrightWhite(): Colors;
get bold(): Colors;
get dim(): Colors;
get italic(): Colors;
get underline(): Colors;
get blink(): Colors;
get inverse(): Colors;
get hidden(): Colors;
get strikethrough(): Colors;
/**
* Returns the formatted string.
*/
toString(): string;
/**
* Set an optional prefix.
*/
withPrefix(prefix: string, color?: Colors): Colors;
/**
* Set an optional suffix.
*/
withSuffix(suffix: string, color?: Colors): Colors;
/**
* Enable timestamp display.
*/
withTimestamp(color?: Colors): Colors;
/**
* Create a new Colors instance for direct usage.
*/
static create(str?: string): Colors;
}
/**
* A default export of basic color formatting functions.
*/
export declare const colors: {
black: (str: string) => string;
red: (str: string) => string;
green: (str: string) => string;
yellow: (str: string) => string;
blue: (str: string) => string;
magenta: (str: string) => string;
cyan: (str: string) => string;
white: (str: string) => string;
};
export type PluginSetupWithoutConfig = Omit<PluginSetupJSON, "config">;
export type HandleSearchFunction = (os: string, query: string) => PromiseLike<Array<PluginSearchResponse>>;
export type HandleReturnFunction = (returned: string) => PromiseLike<Array<string>>;
export type CustomHandleSetupFunction = (config?: string[]) => PromiseLike<PluginSetupJSON>;
export type CreatePluginExtraOptions = {
debug?: boolean;
};
export interface CreatePluginOptions {
setup: PluginSetupWithoutConfig;
port: number;
handleSearch: HandleSearchFunction;
handleReturn?: HandleReturnFunction;
handleSetup?: CustomHandleSetupFunction;
options?: CreatePluginExtraOptions;
routeOptions?: SetupJsonOptions;
}
export type TypeOfConfig = "query" | "params";
export type SetupJsonOptions = {
typeOfConfig: TypeOfConfig;
};
/**
* Configure and start your Falkor plugin in one go.
*
* @param options.setup – core plugin metadata (name, api_url, etc.)
* @param options.port – TCP port to listen on (must be > 0)
* @param options.handleSearch– your search handler (required)
* @param options.handleReturn– your return handler (optional)
* @param options.options.debug – enable verbose debug logging
* @returns the underlying Elysia app instance
*/
export declare function createPlugin({ setup, port, handleSearch, handleReturn, handleSetup, options, routeOptions, }: CreatePluginOptions): Elysia;
export {};