Files
klz-cables.com/.pnpm-store/v10/files/0a/24ca21b158a96a4ee56acacf072cff1d7c6b18dca2bc22bc3e4fcf09040d7135d220ff23da3c5f5ac3a9fa5000f4aadb7a625d86a2c0c388901fa7b2c9e865
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

67 lines
2.4 KiB
Plaintext

import { executeAccess } from '../../auth/executeAccess.js';
import { combineQueries } from '../../database/combineQueries.js';
import { validateQueryPaths } from '../../database/queryValidation/validateQueryPaths.js';
import { buildVersionGlobalFields } from '../../index.js';
import { killTransaction } from '../../utilities/killTransaction.js';
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export const countGlobalVersionsOperation = async (args)=>{
try {
const { disableErrors, global, overrideAccess, where } = args;
const req = args.req;
const { payload } = req;
// /////////////////////////////////////
// beforeOperation - Global
// /////////////////////////////////////
if (global.hooks?.beforeOperation?.length) {
for (const hook of global.hooks.beforeOperation){
args = await hook({
args,
context: req.context,
global,
operation: 'countVersions',
overrideAccess,
req
}) || args;
}
}
// /////////////////////////////////////
// Access
// /////////////////////////////////////
let accessResult;
if (!overrideAccess) {
accessResult = await executeAccess({
disableErrors,
req
}, global.access.readVersions);
// If errors are disabled, and access returns false, return empty results
if (accessResult === false) {
return {
totalDocs: 0
};
}
}
const fullWhere = combineQueries(where, accessResult);
const versionFields = buildVersionGlobalFields(payload.config, global, true);
await validateQueryPaths({
globalConfig: global,
overrideAccess: overrideAccess,
req,
versionFields,
where: where
});
const result = await payload.db.countGlobalVersions({
global: global.slug,
req,
where: fullWhere
});
// /////////////////////////////////////
// Return results
// /////////////////////////////////////
return result;
} catch (error) {
await killTransaction(args.req);
throw error;
}
};
//# sourceMappingURL=countGlobalVersions.js.map