UNPKG

torotask

Version:

Task queue processing in NodeJS based on BullMQ and Redis

32 lines 1.38 kB
import type { TaskGroup } from '../task-group.js'; import type { TaskDefinitionRegistry } from './task.js'; export type TaskGroupRegistry<TGroupDefs extends TaskGroupDefinitionRegistry> = { [K in keyof TGroupDefs]: TGroupDefs[K] extends TaskGroupDefinition<infer T> ? TaskGroup<T> : never; }; /** * Defines a task group with task definitions * * @template TDefs The type of task definitions contained in this group */ export interface TaskGroupDefinition<TDefs extends TaskDefinitionRegistry> { /** * The task definitions contained in this group */ tasks: TDefs; } /** * Registry of task group definitions */ export interface TaskGroupDefinitionRegistry { [groupKey: string]: TaskGroupDefinition<any>; } /** * Helper type to extract task keys for a specific group from a task group definition registry. * Uses direct property access for better IDE autocomplete performance. */ export type TaskKeysForGroup<TGroupDefs extends TaskGroupDefinitionRegistry, GroupName extends keyof TGroupDefs> = keyof TGroupDefs[GroupName]['tasks']; /** * Helper type to get a task definition from the registry. */ export type TaskDefForGroup<TGroupDefs extends TaskGroupDefinitionRegistry, GroupName extends keyof TGroupDefs, TaskName extends keyof TGroupDefs[GroupName]['tasks']> = TGroupDefs[GroupName]['tasks'][TaskName]; //# sourceMappingURL=task-group.d.ts.map