Files
klz-cables.com/.pnpm-store/v10/files/3f/6026f4ed38d3ddbb9e3c17044e35d3f5d5ef9589656c1aa2e7cdf9d13a70869485ff6593846a1d3f5750f6786efb3369f2b82dd2bdb99bcaa9f85eadc98804
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
7.0 KiB
Plaintext

{"version":3,"file":"renderFieldServerFn.js","names":["deepMerge","UnauthorizedError","getClientConfig","getClientSchemaMap","getSchemaMap","renderField","_internal_renderFieldHandler","field","fieldArg","initialValue","path","req","schemaPath","user","entityType","entitySlug","fieldPath","split","schemaMap","collectionSlug","undefined","config","payload","globalSlug","i18n","clientSchemaMap","importMap","targetField","get","join","Error","clone","data","name","fieldState","clientFieldSchemaMap","fieldConfig","fieldSchemaMap","formState","indexPath","lastRenderedPath","operation","parentPath","parentSchemaPath","permissions","preferences","fields","forceCreateClientField","previousFieldState","renderAllFields","siblingData","customComponents"],"sources":["../../../../src/forms/fieldSchemasToFormState/serverFunctions/renderFieldServerFn.ts"],"sourcesContent":["import {\n deepMerge,\n type Field,\n type FieldState,\n type ServerFunction,\n UnauthorizedError,\n} from 'payload'\n\nimport { getClientConfig } from '../../../utilities/getClientConfig.js'\nimport { getClientSchemaMap } from '../../../utilities/getClientSchemaMap.js'\nimport { getSchemaMap } from '../../../utilities/getSchemaMap.js'\nimport { renderField } from '../renderField.js'\n\nexport type RenderFieldServerFnArgs<TField = Field> = {\n /**\n * Override field config pulled from schemaPath lookup\n */\n field?: Partial<TField>\n /**\n * Pass the value this field will receive when rendering it on the server.\n * For richText, this helps provide initial state for sub-fields that are immediately rendered (like blocks)\n * so that we can avoid multiple waterfall requests for each block that renders on the client.\n */\n initialValue?: unknown\n /**\n * Path to the field to render\n * @default field name\n */\n path?: string\n /**\n * Dot schema path to a richText field declared in your config.\n * Format:\n * \"collection.<collectionSlug>.<fieldPath>\"\n * \"global.<globalSlug>.<fieldPath>\"\n *\n * Examples:\n * \"collection.posts.richText\"\n * \"global.siteSettings.content\"\n */\n schemaPath: string\n}\nexport type RenderFieldServerFnReturnType = {} & FieldState['customComponents']\n\n/**\n * @experimental - may break in minor releases\n */\nexport const _internal_renderFieldHandler: ServerFunction<\n RenderFieldServerFnArgs,\n Promise<RenderFieldServerFnReturnType>\n // eslint-disable-next-line @typescript-eslint/require-await\n> = async ({ field: fieldArg, initialValue, path, req, schemaPath }) => {\n if (!req.user) {\n throw new UnauthorizedError()\n }\n\n const [entityType, entitySlug, ...fieldPath] = schemaPath.split('.')\n\n const schemaMap = getSchemaMap({\n collectionSlug: entityType === 'collection' ? entitySlug : undefined,\n config: req.payload.config,\n globalSlug: entityType === 'global' ? entitySlug : undefined,\n i18n: req.i18n,\n })\n\n // Provide client schema map as it would have been provided if the target editor field would have been rendered.\n // For lexical, only then will it contain all the lexical-internal entries\n const clientSchemaMap = getClientSchemaMap({\n collectionSlug: entityType === 'collection' ? entitySlug : undefined,\n config: getClientConfig({\n config: req.payload.config,\n i18n: req.i18n,\n importMap: req.payload.importMap,\n user: req.user,\n }),\n globalSlug: entityType === 'global' ? entitySlug : undefined,\n i18n: req.i18n,\n payload: req.payload,\n schemaMap,\n })\n\n const targetField = schemaMap.get(`${entitySlug}.${fieldPath.join('.')}`) as Field | undefined\n\n if (!targetField) {\n throw new Error(`Could not find target field at schemaPath: ${schemaPath}`)\n }\n\n const field: Field = fieldArg ? deepMerge(targetField, fieldArg, { clone: false }) : targetField\n\n let data = {}\n if (typeof initialValue !== 'undefined') {\n if ('name' in field) {\n data[field.name] = initialValue\n } else {\n data = initialValue\n }\n }\n\n const fieldState: FieldState = {}\n renderField({\n clientFieldSchemaMap: clientSchemaMap,\n collectionSlug: entityType === 'collection' && entitySlug ? entitySlug : '-',\n data,\n fieldConfig: field,\n fieldSchemaMap: schemaMap,\n fieldState, // TODO,\n formState: {}, // TODO,\n indexPath: '',\n lastRenderedPath: '',\n operation: 'create',\n parentPath: '',\n parentSchemaPath: '',\n path: path ?? ('name' in field ? field.name : ''),\n permissions: true,\n preferences: {\n fields: {},\n },\n // If we are passed a field override, we want to ensure we create a new client field based on that override\n forceCreateClientField: fieldArg ? true : false,\n previousFieldState: undefined,\n renderAllFields: true,\n req,\n schemaPath: `${entitySlug}.${fieldPath.join('.')}`,\n siblingData: data,\n })\n\n return fieldState.customComponents ?? {}\n}\n"],"mappings":"AAAA,SACEA,SAAS,EAITC,iBAAiB,QACZ;AAEP,SAASC,eAAe,QAAQ;AAChC,SAASC,kBAAkB,QAAQ;AACnC,SAASC,YAAY,QAAQ;AAC7B,SAASC,WAAW,QAAQ;AAgC5B;;;AAGA,OAAO,MAAMC,4BAAA,GAIT,MAAAA,CAAO;EAAEC,KAAA,EAAOC,QAAQ;EAAEC,YAAY;EAAEC,IAAI;EAAEC,GAAG;EAAEC;AAAU,CAAE;EACjE,IAAI,CAACD,GAAA,CAAIE,IAAI,EAAE;IACb,MAAM,IAAIZ,iBAAA;EACZ;EAEA,MAAM,CAACa,UAAA,EAAYC,UAAA,EAAY,GAAGC,SAAA,CAAU,GAAGJ,UAAA,CAAWK,KAAK,CAAC;EAEhE,MAAMC,SAAA,GAAYd,YAAA,CAAa;IAC7Be,cAAA,EAAgBL,UAAA,KAAe,eAAeC,UAAA,GAAaK,SAAA;IAC3DC,MAAA,EAAQV,GAAA,CAAIW,OAAO,CAACD,MAAM;IAC1BE,UAAA,EAAYT,UAAA,KAAe,WAAWC,UAAA,GAAaK,SAAA;IACnDI,IAAA,EAAMb,GAAA,CAAIa;EACZ;EAEA;EACA;EACA,MAAMC,eAAA,GAAkBtB,kBAAA,CAAmB;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