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.
- 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 +18 -0
- package/dist/automations/nodes/account.js +29 -0
- package/dist/automations/nodes/auto-caption.d.ts +64 -0
- package/dist/automations/nodes/auto-caption.js +46 -0
- package/dist/automations/nodes/auto-post.d.ts +81 -0
- package/dist/automations/nodes/auto-post.js +54 -0
- package/dist/automations/nodes/branch.d.ts +58 -0
- package/dist/automations/nodes/branch.js +50 -0
- package/dist/automations/nodes/collect.d.ts +16 -0
- package/dist/automations/nodes/collect.js +56 -0
- package/dist/automations/nodes/compose-workflow.d.ts +21 -0
- package/dist/automations/nodes/compose-workflow.js +42 -0
- package/dist/automations/nodes/create-dm.d.ts +96 -0
- package/dist/automations/nodes/create-dm.js +88 -0
- package/dist/automations/nodes/custom-model.d.ts +19 -0
- package/dist/automations/nodes/custom-model.js +52 -0
- package/dist/automations/nodes/deduplicate.d.ts +8 -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 +23 -0
- package/dist/automations/nodes/for-each.js +84 -0
- package/dist/automations/nodes/generate-image.d.ts +16 -0
- package/dist/automations/nodes/generate-image.js +45 -0
- package/dist/automations/nodes/generate-video.d.ts +16 -0
- package/dist/automations/nodes/generate-video.js +45 -0
- package/dist/automations/nodes/if.d.ts +22 -0
- package/dist/automations/nodes/if.js +44 -0
- package/dist/automations/nodes/image-composer.d.ts +33 -0
- package/dist/automations/nodes/image-composer.js +95 -0
- package/dist/automations/nodes/index.d.ts +20 -0
- package/dist/automations/nodes/index.js +93 -0
- package/dist/automations/nodes/llm.d.ts +27 -0
- package/dist/automations/nodes/llm.js +85 -0
- package/dist/automations/nodes/manual-trigger.d.ts +34 -0
- package/dist/automations/nodes/manual-trigger.js +32 -0
- package/dist/automations/nodes/media.d.ts +17 -0
- package/dist/automations/nodes/media.js +40 -0
- package/dist/automations/nodes/not.d.ts +6 -0
- package/dist/automations/nodes/not.js +35 -0
- package/dist/automations/nodes/output.d.ts +30 -0
- package/dist/automations/nodes/output.js +32 -0
- package/dist/automations/nodes/random-route.d.ts +52 -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 +69 -0
- package/dist/automations/nodes/recurrence.js +50 -0
- package/dist/automations/nodes/save-to-media.d.ts +32 -0
- package/dist/automations/nodes/save-to-media.js +31 -0
- package/dist/automations/nodes/screenshot-animation.d.ts +7 -0
- package/dist/automations/nodes/screenshot-animation.js +36 -0
- package/dist/automations/nodes/social-audio.d.ts +8 -0
- package/dist/automations/nodes/social-audio.js +30 -0
- package/dist/automations/nodes/text.d.ts +7 -0
- package/dist/automations/nodes/text.js +41 -0
- package/dist/automations/nodes/transcript.d.ts +6 -0
- package/dist/automations/nodes/transcript.js +46 -0
- package/dist/automations/nodes/types.d.ts +178 -0
- package/dist/automations/nodes/types.js +22 -0
- package/dist/automations/nodes/video-composer.d.ts +25 -0
- package/dist/automations/nodes/video-composer.js +71 -0
- package/dist/automations/nodes/video-import.d.ts +27 -0
- package/dist/automations/nodes/video-import.js +37 -0
- package/dist/automations/types.d.ts +544 -0
- package/dist/automations/types.js +101 -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 +194 -0
- package/dist/graph-controller.js +623 -0
- package/dist/index.d.ts +38 -9
- package/dist/index.js +43 -23
- 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 +20 -20
- package/dist/render/types/video.d.ts +2 -2
- 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,31 @@
|
|
|
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: 'save-to-media',
|
|
6
|
+
label: 'Save To Media',
|
|
7
|
+
description: 'Save outputs to media library',
|
|
8
|
+
type: 'terminal',
|
|
9
|
+
category: 'Output',
|
|
10
|
+
outputModes: null,
|
|
11
|
+
selectionModes: null,
|
|
12
|
+
defaults: {
|
|
13
|
+
inputs: [{ id: 'input', type: 'image' }],
|
|
14
|
+
globalTag: undefined,
|
|
15
|
+
includeDateTag: false,
|
|
16
|
+
makeUnique: false,
|
|
17
|
+
outputMode: null,
|
|
18
|
+
selectionMode: null,
|
|
19
|
+
},
|
|
20
|
+
computePorts: ({ config }) => {
|
|
21
|
+
const configInputs = (config?.inputs ?? []);
|
|
22
|
+
const inputs = configInputs.map(input => ({
|
|
23
|
+
id: input.id,
|
|
24
|
+
type: input.type,
|
|
25
|
+
isArray: false,
|
|
26
|
+
required: true,
|
|
27
|
+
}));
|
|
28
|
+
return { inputs, outputs: [] };
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
exports.default = definition;
|
|
@@ -0,0 +1,36 @@
|
|
|
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: 'screenshot-animation',
|
|
6
|
+
label: 'Animate Screenshot',
|
|
7
|
+
description: 'Create an iPhone screenshot animation from an image',
|
|
8
|
+
type: 'generator',
|
|
9
|
+
category: 'Generation',
|
|
10
|
+
outputModes: ['per-input', 'single'],
|
|
11
|
+
selectionModes: null,
|
|
12
|
+
defaults: {
|
|
13
|
+
holdDurationMs: 500,
|
|
14
|
+
outputMode: 'per-input',
|
|
15
|
+
selectionMode: null,
|
|
16
|
+
},
|
|
17
|
+
computePorts: () => ({
|
|
18
|
+
inputs: [
|
|
19
|
+
{
|
|
20
|
+
id: 'image',
|
|
21
|
+
type: 'image',
|
|
22
|
+
isArray: false,
|
|
23
|
+
required: true,
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
outputs: [
|
|
27
|
+
{
|
|
28
|
+
id: 'output',
|
|
29
|
+
type: 'video',
|
|
30
|
+
isArray: false,
|
|
31
|
+
required: true,
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
}),
|
|
35
|
+
});
|
|
36
|
+
exports.default = definition;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
declare const definition: import("./types").NodeDefinition<"source", {
|
|
2
|
+
urls: string[];
|
|
3
|
+
selectedMediaIds: string[];
|
|
4
|
+
selectionMode: "random";
|
|
5
|
+
outputMode: "per-input";
|
|
6
|
+
}>;
|
|
7
|
+
export default definition;
|
|
8
|
+
export type SocialAudioConfig = typeof definition.defaults;
|
|
@@ -0,0 +1,30 @@
|
|
|
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: 'social-audio',
|
|
6
|
+
label: 'Social Audio',
|
|
7
|
+
description: 'Select trending audio for posts',
|
|
8
|
+
type: 'source',
|
|
9
|
+
category: 'Sources',
|
|
10
|
+
outputModes: ['per-input', 'single'],
|
|
11
|
+
selectionModes: ['random', 'sequential'],
|
|
12
|
+
defaults: {
|
|
13
|
+
urls: [],
|
|
14
|
+
selectedMediaIds: [],
|
|
15
|
+
selectionMode: 'random',
|
|
16
|
+
outputMode: 'per-input',
|
|
17
|
+
},
|
|
18
|
+
computePorts: () => ({
|
|
19
|
+
inputs: [],
|
|
20
|
+
outputs: [
|
|
21
|
+
{
|
|
22
|
+
id: 'social-audio',
|
|
23
|
+
type: 'social_audio',
|
|
24
|
+
isArray: false,
|
|
25
|
+
required: true,
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
}),
|
|
29
|
+
});
|
|
30
|
+
exports.default = definition;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const types_1 = require("./types");
|
|
4
|
+
const internal_utils_1 = require("../../internal-utils");
|
|
5
|
+
const definition = (0, types_1.defineNode)({
|
|
6
|
+
nodeId: 'text',
|
|
7
|
+
label: 'Text',
|
|
8
|
+
description: 'Use text collections',
|
|
9
|
+
type: 'source',
|
|
10
|
+
category: 'Sources',
|
|
11
|
+
outputModes: ['per-input', 'single'],
|
|
12
|
+
selectionModes: ['random', 'sequential'],
|
|
13
|
+
defaults: {
|
|
14
|
+
textOptions: [],
|
|
15
|
+
selectionMode: 'random',
|
|
16
|
+
outputMode: 'per-input',
|
|
17
|
+
},
|
|
18
|
+
computePorts: ({ config }) => {
|
|
19
|
+
const textOptions = (config?.textOptions ?? []);
|
|
20
|
+
const variables = (0, internal_utils_1.extractTemplateVariables)(textOptions);
|
|
21
|
+
// Generate inputs from template variables
|
|
22
|
+
const inputs = variables.map(variable => ({
|
|
23
|
+
id: variable,
|
|
24
|
+
type: 'text',
|
|
25
|
+
isArray: false,
|
|
26
|
+
required: false,
|
|
27
|
+
}));
|
|
28
|
+
return {
|
|
29
|
+
inputs,
|
|
30
|
+
outputs: [
|
|
31
|
+
{
|
|
32
|
+
id: 'text',
|
|
33
|
+
type: 'text',
|
|
34
|
+
isArray: false,
|
|
35
|
+
required: true,
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
exports.default = definition;
|
|
@@ -0,0 +1,46 @@
|
|
|
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: 'transcript',
|
|
6
|
+
label: 'Transcribe',
|
|
7
|
+
description: 'Transcribe video or audio with timestamps',
|
|
8
|
+
type: 'generator',
|
|
9
|
+
category: 'Generation',
|
|
10
|
+
outputModes: ['per-input', 'single'],
|
|
11
|
+
selectionModes: null,
|
|
12
|
+
defaults: {
|
|
13
|
+
outputMode: 'per-input',
|
|
14
|
+
selectionMode: null,
|
|
15
|
+
},
|
|
16
|
+
computePorts: () => ({
|
|
17
|
+
inputs: [
|
|
18
|
+
{
|
|
19
|
+
id: 'media',
|
|
20
|
+
type: ['video', 'audio'],
|
|
21
|
+
isArray: false,
|
|
22
|
+
required: true,
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
outputs: [
|
|
26
|
+
{
|
|
27
|
+
id: 'text',
|
|
28
|
+
type: 'text',
|
|
29
|
+
isArray: false,
|
|
30
|
+
required: true,
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
id: 'segments',
|
|
34
|
+
type: 'object',
|
|
35
|
+
isArray: false,
|
|
36
|
+
required: true,
|
|
37
|
+
objectSchema: [
|
|
38
|
+
{ name: 'text', type: 'string' },
|
|
39
|
+
{ name: 'start', type: 'number' },
|
|
40
|
+
{ name: 'end', type: 'number' },
|
|
41
|
+
],
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
}),
|
|
45
|
+
});
|
|
46
|
+
exports.default = definition;
|
|
@@ -0,0 +1,178 @@
|
|
|
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
|
+
export type NodeCategory = 'trigger' | 'source' | 'generator' | 'terminal';
|
|
9
|
+
export type OutputMode = 'per-input' | 'single';
|
|
10
|
+
export type SelectionMode = 'random' | 'sequential';
|
|
11
|
+
export type ExhaustionBehavior = 'restart' | 'error';
|
|
12
|
+
export type InputType = 'static' | 'variable';
|
|
13
|
+
type PrimitiveType = 'string' | 'number' | 'boolean';
|
|
14
|
+
/**
|
|
15
|
+
* Generic type for object schema fields with compile-time depth enforcement.
|
|
16
|
+
*
|
|
17
|
+
* - Level 1 (default): Can have 'object' or 'array' types, arrays can contain objects
|
|
18
|
+
* - Level 2: Can have 'object' or 'array' types, arrays cannot contain objects
|
|
19
|
+
* - Level 3: Only primitive types allowed
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* // Level 1 field (top-level)
|
|
23
|
+
* const field: SchemaField = { name: 'users', type: 'array', items: 'object', objectSchema: [...] };
|
|
24
|
+
*
|
|
25
|
+
* // Level 2 field (inside objectSchema)
|
|
26
|
+
* const nested: SchemaField<true, false> = { name: 'tags', type: 'array', items: 'string' };
|
|
27
|
+
*
|
|
28
|
+
* // Level 3 field (deepest level)
|
|
29
|
+
* const leaf: SchemaField<false, false> = { name: 'id', type: 'string' };
|
|
30
|
+
*/
|
|
31
|
+
/**
|
|
32
|
+
* Schema field type with compile-time depth enforcement for array items.
|
|
33
|
+
*
|
|
34
|
+
* - Level 1 (default): Arrays can contain objects (`items: 'object'`)
|
|
35
|
+
* - Level 2+: Arrays can only contain primitives
|
|
36
|
+
*
|
|
37
|
+
* The `objectSchema` property is always `ObjectSchemaField[]` so it can be
|
|
38
|
+
* passed directly to ports without type mismatches.
|
|
39
|
+
*/
|
|
40
|
+
export type SchemaField<CanNestObjects extends boolean = true> = {
|
|
41
|
+
name: string;
|
|
42
|
+
description?: string;
|
|
43
|
+
type: PrimitiveType | 'object' | 'array';
|
|
44
|
+
items?: PrimitiveType | (CanNestObjects extends true ? 'object' : never);
|
|
45
|
+
objectSchema?: ObjectSchemaField[];
|
|
46
|
+
length?: number;
|
|
47
|
+
minLength?: number;
|
|
48
|
+
maxLength?: number;
|
|
49
|
+
required?: boolean;
|
|
50
|
+
};
|
|
51
|
+
/** Top-level schema field - arrays can contain objects */
|
|
52
|
+
export type ObjectSchemaField = SchemaField<true>;
|
|
53
|
+
/** Nested schema field (inside objectSchema) - arrays can only contain primitives */
|
|
54
|
+
export type NestedSchemaField = SchemaField<false>;
|
|
55
|
+
export interface BranchValueConfig {
|
|
56
|
+
inputType?: InputType;
|
|
57
|
+
}
|
|
58
|
+
export interface PassthroughInput {
|
|
59
|
+
id: string;
|
|
60
|
+
type: string;
|
|
61
|
+
isArray?: boolean;
|
|
62
|
+
branchValues?: Record<string, BranchValueConfig>;
|
|
63
|
+
}
|
|
64
|
+
export interface SelectionConfig {
|
|
65
|
+
mode?: SelectionMode;
|
|
66
|
+
enforceUniqueness?: boolean;
|
|
67
|
+
exhaustionBehavior?: ExhaustionBehavior;
|
|
68
|
+
}
|
|
69
|
+
export interface SelectionState {
|
|
70
|
+
usedIndices: number[];
|
|
71
|
+
currentIndex: number;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Iteration mode for trigger nodes with account iteration
|
|
75
|
+
* - 'fan-out': Spawn all runs simultaneously (one per account)
|
|
76
|
+
* - 'sequential': One account per trigger fire, cycling through the collection
|
|
77
|
+
*/
|
|
78
|
+
export type TriggerIterationMode = 'fan-out' | 'sequential';
|
|
79
|
+
/**
|
|
80
|
+
* Behavior when sequential iteration exhausts all accounts
|
|
81
|
+
* - 'repeat': Start from the beginning of the collection
|
|
82
|
+
* - 'stop': Stop the automation (disable schedule for recurrence)
|
|
83
|
+
*/
|
|
84
|
+
export type IterationExhaustionBehavior = 'repeat' | 'stop';
|
|
85
|
+
/**
|
|
86
|
+
* Selection mode for collection inputs
|
|
87
|
+
* - 'specific': Use hardcoded IDs configured at design time
|
|
88
|
+
* - 'by-tag': Query items by tag at runtime (allows dynamic collections)
|
|
89
|
+
*/
|
|
90
|
+
export type CollectionSelectionMode = 'specific' | 'by-tag';
|
|
91
|
+
/**
|
|
92
|
+
* Account iteration configuration for trigger nodes
|
|
93
|
+
* When enabled, the trigger iterates over a collection of accounts
|
|
94
|
+
*/
|
|
95
|
+
export interface TriggerCollectionConfig {
|
|
96
|
+
/** Whether account iteration is enabled */
|
|
97
|
+
enabled: boolean;
|
|
98
|
+
/** Selection mode: 'specific' uses accountIds, 'by-tag' queries at runtime */
|
|
99
|
+
selectionMode?: CollectionSelectionMode;
|
|
100
|
+
/** Account IDs to iterate over (used when selectionMode is 'specific' or undefined) */
|
|
101
|
+
accountIds?: string[];
|
|
102
|
+
/** Tag to query accounts by at runtime (used when selectionMode is 'by-tag') */
|
|
103
|
+
accountTag?: string;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Computes the required outputMode/selectionMode types based on node category.
|
|
107
|
+
* - trigger/terminal: both null
|
|
108
|
+
* - generator: outputMode required, selectionMode null
|
|
109
|
+
* - source: both required
|
|
110
|
+
*/
|
|
111
|
+
type DefaultsForCategory<T extends NodeCategory, TCustom extends Record<string, unknown>> = T extends 'source' ? TCustom & {
|
|
112
|
+
outputMode: OutputMode;
|
|
113
|
+
selectionMode: SelectionMode;
|
|
114
|
+
} : T extends 'generator' ? TCustom & {
|
|
115
|
+
outputMode: OutputMode;
|
|
116
|
+
selectionMode: null;
|
|
117
|
+
} : TCustom & {
|
|
118
|
+
outputMode: null;
|
|
119
|
+
selectionMode: null;
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* Computes the outputModes array type based on node category.
|
|
123
|
+
*/
|
|
124
|
+
type OutputModesForCategory<T extends NodeCategory> = T extends 'source' | 'generator' ? OutputMode[] : null;
|
|
125
|
+
/**
|
|
126
|
+
* Computes the selectionModes array type based on node category.
|
|
127
|
+
*/
|
|
128
|
+
type SelectionModesForCategory<T extends NodeCategory> = T extends 'source' ? SelectionMode[] : null;
|
|
129
|
+
export interface NodeDefinition<T extends NodeCategory = NodeCategory, TDefaults extends Record<string, unknown> = Record<string, unknown>> {
|
|
130
|
+
nodeId: string;
|
|
131
|
+
label: string;
|
|
132
|
+
description: string;
|
|
133
|
+
type: T;
|
|
134
|
+
category: string;
|
|
135
|
+
outputModes: OutputModesForCategory<T>;
|
|
136
|
+
selectionModes: SelectionModesForCategory<T>;
|
|
137
|
+
defaults: DefaultsForCategory<T, TDefaults>;
|
|
138
|
+
computePorts: (params: {
|
|
139
|
+
config: DefaultsForCategory<T, TDefaults>;
|
|
140
|
+
getConnectedOutput?: (inputId: string) => {
|
|
141
|
+
type: BasePortType | BasePortType[];
|
|
142
|
+
isArray: boolean;
|
|
143
|
+
objectSchema?: ObjectSchemaField[];
|
|
144
|
+
} | null;
|
|
145
|
+
}) => {
|
|
146
|
+
inputs: NodePort[];
|
|
147
|
+
outputs: NodePort[];
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Define a node with full type inference.
|
|
152
|
+
*
|
|
153
|
+
* - outputMode/selectionMode in defaults are typed based on the node's `type`
|
|
154
|
+
* - Custom defaults are merged and available in computePorts
|
|
155
|
+
* - No manual type assertions needed
|
|
156
|
+
*/
|
|
157
|
+
export declare function defineNode<T extends NodeCategory, TCustomDefaults extends Record<string, unknown>>(def: {
|
|
158
|
+
nodeId: string;
|
|
159
|
+
label: string;
|
|
160
|
+
description: string;
|
|
161
|
+
type: T;
|
|
162
|
+
category: string;
|
|
163
|
+
outputModes: OutputModesForCategory<T>;
|
|
164
|
+
selectionModes: SelectionModesForCategory<T>;
|
|
165
|
+
defaults: DefaultsForCategory<T, TCustomDefaults>;
|
|
166
|
+
computePorts: (params: {
|
|
167
|
+
config: DefaultsForCategory<T, TCustomDefaults>;
|
|
168
|
+
getConnectedOutput?: (inputId: string) => {
|
|
169
|
+
type: BasePortType | BasePortType[];
|
|
170
|
+
isArray: boolean;
|
|
171
|
+
objectSchema?: ObjectSchemaField[];
|
|
172
|
+
} | null;
|
|
173
|
+
}) => {
|
|
174
|
+
inputs: NodePort[];
|
|
175
|
+
outputs: NodePort[];
|
|
176
|
+
};
|
|
177
|
+
}): NodeDefinition<T, TCustomDefaults>;
|
|
178
|
+
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;
|
|
22
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { VideoEditorNodeConfig } from '../../render/types';
|
|
2
|
+
declare const definition: import("./types").NodeDefinition<"generator", {
|
|
3
|
+
videoEditor: {
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
fps: number;
|
|
7
|
+
dimensionPreset: string;
|
|
8
|
+
channels: {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
segments: never[];
|
|
12
|
+
}[];
|
|
13
|
+
};
|
|
14
|
+
outputMode: "per-input";
|
|
15
|
+
selectionMode: null;
|
|
16
|
+
}>;
|
|
17
|
+
export default definition;
|
|
18
|
+
export type VideoComposerConfig = typeof definition.defaults;
|
|
19
|
+
/**
|
|
20
|
+
* Input to the video-composer node executor
|
|
21
|
+
*/
|
|
22
|
+
export interface VideoEditorNodeInput extends Record<string, unknown> {
|
|
23
|
+
type: 'video-composer';
|
|
24
|
+
editor: VideoEditorNodeConfig;
|
|
25
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
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
|
+
if (segment.inputRef && !addedIds.has(segment.inputRef)) {
|
|
35
|
+
addedIds.add(segment.inputRef);
|
|
36
|
+
const inputType = segment.type === 'video' ? 'video'
|
|
37
|
+
: segment.type === 'audio' ? 'audio'
|
|
38
|
+
: 'image';
|
|
39
|
+
inputs.push({
|
|
40
|
+
id: segment.inputRef,
|
|
41
|
+
type: inputType,
|
|
42
|
+
isArray: false,
|
|
43
|
+
required: segment.required ?? true,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
if (segment.textInputRef && !addedIds.has(segment.textInputRef)) {
|
|
47
|
+
addedIds.add(segment.textInputRef);
|
|
48
|
+
inputs.push({
|
|
49
|
+
id: segment.textInputRef,
|
|
50
|
+
type: 'text',
|
|
51
|
+
isArray: false,
|
|
52
|
+
required: segment.required ?? true,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
inputs,
|
|
60
|
+
outputs: [
|
|
61
|
+
{
|
|
62
|
+
id: 'output',
|
|
63
|
+
type: 'video',
|
|
64
|
+
isArray: false,
|
|
65
|
+
required: true,
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
};
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
exports.default = definition;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Supported platforms for video import
|
|
3
|
+
* Note: YouTube is not yet implemented
|
|
4
|
+
*/
|
|
5
|
+
export type VideoImportPlatform = 'youtube' | 'tiktok' | 'instagram';
|
|
6
|
+
/**
|
|
7
|
+
* Video quality options for video import
|
|
8
|
+
*/
|
|
9
|
+
export type VideoImportQuality = '360' | '480' | '720' | '1080' | '1440' | '2160';
|
|
10
|
+
/**
|
|
11
|
+
* Video Import node configuration - imports videos from social media platforms
|
|
12
|
+
* Note: URL is received via input port, not stored in config
|
|
13
|
+
*/
|
|
14
|
+
export interface VideoImportNodeConfig {
|
|
15
|
+
/** Platform to import from */
|
|
16
|
+
platform: VideoImportPlatform;
|
|
17
|
+
/** Video quality preference */
|
|
18
|
+
videoQuality?: VideoImportQuality;
|
|
19
|
+
}
|
|
20
|
+
declare const definition: import("./types").NodeDefinition<"source", {
|
|
21
|
+
platform: VideoImportPlatform;
|
|
22
|
+
videoQuality: VideoImportQuality;
|
|
23
|
+
outputMode: "per-input";
|
|
24
|
+
selectionMode: "random";
|
|
25
|
+
}>;
|
|
26
|
+
export default definition;
|
|
27
|
+
export type VideoImportConfig = typeof definition.defaults;
|
|
@@ -0,0 +1,37 @@
|
|
|
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: [
|
|
20
|
+
{
|
|
21
|
+
id: 'url',
|
|
22
|
+
type: 'text',
|
|
23
|
+
isArray: false,
|
|
24
|
+
required: true,
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
outputs: [
|
|
28
|
+
{
|
|
29
|
+
id: 'video',
|
|
30
|
+
type: 'video',
|
|
31
|
+
isArray: false,
|
|
32
|
+
required: true,
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
}),
|
|
36
|
+
});
|
|
37
|
+
exports.default = definition;
|