first commit

This commit is contained in:
2025-10-26 23:10:15 +08:00
commit 8f0345b7be
14961 changed files with 2356381 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
import { ApplicationError } from '@n8n/errors';
import type { FilterConditionValue, FilterOptionsValue, FilterValue, INodeProperties } from '../interfaces';
type FilterConditionMetadata = {
index: number;
unresolvedExpressions: boolean;
itemIndex: number;
errorFormat: 'full' | 'inline';
};
export declare class FilterError extends ApplicationError {
readonly description: string;
constructor(message: string, description: string);
}
export declare function arrayContainsValue(array: unknown[], value: unknown, ignoreCase: boolean): boolean;
export declare function executeFilterCondition(condition: FilterConditionValue, filterOptions: FilterOptionsValue, metadata?: Partial<FilterConditionMetadata>): boolean;
type ExecuteFilterOptions = {
itemIndex?: number;
};
export declare function executeFilter(value: FilterValue, { itemIndex }?: ExecuteFilterOptions): boolean;
export declare const validateFilterParameter: (nodeProperties: INodeProperties, value: FilterValue) => Record<string, string[]>;
export {};
//# sourceMappingURL=filter-parameter.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"filter-parameter.d.ts","sourceRoot":"","sources":["../../../src/node-parameters/filter-parameter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EACX,oBAAoB,EAEpB,kBAAkB,EAClB,WAAW,EACX,eAAe,EAEf,MAAM,eAAe,CAAC;AAKvB,KAAK,uBAAuB,GAAG;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,qBAAqB,EAAE,OAAO,CAAC;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,GAAG,QAAQ,CAAC;CAC/B,CAAC;AAEF,qBAAa,WAAY,SAAQ,gBAAgB;IAG/C,QAAQ,CAAC,WAAW,EAAE,MAAM;gBAD5B,OAAO,EAAE,MAAM,EACN,WAAW,EAAE,MAAM;CAI7B;AA2KD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,GAAG,OAAO,CAUjG;AAGD,wBAAgB,sBAAsB,CACrC,SAAS,EAAE,oBAAoB,EAC/B,aAAa,EAAE,kBAAkB,EACjC,QAAQ,GAAE,OAAO,CAAC,uBAAuB,CAAM,GAC7C,OAAO,CAkLT;AAED,KAAK,oBAAoB,GAAG;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AACF,wBAAgB,aAAa,CAC5B,KAAK,EAAE,WAAW,EAClB,EAAE,SAAS,EAAE,GAAE,oBAAyB,GACtC,OAAO,CAaT;AAED,eAAO,MAAM,uBAAuB,GACnC,gBAAgB,eAAe,EAC/B,OAAO,WAAW,KAChB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAqBzB,CAAC"}

View File

