mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-16 17:46:45 +00:00
fix(editor): Support line breaks in resource mapper field names (#18982)
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
import type { ResourceMapperField } from 'n8n-workflow';
|
||||
import { isCommunityPackageName, isResourceMapperFieldListStale } from './nodeTypesUtils';
|
||||
import {
|
||||
isCommunityPackageName,
|
||||
isResourceMapperFieldListStale,
|
||||
parseResourceMapperFieldName,
|
||||
} from './nodeTypesUtils';
|
||||
|
||||
describe('isResourceMapperFieldListStale', () => {
|
||||
const baseField: ResourceMapperField = {
|
||||
@@ -127,3 +131,27 @@ describe('isCommunityPackageName', () => {
|
||||
expect(isCommunityPackageName('@test-scope/n8n-nodes-test')).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('parseResourceMapperFieldName', () => {
|
||||
test.each([
|
||||
{ input: 'value["fieldName"]', expected: 'fieldName', desc: 'basic field name' },
|
||||
{
|
||||
input: 'value["field with spaces"]',
|
||||
expected: 'field with spaces',
|
||||
desc: 'field with spaces',
|
||||
},
|
||||
{
|
||||
input: 'value["field\nwith\nactual\nnewlines"]',
|
||||
expected: 'field\nwith\nactual\nnewlines',
|
||||
desc: 'field with newlines',
|
||||
},
|
||||
{
|
||||
input: 'value["field\\"with\\"quotes"]',
|
||||
expected: 'field\\"with\\"quotes',
|
||||
desc: 'field with escaped quotes',
|
||||
},
|
||||
{ input: 'fieldName', expected: 'fieldName', desc: 'no value wrapper' },
|
||||
])('should parse $desc', ({ input, expected }) => {
|
||||
expect(parseResourceMapperFieldName(input)).toBe(expected);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -32,7 +32,7 @@ import {
|
||||
const CRED_KEYWORDS_TO_FILTER = ['API', 'OAuth1', 'OAuth2'];
|
||||
const NODE_KEYWORDS_TO_FILTER = ['Trigger'];
|
||||
const COMMUNITY_PACKAGE_NAME_REGEX = /^(?!@n8n\/)(@[\w.-]+\/)?n8n-nodes-(?!base\b)\b\w+/g;
|
||||
const RESOURCE_MAPPER_FIELD_NAME_REGEX = /value\[\"(.+)\"\]/;
|
||||
const RESOURCE_MAPPER_FIELD_NAME_REGEX = /value\["(.+?)"\]/s;
|
||||
|
||||
export function getAppNameFromCredType(name: string) {
|
||||
return name
|
||||
|
||||
Reference in New Issue
Block a user