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.7 KiB
Plaintext
1 line
1.7 KiB
Plaintext
{"version":3,"sources":["../src/findGlobal.ts"],"sourcesContent":["import type { FindGlobal } from 'payload'\n\nimport toSnakeCase from 'to-snake-case'\n\nimport type { DrizzleAdapter } from './types.js'\n\nimport { findMany } from './find/findMany.js'\n\nexport const findGlobal: FindGlobal = async function findGlobal(\n this: DrizzleAdapter,\n { slug, locale, req, select, where },\n) {\n const globalConfig = this.payload.globals.config.find((config) => config.slug === slug)\n\n const tableName = this.tableNameMap.get(toSnakeCase(globalConfig.slug))\n\n const {\n docs: [doc],\n } = await findMany({\n adapter: this,\n fields: globalConfig.flattenedFields,\n limit: 1,\n locale,\n pagination: false,\n req,\n select,\n tableName,\n where,\n })\n\n if (doc) {\n doc.globalType = slug\n return doc\n }\n\n return {}\n}\n"],"names":["toSnakeCase","findMany","findGlobal","slug","locale","req","select","where","globalConfig","payload","globals","config","find","tableName","tableNameMap","get","docs","doc","adapter","fields","flattenedFields","limit","pagination","globalType"],"mappings":"AAEA,OAAOA,iBAAiB,gBAAe;AAIvC,SAASC,QAAQ,QAAQ,qBAAoB;AAE7C,OAAO,MAAMC,aAAyB,eAAeA,WAEnD,EAAEC,IAAI,EAAEC,MAAM,EAAEC,GAAG,EAAEC,MAAM,EAAEC,KAAK,EAAE;IAEpC,MAAMC,eAAe,IAAI,CAACC,OAAO,CAACC,OAAO,CAACC,MAAM,CAACC,IAAI,CAAC,CAACD,SAAWA,OAAOR,IAAI,KAAKA;IAElF,MAAMU,YAAY,IAAI,CAACC,YAAY,CAACC,GAAG,CAACf,YAAYQ,aAAaL,IAAI;IAErE,MAAM,EACJa,MAAM,CAACC,IAAI,EACZ,GAAG,MAAMhB,SAAS;QACjBiB,SAAS,IAAI;QACbC,QAAQX,aAAaY,eAAe;QACpCC,OAAO;QACPjB;QACAkB,YAAY;QACZjB;QACAC;QACAO;QACAN;IACF;IAEA,IAAIU,KAAK;QACPA,IAAIM,UAAU,GAAGpB;QACjB,OAAOc;IACT;IAEA,OAAO,CAAC;AACV,EAAC"} |