Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F10360790
ExampleNode.node.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
ExampleNode.node.ts
View Options
import
{
IExecuteFunctions
}
from
'n8n-core'
;
import
{
INodeExecutionData
,
INodeType
,
INodeTypeDescription
}
from
'n8n-workflow'
;
export
class
ExampleNode
implements
INodeType
{
description
:
INodeTypeDescription
=
{
displayName
:
'Example Node'
,
name
:
'exampleNode'
,
group
:
[
'transform'
],
version
:
1
,
description
:
'Basic Example Node'
,
defaults
:
{
name
:
'Example Node'
,
color
:
'#772244'
,
},
inputs
:
[
'main'
],
outputs
:
[
'main'
],
properties
:
[
// Node properties which the user gets displayed and
// can change on the node.
{
displayName
:
'My String'
,
name
:
'myString'
,
type
:
'string'
,
default
:
''
,
placeholder
:
'Placeholder value'
,
description
:
'The description text'
,
},
],
};
async
execute
(
this
:
IExecuteFunctions
)
:
Promise
<
INodeExecutionData
[][]
>
{
const
items
=
this
.
getInputData
();
let
item
:
INodeExecutionData
;
let
myString
:
string
;
// Itterates over all input items and add the key "myString" with the
// value the parameter "myString" resolves to.
// (This could be a different value for each item in case it contains an expression)
for
(
let
itemIndex
=
0
;
itemIndex
<
items
.
length
;
itemIndex
++
)
{
myString
=
this
.
getNodeParameter
(
'myString'
,
itemIndex
,
''
)
as
string
;
item
=
items
[
itemIndex
];
item
.
json
[
'myString'
]
=
myString
;
}
return
this
.
prepareOutputData
(
items
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Sat, Nov 8, 08:44 (1 d, 9 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1034377
Default Alt Text
ExampleNode.node.ts (1 KB)
Attached To
Mode
rNPN n8n-phabricator-node
Attached
Detach File
Event Timeline
Log In to Comment