ugcinc 4.1.12 → 4.1.14

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.
@@ -196,6 +196,25 @@ export declare function hasMissingTriggerError({ errors }: {
196
196
  export declare function hasMissingTerminalError({ errors }: {
197
197
  errors: ValidationError[];
198
198
  }): boolean;
199
+ /** Schema entry for a workflow output */
200
+ export interface WorkflowOutputSchemaEntry {
201
+ type: string;
202
+ isArray?: boolean;
203
+ objectSchema?: ObjectSchemaField[];
204
+ }
205
+ /**
206
+ * Extract output schema from a workflow's passthrough nodes.
207
+ *
208
+ * This determines what types the workflow outputs, used when embedding
209
+ * as a sub-workflow inside another workflow (compose-workflow node).
210
+ *
211
+ * Multiple passthrough nodes are allowed per workflow. Each passthrough
212
+ * node's input configuration contributes to the workflow's output types.
213
+ * If multiple outputs have the same input ID, later nodes override earlier ones.
214
+ */
215
+ export declare function getWorkflowOutputSchema({ nodes, }: {
216
+ nodes: WorkflowNodeDefinition[];
217
+ }): Record<string, WorkflowOutputSchemaEntry>;
199
218
  /**
200
219
  * Resolve preview data for a node.
201
220
  * Converts node config with refs (inputId/textInputId) to render-ready format.
@@ -29,6 +29,7 @@ exports.getErrorNodeIds = getErrorNodeIds;
29
29
  exports.getPortErrorsForNode = getPortErrorsForNode;
30
30
  exports.hasMissingTriggerError = hasMissingTriggerError;
31
31
  exports.hasMissingTerminalError = hasMissingTerminalError;
32
+ exports.getWorkflowOutputSchema = getWorkflowOutputSchema;
32
33
  exports.resolveNodePreview = resolveNodePreview;
33
34
  const types_1 = require("./automations/types");
34
35
  const nodes_1 = require("./automations/nodes");
@@ -632,6 +633,48 @@ function hasMissingTriggerError({ errors }) {
632
633
  function hasMissingTerminalError({ errors }) {
633
634
  return errors.some(e => e.type === 'missing_terminal');
634
635
  }
636
+ /**
637
+ * Extract output schema from a workflow's passthrough nodes.
638
+ *
639
+ * This determines what types the workflow outputs, used when embedding
640
+ * as a sub-workflow inside another workflow (compose-workflow node).
641
+ *
642
+ * Multiple passthrough nodes are allowed per workflow. Each passthrough
643
+ * node's input configuration contributes to the workflow's output types.
644
+ * If multiple outputs have the same input ID, later nodes override earlier ones.
645
+ */
646
+ function getWorkflowOutputSchema({ nodes, }) {
647
+ // Find all passthrough (output) nodes
648
+ const passthroughNodes = nodes.filter(n => n.type === 'passthrough');
649
+ if (passthroughNodes.length === 0) {
650
+ // No output nodes - default to single text output
651
+ return { result: { type: 'text' } };
652
+ }
653
+ // Merge all passthrough node schemas
654
+ const outputSchema = {};
655
+ for (const node of passthroughNodes) {
656
+ const configInputs = node.config?.inputs;
657
+ if (!configInputs || configInputs.length === 0) {
658
+ // No inputs configured on this node - add default result if schema is empty
659
+ if (Object.keys(outputSchema).length === 0) {
660
+ outputSchema.result = { type: 'text' };
661
+ }
662
+ continue;
663
+ }
664
+ // Add this node's inputs to the schema
665
+ for (const input of configInputs) {
666
+ const entry = { type: input.type };
667
+ if (input.isArray) {
668
+ entry.isArray = true;
669
+ }
670
+ if (input.objectSchema) {
671
+ entry.objectSchema = input.objectSchema;
672
+ }
673
+ outputSchema[input.id] = entry;
674
+ }
675
+ }
676
+ return outputSchema;
677
+ }
635
678
  // ===========================================================================
636
679
  // Preview Resolution
637
680
  // ===========================================================================
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, deriveConnections, addConnection, removeConnection, removeNodeConnections, cleanupStaleConnections, getForEachContext, checkCrossContextViolation, validateWorkflow, getErrorNodeIds, getPortErrorsForNode, hasMissingTriggerError, hasMissingTerminalError, resolveNodePreview, } from './graph-controller';
16
+ export { areTypesCompatible, computePortsForNode, getAllNodes, getNodeByType, getOutputSchema, deriveConnections, addConnection, removeConnection, removeNodeConnections, cleanupStaleConnections, getForEachContext, checkCrossContextViolation, validateWorkflow, getErrorNodeIds, getPortErrorsForNode, hasMissingTriggerError, hasMissingTerminalError, getWorkflowOutputSchema, type WorkflowOutputSchemaEntry, resolveNodePreview, } from './graph-controller';
17
17
  export { nodeDefinitions, internalNodeTypes, isAsyncExecutor, formatPortType } from './automations/types';
18
18
  export { isEditModel } from './automations/nodes/generate-image';
19
19
  export { isImageToVideoModel } from './automations/nodes/generate-video';
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@
5
5
  * Official TypeScript/JavaScript client for the UGC Inc API
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.prepareVideoComposerInput = exports.LLMProviders = exports.IfLogicOperators = exports.indexExpressionToIndexes = exports.prepareImageComposerInput = exports.PortIdSchema = exports.normalizeToPortId = exports.portIdToTitle = exports.isValidPortId = exports.portId = exports.selectFromPool = exports.isImageToVideoModel = exports.isEditModel = exports.formatPortType = exports.isAsyncExecutor = exports.internalNodeTypes = exports.nodeDefinitions = exports.resolveNodePreview = 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.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;
8
+ exports.prepareVideoComposerInput = exports.LLMProviders = exports.IfLogicOperators = exports.indexExpressionToIndexes = exports.prepareImageComposerInput = exports.PortIdSchema = exports.normalizeToPortId = exports.portIdToTitle = exports.isValidPortId = exports.portId = exports.selectFromPool = exports.isImageToVideoModel = exports.isEditModel = exports.formatPortType = exports.isAsyncExecutor = exports.internalNodeTypes = exports.nodeDefinitions = 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.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
9
  // =============================================================================
10
10
  // Client Exports
11
11
  // =============================================================================
@@ -56,6 +56,8 @@ Object.defineProperty(exports, "getErrorNodeIds", { enumerable: true, get: funct
56
56
  Object.defineProperty(exports, "getPortErrorsForNode", { enumerable: true, get: function () { return graph_controller_1.getPortErrorsForNode; } });
57
57
  Object.defineProperty(exports, "hasMissingTriggerError", { enumerable: true, get: function () { return graph_controller_1.hasMissingTriggerError; } });
58
58
  Object.defineProperty(exports, "hasMissingTerminalError", { enumerable: true, get: function () { return graph_controller_1.hasMissingTerminalError; } });
59
+ // Workflow output schema
60
+ Object.defineProperty(exports, "getWorkflowOutputSchema", { enumerable: true, get: function () { return graph_controller_1.getWorkflowOutputSchema; } });
59
61
  // Preview resolution
60
62
  Object.defineProperty(exports, "resolveNodePreview", { enumerable: true, get: function () { return graph_controller_1.resolveNodePreview; } });
61
63
  // =============================================================================
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ugcinc",
3
- "version": "4.1.12",
3
+ "version": "4.1.14",
4
4
  "description": "TypeScript/JavaScript client for the UGC Inc API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",