contentful-management
Version:
Client for Contentful's Content Management API
48 lines (47 loc) • 1.77 kB
TypeScript
import type { Except } from 'type-fest';
import type { CursorPaginationParams, ExoCursorPaginatedCollectionProp, ExoMetadataProps, ExoQueryFilters, Link } from '../common-types';
import type { ComponentSlotDefinition, ComponentTypeContentProperty, ComponentTypeDesignProperty, ComponentTypeViewport, DataAssemblyLink, TreeNodeV2 } from './component-type';
export type ComponentSys = {
id: string;
type: 'Component';
version: number;
space: Link<'Space'>;
environment: Link<'Environment'>;
fieldStatus?: Record<string, Record<string, 'draft' | 'published' | 'changed'>>;
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;
viewports: ComponentTypeViewport[];
contentProperties: ComponentTypeContentProperty[];
designProperties: ComponentTypeDesignProperty[];
componentTree?: TreeNodeV2[];
slots?: ComponentSlotDefinition[];
metadata?: ExoMetadataProps;
dataAssemblies?: DataAssemblyLink[];
};
export type CreateComponentProps = Except<ComponentProps, 'sys'>;
export type UpsertComponentProps = Except<ComponentProps, 'sys'> & {
sys: {
id: string;
type: 'Component';
version?: number;
};
};
export type ComponentQueryOptions = CursorPaginationParams & ExoQueryFilters & {
order?: string;
};
export type ComponentCollection = ExoCursorPaginatedCollectionProp<ComponentProps>;