ugcinc 4.1.0 → 4.1.2

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.
Files changed (64) hide show
  1. package/dist/automations/nodes/account.d.ts +3 -14
  2. package/dist/automations/nodes/auto-caption.d.ts +17 -57
  3. package/dist/automations/nodes/auto-caption.js +15 -11
  4. package/dist/automations/nodes/auto-post.d.ts +7 -65
  5. package/dist/automations/nodes/auto-post.js +3 -4
  6. package/dist/automations/nodes/branch.d.ts +9 -45
  7. package/dist/automations/nodes/branch.js +0 -3
  8. package/dist/automations/nodes/collect.d.ts +4 -12
  9. package/dist/automations/nodes/collect.js +3 -7
  10. package/dist/automations/nodes/compose-workflow.d.ts +3 -15
  11. package/dist/automations/nodes/compose-workflow.js +33 -14
  12. package/dist/automations/nodes/create-dm.d.ts +20 -80
  13. package/dist/automations/nodes/create-dm.js +28 -30
  14. package/dist/automations/nodes/custom-model.d.ts +4 -4
  15. package/dist/automations/nodes/deduplicate.d.ts +2 -2
  16. package/dist/automations/nodes/destructure.d.ts +4 -3
  17. package/dist/automations/nodes/destructure.js +1 -1
  18. package/dist/automations/nodes/for-each.d.ts +2 -2
  19. package/dist/automations/nodes/generate-image.d.ts +2 -2
  20. package/dist/automations/nodes/generate-video.d.ts +2 -2
  21. package/dist/automations/nodes/if.d.ts +2 -2
  22. package/dist/automations/nodes/image-composer.d.ts +35 -21
  23. package/dist/automations/nodes/image-composer.js +40 -0
  24. package/dist/automations/nodes/index.d.ts +299 -7
  25. package/dist/automations/nodes/index.js +6 -7
  26. package/dist/automations/nodes/internal.d.ts +8 -0
  27. package/dist/automations/nodes/internal.js +10 -0
  28. package/dist/automations/nodes/llm.d.ts +2 -2
  29. package/dist/automations/nodes/manual-trigger.d.ts +10 -29
  30. package/dist/automations/nodes/manual-trigger.js +1 -1
  31. package/dist/automations/nodes/media.d.ts +4 -7
  32. package/dist/automations/nodes/not.d.ts +2 -2
  33. package/dist/automations/nodes/output.d.ts +4 -17
  34. package/dist/automations/nodes/random-route.d.ts +4 -31
  35. package/dist/automations/nodes/random-route.js +5 -5
  36. package/dist/automations/nodes/random.d.ts +4 -3
  37. package/dist/automations/nodes/random.js +3 -3
  38. package/dist/automations/nodes/recurrence.d.ts +4 -43
  39. package/dist/automations/nodes/recurrence.js +1 -1
  40. package/dist/automations/nodes/save-to-media.d.ts +4 -20
  41. package/dist/automations/nodes/save-to-media.js +1 -1
  42. package/dist/automations/nodes/screenshot-animation.d.ts +2 -2
  43. package/dist/automations/nodes/social-audio.d.ts +2 -2
  44. package/dist/automations/nodes/text.d.ts +2 -2
  45. package/dist/automations/nodes/transcript.d.ts +2 -2
  46. package/dist/automations/nodes/types.d.ts +44 -20
  47. package/dist/automations/nodes/types.js +1 -1
  48. package/dist/automations/nodes/video-composer.d.ts +2 -10
  49. package/dist/automations/nodes/video-composer.js +65 -19
  50. package/dist/automations/nodes/video-import.d.ts +2 -19
  51. package/dist/automations/nodes/video-import.js +2 -16
  52. package/dist/automations/types.d.ts +45 -158
  53. package/dist/automations/types.js +4 -76
  54. package/dist/graph-controller.d.ts +28 -11
  55. package/dist/graph-controller.js +53 -20
  56. package/dist/index.d.ts +37 -22
  57. package/dist/index.js +9 -2
  58. package/dist/render/compositions/IMessageDmComposition/types.d.ts +6 -6
  59. package/dist/render/compositions/ImageEditorComposition.js +2 -8
  60. package/dist/render/compositions/VideoEditorComposition.js +2 -24
  61. package/dist/render/types/element.d.ts +0 -33
  62. package/dist/render/types/index.d.ts +1 -1
  63. package/dist/render.d.ts +2 -1
  64. package/package.json +1 -1
