@whook/whook
Version:
Build strong and efficient REST web services.
36 lines (35 loc) • 1.87 kB
TypeScript
import { type ImporterService, type LogService } from 'common-services';
import { type WhookTransformerModule, type WhookTransformerDefinition } from '../types/transformers.js';
import { type WhookResolvedPluginsService, type WhookPluginName } from './WHOOK_RESOLVED_PLUGINS.js';
import { type WhookMain } from '../types/base.js';
export declare const DEFAULT_TRANSFORMERS_DEFINITIONS_OPTIONS: WhookTransformerDefinitionsOptions;
export declare const DEFAULT_TRANSFORMER_DEFINITION_FILTER: WhookTransformerDefinitionFilter;
export type WhookTransformerDefinitionFilter = (definition: WhookTransformerDefinition) => boolean;
export interface WhookTransformerDefinitionsOptions {
/** File patterns to ignore */
ignoredFilePatterns?: string[];
/** Pattern to match and pick the transformer name in the file name */
fileNamePatterns: [string, ...string[]];
/** Patterns that matches an transformer name */
serviceNamePatterns: [string, ...string[]];
}
export interface WhookTransformersDefinitionsConfig {
TRANSFORMERS_DEFINITIONS_OPTIONS?: WhookTransformerDefinitionsOptions;
TRANSFORMER_DEFINITION_FILTER?: WhookTransformerDefinitionFilter;
WHOOK_PLUGINS?: WhookPluginName[];
}
export type WhookTransformersDefinitionsDependencies = WhookTransformersDefinitionsConfig & {
APP_ENV: WhookMain['AppEnv'];
WHOOK_RESOLVED_PLUGINS: WhookResolvedPluginsService;
log?: LogService;
importer: ImporterService<WhookTransformerModule>;
readDir?: (path: URL) => Promise<string[]>;
};
export type WhookTransformersDefinitionsService = Record<string, {
url: string;
name: string;
pluginName: WhookPluginName;
module: WhookTransformerModule;
}>;
declare const _default: import("knifecycle").ServiceInitializer<WhookTransformersDefinitionsDependencies, WhookTransformersDefinitionsService>;
export default _default;