File tree Expand file tree Collapse file tree 2 files changed +20
-4
lines changed
Expand file tree Collapse file tree 2 files changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -36,9 +36,25 @@ export class DynamicNode implements INodeType {
3636 // 1) Pull in the incoming items
3737 const items = this . getInputData ( ) ;
3838
39- // 2) Get the user-provided node JSON
40- const raw = this . getNodeParameter ( 'nodeJson' , 0 ) as any ;
41- if ( typeof raw !== 'object' ) {
39+ // 2) Get the user-provided node JSON (string or object)
40+ const rawParam = this . getNodeParameter ( 'nodeJson' , 0 ) as any ;
41+ // Accept either a true JSON object or a JSON string
42+ let raw : any ;
43+ if ( typeof rawParam === 'string' ) {
44+ try {
45+ raw = JSON . parse ( rawParam ) ;
46+ } catch {
47+ throw new NodeOperationError (
48+ this . getNode ( ) ,
49+ 'Node JSON must be a valid JSON object or a parseable JSON string' ,
50+ ) ;
51+ }
52+ } else {
53+ raw = rawParam ;
54+ }
55+ if ( typeof raw !== 'object' || raw === null ) {
56+ throw new NodeOperationError ( this . getNode ( ) , 'Node JSON must be an object' ) ;
57+ } {
4258 throw new NodeOperationError ( this . getNode ( ) , 'Node JSON must be an object' ) ;
4359 }
4460
Original file line number Diff line number Diff line change 11{
22 "name" : " n8n-nodes-dynamic-node" ,
3- "version" : " 0.1.4 " ,
3+ "version" : " 0.1.5 " ,
44 "description" : " A dynamic n8n node wrapper that can execute any node JSON by feeding it at runtime." ,
55 "keywords" : [
66 " n8n-community-node-package" ,
You can’t perform that action at this time.
0 commit comments