Files
klz-cables.com/.pnpm-store/v10/files/b9/5be21f2149f16b95d5dc738b9d8418ffd71ac9a9120d49d5db76432b5bbe8ff2a789e91335b574fed12b90c6c27c4a24c260fff10e33a6118ce35139eb13bd
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

39 lines
1.3 KiB
Plaintext

import { InvalidConfiguration } from '../../errors/InvalidConfiguration.js';
import { getFieldByPath } from '../../utilities/getFieldByPath.js';
export const sanitizeCompoundIndexes = ({ fields, indexes })=>{
const sanitizedCompoundIndexes = [];
for (const index of indexes){
const sanitized = {
fields: [],
unique: index.unique ?? false
};
for (const path of index.fields){
const result = getFieldByPath({
fields,
path
});
if (!result) {
throw new InvalidConfiguration(`Field ${path} was not found`);
}
const { field, localizedPath, pathHasLocalized } = result;
if ([
'array',
'blocks',
'group',
'tab'
].includes(field.type)) {
throw new InvalidConfiguration(`Compound index on ${field.type} cannot be set. Path: ${localizedPath}`);
}
sanitized.fields.push({
field,
localizedPath,
path,
pathHasLocalized
});
}
sanitizedCompoundIndexes.push(sanitized);
}
return sanitizedCompoundIndexes;
};
//# sourceMappingURL=sanitizeCompoundIndexes.js.map