{"version":3,"sources":["../../../src/collections/endpoints/create.ts"],"sourcesContent":["import { getTranslation } from '@payloadcms/translations'\nimport { status as httpStatus } from 'http-status'\n\nimport type { PayloadHandler } from '../../config/types.js'\n\nimport { getRequestCollection } from '../../utilities/getRequestEntity.js'\nimport { headersWithCors } from '../../utilities/headersWithCors.js'\nimport { parseParams } from '../../utilities/parseParams/index.js'\nimport { createOperation } from '../operations/create.js'\n\nexport const createHandler: PayloadHandler = async (req) => {\n const collection = getRequestCollection(req)\n\n const { autosave, depth, draft, populate, publishAllLocales, select } = parseParams(req.query)\n\n const publishSpecificLocale = req.query.publishSpecificLocale as string | undefined\n\n const doc = await createOperation({\n autosave,\n collection,\n data: req.data!,\n depth,\n draft,\n populate,\n publishAllLocales,\n publishSpecificLocale,\n req,\n select,\n })\n\n return Response.json(\n {\n doc,\n message: req.t('general:successfullyCreated', {\n label: getTranslation(collection.config.labels.singular, req.i18n),\n }),\n },\n {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.CREATED,\n },\n )\n}\n"],"names":["getTranslation","status","httpStatus","getRequestCollection","headersWithCors","parseParams","createOperation","createHandler","req","collection","autosave","depth","draft","populate","publishAllLocales","select","query","publishSpecificLocale","doc","data","Response","json","message","t","label","config","labels","singular","i18n","headers","Headers","CREATED"],"mappings":"AAAA,SAASA,cAAc,QAAQ,2BAA0B;AACzD,SAASC,UAAUC,UAAU,QAAQ,cAAa;AAIlD,SAASC,oBAAoB,QAAQ,sCAAqC;AAC1E,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,WAAW,QAAQ,uCAAsC;AAClE,SAASC,eAAe,QAAQ,0BAAyB;AAEzD,OAAO,MAAMC,gBAAgC,OAAOC;IAClD,MAAMC,aAAaN,qBAAqBK;IAExC,MAAM,EAAEE,QAAQ,EAAEC,KAAK,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,iBAAiB,EAAEC,MAAM,EAAE,GAAGV,YAAYG,IAAIQ,KAAK;IAE7F,MAAMC,wBAAwBT,IAAIQ,KAAK,CAACC,qBAAqB;IAE7D,MAAMC,MAAM,MAAMZ,gBAAgB;QAChCI;QACAD;QACAU,MAAMX,IAAIW,IAAI;QACdR;QACAC;QACAC;QACAC;QACAG;QACAT;QACAO;IACF;IAEA,OAAOK,SAASC,IAAI,CAClB;QACEH;QACAI,SAASd,IAAIe,CAAC,CAAC,+BAA+B;YAC5CC,OAAOxB,eAAeS,WAAWgB,MAAM,CAACC,MAAM,CAACC,QAAQ,EAAEnB,IAAIoB,IAAI;QACnE;IACF,GACA;QACEC,SAASzB,gBAAgB;YACvByB,SAAS,IAAIC;YACbtB;QACF;QACAP,QAAQC,WAAW6B,OAAO;IAC5B;AAEJ,EAAC"}