n8n-workflow
Advanced tools
Comparing version 1.22.0 to 1.23.0
export declare const BINARY_ENCODING = "base64"; | ||
export declare const WAIT_TIME_UNLIMITED = "3000-01-01T00:00:00.000Z"; | ||
export declare const LOG_LEVELS: readonly ["silent", "error", "warn", "info", "debug", "verbose"]; | ||
export declare const CODE_LANGUAGES: readonly ["javaScript", "json", "python"]; | ||
export declare const CODE_LANGUAGES: readonly ["javaScript", "python"]; | ||
export declare const CODE_EXECUTION_MODES: readonly ["runOnceForAllItems", "runOnceForEachItem"]; | ||
@@ -6,0 +6,0 @@ export declare const NODES_WITH_RENAMABLE_CONTENT: Set<string>; |
@@ -7,3 +7,3 @@ "use strict"; | ||
exports.LOG_LEVELS = ['silent', 'error', 'warn', 'info', 'debug', 'verbose']; | ||
exports.CODE_LANGUAGES = ['javaScript', 'json', 'python']; | ||
exports.CODE_LANGUAGES = ['javaScript', 'python']; | ||
exports.CODE_EXECUTION_MODES = ['runOnceForAllItems', 'runOnceForEachItem']; | ||
@@ -10,0 +10,0 @@ exports.NODES_WITH_RENAMABLE_CONTENT = new Set([ |
import type { ExtensionMap } from './Extensions'; | ||
export declare const SupportedHashAlgorithms: readonly ["md5", "sha1", "sha224", "sha256", "sha384", "sha512", "sha3"]; | ||
export declare const stringExtensions: ExtensionMap; |
@@ -6,18 +6,18 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.stringExtensions = void 0; | ||
exports.stringExtensions = exports.SupportedHashAlgorithms = void 0; | ||
const jssha_1 = __importDefault(require("jssha")); | ||
const md5_1 = __importDefault(require("md5")); | ||
const js_base64_1 = require("js-base64"); | ||
const title_case_1 = require("title-case"); | ||
const crypto_js_1 = __importDefault(require("crypto-js")); | ||
const js_base64_1 = require("js-base64"); | ||
const transliteration_1 = require("transliteration"); | ||
const expression_extension_error_1 = require("../errors/expression-extension.error"); | ||
const hashFunctions = { | ||
md5: crypto_js_1.default.MD5, | ||
sha1: crypto_js_1.default.SHA1, | ||
sha224: crypto_js_1.default.SHA224, | ||
sha256: crypto_js_1.default.SHA256, | ||
sha384: crypto_js_1.default.SHA384, | ||
sha512: crypto_js_1.default.SHA512, | ||
sha3: crypto_js_1.default.SHA3, | ||
ripemd160: crypto_js_1.default.RIPEMD160, | ||
}; | ||
exports.SupportedHashAlgorithms = [ | ||
'md5', | ||
'sha1', | ||
'sha224', | ||
'sha256', | ||
'sha384', | ||
'sha512', | ||
'sha3', | ||
]; | ||
const CURRENCY_REGEXP = /(\u004c\u0065\u006b|\u060b|\u0024|\u0192|\u20bc|\u0042\u0072|\u0042\u005a\u0024|\u0024\u0062|\u004b\u004d|\u0050|\u043b\u0432|\u0052\u0024|\u17db|\u00a5|\u20a1|\u006b\u006e|\u20b1|\u004b\u010d|\u006b\u0072|\u0052\u0044\u0024|\u00a3|\u20ac|\u00a2|\u0051|\u004c|\u0046\u0074|\u20b9|\u0052\u0070|\ufdfc|\u20aa|\u004a\u0024|\u20a9|\u20ad|\u0434\u0435\u043d|\u0052\u004d|\u20a8|\u20ae|\u004d\u0054|\u0043\u0024|\u20a6|\u0042\u002f\u002e|\u0047\u0073|\u0053\u002f\u002e|\u007a\u0142|\u006c\u0065\u0069|\u20bd|\u0414\u0438\u043d\u002e|\u0053|\u0052|\u0043\u0048\u0046|\u004e\u0054\u0024|\u0e3f|\u0054\u0054\u0024|\u20ba|\u20b4|\u0024\u0055|\u0042\u0073|\u20ab|\u005a\u0024)/gu; | ||
@@ -32,13 +32,27 @@ const DOMAIN_EXTRACT_REGEXP = /^(?:(?:https?|ftp):\/\/)?(?:mailto:)?(?:\/\/)?((?:www\.)?(?:(?:[-\w]+\.)+(?:[a-zA-Z]{2,}|xn--[a-zA-Z0-9]+)|localhost|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}))(?::\d+)?(?:\/[^\s?]*)?(?:\?[^\s#]*)?(?:#[^\s]*)?$/i; | ||
function hash(value, extraArgs) { | ||
const [algorithm = 'MD5'] = extraArgs; | ||
if (algorithm.toLowerCase() === 'base64') { | ||
return (0, js_base64_1.encode)(value); | ||
var _a, _b; | ||
const algorithm = (_b = (_a = extraArgs[0]) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== null && _b !== void 0 ? _b : 'md5'; | ||
switch (algorithm) { | ||
case 'base64': | ||
return (0, js_base64_1.encode)(value); | ||
case 'md5': | ||
return (0, md5_1.default)(value); | ||
case 'sha1': | ||
case 'sha224': | ||
case 'sha256': | ||
case 'sha384': | ||
case 'sha512': | ||
case 'sha3': | ||
const variant = { | ||
sha1: 'SHA-1', | ||
sha224: 'SHA-224', | ||
sha256: 'SHA-256', | ||
sha384: 'SHA-384', | ||
sha512: 'SHA-512', | ||
sha3: 'SHA3-512', | ||
}[algorithm]; | ||
return new jssha_1.default(variant, 'TEXT').update(value).getHash('HEX'); | ||
default: | ||
throw new expression_extension_error_1.ExpressionExtensionError(`Unknown algorithm ${algorithm}. Available algorithms are: ${exports.SupportedHashAlgorithms.join()}, and Base64.`); | ||
} | ||
const hashFunction = hashFunctions[algorithm.toLowerCase()]; | ||
if (!hashFunction) { | ||
throw new expression_extension_error_1.ExpressionExtensionError(`Unknown algorithm ${algorithm}. Available algorithms are: ${Object.keys(hashFunctions) | ||
.map((s) => s.toUpperCase()) | ||
.join(', ')}, and Base64.`); | ||
} | ||
return hashFunction(value.toString()).toString(); | ||
} | ||
@@ -260,3 +274,3 @@ function isEmpty(value) { | ||
name: 'toTitleCase', | ||
description: 'Formats a string to title case. Example: "This Is a Title".', | ||
description: 'Formats a string to title case. Example: "This Is a Title". Will not change already uppercase letters to prevent losing information from acronyms and trademarks such as iPhone or FAANG.', | ||
returnType: 'string', | ||
@@ -263,0 +277,0 @@ docURL: 'https://docs.n8n.io/code/builtin/data-transformation-functions/strings/#string-toTitleCase', |
@@ -256,2 +256,3 @@ /// <reference path="index.d.ts" /> | ||
export type GenericValue = string | object | number | boolean | undefined | null; | ||
export type CloseFunction = () => Promise<void>; | ||
export interface IDataObject { | ||
@@ -273,6 +274,6 @@ [key: string]: GenericValue | IDataObject | GenericValue[] | IDataObject[]; | ||
data: INodeExecutionData[][] | null | undefined; | ||
closeFunction?: () => Promise<void>; | ||
closeFunction?: CloseFunction; | ||
} | ||
export interface IGetExecuteFunctions { | ||
(workflow: Workflow, runExecutionData: IRunExecutionData, runIndex: number, connectionInputData: INodeExecutionData[], inputData: ITaskDataConnections, node: INode, additionalData: IWorkflowExecuteAdditionalData, executeData: IExecuteData, mode: WorkflowExecuteMode, abortSignal?: AbortSignal): IExecuteFunctions; | ||
(workflow: Workflow, runExecutionData: IRunExecutionData, runIndex: number, connectionInputData: INodeExecutionData[], inputData: ITaskDataConnections, node: INode, additionalData: IWorkflowExecuteAdditionalData, executeData: IExecuteData, mode: WorkflowExecuteMode, closeFunctions: CloseFunction[], abortSignal?: AbortSignal): IExecuteFunctions; | ||
} | ||
@@ -635,3 +636,3 @@ export interface IGetExecuteSingleFunctions { | ||
export type CodeAutocompleteTypes = 'function' | 'functionItem'; | ||
export type EditorType = 'code' | 'codeNodeEditor' | 'htmlEditor' | 'sqlEditor' | 'json'; | ||
export type EditorType = 'codeNodeEditor' | 'jsEditor' | 'htmlEditor' | 'sqlEditor'; | ||
export type CodeNodeEditorLanguage = (typeof CODE_LANGUAGES)[number]; | ||
@@ -653,3 +654,2 @@ export type CodeExecutionMode = (typeof CODE_EXECUTION_MODES)[number]; | ||
editor?: EditorType; | ||
editorLanguage?: CodeNodeEditorLanguage; | ||
sqlDialect?: SQLDialect; | ||
@@ -813,7 +813,7 @@ loadOptionsDependsOn?: string[]; | ||
export interface IPollResponse { | ||
closeFunction?: () => Promise<void>; | ||
closeFunction?: CloseFunction; | ||
} | ||
export interface ITriggerResponse { | ||
closeFunction?: () => Promise<void>; | ||
manualTriggerFunction?: () => Promise<void>; | ||
closeFunction?: CloseFunction; | ||
manualTriggerFunction?: CloseFunction; | ||
manualTriggerResponse?: Promise<INodeExecutionData[][]>; | ||
@@ -837,2 +837,3 @@ } | ||
response: unknown; | ||
closeFunction?: CloseFunction; | ||
} | ||
@@ -839,0 +840,0 @@ export interface INodeType { |
@@ -54,3 +54,4 @@ "use strict"; | ||
} | ||
const executeFunctions = nodeExecuteFunctions.getExecuteFunctions(this.workflow, this.runExecutionData, runIndex, this.connectionInputData, inputData, this.node, this.additionalData, executeData, this.mode, abortSignal); | ||
const closeFunctions = []; | ||
const executeFunctions = nodeExecuteFunctions.getExecuteFunctions(this.workflow, this.runExecutionData, runIndex, this.connectionInputData, inputData, this.node, this.additionalData, executeData, this.mode, closeFunctions, abortSignal); | ||
let credentials; | ||
@@ -57,0 +58,0 @@ if (credentialsDecrypted) { |
@@ -693,6 +693,20 @@ "use strict"; | ||
if (nodeType.execute) { | ||
const context = nodeExecuteFunctions.getExecuteFunctions(this, runExecutionData, runIndex, connectionInputData, inputData, node, additionalData, executionData, mode, abortSignal); | ||
const closeFunctions = []; | ||
const context = nodeExecuteFunctions.getExecuteFunctions(this, runExecutionData, runIndex, connectionInputData, inputData, node, additionalData, executionData, mode, closeFunctions, abortSignal); | ||
const data = nodeType instanceof Interfaces_1.Node | ||
? await nodeType.execute(context) | ||
: await nodeType.execute.call(context); | ||
const closeFunctionsResults = await Promise.allSettled(closeFunctions.map(async (fn) => fn())); | ||
const closingErrors = closeFunctionsResults | ||
.filter((result) => result.status === 'rejected') | ||
.map((result) => result.reason); | ||
if (closingErrors.length > 0) { | ||
if (closingErrors[0] instanceof Error) | ||
throw closingErrors[0]; | ||
throw new application_error_1.ApplicationError("Error on execution node's close function(s)", { | ||
extra: { nodeName: node.name }, | ||
tags: { nodeType: node.type }, | ||
cause: closingErrors, | ||
}); | ||
} | ||
return { data }; | ||
@@ -699,0 +713,0 @@ } |
{ | ||
"name": "n8n-workflow", | ||
"version": "1.22.0", | ||
"version": "1.23.0", | ||
"description": "Workflow base code of n8n", | ||
@@ -30,3 +30,2 @@ "license": "SEE LICENSE IN LICENSE.md", | ||
"devDependencies": { | ||
"@types/crypto-js": "^4.1.3", | ||
"@types/deep-equal": "^1.0.1", | ||
@@ -37,2 +36,3 @@ "@types/express": "^4.17.6", | ||
"@types/luxon": "^3.2.0", | ||
"@types/md5": "^2.3.5", | ||
"@types/xml2js": "^0.4.11" | ||
@@ -45,3 +45,2 @@ }, | ||
"callsites": "3.1.0", | ||
"crypto-js": "4.2.0", | ||
"deep-equal": "2.2.0", | ||
@@ -52,4 +51,6 @@ "esprima-next": "5.8.4", | ||
"js-base64": "3.7.2", | ||
"jssha": "3.3.1", | ||
"lodash": "4.17.21", | ||
"luxon": "3.3.0", | ||
"md5": "2.3.0", | ||
"recast": "0.21.5", | ||
@@ -56,0 +57,0 @@ "title-case": "3.0.3", |
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
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
821172
10523
17
+ Addedjssha@3.3.1
+ Addedmd5@2.3.0
+ Addedcharenc@0.0.2(transitive)
+ Addedcrypt@0.0.2(transitive)
+ Addedis-buffer@1.1.6(transitive)
+ Addedjssha@3.3.1(transitive)
+ Addedmd5@2.3.0(transitive)
- Removedcrypto-js@4.2.0
- Removedcrypto-js@4.2.0(transitive)