n8n-workflow
Advanced tools
Comparing version 0.60.0 to 0.61.0
@@ -159,3 +159,3 @@ import { Workflow } from './Workflow'; | ||
prepareOutputData(outputData: INodeExecutionData[], outputIndex?: number): Promise<INodeExecutionData[][]>; | ||
sendMessageToUI(message: string): void; | ||
sendMessageToUI(message: any): void; | ||
helpers: { | ||
@@ -583,3 +583,3 @@ [key: string]: (...args: any[]) => any; | ||
restApiUrl: string; | ||
sendMessageToUI?: (source: string, message: string) => void; | ||
sendMessageToUI?: (source: string, message: any) => void; | ||
timezone: string; | ||
@@ -610,7 +610,8 @@ webhookBaseUrl: string; | ||
} | ||
export interface IRawErrorObject { | ||
[key: string]: string | object | number | boolean | undefined | null | string[] | object[] | number[] | boolean[]; | ||
} | ||
export interface IStatusCodeMessages { | ||
[key: string]: string; | ||
} | ||
export declare type JsonValue = string | number | boolean | null | JsonObject | JsonValue[]; | ||
export declare type JsonObject = { | ||
[key: string]: JsonValue; | ||
}; |
@@ -1,10 +0,11 @@ | ||
import { INode, IRawErrorObject } from '.'; | ||
import { INode, JsonObject } from '.'; | ||
declare abstract class NodeError extends Error { | ||
description: string | null | undefined; | ||
cause: Error | IRawErrorObject; | ||
cause: Error | JsonObject; | ||
node: INode; | ||
timestamp: number; | ||
constructor(node: INode, error: Error | IRawErrorObject); | ||
protected findProperty(error: IRawErrorObject, potentialKeys: string[], traversalKeys: string[]): string | null; | ||
private isTraversableObject; | ||
constructor(node: INode, error: Error | JsonObject); | ||
protected findProperty(error: JsonObject, potentialKeys: string[], traversalKeys?: string[]): string | null; | ||
protected isTraversableObject(value: any): value is JsonObject; | ||
protected removeCircularRefs(obj: JsonObject, seen?: Set<unknown>): void; | ||
} | ||
@@ -16,3 +17,3 @@ export declare class NodeOperationError extends NodeError { | ||
httpCode: string | null; | ||
constructor(node: INode, error: IRawErrorObject, { message, description, httpCode, parseXml }?: { | ||
constructor(node: INode, error: JsonObject, { message, description, httpCode, parseXml }?: { | ||
message?: string; | ||
@@ -19,0 +20,0 @@ description?: string; |
@@ -35,2 +35,3 @@ "use strict"; | ||
super(); | ||
this.removeCircularRefs(error); | ||
this.name = this.constructor.name; | ||
@@ -44,3 +45,3 @@ this.cause = error; | ||
} | ||
findProperty(error, potentialKeys, traversalKeys) { | ||
findProperty(error, potentialKeys, traversalKeys = []) { | ||
for (const key of potentialKeys) { | ||
@@ -59,3 +60,3 @@ if (error[key]) { | ||
if (this.isTraversableObject(error)) { | ||
return this.findProperty(error, potentialKeys, traversalKeys); | ||
return this.findProperty(error, potentialKeys); | ||
} | ||
@@ -70,2 +71,8 @@ return null; | ||
} | ||
if (this.isTraversableObject(error[key])) { | ||
const property = this.findProperty(error[key], potentialKeys); | ||
if (property) { | ||
return property; | ||
} | ||
} | ||
} | ||
@@ -86,2 +93,22 @@ } | ||
} | ||
removeCircularRefs(obj, seen = new Set()) { | ||
seen.add(obj); | ||
Object.entries(obj).forEach(([key, value]) => { | ||
if (this.isTraversableObject(value)) { | ||
seen.has(value) ? obj[key] = { circularReference: true } : this.removeCircularRefs(value, seen); | ||
return; | ||
} | ||
if (Array.isArray(value)) { | ||
value.forEach((val, index) => { | ||
if (seen.has(val)) { | ||
value[index] = { circularReference: true }; | ||
return; | ||
} | ||
if (this.isTraversableObject(val)) { | ||
this.removeCircularRefs(val, seen); | ||
} | ||
}); | ||
} | ||
}); | ||
} | ||
} | ||
@@ -88,0 +115,0 @@ class NodeOperationError extends NodeError { |
{ | ||
"name": "n8n-workflow", | ||
"version": "0.60.0", | ||
"version": "0.61.0", | ||
"description": "Workflow base code of n8n", | ||
@@ -5,0 +5,0 @@ "license": "SEE LICENSE IN LICENSE.md", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
463040
7356