{"version":3,"sources":["../../../../src/fields/hooks/beforeDuplicate/traverseFields.ts"],"sourcesContent":["import type { SanitizedCollectionConfig } from '../../../collections/config/types.js'\nimport type { RequestContext } from '../../../index.js'\nimport type { JsonObject, 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 doc: T\n fields: (Field | TabAsField)[]\n id?: number | string\n overrideAccess: boolean\n parentIndexPath: string\n parentIsLocalized: boolean\n parentPath: string\n parentSchemaPath: string\n req: PayloadRequest\n siblingDoc: JsonObject\n}\n\nexport const traverseFields = async ({\n id,\n blockData,\n collection,\n context,\n doc,\n fields,\n overrideAccess,\n parentIndexPath,\n parentIsLocalized,\n parentPath,\n parentSchemaPath,\n req,\n siblingDoc,\n}: Args): Promise => {\n const promises: Promise[] = []\n\n fields.forEach((field, fieldIndex) => {\n promises.push(\n promise({\n id,\n blockData,\n collection,\n context,\n doc,\n field,\n fieldIndex,\n overrideAccess,\n parentIndexPath,\n parentIsLocalized,\n parentPath,\n parentSchemaPath,\n req,\n siblingDoc,\n siblingFields: fields,\n }),\n )\n })\n await Promise.all(promises)\n}\n"],"names":["promise","traverseFields","id","blockData","collection","context","doc","fields","overrideAccess","parentIndexPath","parentIsLocalized","parentPath","parentSchemaPath","req","siblingDoc","promises","forEach","field","fieldIndex","push","siblingFields","Promise","all"],"mappings":"AAKA,SAASA,OAAO,QAAQ,eAAc;AAqBtC,OAAO,MAAMC,iBAAiB,OAAU,EACtCC,EAAE,EACFC,SAAS,EACTC,UAAU,EACVC,OAAO,EACPC,GAAG,EACHC,MAAM,EACNC,cAAc,EACdC,eAAe,EACfC,iBAAiB,EACjBC,UAAU,EACVC,gBAAgB,EAChBC,GAAG,EACHC,UAAU,EACF;IACR,MAAMC,WAA4B,EAAE;IAEpCR,OAAOS,OAAO,CAAC,CAACC,OAAOC;QACrBH,SAASI,IAAI,CACXnB,QAAQ;YACNE;YACAC;YACAC;YACAC;YACAC;YACAW;YACAC;YACAV;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAM,eAAeb;QACjB;IAEJ;IACA,MAAMc,QAAQC,GAAG,CAACP;AACpB,EAAC"}