@@ -0,0 +1,331 @@
import { ApplicationError } from '@n8n/errors';
import * as LoggerProxy from '../logger-proxy';
import { validateFieldType } from '../type-validation';
export class FilterError extends ApplicationError {
description;
constructor(message, description) {
super(message, { level: 'warning' });
this.description = description;
}
}
function parseSingleFilterValue(value, type, strict = false, version = 1) {
if (type === 'any' || value === null || value === undefined) {
return { valid: true, newValue: value };
}
if (type === 'boolean' && !strict) {
if (version >= 2) {
const result = validateFieldType('filter', value, type);
if (result.valid)
return result;
}
return { valid: true, newValue: Boolean(value) };
}
if (type === 'number' && Number.isNaN(value)) {
return { valid: true, newValue: value };
}
return validateFieldType('filter', value, type, { strict, parseStrings: true });
}
const withIndefiniteArticle = (noun) => {
const article = 'aeiou'.includes(noun.charAt(0)) ? 'an' : 'a';
return `${article} ${noun}`;
};
function parseFilterConditionValues(condition, options, metadata) {
const index = metadata.index ?? 0;
const itemIndex = metadata.itemIndex ?? 0;
const errorFormat = metadata.errorFormat ?? 'full';
const strict = options.typeValidation === 'strict';
const version = options.version ?? 1;
const { operator } = condition;
const rightType = operator.rightType ?? operator.type;
const parsedLeftValue = parseSingleFilterValue(condition.leftValue, operator.type, strict, version);
const parsedRightValue = parseSingleFilterValue(condition.rightValue, rightType, strict, version);
const leftValid = parsedLeftValue.valid ||
(metadata.unresolvedExpressions &&
typeof condition.leftValue === 'string' &&
condition.leftValue.startsWith('='));
const rightValid = parsedRightValue.valid ||
!!operator.singleValue ||
(metadata.unresolvedExpressions &&
typeof condition.rightValue === 'string' &&
condition.rightValue.startsWith('='));
const leftValueString = String(condition.leftValue);
const rightValueString = String(condition.rightValue);
const suffix = errorFormat === 'full' ? `[condition ${index}, item ${itemIndex}]` : `[item ${itemIndex}]`;
const composeInvalidTypeMessage = (type, fromType, value) => {
fromType = fromType.toLocaleLowerCase();
if (strict) {
return `Wrong type: '${value}' is ${withIndefiniteArticle(fromType)} but was expecting ${withIndefiniteArticle(type)} ${suffix}`;
}
return `Conversion error: the ${fromType} '${value}' can't be converted to ${withIndefiniteArticle(type)} ${suffix}`;
};
const getTypeDescription = (isStrict) => {
if (isStrict)
return "Try changing the type of comparison. Alternatively you can enable 'Convert types where required'.";
return 'Try changing the type of the comparison.';
};
const composeInvalidTypeDescription = (type, fromType, valuePosition) => {
fromType = fromType.toLocaleLowerCase();
const expectedType = withIndefiniteArticle(type);
let convertionFunction = '';
if (type === 'string') {
convertionFunction = '.toString()';
}
else if (type === 'number') {
convertionFunction = '.toNumber()';
}
else if (type === 'boolean') {
convertionFunction = '.toBoolean()';
}
if (strict && convertionFunction) {
const suggestFunction = ` by adding <code>${convertionFunction}</code>`;
return `
<p>Try either:</p>
<ol>
<li>Enabling 'Convert types where required'</li>
<li>Converting the ${valuePosition} field to ${expectedType}${suggestFunction}</li>
</ol>
`;
}
return getTypeDescription(strict);
};
if (!leftValid && !rightValid && typeof condition.leftValue === typeof condition.rightValue) {
return {
ok: false,
error: new FilterError(`Comparison type expects ${withIndefiniteArticle(operator.type)} but both fields are ${withIndefiniteArticle(typeof condition.leftValue)}`, getTypeDescription(strict)),
};
}
if (!leftValid) {
return {
ok: false,
error: new FilterError(composeInvalidTypeMessage(operator.type, typeof condition.leftValue, leftValueString), composeInvalidTypeDescription(operator.type, typeof condition.leftValue, 'first')),
};
}
if (!rightValid) {
return {
ok: false,
error: new FilterError(composeInvalidTypeMessage(rightType, typeof condition.rightValue, rightValueString), composeInvalidTypeDescription(rightType, typeof condition.rightValue, 'second')),
};
}
return {
ok: true,
result: {
left: parsedLeftValue.valid ? parsedLeftValue.newValue : undefined,
right: parsedRightValue.valid ? parsedRightValue.newValue : undefined,
},
};
}
function parseRegexPattern(pattern) {
const regexMatch = (pattern || '').match(new RegExp('^/(.*?)/([gimusy]*)$'));
let regex;
if (!regexMatch) {
regex = new RegExp((pattern || '').toString());
}
else {
regex = new RegExp(regexMatch[1], regexMatch[2]);
}
return regex;
}
export function arrayContainsValue(array, value, ignoreCase) {
if (ignoreCase && typeof value === 'string') {
return array.some((item) => {
if (typeof item !== 'string') {
return false;
}
return item.toString().toLocaleLowerCase() === value.toLocaleLowerCase();
});
}
return array.includes(value);
}
// eslint-disable-next-line complexity
export function executeFilterCondition(condition, filterOptions, metadata = {}) {
const ignoreCase = !filterOptions.caseSensitive;
const { operator } = condition;
const parsedValues = parseFilterConditionValues(condition, filterOptions, metadata);
if (!parsedValues.ok) {
throw parsedValues.error;
}
let { left: leftValue, right: rightValue } = parsedValues.result;
const exists = leftValue !== undefined && leftValue !== null && !Number.isNaN(leftValue);
if (condition.operator.operation === 'exists') {
return exists;
}
else if (condition.operator.operation === 'notExists') {
return !exists;
}
switch (operator.type) {
case 'string': {
if (ignoreCase) {
if (typeof leftValue === 'string') {
leftValue = leftValue.toLocaleLowerCase();
}
if (typeof rightValue === 'string' &&
!(condition.operator.operation === 'regex' || condition.operator.operation === 'notRegex')) {
rightValue = rightValue.toLocaleLowerCase();
}
}
const left = (leftValue ?? '');
const right = (rightValue ?? '');
switch (condition.operator.operation) {
case 'empty':
return left.length === 0;
case 'notEmpty':
return left.length !== 0;
case 'equals':
return left === right;
case 'notEquals':
return left !== right;
case 'contains':
return left.includes(right);
case 'notContains':
return !left.includes(right);
case 'startsWith':
return left.startsWith(right);
case 'notStartsWith':
return !left.startsWith(right);
case 'endsWith':
return left.endsWith(right);
case 'notEndsWith':
return !left.endsWith(right);
case 'regex':
return parseRegexPattern(right).test(left);
case 'notRegex':
return !parseRegexPattern(right).test(left);
}
break;
}
case 'number': {
const left = leftValue;
const right = rightValue;
switch (condition.operator.operation) {
case 'empty':
return !exists;
case 'notEmpty':
return exists;
case 'equals':
return left === right;
case 'notEquals':
return left !== right;
case 'gt':
return left > right;
case 'lt':
return left < right;
case 'gte':
return left >= right;
case 'lte':
return left <= right;
}
}
case 'dateTime': {
const left = leftValue;
const right = rightValue;
if (condition.operator.operation === 'empty') {
return !exists;
}
else if (condition.operator.operation === 'notEmpty') {
return exists;
}
if (!left || !right) {
return false;
}
switch (condition.operator.operation) {
case 'equals':
return left.toMillis() === right.toMillis();
case 'notEquals':
return left.toMillis() !== right.toMillis();
case 'after':
return left.toMillis() > right.toMillis();
case 'before':
return left.toMillis() < right.toMillis();
case 'afterOrEquals':
return left.toMillis() >= right.toMillis();
case 'beforeOrEquals':
return left.toMillis() <= right.toMillis();
}
}
case 'boolean': {
const left = leftValue;
const right = rightValue;
switch (condition.operator.operation) {
case 'empty':
return !exists;
case 'notEmpty':
return exists;
case 'true':
return left;
case 'false':
return !left;
case 'equals':
return left === right;
case 'notEquals':
return left !== right;
}
}
case 'array': {
const left = (leftValue ?? []);
const rightNumber = rightValue;
switch (condition.operator.operation) {
case 'contains':
return arrayContainsValue(left, rightValue, ignoreCase);
case 'notContains':
return !arrayContainsValue(left, rightValue, ignoreCase);
case 'lengthEquals':
return left.length === rightNumber;
case 'lengthNotEquals':
return left.length !== rightNumber;
case 'lengthGt':
return left.length > rightNumber;
case 'lengthLt':
return left.length < rightNumber;
case 'lengthGte':
return left.length >= rightNumber;
case 'lengthLte':
return left.length <= rightNumber;
case 'empty':
return left.length === 0;
case 'notEmpty':
return left.length !== 0;
}
}
case 'object': {
const left = leftValue;
switch (condition.operator.operation) {
case 'empty':
return !left || Object.keys(left).length === 0;
case 'notEmpty':
return !!left && Object.keys(left).length !== 0;
}
}
}
LoggerProxy.warn(`Unknown filter parameter operator "${operator.type}:${operator.operation}"`);
return false;
}
export function executeFilter(value, { itemIndex } = {}) {
const conditionPass = (condition, index) => executeFilterCondition(condition, value.options, { index, itemIndex });
if (value.combinator === 'and') {
return value.conditions.every(conditionPass);
}
else if (value.combinator === 'or') {
return value.conditions.some(conditionPass);
}
LoggerProxy.warn(`Unknown filter combinator "${value.combinator}"`);
return false;
}
export const validateFilterParameter = (nodeProperties, value) => {
return value.conditions.reduce((issues, condition, index) => {
const key = `${nodeProperties.name}.${index}`;
try {
parseFilterConditionValues(condition, value.options, {
index,
unresolvedExpressions: true,
errorFormat: 'inline',
});
}
catch (error) {
if (error instanceof FilterError) {
issues[key].push(error.message);
}
}
return issues;
}, {});
};
//# sourceMappingURL=filter-parameter.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,22 @@
import type { INode } from '../interfaces';
type ParameterType = 'string' | 'boolean' | 'number' | 'resource-locator' | 'string[]' | 'number[]' | 'boolean[]' | 'object';
export declare function assertParamIsNumber(parameterName: string, value: unknown, node: INode): asserts value is number;
export declare function assertParamIsString(parameterName: string, value: unknown, node: INode): asserts value is string;
export declare function assertParamIsBoolean(parameterName: string, value: unknown, node: INode): asserts value is boolean;
type TypeofMap = {
string: string;
number: number;
boolean: boolean;
};
export declare function assertParamIsOfAnyTypes<T extends ReadonlyArray<keyof TypeofMap>>(parameterName: string, value: unknown, types: T, node: INode): asserts value is TypeofMap[T[number]];
export declare function assertParamIsArray<T>(parameterName: string, value: unknown, validator: (val: unknown) => val is T, node: INode): asserts value is T[];
type InferParameterType<T extends ParameterType | ParameterType[]> = T extends ParameterType[] ? InferSingleParameterType<T[number]> : T extends ParameterType ? InferSingleParameterType<T> : never;
type InferSingleParameterType<T extends ParameterType> = T extends 'string' ? string : T extends 'boolean' ? boolean : T extends 'number' ? number : T extends 'resource-locator' ? Record<string, unknown> : T extends 'string[]' ? string[] : T extends 'number[]' ? number[] : T extends 'boolean[]' ? boolean[] : T extends 'object' ? Record<string, unknown> : unknown;
export declare function validateNodeParameters<T extends Record<string, {
type: ParameterType | ParameterType[];
required?: boolean;
}>>(value: unknown, parameters: T, node: INode): asserts value is {
[K in keyof T]: T[K]['required'] extends true ? InferParameterType<T[K]['type']> : InferParameterType<T[K]['type']> | undefined;
};
export {};
//# sourceMappingURL=parameter-type-validation.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"parameter-type-validation.d.ts","sourceRoot":"","sources":["../../../src/node-parameters/parameter-type-validation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAG3C,KAAK,aAAa,GACf,QAAQ,GACR,SAAS,GACT,QAAQ,GACR,kBAAkB,GAClB,UAAU,GACV,UAAU,GACV,WAAW,GACX,QAAQ,CAAC;AA0BZ,wBAAgB,mBAAmB,CAClC,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,KAAK,GACT,OAAO,CAAC,KAAK,IAAI,MAAM,CAEzB;AAED,wBAAgB,mBAAmB,CAClC,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,KAAK,GACT,OAAO,CAAC,KAAK,IAAI,MAAM,CAEzB;AAED,wBAAgB,oBAAoB,CACnC,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,KAAK,GACT,OAAO,CAAC,KAAK,IAAI,OAAO,CAE1B;AAED,KAAK,SAAS,GAAG;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,wBAAgB,uBAAuB,CAAC,CAAC,SAAS,aAAa,CAAC,MAAM,SAAS,CAAC,EAC/E,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,OAAO,EACd,KAAK,EA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K,IAAI;KAClB,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,SAAS,IAAI,GAC1C,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,GAChC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,SAAS;CAC/C,CAgBA"}

