payload 3.0.0-beta.95 → 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.
- package/dist/admin/RichText.d.ts +4 -3
- package/dist/admin/RichText.d.ts.map +1 -1
- package/dist/admin/RichText.js.map +1 -1
- package/dist/admin/elements/Tab.d.ts +1 -1
- package/dist/admin/elements/Tab.d.ts.map +1 -1
- package/dist/admin/elements/Tab.js.map +1 -1
- package/dist/admin/forms/Description.d.ts +1 -1
- package/dist/admin/forms/Description.d.ts.map +1 -1
- package/dist/admin/forms/Description.js.map +1 -1
- package/dist/admin/forms/Error.d.ts +1 -1
- package/dist/admin/forms/Error.d.ts.map +1 -1
- package/dist/admin/forms/Error.js.map +1 -1
- package/dist/admin/forms/Form.d.ts +1 -1
- package/dist/admin/forms/Form.d.ts.map +1 -1
- package/dist/admin/forms/Form.js.map +1 -1
- package/dist/admin/forms/Label.d.ts +1 -1
- package/dist/admin/forms/Label.d.ts.map +1 -1
- package/dist/admin/forms/Label.js.map +1 -1
- package/dist/admin/types.d.ts +5 -5
- package/dist/admin/types.d.ts.map +1 -1
- package/dist/admin/types.js.map +1 -1
- package/dist/admin/views/types.d.ts +1 -1
- package/dist/admin/views/types.d.ts.map +1 -1
- package/dist/admin/views/types.js.map +1 -1
- package/dist/auth/executeAccess.d.ts.map +1 -1
- package/dist/auth/executeAccess.js +6 -2
- package/dist/auth/executeAccess.js.map +1 -1
- package/dist/auth/getAuthFields.d.ts.map +1 -1
- package/dist/auth/getAuthFields.js +3 -1
- package/dist/auth/getAuthFields.js.map +1 -1
- package/dist/auth/isLocked.d.ts.map +1 -1
- package/dist/auth/isLocked.js +3 -1
- package/dist/auth/isLocked.js.map +1 -1
- package/dist/auth/operations/auth.d.ts +1 -1
- package/dist/auth/operations/auth.d.ts.map +1 -1
- package/dist/auth/operations/auth.js +3 -1
- package/dist/auth/operations/auth.js.map +1 -1
- package/dist/auth/operations/forgotPassword.d.ts.map +1 -1
- package/dist/auth/operations/forgotPassword.js +6 -2
- package/dist/auth/operations/forgotPassword.js.map +1 -1
- package/dist/auth/operations/login.d.ts.map +1 -1
- package/dist/auth/operations/login.js +6 -2
- package/dist/auth/operations/login.js.map +1 -1
- package/dist/auth/operations/logout.d.ts.map +1 -1
- package/dist/auth/operations/logout.js +6 -2
- package/dist/auth/operations/logout.js.map +1 -1
- package/dist/auth/operations/me.d.ts.map +1 -1
- package/dist/auth/operations/me.js +6 -2
- package/dist/auth/operations/me.js.map +1 -1
- package/dist/auth/operations/refresh.d.ts.map +1 -1
- package/dist/auth/operations/refresh.js +6 -2
- package/dist/auth/operations/refresh.js.map +1 -1
- package/dist/auth/operations/registerFirstUser.d.ts.map +1 -1
- package/dist/auth/operations/registerFirstUser.js +6 -2
- package/dist/auth/operations/registerFirstUser.js.map +1 -1
- package/dist/auth/operations/resetPassword.d.ts.map +1 -1
- package/dist/auth/operations/resetPassword.js +6 -2
- package/dist/auth/operations/resetPassword.js.map +1 -1
- package/dist/auth/operations/unlock.d.ts.map +1 -1
- package/dist/auth/operations/unlock.js +3 -1
- package/dist/auth/operations/unlock.js.map +1 -1
- package/dist/auth/operations/verifyEmail.d.ts.map +1 -1
- package/dist/auth/operations/verifyEmail.js +9 -3
- package/dist/auth/operations/verifyEmail.js.map +1 -1
- package/dist/auth/strategies/jwt.js.map +1 -1
- package/dist/auth/strategies/local/authenticate.d.ts.map +1 -1
- package/dist/auth/strategies/local/authenticate.js +3 -1
- package/dist/auth/strategies/local/authenticate.js.map +1 -1
- package/dist/auth/strategies/local/register.d.ts.map +1 -1
- package/dist/auth/strategies/local/register.js +3 -1
- package/dist/auth/strategies/local/register.js.map +1 -1
- package/dist/auth/strategies/local/resetLoginAttempts.d.ts.map +1 -1
- package/dist/auth/strategies/local/resetLoginAttempts.js +3 -1
- package/dist/auth/strategies/local/resetLoginAttempts.js.map +1 -1
- package/dist/auth/types.d.ts +5 -5
- package/dist/auth/types.d.ts.map +1 -1
- package/dist/auth/types.js.map +1 -1
- package/dist/bin/generateImportMap/iterateFields.js.map +1 -1
- package/dist/bin/generateTypes.d.ts.map +1 -1
- package/dist/bin/generateTypes.js +7 -3
- package/dist/bin/generateTypes.js.map +1 -1
- package/dist/bin/index.d.ts.map +1 -1
- package/dist/bin/index.js +3 -1
- package/dist/bin/index.js.map +1 -1
- package/dist/collections/config/client.d.ts +2 -2
- package/dist/collections/config/client.d.ts.map +1 -1
- package/dist/collections/config/client.js.map +1 -1
- package/dist/collections/config/reservedFieldNames.spec.js +4 -4
- package/dist/collections/config/reservedFieldNames.spec.js.map +1 -1
- package/dist/collections/config/sanitize.d.ts.map +1 -1
- package/dist/collections/config/sanitize.js +15 -6
- package/dist/collections/config/sanitize.js.map +1 -1
- package/dist/collections/config/types.d.ts +9 -9
- package/dist/collections/config/types.d.ts.map +1 -1
- package/dist/collections/config/types.js.map +1 -1
- package/dist/collections/dataloader.d.ts +1 -1
- package/dist/collections/dataloader.d.ts.map +1 -1
- package/dist/collections/dataloader.js +3 -1
- package/dist/collections/dataloader.js.map +1 -1
- package/dist/collections/operations/create.d.ts.map +1 -1
- package/dist/collections/operations/create.js +3 -1
- package/dist/collections/operations/create.js.map +1 -1
- package/dist/collections/operations/delete.d.ts.map +1 -1
- package/dist/collections/operations/delete.js +3 -1
- package/dist/collections/operations/delete.js.map +1 -1
- package/dist/collections/operations/deleteByID.d.ts.map +1 -1
- package/dist/collections/operations/deleteByID.js +9 -3
- package/dist/collections/operations/deleteByID.js.map +1 -1
- package/dist/collections/operations/duplicate.d.ts.map +1 -1
- package/dist/collections/operations/duplicate.js +9 -3
- package/dist/collections/operations/duplicate.js.map +1 -1
- package/dist/collections/operations/findByID.d.ts.map +1 -1
- package/dist/collections/operations/findByID.js +6 -2
- package/dist/collections/operations/findByID.js.map +1 -1
- package/dist/collections/operations/findVersionByID.d.ts.map +1 -1
- package/dist/collections/operations/findVersionByID.js +9 -3
- package/dist/collections/operations/findVersionByID.js.map +1 -1
- package/dist/collections/operations/restoreVersion.d.ts.map +1 -1
- package/dist/collections/operations/restoreVersion.js +6 -2
- package/dist/collections/operations/restoreVersion.js.map +1 -1
- package/dist/collections/operations/update.d.ts.map +1 -1
- package/dist/collections/operations/update.js +3 -1
- package/dist/collections/operations/update.js.map +1 -1
- package/dist/collections/operations/updateByID.d.ts.map +1 -1
- package/dist/collections/operations/updateByID.js +9 -3
- package/dist/collections/operations/updateByID.js.map +1 -1
- package/dist/collections/operations/utils.d.ts +1 -1
- package/dist/collections/operations/utils.d.ts.map +1 -1
- package/dist/collections/operations/utils.js.map +1 -1
- package/dist/config/client.d.ts +2 -2
- package/dist/config/client.d.ts.map +1 -1
- package/dist/config/client.js.map +1 -1
- package/dist/config/find.d.ts.map +1 -1
- package/dist/config/find.js +9 -3
- package/dist/config/find.js.map +1 -1
- package/dist/config/sanitize.d.ts.map +1 -1
- package/dist/config/sanitize.js +10 -5
- package/dist/config/sanitize.js.map +1 -1
- package/dist/config/types.d.ts +164 -35
- package/dist/config/types.d.ts.map +1 -1
- package/dist/config/types.js.map +1 -1
- package/dist/database/combineQueries.d.ts +1 -1
- package/dist/database/combineQueries.d.ts.map +1 -1
- package/dist/database/combineQueries.js +9 -3
- package/dist/database/combineQueries.js.map +1 -1
- package/dist/database/getLocalizedPaths.d.ts.map +1 -1
- package/dist/database/getLocalizedPaths.js +3 -1
- package/dist/database/getLocalizedPaths.js.map +1 -1
- package/dist/database/migrations/readMigrationFiles.d.ts.map +1 -1
- package/dist/database/migrations/readMigrationFiles.js +3 -1
- package/dist/database/migrations/readMigrationFiles.js.map +1 -1
- package/dist/database/types.d.ts +3 -3
- package/dist/database/types.d.ts.map +1 -1
- package/dist/database/types.js.map +1 -1
- package/dist/fields/config/sanitize.d.ts +2 -1
- package/dist/fields/config/sanitize.d.ts.map +1 -1
- package/dist/fields/config/sanitize.js +28 -8
- package/dist/fields/config/sanitize.js.map +1 -1
- package/dist/fields/config/types.d.ts +56 -56
- package/dist/fields/config/types.d.ts.map +1 -1
- package/dist/fields/config/types.js.map +1 -1
- package/dist/fields/hooks/afterChange/index.d.ts +2 -2
- package/dist/fields/hooks/afterChange/index.d.ts.map +1 -1
- package/dist/fields/hooks/afterChange/index.js.map +1 -1
- package/dist/fields/hooks/afterChange/promise.d.ts +2 -2
- package/dist/fields/hooks/afterChange/promise.d.ts.map +1 -1
- package/dist/fields/hooks/afterChange/promise.js.map +1 -1
- package/dist/fields/hooks/afterChange/traverseFields.d.ts +2 -2
- package/dist/fields/hooks/afterChange/traverseFields.d.ts.map +1 -1
- package/dist/fields/hooks/afterChange/traverseFields.js.map +1 -1
- package/dist/fields/hooks/afterRead/index.d.ts +2 -2
- package/dist/fields/hooks/afterRead/index.d.ts.map +1 -1
- package/dist/fields/hooks/afterRead/index.js +3 -1
- package/dist/fields/hooks/afterRead/index.js.map +1 -1
- package/dist/fields/hooks/afterRead/promise.d.ts +2 -2
- package/dist/fields/hooks/afterRead/promise.d.ts.map +1 -1
- package/dist/fields/hooks/afterRead/promise.js +6 -2
- package/dist/fields/hooks/afterRead/promise.js.map +1 -1
- package/dist/fields/hooks/afterRead/traverseFields.d.ts +2 -2
- package/dist/fields/hooks/afterRead/traverseFields.d.ts.map +1 -1
- package/dist/fields/hooks/afterRead/traverseFields.js.map +1 -1
- package/dist/fields/hooks/beforeChange/getExistingRowDoc.d.ts.map +1 -1
- package/dist/fields/hooks/beforeChange/getExistingRowDoc.js +6 -2
- package/dist/fields/hooks/beforeChange/getExistingRowDoc.js.map +1 -1
- package/dist/fields/hooks/beforeChange/index.d.ts +2 -2
- package/dist/fields/hooks/beforeChange/index.d.ts.map +1 -1
- package/dist/fields/hooks/beforeChange/index.js.map +1 -1
- package/dist/fields/hooks/beforeChange/promise.d.ts +2 -2
- package/dist/fields/hooks/beforeChange/promise.d.ts.map +1 -1
- package/dist/fields/hooks/beforeChange/promise.js +18 -6
- package/dist/fields/hooks/beforeChange/promise.js.map +1 -1
- package/dist/fields/hooks/beforeChange/traverseFields.d.ts +2 -2
- package/dist/fields/hooks/beforeChange/traverseFields.d.ts.map +1 -1
- package/dist/fields/hooks/beforeChange/traverseFields.js.map +1 -1
- package/dist/fields/hooks/beforeValidate/index.d.ts +2 -2
- package/dist/fields/hooks/beforeValidate/index.d.ts.map +1 -1
- package/dist/fields/hooks/beforeValidate/index.js.map +1 -1
- package/dist/fields/hooks/beforeValidate/promise.d.ts +2 -2
- package/dist/fields/hooks/beforeValidate/promise.d.ts.map +1 -1
- package/dist/fields/hooks/beforeValidate/promise.js +21 -7
- package/dist/fields/hooks/beforeValidate/promise.js.map +1 -1
- package/dist/fields/hooks/beforeValidate/traverseFields.d.ts +2 -2
- package/dist/fields/hooks/beforeValidate/traverseFields.d.ts.map +1 -1
- package/dist/fields/hooks/beforeValidate/traverseFields.js.map +1 -1
- package/dist/fields/validations.d.ts +1 -1
- package/dist/fields/validations.d.ts.map +1 -1
- package/dist/fields/validations.js +57 -19
- package/dist/fields/validations.js.map +1 -1
- package/dist/globals/config/sanitize.d.ts.map +1 -1
- package/dist/globals/config/sanitize.js +45 -16
- package/dist/globals/config/sanitize.js.map +1 -1
- package/dist/globals/config/types.d.ts +2 -2
- package/dist/globals/config/types.d.ts.map +1 -1
- package/dist/globals/config/types.js.map +1 -1
- package/dist/globals/operations/docAccess.d.ts.map +1 -1
- package/dist/globals/operations/docAccess.js +3 -1
- package/dist/globals/operations/docAccess.js.map +1 -1
- package/dist/globals/operations/findVersionByID.d.ts.map +1 -1
- package/dist/globals/operations/findVersionByID.js +12 -4
- package/dist/globals/operations/findVersionByID.js.map +1 -1
- package/dist/globals/operations/restoreVersion.d.ts.map +1 -1
- package/dist/globals/operations/restoreVersion.js +3 -1
- package/dist/globals/operations/restoreVersion.js.map +1 -1
- package/dist/globals/operations/update.d.ts.map +1 -1
- package/dist/globals/operations/update.js +3 -1
- package/dist/globals/operations/update.js.map +1 -1
- package/dist/index.d.ts +7 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -7
- package/dist/index.js.map +1 -1
- package/dist/preferences/operations/findOne.d.ts.map +1 -1
- package/dist/preferences/operations/findOne.js +3 -1
- package/dist/preferences/operations/findOne.js.map +1 -1
- package/dist/types/index.d.ts +3 -3
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/uploads/cropImage.d.ts.map +1 -1
- package/dist/uploads/cropImage.js +3 -1
- package/dist/uploads/cropImage.js.map +1 -1
- package/dist/uploads/deleteAssociatedFiles.d.ts.map +1 -1
- package/dist/uploads/deleteAssociatedFiles.js +3 -1
- package/dist/uploads/deleteAssociatedFiles.js.map +1 -1
- package/dist/uploads/docWithFilenameExists.d.ts.map +1 -1
- package/dist/uploads/docWithFilenameExists.js +3 -1
- package/dist/uploads/docWithFilenameExists.js.map +1 -1
- package/dist/uploads/formatFilesize.d.ts.map +1 -1
- package/dist/uploads/formatFilesize.js +3 -1
- package/dist/uploads/formatFilesize.js.map +1 -1
- package/dist/uploads/generateFileData.d.ts.map +1 -1
- package/dist/uploads/generateFileData.js +12 -4
- package/dist/uploads/generateFileData.js.map +1 -1
- package/dist/uploads/getBaseFields.d.ts.map +1 -1
- package/dist/uploads/getBaseFields.js +6 -2
- package/dist/uploads/getBaseFields.js.map +1 -1
- package/dist/uploads/getExternalFile.d.ts.map +1 -1
- package/dist/uploads/getExternalFile.js +3 -1
- package/dist/uploads/getExternalFile.js.map +1 -1
- package/dist/uploads/imageResizer.d.ts.map +1 -1
- package/dist/uploads/imageResizer.js +35 -13
- package/dist/uploads/imageResizer.js.map +1 -1
- package/dist/uploads/optionallyAppendMetadata.d.ts.map +1 -1
- package/dist/uploads/optionallyAppendMetadata.js +3 -1
- package/dist/uploads/optionallyAppendMetadata.js.map +1 -1
- package/dist/utilities/configToJSONSchema.d.ts.map +1 -1
- package/dist/utilities/configToJSONSchema.js +12 -4
- package/dist/utilities/configToJSONSchema.js.map +1 -1
- package/dist/utilities/createArrayFromCommaDelineated.d.ts.map +1 -1
- package/dist/utilities/createArrayFromCommaDelineated.js +3 -1
- package/dist/utilities/createArrayFromCommaDelineated.js.map +1 -1
- package/dist/utilities/createLocalReq.d.ts.map +1 -1
- package/dist/utilities/createLocalReq.js +28 -12
- package/dist/utilities/createLocalReq.js.map +1 -1
- package/dist/utilities/deepCopyObject.d.ts.map +1 -1
- package/dist/utilities/deepCopyObject.js +15 -5
- package/dist/utilities/deepCopyObject.js.map +1 -1
- package/dist/utilities/dependencies/versionUtils.d.ts.map +1 -1
- package/dist/utilities/dependencies/versionUtils.js +24 -8
- package/dist/utilities/dependencies/versionUtils.js.map +1 -1
- package/dist/utilities/getEntityPolicies.d.ts.map +1 -1
- package/dist/utilities/getEntityPolicies.js +9 -3
- package/dist/utilities/getEntityPolicies.js.map +1 -1
- package/dist/utilities/getObjectDotNotation.d.ts.map +1 -1
- package/dist/utilities/getObjectDotNotation.js +3 -1
- package/dist/utilities/getObjectDotNotation.js.map +1 -1
- package/dist/utilities/getSiblingData.d.ts.map +1 -1
- package/dist/utilities/getSiblingData.js +3 -1
- package/dist/utilities/getSiblingData.js.map +1 -1
- package/dist/utilities/isReactComponent.d.ts +3 -3
- package/dist/utilities/isReactComponent.d.ts.map +1 -1
- package/dist/utilities/isReactComponent.js.map +1 -1
- package/dist/utilities/isValidID.d.ts +1 -1
- package/dist/utilities/isValidID.d.ts.map +1 -1
- package/dist/utilities/isValidID.js +3 -1
- package/dist/utilities/isValidID.js.map +1 -1
- package/dist/utilities/logger.d.ts +8 -3
- package/dist/utilities/logger.d.ts.map +1 -1
- package/dist/utilities/logger.js +22 -14
- package/dist/utilities/logger.js.map +1 -1
- package/dist/utilities/reduceFieldsToValues.d.ts.map +1 -1
- package/dist/utilities/reduceFieldsToValues.js +3 -1
- package/dist/utilities/reduceFieldsToValues.js.map +1 -1
- package/dist/utilities/telemetry/conf/index.d.ts +1 -1
- package/dist/utilities/telemetry/conf/index.d.ts.map +1 -1
- package/dist/utilities/telemetry/conf/index.js +8 -8
- package/dist/utilities/telemetry/conf/index.js.map +1 -1
- package/dist/utilities/timestamp.d.ts.map +1 -1
- package/dist/utilities/timestamp.js +3 -1
- package/dist/utilities/timestamp.js.map +1 -1
- package/dist/versions/drafts/appendVersionToQueryKey.js +1 -1
- package/dist/versions/drafts/appendVersionToQueryKey.js.map +1 -1
- package/dist/versions/drafts/getQueryDraftsSort.d.ts.map +1 -1
- package/dist/versions/drafts/getQueryDraftsSort.js +3 -1
- package/dist/versions/drafts/getQueryDraftsSort.js.map +1 -1
- package/dist/versions/saveVersion.d.ts.map +1 -1
- package/dist/versions/saveVersion.js +18 -6
- package/dist/versions/saveVersion.js.map +1 -1
- package/dist/versions/types.d.ts +4 -4
- package/dist/versions/types.d.ts.map +1 -1
- package/dist/versions/types.js.map +1 -1
- package/package.json +7 -8
|
@@ -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 /**\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 * 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 /**\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 requireFieldLevelRichTextEditor = false,\n richTextSanitizationPromises,\n validRelationships,\n}: Args): Promise<Field[]> => {\n if (!fields) return []\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) throw new MissingFieldType(field)\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 (field.localized && !config.localization) delete field.localized\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) field.hooks = {}\n if (!field.access) field.access = {}\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 })\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 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 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 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","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","localization","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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AI,CAACD,EAAE;gBACzB,IAAI1D,WAAW4D,QAAQ,OAAOA,IAAI3C,KAAK,KAAK,aAAa;oBACvD2C,IAAI3C,KAAK,GAAGvB,QAAQkE,IAAI7C,IAAI;gBAC9B;gBAEA6C,IAAItD,MAAM,GAAG,MAAML,eAAe;oBAChCE;oBACAC,oBAAoBJ,WAAW4D,OAAO,IAAIvD,QAAQD;oBAClDE,QAAQsD,IAAItD,MAAM;oBAClBC;oBACAC;oBACAC;gBACF;gBACAG,MAAM+C,IAAI,CAACD,EAAE,GAAGE;YAClB;QACF;QAEA,IAAI,gBAAgBhD,OAAO;YACzBA,MAAMC,UAAU,GAAG;QACrB;QAEAP,MAAM,CAACI,EAAE,GAAGE;IACd;IAEA,OAAON;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","isRoot","i18n","Object","keys","translations","blocks","block","concat","slug","j","tabs","tab"],"mappings":"AAAA,SAASA,eAAe,QAAQ,qCAAoC;AAMpE,SACEC,kBAAkB,EAClBC,gBAAgB,EAChBC,wBAAwB,EACxBC,gBAAgB,QACX,wBAAuB;AAC9B,SAASC,iBAAiB,QAAQ,oCAAmC;AACrE,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,EAAE;QAEvB,IAAI,gBAAgBE,SAASA,MAAMC,UAAU,KAAK,MAAM;YACtD;QACF;QAEA,IAAI,CAACD,MAAME,IAAI,EAAE;YACf,MAAM,IAAIxB,iBAAiBsB;QAC7B;QAEA,8DAA8D;QAC9D,IAAId,iBAAiBc,UAAUA,MAAMG,IAAI,CAACC,QAAQ,CAAC,MAAM;YACvD,MAAM,IAAI5B,iBAAiBwB,OAAOA,MAAMG,IAAI;QAC9C;QAEA,aAAa;QACb,IACE,UAAUH,SACVA,MAAMG,IAAI,IACV,OAAOH,MAAMK,KAAK,KAAK,YACvB,OAAOL,MAAMK,KAAK,KAAK,YACvB,OAAOL,MAAMK,KAAK,KAAK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;AACT,EAAC"}
|
|
@@ -3,7 +3,7 @@ import type { JSONSchema4 } 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,
|
|
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:
|
|
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:
|
|
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
|
-
}) =>
|
|
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>) =>
|
|
118
|
-
export type FilterOptions<TData = any> = ((options: FilterOptionsProps<TData>) =>
|
|
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?:
|
|
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)[] |
|
|
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 |
|
|
1074
|
-
export type ClientField = ArrayFieldClient | BlockFieldClient | CheckboxFieldClient | CodeFieldClient | CollapsibleFieldClient | DateFieldClient | EmailFieldClient | GroupFieldClient | JSONFieldClient | NumberFieldClient | PointFieldClient | RadioFieldClient | RelationshipFieldClient | RichTextFieldClient | RowFieldClient | SelectFieldClient | TabsFieldClient |
|
|
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 |
|
|
1081
|
-
export type FieldAffectingDataClient = ArrayFieldClient | BlockFieldClient | CheckboxFieldClient | CodeFieldClient | DateFieldClient | EmailFieldClient | GroupFieldClient | JSONFieldClient | NumberFieldClient | PointFieldClient | RadioFieldClient | RelationshipFieldClient | RichTextFieldClient | SelectFieldClient | TabAsFieldClient |
|
|
1082
|
-
export type NonPresentationalField = ArrayField | BlockField | CheckboxField | CodeField | CollapsibleField | DateField | EmailField | GroupField | JSONField | NumberField | PointField | RadioField | RelationshipField | RichTextField | RowField | SelectField | TabsField |
|
|
1083
|
-
export type NonPresentationalFieldClient = ArrayFieldClient | BlockFieldClient | CheckboxFieldClient | CodeFieldClient | CollapsibleFieldClient | DateFieldClient | EmailFieldClient | GroupFieldClient | JSONFieldClient | NumberFieldClient | PointFieldClient | RadioFieldClient | RelationshipFieldClient | RichTextFieldClient | RowFieldClient | SelectFieldClient | TabsFieldClient |
|
|
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;
|