@payloadcms/ui 3.68.1 → 3.68.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"renderFieldServerFn.d.ts","sourceRoot":"","sources":["../../../../src/forms/fieldSchemasToFormState/serverFunctions/renderFieldServerFn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,KAAK,EAAE,KAAK,UAAU,EAAE,KAAK,cAAc,EAAE,MAAM,SAAS,CAAA;AAOrF,MAAM,MAAM,uBAAuB,CAAC,MAAM,GAAG,KAAK,IAAI;IACpD;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAA;IACvB;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;;;;;;;;OASG;IACH,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA;AACD,MAAM,MAAM,6BAA6B,GAAG,EAAE,GAAG,UAAU,CAAC,kBAAkB,CAAC,CAAA;AAE/E;;GAEG;AACH,eAAO,MAAM,4BAA4B,EAAE,cAAc,CACvD,uBAAuB,EACvB,OAAO,CAAC,6BAA6B,CAAC,CA8EvC,CAAA"}
1
+ {"version":3,"file":"renderFieldServerFn.d.ts","sourceRoot":"","sources":["../../../../src/forms/fieldSchemasToFormState/serverFunctions/renderFieldServerFn.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,KAAK,EACV,KAAK,UAAU,EACf,KAAK,cAAc,EAEpB,MAAM,SAAS,CAAA;AAOhB,MAAM,MAAM,uBAAuB,CAAC,MAAM,GAAG,KAAK,IAAI;IACpD;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAA;IACvB;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;;;;;;;;OASG;IACH,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA;AACD,MAAM,MAAM,6BAA6B,GAAG,EAAE,GAAG,UAAU,CAAC,kBAAkB,CAAC,CAAA;AAE/E;;GAEG;AACH,eAAO,MAAM,4BAA4B,EAAE,cAAc,CACvD,uBAAuB,EACvB,OAAO,CAAC,6BAA6B,CAAC,CA8EvC,CAAA"}
@@ -1,4 +1,4 @@
1
- import { deepMerge } from 'payload';
1
+ import { deepMerge, UnauthorizedError } from 'payload';
2
2
  import { getClientConfig } from '../../../utilities/getClientConfig.js';
3
3
  import { getClientSchemaMap } from '../../../utilities/getClientSchemaMap.js';
4
4
  import { getSchemaMap } from '../../../utilities/getSchemaMap.js';
@@ -14,7 +14,7 @@ export const _internal_renderFieldHandler = async ({
14
14
  schemaPath
15
15
  }) => {
16
16
  if (!req.user) {
17
- throw new Error('Unauthorized');
17
+ throw new UnauthorizedError();
18
18
  }
19
19
  const [entityType, entitySlug, ...fieldPath] = schemaPath.split('.');
20
20
  const schemaMap = getSchemaMap({
@@ -1 +1 @@
1
- {"version":3,"file":"renderFieldServerFn.js","names":["deepMerge","getClientConfig","getClientSchemaMap","getSchemaMap","renderField","_internal_renderFieldHandler","field","fieldArg","initialValue","path","req","schemaPath","user","Error","entityType","entitySlug","fieldPath","split","schemaMap","collectionSlug","undefined","config","payload","globalSlug","i18n","clientSchemaMap","importMap","targetField","get","join","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 { deepMerge, type Field, type FieldState, type ServerFunction } 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 Error('Unauthorized')\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,SAASA,SAAS,QAA0D;AAE5E,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,IAAIC,KAAA,CAAM;EAClB;EAEA,MAAM,CAACC,UAAA,EAAYC,UAAA,EAAY,GAAGC,SAAA,CAAU,GAAGL,UAAA,CAAWM,KAAK,CAAC;EAEhE,MAAMC,SAAA,GAAYf,YAAA,CAAa;IAC7BgB,cAAA,EAAgBL,UAAA,KAAe,eAAeC,UAAA,GAAaK,SAAA;IAC3DC,MAAA,EAAQX,GAAA,CAAIY,OAAO,CAACD,M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AgBC,UAAA,GAAaA,UAAA,GAAa;IACzEgB,IAAA;IACAI,WAAA,EAAa7B,KAAA;IACb8B,cAAA,EAAgBlB,SAAA;IAChBe,UAAA;IACAI,SAAA,EAAW,CAAC;IACZC,SAAA,EAAW;IACXC,gBAAA,EAAkB;IAClBC,SAAA,EAAW;IACXC,UAAA,EAAY;IACZC,gBAAA,EAAkB;IAClBjC,IAAA,EAAMA,IAAA,KAAS,UAAUH,KAAA,GAAQA,KAAA,CAAM0B,IAAI,GAAG,EAAC;IAC/CW,WAAA,EAAa;IACbC,WAAA,EAAa;MACXC,MAAA,EAAQ,CAAC;IACX;IACA;IACAC,sBAAA,EAAwBvC,QAAA,GAAW,OAAO;IAC1CwC,kBAAA,EAAoB3B,SAAA;IACpB4B,eAAA,EAAiB;IACjBtC,GAAA;IACAC,UAAA,EAAY,GAAGI,UAAA,IAAcC,SAAA,CAAUa,IAAI,CAAC,MAAM;IAClDoB,WAAA,EAAalB;EACf;EAEA,OAAOE,UAAA,CAAWiB,gBAAgB,IAAI,CAAC;AACzC","ignoreList":[]}
1
+ {"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,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AAA;IACtBN,cAAA,EAAgBL,UAAA,KAAe,gBAAgBC,UAAA,GAAaA,UAAA,GAAa;IACzEiB,IAAA;IACAI,WAAA,EAAa7B,KAAA;IACb8B,cAAA,EAAgBnB,SAAA;IAChBgB,UAAA;IACAI,SAAA,EAAW,CAAC;IACZC,SAAA,EAAW;IACXC,gBAAA,EAAkB;IAClBC,SAAA,EAAW;IACXC,UAAA,EAAY;IACZC,gBAAA,EAAkB;IAClBjC,IAAA,EAAMA,IAAA,KAAS,UAAUH,KAAA,GAAQA,KAAA,CAAM0B,IAAI,GAAG,EAAC;IAC/CW,WAAA,EAAa;IACbC,WAAA,EAAa;MACXC,MAAA,EAAQ,CAAC;IACX;IACA;IACAC,sBAAA,EAAwBvC,QAAA,GAAW,OAAO;IAC1CwC,kBAAA,EAAoB5B,SAAA;IACpB6B,eAAA,EAAiB;IACjBtC,GAAA;IACAC,UAAA,EAAY,GAAGG,UAAA,IAAcC,SAAA,CAAUa,IAAI,CAAC,MAAM;IAClDqB,WAAA,EAAalB;EACf;EAEA,OAAOE,UAAA,CAAWiB,gBAAgB,IAAI,CAAC;AACzC","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import { canAccessAdmin, formatErrors } from 'payload';
1
+ import { canAccessAdmin, formatErrors, UnauthorizedError } from 'payload';
2
2
  import { getSelectMode, reduceFieldsToValues } from 'payload/shared';
3
3
  import { fieldSchemasToFormState } from '../forms/fieldSchemasToFormState/index.js';
4
4
  import { renderField } from '../forms/fieldSchemasToFormState/renderField.js';
@@ -29,7 +29,7 @@ export const buildFormStateHandler = async args => {
29
29
  };
30
30
  }
31
31
  if (err.message === 'Unauthorized') {
32
- throw new Error('Unauthorized');
32
+ throw new UnauthorizedError();
33
33
  }
34
34
  return formatErrors(err);
35
35
  }
@@ -1 +1 @@
1
- {"version":3,"file":"buildFormState.js","names":["canAccessAdmin","formatErrors","getSelectMode","reduceFieldsToValues","fieldSchemasToFormState","renderField","getClientConfig","getClientSchemaMap","getSchemaMap","handleFormStateLocking","handleLivePreview","handlePreview","buildFormStateHandler","args","req","res","buildFormState","err","payload","logger","error","msg","message","Error","id","idFromArgs","collectionSlug","data","incomingData","docPermissions","docPreferences","documentFormState","formState","globalSlug","initialBlockData","initialBlockFormState","mockRSCs","operation","readOnly","renderAllFields","i18n","config","returnLivePreviewURL","returnLockStatus","returnPreviewURL","schemaPath","select","skipClientConfigAuth","skipValidation","updateLastEdited","selectMode","undefined","schemaMap","clientSchemaMap","importMap","user","fieldOrEntityConfig","get","fields","length","type","documentData","blockData","Array","isArray","formStateResult","clientFieldSchemaMap","fieldSchemaMap","permissions","preferences","previousFormState","renderFieldFn","collections","upload","file","lockedStateResult","lockedState","state","livePreviewURL","previewURL"],"sources":["../../src/utilities/buildFormState.ts"],"sourcesContent":["import type {\n BuildFormStateArgs,\n ClientConfig,\n ClientUser,\n ErrorResult,\n FormState,\n ServerFunction,\n} from 'payload'\n\nimport { canAccessAdmin, formatErrors } from 'payload'\nimport { getSelectMode, reduceFieldsToValues } from 'payload/shared'\n\nimport { fieldSchemasToFormState } from '../forms/fieldSchemasToFormState/index.js'\nimport { renderField } from '../forms/fieldSchemasToFormState/renderField.js'\nimport { getClientConfig } from './getClientConfig.js'\nimport { getClientSchemaMap } from './getClientSchemaMap.js'\nimport { getSchemaMap } from './getSchemaMap.js'\nimport { handleFormStateLocking } from './handleFormStateLocking.js'\nimport { handleLivePreview } from './handleLivePreview.js'\nimport { handlePreview } from './handlePreview.js'\n\nexport type LockedState = {\n isLocked: boolean\n lastEditedAt: string\n user: ClientUser | number | string\n}\n\ntype BuildFormStateSuccessResult = {\n clientConfig?: ClientConfig\n errors?: never\n indexPath?: string\n livePreviewURL?: string\n lockedState?: LockedState\n previewURL?: string\n state: FormState\n}\n\ntype BuildFormStateErrorResult = {\n livePreviewURL?: never\n lockedState?: never\n previewURL?: never\n state?: never\n} & (\n | {\n message: string\n }\n | ErrorResult\n)\n\nexport type BuildFormStateResult = BuildFormStateErrorResult | BuildFormStateSuccessResult\n\nexport const buildFormStateHandler: ServerFunction<\n BuildFormStateArgs,\n Promise<BuildFormStateResult>\n> = async (args) => {\n const { req } = args\n\n try {\n await canAccessAdmin({ req })\n const res = await buildFormState(args)\n\n return res\n } catch (err) {\n req.payload.logger.error({ err, msg: `There was an error building form state` })\n\n if (err.message === 'Could not find field schema for given path') {\n return {\n message: err.message,\n }\n }\n\n if (err.message === 'Unauthorized') {\n throw new Error('Unauthorized')\n }\n\n return formatErrors(err)\n }\n}\n\nexport const buildFormState = async (\n args: BuildFormStateArgs,\n): Promise<BuildFormStateSuccessResult> => {\n const {\n id: idFromArgs,\n collectionSlug,\n data: incomingData,\n docPermissions,\n docPreferences,\n documentFormState,\n formState,\n globalSlug,\n initialBlockData,\n initialBlockFormState,\n mockRSCs,\n operation,\n readOnly,\n renderAllFields,\n req,\n req: {\n i18n,\n payload,\n payload: { config },\n },\n returnLivePreviewURL,\n returnLockStatus,\n returnPreviewURL,\n schemaPath = collectionSlug || globalSlug,\n select,\n skipClientConfigAuth,\n skipValidation,\n updateLastEdited,\n } = args\n\n const selectMode = select ? getSelectMode(select) : undefined\n\n if (!collectionSlug && !globalSlug) {\n throw new Error('Either collectionSlug or globalSlug must be provided')\n }\n\n const schemaMap = getSchemaMap({\n collectionSlug,\n config,\n globalSlug,\n i18n,\n })\n\n const clientSchemaMap = getClientSchemaMap({\n collectionSlug,\n config: getClientConfig({\n config,\n i18n,\n importMap: req.payload.importMap,\n user: skipClientConfigAuth ? true : req.user,\n }),\n globalSlug,\n i18n,\n payload,\n schemaMap,\n })\n\n const id = collectionSlug ? idFromArgs : undefined\n const fieldOrEntityConfig = schemaMap.get(schemaPath)\n\n if (!fieldOrEntityConfig) {\n throw new Error(`Could not find \"${schemaPath}\" in the fieldSchemaMap`)\n }\n\n if (\n (!('fields' in fieldOrEntityConfig) ||\n !fieldOrEntityConfig.fields ||\n !fieldOrEntityConfig.fields.length) &&\n 'type' in fieldOrEntityConfig &&\n fieldOrEntityConfig.type !== 'blocks'\n ) {\n throw new Error(\n `The field found in fieldSchemaMap for \"${schemaPath}\" does not contain any subfields.`,\n )\n }\n\n // If there is form state but no data, deduce data from that form state, e.g. on initial load\n // Otherwise, use the incoming data as the source of truth, e.g. on subsequent saves\n const data = incomingData || reduceFieldsToValues(formState, true)\n\n let documentData = undefined\n\n if (documentFormState) {\n documentData = reduceFieldsToValues(documentFormState, true)\n }\n\n let blockData = initialBlockData\n\n if (initialBlockFormState) {\n blockData = reduceFieldsToValues(initialBlockFormState, true)\n }\n\n /**\n * When building state for sub schemas we need to adjust:\n * - `fields`\n * - `parentSchemaPath`\n * - `parentPath`\n *\n * Type assertion is fine because we wrap sub schemas in an array\n * so we can safely map over them within `fieldSchemasToFormState`\n */\n const fields = Array.isArray(fieldOrEntityConfig)\n ? fieldOrEntityConfig\n : 'fields' in fieldOrEntityConfig\n ? fieldOrEntityConfig.fields\n : [fieldOrEntityConfig]\n\n // Ensure data.id is present during form state requests, where the data\n // is passed from the client as an argument, without the ID\n if (!data.id && id) {\n data.id = id\n }\n\n const formStateResult = await fieldSchemasToFormState({\n id,\n clientFieldSchemaMap: clientSchemaMap,\n collectionSlug,\n data,\n documentData,\n fields,\n fieldSchemaMap: schemaMap,\n initialBlockData: blockData,\n mockRSCs,\n operation,\n permissions: docPermissions?.fields || {},\n preferences: docPreferences || { fields: {} },\n previousFormState: formState,\n readOnly,\n renderAllFields,\n renderFieldFn: renderField,\n req,\n schemaPath,\n select,\n selectMode,\n skipValidation,\n })\n\n // Maintain form state of auth / upload fields\n if (collectionSlug && formState) {\n if (payload.collections[collectionSlug]?.config?.upload && formState.file) {\n formStateResult.file = formState.file\n }\n }\n\n let lockedStateResult\n\n if (returnLockStatus) {\n lockedStateResult = await handleFormStateLocking({\n id,\n collectionSlug,\n globalSlug,\n req,\n updateLastEdited,\n })\n }\n\n const res: BuildFormStateSuccessResult = {\n lockedState: lockedStateResult,\n state: formStateResult,\n }\n\n if (returnLivePreviewURL) {\n const { livePreviewURL } = await handleLivePreview({\n collectionSlug,\n config,\n data,\n globalSlug,\n req,\n })\n\n // Important: only set this when not undefined,\n // Otherwise it will travel through the network as `$undefined`\n if (livePreviewURL) {\n res.livePreviewURL = livePreviewURL\n }\n }\n\n if (returnPreviewURL) {\n const { previewURL } = await handlePreview({\n collectionSlug,\n config,\n data,\n globalSlug,\n req,\n })\n\n // Important: only set this when not undefined,\n // Otherwise it will travel through the network as `$undefined`\n if (previewURL) {\n res.previewURL = previewURL\n }\n }\n\n return res\n}\n"],"mappings":"AASA,SAASA,cAAc,EAAEC,YAAY,QAAQ;AAC7C,SAASC,aAAa,EAAEC,oBAAoB,QAAQ;AAEpD,SAASC,uBAAuB,QAAQ;AACxC,SAASC,WAAW,QAAQ;AAC5B,SAASC,eAAe,QAAQ;AAChC,SAASC,kBAAkB,QAAQ;AACnC,SAASC,YAAY,QAAQ;AAC7B,SAASC,sBAAsB,QAAQ;AACvC,SAASC,iBAAiB,QAAQ;AAClC,SAASC,aAAa,QAAQ;AAgC9B,OAAO,MAAMC,qBAAA,GAGT,MAAOC,IAAA;EACT,MAAM;IAAEC;EAAG,CAAE,GAAGD,IAAA;EAEhB,IAAI;IACF,MAAMb,cAAA,CAAe;MAAEc;IAAI;IAC3B,MAAMC,GAAA,GAAM,MAAMC,cAAA,CAAeH,IAAA;IAEjC,OAAOE,GAAA;EACT,EAAE,OAAOE,GAAA,EAAK;IACZH,GAAA,CAAII,OAAO,CAACC,MAAM,CAACC,KAAK,CAAC;MAAEH,GAAA;MAAKI,GAAA,EAAK;IAAyC;IAE9E,IAAIJ,GAAA,CAAIK,OAAO,KAAK,8CAA8C;MAChE,OAAO;QACLA,OAAA,EAASL,GAAA,CAAIK;MACf;IACF;IAEA,IAAIL,GAAA,CAAIK,OAAO,KAAK,gBAAgB;MAClC,MAAM,IAAIC,KAAA,CAAM;IAClB;IAEA,OAAOtB,YAAA,CAAagB,GAAA;EACtB;AACF;AAEA,OAAO,MAAMD,cAAA,GAAiB,MAC5B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E;IAC5CY,iBAAA,EAAmBtC,SAAA;IACnBM,QAAA;IACAC,eAAA;IACAgC,aAAA,EAAelE,WAAA;IACfS,GAAA;IACA+B,UAAA;IACAC,MAAA;IACAI,UAAA;IACAF;EACF;EAEA;EACA,IAAItB,cAAA,IAAkBM,SAAA,EAAW;IAC/B,IAAId,OAAA,CAAQsD,WAAW,CAAC9C,cAAA,CAAe,EAAEe,MAAA,EAAQgC,MAAA,IAAUzC,SAAA,CAAU0C,IAAI,EAAE;MACzET,eAAA,CAAgBS,IAAI,GAAG1C,SAAA,CAAU0C,IAAI;IACvC;EACF;EAEA,IAAIC,iBAAA;EAEJ,IAAIhC,gBAAA,EAAkB;IACpBgC,iBAAA,GAAoB,MAAMlE,sBAAA,CAAuB;MAC/Ce,EAAA;MACAE,cAAA;MACAO,UAAA;MACAnB,GAAA;MACAmC;IACF;EACF;EAEA,MAAMlC,GAAA,GAAmC;IACvC6D,WAAA,EAAaD,iBAAA;IACbE,KAAA,EAAOZ;EACT;EAEA,IAAIvB,oBAAA,EAAsB;IACxB,MAAM;MAAEoC;IAAc,CAAE,GAAG,MAAMpE,iBAAA,CAAkB;MACjDgB,cAAA;MACAe,MAAA;MACAd,IAAA;MACAM,UAAA;MACAnB;IACF;IAEA;IACA;IACA,IAAIgE,cAAA,EAAgB;MAClB/D,GAAA,CAAI+D,cAAc,GAAGA,cAAA;IACvB;EACF;EAEA,IAAIlC,gBAAA,EAAkB;IACpB,MAAM;MAAEmC;IAAU,CAAE,GAAG,MAAMpE,aAAA,CAAc;MACzCe,cAAA;MACAe,MAAA;MACAd,IAAA;MACAM,UAAA;MACAnB;IACF;IAEA;IACA;IACA,IAAIiE,UAAA,EAAY;MACdhE,GAAA,CAAIgE,UAAU,GAAGA,UAAA;IACnB;EACF;EAEA,OAAOhE,GAAA;AACT","ignoreList":[]}
1
+ {"version":3,"file":"buildFormState.js","names":["canAccessAdmin","formatErrors","UnauthorizedError","getSelectMode","reduceFieldsToValues","fieldSchemasToFormState","renderField","getClientConfig","getClientSchemaMap","getSchemaMap","handleFormStateLocking","handleLivePreview","handlePreview","buildFormStateHandler","args","req","res","buildFormState","err","payload","logger","error","msg","message","id","idFromArgs","collectionSlug","data","incomingData","docPermissions","docPreferences","documentFormState","formState","globalSlug","initialBlockData","initialBlockFormState","mockRSCs","operation","readOnly","renderAllFields","i18n","config","returnLivePreviewURL","returnLockStatus","returnPreviewURL","schemaPath","select","skipClientConfigAuth","skipValidation","updateLastEdited","selectMode","undefined","Error","schemaMap","clientSchemaMap","importMap","user","fieldOrEntityConfig","get","fields","length","type","documentData","blockData","Array","isArray","formStateResult","clientFieldSchemaMap","fieldSchemaMap","permissions","preferences","previousFormState","renderFieldFn","collections","upload","file","lockedStateResult","lockedState","state","livePreviewURL","previewURL"],"sources":["../../src/utilities/buildFormState.ts"],"sourcesContent":["import type {\n BuildFormStateArgs,\n ClientConfig,\n ClientUser,\n ErrorResult,\n FormState,\n ServerFunction,\n} from 'payload'\n\nimport { canAccessAdmin, formatErrors, UnauthorizedError } from 'payload'\nimport { getSelectMode, reduceFieldsToValues } from 'payload/shared'\n\nimport { fieldSchemasToFormState } from '../forms/fieldSchemasToFormState/index.js'\nimport { renderField } from '../forms/fieldSchemasToFormState/renderField.js'\nimport { getClientConfig } from './getClientConfig.js'\nimport { getClientSchemaMap } from './getClientSchemaMap.js'\nimport { getSchemaMap } from './getSchemaMap.js'\nimport { handleFormStateLocking } from './handleFormStateLocking.js'\nimport { handleLivePreview } from './handleLivePreview.js'\nimport { handlePreview } from './handlePreview.js'\n\nexport type LockedState = {\n isLocked: boolean\n lastEditedAt: string\n user: ClientUser | number | string\n}\n\ntype BuildFormStateSuccessResult = {\n clientConfig?: ClientConfig\n errors?: never\n indexPath?: string\n livePreviewURL?: string\n lockedState?: LockedState\n previewURL?: string\n state: FormState\n}\n\ntype BuildFormStateErrorResult = {\n livePreviewURL?: never\n lockedState?: never\n previewURL?: never\n state?: never\n} & (\n | {\n message: string\n }\n | ErrorResult\n)\n\nexport type BuildFormStateResult = BuildFormStateErrorResult | BuildFormStateSuccessResult\n\nexport const buildFormStateHandler: ServerFunction<\n BuildFormStateArgs,\n Promise<BuildFormStateResult>\n> = async (args) => {\n const { req } = args\n\n try {\n await canAccessAdmin({ req })\n const res = await buildFormState(args)\n\n return res\n } catch (err) {\n req.payload.logger.error({ err, msg: `There was an error building form state` })\n\n if (err.message === 'Could not find field schema for given path') {\n return {\n message: err.message,\n }\n }\n\n if (err.message === 'Unauthorized') {\n throw new UnauthorizedError()\n }\n\n return formatErrors(err)\n }\n}\n\nexport const buildFormState = async (\n args: BuildFormStateArgs,\n): Promise<BuildFormStateSuccessResult> => {\n const {\n id: idFromArgs,\n collectionSlug,\n data: incomingData,\n docPermissions,\n docPreferences,\n documentFormState,\n formState,\n globalSlug,\n initialBlockData,\n initialBlockFormState,\n mockRSCs,\n operation,\n readOnly,\n renderAllFields,\n req,\n req: {\n i18n,\n payload,\n payload: { config },\n },\n returnLivePreviewURL,\n returnLockStatus,\n returnPreviewURL,\n schemaPath = collectionSlug || globalSlug,\n select,\n skipClientConfigAuth,\n skipValidation,\n updateLastEdited,\n } = args\n\n const selectMode = select ? getSelectMode(select) : undefined\n\n if (!collectionSlug && !globalSlug) {\n throw new Error('Either collectionSlug or globalSlug must be provided')\n }\n\n const schemaMap = getSchemaMap({\n collectionSlug,\n config,\n globalSlug,\n i18n,\n })\n\n const clientSchemaMap = getClientSchemaMap({\n collectionSlug,\n config: getClientConfig({\n config,\n i18n,\n importMap: req.payload.importMap,\n user: skipClientConfigAuth ? true : req.user,\n }),\n globalSlug,\n i18n,\n payload,\n schemaMap,\n })\n\n const id = collectionSlug ? idFromArgs : undefined\n const fieldOrEntityConfig = schemaMap.get(schemaPath)\n\n if (!fieldOrEntityConfig) {\n throw new Error(`Could not find \"${schemaPath}\" in the fieldSchemaMap`)\n }\n\n if (\n (!('fields' in fieldOrEntityConfig) ||\n !fieldOrEntityConfig.fields ||\n !fieldOrEntityConfig.fields.length) &&\n 'type' in fieldOrEntityConfig &&\n fieldOrEntityConfig.type !== 'blocks'\n ) {\n throw new Error(\n `The field found in fieldSchemaMap for \"${schemaPath}\" does not contain any subfields.`,\n )\n }\n\n // If there is form state but no data, deduce data from that form state, e.g. on initial load\n // Otherwise, use the incoming data as the source of truth, e.g. on subsequent saves\n const data = incomingData || reduceFieldsToValues(formState, true)\n\n let documentData = undefined\n\n if (documentFormState) {\n documentData = reduceFieldsToValues(documentFormState, true)\n }\n\n let blockData = initialBlockData\n\n if (initialBlockFormState) {\n blockData = reduceFieldsToValues(initialBlockFormState, true)\n }\n\n /**\n * When building state for sub schemas we need to adjust:\n * - `fields`\n * - `parentSchemaPath`\n * - `parentPath`\n *\n * Type assertion is fine because we wrap sub schemas in an array\n * so we can safely map over them within `fieldSchemasToFormState`\n */\n const fields = Array.isArray(fieldOrEntityConfig)\n ? fieldOrEntityConfig\n : 'fields' in fieldOrEntityConfig\n ? fieldOrEntityConfig.fields\n : [fieldOrEntityConfig]\n\n // Ensure data.id is present during form state requests, where the data\n // is passed from the client as an argument, without the ID\n if (!data.id && id) {\n data.id = id\n }\n\n const formStateResult = await fieldSchemasToFormState({\n id,\n clientFieldSchemaMap: clientSchemaMap,\n collectionSlug,\n data,\n documentData,\n fields,\n fieldSchemaMap: schemaMap,\n initialBlockData: blockData,\n mockRSCs,\n operation,\n permissions: docPermissions?.fields || {},\n preferences: docPreferences || { fields: {} },\n previousFormState: formState,\n readOnly,\n renderAllFields,\n renderFieldFn: renderField,\n req,\n schemaPath,\n select,\n selectMode,\n skipValidation,\n })\n\n // Maintain form state of auth / upload fields\n if (collectionSlug && formState) {\n if (payload.collections[collectionSlug]?.config?.upload && formState.file) {\n formStateResult.file = formState.file\n }\n }\n\n let lockedStateResult\n\n if (returnLockStatus) {\n lockedStateResult = await handleFormStateLocking({\n id,\n collectionSlug,\n globalSlug,\n req,\n updateLastEdited,\n })\n }\n\n const res: BuildFormStateSuccessResult = {\n lockedState: lockedStateResult,\n state: formStateResult,\n }\n\n if (returnLivePreviewURL) {\n const { livePreviewURL } = await handleLivePreview({\n collectionSlug,\n config,\n data,\n globalSlug,\n req,\n })\n\n // Important: only set this when not undefined,\n // Otherwise it will travel through the network as `$undefined`\n if (livePreviewURL) {\n res.livePreviewURL = livePreviewURL\n }\n }\n\n if (returnPreviewURL) {\n const { previewURL } = await handlePreview({\n collectionSlug,\n config,\n data,\n globalSlug,\n req,\n })\n\n // Important: only set this when not undefined,\n // Otherwise it will travel through the network as `$undefined`\n if (previewURL) {\n res.previewURL = previewURL\n }\n }\n\n return res\n}\n"],"mappings":"AASA,SAASA,cAAc,EAAEC,YAAY,EAAEC,iBAAiB,QAAQ;AAChE,SAASC,aAAa,EAAEC,oBAAoB,QAAQ;AAEpD,SAASC,uBAAuB,QAAQ;AACxC,SAASC,WAAW,QAAQ;AAC5B,SAASC,eAAe,QAAQ;AAChC,SAASC,kBAAkB,QAAQ;AACnC,SAASC,YAAY,QAAQ;AAC7B,SAASC,sBAAsB,QAAQ;AACvC,SAASC,iBAAiB,QAAQ;AAClC,SAASC,aAAa,QAAQ;AAgC9B,OAAO,MAAMC,qBAAA,GAGT,MAAOC,IAAA;EACT,MAAM;IAAEC;EAAG,CAAE,GAAGD,IAAA;EAEhB,IAAI;IACF,MAAMd,cAAA,CAAe;MAAEe;IAAI;IAC3B,MAAMC,GAAA,GAAM,MAAMC,cAAA,CAAeH,IAAA;IAEjC,OAAOE,GAAA;EACT,EAAE,OAAOE,GAAA,EAAK;IACZH,GAAA,CAAII,OAAO,CAACC,MAAM,CAACC,KAAK,CAAC;MAAEH,GAAA;MAAKI,GAAA,EAAK;IAAyC;IAE9E,IAAIJ,GAAA,CAAIK,OAAO,KAAK,8CAA8C;MAChE,OAAO;QACLA,OAAA,EAASL,GAAA,CAAIK;MACf;IACF;IAEA,IAAIL,GAAA,CAAIK,OAAO,KAAK,gBAAgB;MAClC,MAAM,IAAIrB,iBAAA;IACZ;IAEA,OAAOD,YAAA,CAAaiB,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  "name": "@payloadcms/ui",
3
- "version": "3.68.1",
3
+ "version": "3.68.2",
4
4
  "homepage": "https://payloadcms.com",
5
5
  "repository": {
6
6
  "type": "git",
@@ -136,7 +136,7 @@
136
136
  "ts-essentials": "10.0.3",
137
137
  "use-context-selector": "2.0.0",
138
138
  "uuid": "10.0.0",
139
- "@payloadcms/translations": "3.68.1"
139
+ "@payloadcms/translations": "3.68.2"
140
140
  },
141
141
  "devDependencies": {
142
142
  "@babel/cli": "7.27.2",
@@ -151,14 +151,14 @@
151
151
  "babel-plugin-react-compiler": "19.1.0-rc.3",
152
152
  "esbuild": "0.25.5",
153
153
  "esbuild-sass-plugin": "3.3.1",
154
- "payload": "3.68.1",
155
- "@payloadcms/eslint-config": "3.28.0"
154
+ "@payloadcms/eslint-config": "3.28.0",
155
+ "payload": "3.68.2"
156
156
  },
157
157
  "peerDependencies": {
158
158
  "next": "^15.2.6 || ^15.3.6 || ^15.4.8 || ^15.5.7",
159
159
  "react": "^19.0.1 || ^19.1.2 || ^19.2.1",
160
160
  "react-dom": "^19.0.1 || ^19.1.2 || ^19.2.1",
161
- "payload": "3.68.1"
161
+ "payload": "3.68.2"
162
162
  },
163
163
  "engines": {
164
164
  "node": "^18.20.2 || >=20.9.0"