ugcinc 4.1.32 → 4.1.33

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.
@@ -144,6 +144,27 @@ export interface NodePort {
144
144
  /** Options for enum port types */
145
145
  enumOptions?: EnumOption[];
146
146
  }
147
+ /**
148
+ * NodePort with preview value attached.
149
+ * Used by computePortsWithPreviews to include resolved preview data
150
+ * directly on input ports, eliminating separate previewMap lookups.
151
+ */
152
+ export interface NodePortWithPreview extends NodePort {
153
+ /**
154
+ * The preview value flowing into this input port.
155
+ * Type depends on the port type:
156
+ * - image: ImageValue
157
+ * - video: VideoValue
158
+ * - audio: AudioValue
159
+ * - text: string
160
+ * - account: AccountData
161
+ * - etc.
162
+ *
163
+ * null if no connection or source has no preview.
164
+ * undefined if not computed (shouldn't happen with computePortsWithPreviews).
165
+ */
166
+ previewValue?: PortValue | PortValue[] | null;
167
+ }
147
168
  /**
148
169
  * Port definition for resolved/dynamic ports.
149
170
  * Stored in node config when the automation is saved.
@@ -10,7 +10,7 @@
10
10
  *
11
11
  * All functions work with WorkflowNodeDefinition[] (embedded connection format).
12
12
  */
13
- import type { WorkflowNodeDefinition, ComputedNode, NodePort, BasePortType, ValidationError, UserCreatableNodeType, PortValue, AccountData } from './automations/types';
13
+ import type { WorkflowNodeDefinition, ComputedNode, NodePort, NodePortWithPreview, BasePortType, ValidationError, UserCreatableNodeType, PortValue, AccountData } from './automations/types';
14
14
  import type { ObjectSchemaField, ResolvedPreview } from './automations/nodes/types';
15
15
  import type { Media } from './media';
