Skip to content

Commit b3822b8

Browse files
author
drowl87
committed
update README for clarity on node picker location, enhance execution result handling in DynamicNode, and bump version to 0.2.8
1 parent ee4a74a commit b3822b8

3 files changed

Lines changed: 19 additions & 26 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ After installing the node, you can use it like any other node. n8n displays the
2828
npm install n8n-nodes-dynamic-node --save
2929
```
3030
2. Restart n8n.
31-
3. You’ll now see **Dynamic Node** under **Action in an app** in the node picker.
31+
3. You’ll now see **Dynamic Node** in the node picker.
3232

3333
For Docker-based deployments, add the following line before the font installation command in your [n8n Dockerfile](https://github.com/n8n-io/n8n/blob/master/docker/images/n8n/Dockerfile):
3434

nodes/DynamicNode/DynamicNode.node.ts

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -112,32 +112,25 @@ export class DynamicNode implements INodeType {
112112
},
113113
);
114114

115-
// 11) Process executionResult (either your original logic or the suggested one)
115+
// 11) Process executionResult
116116
let returnedData: INodeExecutionData[][] = [];
117117
if (Array.isArray(executionResult)) {
118-
returnedData = executionResult;
119-
} else if (executionResult && typeof executionResult === 'object' && 'data' in executionResult) {
120-
// A slightly more robust check for the { data: ... } structure
121-
if (Array.isArray(executionResult.data)) {
122-
returnedData = executionResult.data as INodeExecutionData[][];
123-
} else {
124-
// Handle cases where executionResult.data might not be an array as expected
125-
console.warn('DynamicNode: executionResult.data was not an array, attempting to wrap.');
126-
// This part is speculative and depends on what executeWorkflow might return in edge cases
127-
// For now, let's assume it should be an array or we make it an empty one
128-
returnedData = [];
129-
}
130-
} else if (executionResult === null || executionResult === undefined) {
131-
console.warn('DynamicNode: executionResult was null or undefined.');
132-
returnedData = []; // Default to empty if nothing came back
133-
}
134-
// Add detailed logging
135-
console.log('DynamicNode: Final returnedData structure:', JSON.stringify(returnedData, null, 2));
136-
if (returnedData && returnedData[0] && returnedData[0][0]) {
137-
console.log('DynamicNode: JSON content of the first item:', JSON.stringify(returnedData[0][0].json, null, 2));
138-
} else {
139-
console.log('DynamicNode: No valid first item found in returnedData to inspect .json property.');
140-
}
118+
returnedData = executionResult as INodeExecutionData[][];
119+
} else if (executionResult && typeof executionResult === 'object' && 'data' in executionResult) {
120+
if (Array.isArray((executionResult as any).data)) {
121+
returnedData = (executionResult as any).data as INodeExecutionData[][];
122+
} else {
123+
this.logger.warn('DynamicNode: Sub-workflow executionResult.data was not an array. Returning empty data.');
124+
returnedData = [];
125+
}
126+
} else if (executionResult === null || executionResult === undefined) {
127+
this.logger.warn('DynamicNode: Sub-workflow executionResult was null or undefined. Returning empty data.');
128+
returnedData = [];
129+
} else {
130+
// Catch-all for other unexpected structures from executeWorkflow
131+
this.logger.warn(`DynamicNode: Unexpected structure from sub-workflow execution. Type: ${typeof executionResult}. Returning empty data.`);
132+
returnedData = [];
133+
}
141134

142135
return returnedData;
143136
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "n8n-nodes-dynamic-node",
3-
"version": "0.2.7",
3+
"version": "0.2.8",
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",

0 commit comments

Comments
 (0)