ugcinc 4.1.30 → 4.1.32

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 (69) hide show
  1. package/dist/automations/nodes/account.d.ts +13 -2
  2. package/dist/automations/nodes/account.js +15 -0
  3. package/dist/automations/nodes/auto-caption.d.ts +15 -3
  4. package/dist/automations/nodes/auto-caption.js +7 -0
  5. package/dist/automations/nodes/auto-post.d.ts +12 -2
  6. package/dist/automations/nodes/auto-post.js +7 -0
  7. package/dist/automations/nodes/branch.d.ts +18 -6
  8. package/dist/automations/nodes/branch.js +26 -0
  9. package/dist/automations/nodes/collect.d.ts +17 -3
  10. package/dist/automations/nodes/collect.js +8 -0
  11. package/dist/automations/nodes/compose-workflow.d.ts +13 -4
  12. package/dist/automations/nodes/compose-workflow.js +11 -0
  13. package/dist/automations/nodes/create-dm.d.ts +15 -4
  14. package/dist/automations/nodes/create-dm.js +8 -0
  15. package/dist/automations/nodes/custom-model.d.ts +15 -3
  16. package/dist/automations/nodes/custom-model.js +8 -0
  17. package/dist/automations/nodes/deduplicate.d.ts +15 -3
  18. package/dist/automations/nodes/deduplicate.js +8 -0
  19. package/dist/automations/nodes/destructure.d.ts +13 -4
  20. package/dist/automations/nodes/destructure.js +55 -0
  21. package/dist/automations/nodes/for-each.d.ts +21 -7
  22. package/dist/automations/nodes/for-each.js +23 -0
  23. package/dist/automations/nodes/generate-image.d.ts +17 -3
  24. package/dist/automations/nodes/generate-image.js +7 -0
  25. package/dist/automations/nodes/generate-video.d.ts +17 -3
  26. package/dist/automations/nodes/generate-video.js +7 -0
  27. package/dist/automations/nodes/if.d.ts +19 -4
  28. package/dist/automations/nodes/if.js +16 -0
  29. package/dist/automations/nodes/image-composer.d.ts +15 -3
  30. package/dist/automations/nodes/image-composer.js +8 -0
  31. package/dist/automations/nodes/index.d.ts +171 -55
  32. package/dist/automations/nodes/llm.d.ts +13 -4
  33. package/dist/automations/nodes/llm.js +15 -0
  34. package/dist/automations/nodes/manual-trigger.d.ts +12 -3
  35. package/dist/automations/nodes/manual-trigger.js +11 -0
  36. package/dist/automations/nodes/media.d.ts +12 -2
  37. package/dist/automations/nodes/media.js +53 -0
  38. package/dist/automations/nodes/not.d.ts +15 -3
  39. package/dist/automations/nodes/not.js +7 -0
  40. package/dist/automations/nodes/output.d.ts +12 -3
  41. package/dist/automations/nodes/output.js +7 -0
  42. package/dist/automations/nodes/random-route.d.ts +13 -4
  43. package/dist/automations/nodes/random-route.js +20 -0
  44. package/dist/automations/nodes/random.d.ts +22 -6
  45. package/dist/automations/nodes/random.js +49 -0
  46. package/dist/automations/nodes/recurrence.d.ts +12 -2
  47. package/dist/automations/nodes/recurrence.js +41 -0
  48. package/dist/automations/nodes/save-to-media.d.ts +12 -2
  49. package/dist/automations/nodes/save-to-media.js +7 -0
  50. package/dist/automations/nodes/screenshot-animation.d.ts +15 -3
  51. package/dist/automations/nodes/screenshot-animation.js +8 -0
  52. package/dist/automations/nodes/social-audio.d.ts +14 -4
  53. package/dist/automations/nodes/social-audio.js +13 -2
  54. package/dist/automations/nodes/text.d.ts +12 -2
  55. package/dist/automations/nodes/text.js +12 -0
  56. package/dist/automations/nodes/transcript.d.ts +21 -3
  57. package/dist/automations/nodes/transcript.js +9 -0
  58. package/dist/automations/nodes/types.d.ts +125 -15
  59. package/dist/automations/nodes/types.js +56 -2
  60. package/dist/automations/nodes/video-composer.d.ts +15 -3
  61. package/dist/automations/nodes/video-composer.js +8 -0
  62. package/dist/automations/nodes/video-import.d.ts +13 -2
  63. package/dist/automations/nodes/video-import.js +8 -0
  64. package/dist/automations/types.d.ts +88 -0
  65. package/dist/graph-controller.d.ts +145 -5
  66. package/dist/graph-controller.js +318 -11
  67. package/dist/index.d.ts +6 -5
  68. package/dist/index.js +16 -3
  69. package/package.json +1 -1