16
16
  /**
@@ -71,6 +71,29 @@ export declare function computePortsForNode({ node, getConnectedOutput, }: {
71
71
  inputs: NodePort[];
72
72
  outputs: NodePort[];
73
73
  };
74
+ /**
75
+ * Compute ports for a node with preview values attached to input ports.
76
+ * Combines port computation with preview lookup for a single source of truth.
77
+ *
78
+ * Each input port will have a `previewValue` property containing the resolved
79
+ * preview value from its connected source node (or null if no connection).
80
+ *
81
+ * @param node - The workflow node definition
82
+ * @param previewMap - The computed preview map (from computePreviewMap)
83
+ * @param getConnectedOutput - Optional function to get connected output port info
84
+ */
85
+ export declare function computePortsWithPreviews({ node, previewMap, getConnectedOutput, }: {
86
+ node: WorkflowNodeDefinition;
87
+ previewMap: PreviewMap;
88
+ getConnectedOutput?: (inputId: string) => {
89
+ type: BasePortType | BasePortType[];
90
+ isArray: boolean;
91
+ objectSchema?: ObjectSchemaField[];
92
+ } | null;
93
+ }): {
94
+ inputs: NodePortWithPreview[];
95
+ outputs: NodePort[];
96
+ };
74
97
  /**
75
98
  * Get all available automation nodes.
76
99
  * Converts node definitions from the registry into ComputedNode format.
@@ -14,6 +14,7 @@
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.areTypesCompatible = areTypesCompatible;
16
16
  exports.computePortsForNode = computePortsForNode;
17
+ exports.computePortsWithPreviews = computePortsWithPreviews;
17
18
  exports.getAllNodes = getAllNodes;
18
19
  exports.getNodeByType = getNodeByType;
19
20
  exports.getOutputSchema = getOutputSchema;
@@ -268,6 +269,26 @@ function computePortsForNode({ node, getConnectedOutput, }) {
268
269
  }
269
270
  return definition.computePortsFromNode(node, getConnectedOutput);
270
271
  }
272
+ /**
273
+ * Compute ports for a node with preview values attached to input ports.
274
+ * Combines port computation with preview lookup for a single source of truth.
275
+ *
276
+ * Each input port will have a `previewValue` property containing the resolved
277
+ * preview value from its connected source node (or null if no connection).
278
+ *
279
+ * @param node - The workflow node definition
280
+ * @param previewMap - The computed preview map (from computePreviewMap)
281
+ * @param getConnectedOutput - Optional function to get connected output port info
282
+ */
283
+ function computePortsWithPreviews({ node, previewMap, getConnectedOutput, }) {
284
+ const { inputs, outputs } = computePortsForNode({ node, getConnectedOutput });
285
+ // Augment each input port with its preview value
286
+ const inputsWithPreviews = inputs.map(port => ({
287
+ ...port,
288
+ previewValue: previewMap[`${node.id}:${port.id}`] ?? null,
289
+ }));
290
+ return { inputs: inputsWithPreviews, outputs };
291
+ }
271
292
  /**
272
293
  * Get all available automation nodes.
273
294
  * Converts node definitions from the registry into ComputedNode format.
package/dist/index.d.ts CHANGED
@@ -13,7 +13,7 @@ export { RenderClient } from './render';
13
13
  export { AutomationsClient } from './automations';
14
14
  export { MediaClient } from './media';
15
15
  export { CommentsClient } from './comments';
16
- export { areTypesCompatible, computePortsForNode, getAllNodes, getNodeByType, getOutputSchema, createNode, deriveConnections, addConnection, removeConnection, removeNodeConnections, cleanupStaleConnections, getForEachContext, checkCrossContextViolation, validateWorkflow, getErrorNodeIds, getPortErrorsForNode, hasMissingTriggerError, hasMissingTerminalError, getWorkflowOutputSchema, type WorkflowOutputSchemaEntry, resolveNodePreview, computeAllNodePreviews, computePreviewMap, updatePreviewMapForConnection, removePreviewForConnection, getPreviewValue, shuffleNodePreview, type PreviewMap, type NodePreviewOutputs, type Connection, generateNodeName, extractWorkflowConfig, type WorkflowTemplateData, } from './graph-controller';
16
+ export { areTypesCompatible, computePortsForNode, computePortsWithPreviews, getAllNodes, getNodeByType, getOutputSchema, createNode, deriveConnections, addConnection, removeConnection, removeNodeConnections, cleanupStaleConnections, getForEachContext, checkCrossContextViolation, validateWorkflow, getErrorNodeIds, getPortErrorsForNode, hasMissingTriggerError, hasMissingTerminalError, getWorkflowOutputSchema, type WorkflowOutputSchemaEntry, resolveNodePreview, computeAllNodePreviews, computePreviewMap, updatePreviewMapForConnection, removePreviewForConnection, getPreviewValue, shuffleNodePreview, type PreviewMap, type NodePreviewOutputs, type Connection, generateNodeName, extractWorkflowConfig, type WorkflowTemplateData, } from './graph-controller';
17
17
  export { nodeDefinitions, internalNodeTypes, isAsyncExecutor, formatPortType } from './automations/types';
18
18
  export { getNodeDefinition } from './automations/nodes';
19
19
  export { isEditModel, ALL_IMAGE_MODELS, IMAGE_ASPECT_RATIOS } from './automations/nodes/generate-image';
@@ -68,7 +68,7 @@ export type { TranscriptNodeConfig } from './automations/nodes/transcript';
68
68
  export type { VideoComposerNodeConfig, VideoComposerRenderInput } from './automations/nodes/video-composer';
69
69
  export { prepareVideoComposerInput } from './automations/nodes/video-composer';
70
70
  export type { VideoImportNodeConfig, VideoImportPlatform, VideoImportQuality, } from './automations/nodes/video-import';
71
- export type { MediaType, BasePortType, EnumOption, ImageValue, VideoValue, AudioValue, TextValue, NumberValue, BooleanValue, DateValue, EnumValue, SocialAudioValue, ObjectValue, PortValueFor, PortValue, NodeOutputValues, NodePort, ResolvedPort, ResolvedPorts, ComputedNode, OutputSchemaProperty, WorkflowNodeDefinition, CanvasState, WorkflowDefinition, TemplateNode, AutomationTemplate, AutomationRun, ExecutorNode, ExecutionEdge, AccountData, FlowControlOutput, ExecutorContext, NodeExecutor, AsyncNodeExecutor, AnyNodeExecutor, AnyAsyncNodeExecutor, ExecutorAsyncJobStatus, ValidationErrorType, ValidationError, ExportedNode, ExportedConnection, ExportedTemplate, AutomationExport, ExportedExecutor, ExportedEdge, ExportedRun, AutomationRunExport, InternalWorkflowConfig, AllWorkflowConfig, } from './automations/types';
71
+ export type { MediaType, BasePortType, EnumOption, ImageValue, VideoValue, AudioValue, TextValue, NumberValue, BooleanValue, DateValue, EnumValue, SocialAudioValue, ObjectValue, PortValueFor, PortValue, NodeOutputValues, NodePort, NodePortWithPreview, ResolvedPort, ResolvedPorts, ComputedNode, OutputSchemaProperty, WorkflowNodeDefinition, CanvasState, WorkflowDefinition, TemplateNode, AutomationTemplate, AutomationRun, ExecutorNode, ExecutionEdge, AccountData, FlowControlOutput, ExecutorContext, NodeExecutor, AsyncNodeExecutor, AnyNodeExecutor, AnyAsyncNodeExecutor, ExecutorAsyncJobStatus, ValidationErrorType, ValidationError, ExportedNode, ExportedConnection, ExportedTemplate, AutomationExport, ExportedExecutor, ExportedEdge, ExportedRun, AutomationRunExport, InternalWorkflowConfig, AllWorkflowConfig, } from './automations/types';
72
72
  export type { NodeDefinition, NodeType, UserCreatableNodeType, NodeConfig, WorkflowConfig, InternalNodeType, } from './automations/nodes';
73
73
  export type { SelectionMode, ExhaustionBehavior, SelectionConfig, SelectionState, OutputMode, NodeCategory, TriggerIterationMode, IterationExhaustionBehavior, CollectionSelectionMode, TriggerCollectionConfig, ObjectSchemaField, MediaItemType, MediaNodeSelectionType, ResolvedPreview, PreviewSelectionState, PreviewContext, NullableOutputs, } from './automations/nodes/types';
74
74
  export type { SuccessResponse, ErrorResponse, ApiResponse, } from './types';
package/dist/index.js CHANGED
@@ -5,8 +5,8 @@
5
5
  * Official TypeScript/JavaScript client for the UGC Inc API
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.getModelDurations = exports.getModelAspectRatios = exports.ALL_VIDEO_MODELS = exports.isImageToVideoModel = exports.IMAGE_ASPECT_RATIOS = exports.ALL_IMAGE_MODELS = exports.isEditModel = exports.getNodeDefinition = exports.formatPortType = exports.isAsyncExecutor = exports.internalNodeTypes = exports.nodeDefinitions = exports.extractWorkflowConfig = exports.generateNodeName = exports.shuffleNodePreview = exports.getPreviewValue = exports.removePreviewForConnection = exports.updatePreviewMapForConnection = exports.computePreviewMap = exports.computeAllNodePreviews = exports.resolveNodePreview = exports.getWorkflowOutputSchema = exports.hasMissingTerminalError = exports.hasMissingTriggerError = exports.getPortErrorsForNode = exports.getErrorNodeIds = exports.validateWorkflow = exports.checkCrossContextViolation = exports.getForEachContext = exports.cleanupStaleConnections = exports.removeNodeConnections = exports.removeConnection = exports.addConnection = exports.deriveConnections = exports.createNode = exports.getOutputSchema = exports.getNodeByType = exports.getAllNodes = exports.computePortsForNode = exports.areTypesCompatible = exports.CommentsClient = exports.MediaClient = exports.AutomationsClient = exports.RenderClient = exports.OrganizationClient = exports.StatsClient = exports.PostsClient = exports.TasksClient = exports.AccountsClient = exports.UGCClient = void 0;
9
- exports.prepareVideoComposerInput = exports.LLMProviders = exports.IfLogicOperators = exports.indexExpressionToIndexes = exports.prepareImageComposerInput = exports.extractTemplateVariables = exports.PortIdSchema = exports.normalizeToPortId = exports.portIdToTitle = exports.isValidPortId = exports.portId = exports.selectFromPool = void 0;
8
+ exports.getModelAspectRatios = exports.ALL_VIDEO_MODELS = exports.isImageToVideoModel = exports.IMAGE_ASPECT_RATIOS = exports.ALL_IMAGE_MODELS = exports.isEditModel = exports.getNodeDefinition = exports.formatPortType = exports.isAsyncExecutor = exports.internalNodeTypes = exports.nodeDefinitions = exports.extractWorkflowConfig = exports.generateNodeName = exports.shuffleNodePreview = exports.getPreviewValue = exports.removePreviewForConnection = exports.updatePreviewMapForConnection = exports.computePreviewMap = exports.computeAllNodePreviews = exports.resolveNodePreview = exports.getWorkflowOutputSchema = exports.hasMissingTerminalError = exports.hasMissingTriggerError = exports.getPortErrorsForNode = exports.getErrorNodeIds = exports.validateWorkflow = exports.checkCrossContextViolation = exports.getForEachContext = exports.cleanupStaleConnections = exports.removeNodeConnections = exports.removeConnection = exports.addConnection = exports.deriveConnections = exports.createNode = exports.getOutputSchema = exports.getNodeByType = exports.getAllNodes = exports.computePortsWithPreviews = exports.computePortsForNode = exports.areTypesCompatible = exports.CommentsClient = exports.MediaClient = exports.AutomationsClient = exports.RenderClient = exports.OrganizationClient = exports.StatsClient = exports.PostsClient = exports.TasksClient = exports.AccountsClient = exports.UGCClient = void 0;
9
+ exports.prepareVideoComposerInput = exports.LLMProviders = exports.IfLogicOperators = exports.indexExpressionToIndexes = exports.prepareImageComposerInput = exports.extractTemplateVariables = exports.PortIdSchema = exports.normalizeToPortId = exports.portIdToTitle = exports.isValidPortId = exports.portId = exports.selectFromPool = exports.getModelDurations = void 0;
10
10
  // =============================================================================
11
11
  // Client Exports
12
12
  // =============================================================================
@@ -38,6 +38,7 @@ var graph_controller_1 = require("./graph-controller");
38
38
  Object.defineProperty(exports, "areTypesCompatible", { enumerable: true, get: function () { return graph_controller_1.areTypesCompatible; } });
39
39
  // Port computation
40
40
  Object.defineProperty(exports, "computePortsForNode", { enumerable: true, get: function () { return graph_controller_1.computePortsForNode; } });
41
+ Object.defineProperty(exports, "computePortsWithPreviews", { enumerable: true, get: function () { return graph_controller_1.computePortsWithPreviews; } });
41
42
  Object.defineProperty(exports, "getAllNodes", { enumerable: true, get: function () { return graph_controller_1.getAllNodes; } });
42
43
  Object.defineProperty(exports, "getNodeByType", { enumerable: true, get: function () { return graph_controller_1.getNodeByType; } });
43
44
  // Output schema
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ugcinc",
3
- "version": "4.1.32",
3
+ "version": "4.1.33",
4
4
  "description": "TypeScript/JavaScript client for the UGC Inc API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",