ugcinc 4.1.19 → 4.1.20
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.
|
@@ -5,8 +5,7 @@
|
|
|
5
5
|
* Each node file imports from here and defines its behavior.
|
|
6
6
|
*/
|
|
7
7
|
import type { NodePort, BasePortType } from '../types';
|
|
8
|
-
|
|
9
|
-
/** Return type for computePorts - can be sync or async */
|
|
8
|
+
/** Return type for computePorts */
|
|
10
9
|
export type ComputePortsResult = {
|
|
11
10
|
inputs: NodePort[];
|
|
12
11
|
outputs: NodePort[];
|
|
@@ -152,13 +151,12 @@ export interface NodeDefinition<T extends NodeCategory = NodeCategory, TDefaults
|
|
|
152
151
|
defaults: DefaultsForCategory<T, TDefaults>;
|
|
153
152
|
computePorts: (params: {
|
|
154
153
|
config: DefaultsForCategory<T, TDefaults>;
|
|
155
|
-
client?: AutomationsClient;
|
|
156
154
|
getConnectedOutput?: (inputId: string) => {
|
|
157
155
|
type: BasePortType | BasePortType[];
|
|
158
156
|
isArray: boolean;
|
|
159
157
|
objectSchema?: ObjectSchemaField[];
|
|
160
158
|
} | null;
|
|
161
|
-
}) => ComputePortsResult
|
|
159
|
+
}) => ComputePortsResult;
|
|
162
160
|
/**
|
|
163
161
|
* Resolve preview values for this node.
|
|
164
162
|
* Converts config with refs (inputId/textInputId) to render-ready format.
|
|
@@ -186,13 +184,12 @@ export declare function defineNode<T extends NodeCategory, TCustomDefaults exten
|
|
|
186
184
|
defaults: DefaultsForCategory<T, TCustomDefaults>;
|
|
187
185
|
computePorts: (params: {
|
|
188
186
|
config: DefaultsForCategory<T, TCustomDefaults>;
|
|
189
|
-
client?: AutomationsClient;
|
|
190
187
|
getConnectedOutput?: (inputId: string) => {
|
|
191
188
|
type: BasePortType | BasePortType[];
|
|
192
189
|
isArray: boolean;
|
|
193
190
|
objectSchema?: ObjectSchemaField[];
|
|
194
191
|
} | null;
|
|
195
|
-
}) => ComputePortsResult
|
|
192
|
+
}) => ComputePortsResult;
|
|
196
193
|
/**
|
|
197
194
|
* Resolve preview values for this node.
|
|
198
195
|
* Converts config with refs (inputId/textInputId) to render-ready format.
|
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
*/
|
|
13
13
|
import type { WorkflowNodeDefinition, ComputedNode, NodePort, BasePortType, ValidationError, UserCreatableNodeType } from './automations/types';
|
|
14
14
|
import type { ObjectSchemaField, ResolvedPreview } from './automations/nodes/types';
|
|
15
|
-
import type { AutomationsClient } from './automations';
|
|
16
15
|
/**
|
|
17
16
|
* Connection extracted from embedded inputs format for internal processing
|
|
18
17
|
*/
|
|
@@ -46,31 +45,29 @@ export declare function areTypesCompatible({ sourceType, sourceIsArray, targetTy
|
|
|
46
45
|
*
|
|
47
46
|
* @param nodeType - The type of the node
|
|
48
47
|
* @param config - The node's configuration object
|
|
49
|
-
* @param client - Optional AutomationsClient for nodes that need to fetch data
|
|
50
48
|
* @param getConnectedOutput - Optional function to get connected output port info (for dynamic ports)
|
|
51
49
|
*/
|
|
52
|
-
export declare function computePortsForNode({ nodeType, config,
|
|
50
|
+
export declare function computePortsForNode({ nodeType, config, getConnectedOutput, }: {
|
|
53
51
|
nodeType: UserCreatableNodeType;
|
|
54
52
|
config?: Record<string, unknown>;
|
|
55
|
-
client?: AutomationsClient;
|
|
56
53
|
getConnectedOutput?: (inputId: string) => {
|
|
57
54
|
type: BasePortType | BasePortType[];
|
|
58
55
|
isArray: boolean;
|
|
59
56
|
objectSchema?: ObjectSchemaField[];
|
|
60
57
|
} | null;
|
|
61
|
-
}):
|
|
58
|
+
}): {
|
|
62
59
|
inputs: NodePort[];
|
|
63
60
|
outputs: NodePort[];
|
|
64
|
-
}
|
|
61
|
+
};
|
|
65
62
|
/**
|
|
66
63
|
* Get all available automation nodes.
|
|
67
64
|
* Converts node definitions from the registry into ComputedNode format.
|
|
68
65
|
*/
|
|
69
|
-
export declare function getAllNodes(
|
|
66
|
+
export declare function getAllNodes(): ComputedNode[];
|
|
70
67
|
/**
|
|
71
68
|
* Get a specific node by nodeId
|
|
72
69
|
*/
|
|
73
|
-
export declare function getNodeByType(nodeId: string
|
|
70
|
+
export declare function getNodeByType(nodeId: string): ComputedNode | undefined;
|
|
74
71
|
/**
|
|
75
72
|
* Get the schema of array items for a node's output port.
|
|
76
73
|
* Returns null if schema is unknown or the output is not an array.
|
|
@@ -78,15 +75,13 @@ export declare function getNodeByType(nodeId: string, client?: AutomationsClient
|
|
|
78
75
|
* @param nodeType - The type of the node (e.g., 'transcript', 'llm')
|
|
79
76
|
* @param nodeConfig - The node's configuration object
|
|
80
77
|
* @param outputPortId - The ID of the output port to get schema for
|
|
81
|
-
* @param client - Optional AutomationsClient for nodes that need to fetch data
|
|
82
78
|
* @returns The schema of array items, or null if unknown
|
|
83
79
|
*/
|
|
84
|
-
export declare function getOutputSchema({ nodeType, nodeConfig, outputPortId,
|
|
80
|
+
export declare function getOutputSchema({ nodeType, nodeConfig, outputPortId, }: {
|
|
85
81
|
nodeType: string;
|
|
86
82
|
nodeConfig: Record<string, unknown> | undefined;
|
|
87
83
|
outputPortId: string;
|
|
88
|
-
|
|
89
|
-
}): Promise<ObjectSchemaField[] | null>;
|
|
84
|
+
}): ObjectSchemaField[] | null;
|
|
90
85
|
/**
|
|
91
86
|
* Create a new node with default config from the node definition.
|
|
92
87
|
*/
|
|
@@ -177,7 +172,7 @@ export declare function checkCrossContextViolation({ sourceNodeId, targetNodeId,
|
|
|
177
172
|
*/
|
|
178
173
|
export declare function validateWorkflow({ nodes, }: {
|
|
179
174
|
nodes: WorkflowNodeDefinition[];
|
|
180
|
-
}):
|
|
175
|
+
}): ValidationError[];
|
|
181
176
|
/**
|
|
182
177
|
* Get node IDs that have errors
|
|
183
178
|
*/
|
package/dist/graph-controller.js
CHANGED
|
@@ -250,17 +250,15 @@ function areTypesCompatible({ sourceType, sourceIsArray, targetType, targetIsArr
|
|
|
250
250
|
*
|
|
251
251
|
* @param nodeType - The type of the node
|
|
252
252
|
* @param config - The node's configuration object
|
|
253
|
-
* @param client - Optional AutomationsClient for nodes that need to fetch data
|
|
254
253
|
* @param getConnectedOutput - Optional function to get connected output port info (for dynamic ports)
|
|
255
254
|
*/
|
|
256
|
-
|
|
255
|
+
function computePortsForNode({ nodeType, config, getConnectedOutput, }) {
|
|
257
256
|
const definition = (0, nodes_1.getNodeDefinition)(nodeType);
|
|
258
257
|
if (!definition) {
|
|
259
258
|
return { inputs: [], outputs: [] };
|
|
260
259
|
}
|
|
261
|
-
return
|
|
260
|
+
return definition.computePorts({
|
|
262
261
|
config: config ?? definition.defaults,
|
|
263
|
-
client,
|
|
264
262
|
getConnectedOutput,
|
|
265
263
|
});
|
|
266
264
|
}
|
|
@@ -268,11 +266,11 @@ async function computePortsForNode({ nodeType, config, client, getConnectedOutpu
|
|
|
268
266
|
* Get all available automation nodes.
|
|
269
267
|
* Converts node definitions from the registry into ComputedNode format.
|
|
270
268
|
*/
|
|
271
|
-
|
|
269
|
+
function getAllNodes() {
|
|
272
270
|
const definitions = (0, nodes_1.getAllNodeDefinitions)();
|
|
273
271
|
const results = [];
|
|
274
272
|
for (const def of definitions) {
|
|
275
|
-
const { inputs, outputs } =
|
|
273
|
+
const { inputs, outputs } = def.computePorts({ config: def.defaults });
|
|
276
274
|
results.push({
|
|
277
275
|
nodeId: def.nodeId,
|
|
278
276
|
label: def.label,
|
|
@@ -291,8 +289,8 @@ async function getAllNodes(client) {
|
|
|
291
289
|
/**
|
|
292
290
|
* Get a specific node by nodeId
|
|
293
291
|
*/
|
|
294
|
-
|
|
295
|
-
const allNodes =
|
|
292
|
+
function getNodeByType(nodeId) {
|
|
293
|
+
const allNodes = getAllNodes();
|
|
296
294
|
return allNodes.find(node => node.nodeId === nodeId);
|
|
297
295
|
}
|
|
298
296
|
// ===========================================================================
|
|
@@ -305,12 +303,11 @@ async function getNodeByType(nodeId, client) {
|
|
|
305
303
|
* @param nodeType - The type of the node (e.g., 'transcript', 'llm')
|
|
306
304
|
* @param nodeConfig - The node's configuration object
|
|
307
305
|
* @param outputPortId - The ID of the output port to get schema for
|
|
308
|
-
* @param client - Optional AutomationsClient for nodes that need to fetch data
|
|
309
306
|
* @returns The schema of array items, or null if unknown
|
|
310
307
|
*/
|
|
311
|
-
|
|
308
|
+
function getOutputSchema({ nodeType, nodeConfig, outputPortId, }) {
|
|
312
309
|
// First check static node definitions
|
|
313
|
-
const nodeDefinition =
|
|
310
|
+
const nodeDefinition = getNodeByType(nodeType);
|
|
314
311
|
const outputPort = nodeDefinition?.outputs.find(o => o.id === outputPortId);
|
|
315
312
|
if (outputPort?.objectSchema) {
|
|
316
313
|
return outputPort.objectSchema;
|
|
@@ -517,7 +514,7 @@ const TERMINAL_TYPES = ['passthrough', 'auto-post', 'save-to-media'];
|
|
|
517
514
|
/**
|
|
518
515
|
* Validate workflow and return structured errors for UI highlighting
|
|
519
516
|
*/
|
|
520
|
-
|
|
517
|
+
function validateWorkflow({ nodes, }) {
|
|
521
518
|
const errors = [];
|
|
522
519
|
const connections = deriveConnectionsInternal(nodes);
|
|
523
520
|
// 1. Check for trigger node
|
|
@@ -549,7 +546,7 @@ async function validateWorkflow({ nodes, }) {
|
|
|
549
546
|
// Use node definition's computePorts if available
|
|
550
547
|
const definition = (0, nodes_1.getNodeDefinition)(node.type);
|
|
551
548
|
const inputPorts = definition
|
|
552
|
-
?
|
|
549
|
+
? definition.computePorts({ config: node.config ?? {} }).inputs
|
|
553
550
|
: [];
|
|
554
551
|
for (const port of inputPorts) {
|
|
555
552
|
if (!port.required)
|
|
@@ -571,7 +568,7 @@ async function validateWorkflow({ nodes, }) {
|
|
|
571
568
|
if (sourceNode) {
|
|
572
569
|
const sourceDefinition = (0, nodes_1.getNodeDefinition)(sourceNode.type);
|
|
573
570
|
const sourceOutputs = sourceDefinition
|
|
574
|
-
?
|
|
571
|
+
? sourceDefinition.computePorts({ config: sourceNode.config ?? {} }).outputs
|
|
575
572
|
: [];
|
|
576
573
|
const sourcePort = sourceOutputs.find(p => p.id === connection.sourceOutputId);
|
|
577
574
|
if (sourcePort) {
|