@@ -1,8 +1,19 @@
1
+ import type { AccountData } from '../types';
1
2
  import { type SelectionMode, type OutputMode } from './types';
3
+ /** Account node has no inputs (source node) */
4
+ export interface AccountNodeInputs {
5
+ }
6
+ export interface AccountNodeOutputs {
7
+ account: AccountData;
8
+ }
2
9
  declare const definition: import("./types").NodeDefinition<"source", {
3
10
  accountIds: string[];
4
11
  outputMode: OutputMode;
5
12
  selectionMode: SelectionMode;
6
- }, false>;
7
- export default definition;
13
+ }, AccountNodeInputs, AccountNodeOutputs, false>;
14
+ declare const _default: typeof definition & {
15
+ __TInputs: AccountNodeInputs;
16
+ __TOutputs: AccountNodeOutputs;
17
+ };
18
+ export default _default;
8
19
  export type AccountNodeConfig = typeof definition.defaults;
@@ -1,6 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const types_1 = require("./types");
4
+ const selection_1 = require("../selection");
5
+ // =============================================================================
6
+ // Node Definition
7
+ // =============================================================================
4
8
  const definition = (0, types_1.defineNode)({
5
9
  nodeId: 'account',
6
10
  label: 'Account',
@@ -25,5 +29,16 @@ const definition = (0, types_1.defineNode)({
25
29
  },
26
30
  ],
27
31
  }),
32
+ generatePreview: (config, ctx) => {
33
+ const pool = config.accountIds;
34
+ if (pool.length === 0)
35
+ return (0, types_1.preview)({ account: null });
36
+ // For single mode, always return first; for per-input, use selection
37
+ const index = config.outputMode === 'single' ? 0 : ctx.selectionState.consumedCount;
38
+ const selectedId = (0, selection_1.selectFromPool)(pool, config.selectionMode, index, 'preview');
39
+ // Look up full AccountData from context
40
+ const account = selectedId ? ctx.accounts.find(a => a.id === selectedId) ?? null : null;
41
+ return (0, types_1.preview)({ account });
42
+ },
28
43
  });
29
44
  exports.default = definition;
@@ -1,3 +1,11 @@
1
+ import type { VideoValue } from '../types';
2
+ import { type OutputMode } from './types';
3
+ export interface AutoCaptionNodeInputs {
4
+ video: VideoValue;
5
+ }
6
+ export interface AutoCaptionNodeOutputs {
7
+ output: VideoValue;
8
+ }
1
9
  export type AutoCaptionPreset = 'hormozi' | 'minimal' | 'bold-pop' | 'clean' | 'neon';
2
10
  export type AutoCaptionFontWeight = 'normal' | 'bold' | 'black';
3
11
  export type AutoCaptionPosition = 'top' | 'center' | 'bottom';
