ugcinc 4.1.95 → 4.1.96

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.
@@ -331,6 +331,7 @@ export declare function getPortErrorsForNode({ nodeId, errors, }: {
331
331
  }>;
332
332
  /**
333
333
  * Check if there's a missing trigger error
334
+ * @deprecated Trigger validation has been removed - automations no longer require trigger nodes
334
335
  */
335
336
  export declare function hasMissingTriggerError({ errors }: {
336
337
  errors: ValidationError[];
@@ -731,7 +731,6 @@ function checkCrossContextViolation({ sourceNodeId, targetNodeId, nodes, }) {
731
731
  // ===========================================================================
732
732
  // Workflow Validation
733
733
  // ===========================================================================
734
- const TRIGGER_TYPES = ['manual-trigger', 'recurrence'];
735
734
  const TERMINAL_TYPES = ['passthrough', 'auto-post', 'save-to-media'];
736
735
  /**
737
736
  * Validate workflow and return structured errors for UI highlighting
@@ -739,15 +738,7 @@ const TERMINAL_TYPES = ['passthrough', 'auto-post', 'save-to-media'];
739
738
  function validateWorkflow({ nodes, }) {
740
739
  const errors = [];
741
740
  const connections = deriveConnectionsInternal(nodes);
742
- // 1. Check for trigger node
743
- const hasTrigger = nodes.some(n => TRIGGER_TYPES.includes(n.type));
744
- if (!hasTrigger) {
745
- errors.push({
746
- type: 'missing_trigger',
747
- message: 'Automation requires a trigger node (Manual Trigger or Recurrence)',
748
- });
749
- }
750
- // 2. Check for terminal node
741
+ // 1. Check for terminal node
751
742
  const hasTerminal = nodes.some(n => TERMINAL_TYPES.includes(n.type));
752
743
  if (!hasTerminal) {
753
744
  errors.push({
@@ -1024,8 +1015,10 @@ function getPortErrorsForNode({ nodeId, errors, }) {
1024
1015
  }
1025
1016
  /**
1026
1017
  * Check if there's a missing trigger error
1018
+ * @deprecated Trigger validation has been removed - automations no longer require trigger nodes
1027
1019
  */
1028
1020
  function hasMissingTriggerError({ errors }) {
1021
+ // Trigger validation removed - kept for backward compatibility
1029
1022
  return errors.some(e => e.type === 'missing_trigger');
1030
1023
  }
1031
1024
  /**
@@ -328,6 +328,14 @@ export declare const nodeDefinitions: {
328
328
  __TInputs: import("./transcript").TranscriptNodeInputs;
329
329
  __TOutputs: import("./transcript").TranscriptNodeOutputs;
330
330
  };
331
+ readonly variable: NodeDefinition<"variable", "source", {
332
+ outputs: import("../types").NodePort[];
333
+ outputMode: import("./types").OutputMode | null;
334
+ selectionMode: import("./types").SelectionMode | null;
335
+ }, import("./variable").VariableNodeInputs, import("./variable").VariableNodeOutputs, false> & {
336
+ __TInputs: import("./variable").VariableNodeInputs;
337
+ __TOutputs: import("./variable").VariableNodeOutputs;
338
+ };
331
339
  readonly 'video-composer': NodeDefinition<"video-composer", "generator", {
332
340
  videoEditor: {
333
341
  width: number;
@@ -39,6 +39,7 @@ const screenshot_animation_1 = __importDefault(require("./screenshot-animation")
39
39
  const social_audio_1 = __importDefault(require("./social-audio"));
40
40
  const text_1 = __importDefault(require("./text"));
41
41
  const transcript_1 = __importDefault(require("./transcript"));
42
+ const variable_1 = __importDefault(require("./variable"));
42
43
  const video_composer_1 = __importDefault(require("./video-composer"));
43
44
  const video_import_1 = __importDefault(require("./video-import"));
44
45
  // =============================================================================
@@ -77,6 +78,7 @@ exports.nodeDefinitions = {
77
78
  'social-audio': social_audio_1.default,
78
79
  'text': text_1.default,
79
80
  'transcript': transcript_1.default,
81
+ 'variable': variable_1.default,
80
82
  'video-composer': video_composer_1.default,
81
83
  'video-import': video_import_1.default,
82
84
  };
@@ -1,11 +1,11 @@
1
- import type { NodePort, PortValue } from '../types';
1
+ import type { NodePort, PortValue, DayOfWeek } from '../types';
2
2
  import { type TriggerCollectionConfig, type MediaItemType, type OutputMode, type SelectionMode } from './types';
3
3
  /** Recurrence node has no inputs (trigger node) */
4
4
  export interface RecurrenceNodeInputs {
5
5
  }
6
6
  /** Recurrence outputs are dynamic based on config. Output port IDs are user-defined. */
7
7
  export type RecurrenceNodeOutputs = Record<string, PortValue | PortValue[]>;
8
- export type DayOfWeek = 'monday' | 'tuesday' | 'wednesday' | 'thursday' | 'friday' | 'saturday' | 'sunday';
8
+ export type { DayOfWeek } from '../types';
9
9
  export interface RecurrenceMediaOutput extends NodePort {
10
10
  type: MediaItemType;
11
11
  selectionMode: 'specific' | 'by-tag';
@@ -0,0 +1,18 @@
1
+ import type { NodePort, PortValue } from '../types';
2
+ import { type OutputMode, type SelectionMode } from './types';
3
+ /** Variable node has no inputs (source node) */
4
+ export interface VariableNodeInputs {
5
+ }
6
+ /** Variable outputs are dynamic based on config. Output port IDs are user-defined. */
7
+ export type VariableNodeOutputs = Record<string, PortValue | PortValue[]>;
8
+ declare const definition: import("./types").NodeDefinition<"variable", "source", {
9
+ outputs: NodePort[];
10
+ outputMode: OutputMode | null;
11
+ selectionMode: SelectionMode | null;
12
+ }, VariableNodeInputs, VariableNodeOutputs, false>;
13
+ declare const _default: typeof definition & {
14
+ __TInputs: VariableNodeInputs;
15
+ __TOutputs: VariableNodeOutputs;
16
+ };
17
+ export default _default;
18
+ export type VariableNodeConfig = typeof definition.defaults;
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const types_1 = require("./types");
4
+ // =============================================================================
5
+ // Node Definition
6
+ // =============================================================================
7
+ const definition = (0, types_1.defineNode)({
8
+ nodeId: 'variable',
9
+ label: 'Variable',
10
+ description: 'Define runtime input variables',
11
+ type: 'source',
12
+ category: 'Sources',
13
+ outputModes: ['single', 'per-input'],
14
+ selectionModes: ['random', 'sequential'],
15
+ defaults: {
16
+ outputs: [{ id: 'input-1', type: 'image', isArray: false, required: true }],
17
+ outputMode: 'single',
18
+ selectionMode: 'random',
19
+ },
20
+ computePorts: ({ config }) => {
21
+ return {
22
+ inputs: [],
23
+ outputs: config?.outputs ?? [],
24
+ };
25
+ },
26
+ generatePreview: (config, _ctx) => {
27
+ // Variable outputs are provided at runtime, no preview available
28
+ const result = {};
29
+ for (const output of config.outputs) {
30
+ result[output.id] = null;
31
+ }
32
+ return (0, types_1.preview)(result);
33
+ },
34
+ validate: (config) => {
35
+ const errors = [];
36
+ const outputs = config.outputs;
37
+ if (!outputs?.length) {
38
+ errors.push('Variable node requires at least one output to be configured');
39
+ }
40
+ else {
41
+ const validTypes = ['image', 'video', 'audio', 'text', 'social_audio', 'account', 'boolean', 'object'];
42
+ for (const output of outputs) {
43
+ if (!output.id) {
44
+ errors.push('Variable output requires an id');
45
+ }
46
+ const outputType = Array.isArray(output.type) ? output.type.join(' | ') : output.type;
47
+ if (!output.type || !validTypes.includes(outputType)) {
48
+ errors.push(`Invalid Variable output type: ${outputType}`);
49
+ }
50
+ }
51
+ }
52
+ return errors;
53
+ },
54
+ });
55
+ exports.default = definition;
@@ -353,6 +353,31 @@ type InternalTemplateNode = {
353
353
  * Discriminated union enabling automatic type narrowing based on node type.
354
354
  */
355
355
  export type TemplateNode = UserCreatableTemplateNode | InternalTemplateNode;
356
+ export type DayOfWeek = 'monday' | 'tuesday' | 'wednesday' | 'thursday' | 'friday' | 'saturday' | 'sunday';
357
+ /**
358
+ * Schedule configuration for automated runs (stored on template, not recurrence node)
359
+ */
360
+ export interface ScheduleConfig {
361
+ frequencyType: 'per-day' | 'periodic';
362
+ runsPerDay?: number;
363
+ periodDays?: number;
364
+ daysOfWeek?: DayOfWeek[];
365
+ timingType: 'specific' | 'random-window';
366
+ specificTimes?: string[];
367
+ randomWindowStart?: string;
368
+ randomWindowEnd?: string;
369
+ timezone: string;
370
+ }
371
+ /**
372
+ * Account iteration configuration for scheduled runs
373
+ */
374
+ export interface AccountIterationConfig {
375
+ enabled: boolean;
376
+ selectionMode: 'specific' | 'by-tag';
377
+ accountIds?: string[];
378
+ accountTag?: string;
379
+ iterationMode: 'sequential' | 'random';
380
+ }
356
381
  export interface AutomationTemplate {
357
382
  id: string;
358
383
  org_id: string;
@@ -365,6 +390,8 @@ export interface AutomationTemplate {
365
390
  recurrence_enabled: boolean;
366
391
  next_run_at: string | null;
367
392
  last_run_at: string | null;
393
+ schedule_config: ScheduleConfig | null;
394
+ account_iteration_config: AccountIterationConfig | null;
368
395
  created_at: string;
369
396
  updated_at: string;
370
397
  }
package/dist/index.d.ts CHANGED
@@ -56,12 +56,14 @@ export { IfLogicOperators, applyLogicOperator } from './automations/nodes/if';
56
56
  export type { LLMNodeConfig, LLMNodeOutputs, LLMProvider, LLMApiKeys, } from './automations/nodes/llm';
57
57
  export { LLMProviders, outputFieldToZod, outputFieldsToZod } from './automations/nodes/llm';
58
58
  export type { ManualTriggerNodeConfig, ManualTriggerNodeOutputs } from './automations/nodes/manual-trigger';
59
+ export type { VariableNodeConfig, VariableNodeOutputs } from './automations/nodes/variable';
59
60
  export type { MediaNodeConfig, MediaNodeOutput } from './automations/nodes/media';
60
61
  export type { NotNodeConfig } from './automations/nodes/not';
61
62
  export type { OutputNodeConfig, OutputNodeOutputs } from './automations/nodes/output';
62
63
  export type { RandomNodeConfig, RandomInputPort, RandomNodeMode, RandomNodeOutputs } from './automations/nodes/random';
63
64
  export type { RandomRouteNodeConfig, RandomRouteBranch, RandomRoutePassthroughInput, } from './automations/nodes/random-route';
64
- export type { RecurrenceNodeConfig, DayOfWeek, RecurrenceMediaOutput, RecurrenceMediaConfig, RecurrenceNodeOutputs, } from './automations/nodes/recurrence';
65
+ export type { RecurrenceNodeConfig, RecurrenceMediaOutput, RecurrenceMediaConfig, RecurrenceNodeOutputs, } from './automations/nodes/recurrence';
66
+ export type { DayOfWeek, ScheduleConfig, AccountIterationConfig, } from './automations/types';
65
67
  export type { SaveToMediaNodeConfig, SaveToMediaInput, SaveToMediaType } from './automations/nodes/save-to-media';
66
68
  export { formatDateTag } from './automations/nodes/save-to-media';
67
69
  export type { ScreenshotAnimationNodeConfig } from './automations/nodes/screenshot-animation';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ugcinc",
3
- "version": "4.1.95",
3
+ "version": "4.1.96",
4
4
  "description": "TypeScript/JavaScript client for the UGC Inc API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",