UNPKG

@whook/whook

Version:

Build strong and efficient REST web services.

37 lines (36 loc) 1.64 kB
import { type ImporterService, type LogService } from 'common-services'; import { type WhookCronModule, type WhookCronDefinition } from '../types/crons.js'; import { type WhookResolvedPluginsService, type WhookPluginName } from './WHOOK_RESOLVED_PLUGINS.js'; export declare const DEFAULT_CRONS_DEFINITIONS_OPTIONS: WhookCronDefinitionsOptions; export declare const DEFAULT_CRON_DEFINITION_FILTER: WhookCronDefinitionFilter; export interface WhookCronDefinitionFilter { (definition: WhookCronDefinition): boolean; } export type WhookCronDefinitionsOptions = { /** File patterns to ignore */ ignoredFilePatterns?: string[]; /** Pattern to match and pick the cron name in the file name */ fileNamePatterns: [string, ...string[]]; /** Patterns that matches an cron name */ serviceNamePatterns: [string, ...string[]]; }; export type WhookCronsDefinitionsConfig = { CRONS_DEFINITIONS_OPTIONS?: WhookCronDefinitionsOptions; CRON_DEFINITION_FILTER?: WhookCronDefinitionFilter; WHOOK_PLUGINS?: WhookPluginName[]; }; export type WhookCronsDefinitionsDependencies = WhookCronsDefinitionsConfig & { APP_ENV: string; WHOOK_RESOLVED_PLUGINS: WhookResolvedPluginsService; log?: LogService; importer: ImporterService<WhookCronModule>; readDir?: (path: URL) => Promise<string[]>; }; export type WhookCronsDefinitionsService = Record<string, { url: string; name: string; pluginName: WhookPluginName; module: WhookCronModule; }>; declare const _default: import("knifecycle").ServiceInitializer<WhookCronsDefinitionsDependencies, WhookCronsDefinitionsService>; export default _default;