@@ -17,8 +25,12 @@ declare const definition: import("./types").NodeDefinition<"generator", {
17
25
  wordsPerSubtitle: number | undefined;
18
26
  enableAnimation: boolean | undefined;
19
27
  language: string | undefined;
20
- outputMode: "per-input";
28
+ outputMode: OutputMode;
21
29
  selectionMode: null;
22
- }, false>;
23
- export default definition;
30
+ }, AutoCaptionNodeInputs, AutoCaptionNodeOutputs, false>;
31
+ declare const _default: typeof definition & {
32
+ __TInputs: AutoCaptionNodeInputs;
33
+ __TOutputs: AutoCaptionNodeOutputs;
34
+ };
35
+ export default _default;
24
36
  export type AutoCaptionNodeConfig = typeof definition.defaults;
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const types_1 = require("./types");
4
+ // =============================================================================
5
+ // Node Definition
6
+ // =============================================================================
4
7
  const definition = (0, types_1.defineNode)({
5
8
  nodeId: 'auto-caption',
6
9
  label: 'Auto Caption',
@@ -46,5 +49,9 @@ const definition = (0, types_1.defineNode)({
46
49
  },
47
50
  ],
48
51
  }),
52
+ generatePreview: (_config, _ctx, cachedOutputs) => {
53
+ // Generator node - return cached output from last successful run
54
+ return (0, types_1.preview)({ output: cachedOutputs?.output ?? null });
55
+ },
49
56
  });
50
57
  exports.default = definition;
@@ -1,4 +1,10 @@
1
+ import type { PortValue } from '../types';
1
2
  import { type InputType } from './types';
3
+ /** Auto post inputs are dynamic (video or images + account + optional fields). */
4
+ export type AutoPostNodeInputs = Record<string, PortValue | PortValue[]>;
5
+ /** Auto post has no outputs (terminal node). */
6
+ export interface AutoPostNodeOutputs {
7
+ }
2
8
  export type AutoPostMode = 'video' | 'slideshow';
3
9
  export type PostSchedulingMode = 'scheduled' | 'queue';
4
10
  declare const definition: import("./types").NodeDefinition<"terminal", {
@@ -18,6 +24,10 @@ declare const definition: import("./types").NodeDefinition<"terminal", {
18
24
  requireApproval: boolean;
19
25
  outputMode: null;
20
26
  selectionMode: null;
21
- }, false>;
22
- export default definition;
27
+ }, AutoPostNodeInputs, AutoPostNodeOutputs, false>;
28
+ declare const _default: typeof definition & {
29
+ __TInputs: AutoPostNodeInputs;
30
+ __TOutputs: AutoPostNodeOutputs;
31
+ };
32
+ export default _default;
23
33
  export type AutoPostNodeConfig = typeof definition.defaults;
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const types_1 = require("./types");
4
+ // =============================================================================
5
+ // Node Definition
6
+ // =============================================================================
4
7
  const definition = (0, types_1.defineNode)({
5
8
  nodeId: 'auto-post',
6
9
  label: 'Auto Post',
@@ -49,5 +52,9 @@ const definition = (0, types_1.defineNode)({
49
52
  }
50
53
  return { inputs, outputs: [] };
51
54
  },
55
+ generatePreview: (_config, _ctx) => {
56
+ // Terminal node - no outputs
57
+ return (0, types_1.preview)({});
58
+ },
52
59
  });
53
60
  exports.default = definition;
@@ -1,4 +1,14 @@
1
- import { type ObjectSchemaField, type InputType } from './types';
1
+ import type { PortValue } from '../types';
2
+ import { type ObjectSchemaField, type InputType, type OutputMode } from './types';
3
+ /**
4
+ * Branch node inputs: required key input + dynamic branch-specific inputs.
5
+ * Input port IDs are user-defined (except 'key').
6
+ */
7
+ export type BranchNodeInputs = Record<string, PortValue | PortValue[]>;
8
+ /**
9
+ * Branch node outputs: passthrough outputs with user-defined IDs.
10
+ */
11
+ export type BranchNodeOutputs = Record<string, PortValue | PortValue[]>;
2
12
  export interface BranchDefinition {
3
13
  key: string;
4
14
  }
@@ -14,14 +24,16 @@ export interface BranchPassthroughInput {
14
24
  branchValues?: Record<string, BranchValueConfig>;
15
25
  objectSchema?: ObjectSchemaField[];
16
26
  }
