ugcinc 4.5.50 → 4.5.51
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/package.json
CHANGED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { NodePort, PortValue, DayOfWeek } from '../types';
|
|
2
|
-
import { type TriggerCollectionConfig, type MediaItemType, type OutputMode, type SelectionMode } from './types';
|
|
3
|
-
/** Recurrence node has no inputs (trigger node) */
|
|
4
|
-
export interface RecurrenceNodeInputs {
|
|
5
|
-
}
|
|
6
|
-
/** Recurrence outputs are dynamic based on config. Output port IDs are user-defined. */
|
|
7
|
-
export type RecurrenceNodeOutputs = Record<string, PortValue | PortValue[]>;
|
|
8
|
-
export type { DayOfWeek } from '../types';
|
|
9
|
-
export interface RecurrenceMediaOutput extends NodePort {
|
|
10
|
-
type: MediaItemType;
|
|
11
|
-
selectionMode: 'specific' | 'by-tag';
|
|
12
|
-
selectedMediaIds?: string[];
|
|
13
|
-
mediaTag?: string;
|
|
14
|
-
}
|
|
15
|
-
export interface RecurrenceMediaConfig {
|
|
16
|
-
enabled: boolean;
|
|
17
|
-
outputs: RecurrenceMediaOutput[];
|
|
18
|
-
}
|
|
19
|
-
declare const definition: import("./types").NodeDefinition<"recurrence", "trigger", {
|
|
20
|
-
frequencyType: "per-day" | "periodic";
|
|
21
|
-
runsPerDay: number;
|
|
22
|
-
periodDays: number;
|
|
23
|
-
daysOfWeek: DayOfWeek[];
|
|
24
|
-
timingType: "specific" | "random-window";
|
|
25
|
-
specificTimes: string[];
|
|
26
|
-
randomWindowStart: string;
|
|
27
|
-
randomWindowEnd: string;
|
|
28
|
-
timezone: string;
|
|
29
|
-
collectionInput: TriggerCollectionConfig | undefined;
|
|
30
|
-
mediaInput: RecurrenceMediaConfig | undefined;
|
|
31
|
-
outputMode: OutputMode | null;
|
|
32
|
-
selectionMode: SelectionMode | null;
|
|
33
|
-
}, RecurrenceNodeInputs, RecurrenceNodeOutputs, false>;
|
|
34
|
-
declare const _default: typeof definition & {
|
|
35
|
-
__TInputs: RecurrenceNodeInputs;
|
|
36
|
-
__TOutputs: RecurrenceNodeOutputs;
|
|
37
|
-
};
|
|
38
|
-
export default _default;
|
|
39
|
-
export type RecurrenceNodeConfig = typeof definition.defaults;
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const types_1 = require("./types");
|
|
4
|
-
const selection_1 = require("../selection");
|
|
5
|
-
// =============================================================================
|
|
6
|
-
// Node Definition
|
|
7
|
-
// =============================================================================
|
|
8
|
-
const definition = (0, types_1.defineNode)({
|
|
9
|
-
nodeId: 'recurrence',
|
|
10
|
-
label: 'Recurring',
|
|
11
|
-
description: 'Run continuously',
|
|
12
|
-
guide: 'Triggers the workflow on a schedule (daily, periodic, specific days/times). Use for always-on automations that run without manual or API triggers. Use cases: daily content posting, weekly digests, recurring reposts. Supports account iteration (fan-out per account) and media outputs. Configure timezone and random time windows for natural posting times. This is the main trigger for scheduled automations.',
|
|
13
|
-
type: 'trigger',
|
|
14
|
-
category: 'Triggers',
|
|
15
|
-
hidden: true,
|
|
16
|
-
outputModes: null,
|
|
17
|
-
selectionModes: null,
|
|
18
|
-
defaults: {
|
|
19
|
-
frequencyType: 'per-day',
|
|
20
|
-
runsPerDay: 1,
|
|
21
|
-
periodDays: 7,
|
|
22
|
-
daysOfWeek: ['monday', 'tuesday', 'wednesday', 'thursday', 'friday'],
|
|
23
|
-
timingType: 'random-window',
|
|
24
|
-
specificTimes: ['09:00'],
|
|
25
|
-
randomWindowStart: '09:00',
|
|
26
|
-
randomWindowEnd: '17:00',
|
|
27
|
-
timezone: 'America/New_York',
|
|
28
|
-
collectionInput: undefined,
|
|
29
|
-
mediaInput: undefined,
|
|
30
|
-
outputMode: null,
|
|
31
|
-
selectionMode: null,
|
|
32
|
-
},
|
|
33
|
-
computePorts: ({ config }) => {
|
|
34
|
-
const collectionInputEnabled = config?.collectionInput?.enabled;
|
|
35
|
-
const mediaOutputs = config?.mediaInput?.outputs ?? [];
|
|
36
|
-
const outputs = [];
|
|
37
|
-
// Add account output if collection input is enabled
|
|
38
|
-
if (collectionInputEnabled) {
|
|
39
|
-
outputs.push({ id: 'account', type: 'account', isArray: false, required: true });
|
|
40
|
-
}
|
|
41
|
-
// Add media outputs
|
|
42
|
-
for (const output of mediaOutputs) {
|
|
43
|
-
outputs.push({
|
|
44
|
-
id: output.id,
|
|
45
|
-
type: output.type,
|
|
46
|
-
isArray: output.isArray,
|
|
47
|
-
required: output.required,
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
return {
|
|
51
|
-
inputs: [],
|
|
52
|
-
outputs,
|
|
53
|
-
};
|
|
54
|
-
},
|
|
55
|
-
generatePreview: (config, ctx) => {
|
|
56
|
-
const result = {};
|
|
57
|
-
// Account output - just return null (account ID, not displayable)
|
|
58
|
-
if (config.collectionInput?.enabled) {
|
|
59
|
-
result.account = null;
|
|
60
|
-
}
|
|
61
|
-
// Media outputs - pick from selected media
|
|
62
|
-
const mediaOutputs = config.mediaInput?.outputs ?? [];
|
|
63
|
-
for (const output of mediaOutputs) {
|
|
64
|
-
if (output.selectionMode === 'specific' && output.selectedMediaIds?.length) {
|
|
65
|
-
// Build URL pool from selected media
|
|
66
|
-
const urlPool = [];
|
|
67
|
-
for (const mediaId of output.selectedMediaIds) {
|
|
68
|
-
const file = ctx.media.find(m => m.id === mediaId);
|
|
69
|
-
if (file) {
|
|
70
|
-
const url = file.media_type === 'social_audio'
|
|
71
|
-
? (file.preview_url ?? file.audio_url)
|
|
72
|
-
: (file.preview_url ?? file.url);
|
|
73
|
-
if (url)
|
|
74
|
-
urlPool.push(url);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
if (urlPool.length > 0) {
|
|
78
|
-
const selected = (0, selection_1.selectFromPool)(urlPool, 'random', ctx.selectionState.consumedCount, `preview-${output.id}`);
|
|
79
|
-
result[output.id] = selected ?? null;
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
result[output.id] = null;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
// by-tag mode - no preview available without runtime query
|
|
87
|
-
result[output.id] = null;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
return (0, types_1.preview)(result);
|
|
91
|
-
},
|
|
92
|
-
});
|
|
93
|
-
exports.default = definition;
|