@whook/whook
Version:
Build strong and efficient REST web services.
36 lines (35 loc) • 1.8 kB
TypeScript
import { type ImporterService, type LogService } from 'common-services';
import { type WhookConsumerModule, type WhookConsumerDefinition } from '../types/consumers.js';
import { type WhookResolvedPluginsService, type WhookPluginName } from './WHOOK_RESOLVED_PLUGINS.js';
import { type WhookMain } from '../types/base.js';
export declare const DEFAULT_CONSUMERS_DEFINITIONS_OPTIONS: WhookConsumerDefinitionsOptions;
export declare const DEFAULT_CONSUMER_DEFINITION_FILTER: WhookConsumerDefinitionFilter;
export type WhookConsumerDefinitionFilter = (definition: WhookConsumerDefinition) => boolean;
export interface WhookConsumerDefinitionsOptions {
/** File patterns to ignore */
ignoredFilePatterns?: string[];
/** Pattern to match and pick the consumer name in the file name */
fileNamePatterns: [string, ...string[]];
/** Patterns that matches an consumer name */
serviceNamePatterns: [string, ...string[]];
}
export interface WhookConsumersDefinitionsConfig {
CONSUMERS_DEFINITIONS_OPTIONS?: WhookConsumerDefinitionsOptions;
CONSUMER_DEFINITION_FILTER?: WhookConsumerDefinitionFilter;
WHOOK_PLUGINS?: WhookPluginName[];
}
export type WhookConsumersDefinitionsDependencies = WhookConsumersDefinitionsConfig & {
APP_ENV: WhookMain['AppEnv'];
WHOOK_RESOLVED_PLUGINS: WhookResolvedPluginsService;
log?: LogService;
importer: ImporterService<WhookConsumerModule>;
readDir?: (path: URL) => Promise<string[]>;
};
export type WhookConsumersDefinitionsService = Record<string, {
url: string;
name: string;
pluginName: WhookPluginName;
module: WhookConsumerModule;
}>;
declare const _default: import("knifecycle").ServiceInitializer<WhookConsumersDefinitionsDependencies, WhookConsumersDefinitionsService>;
export default _default;