17
- /** @deprecated Use BranchPassthroughInput instead */
18
- export type PassthroughInput = BranchPassthroughInput;
19
27
  declare const definition: import("./types").NodeDefinition<"generator", {
20
28
  branches: BranchDefinition[];
21
29
  passthroughInputs: BranchPassthroughInput[];
22
30
  defaultBranchKey: string;
23
- outputMode: "per-input";
31
+ outputMode: OutputMode;
24
32
  selectionMode: null;
25
- }, false>;
26
- export default definition;
33
+ }, BranchNodeInputs, BranchNodeOutputs, false>;
34
+ declare const _default: typeof definition & {
35
+ __TInputs: BranchNodeInputs;
36
+ __TOutputs: BranchNodeOutputs;
37
+ };
38
+ export default _default;
27
39
  export type BranchNodeConfig = typeof definition.defaults;
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const types_1 = require("./types");
4
+ // =============================================================================
5
+ // Node Definition
6
+ // =============================================================================
4
7
  const definition = (0, types_1.defineNode)({
5
8
  nodeId: 'branch',
6
9
  label: 'Branch',
@@ -64,5 +67,28 @@ const definition = (0, types_1.defineNode)({
64
67
  }
65
68
  return { inputs, outputs };
66
69
  },
70
+ generatePreview: (config, ctx) => {
71
+ const result = {};
72
+ // For routing nodes, show preview for all passthrough outputs
73
+ // Each output gets the preview from its corresponding variable input (if any)
74
+ // or falls back to showing the first available branch value
75
+ for (const passthrough of config.passthroughInputs) {
76
+ // Check each branch for a variable input
77
+ let previewValue = null;
78
+ for (const branch of config.branches) {
79
+ const branchValue = passthrough.branchValues?.[branch.key];
80
+ if (branchValue?.inputType === 'variable') {
81
+ const inputPortId = `${branch.key}-${passthrough.id}`;
82
+ const inputPreview = ctx.inputPreviews[inputPortId];
83
+ if (inputPreview) {
84
+ previewValue = inputPreview;
85
+ break; // Use first available
86
+ }
87
+ }
88
+ }
89
+ result[passthrough.id] = previewValue;
90
+ }
91
+ return (0, types_1.preview)(result);
92
+ },
67
93
  });
68
94
  exports.default = definition;
@@ -1,8 +1,22 @@
1
+ import type { ImageValue, VideoValue, AudioValue, TextValue, ObjectValue, BooleanValue, NumberValue } from '../types';
2
+ import { type OutputMode } from './types';
3
+ /** Value type union for collect node (accepts any of these types) */
4
+ export type CollectInputValue = ImageValue | VideoValue | AudioValue | TextValue | ObjectValue | BooleanValue | NumberValue;
5
+ export interface CollectNodeInputs {
6
+ value: CollectInputValue;
7
+ }
8
+ export interface CollectNodeOutputs {
9
+ array: CollectInputValue[];
10
+ }
1
11
  declare const definition: import("./types").NodeDefinition<"generator", {
2
12
  expectedCount: number | undefined;
3
13
  forEachTemplateId: string | undefined;
4
- outputMode: "single";
14
+ outputMode: OutputMode;
5
15
  selectionMode: null;
6
- }, false>;
7
- export default definition;
16
+ }, CollectNodeInputs, CollectNodeOutputs, false>;
17
+ declare const _default: typeof definition & {
18
+ __TInputs: CollectNodeInputs;
19
+ __TOutputs: CollectNodeOutputs;
20
+ };
21
+ export default _default;
8
22
  export type CollectNodeConfig = typeof definition.defaults;
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const types_1 = require("./types");
4
+ // =============================================================================
5
+ // Node Definition
6
+ // =============================================================================
4
7
  const definition = (0, types_1.defineNode)({
5
8
  nodeId: 'collect',
6
9
  label: 'Collect',
@@ -48,5 +51,10 @@ const definition = (0, types_1.defineNode)({
48
51
  ];
49
52
  return { inputs, outputs };
50
53
  },
54
+ generatePreview: (_config, _ctx, cachedOutputs) => {
55
+ return (0, types_1.preview)({
56
+ array: cachedOutputs?.array ?? null,
57
+ });
58
+ },
51
59
  });
