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
@@ -3,9 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.nodeDefinitions = void 0;
6
+ exports.internalNodeTypes = exports.nodeDefinitions = void 0;
7
7
  exports.getAllNodeDefinitions = getAllNodeDefinitions;
8
8
  exports.getNodeDefinition = getNodeDefinition;
9
+ const internal_1 = require("./internal");
10
+ Object.defineProperty(exports, "internalNodeTypes", { enumerable: true, get: function () { return internal_1.internalNodeTypes; } });
9
11
  // Import all node definitions
10
12
  const account_1 = __importDefault(require("./account"));
11
13
  const auto_caption_1 = __importDefault(require("./auto-caption"));
@@ -37,12 +39,12 @@ const text_1 = __importDefault(require("./text"));
37
39
  const transcript_1 = __importDefault(require("./transcript"));
38
40
  const video_composer_1 = __importDefault(require("./video-composer"));
39
41
  const video_import_1 = __importDefault(require("./video-import"));
42
+ // =============================================================================
43
+ // Registry
44
+ // =============================================================================
40
45
  /**
41
46
  * Registry of all user-creatable node definitions.
42
47
  * This is the single source of truth for node types.
43
- *
44
- * Note: Internal executor types like 'for-each-value' are not included here
45
- * as they are created dynamically during execution, not by users.
46
48
  */
47
49
  exports.nodeDefinitions = {
48
50
  'account': account_1.default,
@@ -76,9 +78,6 @@ exports.nodeDefinitions = {
76
78
  'video-composer': video_composer_1.default,
77
79
  'video-import': video_import_1.default,
78
80
  };
79
- // =============================================================================
80
- // Getters
81
- // =============================================================================
82
81
  /**
83
82
  * Get all node definitions as an array
84
83
  */
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Internal Node Types
3
+ *
4
+ * These are node types that are created dynamically during execution.
5
+ * They are not user-creatable and don't have definitions in the nodeDefinitions map.
6
+ */
7
+ export declare const internalNodeTypes: readonly ["for-each-value"];
8
+ export type InternalNodeType = (typeof internalNodeTypes)[number];
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ /**
3
+ * Internal Node Types
4
+ *
5
+ * These are node types that are created dynamically during execution.
6
+ * They are not user-creatable and don't have definitions in the nodeDefinitions map.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.internalNodeTypes = void 0;
10
+ exports.internalNodeTypes = ['for-each-value'];
@@ -20,8 +20,8 @@ declare const definition: import("./types").NodeDefinition<"generator", {
20
20
  apiKeys: LLMApiKeys | undefined;
21
21
  outputMode: "per-input";
22
22
  selectionMode: null;
23
- }>;
23
+ }, false>;
24
24
  export default definition;
25
25
  export { LLMProviders };
26
26
  export type { LLMProvider, LLMApiKeys };
27
- export type LLMConfig = typeof definition.defaults;
27
+ export type LLMNodeConfig = typeof definition.defaults;
@@ -1,34 +1,15 @@
1
- import type { EnumOption } from '../types';
1
+ import type { BasePortType, EnumOption } from '../types';
2
2
  import { type ObjectSchemaField } from './types';
3
- interface ManualTriggerOutputLocal {
4
- id: string;
5
- type: string;
6
- isArray?: boolean;
7
- objectSchema?: ObjectSchemaField[];
8
- enumOptions?: EnumOption[];
9
- }
10
- /**
11
- * Manual Trigger node output definition
12
- */
13
- export interface ManualTriggerOutput {
14
- id: string;
15
- type: 'image' | 'video' | 'audio' | 'text' | 'social_audio' | 'account' | 'boolean' | 'object' | 'enum';
16
- isArray?: boolean;
17
- /** Schema for object types - describes the structure of the object */
18
- objectSchema?: ObjectSchemaField[];
19
- /** Options for enum types */
20
- enumOptions?: EnumOption[];
21
- }
22
- /**
23
- * Manual Trigger node configuration - defines outputs that users provide when running
24
- */
25
- export interface ManualTriggerNodeConfig {
26
- outputs: ManualTriggerOutput[];
27
- }
28
3
  declare const definition: import("./types").NodeDefinition<"trigger", {
29
- outputs: ManualTriggerOutputLocal[];
4
+ outputs: Array<{
5
+ id: string;
6
+ type: BasePortType;
7
+ isArray?: boolean;
8
+ objectSchema?: ObjectSchemaField[];
9
+ enumOptions?: EnumOption[];
10
+ }>;
30
11
  outputMode: null;
31
12
  selectionMode: null;
32
- }>;
13
+ }, false>;
33
14
  export default definition;
