UNPKG

@whook/whook

Version:

Build strong and efficient REST web services.

37 lines (36 loc) 1.7 kB
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'; export declare const DEFAULT_COMMANDS_DEFINITIONS_OPTIONS: WhookCommandsDefinitionsOptions; export declare const DEFAULT_COMMAND_DEFINITION_FILTER: WhookCommandDefinitionFilter; export interface WhookCommandDefinitionFilter { (definition: WhookCommandDefinition): boolean; } export type 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 type WhookCommandsDefinitionsConfig = { COMMANDS_DEFINITIONS_OPTIONS?: WhookCommandsDefinitionsOptions; COMMAND_DEFINITION_FILTER?: WhookCommandDefinitionFilter; WHOOK_PLUGINS?: WhookPluginName[]; }; export type WhookCommandsDependencies = WhookCommandsDefinitionsConfig & { APP_ENV: string; 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;