ugcinc 4.1.21 → 4.1.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/automations/nodes/branch.d.ts +7 -4
- package/dist/automations/nodes/branch.js +25 -4
- package/dist/automations/nodes/index.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/package.json +1 -1
- package/dist/automations.d.ts +0 -173
- package/dist/automations.js +0 -194
- package/dist/node-runtime.d.ts +0 -57
- package/dist/node-runtime.js +0 -6
- package/dist/nodes/account.d.ts +0 -7
- package/dist/nodes/account.js +0 -29
- package/dist/nodes/auto-caption.d.ts +0 -17
- package/dist/nodes/auto-caption.js +0 -46
- package/dist/nodes/auto-post.d.ts +0 -21
- package/dist/nodes/auto-post.js +0 -54
- package/dist/nodes/branch.d.ts +0 -12
- package/dist/nodes/branch.js +0 -50
- package/dist/nodes/collect.d.ts +0 -6
- package/dist/nodes/collect.js +0 -56
- package/dist/nodes/compose-workflow.d.ts +0 -21
- package/dist/nodes/compose-workflow.js +0 -42
- package/dist/nodes/create-dm.d.ts +0 -40
- package/dist/nodes/create-dm.js +0 -88
- package/dist/nodes/custom-model.d.ts +0 -19
- package/dist/nodes/custom-model.js +0 -52
- package/dist/nodes/deduplicate.d.ts +0 -8
- package/dist/nodes/deduplicate.js +0 -36
- package/dist/nodes/destructure.d.ts +0 -25
- package/dist/nodes/destructure.js +0 -65
- package/dist/nodes/for-each.d.ts +0 -23
- package/dist/nodes/for-each.js +0 -84
- package/dist/nodes/generate-image.d.ts +0 -16
- package/dist/nodes/generate-image.js +0 -45
- package/dist/nodes/generate-video.d.ts +0 -16
- package/dist/nodes/generate-video.js +0 -45
- package/dist/nodes/if.d.ts +0 -22
- package/dist/nodes/if.js +0 -44
- package/dist/nodes/image-composer.d.ts +0 -14
- package/dist/nodes/image-composer.js +0 -95
- package/dist/nodes/index.d.ts +0 -20
- package/dist/nodes/index.js +0 -93
- package/dist/nodes/llm.d.ts +0 -27
- package/dist/nodes/llm.js +0 -85
- package/dist/nodes/manual-trigger.d.ts +0 -16
- package/dist/nodes/manual-trigger.js +0 -32
- package/dist/nodes/media.d.ts +0 -17
- package/dist/nodes/media.js +0 -40
- package/dist/nodes/not.d.ts +0 -6
- package/dist/nodes/not.js +0 -35
- package/dist/nodes/output.d.ts +0 -9
- package/dist/nodes/output.js +0 -32
- package/dist/nodes/random-route.d.ts +0 -3
- package/dist/nodes/random-route.js +0 -50
- package/dist/nodes/random.d.ts +0 -3
- package/dist/nodes/random.js +0 -48
- package/dist/nodes/recurrence.d.ts +0 -3
- package/dist/nodes/recurrence.js +0 -45
- package/dist/nodes/save-to-media.d.ts +0 -3
- package/dist/nodes/save-to-media.js +0 -26
- package/dist/nodes/screenshot-animation.d.ts +0 -7
- package/dist/nodes/screenshot-animation.js +0 -36
- package/dist/nodes/social-audio.d.ts +0 -3
- package/dist/nodes/social-audio.js +0 -26
- package/dist/nodes/text.d.ts +0 -3
- package/dist/nodes/text.js +0 -38
- package/dist/nodes/transcript.d.ts +0 -3
- package/dist/nodes/transcript.js +0 -42
- package/dist/nodes/types.d.ts +0 -146
- package/dist/nodes/types.js +0 -22
- package/dist/nodes/video-composer.d.ts +0 -3
- package/dist/nodes/video-composer.js +0 -67
- package/dist/nodes/video-import.d.ts +0 -3
- package/dist/nodes/video-import.js +0 -35
- package/dist/ports.d.ts +0 -54
- package/dist/ports.js +0 -327
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const definition = {
|
|
4
|
-
nodeId: 'video-composer',
|
|
5
|
-
label: 'Video Composer',
|
|
6
|
-
description: 'Create templated videos',
|
|
7
|
-
type: 'generator',
|
|
8
|
-
category: 'Generation',
|
|
9
|
-
getDefaultConfig: () => ({
|
|
10
|
-
videoEditor: {
|
|
11
|
-
width: 1080,
|
|
12
|
-
height: 1920,
|
|
13
|
-
fps: 30,
|
|
14
|
-
dimensionPreset: '9:16',
|
|
15
|
-
channels: [{
|
|
16
|
-
id: 'main-track',
|
|
17
|
-
name: 'Main Track',
|
|
18
|
-
segments: [],
|
|
19
|
-
}],
|
|
20
|
-
},
|
|
21
|
-
outputMode: 'per-input',
|
|
22
|
-
}),
|
|
23
|
-
computePorts: ({ config }) => {
|
|
24
|
-
const editorConfig = config?.videoEditor;
|
|
25
|
-
const inputs = [];
|
|
26
|
-
const addedIds = new Set();
|
|
27
|
-
if (editorConfig) {
|
|
28
|
-
editorConfig.channels.forEach(channel => {
|
|
29
|
-
channel.segments.forEach(segment => {
|
|
30
|
-
if (segment.inputRef && !addedIds.has(segment.inputRef)) {
|
|
31
|
-
addedIds.add(segment.inputRef);
|
|
32
|
-
const inputType = segment.type === 'video' ? 'video'
|
|
33
|
-
: segment.type === 'audio' ? 'audio'
|
|
34
|
-
: 'image';
|
|
35
|
-
inputs.push({
|
|
36
|
-
id: segment.inputRef,
|
|
37
|
-
type: inputType,
|
|
38
|
-
isArray: false,
|
|
39
|
-
required: segment.required ?? true,
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
if (segment.textInputRef && !addedIds.has(segment.textInputRef)) {
|
|
43
|
-
addedIds.add(segment.textInputRef);
|
|
44
|
-
inputs.push({
|
|
45
|
-
id: segment.textInputRef,
|
|
46
|
-
type: 'text',
|
|
47
|
-
isArray: false,
|
|
48
|
-
required: segment.required ?? true,
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
return {
|
|
55
|
-
inputs,
|
|
56
|
-
outputs: [
|
|
57
|
-
{
|
|
58
|
-
id: 'output',
|
|
59
|
-
type: 'video',
|
|
60
|
-
isArray: false,
|
|
61
|
-
required: true,
|
|
62
|
-
},
|
|
63
|
-
],
|
|
64
|
-
};
|
|
65
|
-
},
|
|
66
|
-
};
|
|
67
|
-
exports.default = definition;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const definition = {
|
|
4
|
-
nodeId: 'video-import',
|
|
5
|
-
label: 'Import Video',
|
|
6
|
-
description: 'Import videos from YouTube, TikTok, Instagram & more',
|
|
7
|
-
type: 'source',
|
|
8
|
-
category: 'Sources',
|
|
9
|
-
getDefaultConfig: () => ({
|
|
10
|
-
videoImportConfig: {
|
|
11
|
-
platform: 'youtube',
|
|
12
|
-
videoQuality: '1080',
|
|
13
|
-
},
|
|
14
|
-
outputMode: 'per-input',
|
|
15
|
-
}),
|
|
16
|
-
computePorts: () => ({
|
|
17
|
-
inputs: [
|
|
18
|
-
{
|
|
19
|
-
id: 'url',
|
|
20
|
-
type: 'text',
|
|
21
|
-
isArray: false,
|
|
22
|
-
required: true,
|
|
23
|
-
},
|
|
24
|
-
],
|
|
25
|
-
outputs: [
|
|
26
|
-
{
|
|
27
|
-
id: 'video',
|
|
28
|
-
type: 'video',
|
|
29
|
-
isArray: false,
|
|
30
|
-
required: true,
|
|
31
|
-
},
|
|
32
|
-
],
|
|
33
|
-
}),
|
|
34
|
-
};
|
|
35
|
-
exports.default = definition;
|
package/dist/ports.d.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Port computation utilities for automation nodes
|
|
3
|
-
*
|
|
4
|
-
* These functions dynamically compute input and output ports for nodes
|
|
5
|
-
* based on their type and configuration. Used by both webapp (for UI rendering)
|
|
6
|
-
* and API (for validation and execution).
|
|
7
|
-
*/
|
|
8
|
-
import type { PortType, NodeTypeEnum, PropertySchema } from './types';
|
|
9
|
-
/**
|
|
10
|
-
* Computed port definition
|
|
11
|
-
*/
|
|
12
|
-
export interface ComputedPort {
|
|
13
|
-
id: string;
|
|
14
|
-
type: PortType | PortType[];
|
|
15
|
-
required: boolean;
|
|
16
|
-
itemSchema?: Record<string, PropertySchema>;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Extract template variables from text (e.g., "Hello {{name}}" -> ["name"])
|
|
20
|
-
*/
|
|
21
|
-
export declare function extractTemplateVariables(texts: string[]): string[];
|
|
22
|
-
/**
|
|
23
|
-
* Minimal node interface for port computation
|
|
24
|
-
* Allows both WorkflowNodeDefinition and webapp's Node type to be used
|
|
25
|
-
*/
|
|
26
|
-
interface NodeLike {
|
|
27
|
-
id: string;
|
|
28
|
-
type: NodeTypeEnum;
|
|
29
|
-
config?: Record<string, unknown>;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Compute the input ports for a node based on its type and config
|
|
33
|
-
*/
|
|
34
|
-
export declare function computeInputPorts({ node }: {
|
|
35
|
-
node: NodeLike;
|
|
36
|
-
}): ComputedPort[];
|
|
37
|
-
/**
|
|
38
|
-
* Compute the output ports for a node based on its type and config
|
|
39
|
-
*
|
|
40
|
-
* Uses resolvedPorts as the primary source of truth - modals save complete
|
|
41
|
-
* port definitions to resolvedPorts when the node is configured.
|
|
42
|
-
* Falls back to static outputs from getAllNodes() for nodes without dynamic ports.
|
|
43
|
-
*/
|
|
44
|
-
export declare function computeOutputPorts({ node }: {
|
|
45
|
-
node: NodeLike;
|
|
46
|
-
}): ComputedPort[];
|
|
47
|
-
/**
|
|
48
|
-
* Check if an input port is required for a given node.
|
|
49
|
-
*/
|
|
50
|
-
export declare function isInputPortRequired({ node, portId, }: {
|
|
51
|
-
node: NodeLike;
|
|
52
|
-
portId: string;
|
|
53
|
-
}): boolean;
|
|
54
|
-
export {};
|
package/dist/ports.js
DELETED
|
@@ -1,327 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Port computation utilities for automation nodes
|
|
4
|
-
*
|
|
5
|
-
* These functions dynamically compute input and output ports for nodes
|
|
6
|
-
* based on their type and configuration. Used by both webapp (for UI rendering)
|
|
7
|
-
* and API (for validation and execution).
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.extractTemplateVariables = extractTemplateVariables;
|
|
11
|
-
exports.computeInputPorts = computeInputPorts;
|
|
12
|
-
exports.computeOutputPorts = computeOutputPorts;
|
|
13
|
-
exports.isInputPortRequired = isInputPortRequired;
|
|
14
|
-
const types_1 = require("./types");
|
|
15
|
-
const automations_1 = require("./automations");
|
|
16
|
-
/**
|
|
17
|
-
* Extract template variables from text (e.g., "Hello {{name}}" -> ["name"])
|
|
18
|
-
*/
|
|
19
|
-
function extractTemplateVariables(texts) {
|
|
20
|
-
const variables = new Set();
|
|
21
|
-
const regex = /\{\{(\w+)\}\}/g;
|
|
22
|
-
for (const text of texts) {
|
|
23
|
-
let match;
|
|
24
|
-
while ((match = regex.exec(text)) !== null) {
|
|
25
|
-
if (match[1])
|
|
26
|
-
variables.add(match[1]);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return Array.from(variables);
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Compute the input ports for a node based on its type and config
|
|
33
|
-
*/
|
|
34
|
-
function computeInputPorts({ node }) {
|
|
35
|
-
const nodeConfigs = (0, automations_1.getAllNodes)();
|
|
36
|
-
const nodeConfig = nodeConfigs.find(n => n.nodeId === node.type);
|
|
37
|
-
const baseInputs = nodeConfig?.inputs ?? [];
|
|
38
|
-
// Text nodes: generate inputs from template variables
|
|
39
|
-
if (node.type === 'text') {
|
|
40
|
-
const textOptions = (node.config?.textOptions ?? []);
|
|
41
|
-
const variables = extractTemplateVariables(textOptions);
|
|
42
|
-
if (variables.length === 0)
|
|
43
|
-
return baseInputs;
|
|
44
|
-
return variables.map(variable => ({
|
|
45
|
-
id: variable,
|
|
46
|
-
type: (0, types_1.portType)({ type: 'text', isArray: false }),
|
|
47
|
-
required: false,
|
|
48
|
-
}));
|
|
49
|
-
}
|
|
50
|
-
// Image-editor nodes: generate inputs from elements
|
|
51
|
-
if (node.type === 'image-composer') {
|
|
52
|
-
const editorConfig = node.config?.imageEditor;
|
|
53
|
-
if (!editorConfig)
|
|
54
|
-
return baseInputs;
|
|
55
|
-
const dynamicInputs = [];
|
|
56
|
-
// Only add background input if backgroundType is 'image'
|
|
57
|
-
if (editorConfig.backgroundType !== 'color') {
|
|
58
|
-
dynamicInputs.push({
|
|
59
|
-
id: 'background',
|
|
60
|
-
type: (0, types_1.portType)({ type: 'image', isArray: false }),
|
|
61
|
-
required: true,
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
// Add inputs for each element that has an inputId or textInputId
|
|
65
|
-
editorConfig.elements.forEach(elem => {
|
|
66
|
-
if (elem.type === 'image' && elem.inputId) {
|
|
67
|
-
dynamicInputs.push({
|
|
68
|
-
id: elem.inputId,
|
|
69
|
-
type: (0, types_1.portType)({ type: 'image', isArray: false }),
|
|
70
|
-
required: true,
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
else if (elem.type === 'text' && elem.textInputId) {
|
|
74
|
-
dynamicInputs.push({
|
|
75
|
-
id: elem.textInputId,
|
|
76
|
-
type: (0, types_1.portType)({ type: 'text', isArray: false }),
|
|
77
|
-
required: true,
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
// Add crop boundary inputs (not required)
|
|
82
|
-
const addedCropInputs = new Set();
|
|
83
|
-
const cropConfig = editorConfig.dynamicCrop;
|
|
84
|
-
[
|
|
85
|
-
cropConfig?.vertical?.startBoundary?.inputRef,
|
|
86
|
-
cropConfig?.vertical?.endBoundary?.inputRef,
|
|
87
|
-
cropConfig?.horizontal?.startBoundary?.inputRef,
|
|
88
|
-
cropConfig?.horizontal?.endBoundary?.inputRef,
|
|
89
|
-
].forEach(inputRef => {
|
|
90
|
-
if (inputRef && !addedCropInputs.has(inputRef)) {
|
|
91
|
-
addedCropInputs.add(inputRef);
|
|
92
|
-
dynamicInputs.push({
|
|
93
|
-
id: inputRef,
|
|
94
|
-
type: (0, types_1.portType)({ type: 'text', isArray: false }),
|
|
95
|
-
required: false,
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
return dynamicInputs;
|
|
100
|
-
}
|
|
101
|
-
// Video-editor nodes: generate inputs from segments
|
|
102
|
-
if (node.type === 'video-composer') {
|
|
103
|
-
const editorConfig = node.config?.videoEditor;
|
|
104
|
-
if (!editorConfig)
|
|
105
|
-
return [];
|
|
106
|
-
const dynamicInputs = [];
|
|
107
|
-
const addedIds = new Set();
|
|
108
|
-
editorConfig.channels.forEach(channel => {
|
|
109
|
-
channel.segments.forEach(segment => {
|
|
110
|
-
if ('inputRef' in segment && segment.inputRef && !addedIds.has(segment.inputRef)) {
|
|
111
|
-
addedIds.add(segment.inputRef);
|
|
112
|
-
const inputType = segment.type === 'video' ? (0, types_1.portType)({ type: 'video', isArray: false })
|
|
113
|
-
: segment.type === 'audio' ? (0, types_1.portType)({ type: 'audio', isArray: false })
|
|
114
|
-
: (0, types_1.portType)({ type: 'image', isArray: false });
|
|
115
|
-
dynamicInputs.push({
|
|
116
|
-
id: segment.inputRef,
|
|
117
|
-
type: inputType,
|
|
118
|
-
required: true,
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
if ('textInputRef' in segment && segment.textInputRef && !addedIds.has(segment.textInputRef)) {
|
|
122
|
-
addedIds.add(segment.textInputRef);
|
|
123
|
-
dynamicInputs.push({
|
|
124
|
-
id: segment.textInputRef,
|
|
125
|
-
type: (0, types_1.portType)({ type: 'text', isArray: false }),
|
|
126
|
-
required: true,
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
});
|
|
131
|
-
return dynamicInputs;
|
|
132
|
-
}
|
|
133
|
-
// Workflow nodes: generate inputs from embedded workflow's variable nodes
|
|
134
|
-
if (node.type === 'compose-workflow') {
|
|
135
|
-
const variableNodes = node.config?.workflowVariableNodes;
|
|
136
|
-
if (!variableNodes || variableNodes.length === 0)
|
|
137
|
-
return baseInputs;
|
|
138
|
-
return variableNodes.map(v => {
|
|
139
|
-
const varType = v.variableType === 'dropdown' ? 'text' : (v.variableType ?? 'text');
|
|
140
|
-
return {
|
|
141
|
-
id: v.id,
|
|
142
|
-
type: (0, types_1.portType)({ type: varType, isArray: false }),
|
|
143
|
-
required: false,
|
|
144
|
-
};
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
// Output nodes: generate inputs from outputConfig.inputs
|
|
148
|
-
if (node.type === 'output') {
|
|
149
|
-
const outputConfig = node.config?.outputConfig;
|
|
150
|
-
const configInputs = outputConfig?.inputs;
|
|
151
|
-
if (!configInputs || configInputs.length === 0)
|
|
152
|
-
return baseInputs;
|
|
153
|
-
return configInputs.map((input) => ({
|
|
154
|
-
id: input.id,
|
|
155
|
-
type: (0, types_1.portType)({ type: input.type, isArray: input.isArray ?? false }),
|
|
156
|
-
required: false,
|
|
157
|
-
}));
|
|
158
|
-
}
|
|
159
|
-
// Auto-post nodes: video or slideshow mode
|
|
160
|
-
if (node.type === 'auto-post') {
|
|
161
|
-
const autoPostConfig = node.config?.autoPostConfig;
|
|
162
|
-
const mode = autoPostConfig?.mode ?? 'video';
|
|
163
|
-
const dynamicInputs = [];
|
|
164
|
-
if (mode === 'video') {
|
|
165
|
-
// Video mode: video input required
|
|
166
|
-
dynamicInputs.push({ id: 'video', type: (0, types_1.portType)({ type: 'video', isArray: false }), required: true });
|
|
167
|
-
}
|
|
168
|
-
else {
|
|
169
|
-
// Slideshow mode
|
|
170
|
-
const inputType = autoPostConfig?.inputType ?? 'static';
|
|
171
|
-
if (inputType === 'variable') {
|
|
172
|
-
// Variable mode: single images array port
|
|
173
|
-
dynamicInputs.push({ id: 'images', type: (0, types_1.portType)({ type: 'object', isArray: false }), required: true });
|
|
174
|
-
}
|
|
175
|
-
else {
|
|
176
|
-
// Static mode: individual image inputs
|
|
177
|
-
const imageInputs = autoPostConfig?.inputs ?? [
|
|
178
|
-
{ id: 'image1' },
|
|
179
|
-
{ id: 'image2' },
|
|
180
|
-
{ id: 'image3' },
|
|
181
|
-
];
|
|
182
|
-
imageInputs.forEach((input) => {
|
|
183
|
-
dynamicInputs.push({ id: input.id, type: (0, types_1.portType)({ type: 'image', isArray: false }), required: true });
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
// Add static inputs (same for both modes)
|
|
188
|
-
dynamicInputs.push({ id: 'account', type: (0, types_1.portType)({ type: 'account', isArray: false }), required: true }, { id: 'caption', type: (0, types_1.portType)({ type: 'text', isArray: false }), required: false });
|
|
189
|
-
// Only add social-audio port if isVariable is true
|
|
190
|
-
if (autoPostConfig?.socialAudio?.isVariable) {
|
|
191
|
-
dynamicInputs.push({ id: 'social-audio', type: (0, types_1.portType)({ type: 'audio', isArray: false }), required: false });
|
|
192
|
-
}
|
|
193
|
-
return dynamicInputs;
|
|
194
|
-
}
|
|
195
|
-
// Save-to-media nodes: generate inputs from saveToMediaConfig.inputs
|
|
196
|
-
if (node.type === 'save-to-media') {
|
|
197
|
-
const saveConfig = node.config?.saveToMediaConfig;
|
|
198
|
-
const configInputs = saveConfig?.inputs;
|
|
199
|
-
if (!configInputs || configInputs.length === 0)
|
|
200
|
-
return baseInputs;
|
|
201
|
-
return configInputs.map((input) => ({
|
|
202
|
-
id: input.id,
|
|
203
|
-
type: (0, types_1.portType)({ type: input.type, isArray: false }),
|
|
204
|
-
required: true,
|
|
205
|
-
}));
|
|
206
|
-
}
|
|
207
|
-
// LLM nodes: generate inputs from systemPrompt variables + media refs
|
|
208
|
-
if (node.type === 'llm') {
|
|
209
|
-
const llmConfig = node.config?.llm;
|
|
210
|
-
const dynamicInputs = [];
|
|
211
|
-
// Extract {{variables}} from systemPrompt
|
|
212
|
-
// Variable inputs accept text, object (for JSON data), and boolean types
|
|
213
|
-
const systemPrompt = llmConfig?.systemPrompt ?? '';
|
|
214
|
-
const variables = extractTemplateVariables([systemPrompt]);
|
|
215
|
-
variables.forEach(v => dynamicInputs.push({
|
|
216
|
-
id: v,
|
|
217
|
-
type: [(0, types_1.portType)({ type: 'text', isArray: false }), (0, types_1.portType)({ type: 'object', isArray: false }), (0, types_1.portType)({ type: 'boolean', isArray: false })],
|
|
218
|
-
required: true,
|
|
219
|
-
}));
|
|
220
|
-
// Add image input refs
|
|
221
|
-
llmConfig?.imageInputRefs?.forEach((ref) => dynamicInputs.push({ id: ref, type: (0, types_1.portType)({ type: 'image', isArray: false }), required: true }));
|
|
222
|
-
// Add video input refs
|
|
223
|
-
llmConfig?.videoInputRefs?.forEach((ref) => dynamicInputs.push({ id: ref, type: (0, types_1.portType)({ type: 'video', isArray: false }), required: true }));
|
|
224
|
-
return dynamicInputs.length > 0 ? dynamicInputs : baseInputs;
|
|
225
|
-
}
|
|
226
|
-
// For-each nodes: array input + passthrough inputs
|
|
227
|
-
if (node.type === 'for-each') {
|
|
228
|
-
const forEachConfig = node.config?.forEachConfig;
|
|
229
|
-
const inputPorts = forEachConfig?.inputPorts ?? [];
|
|
230
|
-
return [
|
|
231
|
-
{ id: 'array', type: (0, types_1.portType)({ type: 'object', isArray: false }), required: true },
|
|
232
|
-
...inputPorts.map((port) => ({
|
|
233
|
-
id: port.id,
|
|
234
|
-
type: (0, types_1.portType)({ type: port.type, isArray: port.isArray ?? false }),
|
|
235
|
-
required: false,
|
|
236
|
-
})),
|
|
237
|
-
];
|
|
238
|
-
}
|
|
239
|
-
// If nodes: boolean inputs + passthrough inputs from resolvedPorts
|
|
240
|
-
if (node.type === 'if') {
|
|
241
|
-
const resolvedPorts = node.config?.resolvedPorts;
|
|
242
|
-
if (resolvedPorts?.inputs && resolvedPorts.inputs.length > 0) {
|
|
243
|
-
return resolvedPorts.inputs.map(port => ({
|
|
244
|
-
id: port.id,
|
|
245
|
-
type: port.type,
|
|
246
|
-
required: port.required,
|
|
247
|
-
}));
|
|
248
|
-
}
|
|
249
|
-
return baseInputs;
|
|
250
|
-
}
|
|
251
|
-
// Transcript nodes: media input
|
|
252
|
-
if (node.type === 'transcript') {
|
|
253
|
-
return [{ id: 'media', type: [(0, types_1.portType)({ type: 'video', isArray: false }), (0, types_1.portType)({ type: 'audio', isArray: false })], required: true }];
|
|
254
|
-
}
|
|
255
|
-
// Video import nodes: url input
|
|
256
|
-
if (node.type === 'video-import') {
|
|
257
|
-
return [{ id: 'url', type: (0, types_1.portType)({ type: 'text', isArray: false }), required: true }];
|
|
258
|
-
}
|
|
259
|
-
// Image Generation nodes: prompt + optional image for edit models
|
|
260
|
-
if (node.type === 'generate-image') {
|
|
261
|
-
const imageGenConfig = node.config?.imageGeneration;
|
|
262
|
-
const model = imageGenConfig?.model ?? '';
|
|
263
|
-
const isEditModel = model.includes('/edit');
|
|
264
|
-
const dynamicInputs = [
|
|
265
|
-
{ id: 'prompt', type: (0, types_1.portType)({ type: 'text', isArray: false }), required: true },
|
|
266
|
-
];
|
|
267
|
-
if (isEditModel) {
|
|
268
|
-
dynamicInputs.push({ id: 'image', type: (0, types_1.portType)({ type: 'image', isArray: false }), required: true });
|
|
269
|
-
}
|
|
270
|
-
return dynamicInputs;
|
|
271
|
-
}
|
|
272
|
-
// Custom Model nodes: generate inputs from inputParams
|
|
273
|
-
if (node.type === 'custom-model') {
|
|
274
|
-
const customModelConfig = node.config?.customModelConfig;
|
|
275
|
-
const inputParams = customModelConfig?.inputParams ?? [];
|
|
276
|
-
const dynamicInputs = [];
|
|
277
|
-
inputParams.forEach((param) => {
|
|
278
|
-
if (param.name === 'prompt' || param.type === 'image' || param.type === 'video' || param.type === 'audio') {
|
|
279
|
-
const pType = (param.type === 'image' || param.type === 'video' || param.type === 'audio')
|
|
280
|
-
? param.type
|
|
281
|
-
: 'text';
|
|
282
|
-
dynamicInputs.push({
|
|
283
|
-
id: param.name,
|
|
284
|
-
type: (0, types_1.portType)({ type: pType, isArray: false }),
|
|
285
|
-
required: param.required,
|
|
286
|
-
});
|
|
287
|
-
}
|
|
288
|
-
});
|
|
289
|
-
return dynamicInputs;
|
|
290
|
-
}
|
|
291
|
-
// Deduplicate nodes: video input
|
|
292
|
-
if (node.type === 'deduplicate') {
|
|
293
|
-
return [{ id: 'video', type: (0, types_1.portType)({ type: 'video', isArray: false }), required: true }];
|
|
294
|
-
}
|
|
295
|
-
return baseInputs;
|
|
296
|
-
}
|
|
297
|
-
/**
|
|
298
|
-
* Compute the output ports for a node based on its type and config
|
|
299
|
-
*
|
|
300
|
-
* Uses resolvedPorts as the primary source of truth - modals save complete
|
|
301
|
-
* port definitions to resolvedPorts when the node is configured.
|
|
302
|
-
* Falls back to static outputs from getAllNodes() for nodes without dynamic ports.
|
|
303
|
-
*/
|
|
304
|
-
function computeOutputPorts({ node }) {
|
|
305
|
-
// Primary: use resolvedPorts if available (computed by modal)
|
|
306
|
-
const resolvedPorts = node.config?.resolvedPorts;
|
|
307
|
-
if (resolvedPorts?.outputs && resolvedPorts.outputs.length > 0) {
|
|
308
|
-
return resolvedPorts.outputs.map(port => ({
|
|
309
|
-
id: port.id,
|
|
310
|
-
type: port.type,
|
|
311
|
-
required: port.required,
|
|
312
|
-
itemSchema: port.itemSchema,
|
|
313
|
-
}));
|
|
314
|
-
}
|
|
315
|
-
// Fallback: use static outputs from getAllNodes() for nodes without dynamic ports
|
|
316
|
-
const nodeConfigs = (0, automations_1.getAllNodes)();
|
|
317
|
-
const nodeConfig = nodeConfigs.find(n => n.nodeId === node.type);
|
|
318
|
-
return nodeConfig?.outputs ?? [];
|
|
319
|
-
}
|
|
320
|
-
/**
|
|
321
|
-
* Check if an input port is required for a given node.
|
|
322
|
-
*/
|
|
323
|
-
function isInputPortRequired({ node, portId, }) {
|
|
324
|
-
const ports = computeInputPorts({ node });
|
|
325
|
-
const port = ports.find(p => p.id === portId);
|
|
326
|
-
return port?.required ?? true; // Default to required for safety
|
|
327
|
-
}
|