n8n-workflow
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -118,2 +118,8 @@ "use strict"; | ||
}, | ||
has(target, key) { | ||
if (deletedProperties.indexOf(key) !== -1) | ||
return false; | ||
const newKeys = Object.keys(newData); | ||
return Reflect.has(newKeys.length ? newData : target, key); | ||
}, | ||
ownKeys(target) { | ||
@@ -120,0 +126,0 @@ const originalKeys = Reflect.ownKeys(target); |
import * as tmpl from '@n8n_io/riot-tmpl'; | ||
import type { IExecuteData, INode, INodeExecutionData, INodeParameterResourceLocator, INodeParameters, IRunExecutionData, IWorkflowDataProxyAdditionalKeys, NodeParameterValue, NodeParameterValueType, WorkflowExecuteMode } from './Interfaces'; | ||
import { ExpressionError } from './ExpressionError'; | ||
import type { Workflow } from './Workflow'; | ||
export declare const isSyntaxError: (error: unknown) => error is SyntaxError; | ||
export declare const isExpressionError: (error: unknown) => error is ExpressionError; | ||
export declare const isTypeError: (error: unknown) => error is TypeError; | ||
export declare class Expression { | ||
@@ -5,0 +9,0 @@ workflow: Workflow; |
@@ -26,3 +26,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Expression = void 0; | ||
exports.Expression = exports.isTypeError = exports.isExpressionError = exports.isSyntaxError = void 0; | ||
const tmpl = __importStar(require("@n8n_io/riot-tmpl")); | ||
@@ -35,6 +35,16 @@ const luxon_1 = require("luxon"); | ||
const ExpressionExtension_1 = require("./Extensions/ExpressionExtension"); | ||
const utils_1 = require("./utils"); | ||
const IS_FRONTEND_IN_DEV_MODE = typeof process === 'object' && | ||
Object.keys(process).length === 1 && | ||
'env' in process && | ||
Object.keys(process.env).length === 0; | ||
const IS_FRONTEND = typeof process === 'undefined' || IS_FRONTEND_IN_DEV_MODE; | ||
const isSyntaxError = (error) => error instanceof SyntaxError || (error instanceof Error && error.name === 'SyntaxError'); | ||
exports.isSyntaxError = isSyntaxError; | ||
const isExpressionError = (error) => error instanceof ExpressionError_1.ExpressionError || error instanceof ExpressionError_1.ExpressionExtensionError; | ||
exports.isExpressionError = isExpressionError; | ||
const isTypeError = (error) => error instanceof TypeError || (error instanceof Error && error.name === 'TypeError'); | ||
exports.isTypeError = isTypeError; | ||
tmpl.brackets.set('{{ }}'); | ||
tmpl.tmpl.errorHandler = (error) => { | ||
if ((0, utils_1.isExpressionError)(error)) | ||
if ((0, exports.isExpressionError)(error)) | ||
throw error; | ||
@@ -214,7 +224,7 @@ }; | ||
catch (error) { | ||
if ((0, utils_1.isExpressionError)(error)) | ||
if ((0, exports.isExpressionError)(error)) | ||
throw error; | ||
if ((0, utils_1.isSyntaxError)(error)) | ||
if ((0, exports.isSyntaxError)(error)) | ||
throw new Error('invalid syntax'); | ||
if ((0, utils_1.isTypeError)(error) && utils_1.IS_FRONTEND && error.message.endsWith('is not a function')) { | ||
if ((0, exports.isTypeError)(error) && IS_FRONTEND && error.message.endsWith('is not a function')) { | ||
const match = error.message.match(/(?<msg>[^.]+is not a function)/); | ||
@@ -221,0 +231,0 @@ if (!((_a = match === null || match === void 0 ? void 0 : match.groups) === null || _a === void 0 ? void 0 : _a.msg)) |
@@ -26,3 +26,3 @@ /// <reference types="node" /> | ||
export { LoggerProxy, NodeHelpers, ObservableObject, TelemetryHelpers }; | ||
export { isObjectEmpty, deepCopy, jsonParse, jsonStringify, sleep, fileTypeFromMimeType, assert, } from './utils'; | ||
export { isObjectEmpty, deepCopy, jsonParse, jsonStringify, sleep, fileTypeFromMimeType, assert, removeCircularRefs, } from './utils'; | ||
export { isINodeProperties, isINodePropertyOptions, isINodePropertyCollection, isINodePropertiesList, isINodePropertyCollectionList, isINodePropertyOptionsList, isResourceMapperValue, } from './type-guards'; | ||
@@ -29,0 +29,0 @@ export { ExpressionExtensions } from './Extensions'; |
@@ -29,3 +29,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.NativeMethods = exports.ExpressionExtensions = exports.isResourceMapperValue = exports.isINodePropertyOptionsList = exports.isINodePropertyCollectionList = exports.isINodePropertiesList = exports.isINodePropertyCollection = exports.isINodePropertyOptions = exports.isINodeProperties = exports.assert = exports.fileTypeFromMimeType = exports.sleep = exports.jsonStringify = exports.jsonParse = exports.deepCopy = exports.isObjectEmpty = exports.TelemetryHelpers = exports.ObservableObject = exports.NodeHelpers = exports.LoggerProxy = exports.ErrorReporterProxy = void 0; | ||
exports.NativeMethods = exports.ExpressionExtensions = exports.isResourceMapperValue = exports.isINodePropertyOptionsList = exports.isINodePropertyCollectionList = exports.isINodePropertiesList = exports.isINodePropertyCollection = exports.isINodePropertyOptions = exports.isINodeProperties = exports.removeCircularRefs = exports.assert = exports.fileTypeFromMimeType = exports.sleep = exports.jsonStringify = exports.jsonParse = exports.deepCopy = exports.isObjectEmpty = exports.TelemetryHelpers = exports.ObservableObject = exports.NodeHelpers = exports.LoggerProxy = exports.ErrorReporterProxy = void 0; | ||
const LoggerProxy = __importStar(require("./LoggerProxy")); | ||
@@ -66,2 +66,3 @@ exports.LoggerProxy = LoggerProxy; | ||
Object.defineProperty(exports, "assert", { enumerable: true, get: function () { return utils_1.assert; } }); | ||
Object.defineProperty(exports, "removeCircularRefs", { enumerable: true, get: function () { return utils_1.removeCircularRefs; } }); | ||
var type_guards_1 = require("./type-guards"); | ||
@@ -68,0 +69,0 @@ Object.defineProperty(exports, "isINodeProperties", { enumerable: true, get: function () { return type_guards_1.isINodeProperties; } }); |
@@ -406,2 +406,3 @@ /// <reference types="node" /> | ||
createReadStream(path: PathLike): Promise<Readable>; | ||
getStoragePath(): string; | ||
} | ||
@@ -1033,2 +1034,3 @@ export interface BinaryHelperFunctions { | ||
nodesToTestWith?: string[]; | ||
extends?: string[]; | ||
}; | ||
@@ -1373,6 +1375,6 @@ export type NodeLoadingDetails = LoadingDetails; | ||
nodeExecutionStatus?: { | ||
[key: string]: IExceutionSummaryNodeExecutionResult; | ||
[key: string]: IExecutionSummaryNodeExecutionResult; | ||
}; | ||
} | ||
export interface IExceutionSummaryNodeExecutionResult { | ||
export interface IExecutionSummaryNodeExecutionResult { | ||
executionStatus: ExecutionStatus; | ||
@@ -1379,0 +1381,0 @@ errors?: Array<{ |
@@ -20,4 +20,2 @@ import type { IDataObject, INode, JsonObject } from './Interfaces'; | ||
protected findProperty(jsonError: JsonObject, potentialKeys: string[], traversalKeys?: string[]): string | null; | ||
protected isTraversableObject(value: any): value is JsonObject; | ||
protected removeCircularRefs(obj: JsonObject, seen?: Set<unknown>): void; | ||
} | ||
@@ -24,0 +22,0 @@ interface NodeOperationErrorOptions { |
@@ -5,2 +5,3 @@ "use strict"; | ||
const xml2js_1 = require("xml2js"); | ||
const utils_1 = require("./utils"); | ||
const ERROR_MESSAGE_PROPERTIES = [ | ||
@@ -90,3 +91,3 @@ 'cause', | ||
return jsonError.toString(); | ||
if (this.isTraversableObject(jsonError)) { | ||
if ((0, utils_1.isTraversableObject)(jsonError)) { | ||
return this.findProperty(jsonError, potentialKeys); | ||
@@ -102,3 +103,3 @@ } | ||
} | ||
if (this.isTraversableObject(value)) { | ||
if ((0, utils_1.isTraversableObject)(value)) { | ||
const property = this.findProperty(value, potentialKeys); | ||
@@ -113,3 +114,3 @@ if (property) { | ||
const value = jsonError[key]; | ||
if (this.isTraversableObject(value)) { | ||
if ((0, utils_1.isTraversableObject)(value)) { | ||
const property = this.findProperty(value, potentialKeys, traversalKeys); | ||
@@ -123,30 +124,2 @@ if (property) { | ||
} | ||
isTraversableObject(value) { | ||
return (value && | ||
typeof value === 'object' && | ||
!Array.isArray(value) && | ||
!!Object.keys(value).length); | ||
} | ||
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); | ||
} | ||
}); | ||
} | ||
}); | ||
} | ||
} | ||
@@ -197,3 +170,3 @@ exports.NodeError = NodeError; | ||
if (error.error) { | ||
this.removeCircularRefs(error.error); | ||
(0, utils_1.removeCircularRefs)(error.error); | ||
} | ||
@@ -200,0 +173,0 @@ if ((!message && (error.message || ((_a = error === null || error === void 0 ? void 0 : error.reason) === null || _a === void 0 ? void 0 : _a.message))) || description) { |
@@ -28,2 +28,5 @@ "use strict"; | ||
}, | ||
has(target, key) { | ||
return Reflect.has(target, key); | ||
}, | ||
set(target, name, value) { | ||
@@ -30,0 +33,0 @@ if (parent === undefined) { |
@@ -1,3 +0,2 @@ | ||
import { ExpressionError } from './ExpressionError'; | ||
import type { BinaryFileType } from './Interfaces'; | ||
import type { BinaryFileType, JsonObject } from './Interfaces'; | ||
export declare const isObjectEmpty: (obj: object | null | undefined) => boolean; | ||
@@ -26,6 +25,4 @@ export type Primitives = string | number | boolean | bigint | symbol | null | undefined; | ||
export declare function assert<T>(condition: T, msg?: string): asserts condition; | ||
export declare const IS_FRONTEND: boolean; | ||
export declare const isSyntaxError: (error: unknown) => error is SyntaxError; | ||
export declare const isExpressionError: (error: unknown) => error is ExpressionError; | ||
export declare const isTypeError: (error: unknown) => error is TypeError; | ||
export declare const isTraversableObject: (value: any) => value is JsonObject; | ||
export declare const removeCircularRefs: (obj: JsonObject, seen?: Set<unknown>) => void; | ||
export {}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isTypeError = exports.isExpressionError = exports.isSyntaxError = exports.IS_FRONTEND = exports.assert = exports.fileTypeFromMimeType = exports.sleep = exports.jsonStringify = exports.jsonParse = exports.deepCopy = exports.isObjectEmpty = void 0; | ||
const ExpressionError_1 = require("./ExpressionError"); | ||
exports.removeCircularRefs = exports.isTraversableObject = exports.assert = exports.fileTypeFromMimeType = exports.sleep = exports.jsonStringify = exports.jsonParse = exports.deepCopy = exports.isObjectEmpty = void 0; | ||
const readStreamClasses = new Set(['ReadStream', 'Readable', 'ReadableStream']); | ||
@@ -118,13 +117,30 @@ const isObjectEmpty = (obj) => { | ||
exports.assert = assert; | ||
const IS_FRONTEND_IN_DEV_MODE = typeof process === 'object' && | ||
Object.keys(process).length === 1 && | ||
'env' in process && | ||
Object.keys(process.env).length === 0; | ||
exports.IS_FRONTEND = typeof process === 'undefined' || IS_FRONTEND_IN_DEV_MODE; | ||
const isSyntaxError = (error) => error instanceof SyntaxError || (error instanceof Error && error.name === 'SyntaxError'); | ||
exports.isSyntaxError = isSyntaxError; | ||
const isExpressionError = (error) => error instanceof ExpressionError_1.ExpressionError || error instanceof ExpressionError_1.ExpressionExtensionError; | ||
exports.isExpressionError = isExpressionError; | ||
const isTypeError = (error) => error instanceof TypeError || (error instanceof Error && error.name === 'TypeError'); | ||
exports.isTypeError = isTypeError; | ||
const isTraversableObject = (value) => { | ||
return (value && | ||
typeof value === 'object' && | ||
!Array.isArray(value) && | ||
!!Object.keys(value).length); | ||
}; | ||
exports.isTraversableObject = isTraversableObject; | ||
const removeCircularRefs = (obj, seen = new Set()) => { | ||
seen.add(obj); | ||
Object.entries(obj).forEach(([key, value]) => { | ||
if ((0, exports.isTraversableObject)(value)) { | ||
seen.has(value) ? (obj[key] = { circularReference: true }) : (0, exports.removeCircularRefs)(value, seen); | ||
return; | ||
} | ||
if (Array.isArray(value)) { | ||
value.forEach((val, index) => { | ||
if (seen.has(val)) { | ||
value[index] = { circularReference: true }; | ||
return; | ||
} | ||
if ((0, exports.isTraversableObject)(val)) { | ||
(0, exports.removeCircularRefs)(val, seen); | ||
} | ||
}); | ||
} | ||
}); | ||
}; | ||
exports.removeCircularRefs = removeCircularRefs; | ||
//# sourceMappingURL=utils.js.map |
@@ -84,2 +84,3 @@ "use strict"; | ||
return new Proxy({}, { | ||
has: () => true, | ||
ownKeys(target) { | ||
@@ -109,2 +110,3 @@ if (Reflect.ownKeys(target).length === 0) { | ||
return new Proxy({}, { | ||
has: () => true, | ||
ownKeys(target) { | ||
@@ -125,2 +127,3 @@ return Reflect.ownKeys(target); | ||
return new Proxy(node.parameters, { | ||
has: () => true, | ||
ownKeys(target) { | ||
@@ -243,2 +246,3 @@ return Reflect.ownKeys(target); | ||
return new Proxy({ binary: undefined, data: undefined, json: undefined }, { | ||
has: () => true, | ||
get(target, name, receiver) { | ||
@@ -301,2 +305,3 @@ if (name === 'isProxy') | ||
return new Proxy({}, { | ||
has: () => true, | ||
get(target, name, receiver) { | ||
@@ -326,2 +331,3 @@ if (name === 'isProxy') | ||
return new Proxy({}, { | ||
has: () => true, | ||
ownKeys(target) { | ||
@@ -361,2 +367,3 @@ return allowedValues; | ||
return new Proxy({}, { | ||
has: () => true, | ||
ownKeys(target) { | ||
@@ -392,2 +399,3 @@ return allowedValues; | ||
return new Proxy({}, { | ||
has: () => true, | ||
get(target, name, receiver) { | ||
@@ -657,2 +665,3 @@ if (name === 'isProxy') | ||
return new Proxy({}, { | ||
has: () => true, | ||
ownKeys(target) { | ||
@@ -766,2 +775,3 @@ return [ | ||
$input: new Proxy({}, { | ||
has: () => true, | ||
ownKeys(target) { | ||
@@ -891,2 +901,3 @@ return ['all', 'context', 'first', 'item', 'last', 'params']; | ||
return new Proxy(base, { | ||
has: () => true, | ||
get(target, name, receiver) { | ||
@@ -893,0 +904,0 @@ var _a, _b; |
{ | ||
"name": "n8n-workflow", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
678523
9226