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
1 line
4.4 KiB
Plaintext
1 line
4.4 KiB
Plaintext
{"version":3,"sources":["../../../../src/fields/hooks/beforeChange/traverseFields.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'\nimport type { Field, TabAsField } from '../../config/types.js'\n\nimport { promise } from './promise.js'\n\ntype Args = {\n /**\n * Data of the nearest parent block. If no parent block exists, this will be the `undefined`\n */\n blockData?: JsonObject\n collection: null | SanitizedCollectionConfig\n context: RequestContext\n data: JsonObject\n /**\n * The original data (not modified by any hooks)\n */\n doc: JsonObject\n /**\n * The original data with locales (not modified by any hooks)\n */\n docWithLocales: JsonObject\n errors: ValidationFieldError[]\n /**\n * Built up labels of parent fields\n *\n * @example \"Group Field > Tab Field > Text Field\"\n */\n fieldLabelPath: string\n fields: (Field | TabAsField)[]\n global: null | SanitizedGlobalConfig\n id?: number | string\n mergeLocaleActions: (() => Promise<void> | void)[]\n operation: Operation\n overrideAccess: boolean\n parentIndexPath: string\n /**\n * @todo make required in v4.0\n */\n parentIsLocalized?: boolean\n parentPath: string\n parentSchemaPath: string\n req: PayloadRequest\n siblingData: JsonObject\n /**\n * The original siblingData (not modified by any hooks)\n */\n siblingDoc: JsonObject\n /**\n * The original siblingData with locales (not modified by any hooks)\n */\n siblingDocWithLocales: JsonObject\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 */\nexport const traverseFields = async ({\n id,\n blockData,\n collection,\n context,\n data,\n doc,\n docWithLocales,\n errors,\n fieldLabelPath,\n fields,\n global,\n mergeLocaleActions,\n operation,\n overrideAccess,\n parentIndexPath,\n parentIsLocalized,\n parentPath,\n parentSchemaPath,\n req,\n siblingData,\n siblingDoc,\n siblingDocWithLocales,\n skipValidation,\n}: Args): Promise<void> => {\n const promises: Promise<void>[] = []\n\n fields.forEach((field, fieldIndex) => {\n promises.push(\n promise({\n id,\n blockData,\n collection,\n context,\n data,\n doc,\n docWithLocales,\n errors,\n field,\n fieldIndex,\n fieldLabelPath,\n global,\n mergeLocaleActions,\n operation,\n overrideAccess,\n parentIndexPath,\n parentIsLocalized: parentIsLocalized!,\n parentPath,\n parentSchemaPath,\n req,\n siblingData,\n siblingDoc,\n siblingDocWithLocales,\n siblingFields: fields,\n skipValidation: skipValidation!,\n }),\n )\n })\n\n await Promise.all(promises)\n}\n"],"names":["promise","traverseFields","id","blockData","collection","context","data","doc","docWithLocales","errors","fieldLabelPath","fields","global","mergeLocaleActions","operation","overrideAccess","parentIndexPath","parentIsLocalized","parentPath","parentSchemaPath","req","siblingData","siblingDoc","siblingDocWithLocales","skipValidation","promises","forEach","field","fieldIndex","push","siblingFields","Promise","all"],"mappings":"AAOA,SAASA,OAAO,QAAQ,eAAc;AAmDtC;;;;;;;CAOC,GACD,OAAO,MAAMC,iBAAiB,OAAO,EACnCC,EAAE,EACFC,SAAS,EACTC,UAAU,EACVC,OAAO,EACPC,IAAI,EACJC,GAAG,EACHC,cAAc,EACdC,MAAM,EACNC,cAAc,EACdC,MAAM,EACNC,MAAM,EACNC,kBAAkB,EAClBC,SAAS,EACTC,cAAc,EACdC,eAAe,EACfC,iBAAiB,EACjBC,UAAU,EACVC,gBAAgB,EAChBC,GAAG,EACHC,WAAW,EACXC,UAAU,EACVC,qBAAqB,EACrBC,cAAc,EACT;IACL,MAAMC,WAA4B,EAAE;IAEpCd,OAAOe,OAAO,CAAC,CAACC,OAAOC;QACrBH,SAASI,IAAI,CACX7B,QAAQ;YACNE;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAkB;YACAC;YACAlB;YACAE;YACAC;YACAC;YACAC;YACAC;YACAC,mBAAmBA;YACnBC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAO,eAAenB;YACfa,gBAAgBA;QAClB;IAEJ;IAEA,MAAMO,QAAQC,GAAG,CAACP;AACpB,EAAC"} |