n8n-workflow
Advanced tools
Comparing version 1.26.0 to 1.27.0
@@ -26,4 +26,2 @@ "use strict"; | ||
constructor(node, error) { | ||
if (error instanceof NodeError) | ||
return error; | ||
const isError = error instanceof Error; | ||
@@ -34,2 +32,6 @@ const message = isError ? error.message : ''; | ||
this.node = node; | ||
if (error instanceof NodeError) { | ||
this.level = 'error'; | ||
this.message = `[RE-WRAPPED]: ${message}`; | ||
} | ||
} | ||
@@ -36,0 +38,0 @@ findProperty(jsonError, potentialKeys, traversalKeys = []) { |
@@ -442,3 +442,3 @@ /// <reference path="index.d.ts" /> | ||
request(uriOrObject: string | IDataObject | any, options?: IDataObject): Promise<any>; | ||
requestWithAuthentication(this: IAllExecuteFunctions, credentialsType: string, requestOptions: OptionsWithUri | RequestPromiseOptions, additionalCredentialOptions?: IAdditionalCredentialOptions): Promise<any>; | ||
requestWithAuthentication(this: IAllExecuteFunctions, credentialsType: string, requestOptions: OptionsWithUri | RequestPromiseOptions, additionalCredentialOptions?: IAdditionalCredentialOptions, itemIndex?: number): Promise<any>; | ||
httpRequest(requestOptions: IHttpRequestOptions): Promise<any>; | ||
@@ -699,4 +699,62 @@ httpRequestWithAuthentication(this: IAllExecuteFunctions, credentialsType: string, requestOptions: IHttpRequestOptions, additionalCredentialOptions?: IAdditionalCredentialOptions): Promise<any>; | ||
}>; | ||
export type DisplayCondition = { | ||
_cnd: { | ||
eq: NodeParameterValue; | ||
}; | ||
} | { | ||
_cnd: { | ||
not: NodeParameterValue; | ||
}; | ||
} | { | ||
_cnd: { | ||
gte: number | string; | ||
}; | ||
} | { | ||
_cnd: { | ||
lte: number | string; | ||
}; | ||
} | { | ||
_cnd: { | ||
gt: number | string; | ||
}; | ||
} | { | ||
_cnd: { | ||
lt: number | string; | ||
}; | ||
} | { | ||
_cnd: { | ||
between: { | ||
from: number | string; | ||
to: number | string; | ||
}; | ||
}; | ||
} | { | ||
_cnd: { | ||
startsWith: string; | ||
}; | ||
} | { | ||
_cnd: { | ||
endsWith: string; | ||
}; | ||
} | { | ||
_cnd: { | ||
includes: string; | ||
}; | ||
} | { | ||
_cnd: { | ||
regex: string; | ||
}; | ||
}; | ||
export interface IDisplayOptions { | ||
hide?: { | ||
[key: string]: Array<NodeParameterValue | DisplayCondition> | undefined; | ||
}; | ||
show?: { | ||
'@version'?: Array<number | DisplayCondition>; | ||
[key: string]: Array<NodeParameterValue | DisplayCondition> | undefined; | ||
}; | ||
hideOnCloud?: boolean; | ||
} | ||
export interface ICredentialsDisplayOptions { | ||
hide?: { | ||
[key: string]: NodeParameterValue[] | undefined; | ||
@@ -888,3 +946,3 @@ }; | ||
required?: boolean; | ||
displayOptions?: IDisplayOptions; | ||
displayOptions?: ICredentialsDisplayOptions; | ||
testedBy?: ICredentialTestRequest | string; | ||
@@ -891,0 +949,0 @@ } |
@@ -238,2 +238,71 @@ "use strict"; | ||
exports.applySpecialNodeParameters = applySpecialNodeParameters; | ||
const getPropertyValues = (nodeValues, propertyName, node, nodeValuesRoot) => { | ||
let value; | ||
if (propertyName.charAt(0) === '/') { | ||
value = (0, get_1.default)(nodeValuesRoot, propertyName.slice(1)); | ||
} | ||
else if (propertyName === '@version') { | ||
value = (node === null || node === void 0 ? void 0 : node.typeVersion) || 0; | ||
} | ||
else { | ||
value = (0, get_1.default)(nodeValues, propertyName); | ||
} | ||
if (value && typeof value === 'object' && '__rl' in value && value.__rl) { | ||
value = value.value; | ||
} | ||
if (!Array.isArray(value)) { | ||
return [value]; | ||
} | ||
else { | ||
return value; | ||
} | ||
}; | ||
const checkConditions = (conditions, actualValues) => { | ||
return conditions.some((condition) => { | ||
if (condition && | ||
typeof condition === 'object' && | ||
condition._cnd && | ||
Object.keys(condition).length === 1) { | ||
const [key, targetValue] = Object.entries(condition._cnd)[0]; | ||
return actualValues.every((propertyValue) => { | ||
if (key === 'eq') { | ||
return (0, isEqual_1.default)(propertyValue, targetValue); | ||
} | ||
if (key === 'not') { | ||
return !(0, isEqual_1.default)(propertyValue, targetValue); | ||
} | ||
if (key === 'gte') { | ||
return propertyValue >= targetValue; | ||
} | ||
if (key === 'lte') { | ||
return propertyValue <= targetValue; | ||
} | ||
if (key === 'gt') { | ||
return propertyValue > targetValue; | ||
} | ||
if (key === 'lt') { | ||
return propertyValue < targetValue; | ||
} | ||
if (key === 'between') { | ||
const { from, to } = targetValue; | ||
return propertyValue >= from && propertyValue <= to; | ||
} | ||
if (key === 'includes') { | ||
return propertyValue.includes(targetValue); | ||
} | ||
if (key === 'startsWith') { | ||
return propertyValue.startsWith(targetValue); | ||
} | ||
if (key === 'endsWith') { | ||
return propertyValue.endsWith(targetValue); | ||
} | ||
if (key === 'regex') { | ||
return new RegExp(targetValue).test(propertyValue); | ||
} | ||
return false; | ||
}); | ||
} | ||
return actualValues.includes(condition); | ||
}); | ||
}; | ||
function displayParameter(nodeValues, parameter, node, nodeValuesRoot) { | ||
@@ -243,31 +312,11 @@ if (!parameter.displayOptions) { | ||
} | ||
const { show, hide } = parameter.displayOptions; | ||
nodeValuesRoot = nodeValuesRoot || nodeValues; | ||
let value; | ||
const values = []; | ||
if (parameter.displayOptions.show) { | ||
for (const propertyName of Object.keys(parameter.displayOptions.show)) { | ||
if (propertyName.charAt(0) === '/') { | ||
value = (0, get_1.default)(nodeValuesRoot, propertyName.slice(1)); | ||
} | ||
else if (propertyName === '@version') { | ||
value = (node === null || node === void 0 ? void 0 : node.typeVersion) || 0; | ||
} | ||
else { | ||
value = (0, get_1.default)(nodeValues, propertyName); | ||
} | ||
if (value && typeof value === 'object' && '__rl' in value && value.__rl) { | ||
value = value.value; | ||
} | ||
values.length = 0; | ||
if (!Array.isArray(value)) { | ||
values.push(value); | ||
} | ||
else { | ||
values.push.apply(values, value); | ||
} | ||
if (show) { | ||
for (const propertyName of Object.keys(show)) { | ||
const values = getPropertyValues(nodeValues, propertyName, node, nodeValuesRoot); | ||
if (values.some((v) => typeof v === 'string' && v.charAt(0) === '=')) { | ||
return true; | ||
} | ||
if (values.length === 0 || | ||
!parameter.displayOptions.show[propertyName].some((v) => values.includes(v))) { | ||
if (values.length === 0 || !checkConditions(show[propertyName], values)) { | ||
return false; | ||
@@ -277,25 +326,6 @@ } | ||
} | ||
if (parameter.displayOptions.hide) { | ||
for (const propertyName of Object.keys(parameter.displayOptions.hide)) { | ||
if (propertyName.charAt(0) === '/') { | ||
value = (0, get_1.default)(nodeValuesRoot, propertyName.slice(1)); | ||
} | ||
else if (propertyName === '@version') { | ||
value = (node === null || node === void 0 ? void 0 : node.typeVersion) || 0; | ||
} | ||
else { | ||
value = (0, get_1.default)(nodeValues, propertyName); | ||
} | ||
if (value && typeof value === 'object' && '__rl' in value && value.__rl) { | ||
value = value.value; | ||
} | ||
values.length = 0; | ||
if (!Array.isArray(value)) { | ||
values.push(value); | ||
} | ||
else { | ||
values.push.apply(values, value); | ||
} | ||
if (values.length !== 0 && | ||
parameter.displayOptions.hide[propertyName].some((v) => values.includes(v))) { | ||
if (hide) { | ||
for (const propertyName of Object.keys(hide)) { | ||
const values = getPropertyValues(nodeValues, propertyName, node, nodeValuesRoot); | ||
if (values.length !== 0 && checkConditions(hide[propertyName], values)) { | ||
return false; | ||
@@ -302,0 +332,0 @@ } |
@@ -143,2 +143,6 @@ "use strict"; | ||
switch (condition.operator.operation) { | ||
case 'empty': | ||
return left.length === 0; | ||
case 'notEmpty': | ||
return left.length !== 0; | ||
case 'equals': | ||
@@ -145,0 +149,0 @@ return left === right; |
@@ -138,3 +138,3 @@ "use strict"; | ||
try { | ||
const nodeType = nodeTypes.getByNameAndVersion(node.type); | ||
const nodeType = nodeTypes.getByNameAndVersion(node.type, node.typeVersion); | ||
if (nodeType) { | ||
@@ -177,3 +177,3 @@ const nodeParameters = (0, NodeHelpers_1.getNodeParameters)(nodeType.description.properties, node.parameters, true, false, node); | ||
connections[key].forEach((element) => { | ||
element.forEach((element2) => { | ||
(element !== null && element !== void 0 ? element : []).forEach((element2) => { | ||
nodeGraph.node_connections.push(getGraphConnectionItem(nodeName, element2)); | ||
@@ -180,0 +180,0 @@ }); |
@@ -94,3 +94,3 @@ "use strict"; | ||
}, | ||
getOwnPropertyDescriptor(k) { | ||
getOwnPropertyDescriptor() { | ||
return { | ||
@@ -101,3 +101,3 @@ enumerable: true, | ||
}, | ||
get(target, name, receiver) { | ||
get(_, name) { | ||
if (name === 'isProxy') | ||
@@ -118,3 +118,3 @@ return true; | ||
}, | ||
get(target, name, receiver) { | ||
get(_, name) { | ||
if (name === 'isProxy') | ||
@@ -135,3 +135,3 @@ return true; | ||
}, | ||
getOwnPropertyDescriptor(k) { | ||
getOwnPropertyDescriptor() { | ||
return { | ||
@@ -142,3 +142,3 @@ enumerable: true, | ||
}, | ||
get(target, name, receiver) { | ||
get(target, name) { | ||
if (name === 'isProxy') | ||
@@ -317,3 +317,3 @@ return true; | ||
has: () => true, | ||
get(target, name, receiver) { | ||
get(_, name) { | ||
if (name === 'isProxy') | ||
@@ -343,6 +343,6 @@ return true; | ||
has: () => true, | ||
ownKeys(target) { | ||
ownKeys() { | ||
return allowedValues; | ||
}, | ||
getOwnPropertyDescriptor(k) { | ||
getOwnPropertyDescriptor() { | ||
return { | ||
@@ -379,6 +379,6 @@ enumerable: true, | ||
has: () => true, | ||
ownKeys(target) { | ||
ownKeys() { | ||
return allowedValues; | ||
}, | ||
getOwnPropertyDescriptor(k) { | ||
getOwnPropertyDescriptor() { | ||
return { | ||
@@ -411,3 +411,3 @@ enumerable: true, | ||
has: () => true, | ||
get(target, name, receiver) { | ||
get(_, name) { | ||
if (name === 'isProxy') | ||
@@ -678,3 +678,3 @@ return true; | ||
has: () => true, | ||
ownKeys(target) { | ||
ownKeys() { | ||
return [ | ||
@@ -788,6 +788,6 @@ 'pairedItem', | ||
has: () => true, | ||
ownKeys(target) { | ||
ownKeys() { | ||
return ['all', 'context', 'first', 'item', 'last', 'params']; | ||
}, | ||
getOwnPropertyDescriptor(k) { | ||
getOwnPropertyDescriptor() { | ||
return { | ||
@@ -794,0 +794,0 @@ enumerable: true, |
{ | ||
"name": "n8n-workflow", | ||
"version": "1.26.0", | ||
"version": "1.27.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
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
823916
10623