ugcinc 4.1.18 → 4.1.19

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.
@@ -15,47 +15,16 @@ const definition = (0, types_1.defineNode)({
15
15
  outputMode: 'per-input',
16
16
  selectionMode: null,
17
17
  },
18
- computePorts: async ({ config, client }) => {
19
- // Use cached resolved ports if available
18
+ computePorts: ({ config }) => {
19
+ // Return cached resolved ports - fetching/updating happens in the UI
20
20
  if (config?.resolvedPorts) {
21
21
  return {
22
22
  inputs: config.resolvedPorts.inputs ?? [],
23
23
  outputs: config.resolvedPorts.outputs ?? [],
24
24
  };
25
25
  }
26
- // If no templateId selected, return empty ports
27
- const templateId = config?.workflowTemplateId;
28
- if (!templateId || !client) {
29
- return { inputs: [], outputs: [] };
30
- }
31
- // Fetch the sub-workflow template
32
- const response = await client.getTemplate({ templateId });
33
- if (!response.ok) {
34
- return { inputs: [], outputs: [] };
35
- }
36
- const template = response.data;
37
- // Find the manual-trigger node to get input definitions
38
- const manualTrigger = template.nodes.find(n => n.type === 'manual-trigger');
39
- const triggerOutputs = manualTrigger?.type === 'manual-trigger'
40
- ? (manualTrigger.config?.outputs ?? [])
41
- : [];
42
- // Convert trigger outputs to compose-workflow inputs
43
- const inputs = triggerOutputs.map(output => ({
44
- id: output.id,
45
- type: output.type,
46
- isArray: output.isArray ?? false,
47
- required: true,
48
- ...(output.type === 'enum' && output.enumOptions ? { enumOptions: output.enumOptions } : {}),
49
- }));
50
- // Use template's output_schema for outputs
51
- const outputSchema = template.output_schema ?? {};
52
- const outputs = Object.entries(outputSchema).map(([id, schema]) => ({
53
- id,
54
- type: schema.type,
55
- isArray: false,
56
- required: true,
57
- }));
58
- return { inputs, outputs };
26
+ // No cached ports yet - UI will fetch and update
27
+ return { inputs: [], outputs: [] };
59
28
  },
60
29
  });
61
30
  exports.default = definition;
@@ -40,31 +40,6 @@ export declare function areTypesCompatible({ sourceType, sourceIsArray, targetTy
40
40
  targetType: BasePortType | BasePortType[];
41
41
  targetIsArray: boolean;
42
42
  }): boolean;
43
- /**
44
- * Compute ports for a node synchronously.
45
- *
46
- * Most nodes have sync computePorts functions. For async nodes (like compose-workflow),
47
- * this falls back to cached resolvedPorts from the config, or returns empty arrays.
48
- *
49
- * Use this in UI contexts where you can't await (e.g., React useMemo).
50
- * For server-side or async contexts, use computePortsForNode instead.
51
- *
52
- * @param nodeType - The type of the node
53
- * @param config - The node's configuration object (should include resolvedPorts for async nodes)
54
- * @param getConnectedOutput - Optional function to get connected output port info (for dynamic ports)
55
- */
56
- export declare function computePortsSync({ nodeType, config, getConnectedOutput, }: {
57
- nodeType: UserCreatableNodeType;
58
- config?: Record<string, unknown>;
59
- getConnectedOutput?: (inputId: string) => {
60
- type: BasePortType | BasePortType[];
61
- isArray: boolean;
62
- objectSchema?: ObjectSchemaField[];
63
- } | null;
64
- }): {
65
- inputs: NodePort[];
66
- outputs: NodePort[];
67
- };
68
43
  /**
69
44
  * Compute ports for a node based on its type and config.
70
45
  * Uses the node definition's computePorts function.
@@ -13,7 +13,6 @@
13
13
  */
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.areTypesCompatible = areTypesCompatible;
16
- exports.computePortsSync = computePortsSync;
17
16
  exports.computePortsForNode = computePortsForNode;
