Skip to content

Commit 331deaf

Browse files
Add input and output descriptions to math nodes
Co-authored-by: leocser632 <leocser632@gmail.com>
1 parent 63901db commit 331deaf

13 files changed

Lines changed: 179 additions & 27 deletions

apps/api/src/nodes/math/absolute-value-node.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,21 @@ export class AbsoluteValueNode extends ExecutableNode {
1616
icon: "absolute",
1717
inlinable: true,
1818
asTool: true,
19-
inputs: [{ name: "value", type: "number", required: true }],
20-
outputs: [{ name: "result", type: "number" }],
19+
inputs: [
20+
{
21+
name: "value",
22+
type: "number",
23+
description: "The number to calculate the absolute value of",
24+
required: true,
25+
},
26+
],
27+
outputs: [
28+
{
29+
name: "result",
30+
type: "number",
31+
description: "The absolute value of the input number",
32+
},
33+
],
2134
};
2235

2336
async execute(context: NodeContext): Promise<NodeExecution> {

apps/api/src/nodes/math/addition-node.ts

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,26 @@ export class AdditionNode extends ExecutableNode {
1616
inlinable: true,
1717
asTool: true,
1818
inputs: [
19-
{ name: "a", type: "number", required: true },
20-
{ name: "b", type: "number", required: true },
19+
{
20+
name: "a",
21+
type: "number",
22+
description: "The first number to add",
23+
required: true
24+
},
25+
{
26+
name: "b",
27+
type: "number",
28+
description: "The second number to add",
29+
required: true
30+
},
31+
],
32+
outputs: [
33+
{
34+
name: "result",
35+
type: "number",
36+
description: "The sum of the two input numbers",
37+
},
2138
],
22-
outputs: [{ name: "result", type: "number" }],
2339
};
2440

2541
async execute(context: NodeContext): Promise<NodeExecution> {

apps/api/src/nodes/math/avg-node.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,13 @@ export class AvgNode extends ExecutableNode {
2626
repeated: true,
2727
},
2828
],
29-
outputs: [{ name: "result", type: "number" }],
29+
outputs: [
30+
{
31+
name: "result",
32+
type: "number",
33+
description: "The average (mean) value of the input numbers",
34+
},
35+
],
3036
};
3137

3238
async execute(context: NodeContext): Promise<NodeExecution> {

apps/api/src/nodes/math/division-node.ts

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,26 @@ export class DivisionNode extends ExecutableNode {
1717
inlinable: true,
1818
asTool: true,
1919
inputs: [
20-
{ name: "a", type: "number", required: true },
21-
{ name: "b", type: "number", required: true },
20+
{
21+
name: "a",
22+
type: "number",
23+
description: "The dividend (number to be divided)",
24+
required: true
25+
},
26+
{
27+
name: "b",
28+
type: "number",
29+
description: "The divisor (number to divide by)",
30+
required: true
31+
},
32+
],
33+
outputs: [
34+
{
35+
name: "result",
36+
type: "number",
37+
description: "The quotient of a divided by b",
38+
},
2239
],
23-
outputs: [{ name: "result", type: "number" }],
2440
};
2541

2642
async execute(context: NodeContext): Promise<NodeExecution> {

apps/api/src/nodes/math/exponentiation-node.ts

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,26 @@ export class ExponentiationNode extends ExecutableNode {
1717
inlinable: true,
1818
asTool: true,
1919
inputs: [
20-
{ name: "base", type: "number", required: true },
21-
{ name: "exponent", type: "number", required: true },
20+
{
21+
name: "base",
22+
type: "number",
23+
description: "The base number to be raised to a power",
24+
required: true
25+
},
26+
{
27+
name: "exponent",
28+
type: "number",
29+
description: "The power to raise the base to",
30+
required: true
31+
},
32+
],
33+
outputs: [
34+
{
35+
name: "result",
36+
type: "number",
37+
description: "The result of base raised to the power of exponent",
38+
},
2239
],
23-
outputs: [{ name: "result", type: "number" }],
2440
};
2541

2642
async execute(context: NodeContext): Promise<NodeExecution> {

apps/api/src/nodes/math/max-node.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,13 @@ export class MaxNode extends ExecutableNode {
2626
repeated: true,
2727
},
2828
],
29-
outputs: [{ name: "result", type: "number" }],
29+
outputs: [
30+
{
31+
name: "result",
32+
type: "number",
33+
description: "The maximum value from the input numbers",
34+
},
35+
],
3036
};
3137

3238
async execute(context: NodeContext): Promise<NodeExecution> {

apps/api/src/nodes/math/median-node.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,13 @@ export class MedianNode extends ExecutableNode {
2727
repeated: true,
2828
},
2929
],
30-
outputs: [{ name: "result", type: "number" }],
30+
outputs: [
31+
{
32+
name: "result",
33+
type: "number",
34+
description: "The median value of the input numbers (middle value when sorted)",
35+
},
36+
],
3137
};
3238

3339
async execute(context: NodeContext): Promise<NodeExecution> {

apps/api/src/nodes/math/min-node.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,13 @@ export class MinNode extends ExecutableNode {
2626
repeated: true,
2727
},
2828
],
29-
outputs: [{ name: "result", type: "number" }],
29+
outputs: [
30+
{
31+
name: "result",
32+
type: "number",
33+
description: "The minimum value from the input numbers",
34+
},
35+
],
3036
};
3137

3238
async execute(context: NodeContext): Promise<NodeExecution> {

apps/api/src/nodes/math/modulo-node.ts

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,26 @@ export class ModuloNode extends ExecutableNode {
1818
inlinable: true,
1919
asTool: true,
2020
inputs: [
21-
{ name: "a", type: "number", required: true },
22-
{ name: "b", type: "number", required: true },
21+
{
22+
name: "a",
23+
type: "number",
24+
description: "The dividend (number to be divided)",
25+
required: true
26+
},
27+
{
28+
name: "b",
29+
type: "number",
30+
description: "The divisor (number to divide by)",
31+
required: true
32+
},
33+
],
34+
outputs: [
35+
{
36+
name: "result",
37+
type: "number",
38+
description: "The remainder after dividing a by b",
39+
},
2340
],
24-
outputs: [{ name: "result", type: "number" }],
2541
};
2642

2743
async execute(context: NodeContext): Promise<NodeExecution> {

apps/api/src/nodes/math/multiplication-node.ts

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,26 @@ export class MultiplicationNode extends ExecutableNode {
1717
inlinable: true,
1818
asTool: true,
1919
inputs: [
20-
{ name: "a", type: "number", required: true },
21-
{ name: "b", type: "number", required: true },
20+
{
21+
name: "a",
22+
type: "number",
23+
description: "The first number to multiply",
24+
required: true
25+
},
26+
{
27+
name: "b",
28+
type: "number",
29+
description: "The second number to multiply",
30+
required: true
31+
},
32+
],
33+
outputs: [
34+
{
35+
name: "result",
36+
type: "number",
37+
description: "The product of the two input numbers",
38+
},
2239
],
23-
outputs: [{ name: "result", type: "number" }],
2440
};
2541

2642
async execute(context: NodeContext): Promise<NodeExecution> {

0 commit comments

Comments
 (0)