Files
klz-cables.com/.pnpm-store/v10/files/bf/a56131d1f227ec7f8a1e2c23f949212380b689ba6a34f6c228495381127fde5eeb885ac557ef8ee97dd4db115312e89411333211b4da7ccbb2a28da7bdee22
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

1 line
4.8 KiB
Plaintext

{"version":3,"sources":["../../../../../src/queues/operations/runJobs/runJob/index.ts"],"sourcesContent":["import type { Job } from '../../../../index.js'\nimport type { PayloadRequest } from '../../../../types/index.js'\nimport type { WorkflowConfig, WorkflowHandler } from '../../../config/types/workflowTypes.js'\nimport type { RunJobsSilent } from '../../../localAPI.js'\nimport type { UpdateJobFunction } from './getUpdateJobFunction.js'\n\nimport { handleTaskError } from '../../../errors/handleTaskError.js'\nimport { handleWorkflowError } from '../../../errors/handleWorkflowError.js'\nimport { JobCancelledError, TaskError, WorkflowError } from '../../../errors/index.js'\nimport { getCurrentDate } from '../../../utilities/getCurrentDate.js'\nimport { getRunTaskFunction } from './getRunTaskFunction.js'\n\ntype Args = {\n job: Job\n req: PayloadRequest\n /**\n * If set to true, the job system will not log any output to the console (for both info and error logs).\n * Can be an option for more granular control over logging.\n *\n * This will not automatically affect user-configured logs (e.g. if you call `console.log` or `payload.logger.info` in your job code).\n *\n * @default false\n */\n silent?: RunJobsSilent\n updateJob: UpdateJobFunction\n workflowConfig: WorkflowConfig\n workflowHandler: WorkflowHandler\n}\n\nexport type JobRunStatus = 'error' | 'error-reached-max-retries' | 'success'\n\nexport type RunJobResult = {\n status: JobRunStatus\n}\n\nexport const runJob = async ({\n job,\n req,\n silent,\n updateJob,\n workflowConfig,\n workflowHandler,\n}: Args): Promise<RunJobResult> => {\n // Run the job\n try {\n await workflowHandler({\n inlineTask: getRunTaskFunction(job, workflowConfig, req, true, updateJob),\n job,\n req,\n tasks: getRunTaskFunction(job, workflowConfig, req, false, updateJob),\n })\n } catch (error) {\n if (error instanceof JobCancelledError) {\n throw error // Job cancellation is handled in a top-level error handler, as higher up code may themselves throw this error\n }\n if (error instanceof TaskError) {\n const { hasFinalError } = await handleTaskError({\n error,\n req,\n silent,\n updateJob,\n })\n\n return {\n status: hasFinalError ? 'error-reached-max-retries' : 'error',\n }\n }\n\n const { hasFinalError } = await handleWorkflowError({\n error:\n error instanceof WorkflowError\n ? error\n : new WorkflowError({\n job,\n message:\n typeof error === 'object' && error && 'message' in error\n ? (error.message as string)\n : 'An unhandled error occurred',\n workflowConfig,\n }),\n req,\n silent,\n updateJob,\n })\n\n return {\n status: hasFinalError ? 'error-reached-max-retries' : 'error',\n }\n }\n\n // Workflow has completed successfully\n // Do not update the job log here, as that would result in unnecessary db calls when using postgres.\n // Solely updating simple fields here will result in optimized db calls.\n // Job log modifications are already updated at the end of the runTask function.\n await updateJob({\n completedAt: getCurrentDate().toISOString(),\n processing: false,\n totalTried: (job.totalTried ?? 0) + 1,\n })\n\n return {\n status: 'success',\n }\n}\n"],"names":["handleTaskError","handleWorkflowError","JobCancelledError","TaskError","WorkflowError","getCurrentDate","getRunTaskFunction","runJob","job","req","silent","updateJob","workflowConfig","workflowHandler","inlineTask","tasks","error","hasFinalError","status","message","completedAt","toISOString","processing","totalTried"],"mappings":"AAMA,SAASA,eAAe,QAAQ,qCAAoC;AACpE,SAASC,mBAAmB,QAAQ,yCAAwC;AAC5E,SAASC,iBAAiB,EAAEC,SAAS,EAAEC,aAAa,QAAQ,2BAA0B;AACtF,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,kBAAkB,QAAQ,0BAAyB;AAyB5D,OAAO,MAAMC,SAAS,OAAO,EAC3BC,G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