From 1d4f92a6575a7af6dbd4f03b61202cb56badf6a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Ovejero?= Date: Tue, 23 Aug 2022 15:27:04 +0200 Subject: [PATCH] fix(cli): Fix excessive instantiation type error for flattened execution (#3921) * :blue_book: Fix excessive instantiation error * :recycle: Simplify interface for TypeORM --- packages/cli/src/Interfaces.ts | 2 +- .../src/databases/entities/WorkflowEntity.ts | 23 +++++++++++++++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/packages/cli/src/Interfaces.ts b/packages/cli/src/Interfaces.ts index 3794ada3e2..f25cea743f 100644 --- a/packages/cli/src/Interfaces.ts +++ b/packages/cli/src/Interfaces.ts @@ -227,7 +227,7 @@ export interface IExecutionFlattedDb extends IExecutionBase { id: number | string; data: string; waitTill?: Date | null; - workflowData: IWorkflowBase; + workflowData: Omit; } export interface IExecutionFlattedResponse extends IExecutionFlatted { diff --git a/packages/cli/src/databases/entities/WorkflowEntity.ts b/packages/cli/src/databases/entities/WorkflowEntity.ts index d37decc15d..cbc7c5269d 100644 --- a/packages/cli/src/databases/entities/WorkflowEntity.ts +++ b/packages/cli/src/databases/entities/WorkflowEntity.ts @@ -2,7 +2,14 @@ /* eslint-disable import/no-cycle */ import { Length } from 'class-validator'; -import { IConnections, IDataObject, INode, IPinData, IWorkflowSettings } from 'n8n-workflow'; +import { + IBinaryKeyData, + IConnections, + IDataObject, + INode, + IPairedItemData, + IWorkflowSettings, +} from 'n8n-workflow'; import { BeforeUpdate, @@ -122,10 +129,22 @@ export class WorkflowEntity implements IWorkflowDb { nullable: true, transformer: sqlite.jsonColumn, }) - pinData: IPinData; + pinData: ISimplifiedPinData; @BeforeUpdate() setUpdateDate() { this.updatedAt = new Date(); } } + +/** + * Simplified to prevent excessively deep type instantiation error from + * `INodeExecutionData` in `IPinData` in a TypeORM entity field. + */ +export interface ISimplifiedPinData { + [nodeName: string]: Array<{ + json: IDataObject; + binary?: IBinaryKeyData; + pairedItem?: IPairedItemData | IPairedItemData[] | number; + }>; +}