@whook/whook
Version:
Build strong and efficient REST web services.
36 lines (35 loc) • 1.75 kB
TypeScript
import { type ImporterService, type LogService } from 'common-services';
import { type WhookCommandModule, type WhookCommandDefinition } from '../types/commands.js';
import { type WhookResolvedPluginsService, type WhookPluginName } from './WHOOK_RESOLVED_PLUGINS.js';
import { type WhookMain } from '../types/base.js';
export declare const DEFAULT_COMMANDS_DEFINITIONS_OPTIONS: WhookCommandsDefinitionsOptions;
export declare const DEFAULT_COMMAND_DEFINITION_FILTER: WhookCommandDefinitionFilter;
export type WhookCommandDefinitionFilter = (definition: WhookCommandDefinition) => boolean;
export interface WhookCommandsDefinitionsOptions {
/** File patterns to ignore */
ignoredFilePatterns?: string[];
/** Pattern to match and pick the command name in the file name */
fileNamePatterns: [string, ...string[]];
/** Patterns that matches an command name */
serviceNamePatterns: [string, ...string[]];
}
export interface WhookCommandsDefinitionsConfig {
COMMANDS_DEFINITIONS_OPTIONS?: WhookCommandsDefinitionsOptions;
COMMAND_DEFINITION_FILTER?: WhookCommandDefinitionFilter;
WHOOK_PLUGINS?: WhookPluginName[];
}
export type WhookCommandsDependencies = WhookCommandsDefinitionsConfig & {
APP_ENV: WhookMain['AppEnv'];
WHOOK_RESOLVED_PLUGINS: WhookResolvedPluginsService;
log?: LogService;
importer: ImporterService<WhookCommandModule>;
readDir?: (path: URL) => Promise<string[]>;
};
export type WhookCommandsDefinitionsService = Record<string, {
url: string;
name: string;
pluginName: WhookPluginName;
module: WhookCommandModule;
}>;
declare const _default: import("knifecycle").ServiceInitializer<WhookCommandsDependencies, WhookCommandsDefinitionsService>;
export default _default;