UNPKG

contentful-management

Version:
122 lines (121 loc) 3.65 kB
import type { Link, MetadataProps, SysLink } from '../common-types'; export type ComponentTypeQueryOptions = { _experienceCtId: string; skip?: number; limit?: number; }; export type ComponentTypeViewport = { id: string; query: string; displayName: string; previewSize: string; }; export type ComponentTypeContentProperty = { id: string; name: string; type: string; required: boolean; defaultValue?: unknown; }; export type ComponentTypeDesignPropertyValidation = { value: string | number | boolean; name: string; description?: string; }; export type ComponentTypeDesignProperty = { id: string; name: string; type: string; required: boolean; description?: string; defaultValue?: unknown; validations?: { in: ComponentTypeDesignPropertyValidation[]; }; designTokenSet?: string[]; }; export type ComponentTypeDimensionKeyMap = { designProperties: Record<string, Record<string, string>>; }; export type ContentPropertyPointerValue = `$contentProperties/${string}` | `$contentBindings/${string}`; export type DesignPropertyPointerValue = `$designProperties/${string}`; export type ManualDesignValue = { type: 'ManualDesignValue'; value: string | number | boolean | Record<string, unknown>; }; export type DesignTokenValue = { type: 'DesignValue'; token: string; }; export type DesignPropertyValue = ManualDesignValue | DesignTokenValue | DesignPropertyPointerValue | Record<string, ManualDesignValue | DesignTokenValue | DesignPropertyPointerValue>; export type ComponentNode = { id: string; nodeType: 'Component'; componentTypeId: string; contentProperties: Record<string, ContentPropertyPointerValue | unknown>; designProperties: Record<string, DesignPropertyValue>; slots: Record<string, TreeNode[]>; contentBindings?: string; }; export type ViewNode = { id: string; nodeType: 'View'; viewId: string; }; export type SlotNode = { id: string; nodeType: 'Slot'; slotId: string; }; export type TreeNode = ComponentNode | ViewNode | SlotNode; export type ComponentTypeDataTypeField = { id: string; name: string; type: string; required: boolean; source?: string; }; export type DataAssemblyLink = Link<'DataAssembly'>; export type ComponentTypeContentBindings = DataAssemblyLink['sys'] & { required: boolean; dataType: ComponentTypeDataTypeField[]; }; export type ComponentTypeSlotDefinition = { id: string; name: string; componentTypeId: string[]; required: boolean; validations: unknown[]; }; export type ComponentTypeSys = { id: string; type: 'ComponentType'; version: number; space: SysLink; environment: SysLink; fieldStatus?: Record<string, Record<string, 'draft' | 'published' | 'changed'>>; publishedAt?: string; publishedVersion?: number; publishedCounter?: number; firstPublishedAt?: string; publishedBy?: Link<'User'> | Link<'AppDefinition'>; variant?: string; createdAt?: string; createdBy?: Link<'User'>; updatedAt?: string; updatedBy?: Link<'User'>; }; export type ComponentTypeProps = { sys: ComponentTypeSys; name: string; description: string; viewports: ComponentTypeViewport[]; contentProperties: ComponentTypeContentProperty[]; designProperties: ComponentTypeDesignProperty[]; dimensionKeyMap: ComponentTypeDimensionKeyMap; componentTree?: TreeNode[]; contentBindings?: ComponentTypeContentBindings; slots?: ComponentTypeSlotDefinition[]; metadata?: MetadataProps; dataAssemblies?: DataAssemblyLink[]; };