ugcinc 4.0.2 → 4.1.0

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 (154) hide show
  1. package/dist/accounts.d.ts +146 -1
  2. package/dist/automations/index.d.ts +174 -0
  3. package/dist/automations/index.js +194 -0
  4. package/dist/automations/nodes/account.d.ts +18 -0
  5. package/dist/automations/nodes/account.js +29 -0
  6. package/dist/automations/nodes/auto-caption.d.ts +64 -0
  7. package/dist/automations/nodes/auto-caption.js +46 -0
  8. package/dist/automations/nodes/auto-post.d.ts +81 -0
  9. package/dist/automations/nodes/auto-post.js +54 -0
  10. package/dist/automations/nodes/branch.d.ts +58 -0
  11. package/dist/automations/nodes/branch.js +50 -0
  12. package/dist/automations/nodes/collect.d.ts +16 -0
  13. package/dist/automations/nodes/collect.js +56 -0
  14. package/dist/automations/nodes/compose-workflow.d.ts +21 -0
  15. package/dist/automations/nodes/compose-workflow.js +42 -0
  16. package/dist/automations/nodes/create-dm.d.ts +96 -0
  17. package/dist/automations/nodes/create-dm.js +88 -0
  18. package/dist/automations/nodes/custom-model.d.ts +19 -0
  19. package/dist/automations/nodes/custom-model.js +52 -0
  20. package/dist/automations/nodes/deduplicate.d.ts +8 -0
  21. package/dist/automations/nodes/deduplicate.js +36 -0
  22. package/dist/automations/nodes/destructure.d.ts +25 -0
  23. package/dist/automations/nodes/destructure.js +65 -0
  24. package/dist/automations/nodes/for-each.d.ts +23 -0
  25. package/dist/automations/nodes/for-each.js +84 -0
  26. package/dist/automations/nodes/generate-image.d.ts +16 -0
  27. package/dist/automations/nodes/generate-image.js +45 -0
  28. package/dist/automations/nodes/generate-video.d.ts +16 -0
  29. package/dist/automations/nodes/generate-video.js +45 -0
  30. package/dist/automations/nodes/if.d.ts +22 -0
  31. package/dist/automations/nodes/if.js +44 -0
  32. package/dist/automations/nodes/image-composer.d.ts +33 -0
  33. package/dist/automations/nodes/image-composer.js +95 -0
  34. package/dist/automations/nodes/index.d.ts +20 -0
  35. package/dist/automations/nodes/index.js +93 -0
  36. package/dist/automations/nodes/llm.d.ts +27 -0
  37. package/dist/automations/nodes/llm.js +85 -0
  38. package/dist/automations/nodes/manual-trigger.d.ts +34 -0
  39. package/dist/automations/nodes/manual-trigger.js +32 -0
  40. package/dist/automations/nodes/media.d.ts +17 -0
  41. package/dist/automations/nodes/media.js +40 -0
  42. package/dist/automations/nodes/not.d.ts +6 -0
  43. package/dist/automations/nodes/not.js +35 -0
  44. package/dist/automations/nodes/output.d.ts +30 -0
  45. package/dist/automations/nodes/output.js +32 -0
  46. package/dist/automations/nodes/random-route.d.ts +52 -0
  47. package/dist/automations/nodes/random-route.js +53 -0
  48. package/dist/automations/nodes/random.d.ts +16 -0
  49. package/dist/automations/nodes/random.js +50 -0
  50. package/dist/automations/nodes/recurrence.d.ts +69 -0
  51. package/dist/automations/nodes/recurrence.js +50 -0
  52. package/dist/automations/nodes/save-to-media.d.ts +32 -0
  53. package/dist/automations/nodes/save-to-media.js +31 -0
  54. package/dist/automations/nodes/screenshot-animation.d.ts +7 -0
  55. package/dist/automations/nodes/screenshot-animation.js +36 -0
  56. package/dist/automations/nodes/social-audio.d.ts +8 -0
  57. package/dist/automations/nodes/social-audio.js +30 -0
  58. package/dist/automations/nodes/text.d.ts +7 -0
  59. package/dist/automations/nodes/text.js +41 -0
  60. package/dist/automations/nodes/transcript.d.ts +6 -0
  61. package/dist/automations/nodes/transcript.js +46 -0
  62. package/dist/automations/nodes/types.d.ts +178 -0
  63. package/dist/automations/nodes/types.js +22 -0
  64. package/dist/automations/nodes/video-composer.d.ts +25 -0
  65. package/dist/automations/nodes/video-composer.js +71 -0
  66. package/dist/automations/nodes/video-import.d.ts +27 -0
  67. package/dist/automations/nodes/video-import.js +37 -0
  68. package/dist/automations/types.d.ts +544 -0
  69. package/dist/automations/types.js +101 -0
  70. package/dist/automations.d.ts +5 -33
  71. package/dist/automations.js +6 -647
  72. package/dist/comments.d.ts +26 -1
  73. package/dist/comments.js +3 -0
  74. package/dist/graph-controller.d.ts +194 -0
  75. package/dist/graph-controller.js +623 -0
  76. package/dist/index.d.ts +38 -9
  77. package/dist/index.js +43 -23
  78. package/dist/internal-utils.d.ts +8 -0
  79. package/dist/internal-utils.js +22 -0
  80. package/dist/media.d.ts +135 -1
  81. package/dist/nodes/account.d.ts +7 -0
  82. package/dist/nodes/account.js +29 -0
  83. package/dist/nodes/auto-caption.d.ts +17 -0
  84. package/dist/nodes/auto-caption.js +46 -0
  85. package/dist/nodes/auto-post.d.ts +21 -0
  86. package/dist/nodes/auto-post.js +54 -0
  87. package/dist/nodes/branch.d.ts +12 -0
  88. package/dist/nodes/branch.js +50 -0
  89. package/dist/nodes/collect.d.ts +6 -0
  90. package/dist/nodes/collect.js +56 -0
  91. package/dist/nodes/compose-workflow.d.ts +21 -0
  92. package/dist/nodes/compose-workflow.js +42 -0
  93. package/dist/nodes/create-dm.d.ts +40 -0
  94. package/dist/nodes/create-dm.js +88 -0
  95. package/dist/nodes/custom-model.d.ts +19 -0
  96. package/dist/nodes/custom-model.js +52 -0
  97. package/dist/nodes/deduplicate.d.ts +8 -0
  98. package/dist/nodes/deduplicate.js +36 -0
  99. package/dist/nodes/destructure.d.ts +25 -0
  100. package/dist/nodes/destructure.js +65 -0
  101. package/dist/nodes/for-each.d.ts +23 -0
  102. package/dist/nodes/for-each.js +84 -0
  103. package/dist/nodes/generate-image.d.ts +16 -0
  104. package/dist/nodes/generate-image.js +45 -0
  105. package/dist/nodes/generate-video.d.ts +16 -0
  106. package/dist/nodes/generate-video.js +45 -0
  107. package/dist/nodes/if.d.ts +22 -0
  108. package/dist/nodes/if.js +44 -0
  109. package/dist/nodes/image-composer.d.ts +14 -0
  110. package/dist/nodes/image-composer.js +95 -0
  111. package/dist/nodes/index.d.ts +20 -0
  112. package/dist/nodes/index.js +93 -0
  113. package/dist/nodes/llm.d.ts +27 -0
  114. package/dist/nodes/llm.js +85 -0
  115. package/dist/nodes/manual-trigger.d.ts +16 -0
  116. package/dist/nodes/manual-trigger.js +32 -0
  117. package/dist/nodes/media.d.ts +17 -0
  118. package/dist/nodes/media.js +40 -0
  119. package/dist/nodes/not.d.ts +6 -0
  120. package/dist/nodes/not.js +35 -0
  121. package/dist/nodes/output.d.ts +9 -0
  122. package/dist/nodes/output.js +32 -0
  123. package/dist/nodes/random-route.d.ts +3 -0
  124. package/dist/nodes/random-route.js +50 -0
  125. package/dist/nodes/random.d.ts +3 -0
  126. package/dist/nodes/random.js +48 -0
  127. package/dist/nodes/recurrence.d.ts +3 -0
  128. package/dist/nodes/recurrence.js +45 -0
  129. package/dist/nodes/save-to-media.d.ts +3 -0
  130. package/dist/nodes/save-to-media.js +26 -0
  131. package/dist/nodes/screenshot-animation.d.ts +7 -0
  132. package/dist/nodes/screenshot-animation.js +36 -0
  133. package/dist/nodes/social-audio.d.ts +3 -0
  134. package/dist/nodes/social-audio.js +26 -0
  135. package/dist/nodes/text.d.ts +3 -0
  136. package/dist/nodes/text.js +38 -0
  137. package/dist/nodes/transcript.d.ts +3 -0
  138. package/dist/nodes/transcript.js +42 -0
  139. package/dist/nodes/types.d.ts +146 -0
  140. package/dist/nodes/types.js +22 -0
  141. package/dist/nodes/video-composer.d.ts +3 -0
  142. package/dist/nodes/video-composer.js +67 -0
  143. package/dist/nodes/video-import.d.ts +3 -0
  144. package/dist/nodes/video-import.js +35 -0
  145. package/dist/org.d.ts +13 -1
  146. package/dist/ports.js +3 -9
  147. package/dist/posts.d.ts +88 -1
  148. package/dist/render/compositions/IMessageDmComposition/types.d.ts +20 -20
  149. package/dist/render/types/video.d.ts +2 -2
  150. package/dist/stats.d.ts +128 -1
  151. package/dist/tasks.d.ts +20 -1
  152. package/dist/types.d.ts +1 -2216
  153. package/dist/types.js +2 -124
  154. package/package.json +1 -1
