integreat
Version:
Node.js integration layer
10 lines • 492 B
JavaScript
import { createErrorResponse } from '../utils/response.js';
export default (jobs) => async function run(action, { dispatch, setProgress }) {
const { payload: { jobId }, meta: { id } = {}, } = action;
const job = typeof jobId === 'string' ? jobs.get(jobId) : undefined;
if (!job) {
return createErrorResponse(`No valid job with id '${jobId}'`, 'handler:RUN', 'notfound');
}
return await job.run(action, dispatch, setProgress, id);
};
//# sourceMappingURL=run.js.map