Files
klz-cables.com/.pnpm-store/v10/files/24/76ef3d56c3eb56100f860d6cc847b5ff914b8cfc894bdeb10d3a6c4e7a962368daf952f37f673be289c72f837fc4fc03494b13538f0bd0277ff7a92c55f27a
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
2.5 KiB
Plaintext

{"version":3,"sources":["../../../src/utilities/getEntityPermissions/entityDocExists.ts"],"sourcesContent":["import {\n type AllOperations,\n combineQueries,\n type DefaultDocumentIDType,\n type PayloadRequest,\n type Where,\n} from '../../index.js'\n\n/**\n * Returns whether or not the entity doc exists based on the where query.\n */\nexport async function entityDocExists({\n id,\n slug,\n entityType,\n locale,\n operation,\n req,\n where,\n}: {\n entityType: 'collection' | 'global'\n id?: DefaultDocumentIDType\n locale?: string\n operation?: AllOperations\n req: PayloadRequest\n slug: string\n where: Where\n}): Promise<boolean> {\n if (entityType === 'global') {\n const global = await req.payload.db.findGlobal({\n slug,\n locale,\n req,\n select: {},\n where,\n })\n\n const hasGlobalDoc = Boolean(global && Object.keys(global).length > 0)\n\n return hasGlobalDoc\n }\n\n if (entityType === 'collection' && id) {\n if (operation === 'readVersions') {\n const count = await req.payload.db.countVersions({\n collection: slug,\n locale,\n req,\n where: combineQueries(where, { parent: { equals: id } }),\n })\n return count.totalDocs > 0\n }\n\n const count = await req.payload.db.count({\n collection: slug,\n locale,\n req,\n where: combineQueries(where, { id: { equals: id } }),\n })\n\n return count.totalDocs > 0\n }\n\n return false\n}\n"],"names":["combineQueries","entityDocExists","id","slug","entityType","locale","operation","req","where","global","payload","db","findGlobal","select","hasGlobalDoc","Boolean","Object","keys","length","count","countVersions","collection","parent","equals","totalDocs"],"mappings":"AAAA,SAEEA,cAAc,QAIT,iBAAgB;AAEvB;;CAEC,GACD,OAAO,eAAeC,gBAAgB,EACpCC,EAAE,EACFC,IAAI,EACJC,UAAU,EACVC,MAAM,EACNC,SAAS,EACTC,GAAG,EACHC,KAAK,EASN;IACC,IAAIJ,eAAe,UAAU;QAC3B,MAAMK,SAAS,MAAMF,IAAIG,OAAO,CAACC,EAAE,CAACC,UAAU,CAAC;YAC7CT;YACAE;YACAE;YACAM,QAAQ,CAAC;YACTL;QACF;QAEA,MAAMM,eAAeC,QAAQN,UAAUO,OAAOC,IAAI,CAACR,QAAQS,MAAM,GAAG;QAEpE,OAAOJ;IACT;IAEA,IAAIV,eAAe,gBAAgBF,IAAI;QACrC,IAAII,cAAc,gBAAgB;YAChC,MAAMa,QAAQ,MAAMZ,IAAIG,OAAO,CAACC,EAAE,CAACS,aAAa,CAAC;gBAC/CC,YAAYlB;gBACZE;gBACAE;gBACAC,OAAOR,eAAeQ,OAAO;oBAAEc,QAAQ;wBAAEC,QAAQrB;oBAAG;gBAAE;YACxD;YACA,OAAOiB,MAAMK,SAAS,GAAG;QAC3B;QAEA,MAAML,QAAQ,MAAMZ,IAAIG,OAAO,CAACC,EAAE,CAACQ,KAAK,CAAC;YACvCE,YAAYlB;YACZE;YACAE;YACAC,OAAOR,eAAeQ,OAAO;gBAAEN,IAAI;oBAAEqB,QAAQrB;gBAAG;YAAE;QACpD;QAEA,OAAOiB,MAAMK,SAAS,GAAG;IAC3B;IAEA,OAAO;AACT"}