Skip to content

Commit

Permalink
Object node can inspect its output to see if it's an array and return…
Browse files Browse the repository at this point in the history
… a more appropriate type
  • Loading branch information
abrenneke committed Jan 17, 2024
1 parent dee51a8 commit 61f42f9
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/core/src/model/nodes/ObjectNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class ObjectNodeImpl extends NodeImpl<ObjectNode> {
getOutputDefinitions(): NodeOutputDefinition[] {
return [
{
dataType: 'object',
dataType: ['object', 'object[]'],
id: 'output' as PortId,
title: 'Output',
},
Expand Down Expand Up @@ -126,6 +126,15 @@ export class ObjectNodeImpl extends NodeImpl<ObjectNode> {
unknown
>;

if (Array.isArray(outputValue)) {
return {
output: {
type: 'object[]',
value: outputValue,
},
};
}

return {
output: {
type: 'object',
Expand Down

0 comments on commit 61f42f9

Please sign in to comment.