ugcinc 3.88.2 → 3.88.4
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/ports.d.ts +6 -1
- package/dist/ports.js +16 -158
- package/dist/types.d.ts +2 -2
- package/package.json +1 -1
package/dist/ports.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* based on their type and configuration. Used by both webapp (for UI rendering)
|
|
6
6
|
* and API (for validation and execution).
|
|
7
7
|
*/
|
|
8
|
-
import type { PortType, NodeTypeEnum } from './types';
|
|
8
|
+
import type { PortType, NodeTypeEnum, PropertySchema } from './types';
|
|
9
9
|
/**
|
|
10
10
|
* Computed port definition
|
|
11
11
|
*/
|
|
@@ -13,6 +13,7 @@ export interface ComputedPort {
|
|
|
13
13
|
id: string;
|
|
14
14
|
type: PortType | PortType[];
|
|
15
15
|
required: boolean;
|
|
16
|
+
itemSchema?: Record<string, PropertySchema>;
|
|
16
17
|
}
|
|
17
18
|
/**
|
|
18
19
|
* Extract template variables from text (e.g., "Hello {{name}}" -> ["name"])
|
|
@@ -35,6 +36,10 @@ export declare function computeInputPorts({ node }: {
|
|
|
35
36
|
}): ComputedPort[];
|
|
36
37
|
/**
|
|
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.
|
|
38
43
|
*/
|
|
39
44
|
export declare function computeOutputPorts({ node }: {
|
|
40
45
|
node: NodeLike;
|
package/dist/ports.js
CHANGED
|
@@ -297,168 +297,26 @@ function computeInputPorts({ node }) {
|
|
|
297
297
|
}
|
|
298
298
|
/**
|
|
299
299
|
* Compute the output ports for a node based on its type and config
|
|
300
|
+
*
|
|
301
|
+
* Uses resolvedPorts as the primary source of truth - modals save complete
|
|
302
|
+
* port definitions to resolvedPorts when the node is configured.
|
|
303
|
+
* Falls back to static outputs from getAllNodes() for nodes without dynamic ports.
|
|
300
304
|
*/
|
|
301
305
|
function computeOutputPorts({ node }) {
|
|
302
|
-
|
|
303
|
-
const
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
return resolvedPorts.outputs.map(port => ({
|
|
311
|
-
id: port.id,
|
|
312
|
-
type: port.type,
|
|
313
|
-
required: port.required,
|
|
314
|
-
}));
|
|
315
|
-
}
|
|
316
|
-
// Fallback to workflowOutputSchema with isArray handling
|
|
317
|
-
const outputSchema = node.config?.workflowOutputSchema;
|
|
318
|
-
if (!outputSchema || Object.keys(outputSchema).length === 0)
|
|
319
|
-
return baseOutputs;
|
|
320
|
-
return Object.entries(outputSchema).map(([id, schema]) => ({
|
|
321
|
-
id,
|
|
322
|
-
type: (schema.isArray ? `${schema.type}[]` : schema.type),
|
|
323
|
-
required: true,
|
|
324
|
-
}));
|
|
325
|
-
}
|
|
326
|
-
// LLM nodes: outputs from outputFields
|
|
327
|
-
// Array types output 'object', others output 'text'
|
|
328
|
-
if (node.type === 'llm') {
|
|
329
|
-
const llmConfig = node.config?.llm;
|
|
330
|
-
const outputFields = llmConfig?.outputFields ?? [{ name: 'output', type: 'string' }];
|
|
331
|
-
return outputFields.map((f) => ({
|
|
332
|
-
id: f.name,
|
|
333
|
-
type: (f.type === 'array' ? 'object' : 'text'),
|
|
334
|
-
required: true,
|
|
335
|
-
}));
|
|
336
|
-
}
|
|
337
|
-
// For-each nodes: outputs based on forEachConfig
|
|
338
|
-
if (node.type === 'for-each') {
|
|
339
|
-
// Prefer resolvedPorts if available (computed by modal with accurate item types)
|
|
340
|
-
const resolvedPorts = node.config?.resolvedPorts;
|
|
341
|
-
if (resolvedPorts?.outputs && resolvedPorts.outputs.length > 0) {
|
|
342
|
-
return resolvedPorts.outputs.map(port => ({
|
|
343
|
-
id: port.id,
|
|
344
|
-
type: port.type,
|
|
345
|
-
required: port.required,
|
|
346
|
-
}));
|
|
347
|
-
}
|
|
348
|
-
// Fallback to manual computation (for backwards compatibility)
|
|
349
|
-
const forEachConfig = node.config?.forEachConfig;
|
|
350
|
-
const outputProperties = forEachConfig?.outputProperties ?? [];
|
|
351
|
-
const inputPorts = forEachConfig?.inputPorts ?? [];
|
|
352
|
-
const exposeItem = forEachConfig?.exposeItem ?? false;
|
|
353
|
-
const exposeIndex = forEachConfig?.exposeIndex ?? false;
|
|
354
|
-
const outputs = [];
|
|
355
|
-
if (exposeItem) {
|
|
356
|
-
outputs.push({ id: 'item', type: 'object', required: true });
|
|
357
|
-
}
|
|
358
|
-
if (exposeIndex) {
|
|
359
|
-
outputs.push({ id: 'index', type: 'number', required: true });
|
|
360
|
-
}
|
|
361
|
-
for (const prop of outputProperties) {
|
|
362
|
-
outputs.push({
|
|
363
|
-
id: prop.portId,
|
|
364
|
-
type: prop.type,
|
|
365
|
-
required: true,
|
|
366
|
-
});
|
|
367
|
-
}
|
|
368
|
-
for (const port of inputPorts) {
|
|
369
|
-
outputs.push({
|
|
370
|
-
id: port.id,
|
|
371
|
-
type: port.type,
|
|
372
|
-
required: true,
|
|
373
|
-
});
|
|
374
|
-
}
|
|
375
|
-
return outputs;
|
|
376
|
-
}
|
|
377
|
-
// If nodes: outputs from resolvedPorts
|
|
378
|
-
if (node.type === 'if') {
|
|
379
|
-
const resolvedPorts = node.config?.resolvedPorts;
|
|
380
|
-
if (resolvedPorts?.outputs && resolvedPorts.outputs.length > 0) {
|
|
381
|
-
return resolvedPorts.outputs.map(port => ({
|
|
382
|
-
id: port.id,
|
|
383
|
-
type: port.type,
|
|
384
|
-
required: port.required,
|
|
385
|
-
}));
|
|
386
|
-
}
|
|
387
|
-
return baseOutputs;
|
|
388
|
-
}
|
|
389
|
-
// Transcript nodes: text and segments outputs
|
|
390
|
-
if (node.type === 'transcript') {
|
|
391
|
-
return [
|
|
392
|
-
{ id: 'text', type: 'text', required: true },
|
|
393
|
-
{ id: 'segments', type: 'object', required: true },
|
|
394
|
-
];
|
|
395
|
-
}
|
|
396
|
-
// Video import nodes: video output
|
|
397
|
-
if (node.type === 'video-import') {
|
|
398
|
-
return [{ id: 'output', type: 'video', required: true }];
|
|
399
|
-
}
|
|
400
|
-
// Deduplicate nodes: video output
|
|
401
|
-
if (node.type === 'deduplicate') {
|
|
402
|
-
return [{ id: 'output', type: 'video', required: true }];
|
|
403
|
-
}
|
|
404
|
-
// Manual Trigger nodes: outputs from resolvedPorts or config
|
|
405
|
-
if (node.type === 'manual-trigger') {
|
|
406
|
-
// Prefer resolvedPorts if available (computed by modal with correct array types)
|
|
407
|
-
const resolvedPorts = node.config?.resolvedPorts;
|
|
408
|
-
if (resolvedPorts?.outputs && resolvedPorts.outputs.length > 0) {
|
|
409
|
-
return resolvedPorts.outputs.map(port => ({
|
|
410
|
-
id: port.id,
|
|
411
|
-
type: port.type,
|
|
412
|
-
required: port.required,
|
|
413
|
-
}));
|
|
414
|
-
}
|
|
415
|
-
// Fallback to config (handle isArray flag)
|
|
416
|
-
const triggerConfig = node.config?.manualTriggerConfig;
|
|
417
|
-
const configOutputs = triggerConfig?.outputs ?? [];
|
|
418
|
-
if (configOutputs.length === 0)
|
|
419
|
-
return baseOutputs;
|
|
420
|
-
return configOutputs.map((output) => ({
|
|
421
|
-
id: output.id,
|
|
422
|
-
type: (output.isArray ? `${output.type}[]` : output.type),
|
|
423
|
-
required: true,
|
|
424
|
-
}));
|
|
425
|
-
}
|
|
426
|
-
// Recurrence nodes: add account output if enabled
|
|
427
|
-
if (node.type === 'recurrence') {
|
|
428
|
-
const recurrenceConfig = node.config?.recurrenceConfig;
|
|
429
|
-
const collectionInput = recurrenceConfig?.collectionInput;
|
|
430
|
-
if (collectionInput?.enabled && (collectionInput.accountIds?.length ?? 0) > 0) {
|
|
431
|
-
return [
|
|
432
|
-
...baseOutputs,
|
|
433
|
-
{ id: 'account', type: 'account', required: true },
|
|
434
|
-
];
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
// Media nodes: outputs based on outputs array
|
|
438
|
-
if (node.type === 'media') {
|
|
439
|
-
const mediaConfig = node.config?.mediaConfig;
|
|
440
|
-
const configOutputs = mediaConfig?.outputs ?? [];
|
|
441
|
-
// Only include outputs with actual selections
|
|
442
|
-
const activeOutputs = configOutputs.filter(o => o.selectedMediaIds.length > 0);
|
|
443
|
-
if (activeOutputs.length === 0)
|
|
444
|
-
return baseOutputs;
|
|
445
|
-
return activeOutputs.map(o => ({
|
|
446
|
-
id: o.id,
|
|
447
|
-
type: (o.isArray ? `${o.type}[]` : o.type),
|
|
448
|
-
required: true,
|
|
306
|
+
// Primary: use resolvedPorts if available (computed by modal)
|
|
307
|
+
const resolvedPorts = node.config?.resolvedPorts;
|
|
308
|
+
if (resolvedPorts?.outputs && resolvedPorts.outputs.length > 0) {
|
|
309
|
+
return resolvedPorts.outputs.map(port => ({
|
|
310
|
+
id: port.id,
|
|
311
|
+
type: port.type,
|
|
312
|
+
required: port.required,
|
|
313
|
+
itemSchema: port.itemSchema,
|
|
449
314
|
}));
|
|
450
315
|
}
|
|
451
|
-
//
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
// Custom Model nodes: single output based on outputType
|
|
456
|
-
if (node.type === 'custom-model') {
|
|
457
|
-
const customModelConfig = node.config?.customModelConfig;
|
|
458
|
-
const outputType = customModelConfig?.outputType ?? 'image';
|
|
459
|
-
return [{ id: 'output', type: outputType, required: true }];
|
|
460
|
-
}
|
|
461
|
-
return baseOutputs;
|
|
316
|
+
// Fallback: use static outputs from getAllNodes() for nodes without dynamic ports
|
|
317
|
+
const nodeConfigs = (0, automations_1.getAllNodes)();
|
|
318
|
+
const nodeConfig = nodeConfigs.find(n => n.type === node.type);
|
|
319
|
+
return nodeConfig?.outputs ?? [];
|
|
462
320
|
}
|
|
463
321
|
/**
|
|
464
322
|
* Check if an input port is required for a given node.
|
package/dist/types.d.ts
CHANGED
|
@@ -760,7 +760,7 @@ export type MediaType = 'video' | 'image' | 'audio' | 'text';
|
|
|
760
760
|
/**
|
|
761
761
|
* Array types for collections
|
|
762
762
|
*/
|
|
763
|
-
export type ArrayType = 'image[]' | 'video[]' | 'audio[]' | 'text[]' | 'object[]';
|
|
763
|
+
export type ArrayType = 'image[]' | 'video[]' | 'audio[]' | 'text[]' | 'object[]' | 'account[]' | 'social_audio[]' | 'boolean[]';
|
|
764
764
|
/**
|
|
765
765
|
* Extended port types (includes non-media types for special nodes)
|
|
766
766
|
*/
|
|
@@ -1000,7 +1000,7 @@ export interface WorkflowNodeDefinition {
|
|
|
1000
1000
|
}
|
|
1001
1001
|
export interface OutputInput {
|
|
1002
1002
|
id: string;
|
|
1003
|
-
title
|
|
1003
|
+
title?: string;
|
|
1004
1004
|
type: 'image' | 'video' | 'audio' | 'text' | 'social_audio' | 'account' | 'boolean' | 'object';
|
|
1005
1005
|
/** Individual tag for this input (overrides global tag) */
|
|
1006
1006
|
tag?: string;
|