34
- export type ManualTriggerConfig = typeof definition.defaults;
15
+ export type ManualTriggerNodeConfig = typeof definition.defaults;
@@ -15,7 +15,7 @@ const definition = (0, types_1.defineNode)({
15
15
  selectionMode: null,
16
16
  },
17
17
  computePorts: ({ config }) => {
18
- const configOutputs = (config?.outputs ?? []);
18
+ const configOutputs = config?.outputs ?? [];
19
19
  const outputs = configOutputs.map(output => ({
20
20
  id: output.id,
21
21
  type: output.type,
@@ -1,17 +1,14 @@
1
- import { type SelectionConfig } from './types';
2
- type MediaNodeEnabledType = 'image' | 'video' | 'audio';
1
+ import { type SelectionConfig, type MediaNodeSelectionType } from './types';
3
2
  declare const definition: import("./types").NodeDefinition<"source", {
4
3
  outputs: {
5
4
  id: string;
6
- type: MediaNodeEnabledType;
5
+ type: MediaNodeSelectionType;
7
6
  isArray: boolean;
8
7
  selectedMediaIds: string[];
9
8
  selectionConfig: SelectionConfig | undefined;
10
9
  }[];
11
10
  outputMode: "per-input";
12
11
  selectionMode: "random";
13
- }>;
12
+ }, false>;
14
13
  export default definition;
15
- export type { MediaNodeEnabledType };
16
- export type MediaConfig = typeof definition.defaults;
17
- export type MediaNodeOutput = MediaConfig['outputs'][number];
14
+ export type MediaNodeConfig = typeof definition.defaults;
@@ -1,6 +1,6 @@
1
1
  declare const definition: import("./types").NodeDefinition<"generator", {
2
2
  outputMode: "per-input";
3
3
  selectionMode: null;
4
- }>;
4
+ }, false>;
5
5
  export default definition;
6
- export type NotConfig = typeof definition.defaults;
6
+ export type NotNodeConfig = typeof definition.defaults;
@@ -1,30 +1,17 @@
1
+ import type { BasePortType } from '../types';
1
2
  import { type ObjectSchemaField } from './types';
2
- /**
3
- * Output node input definition
4
- */
5
3
  export interface OutputInput {
6
4
  id: string;
7
- type: 'image' | 'video' | 'audio' | 'text' | 'social_audio' | 'account' | 'boolean' | 'object';
8
- /** Individual tag for this input (overrides global tag) */
5
+ type: BasePortType;
9
6
  tag?: string;
10
- /** Whether this input accepts an array */
11
7
  isArray?: boolean;
12
- /** Schema of object properties (when type is object) */
13
8
  objectSchema?: ObjectSchemaField[];
14
9
  }
15
- /**
16
- * Output node configuration
17
- */
18
- export interface OutputNodeConfig {
19
- inputs: OutputInput[];
20
- /** Which input is the main visual preview for the workflow */
21
- mainPreviewInputId?: string;
22
- }
23
10
  declare const definition: import("./types").NodeDefinition<"terminal", {
24
11
  inputs: OutputInput[];
25
12
  mainPreviewInputId: string | undefined;
26
13
  outputMode: null;
27
14
  selectionMode: null;
28
- }>;
15
+ }, false>;
29
16
  export default definition;
30
- export type PassthroughConfig = typeof definition.defaults;
17
+ export type OutputNodeConfig = typeof definition.defaults;
@@ -1,52 +1,25 @@
1
- /**
2
- * Random Branch branch definition
3
- */
1
+ import { type InputType } from './types';
4
2
  export interface RandomRouteBranch {
5
- /** Unique ID for this branch (e.g., "branch-1") */
6
3
  id: string;
7
- /** Probability weight (0-100, all branches must sum to 100) */
8
4
  probability: number;
9
5
  }
10
- /**
11
- * Object field definition for Random Branch passthrough input default values
12
- */
13
6
  export interface RandomRouteObjectField {
14
- /** Field name */
15
7
  name: string;
16
- /** Field type */
17
8
  type: 'string' | 'number' | 'boolean';
18
9
  }
19
- /**
20
- * Random Branch passthrough input definition
21
- */
22
10
  export interface RandomRoutePassthroughInput {
23
- /** The input port ID (lowercase, hyphens/underscores only) */
24
11
  id: string;
25
- /** The value type */
26
12
  type: 'image' | 'video' | 'audio' | 'text' | 'number' | 'boolean' | 'account' | 'object';
27
- /** Whether this is an array type */
28
13
  isArray?: boolean;
29
- /** Whether this input comes from a variable (input port) vs static default value. Defaults to false. */
30
- isVariable?: boolean;
31
- /** Default value when isVariable is false (type depends on type field) */
14
+ inputType?: InputType;
32
15
  defaultValue?: unknown;
33
- /** Object schema for object type (when type is 'object') */
34
16
  objectSchema?: RandomRouteObjectField[];
35
17
  }
36
- /**
37
- * Random Branch node configuration - routes inputs to a randomly selected branch based on probability
38
- */
39
- export interface RandomRouteNodeConfig {
40
- /** Output branches with probability weights (must sum to 100) */
41
- branches: RandomRouteBranch[];
42
- /** Passthrough inputs that get routed to one branch's outputs */
43
- passthroughInputs: RandomRoutePassthroughInput[];
44
- }
45
18
  declare const definition: import("./types").NodeDefinition<"generator", {
46
19
  branches: RandomRouteBranch[];
47
20
  passthroughInputs: RandomRoutePassthroughInput[];
48
21
  outputMode: "single";
49
22
  selectionMode: null;
50
- }>;
23
+ }, false>;
51
24
  export default definition;
52
- export type RandomRouteConfig = typeof definition.defaults;
25
+ export type RandomRouteNodeConfig = typeof definition.defaults;
@@ -15,19 +15,19 @@ const definition = (0, types_1.defineNode)({
15
15
  { id: 'branch-2', probability: 50 },
16
16
  ],
17
17
  passthroughInputs: [
18
- { id: 'input', type: 'image', isArray: false, isVariable: false },
18
+ { id: 'input', type: 'image', isArray: false, inputType: 'static' },
19
19
  ],
20
20
  outputMode: 'single',
21
21
  selectionMode: null,
22
22
  },
23
23
  computePorts: ({ config }) => {
24
- const branches = (config?.branches ?? []);
25
- const passthroughInputs = (config?.passthroughInputs ?? []);
24
+ const branches = config?.branches ?? [];
25
+ const passthroughInputs = config?.passthroughInputs ?? [];
26
26
  const inputs = [];
27
27
  const outputs = [];
28
- // Input ports: only passthroughs where isVariable is true
28
+ // Input ports: only passthroughs where inputType is 'variable'
29
29
  for (const passthrough of passthroughInputs) {
30
- if (passthrough.isVariable) {
30
+ if (passthrough.inputType === 'variable') {
31
31
  inputs.push({
32
32
  id: passthrough.id,
33
33
  type: passthrough.type,
@@ -1,7 +1,8 @@
1
+ import { type InputType } from './types';
1
2
  export interface RandomInputPort {
2
3
  id: string;
3
4
  probability: number;
4
- isVariable: boolean;
5
+ inputType: InputType;
5
6
  defaultValue?: unknown;
6
7
  }
7
8
  declare const definition: import("./types").NodeDefinition<"generator", {
@@ -11,6 +12,6 @@ declare const definition: import("./types").NodeDefinition<"generator", {
11
12
  inputPorts: RandomInputPort[];
12
13
  outputMode: "single";
13
14
  selectionMode: null;
14
- }>;
15
+ }, false>;
15
16
  export default definition;
16
- export type RandomConfig = typeof definition.defaults;
17
+ export type RandomNodeConfig = typeof definition.defaults;
@@ -21,16 +21,16 @@ const definition = (0, types_1.defineNode)({
21
21
  const mode = config?.mode ?? 'array';
22
22
  const valueType = (config?.valueType ?? 'object');
23
23
  const exposeIndex = config?.exposeIndex ?? false;
24
- const inputPorts = (config?.inputPorts ?? []);
24
+ const inputPorts = config?.inputPorts ?? [];
25
25
  const inputs = [];
26
26
  const outputs = [];
27
27
  if (mode === 'array') {
28
28
  inputs.push({ id: 'array', type: 'object', isArray: false, required: true });
29
29
  }
30
30
  else {
31
- // Multi-input mode: only add ports where isVariable is true
31
+ // Multi-input mode: only add ports where inputType is 'variable'
32
32
  for (const port of inputPorts) {
33
- if (port.isVariable) {
33
+ if (port.inputType === 'variable') {
34
34
  inputs.push({
35
35
  id: port.id,
36
36
  type: valueType,
@@ -1,55 +1,16 @@
1
- import { type TriggerCollectionConfig } from './types';
2
- /**
3
- * Days of the week for recurrence scheduling
4
- */
1
+ import { type TriggerCollectionConfig, type MediaItemType } from './types';
5
2
  export type DayOfWeek = 'monday' | 'tuesday' | 'wednesday' | 'thursday' | 'friday' | 'saturday' | 'sunday';
6
- /**
7
- * Recurrence media output port definition
8
- * Each output is a named port with a specific media type and its own selection config
9
- */
10
3
  export interface RecurrenceMediaOutput {
11
- /** Unique ID for this output port (e.g., "background-image", "overlay") */
12
4
  id: string;
13
- /** Media type for this port */
14
- type: 'image' | 'video' | 'audio' | 'text' | 'social_audio';
15
- /** Selection mode for this output's media source */
5
+ type: MediaItemType;
16
6
  selectionMode: 'specific' | 'by-tag';
17
- /** Media IDs for this output (used when selectionMode is 'specific') */
18
7
  selectedMediaIds?: string[];
19
- /** Tag to query media by at runtime (used when selectionMode is 'by-tag') */
20
8
  mediaTag?: string;
21
9
  }
22
- /**
23
- * Media input configuration for recurrence nodes
24
- * Each output has its own selection configuration
25
- */
26
10
  export interface RecurrenceMediaConfig {
27
- /** Whether media input is enabled */
28
11
  enabled: boolean;
29
- /** Named output ports - each has its own selection config */
30
12
  outputs: RecurrenceMediaOutput[];
31
13
  }
32
- /**
33
- * Recurrence node configuration - defines when the automation runs on a schedule
34
- */
35
- export interface RecurrenceNodeConfig {
36
- frequencyType: 'per-day' | 'periodic';
37
- runsPerDay: number;
38
- periodDays: number;
39
- daysOfWeek: DayOfWeek[];
40
- timingType: 'specific' | 'random-window';
41
- specificTimes: string[];
42
- randomWindowStart: string;
43
- randomWindowEnd: string;
44
- timezone: string;
45
- collectionInput?: TriggerCollectionConfig;
46
- mediaInput?: RecurrenceMediaConfig;
47
- }
48
- /**
49
- * Recurrence media enabled type
50
- * Includes all media types that can be output from recurrence nodes
51
- */
52
- export type RecurrenceMediaEnabledType = 'image' | 'video' | 'audio' | 'text' | 'social_audio';
53
14
  declare const definition: import("./types").NodeDefinition<"trigger", {
54
15
  frequencyType: "per-day" | "periodic";
55
16
  runsPerDay: number;
@@ -64,6 +25,6 @@ declare const definition: import("./types").NodeDefinition<"trigger", {
64
25
  mediaInput: RecurrenceMediaConfig | undefined;
65
26
  outputMode: null;
66
27
  selectionMode: null;
67
- }>;
28
+ }, false>;
68
29
  export default definition;
69
- export type RecurrenceConfig = typeof definition.defaults;
30
+ export type RecurrenceNodeConfig = typeof definition.defaults;
@@ -26,7 +26,7 @@ const definition = (0, types_1.defineNode)({
26
26
  },
27
27
  computePorts: ({ config }) => {
28
28
  const collectionInputEnabled = config?.collectionInput?.enabled;
29
- const mediaOutputs = (config?.mediaInput?.outputs ?? []);
29
+ const mediaOutputs = config?.mediaInput?.outputs ?? [];
30
30
  const outputs = [];
31
31
  // Add account output if collection input is enabled
32
32
  if (collectionInputEnabled) {
@@ -1,25 +1,9 @@
1
- /**
2
- * Save To Media node input definition
3
- */
1
+ type SaveToMediaType = 'image' | 'video' | 'audio' | 'text';
4
2
  export interface SaveToMediaInput {
5
3
  id: string;
6
- type: 'image' | 'video' | 'audio' | 'text';
7
- /** Optional individual tag for this input (overrides global tag) */
4
+ type: SaveToMediaType;
8
5
  tag?: string;
9
6
  }
10
- /**
11
- * Save To Media node configuration - saves outputs to media library
12
- */
13
- export interface SaveToMediaNodeConfig {
14
- /** Dynamic inputs to save */
15
- inputs: SaveToMediaInput[];
16
- /** Global tag applied to all saved items */
17
- globalTag?: string;
18
- /** If true, append date in mm-dd-yy format to tag */
19
- includeDateTag?: boolean;
20
- /** If true, append run ID to make tags unique */
21
- makeUnique?: boolean;
22
- }
23
7
  declare const definition: import("./types").NodeDefinition<"terminal", {
24
8
  inputs: SaveToMediaInput[];
25
9
  globalTag: string | undefined;
@@ -27,6 +11,6 @@ declare const definition: import("./types").NodeDefinition<"terminal", {
27
11
  makeUnique: boolean;
28
12
  outputMode: null;
29
13
  selectionMode: null;
30
- }>;
14
+ }, false>;
31
15
  export default definition;
32
- export type SaveToMediaConfig = typeof definition.defaults;
16
+ export type SaveToMediaNodeConfig = typeof definition.defaults;
@@ -18,7 +18,7 @@ const definition = (0, types_1.defineNode)({
18
18
  selectionMode: null,
19
19
  },
20
20
  computePorts: ({ config }) => {
21
- const configInputs = (config?.inputs ?? []);
21
+ const configInputs = config?.inputs ?? [];
22
22
  const inputs = configInputs.map(input => ({
23
23
  id: input.id,
24
24
  type: input.type,
@@ -2,6 +2,6 @@ declare const definition: import("./types").NodeDefinition<"generator", {
2
2
  holdDurationMs: number;
3
3
  outputMode: "per-input";
4
4
  selectionMode: null;
5
- }>;
5
+ }, false>;
6
6
  export default definition;
7
- export type ScreenshotAnimationConfig = typeof definition.defaults;
7
+ export type ScreenshotAnimationNodeConfig = typeof definition.defaults;
@@ -3,6 +3,6 @@ declare const definition: import("./types").NodeDefinition<"source", {
3
3
  selectedMediaIds: string[];
4
4
  selectionMode: "random";
5
5
  outputMode: "per-input";
6
- }>;
6
+ }, false>;
7
7
  export default definition;
8
- export type SocialAudioConfig = typeof definition.defaults;
8
+ export type SocialAudioNodeConfig = typeof definition.defaults;
@@ -2,6 +2,6 @@ declare const definition: import("./types").NodeDefinition<"source", {
2
2
  textOptions: string[];
3
3
  selectionMode: "random";
4
4
  outputMode: "per-input";
5
- }>;
5
+ }, false>;
6
6
  export default definition;
7
- export type TextConfig = typeof definition.defaults;
7
+ export type TextNodeConfig = typeof definition.defaults;
@@ -1,6 +1,6 @@
1
1
  declare const definition: import("./types").NodeDefinition<"generator", {
2
2
  outputMode: "per-input";
3
3
  selectionMode: null;
4
- }>;
4
+ }, false>;
5
5
  export default definition;
6
- export type TranscriptConfig = typeof definition.defaults;
6
+ export type TranscriptNodeConfig = typeof definition.defaults;
@@ -5,11 +5,21 @@
5
5
  * Each node file imports from here and defines its behavior.
6
6
  */
7
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
+ };
8
14
  export type NodeCategory = 'trigger' | 'source' | 'generator' | 'terminal';
9
15
  export type OutputMode = 'per-input' | 'single';
10
16
  export type SelectionMode = 'random' | 'sequential';
11
17
  export type ExhaustionBehavior = 'restart' | 'error';
12
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';
13
23
  type PrimitiveType = 'string' | 'number' | 'boolean';
14
24
  /**
15
25
  * Generic type for object schema fields with compile-time depth enforcement.
@@ -52,15 +62,6 @@ export type SchemaField<CanNestObjects extends boolean = true> = {
52
62
  export type ObjectSchemaField = SchemaField<true>;
53
63
  /** Nested schema field (inside objectSchema) - arrays can only contain primitives */
54
64
  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
65
  export interface SelectionConfig {
65
66
  mode?: SelectionMode;
66
67
  enforceUniqueness?: boolean;
@@ -126,26 +127,44 @@ type OutputModesForCategory<T extends NodeCategory> = T extends 'source' | 'gene
126
127
  * Computes the selectionModes array type based on node category.
127
128
  */
128
129
  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
+ /**
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> {
130
143
  nodeId: string;
131
144
  label: string;
132
145
  description: string;
133
146
  type: T;
134
147
  category: string;
148
+ /** If true, this node is internal and not user-creatable */
149
+ isInternal: TInternal;
135
150
  outputModes: OutputModesForCategory<T>;
136
151
  selectionModes: SelectionModesForCategory<T>;
137
152
  defaults: DefaultsForCategory<T, TDefaults>;
138
153
  computePorts: (params: {
139
154
  config: DefaultsForCategory<T, TDefaults>;
155
+ client?: AutomationsClient;
140
156
  getConnectedOutput?: (inputId: string) => {
141
157
  type: BasePortType | BasePortType[];
142
158
  isArray: boolean;
143
159
  objectSchema?: ObjectSchemaField[];
144
160
  } | null;
145
- }) => {
146
- inputs: NodePort[];
147
- outputs: NodePort[];
148
- };
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;
149
168
  }
150
169
  /**
151
170
  * Define a node with full type inference.
@@ -154,25 +173,30 @@ export interface NodeDefinition<T extends NodeCategory = NodeCategory, TDefaults
154
173
  * - Custom defaults are merged and available in computePorts
155
174
  * - No manual type assertions needed
156
175
  */
157
- export declare function defineNode<T extends NodeCategory, TCustomDefaults extends Record<string, unknown>>(def: {
176
+ export declare function defineNode<T extends NodeCategory, TCustomDefaults extends Record<string, unknown>, TInternal extends boolean = false>(def: {
158
177
  nodeId: string;
159
178
  label: string;
160
179
  description: string;
161
180
  type: T;
162
181
  category: string;
182
+ /** If true, this node is internal and not user-creatable */
183
+ isInternal?: TInternal;
163
184
  outputModes: OutputModesForCategory<T>;
164
185
  selectionModes: SelectionModesForCategory<T>;
165
186
  defaults: DefaultsForCategory<T, TCustomDefaults>;
166
187
  computePorts: (params: {
167
188
  config: DefaultsForCategory<T, TCustomDefaults>;
189
+ client?: AutomationsClient;
168
190
  getConnectedOutput?: (inputId: string) => {
169
191
  type: BasePortType | BasePortType[];
170
192
  isArray: boolean;
171
193
  objectSchema?: ObjectSchemaField[];
172
194
  } | null;
173
- }) => {
174
- inputs: NodePort[];
175
- outputs: NodePort[];
176
- };
177
- }): NodeDefinition<T, TCustomDefaults>;
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>;
178
202
  export {};
@@ -18,5 +18,5 @@ exports.defineNode = defineNode;
18
18
  * - No manual type assertions needed
19
19
  */
20
20
  function defineNode(def) {
21
- return def;
21
+ return { ...def, isInternal: (def.isInternal ?? false) };
22
22
  }
@@ -1,4 +1,3 @@
1
- import type { VideoEditorNodeConfig } from '../../render/types';
2
1
  declare const definition: import("./types").NodeDefinition<"generator", {
3
2
  videoEditor: {
4
3
  width: number;
@@ -13,13 +12,6 @@ declare const definition: import("./types").NodeDefinition<"generator", {
13
12
  };
14
13
  outputMode: "per-input";
15
14
  selectionMode: null;
16
- }>;
15
+ }, false>;
17
16
  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
- }
17
+ export type VideoComposerNodeConfig = typeof definition.defaults;