package/dist/comments.js CHANGED
@@ -2,6 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CommentsClient = void 0;
4
4
  const base_1 = require("./base");
5
+ // =============================================================================
6
+ // Comments Client
7
+ // =============================================================================
5
8
  /**
6
9
  * Client for managing comments
7
10
  */
@@ -0,0 +1,194 @@
1
+ /**
2
+ * Graph Controller
3
+ *
4
+ * Centralized logic for automation graph management including:
5
+ * - Port computation
6
+ * - Connection management
7
+ * - Type compatibility checking
8
+ * - Workflow validation
9
+ * - For-each context validation
10
+ *
11
+ * All functions work with WorkflowNodeDefinition[] (embedded connection format).
12
+ */
13
+ import type { WorkflowNodeDefinition, NodeControlConfig, NodePort, BasePortType, ValidationError, UserCreatableNodeType } from './automations/types';
14
+ import type { ObjectSchemaField } from './automations/nodes/types';
15
+ /**
16
+ * Connection extracted from embedded inputs format for internal processing
17
+ */
18
+ interface Connection {
19
+ id: string;
20
+ sourceNodeId: string;
21
+ sourceOutputId: string;
22
+ targetNodeId: string;
23
+ targetInputId: string;
24
+ }
25
+ /**
26
+ * Check if two port types are compatible for connection
27
+ * A connection is valid if:
28
+ * 1. The types match exactly (same base type and same isArray), OR
29
+ * 2. The source is an array type and target is 'object' (non-array), OR
30
+ * 3. The source is a union and includes a compatible type, OR
31
+ * 4. The target is a union and includes a compatible type, OR
32
+ * 5. Both are unions and have at least one common compatible type
33
+ *
34
+ * Note: Array inputs are strict - they only accept exact matches
35
+ */
36
+ export declare function areTypesCompatible({ sourceType, sourceIsArray, targetType, targetIsArray, }: {
37
+ sourceType: BasePortType | BasePortType[];
38
+ sourceIsArray: boolean;
39
+ targetType: BasePortType | BasePortType[];
40
+ targetIsArray: boolean;
41
+ }): boolean;
42
+ /**
43
+ * Compute ports for a node based on its type and config.
44
+ * Uses the node definition's computePorts function.
45
+ *
46
+ * @param nodeType - The type of the node
47
+ * @param config - The node's configuration object
48
+ * @param getConnectedOutput - Optional function to get connected output port info (for dynamic ports)
49
+ */
50
+ export declare function computePortsForNode({ nodeType, config, getConnectedOutput, }: {
51
+ nodeType: UserCreatableNodeType;
52
+ config?: Record<string, unknown>;
53
+ getConnectedOutput?: (inputId: string) => {
54
+ type: BasePortType | BasePortType[];
55
+ isArray: boolean;
56
+ objectSchema?: ObjectSchemaField[];
57
+ } | null;
58
+ }): {
59
+ inputs: NodePort[];
60
+ outputs: NodePort[];
61
+ };
62
+ /**
63
+ * Get all available automation nodes.
64
+ * Converts node definitions from the registry into NodeControlConfig format.
65
+ */
66
+ export declare function getAllNodes(): NodeControlConfig[];
67
+ /**
68
+ * Get a specific node by nodeId
69
+ */
70
+ export declare function getNodeByType(nodeId: string): NodeControlConfig | undefined;
71
+ /**
72
+ * Get the schema of array items for a node's output port.
73
+ * Returns null if schema is unknown or the output is not an array.
74
+ *
75
+ * @param nodeType - The type of the node (e.g., 'transcript', 'llm')
76
+ * @param nodeConfig - The node's configuration object
77
+ * @param outputPortId - The ID of the output port to get schema for
78
+ * @returns The schema of array items, or null if unknown
79
+ */
80
+ export declare function getOutputSchema({ nodeType, nodeConfig, outputPortId, }: {
81
+ nodeType: string;
82
+ nodeConfig: Record<string, unknown> | undefined;
83
+ outputPortId: string;
84
+ }): ObjectSchemaField[] | null;
85
+ /**
86
+ * Derive Connection[] array from nodes for canvas rendering
87
+ *
88
+ * Connections are stored in the embedded inputs map format.
89
+ * This function extracts them into a flat array for canvas rendering.
90
+ */
91
+ export declare function deriveConnections({ nodes }: {
92
+ nodes: WorkflowNodeDefinition[];
93
+ }): Connection[];
94
+ /**
95
+ * Add a connection to a node's inputs map
96
+ */
97
+ export declare function addConnection({ nodes, sourceNodeId, sourceOutputId, targetNodeId, targetInputId, }: {
98
+ nodes: WorkflowNodeDefinition[];
99
+ sourceNodeId: string;
100
+ sourceOutputId: string;
101
+ targetNodeId: string;
102
+ targetInputId: string;
103
+ }): WorkflowNodeDefinition[];
104
+ /**
105
+ * Remove a connection from a node's inputs map
106
+ */
107
+ export declare function removeConnection({ nodes, targetNodeId, targetInputId, }: {
108
+ nodes: WorkflowNodeDefinition[];
109
+ targetNodeId: string;
110
+ targetInputId: string;
111
+ }): WorkflowNodeDefinition[];
112
+ /**
113
+ * Remove all connections to/from a node
114
+ */
115
+ export declare function removeNodeConnections({ nodes, nodeId, }: {
116
+ nodes: WorkflowNodeDefinition[];
117
+ nodeId: string;
118
+ }): WorkflowNodeDefinition[];
119
+ /**
120
+ * Clean up stale connections on load.
121
+ *
122
+ * Removes entries from node.inputs that reference ports that no longer exist
123
+ * in the node's resolvedPorts.inputs. This handles cases where ports were
124
+ * renamed or deleted but the old connection data persisted.
125
+ */
126
+ export declare function cleanupStaleConnections({ nodes, }: {
127
+ nodes: WorkflowNodeDefinition[];
128
+ }): WorkflowNodeDefinition[];
129
+ /**
130
+ * Find the for-each context a node belongs to by tracing backwards.
131
+ *
132
+ * A node is "inside" a for-each context if, when tracing backwards through
133
+ * connections, we reach a for-each node via one of its OUTPUT ports.
134
+ *
135
+ * Returns the for-each node ID if inside a context, or null if outside all contexts.
136
+ */
137
+ export declare function getForEachContext({ nodeId, nodes, }: {
138
+ nodeId: string;
139
+ nodes: WorkflowNodeDefinition[];
140
+ }): string | null;
141
+ /**
142
+ * Check if a connection would violate for-each context boundaries.
143
+ *
144
+ * A violation occurs when:
145
+ * 1. Source is OUTSIDE a for-each context and target is INSIDE,
146
+ * AND the source would NOT become a "captured" node after this connection
147
+ * 2. Source and target are in DIFFERENT for-each contexts
148
+ * (can't connect across different loops)
149
+ *
150
+ * "Captured" nodes are allowed - they will be expanded at runtime to execute
151
+ * once per for-each iteration (e.g., Account selector → Auto Post inside for-each).
152
+ *
153
+ * Returns true if the connection is INVALID (violation), false if allowed.
154
+ */
155
+ export declare function checkCrossContextViolation({ sourceNodeId, targetNodeId, nodes, }: {
156
+ sourceNodeId: string;
157
+ targetNodeId: string;
158
+ nodes: WorkflowNodeDefinition[];
159
+ }): boolean;
160
+ /**
161
+ * Validate workflow and return structured errors for UI highlighting
162
+ */
163
+ export declare function validateWorkflow({ nodes, }: {
164
+ nodes: WorkflowNodeDefinition[];
165
+ }): ValidationError[];
166
+ /**
167
+ * Get node IDs that have errors
168
+ */
169
+ export declare function getErrorNodeIds({ errors }: {
170
+ errors: ValidationError[];
171
+ }): string[];
172
+ /**
173
+ * Get port errors for a specific node
174
+ */
175
+ export declare function getPortErrorsForNode({ nodeId, errors, }: {
176
+ nodeId: string;
177
+ errors: ValidationError[];
178
+ }): Array<{
179
+ portId: string;
180
+ message: string;
181
+ }>;
182
+ /**
183
+ * Check if there's a missing trigger error
184
+ */
185
+ export declare function hasMissingTriggerError({ errors }: {
186
+ errors: ValidationError[];
187
+ }): boolean;
188
+ /**
189
+ * Check if there's a missing terminal error
190
+ */
191
+ export declare function hasMissingTerminalError({ errors }: {
192
+ errors: ValidationError[];
193
+ }): boolean;
194
+ export {};