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.
- package/dist/accounts.d.ts +146 -1
- package/dist/automations/index.d.ts +174 -0
- package/dist/automations/index.js +194 -0
- package/dist/automations/nodes/account.d.ts +6 -0
- package/dist/automations/nodes/account.js +28 -0
- package/dist/automations/nodes/auto-caption.d.ts +23 -0
- package/dist/automations/nodes/auto-caption.js +49 -0
- package/dist/automations/nodes/auto-post.d.ts +22 -0
- package/dist/automations/nodes/auto-post.js +52 -0
- package/dist/automations/nodes/branch.d.ts +21 -0
- package/dist/automations/nodes/branch.js +46 -0
- package/dist/automations/nodes/collect.d.ts +7 -0
- package/dist/automations/nodes/collect.js +51 -0
- package/dist/automations/nodes/compose-workflow.d.ts +8 -0
- package/dist/automations/nodes/compose-workflow.js +61 -0
- package/dist/automations/nodes/create-dm.d.ts +35 -0
- package/dist/automations/nodes/create-dm.js +86 -0
- package/dist/automations/nodes/custom-model.d.ts +18 -0
- package/dist/automations/nodes/custom-model.js +52 -0
- package/dist/automations/nodes/deduplicate.d.ts +7 -0
- package/dist/automations/nodes/deduplicate.js +36 -0
- package/dist/automations/nodes/destructure.d.ts +25 -0
- package/dist/automations/nodes/destructure.js +65 -0
- package/dist/automations/nodes/for-each.d.ts +22 -0
- package/dist/automations/nodes/for-each.js +84 -0
- package/dist/automations/nodes/generate-image.d.ts +15 -0
- package/dist/automations/nodes/generate-image.js +45 -0
- package/dist/automations/nodes/generate-video.d.ts +15 -0
- package/dist/automations/nodes/generate-video.js +45 -0
- package/dist/automations/nodes/if.d.ts +21 -0
- package/dist/automations/nodes/if.js +44 -0
- package/dist/automations/nodes/image-composer.d.ts +46 -0
- package/dist/automations/nodes/image-composer.js +135 -0
- package/dist/automations/nodes/index.d.ts +312 -0
- package/dist/automations/nodes/index.js +92 -0
- package/dist/automations/nodes/internal.d.ts +8 -0
- package/dist/automations/nodes/internal.js +10 -0
- package/dist/automations/nodes/llm.d.ts +26 -0
- package/dist/automations/nodes/llm.js +85 -0
- package/dist/automations/nodes/manual-trigger.d.ts +14 -0
- package/dist/automations/nodes/manual-trigger.js +32 -0
- package/dist/automations/nodes/media.d.ts +13 -0
- package/dist/automations/nodes/media.js +40 -0
- package/dist/automations/nodes/not.d.ts +5 -0
- package/dist/automations/nodes/not.js +35 -0
- package/dist/automations/nodes/output.d.ts +16 -0
- package/dist/automations/nodes/output.js +32 -0
- package/dist/automations/nodes/random-route.d.ts +24 -0
- package/dist/automations/nodes/random-route.js +53 -0
- package/dist/automations/nodes/random.d.ts +16 -0
- package/dist/automations/nodes/random.js +50 -0
- package/dist/automations/nodes/recurrence.d.ts +29 -0
- package/dist/automations/nodes/recurrence.js +50 -0
- package/dist/automations/nodes/save-to-media.d.ts +15 -0
- package/dist/automations/nodes/save-to-media.js +31 -0
- package/dist/automations/nodes/screenshot-animation.d.ts +6 -0
- package/dist/automations/nodes/screenshot-animation.js +36 -0
- package/dist/automations/nodes/social-audio.d.ts +7 -0
- package/dist/automations/nodes/social-audio.js +30 -0
- package/dist/automations/nodes/text.d.ts +6 -0
- package/dist/automations/nodes/text.js +41 -0
- package/dist/automations/nodes/transcript.d.ts +5 -0
- package/dist/automations/nodes/transcript.js +46 -0
- package/dist/automations/nodes/types.d.ts +202 -0
- package/dist/automations/nodes/types.js +22 -0
- package/dist/automations/nodes/video-composer.d.ts +16 -0
- package/dist/automations/nodes/video-composer.js +117 -0
- package/dist/automations/nodes/video-import.d.ts +9 -0
- package/dist/automations/nodes/video-import.js +23 -0
- package/dist/automations/types.d.ts +431 -0
- package/dist/automations/types.js +29 -0
- package/dist/automations.d.ts +5 -33
- package/dist/automations.js +6 -647
- package/dist/comments.d.ts +26 -1
- package/dist/comments.js +3 -0
- package/dist/graph-controller.d.ts +211 -0
- package/dist/graph-controller.js +656 -0
- package/dist/index.d.ts +22 -9
- package/dist/index.js +47 -24
- package/dist/internal-utils.d.ts +8 -0
- package/dist/internal-utils.js +22 -0
- package/dist/media.d.ts +135 -1
- package/dist/nodes/account.d.ts +7 -0
- package/dist/nodes/account.js +29 -0
- package/dist/nodes/auto-caption.d.ts +17 -0
- package/dist/nodes/auto-caption.js +46 -0
- package/dist/nodes/auto-post.d.ts +21 -0
- package/dist/nodes/auto-post.js +54 -0
- package/dist/nodes/branch.d.ts +12 -0
- package/dist/nodes/branch.js +50 -0
- package/dist/nodes/collect.d.ts +6 -0
- package/dist/nodes/collect.js +56 -0
- package/dist/nodes/compose-workflow.d.ts +21 -0
- package/dist/nodes/compose-workflow.js +42 -0
- package/dist/nodes/create-dm.d.ts +40 -0
- package/dist/nodes/create-dm.js +88 -0
- package/dist/nodes/custom-model.d.ts +19 -0
- package/dist/nodes/custom-model.js +52 -0
- package/dist/nodes/deduplicate.d.ts +8 -0
- package/dist/nodes/deduplicate.js +36 -0
- package/dist/nodes/destructure.d.ts +25 -0
- package/dist/nodes/destructure.js +65 -0
- package/dist/nodes/for-each.d.ts +23 -0
- package/dist/nodes/for-each.js +84 -0
- package/dist/nodes/generate-image.d.ts +16 -0
- package/dist/nodes/generate-image.js +45 -0
- package/dist/nodes/generate-video.d.ts +16 -0
- package/dist/nodes/generate-video.js +45 -0
- package/dist/nodes/if.d.ts +22 -0
- package/dist/nodes/if.js +44 -0
- package/dist/nodes/image-composer.d.ts +14 -0
- package/dist/nodes/image-composer.js +95 -0
- package/dist/nodes/index.d.ts +20 -0
- package/dist/nodes/index.js +93 -0
- package/dist/nodes/llm.d.ts +27 -0
- package/dist/nodes/llm.js +85 -0
- package/dist/nodes/manual-trigger.d.ts +16 -0
- package/dist/nodes/manual-trigger.js +32 -0
- package/dist/nodes/media.d.ts +17 -0
- package/dist/nodes/media.js +40 -0
- package/dist/nodes/not.d.ts +6 -0
- package/dist/nodes/not.js +35 -0
- package/dist/nodes/output.d.ts +9 -0
- package/dist/nodes/output.js +32 -0
- package/dist/nodes/random-route.d.ts +3 -0
- package/dist/nodes/random-route.js +50 -0
- package/dist/nodes/random.d.ts +3 -0
- package/dist/nodes/random.js +48 -0
- package/dist/nodes/recurrence.d.ts +3 -0
- package/dist/nodes/recurrence.js +45 -0
- package/dist/nodes/save-to-media.d.ts +3 -0
- package/dist/nodes/save-to-media.js +26 -0
- package/dist/nodes/screenshot-animation.d.ts +7 -0
- package/dist/nodes/screenshot-animation.js +36 -0
- package/dist/nodes/social-audio.d.ts +3 -0
- package/dist/nodes/social-audio.js +26 -0
- package/dist/nodes/text.d.ts +3 -0
- package/dist/nodes/text.js +38 -0
- package/dist/nodes/transcript.d.ts +3 -0
- package/dist/nodes/transcript.js +42 -0
- package/dist/nodes/types.d.ts +146 -0
- package/dist/nodes/types.js +22 -0
- package/dist/nodes/video-composer.d.ts +3 -0
- package/dist/nodes/video-composer.js +67 -0
- package/dist/nodes/video-import.d.ts +3 -0
- package/dist/nodes/video-import.js +35 -0
- package/dist/org.d.ts +13 -1
- package/dist/ports.js +3 -9
- package/dist/posts.d.ts +88 -1
- package/dist/render/compositions/IMessageDmComposition/types.d.ts +24 -24
- package/dist/render/compositions/ImageEditorComposition.js +2 -8
- package/dist/render/compositions/VideoEditorComposition.js +2 -24
- package/dist/render/types/element.d.ts +0 -33
- package/dist/render/types/index.d.ts +1 -1
- package/dist/render/types/video.d.ts +2 -2
- package/dist/render.d.ts +2 -1
- package/dist/stats.d.ts +128 -1
- package/dist/tasks.d.ts +20 -1
- package/dist/types.d.ts +1 -2216
- package/dist/types.js +2 -124
- package/package.json +1 -1
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node Definition Types
|
|
3
|
+
*
|
|
4
|
+
* This file contains shared types for node definitions.
|
|
5
|
+
* Each node file imports from here and defines its behavior.
|
|
6
|
+
*/
|
|
7
|
+
import type { NodePort, BasePortType } from '../types';
|
|
8
|
+
import type { AutomationsClient } from '../index';
|
|
9
|
+
/** Return type for computePorts - can be sync or async */
|
|
10
|
+
export type ComputePortsResult = {
|
|
11
|
+
inputs: NodePort[];
|
|
12
|
+
outputs: NodePort[];
|
|
13
|
+
};
|
|
14
|
+
export type NodeCategory = 'trigger' | 'source' | 'generator' | 'terminal';
|
|
15
|
+
export type OutputMode = 'per-input' | 'single';
|
|
16
|
+
export type SelectionMode = 'random' | 'sequential';
|
|
17
|
+
export type ExhaustionBehavior = 'restart' | 'error';
|
|
18
|
+
export type InputType = 'static' | 'variable';
|
|
19
|
+
/** All possible media item types */
|
|
20
|
+
export type MediaItemType = 'image' | 'video' | 'audio' | 'text' | 'social_audio';
|
|
21
|
+
/** Media types that can be selected from the media node */
|
|
22
|
+
export type MediaNodeSelectionType = 'image' | 'video' | 'audio';
|
|
23
|
+
type PrimitiveType = 'string' | 'number' | 'boolean';
|
|
24
|
+
/**
|
|
25
|
+
* Generic type for object schema fields with compile-time depth enforcement.
|
|
26
|
+
*
|
|
27
|
+
* - Level 1 (default): Can have 'object' or 'array' types, arrays can contain objects
|
|
28
|
+
* - Level 2: Can have 'object' or 'array' types, arrays cannot contain objects
|
|
29
|
+
* - Level 3: Only primitive types allowed
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* // Level 1 field (top-level)
|
|
33
|
+
* const field: SchemaField = { name: 'users', type: 'array', items: 'object', objectSchema: [...] };
|
|
34
|
+
*
|
|
35
|
+
* // Level 2 field (inside objectSchema)
|
|
36
|
+
* const nested: SchemaField<true, false> = { name: 'tags', type: 'array', items: 'string' };
|
|
37
|
+
*
|
|
38
|
+
* // Level 3 field (deepest level)
|
|
39
|
+
* const leaf: SchemaField<false, false> = { name: 'id', type: 'string' };
|
|
40
|
+
*/
|
|
41
|
+
/**
|
|
42
|
+
* Schema field type with compile-time depth enforcement for array items.
|
|
43
|
+
*
|
|
44
|
+
* - Level 1 (default): Arrays can contain objects (`items: 'object'`)
|
|
45
|
+
* - Level 2+: Arrays can only contain primitives
|
|
46
|
+
*
|
|
47
|
+
* The `objectSchema` property is always `ObjectSchemaField[]` so it can be
|
|
48
|
+
* passed directly to ports without type mismatches.
|
|
49
|
+
*/
|
|
50
|
+
export type SchemaField<CanNestObjects extends boolean = true> = {
|
|
51
|
+
name: string;
|
|
52
|
+
description?: string;
|
|
53
|
+
type: PrimitiveType | 'object' | 'array';
|
|
54
|
+
items?: PrimitiveType | (CanNestObjects extends true ? 'object' : never);
|
|
55
|
+
objectSchema?: ObjectSchemaField[];
|
|
56
|
+
length?: number;
|
|
57
|
+
minLength?: number;
|
|
58
|
+
maxLength?: number;
|
|
59
|
+
required?: boolean;
|
|
60
|
+
};
|
|
61
|
+
/** Top-level schema field - arrays can contain objects */
|
|
62
|
+
export type ObjectSchemaField = SchemaField<true>;
|
|
63
|
+
/** Nested schema field (inside objectSchema) - arrays can only contain primitives */
|
|
64
|
+
export type NestedSchemaField = SchemaField<false>;
|
|
65
|
+
export interface SelectionConfig {
|
|
66
|
+
mode?: SelectionMode;
|
|
67
|
+
enforceUniqueness?: boolean;
|
|
68
|
+
exhaustionBehavior?: ExhaustionBehavior;
|
|
69
|
+
}
|
|
70
|
+
export interface SelectionState {
|
|
71
|
+
usedIndices: number[];
|
|
72
|
+
currentIndex: number;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Iteration mode for trigger nodes with account iteration
|
|
76
|
+
* - 'fan-out': Spawn all runs simultaneously (one per account)
|
|
77
|
+
* - 'sequential': One account per trigger fire, cycling through the collection
|
|
78
|
+
*/
|
|
79
|
+
export type TriggerIterationMode = 'fan-out' | 'sequential';
|
|
80
|
+
/**
|
|
81
|
+
* Behavior when sequential iteration exhausts all accounts
|
|
82
|
+
* - 'repeat': Start from the beginning of the collection
|
|
83
|
+
* - 'stop': Stop the automation (disable schedule for recurrence)
|
|
84
|
+
*/
|
|
85
|
+
export type IterationExhaustionBehavior = 'repeat' | 'stop';
|
|
86
|
+
/**
|
|
87
|
+
* Selection mode for collection inputs
|
|
88
|
+
* - 'specific': Use hardcoded IDs configured at design time
|
|
89
|
+
* - 'by-tag': Query items by tag at runtime (allows dynamic collections)
|
|
90
|
+
*/
|
|
91
|
+
export type CollectionSelectionMode = 'specific' | 'by-tag';
|
|
92
|
+
/**
|
|
93
|
+
* Account iteration configuration for trigger nodes
|
|
94
|
+
* When enabled, the trigger iterates over a collection of accounts
|
|
95
|
+
*/
|
|
96
|
+
export interface TriggerCollectionConfig {
|
|
97
|
+
/** Whether account iteration is enabled */
|
|
98
|
+
enabled: boolean;
|
|
99
|
+
/** Selection mode: 'specific' uses accountIds, 'by-tag' queries at runtime */
|
|
100
|
+
selectionMode?: CollectionSelectionMode;
|
|
101
|
+
/** Account IDs to iterate over (used when selectionMode is 'specific' or undefined) */
|
|
102
|
+
accountIds?: string[];
|
|
103
|
+
/** Tag to query accounts by at runtime (used when selectionMode is 'by-tag') */
|
|
104
|
+
accountTag?: string;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Computes the required outputMode/selectionMode types based on node category.
|
|
108
|
+
* - trigger/terminal: both null
|
|
109
|
+
* - generator: outputMode required, selectionMode null
|
|
110
|
+
* - source: both required
|
|
111
|
+
*/
|
|
112
|
+
type DefaultsForCategory<T extends NodeCategory, TCustom extends Record<string, unknown>> = T extends 'source' ? TCustom & {
|
|
113
|
+
outputMode: OutputMode;
|
|
114
|
+
selectionMode: SelectionMode;
|
|
115
|
+
} : T extends 'generator' ? TCustom & {
|
|
116
|
+
outputMode: OutputMode;
|
|
117
|
+
selectionMode: null;
|
|
118
|
+
} : TCustom & {
|
|
119
|
+
outputMode: null;
|
|
120
|
+
selectionMode: null;
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* Computes the outputModes array type based on node category.
|
|
124
|
+
*/
|
|
125
|
+
type OutputModesForCategory<T extends NodeCategory> = T extends 'source' | 'generator' ? OutputMode[] : null;
|
|
126
|
+
/**
|
|
127
|
+
* Computes the selectionModes array type based on node category.
|
|
128
|
+
*/
|
|
129
|
+
type SelectionModesForCategory<T extends NodeCategory> = T extends 'source' ? SelectionMode[] : null;
|
|
130
|
+
/**
|
|
131
|
+
* Resolved preview data for a node.
|
|
132
|
+
* Contains render-ready configuration with all references resolved.
|
|
133
|
+
*/
|
|
134
|
+
export interface ResolvedPreview {
|
|
135
|
+
/** Render-ready config (varies by node type) */
|
|
136
|
+
renderConfig: unknown;
|
|
137
|
+
/** Source URLs keyed by segment/element ID */
|
|
138
|
+
sources: Record<string, string>;
|
|
139
|
+
/** Text content keyed by segment/element ID */
|
|
140
|
+
textContent: Record<string, string>;
|
|
141
|
+
}
|
|
142
|
+
export interface NodeDefinition<T extends NodeCategory = NodeCategory, TDefaults extends Record<string, unknown> = Record<string, unknown>, TInternal extends boolean = false> {
|
|
143
|
+
nodeId: string;
|
|
144
|
+
label: string;
|
|
145
|
+
description: string;
|
|
146
|
+
type: T;
|
|
147
|
+
category: string;
|
|
148
|
+
/** If true, this node is internal and not user-creatable */
|
|
149
|
+
isInternal: TInternal;
|
|
150
|
+
outputModes: OutputModesForCategory<T>;
|
|
151
|
+
selectionModes: SelectionModesForCategory<T>;
|
|
152
|
+
defaults: DefaultsForCategory<T, TDefaults>;
|
|
153
|
+
computePorts: (params: {
|
|
154
|
+
config: DefaultsForCategory<T, TDefaults>;
|
|
155
|
+
client?: AutomationsClient;
|
|
156
|
+
getConnectedOutput?: (inputId: string) => {
|
|
157
|
+
type: BasePortType | BasePortType[];
|
|
158
|
+
isArray: boolean;
|
|
159
|
+
objectSchema?: ObjectSchemaField[];
|
|
160
|
+
} | null;
|
|
161
|
+
}) => ComputePortsResult | Promise<ComputePortsResult>;
|
|
162
|
+
/**
|
|
163
|
+
* Resolve preview values for this node.
|
|
164
|
+
* Converts config with refs (inputId/textInputId) to render-ready format.
|
|
165
|
+
* Only implemented by nodes that support preview (image-composer, video-composer).
|
|
166
|
+
*/
|
|
167
|
+
resolvePreview?: (config: DefaultsForCategory<T, TDefaults>) => ResolvedPreview | null;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Define a node with full type inference.
|
|
171
|
+
*
|
|
172
|
+
* - outputMode/selectionMode in defaults are typed based on the node's `type`
|
|
173
|
+
* - Custom defaults are merged and available in computePorts
|
|
174
|
+
* - No manual type assertions needed
|
|
175
|
+
*/
|
|
176
|
+
export declare function defineNode<T extends NodeCategory, TCustomDefaults extends Record<string, unknown>, TInternal extends boolean = false>(def: {
|
|
177
|
+
nodeId: string;
|
|
178
|
+
label: string;
|
|
179
|
+
description: string;
|
|
180
|
+
type: T;
|
|
181
|
+
category: string;
|
|
182
|
+
/** If true, this node is internal and not user-creatable */
|
|
183
|
+
isInternal?: TInternal;
|
|
184
|
+
outputModes: OutputModesForCategory<T>;
|
|
185
|
+
selectionModes: SelectionModesForCategory<T>;
|
|
186
|
+
defaults: DefaultsForCategory<T, TCustomDefaults>;
|
|
187
|
+
computePorts: (params: {
|
|
188
|
+
config: DefaultsForCategory<T, TCustomDefaults>;
|
|
189
|
+
client?: AutomationsClient;
|
|
190
|
+
getConnectedOutput?: (inputId: string) => {
|
|
191
|
+
type: BasePortType | BasePortType[];
|
|
192
|
+
isArray: boolean;
|
|
193
|
+
objectSchema?: ObjectSchemaField[];
|
|
194
|
+
} | null;
|
|
195
|
+
}) => ComputePortsResult | Promise<ComputePortsResult>;
|
|
196
|
+
/**
|
|
197
|
+
* Resolve preview values for this node.
|
|
198
|
+
* Converts config with refs (inputId/textInputId) to render-ready format.
|
|
199
|
+
*/
|
|
200
|
+
resolvePreview?: (config: DefaultsForCategory<T, TCustomDefaults>) => ResolvedPreview | null;
|
|
201
|
+
}): NodeDefinition<T, TCustomDefaults, TInternal>;
|
|
202
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Node Definition Types
|
|
4
|
+
*
|
|
5
|
+
* This file contains shared types for node definitions.
|
|
6
|
+
* Each node file imports from here and defines its behavior.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.defineNode = defineNode;
|
|
10
|
+
// =============================================================================
|
|
11
|
+
// Helper Function
|
|
12
|
+
// =============================================================================
|
|
13
|
+
/**
|
|
14
|
+
* Define a node with full type inference.
|
|
15
|
+
*
|
|
16
|
+
* - outputMode/selectionMode in defaults are typed based on the node's `type`
|
|
17
|
+
* - Custom defaults are merged and available in computePorts
|
|
18
|
+
* - No manual type assertions needed
|
|
19
|
+
*/
|
|
20
|
+
function defineNode(def) {
|
|
21
|
+
return { ...def, isInternal: (def.isInternal ?? false) };
|
|
22
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
declare const definition: import("./types").NodeDefinition<"generator", {
|
|
2
|
+
videoEditor: {
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
fps: number;
|
|
6
|
+
dimensionPreset: string;
|
|
7
|
+
channels: {
|
|
8
|
+
id: string;
|
|
9
|
+
name: string;
|
|
10
|
+
segments: never[];
|
|
11
|
+
}[];
|
|
12
|
+
};
|
|
13
|
+
outputMode: "per-input";
|
|
14
|
+
selectionMode: null;
|
|
15
|
+
}, false>;
|
|
16
|
+
export default definition;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const types_1 = require("./types");
|
|
4
|
+
const definition = (0, types_1.defineNode)({
|
|
5
|
+
nodeId: 'video-composer',
|
|
6
|
+
label: 'Video Composer',
|
|
7
|
+
description: 'Create templated videos',
|
|
8
|
+
type: 'generator',
|
|
9
|
+
category: 'Generation',
|
|
10
|
+
outputModes: ['per-input', 'single'],
|
|
11
|
+
selectionModes: null,
|
|
12
|
+
defaults: {
|
|
13
|
+
videoEditor: {
|
|
14
|
+
width: 1080,
|
|
15
|
+
height: 1920,
|
|
16
|
+
fps: 30,
|
|
17
|
+
dimensionPreset: '9:16',
|
|
18
|
+
channels: [{
|
|
19
|
+
id: 'main-track',
|
|
20
|
+
name: 'Main Track',
|
|
21
|
+
segments: [],
|
|
22
|
+
}],
|
|
23
|
+
},
|
|
24
|
+
outputMode: 'per-input',
|
|
25
|
+
selectionMode: null,
|
|
26
|
+
},
|
|
27
|
+
computePorts: ({ config }) => {
|
|
28
|
+
const editorConfig = config?.videoEditor;
|
|
29
|
+
const inputs = [];
|
|
30
|
+
const addedIds = new Set();
|
|
31
|
+
if (editorConfig) {
|
|
32
|
+
editorConfig.channels.forEach(channel => {
|
|
33
|
+
channel.segments.forEach(segment => {
|
|
34
|
+
// inputRef exists on all segments except 'text'
|
|
35
|
+
if (segment.type !== 'text') {
|
|
36
|
+
if (segment.inputRef && !addedIds.has(segment.inputRef)) {
|
|
37
|
+
addedIds.add(segment.inputRef);
|
|
38
|
+
const inputType = segment.type === 'video' || segment.type === 'video-sequence' ? 'video'
|
|
39
|
+
: segment.type === 'audio' ? 'audio'
|
|
40
|
+
: 'image';
|
|
41
|
+
inputs.push({
|
|
42
|
+
id: segment.inputRef,
|
|
43
|
+
type: inputType,
|
|
44
|
+
isArray: segment.type === 'image-sequence' || segment.type === 'video-sequence',
|
|
45
|
+
required: segment.required ?? true,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
// textInputRef only exists on 'text' segments
|
|
50
|
+
if (segment.type === 'text') {
|
|
51
|
+
if (segment.textInputRef && !addedIds.has(segment.textInputRef)) {
|
|
52
|
+
addedIds.add(segment.textInputRef);
|
|
53
|
+
inputs.push({
|
|
54
|
+
id: segment.textInputRef,
|
|
55
|
+
type: 'text',
|
|
56
|
+
isArray: false,
|
|
57
|
+
required: segment.required ?? true,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
inputs,
|
|
66
|
+
outputs: [
|
|
67
|
+
{
|
|
68
|
+
id: 'output',
|
|
69
|
+
type: 'video',
|
|
70
|
+
isArray: false,
|
|
71
|
+
required: true,
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
};
|
|
75
|
+
},
|
|
76
|
+
resolvePreview: (config) => {
|
|
77
|
+
const editorConfig = config?.videoEditor;
|
|
78
|
+
if (!editorConfig)
|
|
79
|
+
return null;
|
|
80
|
+
const sources = {};
|
|
81
|
+
const textContent = {};
|
|
82
|
+
// Resolve segments: inputRef/textInputRef -> segment.id
|
|
83
|
+
for (const channel of editorConfig.channels) {
|
|
84
|
+
for (const segment of channel.segments) {
|
|
85
|
+
if (segment.type !== 'text') {
|
|
86
|
+
// Media segments with inputRef
|
|
87
|
+
if (segment.inputRef) {
|
|
88
|
+
const url = editorConfig.previewUrls?.[segment.inputRef];
|
|
89
|
+
if (url) {
|
|
90
|
+
sources[segment.id] = url;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
// Text segments with textInputRef
|
|
96
|
+
if (segment.textInputRef) {
|
|
97
|
+
const text = editorConfig.previewTextValues?.[segment.textInputRef];
|
|
98
|
+
if (text) {
|
|
99
|
+
textContent[segment.id] = text;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return {
|
|
106
|
+
renderConfig: {
|
|
107
|
+
width: editorConfig.width,
|
|
108
|
+
height: editorConfig.height,
|
|
109
|
+
fps: editorConfig.fps,
|
|
110
|
+
channels: editorConfig.channels,
|
|
111
|
+
},
|
|
112
|
+
sources,
|
|
113
|
+
textContent,
|
|
114
|
+
};
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
exports.default = definition;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type VideoImportPlatform = 'youtube' | 'tiktok' | 'instagram';
|
|
2
|
+
export type VideoImportQuality = '360' | '480' | '720' | '1080' | '1440' | '2160';
|
|
3
|
+
declare const definition: import("./types").NodeDefinition<"source", {
|
|
4
|
+
platform: VideoImportPlatform;
|
|
5
|
+
videoQuality: VideoImportQuality;
|
|
6
|
+
outputMode: "per-input";
|
|
7
|
+
selectionMode: "random";
|
|
8
|
+
}, false>;
|
|
9
|
+
export default definition;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const types_1 = require("./types");
|
|
4
|
+
const definition = (0, types_1.defineNode)({
|
|
5
|
+
nodeId: 'video-import',
|
|
6
|
+
label: 'Import Video',
|
|
7
|
+
description: 'Import videos from YouTube, TikTok, Instagram & more',
|
|
8
|
+
type: 'source',
|
|
9
|
+
category: 'Sources',
|
|
10
|
+
outputModes: ['per-input', 'single'],
|
|
11
|
+
selectionModes: ['random', 'sequential'],
|
|
12
|
+
defaults: {
|
|
13
|
+
platform: 'youtube',
|
|
14
|
+
videoQuality: '1080',
|
|
15
|
+
outputMode: 'per-input',
|
|
16
|
+
selectionMode: 'random',
|
|
17
|
+
},
|
|
18
|
+
computePorts: () => ({
|
|
19
|
+
inputs: [{ id: 'url', type: 'text', isArray: false, required: true }],
|
|
20
|
+
outputs: [{ id: 'video', type: 'video', isArray: false, required: true }],
|
|
21
|
+
}),
|
|
22
|
+
});
|
|
23
|
+
exports.default = definition;
|