Files
klz-cables.com/.pnpm-store/v10/files/d1/0339cedf746fde1b83b86856ecfe100d1013575ca2731e51deaf83564a70c108516775ed6b42a9f94f76b23476a7a303c165f8aa05aaba42afc2ed4b38be0e
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
1.8 KiB
Plaintext

{"version":3,"sources":["../../../../src/fields/baseFields/slug/countVersions.ts"],"sourcesContent":["import type {\n CollectionSlug,\n DefaultDocumentIDType,\n GlobalSlug,\n PayloadRequest,\n Where,\n} from '../../../index.js'\n\n/**\n * This is a cross-entity way to count the number of versions for any given document.\n * It will work for both collections and globals.\n * @returns number of versions\n */\nexport const countVersions = async (args: {\n collectionSlug?: CollectionSlug\n globalSlug?: GlobalSlug\n parentID?: DefaultDocumentIDType\n req: PayloadRequest\n}): Promise<number> => {\n const { collectionSlug, globalSlug, parentID, req } = args\n\n let countFn\n\n const where: Where = {\n parent: {\n equals: parentID,\n },\n }\n\n if (collectionSlug) {\n countFn = () =>\n req.payload.countVersions({\n collection: collectionSlug,\n where,\n })\n }\n\n if (globalSlug) {\n countFn = () =>\n req.payload.countGlobalVersions({\n global: globalSlug,\n where,\n })\n }\n\n const res = countFn ? (await countFn()?.then((res) => res.totalDocs || 0)) || 0 : 0\n\n return res\n}\n"],"names":["countVersions","args","collectionSlug","globalSlug","parentID","req","countFn","where","parent","equals","payload","collection","countGlobalVersions","global","res","then","totalDocs"],"mappings":"AAQA;;;;CAIC,GACD,OAAO,MAAMA,gBAAgB,OAAOC;IAMlC,MAAM,EAAEC,cAAc,EAAEC,UAAU,EAAEC,QAAQ,EAAEC,GAAG,EAAE,GAAGJ;IAEtD,IAAIK;IAEJ,MAAMC,QAAe;QACnBC,QAAQ;YACNC,QAAQL;QACV;IACF;IAEA,IAAIF,gBAAgB;QAClBI,UAAU,IACRD,IAAIK,OAAO,CAACV,aAAa,CAAC;gBACxBW,YAAYT;gBACZK;YACF;IACJ;IAEA,IAAIJ,YAAY;QACdG,UAAU,IACRD,IAAIK,OAAO,CAACE,mBAAmB,CAAC;gBAC9BC,QAAQV;gBACRI;YACF;IACJ;IAEA,MAAMO,MAAMR,UAAU,AAAC,MAAMA,WAAWS,KAAK,CAACD,MAAQA,IAAIE,SAAS,IAAI,MAAO,IAAI;IAElF,OAAOF;AACT,EAAC"}