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
1 line
2.7 KiB
Plaintext
1 line
2.7 KiB
Plaintext
{"version":3,"sources":["../../../src/collections/endpoints/updateByID.ts"],"sourcesContent":["import { status as httpStatus } from 'http-status'\n\nimport type { PayloadHandler } from '../../config/types.js'\n\nimport { getRequestCollectionWithID } from '../../utilities/getRequestEntity.js'\nimport { headersWithCors } from '../../utilities/headersWithCors.js'\nimport { parseParams } from '../../utilities/parseParams/index.js'\nimport { updateByIDOperation } from '../operations/updateByID.js'\n\nexport const updateByIDHandler: PayloadHandler = async (req) => {\n const { id, collection } = getRequestCollectionWithID(req)\n\n const {\n autosave,\n depth,\n draft,\n overrideLock,\n populate,\n publishAllLocales,\n publishSpecificLocale,\n select,\n trash,\n unpublishAllLocales,\n } = parseParams(req.query)\n\n const doc = await updateByIDOperation({\n id,\n autosave,\n collection,\n data: req.data!,\n depth,\n draft,\n overrideLock: overrideLock ?? false,\n populate,\n publishAllLocales,\n publishSpecificLocale,\n req,\n select,\n trash,\n unpublishAllLocales,\n })\n\n let message = req.t('general:updatedSuccessfully')\n\n if (draft) {\n message = req.t('version:draftSavedSuccessfully')\n }\n if (autosave) {\n message = req.t('version:autosavedSuccessfully')\n }\n\n return Response.json(\n {\n doc,\n message,\n },\n {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n },\n )\n}\n"],"names":["status","httpStatus","getRequestCollectionWithID","headersWithCors","parseParams","updateByIDOperation","updateByIDHandler","req","id","collection","autosave","depth","draft","overrideLock","populate","publishAllLocales","publishSpecificLocale","select","trash","unpublishAllLocales","query","doc","data","message","t","Response","json","headers","Headers","OK"],"mappings":"AAAA,SAASA,UAAUC,UAAU,QAAQ,cAAa;AAIlD,SAASC,0BAA0B,QAAQ,sCAAqC;AAChF,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,WAAW,QAAQ,uCAAsC;AAClE,SAASC,mBAAmB,QAAQ,8BAA6B;AAEjE,OAAO,MAAMC,oBAAoC,OAAOC;IACtD,MAAM,EAAEC,EAAE,EAAEC,UAAU,EAAE,GAAGP,2BAA2BK;IAEtD,MAAM,EACJG,QAAQ,EACRC,KAAK,EACLC,KAAK,EACLC,YAAY,EACZC,QAAQ,EACRC,iBAAiB,EACjBC,qBAAqB,EACrBC,MAAM,EACNC,KAAK,EACLC,mBAAmB,EACpB,GAAGf,YAAYG,IAAIa,KAAK;IAEzB,MAAMC,MAAM,MAAMhB,oBAAoB;QACpCG;QACAE;QACAD;QACAa,MAAMf,IAAIe,IAAI;QACdX;QACAC;QACAC,cAAcA,gBAAgB;QAC9BC;QACAC;QACAC;QACAT;QACAU;QACAC;QACAC;IACF;IAEA,IAAII,UAAUhB,IAAIiB,CAAC,CAAC;IAEpB,IAAIZ,OAAO;QACTW,UAAUhB,IAAIiB,CAAC,CAAC;IAClB;IACA,IAAId,UAAU;QACZa,UAAUhB,IAAIiB,CAAC,CAAC;IAClB;IAEA,OAAOC,SAASC,IAAI,CAClB;QACEL;QACAE;IACF,GACA;QACEI,SAASxB,gBAAgB;YACvBwB,SAAS,IAAIC;YACbrB;QACF;QACAP,QAAQC,WAAW4B,EAAE;IACvB;AAEJ,EAAC"} |