Skip to content

Commit 1b1c313

Browse files
authored
Merge pull request #103 from dafthunk-com/99-replace-array-nodetype-with-json-type
feat: replace array nodetype with json type
2 parents 94d14f4 + e474df3 commit 1b1c313

12 files changed

Lines changed: 19 additions & 33 deletions

apps/api/src/nodes/audio/whisper-large-v3-turbo-node.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export class WhisperLargeV3TurboNode extends ExecutableNode {
6868
},
6969
{
7070
name: "segments",
71-
type: "array",
71+
type: "json",
7272
description: "Detailed transcription segments with timing information",
7373
hidden: true,
7474
},

apps/api/src/nodes/audio/whisper-node.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export class WhisperNode extends ExecutableNode {
3838
},
3939
{
4040
name: "words",
41-
type: "array",
41+
type: "json",
4242
description: "Detailed word timing information",
4343
hidden: true,
4444
},

apps/api/src/nodes/audio/whisper-tiny-en-node.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export class WhisperTinyEnNode extends ExecutableNode {
3838
},
3939
{
4040
name: "words",
41-
type: "array",
41+
type: "json",
4242
description: "Detailed word timing information",
4343
hidden: true,
4444
},

apps/api/src/nodes/json/json-template-node.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export class JsonTemplateNode extends ExecutableNode {
3535
},
3636
{
3737
name: "missingVariables",
38-
type: "array",
38+
type: "json",
3939
description:
4040
"Array of variable names that were not found in the variables object",
4141
hidden: true,

apps/api/src/nodes/text/bge-reranker-base-node.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export class BgeRerankerBaseNode extends ExecutableNode {
2525
},
2626
{
2727
name: "contexts",
28-
type: "array",
28+
type: "json",
2929
description: "Array of text passages to rank",
3030
required: true,
3131
},
@@ -39,7 +39,7 @@ export class BgeRerankerBaseNode extends ExecutableNode {
3939
outputs: [
4040
{
4141
name: "rankings",
42-
type: "array",
42+
type: "json",
4343
description: "Array of ranked results with scores",
4444
},
4545
],

apps/api/src/nodes/text/multi-variable-string-template-node.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export class MultiVariableStringTemplateNode extends ExecutableNode {
3535
},
3636
{
3737
name: "missingVariables",
38-
type: "array",
38+
type: "json",
3939
description:
4040
"Array of variable names that were not found in the variables object",
4141
hidden: true,

apps/api/src/nodes/text/regex-extract-node.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export class RegexExtractNode extends ExecutableNode {
3636
outputs: [
3737
{
3838
name: "matches",
39-
type: "array",
39+
type: "json",
4040
description: "Array of matched strings (empty if no match).",
4141
},
4242
],

apps/api/src/nodes/text/regex-split-node.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export class RegexSplitNode extends ExecutableNode {
3434
outputs: [
3535
{
3636
name: "result",
37-
type: "array",
37+
type: "json",
3838
description: "Array of strings split by the pattern.",
3939
},
4040
],

apps/api/src/nodes/types.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,6 @@ export type ParameterType =
5757
type: "image";
5858
value?: ImageParameter;
5959
}
60-
| {
61-
type: "array";
62-
value?: Array<any>;
63-
}
6460
| {
6561
type: "json";
6662
value?: any;

apps/web/src/components/workflow/workflow-node.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { Handle, Position } from "@xyflow/react";
33
import {
44
AsteriskIcon,
55
BracesIcon,
6-
BracketsIcon,
76
CheckIcon,
87
ChevronDown,
98
ChevronUp,
@@ -65,17 +64,16 @@ const TypeBadge = ({
6564
onInputClick?: (param: WorkflowParameter) => void;
6665
readonly?: boolean;
6766
}) => {
68-
const icon = {
67+
const icon: Record<InputOutputType, React.ReactNode> = {
6968
string: <TypeIcon className="!size-3" />,
7069
number: <HashIcon className="!size-3" />,
7170
boolean: <CheckIcon className="!size-3" />,
7271
image: <ImageIcon className="!size-3" />,
7372
document: <StickyNoteIcon className="!size-3" />,
7473
audio: <MusicIcon className="!size-3" />,
75-
array: <BracketsIcon className="!size-3" />,
7674
json: <BracesIcon className="!size-3" />,
7775
any: <AsteriskIcon className="!size-3" />,
78-
}[type];
76+
} satisfies Record<InputOutputType, React.ReactNode>;
7977

8078
const handleClick = (e: React.MouseEvent) => {
8179
if (readonly) return;
@@ -136,7 +134,7 @@ const TypeBadge = ({
136134
)}
137135
onClick={handleClick}
138136
>
139-
{icon}
137+
{icon[type]}
140138
</span>
141139
</div>
142140
);

0 commit comments

Comments
 (0)