omitProcessors
FunctionSignature
function omitProcessors<TProcessors, TTypeNames>(processors, typeNames): Omit<ProcessorDefinitions<TProcessors>, TTypeNames[number]> extends TRemainingDefinitions ? Processors<TRemainingDefinitions, ProcessorMiddlewareTuple<TProcessors>> : never;core/src/job-type-processors/pick-job-type-processors.ts:84
Create a registry holding every job type of processors except the listed ones, e.g. for the
worker that handles whatever the dedicated workers built with pickProcessors don't.
Each remaining processor keeps its handler, its middleware chain and its backoffConfig.
Type Parameters
- TProcessorsextends
Processors - TTypeNamesextends readonly [
JobTypeNames<ProcessorDefinitions<TProcessors>>,JobTypeNames<ProcessorDefinitions<TProcessors>>]
Parameters
- processors
TProcessors - typeNames
TTypeNames&( [ Exclude<JobTypeNames<ProcessorDefinitions<TProcessors>>,TTypeNames[number]>] extends [never] ?"Error: omitProcessors would omit every processor":unknown)
Returns
Omit<ProcessorDefinitions<TProcessors>,TTypeNames[number]> extends TRemainingDefinitions ? Processors<TRemainingDefinitions,ProcessorMiddlewareTuple<TProcessors>> : never
Example
TypeScript
const defaultWorkerRunner = createWorkerRunner({
client,
processors: omitProcessors(appProcessors, ["images.resize", "images.transcode"]),
});Throws
if the list is empty, a listed job type has no processor in processors, or
every processor is omitted.