Files
klz-cables.com/.pnpm-store/v10/files/fa/cf4c778895700836c4fbb73ed03560b8a459f7801057617694f8b40fe818ad075bf04055ac90fc17054f6b6a7787c6041e2bc97721c20dae7fa4e475edb2ef
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

73 lines
2.7 KiB
Plaintext

import { fieldShouldBeLocalized } from 'payload/shared';
import { isArrayOfRows } from '../../utilities/isArrayOfRows.js';
import { traverseFields } from './traverseFields.js';
export const transformArray = ({ adapter, arrayTableName, baseTableName, blocks, blocksToDelete, data, field, locale, numbers, numbersToDelete, parentIsLocalized, path, relationships, relationshipsToDelete, selects, texts, textsToDelete, withinArrayOrBlockLocale })=>{
const newRows = [];
const hasUUID = adapter.tables[arrayTableName]._uuid;
if (isArrayOfRows(data)) {
data.forEach((arrayRow, i)=>{
const newRow = {
arrays: {},
arraysToPush: {},
locales: {},
row: {
_order: i + 1
}
};
// If we have declared a _uuid field on arrays,
// that means the ID has to be unique,
// and our ids within arrays are not unique.
// So move the ID to a uuid field for storage
// and allow the database to generate a serial id automatically
if (hasUUID) {
newRow.row._uuid = arrayRow.id;
delete arrayRow.id;
}
if (locale) {
newRow.locales[locale] = {
_locale: locale
};
}
if (fieldShouldBeLocalized({
field,
parentIsLocalized
}) && locale) {
newRow.row._locale = locale;
}
if (withinArrayOrBlockLocale) {
newRow.row._locale = withinArrayOrBlockLocale;
}
traverseFields({
adapter,
arrays: newRow.arrays,
arraysToPush: newRow.arraysToPush,
baseTableName,
blocks,
blocksToDelete,
columnPrefix: '',
data: arrayRow,
fieldPrefix: '',
fields: field.flattenedFields,
insideArrayOrBlock: true,
locales: newRow.locales,
numbers,
numbersToDelete,
parentIsLocalized: parentIsLocalized || field.localized,
parentTableName: arrayTableName,
path: `${path || ''}${field.name}.${i}.`,
relationships,
relationshipsToAppend: [],
relationshipsToDelete,
row: newRow.row,
selects,
texts,
textsToDelete,
withinArrayOrBlockLocale
});
newRows.push(newRow);
});
}
return newRows;
};
//# sourceMappingURL=array.js.map