52
60
  exports.default = definition;
@@ -1,11 +1,20 @@
1
- import type { ResolvedPorts } from '../types';
1
+ import type { ResolvedPorts, PortValue } from '../types';
2
+ import { type OutputMode } from './types';
3
+ /** Compose workflow inputs are fully dynamic (from resolvedPorts). */
4
+ export type ComposeWorkflowNodeInputs = Record<string, PortValue | PortValue[]>;
5
+ /** Compose workflow outputs are fully dynamic (from resolvedPorts). */
6
+ export type ComposeWorkflowNodeOutputs = Record<string, PortValue | PortValue[]>;
2
7
  declare const definition: import("./types").NodeDefinition<"generator", {
3
8
  workflowTemplateId: string | undefined;
4
9
  workflowName: string | undefined;
5
10
  workflowPreviewOutput: string | undefined;
6
11
  resolvedPorts: ResolvedPorts | undefined;
7
- outputMode: "per-input";
12
+ outputMode: OutputMode;
8
13
  selectionMode: null;
9
- }, false>;
10
- export default definition;
14
+ }, ComposeWorkflowNodeInputs, ComposeWorkflowNodeOutputs, false>;
15
+ declare const _default: typeof definition & {
16
+ __TInputs: ComposeWorkflowNodeInputs;
17
+ __TOutputs: ComposeWorkflowNodeOutputs;
18
+ };
19
+ export default _default;
11
20
  export type ComposeWorkflowNodeConfig = typeof definition.defaults;
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const types_1 = require("./types");
4
+ // =============================================================================
5
+ // Node Definition
6
+ // =============================================================================
4
7
  const definition = (0, types_1.defineNode)({
5
8
  nodeId: 'compose-workflow',
6
9
  label: 'Compose Workflow',
@@ -28,5 +31,13 @@ const definition = (0, types_1.defineNode)({
28
31
  // No cached ports yet - UI will fetch and update
29
32
  return { inputs: [], outputs: [] };
30
33
  },
34
+ generatePreview: (config, _ctx, cachedOutputs) => {
35
+ const result = {};
36
+ const outputs = config.resolvedPorts?.outputs ?? [];
37
+ for (const output of outputs) {
38
+ result[output.id] = cachedOutputs?.[output.id] ?? null;
39
+ }
40
+ return (0, types_1.preview)(result);
41
+ },
31
42
  });
32
43
  exports.default = definition;
@@ -1,4 +1,11 @@
1
- import { type InputType } from './types';
1
+ import type { PortValue, ImageValue } from '../types';
2
+ import { type InputType, type OutputMode } from './types';
3
+ /** Create DM inputs are dynamic (based on inputType settings). */
4
+ export type CreateDmNodeInputs = Record<string, PortValue | PortValue[]>;
5
+ /** Create DM has a fixed 'output' port. */
6
+ export interface CreateDmNodeOutputs {
7
+ output: ImageValue;
8
+ }
2
9
  export type DmPlatform = 'imessage' | 'instagram';
3
10
  export interface CreateDmMessage {
4
11
  sender: 'user' | 'recipient';
@@ -29,8 +36,12 @@ declare const definition: import("./types").NodeDefinition<"generator", {
29
36
  imessageMessageHeaderTimestampText: string;
30
37
  imessageMessageHeaderTimeInputType: InputType;
31
38
  instagramUserHasStory: boolean;
32
- outputMode: "per-input";
39
+ outputMode: OutputMode;
33
40
  selectionMode: null;
34
- }, false>;
35
- export default definition;
41
+ }, CreateDmNodeInputs, CreateDmNodeOutputs, false>;
42
+ declare const _default: typeof definition & {
43
+ __TInputs: CreateDmNodeInputs;
44
+ __TOutputs: CreateDmNodeOutputs;
45
+ };
46
+ export default _default;
36
47
  export type CreateDmNodeConfig = typeof definition.defaults;
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const types_1 = require("./types");
4
+ // =============================================================================
5
+ // Node Definition
6
+ // =============================================================================
4
7
  const definition = (0, types_1.defineNode)({
5
8
  nodeId: 'create-dm',
6
9
  label: 'Create DM',
@@ -82,5 +85,10 @@ const definition = (0, types_1.defineNode)({
82
85
  outputs: [{ id: 'output', type: 'image', isArray: false, required: true }],
83
86
  };
84
87
  },
88
+ generatePreview: (_config, _ctx, cachedOutputs) => {
89
+ return (0, types_1.preview)({
90
+ output: cachedOutputs?.output ?? null,
91
+ });
92
+ },
85
93
  });
86
94
  exports.default = definition;
@@ -1,3 +1,11 @@
1
+ import type { PortValue, ImageValue, VideoValue, AudioValue } from '../types';
2
+ import { type OutputMode } from './types';
3
+ /** Custom model inputs are dynamic (from inputParams). Input port IDs are user-defined. */
4
+ export type CustomModelNodeInputs = Record<string, PortValue | PortValue[]>;
5
+ /** Custom model output depends on outputType config. */
6
+ export interface CustomModelNodeOutputs {
7
+ output: ImageValue | VideoValue | AudioValue;
8
+ }
1
9
  export type CustomModelOutputType = 'image' | 'video' | 'audio';
2
10
  export interface CustomModelInputParam {
3
11
  name: string;
@@ -12,8 +20,12 @@ declare const definition: import("./types").NodeDefinition<"generator", {
12
20
  outputType: CustomModelOutputType;
13
21
  inputParams: CustomModelInputParam[];
14
22
  apiKey: string | undefined;
15
- outputMode: "per-input";
23
+ outputMode: OutputMode;
16
24
  selectionMode: null;
17
- }, false>;
18
- export default definition;
25
+ }, CustomModelNodeInputs, CustomModelNodeOutputs, false>;
26
+ declare const _default: typeof definition & {
27
+ __TInputs: CustomModelNodeInputs;
28
+ __TOutputs: CustomModelNodeOutputs;
29
+ };
30
+ export default _default;
19
31
  export type CustomModelNodeConfig = typeof definition.defaults;
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const types_1 = require("./types");
4
+ // =============================================================================
5
+ // Node Definition
6
+ // =============================================================================
4
7
  const definition = (0, types_1.defineNode)({
5
8
  nodeId: 'custom-model',
6
9
  label: 'Custom Model',
@@ -48,5 +51,10 @@ const definition = (0, types_1.defineNode)({
48
51
  ],
49
52
  };
50
53
  },
54
+ generatePreview: (_config, _ctx, cachedOutputs) => {
55
+ return (0, types_1.preview)({
56
+ output: cachedOutputs?.output ?? null,
57
+ });
58
+ },
51
59
  });