View File

@@ -0,0 +1,123 @@
import { NodeOperationError } from '../errors';
import { assert } from '../utils';
function assertUserInput(condition, message, node) {
try {
assert(condition, message);
}
catch (e) {
if (e instanceof Error) {
// Use level 'info' to prevent reporting to Sentry (only 'error' and 'fatal' levels are reported)
const nodeError = new NodeOperationError(node, e.message, { level: 'info' });
nodeError.stack = e.stack;
throw nodeError;
}
throw e;
}
}
function assertParamIsType(parameterName, value, type, node) {
assertUserInput(typeof value === type, `Parameter "${parameterName}" is not ${type}`, node);
}
export function assertParamIsNumber(parameterName, value, node) {
assertParamIsType(parameterName, value, 'number', node);
}
export function assertParamIsString(parameterName, value, node) {
assertParamIsType(parameterName, value, 'string', node);
}
export function assertParamIsBoolean(parameterName, value, node) {
assertParamIsType(parameterName, value, 'boolean', node);
}
export function assertParamIsOfAnyTypes(parameterName, value, types, node) {
const isValid = types.some((type) => typeof value === type);
if (!isValid) {
const typeList = types.join(' or ');
assertUserInput(false, `Parameter "${parameterName}" must be ${typeList}`, node);
}
}
export function assertParamIsArray(parameterName, value, validator, node) {
assertUserInput(Array.isArray(value), `Parameter "${parameterName}" is not an array`, node);
// Use for loop instead of .every() to properly handle sparse arrays
// .every() skips empty/sparse indices, which could allow invalid arrays to pass
for (let i = 0; i < value.length; i++) {
if (!validator(value[i])) {
assertUserInput(false, `Parameter "${parameterName}" has elements that don't match expected types`, node);
}
}
}
function assertIsValidObject(value, node) {
assertUserInput(typeof value === 'object' && value !== null, 'Value is not a valid object', node);
}
function assertIsRequiredParameter(parameterName, value, isRequired, node) {
if (isRequired && value === undefined) {
assertUserInput(false, `Required parameter "${parameterName}" is missing`, node);
}
}
function assertIsResourceLocator(parameterName, value, node) {
assertUserInput(typeof value === 'object' &&
value !== null &&
'__rl' in value &&
'mode' in value &&
'value' in value, `Parameter "${parameterName}" is not a valid resource locator object`, node);
}
function assertParamIsObject(parameterName, value, node) {
assertUserInput(typeof value === 'object' && value !== null, `Parameter "${parameterName}" is not a valid object`, node);
}
function createElementValidator(elementType) {
return (val) => typeof val === elementType;
}
function assertParamIsArrayOfType(parameterName, value, arrayType, node) {
const baseType = arrayType.slice(0, -2);
const elementType = baseType === 'string' || baseType === 'number' || baseType === 'boolean' ? baseType : 'string';
const validator = createElementValidator(elementType);
assertParamIsArray(parameterName, value, validator, node);
}
function assertParamIsPrimitive(parameterName, value, type, node) {
assertUserInput(typeof value === type, `Parameter "${parameterName}" is not a valid ${type}`, node);
}
function validateParameterType(parameterName, value, type, node) {
try {
if (type === 'resource-locator') {
assertIsResourceLocator(parameterName, value, node);
}
else if (type === 'object') {
assertParamIsObject(parameterName, value, node);
}
else if (type.endsWith('[]')) {
assertParamIsArrayOfType(parameterName, value, type, node);
}
else {
assertParamIsPrimitive(parameterName, value, type, node);
}
return true;
}
catch {
return false;
}
}
function validateParameterAgainstTypes(parameterName, value, types, node) {
let isValid = false;
for (const type of types) {
if (validateParameterType(parameterName, value, type, node)) {
isValid = true;
break;
}
}
if (!isValid) {
const typeList = types.join(' or ');
assertUserInput(false, `Parameter "${parameterName}" does not match any of the expected types: ${typeList}`, node);
}
}
export function validateNodeParameters(value, parameters, node) {
assertIsValidObject(value, node);
Object.keys(parameters).forEach((key) => {
const param = parameters[key];
const paramValue = value[key];
assertIsRequiredParameter(key, paramValue, param.required ?? false, node);
// If required, value cannot be undefined and must be validated
// If not required, value can be undefined but should be validated when present
if (param.required || paramValue !== undefined) {
const types = Array.isArray(param.type) ? param.type : [param.type];
validateParameterAgainstTypes(key, paramValue, types, node);
}
});
}
//# sourceMappingURL=parameter-type-validation.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"parameter-type-validation.js","sourceRoot":"","sources":["../../../src/node-parameters/parameter-type-validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAYlC,SAAS,eAAe,CAAI,SAAY,EAAE,OAAe,EAAE,IAAW;IACrE,IAAI,CAAC;QACJ,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAC5B,CAAC;IAAC,OAAO,CAAU,EAAE,CAAC;QACrB,IAAI,CAAC,YAAY,KAAK,EAAE,CAAC;YACxB,iGAAiG;YACjG,MAAM,SAAS,GAAG,IAAI,kBAAkB,CAAC,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;YAC7E,SAAS,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC;YAC1B,MAAM,SAAS,CAAC;QACjB,CAAC;QAED,MAAM,CAAC,CAAC;IACT,CAAC;AACF,CAAC;AAED,SAAS,iBAAiB,CACzB,aAAqB,EACrB,KAAc,EACd,IAAqC,EACrC,IAAW;IAEX,eAAe,CAAC,OAAO,KAAK,KAAK,IAAI,EAAE,cAAc,aAAa,YAAY,IAAI,EAAE,EAAE,IAAI,CAAC,CAAC;AAC7F,CAAC;AAED,MAAM,UAAU,mBAAmB,CAClC,aAAqB,EACrB,KAAc,EACd,IAAW;IAEX,iBAAiB,CAAS,aAAa,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;AACjE,CAAC;AAED,MAAM,UAAU,mBAAmB,CAClC,aAAqB,EACrB,KAAc,EACd,IAAW;IAEX,iBAAiB,CAAS,aAAa,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;AACjE,CAAC;AAED,MAAM,UAAU,oBAAoB,CACnC,aAAqB,EACrB,KAAc,EACd,IAAW;IAEX,iBA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,CAAC;IACH,CAAC;AACF,CAAC;AA0BD,MAAM,UAAU,sBAAsB,CAGrC,KAAc,EACd,UAAa,EACb,IAAW;IAMX,mBAAmB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAEjC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;QACvC,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;QAC9B,MAAM,UAAU,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;QAE9B,yBAAyB,CAAC,GAAG,EAAE,UAAU,EAAE,KAAK,CAAC,QAAQ,IAAI,KAAK,EAAE,IAAI,CAAC,CAAC;QAE1E,+DAA+D;QAC/D,+EAA+E;QAC/E,IAAI,KAAK,CAAC,QAAQ,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;YAChD,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACpE,6BAA6B,CAAC,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;QAC7D,CAAC;IACF,CAAC,CAAC,CAAC;AACJ,CAAC"}