@@ -29,6 +29,7 @@ exports.getErrorNodeIds = getErrorNodeIds;
29
29
  exports.getPortErrorsForNode = getPortErrorsForNode;
30
30
  exports.hasMissingTriggerError = hasMissingTriggerError;
31
31
  exports.hasMissingTerminalError = hasMissingTerminalError;
32
+ exports.resolveNodePreview = resolveNodePreview;
32
33
  const types_1 = require("./automations/types");
33
34
  const nodes_1 = require("./automations/nodes");
34
35
  // ===========================================================================
@@ -247,26 +248,30 @@ function areTypesCompatible({ sourceType, sourceIsArray, targetType, targetIsArr
247
248
  *
248
249
  * @param nodeType - The type of the node
249
250
  * @param config - The node's configuration object
251
+ * @param client - Optional AutomationsClient for nodes that need to fetch data
250
252
  * @param getConnectedOutput - Optional function to get connected output port info (for dynamic ports)
251
253
  */
252
- function computePortsForNode({ nodeType, config, getConnectedOutput, }) {
254
+ async function computePortsForNode({ nodeType, config, client, getConnectedOutput, }) {
253
255
  const definition = (0, nodes_1.getNodeDefinition)(nodeType);
254
256
  if (!definition) {
255
257
  return { inputs: [], outputs: [] };
256
258
  }
257
- return definition.computePorts({
259
+ return await definition.computePorts({
258
260
  config: config ?? definition.defaults,
261
+ client,
259
262
  getConnectedOutput,
260
263
  });
261
264
  }
262
265
  /**
263
266
  * Get all available automation nodes.
264
- * Converts node definitions from the registry into NodeControlConfig format.
267
+ * Converts node definitions from the registry into ComputedNode format.
265
268
  */
266
- function getAllNodes() {
267
- return (0, nodes_1.getAllNodeDefinitions)().map(def => {
268
- const { inputs, outputs } = def.computePorts({ config: def.defaults });
269
- return {
269
+ async function getAllNodes(client) {
270
+ const definitions = (0, nodes_1.getAllNodeDefinitions)();
271
+ const results = [];
272
+ for (const def of definitions) {
273
+ const { inputs, outputs } = await def.computePorts({ config: def.defaults, client });
274
+ results.push({
270
275
  nodeId: def.nodeId,
271
276
  label: def.label,
272
277
  description: def.description,
@@ -277,14 +282,16 @@ function getAllNodes() {
277
282
  outputModes: def.outputModes,
278
283
  selectionModes: def.selectionModes,
279
284
  defaults: def.defaults,
280
- };
281
- });
285
+ });
286
+ }
287
+ return results;
282
288
  }
283
289
  /**
284
290
  * Get a specific node by nodeId
285
291
  */
286
- function getNodeByType(nodeId) {
287
- return getAllNodes().find(node => node.nodeId === nodeId);
292
+ async function getNodeByType(nodeId, client) {
293
+ const allNodes = await getAllNodes(client);
294
+ return allNodes.find(node => node.nodeId === nodeId);
288
295
  }
289
296
  // ===========================================================================
290
297
  // Output Schema
@@ -296,11 +303,12 @@ function getNodeByType(nodeId) {
296
303
  * @param nodeType - The type of the node (e.g., 'transcript', 'llm')
297
304
  * @param nodeConfig - The node's configuration object
298
305
  * @param outputPortId - The ID of the output port to get schema for
306
+ * @param client - Optional AutomationsClient for nodes that need to fetch data
299
307
  * @returns The schema of array items, or null if unknown
300
308
  */
301
- function getOutputSchema({ nodeType, nodeConfig, outputPortId, }) {
309
+ async function getOutputSchema({ nodeType, nodeConfig, outputPortId, client, }) {
302
310
  // First check static node definitions
303
- const nodeDefinition = getNodeByType(nodeType);
311
+ const nodeDefinition = await getNodeByType(nodeType, client);
304
312
  const outputPort = nodeDefinition?.outputs.find(o => o.id === outputPortId);
305
313
  if (outputPort?.objectSchema) {
306
314
  return outputPort.objectSchema;
@@ -390,7 +398,11 @@ function removeNodeConnections({ nodes, nodeId, }) {
390
398
  */
391
399
  function cleanupStaleConnections({ nodes, }) {
392
400
  return nodes.map(node => {
393
- const resolvedInputs = node.config?.resolvedPorts?.inputs;
401
+ // Only compose-workflow nodes have resolvedPorts
402
+ if (node.type !== 'compose-workflow') {
403
+ return node;
404
+ }
405
+ const resolvedInputs = node.config.resolvedPorts?.inputs;
394
406
  // If no resolvedPorts.inputs, we can't validate - skip cleanup for this node
395
407
  if (!resolvedInputs || !Array.isArray(resolvedInputs)) {
396
408
  return node;
@@ -485,7 +497,7 @@ const TERMINAL_TYPES = ['passthrough', 'auto-post', 'save-to-media'];
485
497
  /**
486
498
  * Validate workflow and return structured errors for UI highlighting
487
499
  */
488
- function validateWorkflow({ nodes, }) {
500
+ async function validateWorkflow({ nodes, }) {
489
501
  const errors = [];
490
502
  const connections = deriveConnectionsInternal(nodes);
491
503
  // 1. Check for trigger node
@@ -517,7 +529,7 @@ function validateWorkflow({ nodes, }) {
517
529
  // Use node definition's computePorts if available
518
530
  const definition = (0, nodes_1.getNodeDefinition)(node.type);
519
531
  const inputPorts = definition
520
- ? definition.computePorts({ config: node.config ?? {} }).inputs
532
+ ? (await definition.computePorts({ config: node.config ?? {} })).inputs
521
533
  : [];
522
534
  for (const port of inputPorts) {
523
535
  if (!port.required)
@@ -539,7 +551,7 @@ function validateWorkflow({ nodes, }) {
539
551
  if (sourceNode) {
540
552
  const sourceDefinition = (0, nodes_1.getNodeDefinition)(sourceNode.type);
541
553
  const sourceOutputs = sourceDefinition
542
- ? sourceDefinition.computePorts({ config: sourceNode.config ?? {} }).outputs
554
+ ? (await sourceDefinition.computePorts({ config: sourceNode.config ?? {} })).outputs
543
555
  : [];
544
556
  const sourcePort = sourceOutputs.find(p => p.id === connection.sourceOutputId);
545
557
  if (sourcePort) {
@@ -563,7 +575,7 @@ function validateWorkflow({ nodes, }) {
563
575
  }
564
576
  // 4. Check for empty media pool
565
577
  if (node.type === 'media') {
566
- const configOutputs = (node.config?.outputs ?? []);
578
+ const configOutputs = node.config.outputs ?? [];
567
579
  // Check if ANY output has media selected
568
580
  const totalSelected = configOutputs.reduce((sum, o) => sum + o.selectedMediaIds.length, 0);
569
581
  if (totalSelected === 0) {
@@ -576,8 +588,7 @@ function validateWorkflow({ nodes, }) {
576
588
  }
577
589
  // 5. Check for empty account pool
578
590
  if (node.type === 'account') {
579
- const accountConfig = node.config?.accountConfig;
580
- const accountIds = accountConfig?.accountIds ?? [];
591
+ const accountIds = node.config.accountIds ?? [];
581
592
  if (accountIds.length === 0) {
582
593
  errors.push({
583
594
  type: 'empty_account_pool',
@@ -621,3 +632,25 @@ function hasMissingTriggerError({ errors }) {
621
632
  function hasMissingTerminalError({ errors }) {
622
633
  return errors.some(e => e.type === 'missing_terminal');
623
634
  }
635
+ // ===========================================================================
636
+ // Preview Resolution
637
+ // ===========================================================================
638
+ /**
639
+ * Resolve preview data for a node.
640
+ * Converts node config with refs (inputId/textInputId) to render-ready format.
641
+ * Delegates to the node definition's resolvePreview function if available.
642
+ *
643
+ * @returns ResolvedPreview with render-ready config, sources, and textContent,
644
+ * or null if the node doesn't support preview or config is invalid.
645
+ */
646
+ function resolveNodePreview({ nodes, nodeId, }) {
647
+ const node = nodes.find(n => n.id === nodeId);
648
+ if (!node)
649
+ return null;
650
+ const definition = (0, nodes_1.getNodeDefinition)(node.type);
651
+ if (!definition)
652
+ return null;
653
+ if (!definition.resolvePreview)
654
+ return null;
655
+ return definition.resolvePreview(node.config);
656
+ }
package/dist/index.d.ts CHANGED
@@ -13,8 +13,8 @@ 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, } from './graph-controller';
17
- export { NodeTypes, isAsyncExecutor, formatPortType } from './automations/types';
16
+ export { areTypesCompatible, computePortsForNode, getAllNodes, getNodeByType, getOutputSchema, deriveConnections, addConnection, removeConnection, removeNodeConnections, cleanupStaleConnections, getForEachContext, checkCrossContextViolation, validateWorkflow, getErrorNodeIds, getPortErrorsForNode, hasMissingTriggerError, hasMissingTerminalError, resolveNodePreview, } from './graph-controller';
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';
20
20
  export { portId, isValidPortId, portIdToTitle, normalizeToPortId, PortIdSchema } from './port-id';
@@ -28,26 +28,41 @@ export type { ApiKey, DeleteApiKeyParams, EditApiKeyParams } from './org';
28
28
  export type { UserMedia, MediaUse, SocialAudio, Media, GetMediaParams, GetSocialAudioParams, UploadMediaParams, UploadMediaResponse, MediaTagUpdate, UpdateMediaTagsParams, MediaTagUpdateResult, UpdateMediaTagsResponse, UpdateMediaTagParams, DeleteMediaParams, DeleteMediaResponse, CreateSocialAudioParams, ImportTextParams, ImportTextResponse, CreateMediaFromUrlParams, GetMediaUseParams, GetMediaUseResponse, FilterMediaParams, FilterMediaResponse, GetUploadTokenParams, UploadTokenResponse, } from './media';
29
29
  export type { CommentStatus, Comment, CreateCommentParams, CreateCommentResponse, GetCommentsParams, } from './comments';
30
30
  export type { RenderJobResponse, RenderJobStatus, SubmitImageRenderJobParams, SubmitVideoRenderJobParams, SubmitScreenshotAnimationRenderJobParams, SubmitInstagramDmRenderJobParams, SubmitIMessageDmRenderJobParams, IgDmMessage, ImDmMessage, RenderVideoEditorConfig, } from './render';
31
- export type { VideoEditorNodeConfig, VideoEditorChannel, VideoEditorSegment, VideoEditorVideoSegment, VideoEditorAudioSegment, VideoEditorImageSegment, VideoEditorTextSegment, VideoEditorImageSequenceSegment, VideoEditorVideoSequenceSegment, TimeValue, TimeMode, SegmentTimelinePosition, DeduplicationInput, ImageEditorElement, ImageEditorNodeConfig, DimensionPresetKey, } from './render/types';
32
- export type { MediaType, BasePortType, EnumOption, SelectionMode, ExhaustionBehavior, SelectionConfig, SelectionState, OutputMode, NodeOutputValues, NodePort, ResolvedPort, ResolvedPorts, NodeCategory, NodeControlConfig, NodeDefinition, NodeTypeEnum, NodeType, UserCreatableNodeType, OutputSchemaProperty, WorkflowNodeDefinition, CanvasState, WorkflowDefinition, TemplateNode, AutomationTemplate, AutomationRun, ExecutorNode, ExecutionEdge, AccountData, FlowControlOutput, ExecutorContext, NodeExecutor, AsyncNodeExecutor, ExecutorAsyncJobStatus, ValidationErrorType, ValidationError, ExportedNode, ExportedConnection, ExportedTemplate, AutomationExport, ExportedExecutor, ExportedEdge, ExportedRun, AutomationRunExport, } from './automations/types';
33
- export type { MediaNodeOutput, MediaNodeEnabledType, MediaConfig } from './automations/nodes/media';
34
- export type { ScreenshotAnimationConfig } from './automations/nodes/screenshot-animation';
35
- /** @deprecated Use ScreenshotAnimationConfig instead */
36
- export type { ScreenshotAnimationConfig as ScreenshotAnimationNodeConfig } from './automations/nodes/screenshot-animation';
37
- export type { RandomRouteBranch, RandomRouteObjectField, RandomRoutePassthroughInput, RandomRouteNodeConfig, } from './automations/nodes/random-route';
38
- export type { BranchDefinition, BranchValueConfig, BranchPassthroughInput, BranchNodeConfig, } from './automations/nodes/branch';
39
- export type { VideoImportPlatform, VideoImportQuality, VideoImportNodeConfig, } from './automations/nodes/video-import';
40
- export type { AutoCaptionPreset, AutoCaptionFontWeight, AutoCaptionPosition, AutoCaptionNodeConfig, } from './automations/nodes/auto-caption';
41
- export type { CreateDmMessage, CreateDmNodeConfig, } from './automations/nodes/create-dm';
42
- export type { CollectNodeConfig } from './automations/nodes/collect';
43
- export type { OutputInput, OutputNodeConfig, } from './automations/nodes/output';
44
- export type { ManualTriggerOutput, ManualTriggerNodeConfig, } from './automations/nodes/manual-trigger';
45
- export type { DayOfWeek, RecurrenceMediaOutput, RecurrenceMediaConfig, RecurrenceNodeConfig, RecurrenceMediaEnabledType, } from './automations/nodes/recurrence';
31
+ export type { VideoEditorNodeConfig, VideoEditorChannel, VideoEditorSegment, VideoEditorVideoSegment, VideoEditorAudioSegment, VideoEditorImageSegment, VideoEditorTextSegment, VideoEditorImageSequenceSegment, VideoEditorVideoSequenceSegment, TimeValue, TimeMode, SegmentTimelinePosition, DeduplicationInput, ImageEditorElement, DimensionPresetKey, } from './render/types';
32
+ export type { ImageEditorNodeConfig, ImageComposerNodeConfig } from './automations/nodes/image-composer';
46
33
  export type { AccountNodeConfig } from './automations/nodes/account';
47
- export type { PostSchedulingMode, PostSchedulingConfig, AutoPostMode, AutoPostInputType, AutoPostInput, AutoPostNodeConfig, } from './automations/nodes/auto-post';
48
- export type { SaveToMediaInput, SaveToMediaNodeConfig, } from './automations/nodes/save-to-media';
49
- export type { TriggerIterationMode, IterationExhaustionBehavior, CollectionSelectionMode, TriggerCollectionConfig, ObjectSchemaField, } from './automations/nodes/types';
50
- export type { ImageComposerConfig, ImageEditorNodeInput, ImageEditorNodeOutput, } from './automations/nodes/image-composer';
51
- export type { VideoComposerConfig, VideoEditorNodeInput, } from './automations/nodes/video-composer';
34
+ export type { AutoCaptionNodeConfig, AutoCaptionPreset, AutoCaptionFontWeight, AutoCaptionPosition, } from './automations/nodes/auto-caption';
35
+ export type { AutoPostNodeConfig, AutoPostMode, PostSchedulingMode, } from './automations/nodes/auto-post';
36
+ export type { BranchNodeConfig, BranchDefinition, PassthroughInput, } from './automations/nodes/branch';
37
+ export type { CollectNodeConfig } from './automations/nodes/collect';
38
+ export type { ComposeWorkflowNodeConfig } from './automations/nodes/compose-workflow';
39
+ export type { CreateDmNodeConfig, CreateDmMessage, DmPlatform, } from './automations/nodes/create-dm';
40
+ export type { CustomModelNodeConfig, CustomModelOutputType, CustomModelInputParam, } from './automations/nodes/custom-model';
41
+ export type { DeduplicateNodeConfig } from './automations/nodes/deduplicate';
42
+ export type { DestructureNodeConfig, DestructureSelection, IndexExpression, } from './automations/nodes/destructure';
43
+ export type { ForEachNodeConfig, ForEachOutputProperty, ForEachInputPort, } from './automations/nodes/for-each';
44
+ export type { GenerateImageNodeConfig, ImageGenerationTextModel, ImageGenerationEditModel, ImageGenerationModel, } from './automations/nodes/generate-image';
45
+ export type { GenerateVideoNodeConfig, VideoGenerationTextToVideoModel, VideoGenerationImageToVideoModel, VideoGenerationModel, } from './automations/nodes/generate-video';
46
+ export type { IfNodeConfig, IfLogicOperator, IfBooleanInput, IfPassthroughInput, } from './automations/nodes/if';
47
+ export { IfLogicOperators } from './automations/nodes/if';
48
+ export type { LLMNodeConfig, LLMProvider, LLMApiKeys, } from './automations/nodes/llm';
49
+ export { LLMProviders } from './automations/nodes/llm';
50
+ export type { ManualTriggerNodeConfig } from './automations/nodes/manual-trigger';
51
+ export type { MediaNodeConfig } from './automations/nodes/media';
52
+ export type { NotNodeConfig } from './automations/nodes/not';
53
+ export type { OutputNodeConfig, OutputInput } from './automations/nodes/output';
54
+ export type { RandomNodeConfig, RandomInputPort } from './automations/nodes/random';
55
+ export type { RandomRouteNodeConfig, RandomRouteBranch, RandomRouteObjectField, RandomRoutePassthroughInput, } from './automations/nodes/random-route';
56
+ export type { RecurrenceNodeConfig, DayOfWeek, RecurrenceMediaOutput, RecurrenceMediaConfig, } from './automations/nodes/recurrence';
57
+ export type { SaveToMediaNodeConfig, SaveToMediaInput } from './automations/nodes/save-to-media';
58
+ export type { ScreenshotAnimationNodeConfig } from './automations/nodes/screenshot-animation';
59
+ export type { SocialAudioNodeConfig } from './automations/nodes/social-audio';
60
+ export type { TextNodeConfig } from './automations/nodes/text';
61
+ export type { TranscriptNodeConfig } from './automations/nodes/transcript';
62
+ export type { VideoComposerNodeConfig } from './automations/nodes/video-composer';
63
+ export type { VideoImportNodeConfig, VideoImportPlatform, VideoImportQuality, } from './automations/nodes/video-import';
64
+ export type { MediaType, BasePortType, EnumOption, NodeOutputValues, NodePort, ResolvedPort, ResolvedPorts, ComputedNode, OutputSchemaProperty, WorkflowNodeDefinition, CanvasState, WorkflowDefinition, TemplateNode, AutomationTemplate, AutomationRun, ExecutorNode, ExecutionEdge, AccountData, FlowControlOutput, ExecutorContext, NodeExecutor, AsyncNodeExecutor, ExecutorAsyncJobStatus, ValidationErrorType, ValidationError, ExportedNode, ExportedConnection, ExportedTemplate, AutomationExport, ExportedExecutor, ExportedEdge, ExportedRun, AutomationRunExport, } from './automations/types';
65
+ export type { NodeDefinition, NodeType, UserCreatableNodeType, NodeConfig, WorkflowConfig, InternalNodeType, } from './automations/nodes';
66
+ export type { SelectionMode, ExhaustionBehavior, SelectionConfig, SelectionState, OutputMode, NodeCategory, TriggerIterationMode, IterationExhaustionBehavior, CollectionSelectionMode, TriggerCollectionConfig, ObjectSchemaField, MediaItemType, MediaNodeSelectionType, ResolvedPreview, } from './automations/nodes/types';
52
67
  export type { SuccessResponse, ErrorResponse, ApiResponse, } from './types';
53
68
  export type { CropBoundary, CropAxisConfig, DynamicCropConfig, BorderRadiusConfig, VerticalAnchor, HorizontalAnchor, HorizontalSelfAnchor, VerticalSelfAnchor, RelativePositionConfigX, RelativePositionConfigY, } from './render/types';
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.PortIdSchema = exports.normalizeToPortId = exports.portIdToTitle = exports.isValidPortId = exports.portId = exports.isImageToVideoModel = exports.isEditModel = exports.formatPortType = exports.isAsyncExecutor = exports.NodeTypes = 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.LLMProviders = exports.IfLogicOperators = exports.PortIdSchema = exports.normalizeToPortId = exports.portIdToTitle = exports.isValidPortId = exports.portId = 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;
9
9
  // =============================================================================
10
10
  // Client Exports
11
11
  // =============================================================================
@@ -56,11 +56,14 @@ 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
+ // Preview resolution
60
+ Object.defineProperty(exports, "resolveNodePreview", { enumerable: true, get: function () { return graph_controller_1.resolveNodePreview; } });
59
61
  // =============================================================================
60
62
  // Utility Exports
61
63
  // =============================================================================
62
64
  var types_1 = require("./automations/types");
63
- Object.defineProperty(exports, "NodeTypes", { enumerable: true, get: function () { return types_1.NodeTypes; } });
65
+ Object.defineProperty(exports, "nodeDefinitions", { enumerable: true, get: function () { return types_1.nodeDefinitions; } });
66
+ Object.defineProperty(exports, "internalNodeTypes", { enumerable: true, get: function () { return types_1.internalNodeTypes; } });
64
67
  Object.defineProperty(exports, "isAsyncExecutor", { enumerable: true, get: function () { return types_1.isAsyncExecutor; } });
65
68
  Object.defineProperty(exports, "formatPortType", { enumerable: true, get: function () { return types_1.formatPortType; } });
66
69
  var generate_image_1 = require("./automations/nodes/generate-image");
@@ -73,3 +76,7 @@ Object.defineProperty(exports, "isValidPortId", { enumerable: true, get: functio
73
76
  Object.defineProperty(exports, "portIdToTitle", { enumerable: true, get: function () { return port_id_1.portIdToTitle; } });
74
77
  Object.defineProperty(exports, "normalizeToPortId", { enumerable: true, get: function () { return port_id_1.normalizeToPortId; } });
75
78
  Object.defineProperty(exports, "PortIdSchema", { enumerable: true, get: function () { return port_id_1.PortIdSchema; } });
79
+ var if_1 = require("./automations/nodes/if");
80
+ Object.defineProperty(exports, "IfLogicOperators", { enumerable: true, get: function () { return if_1.IfLogicOperators; } });
81
+ var llm_1 = require("./automations/nodes/llm");
82
+ Object.defineProperty(exports, "LLMProviders", { enumerable: true, get: function () { return llm_1.LLMProviders; } });
@@ -392,8 +392,7 @@ export declare const iMessageDmPropsSchema: z.ZodObject<{
392
392
  groupWithPrevious?: boolean | undefined;
393
393
  }>, "many">>;
394
394
  }, "strip", z.ZodTypeAny, {
395
- width?: number | undefined;
396
- height?: number | undefined;
395
+ backgroundColor?: string | undefined;
397
396
  lightMode?: boolean | undefined;
398
397
  username?: string | undefined;
399
398
  time?: string | undefined;
@@ -405,8 +404,9 @@ export declare const iMessageDmPropsSchema: z.ZodObject<{
405
404
  imageUrl?: string | undefined;
406
405
  groupWithPrevious?: boolean | undefined;
407
406
  }[] | undefined;
407
+ width?: number | undefined;
408
+ height?: number | undefined;
408
409
  fps?: number | undefined;
409
- backgroundColor?: string | undefined;
410
410
  durationInFrames?: number | undefined;
411
411
  showDebugOverlay?: boolean | undefined;
412
412
  referenceImageUrl?: string | undefined;
@@ -573,8 +573,7 @@ export declare const iMessageDmPropsSchema: z.ZodObject<{
573
573
  readReceiptLeft?: number | undefined;
574
574
  readReceiptRight?: number | undefined;
575
575
  }, {
576
- width?: number | undefined;
577
- height?: number | undefined;
576
+ backgroundColor?: string | undefined;
578
577
  lightMode?: boolean | undefined;
579
578
  username?: string | undefined;
580
579
  time?: string | undefined;
@@ -586,8 +585,9 @@ export declare const iMessageDmPropsSchema: z.ZodObject<{
586
585
  imageUrl?: string | undefined;
587
586
  groupWithPrevious?: boolean | undefined;
588
587
  }[] | undefined;
588
+ width?: number | undefined;
589
+ height?: number | undefined;
589
590
  fps?: number | undefined;
590
- backgroundColor?: string | undefined;
591
591
  durationInFrames?: number | undefined;
592
592
  showDebugOverlay?: boolean | undefined;
593
593
  referenceImageUrl?: string | undefined;
@@ -281,17 +281,11 @@ elements, width, height, backgroundType = 'image', backgroundColor, backgroundFi
281
281
  const sorted = getSortedSegments(config);
282
282
  return sorted.find((s) => s.id === 'background' && s.type === 'image');
283
283
  }, [config, segmentsFromElements]);
284
- // Get source URL for a segment (legacy format)
284
+ // Get source URL for a segment
285
285
  const getSource = (segment) => {
286
286
  if (segment.source)
287
287
  return segment.source;
288
- if (sources[segment.id])
289
- return sources[segment.id];
290
- const segmentAny = segment;
291
- if (segmentAny.inputRef && sources[segmentAny.inputRef]) {
292
- return sources[segmentAny.inputRef];
293
- }
294
- return undefined;
288
+ return sources[segment.id];
295
289
  };
296
290
  // Determine background color for the container
297
291
  const containerBgColor = backgroundType === 'color' && backgroundColor
@@ -160,33 +160,11 @@ function VideoEditorComposition({ config, sources = {}, textContent = {}, }) {
160
160
  if (segment.source) {
161
161
  return segment.source;
162
162
  }
163
- if (sources[segment.id]) {
164
- return sources[segment.id];
165
- }
166
- // Check for inputRef
167
- const segmentAny = segment;
168
- if (segmentAny.inputRef && sources[segmentAny.inputRef]) {
169
- return sources[segmentAny.inputRef];
170
- }
171
- return undefined;
163
+ return sources[segment.id];
172
164
  };
173
165
  // Get text content for a text segment
174
166
  const getTextContent = (segment) => {
175
- // Check textContent map first
176
- const directContent = textContent[segment.id];
177
- if (directContent) {
178
- return directContent;
179
- }
180
- // Check for textInputRef
181
- const segmentAny = segment;
182
- if (segmentAny.textInputRef) {
183
- const refContent = textContent[segmentAny.textInputRef];
184
- if (refContent) {
185
- return refContent;
186
- }
187
- }
188
- // Return segment's text or empty string
189
- return segment.text ?? '';
167
+ return textContent[segment.id] ?? segment.text ?? '';
190
168
  };
191
169
  // Audio segments
192
170
  const audioTimings = (0, react_1.useMemo)(() => {
@@ -7,7 +7,6 @@
7
7
  */
8
8
  import type { FitMode, BorderRadiusConfig, FontType, FontWeight, TextAlignment, VerticalAlignment } from './base';
9
9
  import type { RelativePositionConfigX, RelativePositionConfigY } from './position';
10
- import type { DynamicCropConfig } from './crop';
11
10
  /**
12
11
  * Dimension preset keys for image editor
13
12
  */
@@ -105,35 +104,3 @@ export interface ImageEditorElement {
105
104
  /** Corner radius - single number for all corners, or object for individual */
106
105
  borderRadius?: number | BorderRadiusConfig;
107
106
  }
108
- /**
109
- * Image editor node configuration
110
- *
111
- * This is the complete configuration for an image editor node,
112
- * including canvas dimensions, elements, and crop settings.
113
- */
114
- export interface ImageEditorNodeConfig {
115
- /** Canvas width in pixels */
116
- width: number;
117
- /** Canvas height in pixels */
118
- height: number;
119
- /** Aspect ratio string (e.g., "9:16") */
120
- aspectRatio: string;
121
- /** Dimension preset key */
122
- dimensionPreset: DimensionPresetKey;
123
- /** Elements to render */
124
- elements: ImageEditorElement[];
125
- /** Background type: 'image' for image input, 'color' for solid color */
126
- backgroundType?: 'image' | 'color';
127
- /** Background color (hex) when backgroundType is 'color' */
128
- backgroundColor?: string;
129
- /** How the background image fits the canvas */
130
- backgroundFit?: FitMode;
131
- /** Cached background image URL for consistent preview */
132
- previewBackgroundUrl?: string;
133
- /** Cached image URLs for image elements (keyed by inputId) */
134
- previewImageUrls?: Record<string, string>;
135
- /** Cached text values for text elements (keyed by textInputId) */
136
- previewTextValues?: Record<string, string>;
137
- /** Dynamic cropping configuration */
138
- dynamicCrop?: DynamicCropConfig;
139
- }
@@ -6,7 +6,7 @@
6
6
  */
7
7
  export type { TimeValue, BorderRadiusConfig, FitMode, SegmentType, FontType, FontWeight, TextAlignment, VerticalAlignment, TextDirection, TextWrap, WordBreak, Hyphenation, TextOverflow, TextStyleProperties, } from './base';
8
8
  export type { VerticalAnchor, HorizontalAnchor, HorizontalSelfAnchor, VerticalSelfAnchor, RelativePositionConfigX, RelativePositionConfigY, } from './position';
9
- export type { ImageEditorElement, ImageEditorNodeConfig, DimensionPresetKey, DimensionPreset, } from './element';
9
+ export type { ImageEditorElement, DimensionPresetKey, DimensionPreset, } from './element';
10
10
  export { DIMENSION_PRESETS } from './element';
11
11
  export type { TimeMode, VideoEditorBaseSegment, VideoEditorVisualSegment, VideoEditorVideoSegment, VideoEditorAudioSegment, VideoEditorImageSegment, VideoEditorTextSegment, VideoEditorImageSequenceSegment, VideoEditorVideoSequenceSegment, VideoEditorSegment, VideoEditorChannel, VideoEditorNodeConfig, SegmentTimelinePosition, } from './video';
12
12
  export type { BaseSegment, VisualSegment, PictureSegment, VideoSegment, ImageSegment, TextSegment, AudioSegment, ImageSequenceSegment, VideoSequenceSegment, Segment, VisualSegmentUnion, StaticSegment, } from './segment';
package/dist/render.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import type { ApiResponse } from './types';
2
- import type { ImageEditorNodeConfig, VideoEditorNodeConfig, DeduplicationInput } from './render/types';
2
+ import type { VideoEditorNodeConfig, DeduplicationInput } from './render/types';
3
+ import type { ImageEditorNodeConfig } from './automations/nodes/image-composer';
3
4
  export interface RenderJobResponse {
4
5
  job_id: string;
5
6
  status: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ugcinc",
3
- "version": "4.1.0",
3
+ "version": "4.1.2",
4
4
  "description": "TypeScript/JavaScript client for the UGC Inc API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",