Files
klz-cables.com/.pnpm-store/v10/files/90/d7409e9c6cdc33a1e0da396f89c58f714e3c853749632658138495b6dcdc65856327e5c2b8d32c52232d49558bb83da6994ed5e076624bcb67f81672cccefe
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
3.3 KiB
Plaintext

{"version":3,"sources":["../../../src/collections/operations/docAccess.ts"],"sourcesContent":["import type { SanitizedCollectionPermission } from '../../auth/index.js'\nimport type { AllOperations, JsonObject, PayloadRequest } from '../../types/index.js'\nimport type { Collection } from '../config/types.js'\n\nimport { getEntityPermissions } from '../../utilities/getEntityPermissions/getEntityPermissions.js'\nimport { killTransaction } from '../../utilities/killTransaction.js'\nimport { sanitizePermissions } from '../../utilities/sanitizePermissions.js'\n\nconst allOperations: AllOperations[] = ['create', 'read', 'update', 'delete']\n\ntype Arguments = {\n collection: Collection\n /**\n * If the document data is passed, it will be used to check access instead of fetching the document from the database.\n */\n data?: JsonObject\n /**\n * When called for creating a new document, id is not provided.\n */\n id?: number | string\n req: PayloadRequest\n}\n\nexport async function docAccessOperation(args: Arguments): Promise<SanitizedCollectionPermission> {\n const {\n id,\n collection: { config },\n data,\n req,\n } = args\n\n const collectionOperations = [...allOperations]\n\n if (\n config.auth &&\n typeof config.auth.maxLoginAttempts !== 'undefined' &&\n config.auth.maxLoginAttempts !== 0\n ) {\n collectionOperations.push('unlock')\n }\n\n if (config.versions) {\n collectionOperations.push('readVersions')\n }\n\n try {\n const result = await getEntityPermissions({\n id: id!,\n blockReferencesPermissions: {},\n data,\n entity: config,\n entityType: 'collection',\n fetchData: id ? true : (false as true),\n operations: collectionOperations,\n req,\n })\n\n const sanitizedPermissions = sanitizePermissions({\n collections: {\n [config.slug]: result,\n },\n })\n\n const collectionPermissions = sanitizedPermissions?.collections?.[config.slug]\n return collectionPermissions ?? { fields: {} }\n } catch (e: unknown) {\n await killTransaction(req)\n throw e\n }\n}\n"],"names":["getEntityPermissions","killTransaction","sanitizePermissions","allOperations","docAccessOperation","args","id","collection","config","data","req","collectionOperations","auth","maxLoginAttempts","push","versions","result","blockReferencesPermissions","entity","entityType","fetchData","operations","sanitizedPermissions","collections","slug","collectionPermissions","fields","e"],"mappings":"AAIA,SAASA,oBAAoB,QAAQ,+DAA8D;AACnG,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,mBAAmB,QAAQ,yCAAwC;AAE5E,MAAMC,gBAAiC;IAAC;IAAU;IAAQ;IAAU;CAAS;AAe7E,OAAO,eAAeC,mBAAmBC,IAAe;IACtD,MAAM,EACJC,EAAE,EACFC,YAAY,EAAEC,MAAM,EAAE,EACtBC,IAAI,EACJC,GAAG,EACJ,GAAGL;IAEJ,MAAMM,uBAAuB;WAAIR;KAAc;IAE/C,IACEK,OAAOI,IAAI,IACX,OAAOJ,OAAOI,IAAI,CAACC,gBAAgB,KAAK,eACxCL,OAAOI,IAAI,CAACC,gBAAgB,KAAK,GACjC;QACAF,qBAAqBG,IAAI,CAAC;IAC5B;IAEA,IAAIN,OAAOO,QAAQ,EAAE;QACnBJ,qBAAqBG,IAAI,CAAC;IAC5B;IAEA,IAAI;QACF,MAAME,SAAS,MAAMhB,qBAAqB;YACxCM,IAAIA;YACJW,4BAA4B,CAAC;YAC7BR;YACAS,QAAQV;YACRW,YAAY;YACZC,WAAWd,KAAK,OAAQ;YACxBe,YAAYV;YACZD;QACF;QAEA,MAAMY,uBAAuBpB,oBAAoB;YAC/CqB,aAAa;gBACX,CAACf,OAAOgB,IAAI,CAAC,EAAER;YACjB;QACF;QAEA,MAAMS,wBAAwBH,sBAAsBC,aAAa,CAACf,OAAOgB,IAAI,CAAC;QAC9E,OAAOC,yBAAyB;YAAEC,QAAQ,CAAC;QAAE;IAC/C,EAAE,OAAOC,GAAY;QACnB,MAAM1B,gBAAgBS;QACtB,MAAMiB;IACR;AACF"}