payload 3.0.0-beta.96 → 3.0.0-beta.97

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.
Files changed (132) hide show
  1. package/dist/admin/RichText.d.ts +2 -2
  2. package/dist/admin/RichText.d.ts.map +1 -1
  3. package/dist/admin/RichText.js.map +1 -1
  4. package/dist/admin/elements/Tab.d.ts +1 -1
  5. package/dist/admin/elements/Tab.d.ts.map +1 -1
  6. package/dist/admin/elements/Tab.js.map +1 -1
  7. package/dist/admin/forms/Description.d.ts +1 -1
  8. package/dist/admin/forms/Description.d.ts.map +1 -1
  9. package/dist/admin/forms/Description.js.map +1 -1
  10. package/dist/admin/forms/Error.d.ts +1 -1
  11. package/dist/admin/forms/Error.d.ts.map +1 -1
  12. package/dist/admin/forms/Error.js.map +1 -1
  13. package/dist/admin/forms/Form.d.ts +1 -1
  14. package/dist/admin/forms/Form.d.ts.map +1 -1
  15. package/dist/admin/forms/Form.js.map +1 -1
  16. package/dist/admin/forms/Label.d.ts +1 -1
  17. package/dist/admin/forms/Label.d.ts.map +1 -1
  18. package/dist/admin/forms/Label.js.map +1 -1
  19. package/dist/admin/types.d.ts +5 -5
  20. package/dist/admin/types.d.ts.map +1 -1
  21. package/dist/admin/types.js.map +1 -1
  22. package/dist/admin/views/types.d.ts +1 -1
  23. package/dist/admin/views/types.d.ts.map +1 -1
  24. package/dist/admin/views/types.js.map +1 -1
  25. package/dist/auth/operations/auth.d.ts +1 -1
  26. package/dist/auth/operations/auth.d.ts.map +1 -1
  27. package/dist/auth/operations/auth.js.map +1 -1
  28. package/dist/auth/strategies/jwt.js.map +1 -1
  29. package/dist/auth/types.d.ts +5 -5
  30. package/dist/auth/types.d.ts.map +1 -1
  31. package/dist/auth/types.js.map +1 -1
  32. package/dist/bin/generateImportMap/iterateFields.js.map +1 -1
  33. package/dist/bin/generateTypes.js +1 -1
  34. package/dist/bin/generateTypes.js.map +1 -1
  35. package/dist/collections/config/client.d.ts +2 -2
  36. package/dist/collections/config/client.d.ts.map +1 -1
  37. package/dist/collections/config/client.js.map +1 -1
  38. package/dist/collections/config/types.d.ts +9 -9
  39. package/dist/collections/config/types.d.ts.map +1 -1
  40. package/dist/collections/config/types.js.map +1 -1
  41. package/dist/collections/dataloader.d.ts +1 -1
  42. package/dist/collections/dataloader.d.ts.map +1 -1
  43. package/dist/collections/dataloader.js.map +1 -1
  44. package/dist/collections/operations/utils.d.ts +1 -1
  45. package/dist/collections/operations/utils.d.ts.map +1 -1
  46. package/dist/collections/operations/utils.js.map +1 -1
  47. package/dist/config/client.d.ts +2 -2
  48. package/dist/config/client.d.ts.map +1 -1
  49. package/dist/config/client.js.map +1 -1
  50. package/dist/config/types.d.ts +49 -33
  51. package/dist/config/types.d.ts.map +1 -1
  52. package/dist/config/types.js.map +1 -1
  53. package/dist/database/combineQueries.d.ts +1 -1
  54. package/dist/database/combineQueries.d.ts.map +1 -1
  55. package/dist/database/combineQueries.js.map +1 -1
  56. package/dist/database/types.d.ts +3 -3
  57. package/dist/database/types.d.ts.map +1 -1
  58. package/dist/database/types.js.map +1 -1
  59. package/dist/fields/config/sanitize.js +1 -1
  60. package/dist/fields/config/sanitize.js.map +1 -1
  61. package/dist/fields/config/types.d.ts +56 -56
  62. package/dist/fields/config/types.d.ts.map +1 -1
  63. package/dist/fields/config/types.js.map +1 -1
  64. package/dist/fields/hooks/afterChange/index.d.ts +2 -2
  65. package/dist/fields/hooks/afterChange/index.d.ts.map +1 -1
  66. package/dist/fields/hooks/afterChange/index.js.map +1 -1
  67. package/dist/fields/hooks/afterChange/promise.d.ts +2 -2
  68. package/dist/fields/hooks/afterChange/promise.d.ts.map +1 -1
  69. package/dist/fields/hooks/afterChange/promise.js.map +1 -1
  70. package/dist/fields/hooks/afterChange/traverseFields.d.ts +2 -2
  71. package/dist/fields/hooks/afterChange/traverseFields.d.ts.map +1 -1
  72. package/dist/fields/hooks/afterChange/traverseFields.js.map +1 -1
  73. package/dist/fields/hooks/afterRead/index.d.ts +2 -2
  74. package/dist/fields/hooks/afterRead/index.d.ts.map +1 -1
  75. package/dist/fields/hooks/afterRead/index.js.map +1 -1
  76. package/dist/fields/hooks/afterRead/promise.d.ts +2 -2
  77. package/dist/fields/hooks/afterRead/promise.d.ts.map +1 -1
  78. package/dist/fields/hooks/afterRead/promise.js.map +1 -1
  79. package/dist/fields/hooks/afterRead/traverseFields.d.ts +2 -2
  80. package/dist/fields/hooks/afterRead/traverseFields.d.ts.map +1 -1
  81. package/dist/fields/hooks/afterRead/traverseFields.js.map +1 -1
  82. package/dist/fields/hooks/beforeChange/index.d.ts +2 -2
  83. package/dist/fields/hooks/beforeChange/index.d.ts.map +1 -1
  84. package/dist/fields/hooks/beforeChange/index.js.map +1 -1
  85. package/dist/fields/hooks/beforeChange/promise.d.ts +2 -2
  86. package/dist/fields/hooks/beforeChange/promise.d.ts.map +1 -1
  87. package/dist/fields/hooks/beforeChange/promise.js.map +1 -1
  88. package/dist/fields/hooks/beforeChange/traverseFields.d.ts +2 -2
  89. package/dist/fields/hooks/beforeChange/traverseFields.d.ts.map +1 -1
  90. package/dist/fields/hooks/beforeChange/traverseFields.js.map +1 -1
  91. package/dist/fields/hooks/beforeValidate/index.d.ts +2 -2
  92. package/dist/fields/hooks/beforeValidate/index.d.ts.map +1 -1
  93. package/dist/fields/hooks/beforeValidate/index.js.map +1 -1
  94. package/dist/fields/hooks/beforeValidate/promise.d.ts +2 -2
  95. package/dist/fields/hooks/beforeValidate/promise.d.ts.map +1 -1
  96. package/dist/fields/hooks/beforeValidate/promise.js.map +1 -1
  97. package/dist/fields/hooks/beforeValidate/traverseFields.d.ts +2 -2
  98. package/dist/fields/hooks/beforeValidate/traverseFields.d.ts.map +1 -1
  99. package/dist/fields/hooks/beforeValidate/traverseFields.js.map +1 -1
  100. package/dist/fields/validations.d.ts +1 -1
  101. package/dist/fields/validations.d.ts.map +1 -1
  102. package/dist/fields/validations.js.map +1 -1
  103. package/dist/globals/config/types.d.ts +2 -2
  104. package/dist/globals/config/types.d.ts.map +1 -1
  105. package/dist/globals/config/types.js.map +1 -1
  106. package/dist/index.d.ts +7 -7
  107. package/dist/index.d.ts.map +1 -1
  108. package/dist/index.js +4 -4
  109. package/dist/index.js.map +1 -1
  110. package/dist/types/index.d.ts +3 -3
  111. package/dist/types/index.d.ts.map +1 -1
  112. package/dist/types/index.js.map +1 -1
  113. package/dist/utilities/isReactComponent.d.ts +3 -3
  114. package/dist/utilities/isReactComponent.d.ts.map +1 -1
  115. package/dist/utilities/isReactComponent.js.map +1 -1
  116. package/dist/utilities/isValidID.d.ts +1 -1
  117. package/dist/utilities/isValidID.d.ts.map +1 -1
  118. package/dist/utilities/isValidID.js.map +1 -1
  119. package/dist/utilities/logger.d.ts +8 -3
  120. package/dist/utilities/logger.d.ts.map +1 -1
  121. package/dist/utilities/logger.js +22 -14
  122. package/dist/utilities/logger.js.map +1 -1
  123. package/dist/utilities/telemetry/conf/index.d.ts +1 -1
  124. package/dist/utilities/telemetry/conf/index.d.ts.map +1 -1
  125. package/dist/utilities/telemetry/conf/index.js +8 -8
  126. package/dist/utilities/telemetry/conf/index.js.map +1 -1
  127. package/dist/versions/drafts/appendVersionToQueryKey.js +1 -1
  128. package/dist/versions/drafts/appendVersionToQueryKey.js.map +1 -1
  129. package/dist/versions/types.d.ts +4 -4
  130. package/dist/versions/types.d.ts.map +1 -1
  131. package/dist/versions/types.js.map +1 -1
  132. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/fields/config/sanitize.ts"],"sourcesContent":["import { deepMergeSimple } from '@payloadcms/translations/utilities'\n\nimport type { CollectionConfig } from '../../collections/config/types.js'\nimport type { Config, SanitizedConfig } from '../../config/types.js'\nimport type { Field } from './types.js'\n\nimport { MissingEditorProp } from '../../errors/MissingEditorProp.js'\nimport {\n DuplicateFieldName,\n InvalidFieldName,\n InvalidFieldRelationship,\n MissingFieldType,\n} from '../../errors/index.js'\nimport { formatLabels, toWords } from '../../utilities/formatLabels.js'\nimport { baseBlockFields } from '../baseFields/baseBlockFields.js'\nimport { baseIDField } from '../baseFields/baseIDField.js'\nimport { setDefaultBeforeDuplicate } from '../setDefaultBeforeDuplicate.js'\nimport validations from '../validations.js'\nimport { fieldAffectsData, tabHasName } from './types.js'\n\ntype Args = {\n collectionConfig?: CollectionConfig\n config: Config\n existingFieldNames?: Set<string>\n fields: Field[]\n parentIsLocalized: boolean\n /**\n * If true, a richText field will require an editor property to be set, as the sanitizeFields function will not add it from the payload config if not present.\n *\n * @default false\n */\n requireFieldLevelRichTextEditor?: boolean\n\n /**\n * If this property is set, RichText fields won't be sanitized immediately. Instead, they will be added to this array as promises\n * so that you can sanitize them together, after the config has been sanitized.\n */\n richTextSanitizationPromises?: Array<(config: SanitizedConfig) => Promise<void>>\n /**\n * If not null, will validate that upload and relationship fields do not relate to a collection that is not in this array.\n * This validation will be skipped if validRelationships is null.\n */\n validRelationships: null | string[]\n}\n\nexport const sanitizeFields = async ({\n collectionConfig,\n config,\n existingFieldNames = new Set(),\n fields,\n parentIsLocalized,\n requireFieldLevelRichTextEditor = false,\n richTextSanitizationPromises,\n validRelationships,\n}: Args): Promise<Field[]> => {\n if (!fields) {\n return []\n }\n\n for (let i = 0; i < fields.length; i++) {\n const field = fields[i]\n\n if ('_sanitized' in field && field._sanitized === true) {\n continue\n }\n\n if (!field.type) {\n throw new MissingFieldType(field)\n }\n\n // assert that field names do not contain forbidden characters\n if (fieldAffectsData(field) && field.name.includes('.')) {\n throw new InvalidFieldName(field, field.name)\n }\n\n // Auto-label\n if (\n 'name' in field &&\n field.name &&\n typeof field.label !== 'object' &&\n typeof field.label !== 'string' &&\n typeof field.label !== 'function' &&\n field.label !== false\n ) {\n field.label = toWords(field.name)\n }\n\n if (\n field.type === 'checkbox' &&\n typeof field.defaultValue === 'undefined' &&\n field.required === true\n ) {\n field.defaultValue = false\n }\n\n if (field.type === 'relationship' || field.type === 'upload') {\n if (validRelationships) {\n const relationships = Array.isArray(field.relationTo)\n ? field.relationTo\n : [field.relationTo]\n relationships.forEach((relationship: string) => {\n if (!validRelationships.includes(relationship)) {\n throw new InvalidFieldRelationship(field, relationship)\n }\n })\n }\n\n if (field.min && !field.minRows) {\n console.warn(\n `(payload): The \"min\" property is deprecated for the Relationship field \"${field.name}\" and will be removed in a future version. Please use \"minRows\" instead.`,\n )\n }\n if (field.max && !field.maxRows) {\n console.warn(\n `(payload): The \"max\" property is deprecated for the Relationship field \"${field.name}\" and will be removed in a future version. Please use \"maxRows\" instead.`,\n )\n }\n field.minRows = field.minRows || field.min\n field.maxRows = field.maxRows || field.max\n }\n\n if (field.type === 'upload') {\n if (!field.admin || !('isSortable' in field.admin)) {\n field.admin = {\n isSortable: true,\n ...field.admin,\n }\n }\n }\n\n if (field.type === 'array' && field.fields) {\n field.fields.push(baseIDField)\n }\n\n if ((field.type === 'blocks' || field.type === 'array') && field.label) {\n field.labels = field.labels || formatLabels(field.name)\n }\n\n if (fieldAffectsData(field)) {\n if (existingFieldNames.has(field.name)) {\n throw new DuplicateFieldName(field.name)\n } else if (!['blockName', 'id'].includes(field.name)) {\n existingFieldNames.add(field.name)\n }\n\n if (typeof field.localized !== 'undefined') {\n let shouldDisableLocalized = !config.localization\n\n if (!config.compatibility?.allowLocalizedWithinLocalized && parentIsLocalized) {\n shouldDisableLocalized = true\n }\n\n if (shouldDisableLocalized) {\n delete field.localized\n }\n }\n\n if (typeof field.validate === 'undefined') {\n const defaultValidate = validations[field.type]\n if (defaultValidate) {\n field.validate = (val, options) => defaultValidate(val, { ...field, ...options })\n } else {\n field.validate = () => true\n }\n }\n\n if (!field.hooks) {\n field.hooks = {}\n }\n if (!field.access) {\n field.access = {}\n }\n\n setDefaultBeforeDuplicate(field)\n }\n\n if (!field.admin) {\n field.admin = {}\n }\n\n // Make sure that the richText field has an editor\n if (field.type === 'richText') {\n const sanitizeRichText = async (_config: SanitizedConfig) => {\n if (!field.editor) {\n if (_config.editor && !requireFieldLevelRichTextEditor) {\n // config.editor should be sanitized at this point\n field.editor = _config.editor\n } else {\n throw new MissingEditorProp(field) // while we allow disabling editor functionality, you should not have any richText fields defined if you do not have an editor\n }\n }\n\n if (typeof field.editor === 'function') {\n field.editor = await field.editor({\n config: _config,\n isRoot: requireFieldLevelRichTextEditor,\n parentIsLocalized: parentIsLocalized || field.localized,\n })\n }\n\n if (field.editor.i18n && Object.keys(field.editor.i18n).length >= 0) {\n config.i18n.translations = deepMergeSimple(config.i18n.translations, field.editor.i18n)\n }\n }\n if (richTextSanitizationPromises) {\n richTextSanitizationPromises.push(sanitizeRichText)\n } else {\n await sanitizeRichText(config as unknown as SanitizedConfig)\n }\n }\n\n if (field.type === 'blocks' && field.blocks) {\n for (const block of field.blocks) {\n if (block._sanitized === true) {\n continue\n }\n block._sanitized = true\n block.fields = block.fields.concat(baseBlockFields)\n block.labels = !block.labels ? formatLabels(block.slug) : block.labels\n\n block.fields = await sanitizeFields({\n config,\n existingFieldNames: new Set(),\n fields: block.fields,\n parentIsLocalized: parentIsLocalized || field.localized,\n requireFieldLevelRichTextEditor,\n richTextSanitizationPromises,\n validRelationships,\n })\n }\n }\n\n if ('fields' in field && field.fields) {\n field.fields = await sanitizeFields({\n config,\n existingFieldNames: fieldAffectsData(field) ? new Set() : existingFieldNames,\n fields: field.fields,\n parentIsLocalized: parentIsLocalized || field.localized,\n requireFieldLevelRichTextEditor,\n richTextSanitizationPromises,\n validRelationships,\n })\n }\n\n if (field.type === 'tabs') {\n for (let j = 0; j < field.tabs.length; j++) {\n const tab = field.tabs[j]\n if (tabHasName(tab) && typeof tab.label === 'undefined') {\n tab.label = toWords(tab.name)\n }\n\n tab.fields = await sanitizeFields({\n config,\n existingFieldNames: tabHasName(tab) ? new Set() : existingFieldNames,\n fields: tab.fields,\n parentIsLocalized: parentIsLocalized || (tabHasName(tab) && tab.localized),\n requireFieldLevelRichTextEditor,\n richTextSanitizationPromises,\n validRelationships,\n })\n field.tabs[j] = tab\n }\n }\n\n if ('_sanitized' in field) {\n field._sanitized = true\n }\n\n fields[i] = field\n }\n\n return fields\n}\n"],"names":["deepMergeSimple","MissingEditorProp","DuplicateFieldName","InvalidFieldName","InvalidFieldRelationship","MissingFieldType","formatLabels","toWords","baseBlockFields","baseIDField","setDefaultBeforeDuplicate","validations","fieldAffectsData","tabHasName","sanitizeFields","collectionConfig","config","existingFieldNames","Set","fields","parentIsLocalized","requireFieldLevelRichTextEditor","richTextSanitizationPromises","validRelationships","i","length","field","_sanitized","type","name","includes","label","defaultValue","required","relationships","Array","isArray","relationTo","forEach","relationship","min","minRows","console","warn","max","maxRows","admin","isSortable","push","labels","has","add","localized","shouldDisableLocalized","localization","compatibility","allowLocalizedWithinLocalized","validate","defaultValidate","val","options","hooks","access","sanitizeRichText","_config","editor","isRoot","i18n","Object","keys","translations","blocks","block","concat","slug","j","tabs","tab"],"mappings":"AAAA,SAASA,eAAe,QAAQ,qCAAoC;AAMpE,SAASC,iBAAiB,QAAQ,oCAAmC;AACrE,SACEC,kBAAkB,EAClBC,gBAAgB,EAChBC,wBAAwB,EACxBC,gBAAgB,QACX,wBAAuB;AAC9B,SAASC,YAAY,EAAEC,OAAO,QAAQ,kCAAiC;AACvE,SAASC,eAAe,QAAQ,mCAAkC;AAClE,SAASC,WAAW,QAAQ,+BAA8B;AAC1D,SAASC,yBAAyB,QAAQ,kCAAiC;AAC3E,OAAOC,iBAAiB,oBAAmB;AAC3C,SAASC,gBAAgB,EAAEC,UAAU,QAAQ,aAAY;AA2BzD,OAAO,MAAMC,iBAAiB,OAAO,EACnCC,gBAAgB,EAChBC,MAAM,EACNC,qBAAqB,IAAIC,KAAK,EAC9BC,MAAM,EACNC,iBAAiB,EACjBC,kCAAkC,KAAK,EACvCC,4BAA4B,EAC5BC,kBAAkB,EACb;IACL,IAAI,CAACJ,QAAQ;QACX,OAAO,EAAE;IACX;IAEA,IAAK,IAAIK,IAAI,GAAGA,IAAIL,OAAOM,MAAM,EAAED,IAAK;QACtC,MAAME,QAAQP,MAAM,CAACK,E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KAAK,GAAGxB,QAAQsE,IAAIhD,IAAI;gBAC9B;gBAEAgD,IAAI1D,MAAM,GAAG,MAAML,eAAe;oBAChCE;oBACAC,oBAAoBJ,WAAWgE,OAAO,IAAI3D,QAAQD;oBAClDE,QAAQ0D,IAAI1D,MAAM;oBAClBC,mBAAmBA,qBAAsBP,WAAWgE,QAAQA,IAAIzB,SAAS;oBACzE/B;oBACAC;oBACAC;gBACF;gBACAG,MAAMkD,IAAI,CAACD,EAAE,GAAGE;YAClB;QACF;QAEA,IAAI,gBAAgBnD,OAAO;YACzBA,MAAMC,UAAU,GAAG;QACrB;QAEAR,MAAM,CAACK,EAAE,GAAGE;IACd;IAEA,OAAOP;AACT,EAAC"}
1
+ {"version":3,"sources":["../../../src/fields/config/sanitize.ts"],"sourcesContent":["import { deepMergeSimple } from '@payloadcms/translations/utilities'\n\nimport type { CollectionConfig } from '../../collections/config/types.js'\nimport type { Config, SanitizedConfig } from '../../config/types.js'\nimport type { Field } from './types.js'\n\nimport {\n DuplicateFieldName,\n InvalidFieldName,\n InvalidFieldRelationship,\n MissingFieldType,\n} from '../../errors/index.js'\nimport { MissingEditorProp } from '../../errors/MissingEditorProp.js'\nimport { formatLabels, toWords } from '../../utilities/formatLabels.js'\nimport { baseBlockFields } from '../baseFields/baseBlockFields.js'\nimport { baseIDField } from '../baseFields/baseIDField.js'\nimport { setDefaultBeforeDuplicate } from '../setDefaultBeforeDuplicate.js'\nimport validations from '../validations.js'\nimport { fieldAffectsData, tabHasName } from './types.js'\n\ntype Args = {\n collectionConfig?: CollectionConfig\n config: Config\n existingFieldNames?: Set<string>\n fields: Field[]\n parentIsLocalized: boolean\n /**\n * If true, a richText field will require an editor property to be set, as the sanitizeFields function will not add it from the payload config if not present.\n *\n * @default false\n */\n requireFieldLevelRichTextEditor?: boolean\n\n /**\n * If this property is set, RichText fields won't be sanitized immediately. Instead, they will be added to this array as promises\n * so that you can sanitize them together, after the config has been sanitized.\n */\n richTextSanitizationPromises?: Array<(config: SanitizedConfig) => Promise<void>>\n /**\n * If not null, will validate that upload and relationship fields do not relate to a collection that is not in this array.\n * This validation will be skipped if validRelationships is null.\n */\n validRelationships: null | string[]\n}\n\nexport const sanitizeFields = async ({\n collectionConfig,\n config,\n existingFieldNames = new Set(),\n fields,\n parentIsLocalized,\n requireFieldLevelRichTextEditor = false,\n richTextSanitizationPromises,\n validRelationships,\n}: Args): Promise<Field[]> => {\n if (!fields) {\n return []\n }\n\n for (let i = 0; i < fields.length; i++) {\n const field = fields[i]\n\n if ('_sanitized' in field && field._sanitized === true) {\n continue\n }\n\n if (!field.type) {\n throw new MissingFieldType(field)\n }\n\n // assert that field names do not contain forbidden characters\n if (fieldAffectsData(field) && field.name.includes('.')) {\n throw new InvalidFieldName(field, field.name)\n }\n\n // Auto-label\n if (\n 'name' in field &&\n field.name &&\n typeof field.label !== 'object' &&\n typeof field.label !== 'string' &&\n typeof field.label !== 'function' &&\n field.label !== false\n ) {\n field.label = toWords(field.name)\n }\n\n if (\n field.type === 'checkbox' &&\n typeof field.defaultValue === 'undefined' &&\n field.required === true\n ) {\n field.defaultValue = false\n }\n\n if (field.type === 'relationship' || field.type === 'upload') {\n if (validRelationships) {\n const relationships = Array.isArray(field.relationTo)\n ? field.relationTo\n : [field.relationTo]\n relationships.forEach((relationship: string) => {\n if (!validRelationships.includes(relationship)) {\n throw new InvalidFieldRelationship(field, relationship)\n }\n })\n }\n\n if (field.min && !field.minRows) {\n console.warn(\n `(payload): The \"min\" property is deprecated for the Relationship field \"${field.name}\" and will be removed in a future version. Please use \"minRows\" instead.`,\n )\n }\n if (field.max && !field.maxRows) {\n console.warn(\n `(payload): The \"max\" property is deprecated for the Relationship field \"${field.name}\" and will be removed in a future version. Please use \"maxRows\" instead.`,\n )\n }\n field.minRows = field.minRows || field.min\n field.maxRows = field.maxRows || field.max\n }\n\n if (field.type === 'upload') {\n if (!field.admin || !('isSortable' in field.admin)) {\n field.admin = {\n isSortable: true,\n ...field.admin,\n }\n }\n }\n\n if (field.type === 'array' && field.fields) {\n field.fields.push(baseIDField)\n }\n\n if ((field.type === 'blocks' || field.type === 'array') && field.label) {\n field.labels = field.labels || formatLabels(field.name)\n }\n\n if (fieldAffectsData(field)) {\n if (existingFieldNames.has(field.name)) {\n throw new DuplicateFieldName(field.name)\n } else if (!['blockName', 'id'].includes(field.name)) {\n existingFieldNames.add(field.name)\n }\n\n if (typeof field.localized !== 'undefined') {\n let shouldDisableLocalized = !config.localization\n\n if (!config.compatibility?.allowLocalizedWithinLocalized && parentIsLocalized) {\n shouldDisableLocalized = true\n }\n\n if (shouldDisableLocalized) {\n delete field.localized\n }\n }\n\n if (typeof field.validate === 'undefined') {\n const defaultValidate = validations[field.type]\n if (defaultValidate) {\n field.validate = (val, options) => defaultValidate(val, { ...field, ...options })\n } else {\n field.validate = () => true\n }\n }\n\n if (!field.hooks) {\n field.hooks = {}\n }\n if (!field.access) {\n field.access = {}\n }\n\n setDefaultBeforeDuplicate(field)\n }\n\n if (!field.admin) {\n field.admin = {}\n }\n\n // Make sure that the richText field has an editor\n if (field.type === 'richText') {\n const sanitizeRichText = async (_config: SanitizedConfig) => {\n if (!field.editor) {\n if (_config.editor && !requireFieldLevelRichTextEditor) {\n // config.editor should be sanitized at this point\n field.editor = _config.editor\n } else {\n throw new MissingEditorProp(field) // while we allow disabling editor functionality, you should not have any richText fields defined if you do not have an editor\n }\n }\n\n if (typeof field.editor === 'function') {\n field.editor = await field.editor({\n config: _config,\n isRoot: requireFieldLevelRichTextEditor,\n parentIsLocalized: parentIsLocalized || field.localized,\n })\n }\n\n if (field.editor.i18n && Object.keys(field.editor.i18n).length >= 0) {\n config.i18n.translations = deepMergeSimple(config.i18n.translations, field.editor.i18n)\n }\n }\n if (richTextSanitizationPromises) {\n richTextSanitizationPromises.push(sanitizeRichText)\n } else {\n await sanitizeRichText(config as unknown as SanitizedConfig)\n }\n }\n\n if (field.type === 'blocks' && field.blocks) {\n for (const block of field.blocks) {\n if (block._sanitized === true) {\n continue\n }\n block._sanitized = true\n block.fields = block.fields.concat(baseBlockFields)\n block.labels = !block.labels ? formatLabels(block.slug) : block.labels\n\n block.fields = await sanitizeFields({\n config,\n existingFieldNames: new Set(),\n fields: block.fields,\n parentIsLocalized: parentIsLocalized || field.localized,\n requireFieldLevelRichTextEditor,\n richTextSanitizationPromises,\n validRelationships,\n })\n }\n }\n\n if ('fields' in field && field.fields) {\n field.fields = await sanitizeFields({\n config,\n existingFieldNames: fieldAffectsData(field) ? new Set() : existingFieldNames,\n fields: field.fields,\n parentIsLocalized: parentIsLocalized || field.localized,\n requireFieldLevelRichTextEditor,\n richTextSanitizationPromises,\n validRelationships,\n })\n }\n\n if (field.type === 'tabs') {\n for (let j = 0; j < field.tabs.length; j++) {\n const tab = field.tabs[j]\n if (tabHasName(tab) && typeof tab.label === 'undefined') {\n tab.label = toWords(tab.name)\n }\n\n tab.fields = await sanitizeFields({\n config,\n existingFieldNames: tabHasName(tab) ? new Set() : existingFieldNames,\n fields: tab.fields,\n parentIsLocalized: parentIsLocalized || (tabHasName(tab) && tab.localized),\n requireFieldLevelRichTextEditor,\n richTextSanitizationPromises,\n validRelationships,\n })\n field.tabs[j] = tab\n }\n }\n\n if ('_sanitized' in field) {\n field._sanitized = true\n }\n\n fields[i] = field\n }\n\n return fields\n}\n"],"names":["deepMergeSimple","DuplicateFieldName","InvalidFieldName","InvalidFieldRelationship","MissingFieldType","MissingEditorProp","formatLabels","toWords","baseBlockFields","baseIDField","setDefaultBeforeDuplicate","validations","fieldAffectsData","tabHasName","sanitizeFields","collectionConfig","config","existingFieldNames","Set","fields","parentIsLocalized","requireFieldLevelRichTextEditor","richTextSanitizationPromises","validRelationships","i","length","field","_sanitized","type","name","includes","label","defaultValue","required","relationships","Array","isArray","relationTo","forEach","relationship","min","minRows","console","warn","max","maxRows","admin","isSortable","push","labels","has","add","localized","shouldDisableLocalized","localization","compatibility","allowLocalizedWithinLocalized","validate","defaultValidate","val","options","hooks","access","sanitizeRichText","_config","editor","isR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chema4 } from 'json-schema';
3
3
  import type { CSSProperties } from 'react';
4
4
  import type { DeepUndefinable } from 'ts-essentials';
5
5
  import type { RichTextAdapter, RichTextAdapterProvider } from '../../admin/RichText.js';
6
- import type { ArrayFieldErrorClientComponent, ArrayFieldErrorServerComponent, ArrayFieldLabelClientComponent, ArrayFieldLabelServerComponent, ArrayFieldProps, BlockFieldErrorClientComponent, BlockFieldErrorServerComponent, BlockFieldProps, CheckboxFieldErrorClientComponent, CheckboxFieldErrorServerComponent, CheckboxFieldLabelClientComponent, CheckboxFieldLabelServerComponent, CheckboxFieldProps, ClientTab, CodeFieldErrorClientComponent, CodeFieldErrorServerComponent, CodeFieldLabelClientComponent, CodeFieldLabelServerComponent, CodeFieldProps, CollapsibleFieldLabelClientComponent, CollapsibleFieldLabelServerComponent, CollapsibleFieldProps, ConditionalDateProps, DateFieldErrorClientComponent, DateFieldErrorServerComponent, DateFieldLabelClientComponent, DateFieldLabelServerComponent, DateFieldProps, Description, EmailFieldErrorClientComponent, EmailFieldErrorServerComponent, EmailFieldLabelClientComponent, EmailFieldLabelServerComponent, EmailFieldProps, FieldDescriptionClientComponent, FieldDescriptionServerComponent, GroupFieldLabelClientComponent, GroupFieldLabelServerComponent, GroupFieldProps, HiddenFieldProps, JSONFieldErrorClientComponent, JSONFieldErrorServerComponent, JSONFieldLabelClientComponent, JSONFieldLabelServerComponent, JSONFieldProps, MappedComponent, NumberFieldErrorClientComponent, NumberFieldErrorServerComponent, NumberFieldLabelClientComponent, NumberFieldLabelServerComponent, NumberFieldProps, PointFieldErrorClientComponent, PointFieldErrorServerComponent, PointFieldLabelClientComponent, PointFieldLabelServerComponent, PointFieldProps, RadioFieldErrorClientComponent, RadioFieldErrorServerComponent, RadioFieldLabelClientComponent, RadioFieldLabelServerComponent, RadioFieldProps, RelationshipFieldErrorClientComponent, RelationshipFieldErrorServerComponent, RelationshipFieldLabelClientComponent, RelationshipFieldLabelServerComponent, RelationshipFieldProps, RichTextFieldProps, RowFieldProps, RowLabelComponent, SelectFieldErrorClientComponent, SelectFieldErrorServerComponent, SelectFieldLabelClientComponent, SelectFieldLabelServerComponent, SelectFieldProps, StaticDescription, TabsFieldProps, TextFieldErrorClientComponent, TextFieldErrorServerComponent, TextFieldLabelClientComponent, TextFieldLabelServerComponent, TextareaFieldErrorClientComponent, TextareaFieldErrorServerComponent, TextareaFieldLabelClientComponent, TextareaFieldLabelServerComponent, TextareaFieldProps, UploadFieldProps } from '../../admin/types.js';
6
+ import type { ArrayFieldErrorClientComponent, ArrayFieldErrorServerComponent, ArrayFieldLabelClientComponent, ArrayFieldLabelServerComponent, ArrayFieldProps, BlockFieldErrorClientComponent, BlockFieldErrorServerComponent, BlockFieldProps, CheckboxFieldErrorClientComponent, CheckboxFieldErrorServerComponent, CheckboxFieldLabelClientComponent, CheckboxFieldLabelServerComponent, CheckboxFieldProps, ClientTab, CodeFieldErrorClientComponent, CodeFieldErrorServerComponent, CodeFieldLabelClientComponent, CodeFieldLabelServerComponent, CodeFieldProps, CollapsibleFieldLabelClientComponent, CollapsibleFieldLabelServerComponent, CollapsibleFieldProps, ConditionalDateProps, DateFieldErrorClientComponent, DateFieldErrorServerComponent, DateFieldLabelClientComponent, DateFieldLabelServerComponent, DateFieldProps, Description, EmailFieldErrorClientComponent, EmailFieldErrorServerComponent, EmailFieldLabelClientComponent, EmailFieldLabelServerComponent, EmailFieldProps, FieldDescriptionClientComponent, FieldDescriptionServerComponent, GroupFieldLabelClientComponent, GroupFieldLabelServerComponent, GroupFieldProps, HiddenFieldProps, JSONFieldErrorClientComponent, JSONFieldErrorServerComponent, JSONFieldLabelClientComponent, JSONFieldLabelServerComponent, JSONFieldProps, MappedComponent, NumberFieldErrorClientComponent, NumberFieldErrorServerComponent, NumberFieldLabelClientComponent, NumberFieldLabelServerComponent, NumberFieldProps, PointFieldErrorClientComponent, PointFieldErrorServerComponent, PointFieldLabelClientComponent, PointFieldLabelServerComponent, PointFieldProps, RadioFieldErrorClientComponent, RadioFieldErrorServerComponent, RadioFieldLabelClientComponent, RadioFieldLabelServerComponent, RadioFieldProps, RelationshipFieldErrorClientComponent, RelationshipFieldErrorServerComponent, RelationshipFieldLabelClientComponent, RelationshipFieldLabelServerComponent, RelationshipFieldProps, RichTextFieldProps, RowFieldProps, RowLabelComponent, SelectFieldErrorClientComponent, SelectFieldErrorServerComponent, SelectFieldLabelClientComponent, SelectFieldLabelServerComponent, SelectFieldProps, StaticDescription, TabsFieldProps, TextareaFieldErrorClientComponent, TextareaFieldErrorServerComponent, TextareaFieldLabelClientComponent, TextareaFieldLabelServerComponent, TextareaFieldProps, TextFieldErrorClientComponent, TextFieldErrorServerComponent, TextFieldLabelClientComponent, TextFieldLabelServerComponent, UploadFieldProps } from '../../admin/types.js';
7
7
  import type { SanitizedCollectionConfig, TypeWithID } from '../../collections/config/types.js';
8
8
  import type { CustomComponent, LabelFunction, PayloadComponent, StaticLabel } from '../../config/types.js';
9
9
  import type { DBIdentifierName } from '../../database/types.js';
@@ -13,7 +13,7 @@ import type { DocumentPreferences } from '../../preferences/types.js';
13
13
  import type { Operation, PayloadRequest, RequestContext, Where } from '../../types/index.js';
14
14
  export type FieldHookArgs<TData extends TypeWithID = any, TValue = any, TSiblingData = any> = {
15
15
  /** The collection which the field belongs to. If the field belongs to a global, this will be null. */
16
- collection: SanitizedCollectionConfig | null;
16
+ collection: null | SanitizedCollectionConfig;
17
17
  context: RequestContext;
18
18
  /**
19
19
  * Only available in `afterRead` hooks
@@ -33,7 +33,7 @@ export type FieldHookArgs<TData extends TypeWithID = any, TValue = any, TSibling
33
33
  /** Boolean to denote if this hook is running against finding one, or finding many within the afterRead hook. */
34
34
  findMany?: boolean;
35
35
  /** The global which the field belongs to. If the field belongs to a collection, this will be null. */
36
- global: SanitizedGlobalConfig | null;
36
+ global: null | SanitizedGlobalConfig;
37
37
  /** A string relating to which operation the field type is currently executing within. Useful within beforeValidate, beforeChange, and afterChange hooks to differentiate between create and update operations. */
38
38
  operation?: 'create' | 'delete' | 'read' | 'update';
39
39
  /** The full original document in `update` operations. In the `afterChange` hook, this is the resulting document of the operation. */
@@ -88,7 +88,7 @@ export type FieldAccess<TData extends TypeWithID = any, TSiblingData = any> = (a
88
88
  * Immediately adjacent data to this field. For example, if this is a `group` field, then `siblingData` will be the other fields within the group.
89
89
  */
90
90
  siblingData?: Partial<TSiblingData>;
91
- }) => Promise<boolean> | boolean;
91
+ }) => boolean | Promise<boolean>;
92
92
  export type Condition<TData extends TypeWithID = any, TSiblingData = any> = (data: Partial<TData>, siblingData: Partial<TSiblingData>, { user }: {
93
93
  user: PayloadRequest['user'];
94
94
  }) => boolean;
@@ -114,8 +114,8 @@ export type FilterOptionsProps<TData = any> = {
114
114
  */
115
115
  user: Partial<PayloadRequest['user']>;
116
116
  };
117
- export type FilterOptionsFunc<TData = any> = (options: FilterOptionsProps<TData>) => Promise<Where | boolean> | Where | boolean;
118
- export type FilterOptions<TData = any> = ((options: FilterOptionsProps<TData>) => Promise<Where | boolean> | Where | boolean) | Where | null;
117
+ export type FilterOptionsFunc<TData = any> = (options: FilterOptionsProps<TData>) => boolean | Promise<boolean | Where> | Where;
118
+ export type FilterOptions<TData = any> = ((options: FilterOptionsProps<TData>) => boolean | Promise<boolean | Where> | Where) | null | Where;
119
119
  type Admin = {
120
120
  className?: string;
121
121
  components?: {
@@ -136,6 +136,7 @@ type Admin = {
136
136
  custom?: Record<string, any>;
137
137
  description?: Description;
138
138
  disableBulkEdit?: boolean;
139
+ disabled?: boolean;
139
140
  /**
140
141
  * Shows / hides fields from appearing in the list view column selector.
141
142
  * @type boolean
@@ -146,7 +147,6 @@ type Admin = {
146
147
  * @type boolean
147
148
  */
148
149
  disableListFilter?: boolean;
149
- disabled?: boolean;
150
150
  hidden?: boolean;
151
151
  position?: 'sidebar';
152
152
  readOnly?: boolean;
@@ -168,6 +168,7 @@ export type AdminClient = {
168
168
  custom?: Record<string, any>;
169
169
  description?: StaticDescription;
170
170
  disableBulkEdit?: boolean;
171
+ disabled?: boolean;
171
172
  /**
172
173
  * Shows / hides fields from appearing in the list view column selector.
173
174
  * @type boolean
@@ -178,7 +179,6 @@ export type AdminClient = {
178
179
  * @type boolean
179
180
  */
180
181
  disableListFilter?: boolean;
181
- disabled?: boolean;
182
182
  hidden?: boolean;
183
183
  position?: 'sidebar';
184
184
  readOnly?: boolean;
@@ -238,7 +238,7 @@ export interface FieldBase {
238
238
  beforeValidate?: FieldHook[];
239
239
  };
240
240
  index?: boolean;
241
- label?: LabelFunction | StaticLabel | false;
241
+ label?: false | LabelFunction | StaticLabel;
242
242
  localized?: boolean;
243
243
  /**
244
244
  * The name of the field. Must be alphanumeric and cannot contain ' . '
@@ -291,10 +291,10 @@ export type NumberField = {
291
291
  /** Set this property to a string that will be used for browser autocomplete. */
292
292
  autoComplete?: string;
293
293
  components?: {
294
- Error?: CustomComponent<NumberFieldErrorClientComponent | NumberFieldErrorServerComponent>;
295
- Label?: CustomComponent<NumberFieldLabelClientComponent | NumberFieldLabelServerComponent>;
296
294
  afterInput?: CustomComponent[];
297
295
  beforeInput?: CustomComponent[];
296
+ Error?: CustomComponent<NumberFieldErrorClientComponent | NumberFieldErrorServerComponent>;
297
+ Label?: CustomComponent<NumberFieldLabelClientComponent | NumberFieldLabelServerComponent>;
298
298
  } & Admin['components'];
299
299
  /** Set this property to define a placeholder string for the field. */
300
300
  placeholder?: Record<string, string> | string;
@@ -325,10 +325,10 @@ export type NumberField = {
325
325
  export type NumberFieldClient = {
326
326
  admin?: {
327
327
  components?: {
328
- Error?: MappedComponent;
329
- Label?: MappedComponent;
330
328
  afterInput?: MappedComponent[];
331
329
  beforeInput?: MappedComponent[];
330
+ Error?: MappedComponent;
331
+ Label?: MappedComponent;
332
332
  } & AdminClient['components'];
333
333
  } & AdminClient & Pick<NumberField['admin'], 'autoComplete' | 'placeholder' | 'step'>;
334
334
  } & FieldBaseClient & Pick<NumberField, 'hasMany' | 'max' | 'maxRows' | 'min' | 'minRows' | 'type'>;
@@ -336,10 +336,10 @@ export type TextField = {
336
336
  admin?: {
337
337
  autoComplete?: string;
338
338
  components?: {
339
- Error?: CustomComponent<TextFieldErrorClientComponent | TextFieldErrorServerComponent>;
340
- Label?: CustomComponent<TextFieldLabelClientComponent | TextFieldLabelServerComponent>;
341
339
  afterInput?: CustomComponent[];
342
340
  beforeInput?: CustomComponent[];
341
+ Error?: CustomComponent<TextFieldErrorClientComponent | TextFieldErrorServerComponent>;
342
+ Label?: CustomComponent<TextFieldLabelClientComponent | TextFieldLabelServerComponent>;
343
343
  } & Admin['components'];
344
344
  placeholder?: Record<string, string> | string;
345
345
  rtl?: boolean;
@@ -366,10 +366,10 @@ export type TextField = {
366
366
  export type TextFieldClient = {
367
367
  admin?: {
368
368
  components?: {
369
- Error?: MappedComponent;
370
- Label?: MappedComponent;
371
369
  afterInput?: MappedComponent[];
372
370
  beforeInput?: MappedComponent[];
371
+ Error?: MappedComponent;
372
+ Label?: MappedComponent;
373
373
  } & AdminClient['components'];
374
374
  } & AdminClient & Pick<TextField['admin'], 'autoComplete' | 'placeholder' | 'rtl'>;
375
375
  } & FieldBaseClient & Pick<TextField, 'hasMany' | 'maxLength' | 'maxRows' | 'minLength' | 'minRows' | 'type'>;
@@ -377,10 +377,10 @@ export type EmailField = {
377
377
  admin?: {
378
378
  autoComplete?: string;
379
379
  components?: {
380
- Error?: CustomComponent<EmailFieldErrorClientComponent | EmailFieldErrorServerComponent>;
381
- Label?: CustomComponent<EmailFieldLabelClientComponent | EmailFieldLabelServerComponent>;
382
380
  afterInput?: CustomComponent[];
383
381
  beforeInput?: CustomComponent[];
382
+ Error?: CustomComponent<EmailFieldErrorClientComponent | EmailFieldErrorServerComponent>;
383
+ Label?: CustomComponent<EmailFieldLabelClientComponent | EmailFieldLabelServerComponent>;
384
384
  } & Admin['components'];
385
385
  placeholder?: Record<string, string> | string;
386
386
  } & Admin;
@@ -390,20 +390,20 @@ export type EmailField = {
390
390
  export type EmailFieldClient = {
391
391
  admin?: {
392
392
  components?: {
393
- Error?: MappedComponent;
394
- Label?: MappedComponent;
395
393
  afterInput?: MappedComponent[];
396
394
  beforeInput?: MappedComponent[];
395
+ Error?: MappedComponent;
396
+ Label?: MappedComponent;
397
397
  } & AdminClient['components'];
398
398
  } & AdminClient & Pick<EmailField['admin'], 'placeholder'>;
399
399
  } & FieldBaseClient & Pick<EmailField, 'type'>;
400
400
  export type TextareaField = {
401
401
  admin?: {
402
402
  components?: {
403
- Error?: CustomComponent<TextareaFieldErrorClientComponent | TextareaFieldErrorServerComponent>;
404
- Label?: CustomComponent<TextareaFieldLabelClientComponent | TextareaFieldLabelServerComponent>;
405
403
  afterInput?: CustomComponent[];
406
404
  beforeInput?: CustomComponent[];
405
+ Error?: CustomComponent<TextareaFieldErrorClientComponent | TextareaFieldErrorServerComponent>;
406
+ Label?: CustomComponent<TextareaFieldLabelClientComponent | TextareaFieldLabelServerComponent>;
407
407
  } & Admin['components'];
408
408
  placeholder?: Record<string, string> | string;
409
409
  rows?: number;
@@ -417,20 +417,20 @@ export type TextareaField = {
417
417
  export type TextareaFieldClient = {
418
418
  admin?: {
419
419
  components?: {
420
- Error?: MappedComponent;
421
- Label?: MappedComponent;
422
420
  afterInput?: MappedComponent[];
423
421
  beforeInput?: MappedComponent[];
422
+ Error?: MappedComponent;
423
+ Label?: MappedComponent;
424
424
  } & AdminClient['components'];
425
425
  } & AdminClient & Pick<TextareaField['admin'], 'placeholder' | 'rows' | 'rtl'>;
426
426
  } & FieldBaseClient & Pick<TextareaField, 'maxLength' | 'minLength' | 'type'>;
427
427
  export type CheckboxField = {
428
428
  admin?: {
429
429
  components?: {
430
- Error?: CustomComponent<CheckboxFieldErrorClientComponent | CheckboxFieldErrorServerComponent>;
431
- Label?: CustomComponent<CheckboxFieldLabelClientComponent | CheckboxFieldLabelServerComponent>;
432
430
  afterInput?: CustomComponent[];
433
431
  beforeInput?: CustomComponent[];
432
+ Error?: CustomComponent<CheckboxFieldErrorClientComponent | CheckboxFieldErrorServerComponent>;
433
+ Label?: CustomComponent<CheckboxFieldLabelClientComponent | CheckboxFieldLabelServerComponent>;
434
434
  } & Admin['components'];
435
435
  } & Admin;
436
436
  type: 'checkbox';
@@ -439,20 +439,20 @@ export type CheckboxField = {
439
439
  export type CheckboxFieldClient = {
440
440
  admin?: {
441
441
  components?: {
442
- Error?: MappedComponent;
443
- Label?: MappedComponent;
444
442
  afterInput?: MappedComponent[];
445
443
  beforeInput?: MappedComponent[];
444
+ Error?: MappedComponent;
445
+ Label?: MappedComponent;
446
446
  } & AdminClient['components'];
447
447
  } & AdminClient;
448
448
  } & FieldBaseClient & Pick<CheckboxField, 'type'>;
449
449
  export type DateField = {
450
450
  admin?: {
451
451
  components?: {
452
- Error?: CustomComponent<DateFieldErrorClientComponent | DateFieldErrorServerComponent>;
453
- Label?: CustomComponent<DateFieldLabelClientComponent | DateFieldLabelServerComponent>;
454
452
  afterInput?: CustomComponent[];
455
453
  beforeInput?: CustomComponent[];
454
+ Error?: CustomComponent<DateFieldErrorClientComponent | DateFieldErrorServerComponent>;
455
+ Label?: CustomComponent<DateFieldLabelClientComponent | DateFieldLabelServerComponent>;
456
456
  } & Admin['components'];
457
457
  date?: ConditionalDateProps;
458
458
  placeholder?: Record<string, string> | string;
@@ -463,10 +463,10 @@ export type DateField = {
463
463
  export type DateFieldClient = {
464
464
  admin?: {
465
465
  components?: {
466
- Error?: MappedComponent;
467
- Label?: MappedComponent;
468
466
  afterInput?: MappedComponent[];
469
467
  beforeInput?: MappedComponent[];
468
+ Error?: MappedComponent;
469
+ Label?: MappedComponent;
470
470
  } & AdminClient['components'];
471
471
  } & AdminClient & Pick<DateField['admin'], 'date' | 'placeholder'>;
472
472
  } & FieldBaseClient & Pick<DateField, 'type'>;
@@ -705,10 +705,10 @@ export type UploadFieldClient = SingleUploadFieldClient;
705
705
  export type CodeField = {
706
706
  admin?: {
707
707
  components?: {
708
- Error?: CustomComponent<CodeFieldErrorClientComponent | CodeFieldErrorServerComponent>;
709
- Label?: CustomComponent<CodeFieldLabelClientComponent | CodeFieldLabelServerComponent>;
710
708
  afterInput?: CustomComponent[];
711
709
  beforeInput?: CustomComponent[];
710
+ Error?: CustomComponent<CodeFieldErrorClientComponent | CodeFieldErrorServerComponent>;
711
+ Label?: CustomComponent<CodeFieldLabelClientComponent | CodeFieldLabelServerComponent>;
712
712
  } & Admin['components'];
713
713
  editorOptions?: EditorProps['options'];
714
714
  language?: string;
@@ -721,20 +721,20 @@ export type CodeField = {
721
721
  export type CodeFieldClient = {
722
722
  admin?: {
723
723
  components?: {
724
- Error?: MappedComponent;
725
- Label?: MappedComponent;
726
724
  afterInput?: MappedComponent[];
727
725
  beforeInput?: MappedComponent[];
726
+ Error?: MappedComponent;
727
+ Label?: MappedComponent;
728
728
  } & AdminClient['components'];
729
729
  } & AdminClient & Pick<CodeField['admin'], 'editorOptions' | 'language'>;
730
730
  } & Omit<FieldBaseClient, 'admin'> & Pick<CodeField, 'maxLength' | 'minLength' | 'type'>;
731
731
  export type JSONField = {
732
732
  admin?: {
733
733
  components?: {
734
- Error?: CustomComponent<JSONFieldErrorClientComponent | JSONFieldErrorServerComponent>;
735
- Label?: CustomComponent<JSONFieldLabelClientComponent | JSONFieldLabelServerComponent>;
736
734
  afterInput?: CustomComponent[];
737
735
  beforeInput?: CustomComponent[];
736
+ Error?: CustomComponent<JSONFieldErrorClientComponent | JSONFieldErrorServerComponent>;
737
+ Label?: CustomComponent<JSONFieldLabelClientComponent | JSONFieldLabelServerComponent>;
738
738
  } & Admin['components'];
739
739
  editorOptions?: EditorProps['options'];
740
740
  } & Admin;
@@ -749,20 +749,20 @@ export type JSONField = {
749
749
  export type JSONFieldClient = {
750
750
  admin?: {
751
751
  components?: {
752
- Error?: MappedComponent;
753
- Label?: MappedComponent;
754
752
  afterInput?: MappedComponent[];
755
753
  beforeInput?: MappedComponent[];
754
+ Error?: MappedComponent;
755
+ Label?: MappedComponent;
756
756
  } & AdminClient['components'];
757
757
  } & AdminClient & Pick<JSONField['admin'], 'editorOptions'>;
758
758
  } & Omit<FieldBaseClient, 'admin'> & Pick<JSONField, 'jsonSchema' | 'type'>;
759
759
  export type SelectField = {
760
760
  admin?: {
761
761
  components?: {
762
- Error?: CustomComponent<SelectFieldErrorClientComponent | SelectFieldErrorServerComponent>;
763
- Label?: CustomComponent<SelectFieldLabelClientComponent | SelectFieldLabelServerComponent>;
764
762
  afterInput?: CustomComponent[];
765
763
  beforeInput?: CustomComponent[];
764
+ Error?: CustomComponent<SelectFieldErrorClientComponent | SelectFieldErrorServerComponent>;
765
+ Label?: CustomComponent<SelectFieldLabelClientComponent | SelectFieldLabelServerComponent>;
766
766
  } & Admin['components'];
767
767
  isClearable?: boolean;
768
768
  isSortable?: boolean;
@@ -783,10 +783,10 @@ export type SelectField = {
783
783
  export type SelectFieldClient = {
784
784
  admin?: {
785
785
  components?: {
786
- Error?: MappedComponent;
787
- Label?: MappedComponent;
788
786
  afterInput?: MappedComponent[];
789
787
  beforeInput?: MappedComponent[];
788
+ Error?: MappedComponent;
789
+ Label?: MappedComponent;
790
790
  } & AdminClient['components'];
791
791
  } & AdminClient & Pick<SelectField['admin'], 'isClearable' | 'isSortable'>;
792
792
  } & FieldBaseClient & Pick<SelectField, 'hasMany' | 'options' | 'type'>;
@@ -870,7 +870,7 @@ export type ValueWithRelation = {
870
870
  value: number | string;
871
871
  };
872
872
  export declare function valueIsValueWithRelation(value: unknown): value is ValueWithRelation;
873
- export type RelationshipValue = (number | string)[] | ValueWithRelation | ValueWithRelation[] | (number | string);
873
+ export type RelationshipValue = (number | string)[] | (number | string) | ValueWithRelation | ValueWithRelation[];
874
874
  export type RichTextField<TValue extends object = any, TAdapterProps = any, TExtraProperties = object> = {
875
875
  admin?: {
876
876
  components?: {
@@ -1049,10 +1049,10 @@ export type BlockFieldClient = {
1049
1049
  export type PointField = {
1050
1050
  admin?: {
1051
1051
  components?: {
1052
- Error?: CustomComponent<PointFieldErrorClientComponent | PointFieldErrorServerComponent>;
1053
- Label?: CustomComponent<PointFieldLabelClientComponent | PointFieldLabelServerComponent>;
1054
1052
  afterInput?: CustomComponent[];
1055
1053
  beforeInput?: CustomComponent[];
1054
+ Error?: CustomComponent<PointFieldErrorClientComponent | PointFieldErrorServerComponent>;
1055
+ Label?: CustomComponent<PointFieldLabelClientComponent | PointFieldLabelServerComponent>;
1056
1056
  } & Admin['components'];
1057
1057
  placeholder?: Record<string, string> | string;
1058
1058
  step?: number;
@@ -1063,24 +1063,24 @@ export type PointField = {
1063
1063
  export type PointFieldClient = {
1064
1064
  admin?: {
1065
1065
  components?: {
1066
- Error?: MappedComponent;
1067
- Label?: MappedComponent;
1068
1066
  afterInput?: MappedComponent[];
1069
1067
  beforeInput?: MappedComponent[];
1068
+ Error?: MappedComponent;
1069
+ Label?: MappedComponent;
1070
1070
  } & AdminClient['components'];
1071
1071
  } & AdminClient & Pick<PointField['admin'], 'placeholder' | 'step'>;
1072
1072
  } & FieldBaseClient & Pick<PointField, 'type'>;
1073
- export type Field = ArrayField | BlockField | CheckboxField | CodeField | CollapsibleField | DateField | EmailField | GroupField | JSONField | NumberField | PointField | RadioField | RelationshipField | RichTextField | RowField | SelectField | TabsField | TextField | TextareaField | UIField | UploadField;
1074
- export type ClientField = ArrayFieldClient | BlockFieldClient | CheckboxFieldClient | CodeFieldClient | CollapsibleFieldClient | DateFieldClient | EmailFieldClient | GroupFieldClient | JSONFieldClient | NumberFieldClient | PointFieldClient | RadioFieldClient | RelationshipFieldClient | RichTextFieldClient | RowFieldClient | SelectFieldClient | TabsFieldClient | TextFieldClient | TextareaFieldClient | UIFieldClient | UploadFieldClient;
1073
+ export type Field = ArrayField | BlockField | CheckboxField | CodeField | CollapsibleField | DateField | EmailField | GroupField | JSONField | NumberField | PointField | RadioField | RelationshipField | RichTextField | RowField | SelectField | TabsField | TextareaField | TextField | UIField | UploadField;
1074
+ export type ClientField = ArrayFieldClient | BlockFieldClient | CheckboxFieldClient | CodeFieldClient | CollapsibleFieldClient | DateFieldClient | EmailFieldClient | GroupFieldClient | JSONFieldClient | NumberFieldClient | PointFieldClient | RadioFieldClient | RelationshipFieldClient | RichTextFieldClient | RowFieldClient | SelectFieldClient | TabsFieldClient | TextareaFieldClient | TextFieldClient | UIFieldClient | UploadFieldClient;
1075
1075
  export type ClientFieldProps = ArrayFieldProps | BlockFieldProps | CheckboxFieldProps | CodeFieldProps | CollapsibleFieldProps | DateFieldProps | EmailFieldProps | GroupFieldProps | HiddenFieldProps | JSONFieldProps | NumberFieldProps | PointFieldProps | RadioFieldProps | RelationshipFieldProps | RichTextFieldProps | RowFieldProps | SelectFieldProps | TabsFieldProps | TextareaFieldProps | UploadFieldProps;
1076
1076
  type ExtractFieldTypes<T> = T extends {
1077
1077
  type: infer U;
1078
1078
  } ? U : never;
1079
1079
  export type FieldTypes = ExtractFieldTypes<Field>;
1080
- export type FieldAffectingData = ArrayField | BlockField | CheckboxField | CodeField | DateField | EmailField | GroupField | JSONField | NumberField | PointField | RadioField | RelationshipField | RichTextField | SelectField | TabAsField | TextField | TextareaField | UploadField;
1081
- export type FieldAffectingDataClient = ArrayFieldClient | BlockFieldClient | CheckboxFieldClient | CodeFieldClient | DateFieldClient | EmailFieldClient | GroupFieldClient | JSONFieldClient | NumberFieldClient | PointFieldClient | RadioFieldClient | RelationshipFieldClient | RichTextFieldClient | SelectFieldClient | TabAsFieldClient | TextFieldClient | TextareaFieldClient | UploadFieldClient;
1082
- export type NonPresentationalField = ArrayField | BlockField | CheckboxField | CodeField | CollapsibleField | DateField | EmailField | GroupField | JSONField | NumberField | PointField | RadioField | RelationshipField | RichTextField | RowField | SelectField | TabsField | TextField | TextareaField | UploadField;
1083
- export type NonPresentationalFieldClient = ArrayFieldClient | BlockFieldClient | CheckboxFieldClient | CodeFieldClient | CollapsibleFieldClient | DateFieldClient | EmailFieldClient | GroupFieldClient | JSONFieldClient | NumberFieldClient | PointFieldClient | RadioFieldClient | RelationshipFieldClient | RichTextFieldClient | RowFieldClient | SelectFieldClient | TabsFieldClient | TextFieldClient | TextareaFieldClient | UploadFieldClient;
1080
+ export type FieldAffectingData = ArrayField | BlockField | CheckboxField | CodeField | DateField | EmailField | GroupField | JSONField | NumberField | PointField | RadioField | RelationshipField | RichTextField | SelectField | TabAsField | TextareaField | TextField | UploadField;
1081
+ export type FieldAffectingDataClient = ArrayFieldClient | BlockFieldClient | CheckboxFieldClient | CodeFieldClient | DateFieldClient | EmailFieldClient | GroupFieldClient | JSONFieldClient | NumberFieldClient | PointFieldClient | RadioFieldClient | RelationshipFieldClient | RichTextFieldClient | SelectFieldClient | TabAsFieldClient | TextareaFieldClient | TextFieldClient | UploadFieldClient;
1082
+ export type NonPresentationalField = ArrayField | BlockField | CheckboxField | CodeField | CollapsibleField | DateField | EmailField | GroupField | JSONField | NumberField | PointField | RadioField | RelationshipField | RichTextField | RowField | SelectField | TabsField | TextareaField | TextField | UploadField;
1083
+ export type NonPresentationalFieldClient = ArrayFieldClient | BlockFieldClient | CheckboxFieldClient | CodeFieldClient | CollapsibleFieldClient | DateFieldClient | EmailFieldClient | GroupFieldClient | JSONFieldClient | NumberFieldClient | PointFieldClient | RadioFieldClient | RelationshipFieldClient | RichTextFieldClient | RowFieldClient | SelectFieldClient | TabsFieldClient | TextareaFieldClient | TextFieldClient | UploadFieldClient;
1084
1084
  export type FieldWithPath = {
1085
1085
  path?: string;
1086
1086
  } & Field;