18
17
  exports.getAllNodes = getAllNodes;
19
18
  exports.getNodeByType = getNodeByType;
@@ -245,41 +244,6 @@ function areTypesCompatible({ sourceType, sourceIsArray, targetType, targetIsArr
245
244
  // ===========================================================================
246
245
  // Port Computation
247
246
  // ===========================================================================
248
- /**
249
- * Compute ports for a node synchronously.
250
- *
251
- * Most nodes have sync computePorts functions. For async nodes (like compose-workflow),
252
- * this falls back to cached resolvedPorts from the config, or returns empty arrays.
253
- *
254
- * Use this in UI contexts where you can't await (e.g., React useMemo).
255
- * For server-side or async contexts, use computePortsForNode instead.
256
- *
257
- * @param nodeType - The type of the node
258
- * @param config - The node's configuration object (should include resolvedPorts for async nodes)
259
- * @param getConnectedOutput - Optional function to get connected output port info (for dynamic ports)
260
- */
261
- function computePortsSync({ nodeType, config, getConnectedOutput, }) {
262
- const definition = (0, nodes_1.getNodeDefinition)(nodeType);
263
- if (!definition) {
264
- return { inputs: [], outputs: [] };
265
- }
266
- const result = definition.computePorts({
267
- config: config ?? definition.defaults,
268
- getConnectedOutput,
269
- });
270
- // If the result is a Promise, fall back to cached resolvedPorts or empty arrays
271
- if (result instanceof Promise) {
272
- const resolvedPorts = config?.resolvedPorts;
273
- if (resolvedPorts) {
274
- return {
275
- inputs: resolvedPorts.inputs,
276
- outputs: resolvedPorts.outputs,
277
- };
278
- }
279
- return { inputs: [], outputs: [] };
280
- }
281
- return result;
282
- }
283
247
  /**
284
248
  * Compute ports for a node based on its type and config.
285
249
  * Uses the node definition's computePorts function.
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, computePortsSync, computePortsForNode, getAllNodes, getNodeByType, getOutputSchema, createNode, deriveConnections, addConnection, removeConnection, removeNodeConnections, cleanupStaleConnections, getForEachContext, checkCrossContextViolation, validateWorkflow, getErrorNodeIds, getPortErrorsForNode, hasMissingTriggerError, hasMissingTerminalError, getWorkflowOutputSchema, type WorkflowOutputSchemaEntry, resolveNodePreview, } from './graph-controller';
16
+ export { areTypesCompatible, computePortsForNode, getAllNodes, getNodeByType, getOutputSchema, createNode, 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.extractTemplateVariables = 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.createNode = exports.getOutputSchema = exports.getNodeByType = exports.getAllNodes = exports.computePortsForNode = exports.computePortsSync = 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.extractTemplateVariables = 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.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
9
  // =============================================================================
10
10
  // Client Exports
11
11
  // =============================================================================
@@ -36,7 +36,6 @@ var graph_controller_1 = require("./graph-controller");
36
36
  // Type compatibility
37
37
  Object.defineProperty(exports, "areTypesCompatible", { enumerable: true, get: function () { return graph_controller_1.areTypesCompatible; } });
38
38
  // Port computation
39
- Object.defineProperty(exports, "computePortsSync", { enumerable: true, get: function () { return graph_controller_1.computePortsSync; } });
40
39
  Object.defineProperty(exports, "computePortsForNode", { enumerable: true, get: function () { return graph_controller_1.computePortsForNode; } });
41
40
  Object.defineProperty(exports, "getAllNodes", { enumerable: true, get: function () { return graph_controller_1.getAllNodes; } });
42
41
  Object.defineProperty(exports, "getNodeByType", { enumerable: true, get: function () { return graph_controller_1.getNodeByType; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ugcinc",
3
- "version": "4.1.18",
3
+ "version": "4.1.19",
4
4
  "description": "TypeScript/JavaScript client for the UGC Inc API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",