View File

@@ -0,0 +1,11 @@
/**
* Resolve relative paths starting in & in the context of a given full path including parameters,
* which will be dropped in the process.
* If `candidateRelativePath` is not relative, it is returned unchanged.
*
* `parameters.a.b.c`, `&d` -> `a.b.d`
* `parameters.a.b[0].c`, `&d` -> `a.b[0].d`
* `parameters.a.b.c`, `d` -> `d`
*/
export declare function resolveRelativePath(fullPathWithParameters: string, candidateRelativePath: string): string;
//# sourceMappingURL=path-utils.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"path-utils.d.ts","sourceRoot":"","sources":["../../../src/node-parameters/path-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAClC,sBAAsB,EAAE,MAAM,EAC9B,qBAAqB,EAAE,MAAM,GAC3B,MAAM,CAWR"}

View File

@@ -0,0 +1,20 @@
/**
* Resolve relative paths starting in & in the context of a given full path including parameters,
* which will be dropped in the process.
* If `candidateRelativePath` is not relative, it is returned unchanged.
*
* `parameters.a.b.c`, `&d` -> `a.b.d`
* `parameters.a.b[0].c`, `&d` -> `a.b[0].d`
* `parameters.a.b.c`, `d` -> `d`
*/
export function resolveRelativePath(fullPathWithParameters, candidateRelativePath) {
if (candidateRelativePath.startsWith('&')) {
const resolvedLeaf = candidateRelativePath.slice(1);
const pathToLeaf = fullPathWithParameters.split('.').slice(1, -1).join('.');
if (!pathToLeaf)
return resolvedLeaf;
return `${pathToLeaf}.${resolvedLeaf}`;
}
return candidateRelativePath;
}
//# sourceMappingURL=path-utils.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"path-utils.js","sourceRoot":"","sources":["../../../src/node-parameters/path-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CAClC,sBAA8B,EAC9B,qBAA6B;IAE7B,IAAI,qBAAqB,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC3C,MAAM,YAAY,GAAG,qBAAqB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACpD,MAAM,UAAU,GAAG,sBAAsB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAE5E,IAAI,CAAC,UAAU;YAAE,OAAO,YAAY,CAAC;QAErC,OAAO,GAAG,UAAU,IAAI,YAAY,EAAE,CAAC;IACxC,CAAC;IAED,OAAO,qBAAqB,CAAC;AAC9B,CAAC"}

