import type { Except } from 'type-fest'; import type { CursorPaginationParams, ExoCursorPaginatedCollectionProp, ExoMetadataProps, ExoQueryFilters, Link } from '../common-types'; import type { ComponentSlotDefinition, ComponentTypeContentProperty, ComponentTypeDesignProperty, DataAssemblyLink, TreeNodeV2 } from './component-type'; export type ComponentSys = { id: string; type: 'Component'; version: number; space: Link<'Space'>; environment: Link<'Environment'>; fieldStatus?: Record>; publishedAt?: string; publishedVersion?: number; publishedCounter?: number; firstPublishedAt?: string; publishedBy?: Link<'User'> | Link<'AppDefinition'>; variant?: string; variantType?: string; variantDimension?: string; createdAt: string; createdBy: Link<'User'>; updatedAt: string; updatedBy: Link<'User'>; }; export type ComponentProps = { sys: ComponentSys; name: string; description: string; contentProperties: ComponentTypeContentProperty[]; designProperties: ComponentTypeDesignProperty[]; /** * `null` marks a coded component (no tree); `[]` is a composed component with an empty tree. * The Content Management API requires this field on create and update, so always send it. */ componentTree?: TreeNodeV2[] | null; slots?: ComponentSlotDefinition[]; metadata?: ExoMetadataProps; dataAssemblies?: DataAssemblyLink[]; }; export type CreateComponentProps = Except; export type UpsertComponentProps = Except & { sys: { id: string; type: 'Component'; version?: number; }; }; export type ComponentQueryOptions = CursorPaginationParams & ExoQueryFilters & { order?: string; }; export type ComponentCollection = ExoCursorPaginatedCollectionProp;