52
60
  exports.default = definition;
@@ -1,8 +1,20 @@
1
+ import type { VideoValue } from '../types';
1
2
  import type { DeduplicationInput } from '../../render/types';
3
+ import { type OutputMode } from './types';
4
+ export interface DeduplicateNodeInputs {
5
+ video: VideoValue;
6
+ }
7
+ export interface DeduplicateNodeOutputs {
8
+ output: VideoValue;
9
+ }
2
10
  declare const definition: import("./types").NodeDefinition<"generator", {
3
11
  deduplication: DeduplicationInput;
4
- outputMode: "per-input";
12
+ outputMode: OutputMode;
5
13
  selectionMode: null;
6
- }, false>;
7
- export default definition;
14
+ }, DeduplicateNodeInputs, DeduplicateNodeOutputs, false>;
15
+ declare const _default: typeof definition & {
16
+ __TInputs: DeduplicateNodeInputs;
17
+ __TOutputs: DeduplicateNodeOutputs;
18
+ };
19
+ export default _default;
8
20
  export type DeduplicateNodeConfig = typeof definition.defaults;
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const types_1 = require("./types");
4
+ // =============================================================================
5
+ // Node Definition
6
+ // =============================================================================
4
7
  const definition = (0, types_1.defineNode)({
5
8
  nodeId: 'deduplicate',
6
9
  label: 'Mass Repost',
@@ -32,5 +35,10 @@ const definition = (0, types_1.defineNode)({
32
35
  },
33
36
  ],
34
37
  }),
