UNPKG

@whook/whook

Version:

Build strong and efficient REST web services.

36 lines (35 loc) 1.7 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'; import { type WhookMain } from '../types/base.js'; export declare const DEFAULT_CRONS_DEFINITIONS_OPTIONS: WhookCronDefinitionsOptions; export declare const DEFAULT_CRON_DEFINITION_FILTER: WhookCronDefinitionFilter; export type WhookCronDefinitionFilter = (definition: WhookCronDefinition) => boolean; export interface 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 interface WhookCronsDefinitionsConfig { CRONS_DEFINITIONS_OPTIONS?: WhookCronDefinitionsOptions; CRON_DEFINITION_FILTER?: WhookCronDefinitionFilter; WHOOK_PLUGINS?: WhookPluginName[]; } export type WhookCronsDefinitionsDependencies = WhookCronsDefinitionsConfig & { APP_ENV: WhookMain['AppEnv']; 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;