import type { IDataObject } from 'n8n-workflow'; export type TwentyApiSurface = 'root' | 'coreRest' | 'coreGraphql' | 'metadataRest' | 'metadataGraphql'; export interface NormalizedObjectDefinition { id: string; universalIdentifier?: string; apiNameSingular: string; apiNamePlural: string; labelSingular: string; labelPlural: string; description?: string; icon?: string; isActive: boolean; isCustom?: boolean; isRemote: boolean; isSystem: boolean; isReadOnly: boolean; isCreatable?: boolean; isSearchable: boolean; fields: NormalizedFieldDefinition[]; } export interface NormalizedFieldDefinition { id: string; universalIdentifier?: string; apiName: string; label: string; type: string; description?: string; icon?: string; isActive: boolean; isCustom?: boolean; isNullable: boolean; isUnique: boolean; isRequired: boolean; isReadOnly: boolean; isSystem: boolean; defaultValue?: unknown; options?: unknown; settings?: unknown; relation?: NormalizedRelationDefinition; morphRelations?: NormalizedRelationDefinition[]; } export interface NormalizedRelationEndpoint { objectId: string; objectApiNameSingular: string; objectApiNamePlural: string; fieldId: string; fieldApiName: string; } export interface NormalizedRelationDefinition { type: string; source: NormalizedRelationEndpoint; target: NormalizedRelationEndpoint; } export type TwentyRecord = Readonly; export interface ObjectMetadataService { getObject(apiName: string): Promise; getObjects(): Promise; } export interface FieldMetadataService { getFields(objectApiName: string): Promise; } export interface RecordGetManyOptions { returnAll: boolean; limit?: number; filter?: string; orderBy?: string; fields?: unknown; depth?: unknown; } export interface RecordGetOptions { fields?: unknown; depth?: unknown; } export interface RecordDeleteResult { success: true; recordId: string; objectApiName: string; } export interface RecordService { create(objectApiName: string, input: unknown): Promise; get(objectApiName: string, recordId: string, options?: RecordGetOptions): Promise; getMany(objectApiName: string, options: RecordGetManyOptions): Promise; update(objectApiName: string, recordId: string, input: unknown): Promise; delete(objectApiName: string, recordId: string): Promise; }