38
+ generatePreview: (_config, _ctx, cachedOutputs) => {
39
+ return (0, types_1.preview)({
40
+ output: cachedOutputs?.output ?? null,
41
+ });
42
+ },
35
43
  });
36
44
  exports.default = definition;
@@ -1,4 +1,9 @@
1
- import { type InputType } from './types';
1
+ import type { PortValue } from '../types';
2
+ import { type InputType, type OutputMode } from './types';
3
+ /** Destructure inputs: 'array' + dynamic idx-* inputs for variable selections. */
4
+ export type DestructureNodeInputs = Record<string, PortValue | PortValue[]>;
5
+ /** Destructure outputs are dynamic based on selections config. */
6
+ export type DestructureNodeOutputs = Record<string, PortValue | PortValue[]>;
2
7
  type IndexExpression = {
3
8
  type: 'single';
4
9
  index: number;
@@ -18,10 +23,14 @@ interface DestructureSelection {
18
23
  }
19
24
  declare const definition: import("./types").NodeDefinition<"generator", {
20
25
  selections: DestructureSelection[];
21
- outputMode: "per-input";
26
+ outputMode: OutputMode;
22
27
  selectionMode: null;
23
- }, false>;
24
- export default definition;
28
+ }, DestructureNodeInputs, DestructureNodeOutputs, false>;
29
+ declare const _default: typeof definition & {
30
+ __TInputs: DestructureNodeInputs;
31
+ __TOutputs: DestructureNodeOutputs;
32
+ };
33
+ export default _default;
25
34
  export type { DestructureSelection, IndexExpression };
26
35
  export type DestructureNodeConfig = typeof definition.defaults;
27
36
  /**
@@ -2,6 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.indexExpressionToIndexes = indexExpressionToIndexes;
4
4
  const types_1 = require("./types");
5
+ // =============================================================================
6
+ // Node Definition
7
+ // =============================================================================
5
8
  const definition = (0, types_1.defineNode)({
6
9
  nodeId: 'destructure',
7
10
  label: 'Destructure',
@@ -81,6 +84,58 @@ const definition = (0, types_1.defineNode)({
81
84
  }
82
85
  return { inputs, outputs };
83
86
  },
87
+ generatePreview: (config, ctx, _cachedOutputs) => {
88
+ const result = {};
89
+ const inputArray = ctx.inputPreviews.array;
90
+ // If no input array or not an array, return nulls
91
+ if (!inputArray || !Array.isArray(inputArray)) {
92
+ for (const selection of config.selections) {
93
+ result[selection.portId] = null;
94
+ }
95
+ return (0, types_1.preview)(result);
96
+ }
97
+ for (const selection of config.selections) {
98
+ // Skip variable inputs - we don't know the index at preview time
99
+ if (selection.inputType === 'variable') {
100
+ result[selection.portId] = null;
101
+ continue;
102
+ }
103
+ const indexes = indexExpressionToIndexes(selection.indexExpr);
104
+ if (selection.indexExpr.type === 'single') {
105
+ // Single index - return single value
106
+ const item = inputArray[indexes[0]];
107
+ if (item === undefined) {
108
+ result[selection.portId] = null;
109
+ }
110
+ else if (selection.propertyPath) {
111
+ // TODO: Add discriminator field to value types to enable proper narrowing without casts
112
+ // For now, cast to access property - returns undefined if property doesn't exist
113
+ const value = item[selection.propertyPath];
114
+ result[selection.portId] = value ?? null;
115
+ }
116
+ else {
117
+ result[selection.portId] = item;
118
+ }
119
+ }
120
+ else {
121
+ // Range or list - return array of values
122
+ const values = indexes
123
+ .map(i => {
124
+ const item = inputArray[i];
125
+ if (item === undefined)
126
+ return undefined;
127
+ if (selection.propertyPath) {
128
+ // TODO: Add discriminator field to value types to enable proper narrowing
129
+ return item[selection.propertyPath];
130
+ }
131
+ return item;
132
+ })
133
+ .filter((v) => v !== undefined);
134
+ result[selection.portId] = values.length > 0 ? values : null;
135
+ }
136
+ }
137
+ return (0, types_1.preview)(result);
138
+ },
84
139
  });
85
140
  exports.default = definition;
86
141
  // =============================================================================
@@ -1,11 +1,22 @@
1
- import type { BasePortType } from '../types';
2
- interface ForEachOutputProperty {
1
+ import type { BasePortType, PortValue } from '../types';
2
+ import { type OutputMode } from './types';
3
+ /**
4
+ * For-each node inputs: required array input + dynamic passthrough inputs.
5
+ * Input port IDs are user-defined (except 'array').
6
+ */
7
+ export type ForEachNodeInputs = Record<string, PortValue | PortValue[]>;
8
+ /**
9
+ * For-each node outputs: optional item/index + dynamic property outputs + passthrough outputs.
10
+ * Output port IDs are user-defined based on config.
11
+ */
12
+ export type ForEachNodeOutputs = Record<string, PortValue | PortValue[]>;
13
+ export interface ForEachOutputProperty {
3
14
  portId: string;
4
15
  propertyPath: string;
5
16
  type: BasePortType;
6
17
  isArray: boolean;
7
18
  }
