import type { KeyValueMap } from '../common-types'; import type { INLINES, BLOCKS } from '@contentful/rich-text-types'; interface NumRange { min?: number; max?: number; } interface DateRange { min?: string; max?: string; } interface RegExp { pattern: string; flags: string; } interface NodesValidation { [BLOCKS.EMBEDDED_ENTRY]?: Pick[]; [INLINES.EMBEDDED_ENTRY]?: Pick[]; [INLINES.ENTRY_HYPERLINK]?: Pick[]; [BLOCKS.EMBEDDED_ASSET]?: Pick[]; [INLINES.ASSET_HYPERLINK]?: Pick[]; [BLOCKS.EMBEDDED_RESOURCE]?: { validations: Pick[]; allowedResources: ContentTypeAllowedResources[]; }; [INLINES.EMBEDDED_RESOURCE]?: { validations: Pick[]; allowedResources: ContentTypeAllowedResources[]; }; [INLINES.RESOURCE_HYPERLINK]?: { validations: Pick[]; allowedResources: ContentTypeAllowedResources[]; }; } export interface ContentTypeFieldValidation { linkContentType?: string[]; in?: (string | number)[]; linkMimetypeGroup?: string[]; enabledNodeTypes?: (`${BLOCKS}` | `${INLINES}`)[]; enabledMarks?: string[]; unique?: boolean; size?: NumRange; range?: NumRange; dateRange?: DateRange; regexp?: RegExp; message?: string | null; prohibitRegexp?: RegExp; assetImageDimensions?: { width?: NumRange; height?: NumRange; }; assetFileSize?: NumRange; nodes?: NodesValidation; } interface Item { type: string; linkType?: string; validations?: ContentTypeFieldValidation[]; } type ContentTypeAllowedResources = ContentfulEntryResource | ExternalResource; export interface ContentfulEntryResource { type: 'Contentful:Entry'; source: string; contentTypes: string[]; } export interface ExternalResource { type: string; } export interface ContentFields extends Item { id: string; name: string; required: boolean; localized: boolean; disabled?: boolean; omitted?: boolean; deleted?: boolean; items?: Item; apiName?: string; defaultValue?: T; allowedResources?: ContentTypeAllowedResources[]; } export {};