View File

@@ -0,0 +1,3 @@
import type { INode, NodeParameterValueType } from '../interfaces';
export declare function renameFormFields(node: INode, renameField: (v: NodeParameterValueType) => NodeParameterValueType): void;
//# sourceMappingURL=rename-node-utils.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"rename-node-utils.d.ts","sourceRoot":"","sources":["../../../src/node-parameters/rename-node-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAEnE,wBAAgB,gBAAgB,CAC/B,IAAI,EAAE,KAAK,EACX,WAAW,EAAE,CAAC,CAAC,EAAE,sBAAsB,KAAK,sBAAsB,GAChE,IAAI,CAuBN"}

View File

@@ -0,0 +1,23 @@
export function renameFormFields(node, renameField) {
const formFields = node.parameters?.formFields;
const values = formFields &&
typeof formFields === 'object' &&
'values' in formFields &&
typeof formFields.values === 'object' &&
// TypeScript thinks this is `Array.values` and gets very confused here
// eslint-disable-next-line @typescript-eslint/unbound-method
Array.isArray(formFields.values)
? // eslint-disable-next-line @typescript-eslint/unbound-method
(formFields.values ?? [])
: [];
for (const formFieldValue of values) {
if (!formFieldValue || typeof formFieldValue !== 'object')
continue;
if ('fieldType' in formFieldValue && formFieldValue.fieldType === 'html') {
if ('html' in formFieldValue) {
formFieldValue.html = renameField(formFieldValue.html);
}
}
}
}
//# sourceMappingURL=rename-node-utils.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"rename-node-utils.js","sourceRoot":"","sources":["../../../src/node-parameters/rename-node-utils.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,gBAAgB,CAC/B,IAAW,EACX,WAAkE;IAElE,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC;IAE/C,MAAM,MAAM,GACX,UAAU;QACV,OAAO,UAAU,KAAK,QAAQ;QAC9B,QAAQ,IAAI,UAAU;QACtB,OAAO,UAAU,CAAC,MAAM,KAAK,QAAQ;QACrC,uEAAuE;QACvE,6DAA6D;QAC7D,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC;QAC/B,CAAC,CAAC,6DAA6D;YAC9D,CAAC,UAAU,CAAC,MAAM,IAAI,EAAE,CAAC;QAC1B,CAAC,CAAC,EAAE,CAAC;IAEP,KAAK,MAAM,cAAc,IAAI,MAAM,EAAE,CAAC;QACrC,IAAI,CAAC,cAAc,IAAI,OAAO,cAAc,KAAK,QAAQ;YAAE,SAAS;QACpE,IAAI,WAAW,IAAI,cAAc,IAAI,cAAc,CAAC,SAAS,KAAK,MAAM,EAAE,CAAC;YAC1E,IAAI,MAAM,IAAI,cAAc,EAAE,CAAC;gBAC9B,cAAc,CAAC,IAAI,GAAG,WAAW,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;YACxD,CAAC;QACF,CAAC;IACF,CAAC;AACF,CAAC"}