Files
klz-cables.com/.pnpm-store/v10/files/ca/3f973998df20e411efa6ea98c4ecb4470f95a7ce6c6eb40a10f3eb7843cc2436dd850fa07044364af9f9517561e25ea4c1d8814fada6a78314b343f8515980
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

1 line
3.7 KiB
Plaintext

{"version":3,"sources":["../../../../src/fields/hooks/beforeChange/index.ts"],"sourcesContent":["import type { SanitizedCollectionConfig } from '../../../collections/config/types.js'\nimport type { ValidationFieldError } from '../../../errors/index.js'\nimport type { SanitizedGlobalConfig } from '../../../globals/config/types.js'\nimport type { RequestContext } from '../../../index.js'\nimport type { JsonObject, Operation, PayloadRequest } from '../../../types/index.js'\n\nimport { ValidationError } from '../../../errors/index.js'\nimport { deepCopyObjectSimple } from '../../../utilities/deepCopyObject.js'\nimport { traverseFields } from './traverseFields.js'\n\nexport type Args<T extends JsonObject> = {\n collection: null | SanitizedCollectionConfig\n context: RequestContext\n data: T\n doc: T\n docWithLocales: JsonObject\n global: null | SanitizedGlobalConfig\n id?: number | string\n operation: Operation\n overrideAccess?: boolean\n req: PayloadRequest\n skipValidation?: boolean\n}\n\n/**\n * This function is responsible for the following actions, in order:\n * - Run condition\n * - Execute field hooks\n * - Validate data\n * - Transform data for storage\n * - Unflatten locales. The input `data` is the normal document for one locale. The output result will become the document with locales.\n */\n\nexport const beforeChange = async <T extends JsonObject>({\n id,\n collection,\n context,\n data: incomingData,\n doc,\n docWithLocales,\n global,\n operation,\n overrideAccess,\n req,\n skipValidation,\n}: Args<T>): Promise<T> => {\n const data = deepCopyObjectSimple(incomingData)\n const mergeLocaleActions: (() => Promise<void> | void)[] = []\n const errors: ValidationFieldError[] = []\n\n await traverseFields({\n id,\n collection,\n context,\n data,\n doc,\n docWithLocales,\n errors,\n fieldLabelPath: '',\n fields: (collection?.fields || global?.fields)!,\n global,\n mergeLocaleActions,\n operation,\n overrideAccess: overrideAccess!,\n parentIndexPath: '',\n parentIsLocalized: false,\n parentPath: '',\n parentSchemaPath: '',\n req,\n siblingData: data,\n siblingDoc: doc,\n siblingDocWithLocales: docWithLocales,\n skipValidation,\n })\n\n if (errors.length > 0) {\n throw new ValidationError(\n {\n id,\n collection: collection?.slug,\n errors,\n global: global?.slug,\n req,\n },\n req.t,\n )\n }\n\n for (const action of mergeLocaleActions) {\n await action()\n }\n\n return data\n}\n"],"names":["ValidationError","deepCopyObjectSimple","traverseFields","beforeChange","id","collection","context","data","incomingData","doc","docWithLocales","global","operation","overrideAccess","req","skipValidation","mergeLocaleActions","errors","fieldLabelPath","fields","parentIndexPath","parentIsLocalized","parentPath","parentSchemaPath","siblingData","siblingDoc","siblingDocWithLocales","length","slug","t","action"],"mappings":"AAMA,SAASA,eAAe,QAAQ,2BAA0B;AAC1D,SAASC,oBAAoB,QAAQ,uCAAsC;AAC3E,SAASC,cAAc,QAAQ,sBAAqB;AAgBpD;;;;;;;CAOC,GAED,OAAO,MAAMC,eAAe,OAA6B,EACvDC,EAAE,EACFC,UAAU,EACVC,OAAO,EACPC,MAAMC,YAAY,EAClBC,GAAG,EACHC,cAAc,EACdC,MAAM,EACNC,SAAS,EACTC,cAAc,EACdC,GAAG,EACHC,cAAc,EACN;IACR,MAAMR,OAAON,qBAAqBO;IAClC,MAAMQ,qBAAqD,EAAE;IAC7D,MAAMC,SAAiC,EAAE;IAEzC,MAAMf,eAAe;QACnBE;QACAC;QACAC;QACAC;QACAE;QACAC;QACAO;QACAC,gBAAgB;QAChBC,QAASd,YAAYc,UAAUR,QAAQQ;QACvCR;QACAK;QACAJ;QACAC,gBAAgBA;QAChBO,iBAAiB;QACjBC,mBAAmB;QACnBC,YAAY;QACZC,kBAAkB;QAClBT;QACAU,aAAajB;QACbkB,YAAYhB;QACZiB,uBAAuBhB;QACvBK;IACF;IAEA,IAAIE,OAAOU,MAAM,GAAG,GAAG;QACrB,MAAM,IAAI3B,gBACR;YACEI;YACAC,YAAYA,YAAYuB;YACxBX;YACAN,QAAQA,QAAQiB;YAChBd;QACF,GACAA,IAAIe,CAAC;IAET;IAEA,KAAK,MAAMC,UAAUd,mBAAoB;QACvC,MAAMc;IACR;IAEA,OAAOvB;AACT,EAAC"}