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
1.5 KiB
Plaintext
1 line
1.5 KiB
Plaintext
{"version":3,"sources":["../../src/auth/executeAccess.ts"],"sourcesContent":["import type { Access, AccessResult } from '../config/types.js'\nimport type { PayloadRequest } from '../types/index.js'\n\nimport { Forbidden } from '../errors/index.js'\n\ntype OperationArgs = {\n data?: any\n disableErrors?: boolean\n id?: number | string\n isReadingStaticFile?: boolean\n req: PayloadRequest\n}\nexport const executeAccess = async (\n { id, data, disableErrors, isReadingStaticFile = false, req }: OperationArgs,\n access: Access,\n): Promise<AccessResult> => {\n if (access) {\n const resolvedConstraint = await access({\n id,\n data,\n isReadingStaticFile,\n req,\n })\n\n if (!resolvedConstraint) {\n if (!disableErrors) {\n throw new Forbidden(req.t)\n }\n }\n\n return resolvedConstraint\n }\n\n if (req.user) {\n return true\n }\n\n if (!disableErrors) {\n throw new Forbidden(req.t)\n }\n return false\n}\n"],"names":["Forbidden","executeAccess","id","data","disableErrors","isReadingStaticFile","req","access","resolvedConstraint","t","user"],"mappings":"AAGA,SAASA,SAAS,QAAQ,qBAAoB;AAS9C,OAAO,MAAMC,gBAAgB,OAC3B,EAAEC,EAAE,EAAEC,IAAI,EAAEC,aAAa,EAAEC,sBAAsB,KAAK,EAAEC,GAAG,EAAiB,EAC5EC;IAEA,IAAIA,QAAQ;QACV,MAAMC,qBAAqB,MAAMD,OAAO;YACtCL;YACAC;YACAE;YACAC;QACF;QAEA,IAAI,CAACE,oBAAoB;YACvB,IAAI,CAACJ,eAAe;gBAClB,MAAM,IAAIJ,UAAUM,IAAIG,CAAC;YAC3B;QACF;QAEA,OAAOD;IACT;IAEA,IAAIF,IAAII,IAAI,EAAE;QACZ,OAAO;IACT;IAEA,IAAI,CAACN,eAAe;QAClB,MAAM,IAAIJ,UAAUM,IAAIG,CAAC;IAC3B;IACA,OAAO;AACT,EAAC"} |