ugcinc 4.0.2 → 4.1.1

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