mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
feat(core): Introduce simplified node versioning (#3205)
* ✨ Introduce simple node versioning * ⚡ Add example how to read version in node-code for custom logic * 🐛 Fix setting of parameters * 🐛 Fix another instance where it sets the wrong parameter * ⚡ Remove unnecessary TOODs * ⚡ Revert Set Node example changes * ;rotating_light: Add test
This commit is contained in:
@@ -517,6 +517,65 @@ class NodeTypesClass implements INodeTypes {
|
||||
},
|
||||
},
|
||||
},
|
||||
'n8n-nodes-base.versionTest': {
|
||||
sourcePath: '',
|
||||
type: {
|
||||
description: {
|
||||
displayName: 'Version Test',
|
||||
name: 'versionTest',
|
||||
group: ['input'],
|
||||
version: 1,
|
||||
description: 'Tests if versioning works',
|
||||
defaults: {
|
||||
name: 'Version Test',
|
||||
color: '#0000FF',
|
||||
},
|
||||
inputs: ['main'],
|
||||
outputs: ['main'],
|
||||
properties: [
|
||||
{
|
||||
displayName: 'Display V1',
|
||||
name: 'versionTest',
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
'@version': [1],
|
||||
},
|
||||
},
|
||||
default: 1,
|
||||
},
|
||||
{
|
||||
displayName: 'Display V2',
|
||||
name: 'versionTest',
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
'@version': [2],
|
||||
},
|
||||
},
|
||||
default: 2,
|
||||
},
|
||||
],
|
||||
},
|
||||
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
|
||||
for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
|
||||
const newItem: INodeExecutionData = {
|
||||
json: {
|
||||
versionFromParameter: this.getNodeParameter('versionTest', itemIndex),
|
||||
versionFromNode: this.getNode().typeVersion,
|
||||
},
|
||||
};
|
||||
|
||||
returnData.push(newItem);
|
||||
}
|
||||
|
||||
return this.prepareOutputData(returnData);
|
||||
},
|
||||
},
|
||||
},
|
||||
'n8n-nodes-base.set': {
|
||||
sourcePath: '',
|
||||
type: {
|
||||
|
||||
Reference in New Issue
Block a user