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

68 lines
1.9 KiB
Plaintext

import { confirmPassword, password } from 'payload/shared';
import { traverseFields } from './traverseFields.js';
const baseAuthFields = [{
name: 'password',
type: 'text',
required: true,
validate: password
}, {
name: 'confirm-password',
type: 'text',
required: true,
validate: confirmPassword
}];
/**
* Flattens the config fields into a map of field schemas
*/
export const buildFieldSchemaMap = args => {
const {
collectionSlug,
config,
globalSlug,
i18n
} = args;
const schemaMap = new Map();
if (collectionSlug) {
const matchedCollection = config.collections.find(collection => collection.slug === collectionSlug);
if (matchedCollection) {
let fieldsToSet = matchedCollection?.fields || [];
if (matchedCollection.auth && !matchedCollection.auth.disableLocalStrategy) {
;
baseAuthFields[0].label = i18n.t('general:password');
baseAuthFields[1].label = i18n.t('authentication:confirmPassword');
// Place these fields _last_ to ensure they do not disrupt field paths in the field schema map
fieldsToSet = fieldsToSet.concat(baseAuthFields);
}
schemaMap.set(collectionSlug, {
fields: fieldsToSet
});
traverseFields({
config,
fields: fieldsToSet,
i18n,
parentIndexPath: '',
parentSchemaPath: collectionSlug,
schemaMap
});
}
} else if (globalSlug) {
const matchedGlobal = config.globals.find(global => global.slug === globalSlug);
if (matchedGlobal) {
schemaMap.set(globalSlug, {
fields: matchedGlobal.fields
});
traverseFields({
config,
fields: matchedGlobal.fields,
i18n,
parentIndexPath: '',
parentSchemaPath: globalSlug,
schemaMap
});
}
}
return {
fieldSchemaMap: schemaMap
};
};
//# sourceMappingURL=index.js.map