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
2.3 KiB
Plaintext
1 line
2.3 KiB
Plaintext
{"version":3,"sources":["../src/countGlobalVersions.ts"],"sourcesContent":["import type { CountGlobalVersions, SanitizedGlobalConfig } from 'payload'\n\nimport { buildVersionGlobalFields } from 'payload'\nimport toSnakeCase from 'to-snake-case'\n\nimport type { DrizzleAdapter } from './types.js'\n\nimport { buildQuery } from './queries/buildQuery.js'\nimport { getTransaction } from './utilities/getTransaction.js'\n\nexport const countGlobalVersions: CountGlobalVersions = async function countGlobalVersions(\n this: DrizzleAdapter,\n { global, locale, req, where: whereArg },\n) {\n const globalConfig: SanitizedGlobalConfig = this.payload.globals.config.find(\n ({ slug }) => slug === global,\n )\n\n const tableName = this.tableNameMap.get(\n `_${toSnakeCase(globalConfig.slug)}${this.versionsSuffix}`,\n )\n\n const fields = buildVersionGlobalFields(this.payload.config, globalConfig, true)\n\n const { joins, where } = buildQuery({\n adapter: this,\n fields,\n locale,\n tableName,\n where: whereArg,\n })\n\n const db = await getTransaction(this, req)\n\n const countResult = await this.countDistinct({\n db,\n joins,\n tableName,\n where,\n })\n\n return { totalDocs: countResult }\n}\n"],"names":["buildVersionGlobalFields","toSnakeCase","buildQuery","getTransaction","countGlobalVersions","global","locale","req","where","whereArg","globalConfig","payload","globals","config","find","slug","tableName","tableNameMap","get","versionsSuffix","fields","joins","adapter","db","countResult","countDistinct","totalDocs"],"mappings":"AAEA,SAASA,wBAAwB,QAAQ,UAAS;AAClD,OAAOC,iBAAiB,gBAAe;AAIvC,SAASC,UAAU,QAAQ,0BAAyB;AACpD,SAASC,cAAc,QAAQ,gCAA+B;AAE9D,OAAO,MAAMC,sBAA2C,eAAeA,oBAErE,EAAEC,MAAM,EAAEC,MAAM,EAAEC,GAAG,EAAEC,OAAOC,QAAQ,EAAE;IAExC,MAAMC,eAAsC,IAAI,CAACC,OAAO,CAACC,OAAO,CAACC,MAAM,CAACC,IAAI,CAC1E,CAAC,EAAEC,IAAI,EAAE,GAAKA,SAASV;IAGzB,MAAMW,YAAY,IAAI,CAACC,YAAY,CAACC,GAAG,CACrC,CAAC,CAAC,EAAEjB,YAAYS,aAAaK,IAAI,IAAI,IAAI,CAACI,cAAc,EAAE;IAG5D,MAAMC,SAASpB,yBAAyB,IAAI,CAACW,OAAO,CAACE,MAAM,EAAEH,cAAc;IAE3E,MAAM,EAAEW,KAAK,EAAEb,KAAK,EAAE,GAAGN,WAAW;QAClCoB,SAAS,IAAI;QACbF;QACAd;QACAU;QACAR,OAAOC;IACT;IAEA,MAAMc,KAAK,MAAMpB,eAAe,IAAI,EAAEI;IAEtC,MAAMiB,cAAc,MAAM,IAAI,CAACC,aAAa,CAAC;QAC3CF;QACAF;QACAL;QACAR;IACF;IAEA,OAAO;QAAEkB,WAAWF;IAAY;AAClC,EAAC"} |