import type { CollectionConfig, SanitizedJoin, SanitizedJoins } from '../../collections/config/types.js'; import type { Config, SanitizedConfig } from '../../config/types.js'; import type { GlobalConfig } from '../../globals/config/types.js'; import type { OrderableJoinInfo } from './sanitizeJoinField.js'; import type { Field } from './types.js'; type SanitizeFieldsArgs = { collectionConfig?: CollectionConfig; config: Config; existingFieldNames?: Set; fields: Field[]; globalConfig?: GlobalConfig; /** * Used to prevent unnecessary sanitization of fields that are not top-level. */ isTopLevelField?: boolean; joinPath?: string; /** * When not passed in, assume that join are not supported (globals, arrays, blocks) */ joins?: SanitizedJoins; /** * Tracker for orderable join fields - populated during sanitization */ orderableJoins?: OrderableJoinInfo[]; /** * A string of '-' separated indexes representing where * to find this field in a given field schema array. */ parentIndexPath?: string; parentIsLocalized: boolean; /** * Path for parent fields relative to their position in the schema. */ parentSchemaPath?: string; polymorphicJoins?: SanitizedJoin[]; /** * 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. * * @default false */ requireFieldLevelRichTextEditor?: boolean; /** * If this property is set, RichText fields won't be sanitized immediately. Instead, they will be added to this array as promises * so that you can sanitize them together, after the config has been sanitized. */ richTextSanitizationPromises?: Array<(config: SanitizedConfig) => Promise>; /** * If not null, will validate that upload and relationship fields do not relate to a collection that is not in this array. * This validation will be skipped if validRelationships is null. */ validRelationships: null | string[]; }; export type SanitizeFieldArgs = { collectionConfig?: CollectionConfig; config: Config; existingFieldNames: Set; field: Field; globalConfig?: GlobalConfig; /** * The index of this field in the parent fields array */ index: number; /** * Used to prevent unnecessary sanitization of fields that are not top-level. */ isTopLevelField: boolean; joinPath: string; /** * When not passed in, assume that joins are not supported (globals, arrays, blocks) */ joins?: SanitizedJoins; /** * Tracker for orderable join fields - populated during sanitization */ orderableJoins?: OrderableJoinInfo[]; parentIndexPath: string; parentIsLocalized: boolean; parentSchemaPath: string; polymorphicJoins?: SanitizedJoin[]; requireFieldLevelRichTextEditor: boolean; richTextSanitizationPromises?: Array<(config: SanitizedConfig) => Promise>; validRelationships: null | string[]; }; type SanitizeFieldResult = { /** * Fields to insert after this field (e.g., timezone field) */ fieldsToInsert?: Field[]; }; /** * Sanitize a single field. Handles all per-field logic including: * - Validation setup * - Hooks/access/admin defaults * - Type-specific handling * - Recursive sanitization of nested fields * * @returns Result containing any fields to insert after this one */ export declare const sanitizeField: ({ collectionConfig, config, existingFieldNames, field, globalConfig, index, isTopLevelField, joinPath, joins, orderableJoins, parentIndexPath, parentIsLocalized, parentSchemaPath, polymorphicJoins, requireFieldLevelRichTextEditor, richTextSanitizationPromises, validRelationships, }: SanitizeFieldArgs) => Promise; export declare const sanitizeFields: ({ collectionConfig, config, existingFieldNames, fields, globalConfig, isTopLevelField, joinPath, joins, orderableJoins, parentIndexPath, parentIsLocalized, parentSchemaPath, polymorphicJoins, requireFieldLevelRichTextEditor, richTextSanitizationPromises, validRelationships, }: SanitizeFieldsArgs) => Promise; export {}; //# sourceMappingURL=sanitize.d.ts.map