UNPKG

@datocms/cma-client

Version:
32 lines (31 loc) 1.5 kB
import { type LocalizedFieldValue } from '../utilities/normalizedFieldValues'; import type { SlugEditorConfiguration } from './appearance/slug'; import type { UniqueValidator } from './validators'; import type { LengthValidator } from './validators/length'; import type { RequiredValidator } from './validators/required'; import type { SlugFormatValidator } from './validators/slug_format'; import type { SlugTitleFieldValidator } from './validators/slug_title_field'; export type SlugFieldValue = string | null; export declare function isSlugFieldValue(value: unknown): value is SlugFieldValue; export declare function isLocalizedSlugFieldValue(value: unknown): value is LocalizedFieldValue<SlugFieldValue>; export type SlugFieldValidators = { /** Value must be specified or it won't be valid */ required?: RequiredValidator; /** The value must be unique across the whole collection of records */ unique?: UniqueValidator; /** Accept strings only with a specified number of characters */ length?: LengthValidator; /** Only accept slugs having a specific format */ slug_format?: SlugFormatValidator; /** Specifies the ID of the Single_line string field that will be used to generate the slug */ slug_title_field?: SlugTitleFieldValidator; }; export type SlugFieldAppearance = { editor: 'slug'; parameters: SlugEditorConfiguration; } | { /** Plugin ID */ editor: string; /** Plugin configuration */ parameters: Record<string, unknown>; };