8
- interface ForEachInputPort {
19
+ export interface ForEachInputPort {
9
20
  id: string;
10
21
  type: BasePortType;
11
22
  isArray: boolean;
@@ -15,9 +26,12 @@ declare const definition: import("./types").NodeDefinition<"generator", {
15
26
  inputPorts: ForEachInputPort[];
16
27
  exposeItem: boolean;
17
28
  exposeIndex: boolean;
18
- outputMode: "per-input";
29
+ outputMode: OutputMode;
19
30
  selectionMode: null;
20
- }, false>;
21
- export default definition;
22
- export type { ForEachOutputProperty, ForEachInputPort };
31
+ }, ForEachNodeInputs, ForEachNodeOutputs, false>;
32
+ declare const _default: typeof definition & {
33
+ __TInputs: ForEachNodeInputs;
34
+ __TOutputs: ForEachNodeOutputs;
35
+ };
36
+ export default _default;
23
37
  export type ForEachNodeConfig = typeof definition.defaults;
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const types_1 = require("./types");
4
+ // =============================================================================
5
+ // Node Definition
6
+ // =============================================================================
4
7
  const definition = (0, types_1.defineNode)({
5
8
  nodeId: 'for-each',
6
9
  label: 'For Each',
@@ -80,5 +83,25 @@ const definition = (0, types_1.defineNode)({
80
83
  }
81
84
  return { inputs, outputs };
82
85
  },
86
+ generatePreview: (config, ctx) => {
87
+ const result = {};
88
+ // Item output - pass through the array input preview (shows one item)
89
+ if (config.exposeItem) {
90
+ result.item = ctx.inputPreviews.array ?? null;
91
+ }
92
+ // Index output - not displayable as a preview
93
+ if (config.exposeIndex) {
94
+ result.index = null;
95
+ }
96
+ // Property outputs - would need object parsing, return null for now
97
+ for (const prop of config.outputProperties) {
98
+ result[prop.portId] = null;
99
+ }
100
+ // Passthrough outputs - pass through from inputPreviews
101
+ for (const port of config.inputPorts) {
102
+ result[port.id] = ctx.inputPreviews[port.id] ?? null;
103
+ }
104
+ return (0, types_1.preview)(result);
105
+ },
83
106
  });
84
107
  exports.default = definition;