import type { Schema, Struct, UID } from '@strapi/types'; import type { PrimitiveType } from 'react-intl'; export type IntlLabel = { id: string; defaultMessage: string; values?: Record; }; export type FormChange = { target: { name: string; value?: TValue; type?: TType; }; }; export type FormChangeHandler = (value: FormChange) => void; export type DifferentAttributesKind = 'Populatable' | 'NonPopulatable' | 'Any'; export type Status = 'UNCHANGED' | 'CHANGED' | 'REMOVED' | 'NEW'; export type AttributeConditionValue = string | number | boolean; export type AttributeConditionRule = [{ var: string; }, AttributeConditionValue]; export type AttributeConditions = { visible?: Record; }; export type Base = { name: string; status?: Status; customField?: string; conditions?: AttributeConditions; }; /** * A single attribute rename hop, recorded in the exact order the user performed * it so the server can replay it as a data-preserving migration. Because the CTB * forbids duplicate field names at any instant, the recorded sequence is always * collision-free (a swap is expressed through the user's own intermediate name). * Only renames of fields that already exist in the database are tracked — never * brand-new fields. Transient (admin only). */ export type RenameHop = { oldName: string; newName: string; }; export type Relation = Base & { type: 'relation'; relation: Schema.Attribute.RelationKind.Any; target: string; targetAttribute?: string | null; configurable?: boolean; required?: boolean; private?: boolean; pluginOptions?: Record; }; export type Media = Base & { type: 'media'; multiple?: boolean; required?: boolean; configurable?: boolean; private?: boolean; allowedTypes?: string[]; pluginOptions?: Record; }; export type AnyAttribute = Base & (Schema.Attribute.BigInteger | Schema.Attribute.Boolean | Schema.Attribute.Blocks | Schema.Attribute.Component | Schema.Attribute.DateTime | Schema.Attribute.Date | Schema.Attribute.Decimal | Schema.Attribute.DynamicZone | Schema.Attribute.Email | Schema.Attribute.Enumeration | Schema.Attribute.Float | Schema.Attribute.Integer | Schema.Attribute.JSON | Schema.Attribute.Password | Schema.Attribute.RichText | Schema.Attribute.String | Schema.Attribute.Text | Schema.Attribute.Time | Schema.Attribute.Timestamp | Schema.Attribute.UID | Media | Relation); /** * Attribute names involved in rename chains the user declined to preserve data * for (`prompt-after-edit` mode). A later hop touching one of these names is * declined without a prompt so a chain is never partially preserved. Transient * (admin only), never sent to the server. */ export type DeclinedRenameNames = string[]; export type Component = Omit & { status: Status; attributes: Array; renames?: RenameHop[]; declinedRenameNames?: DeclinedRenameNames; }; export type ContentType = Omit & { plugin?: string; visible: boolean; status: Status; restrictRelationsTo: Schema.Attribute.RelationKind.Any[] | null; attributes: Array; renames?: RenameHop[]; declinedRenameNames?: DeclinedRenameNames; }; export type Components = Record; export type ContentTypes = Record;