ugcinc 2.63.1 → 2.63.3

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/index.d.ts CHANGED
@@ -9,7 +9,9 @@ export { TasksClient } from './tasks';
9
9
  export { PostsClient } from './posts';
10
10
  export { StatsClient } from './stats';
11
11
  export { OrganizationClient } from './org';
12
+ export { RenderClient } from './render';
12
13
  export { AutomationsClient, getAllNodes, getNodeByType } from './automations';
13
14
  export { MediaClient } from './media';
15
+ export type { RenderJobResponse, RenderJobStatus, SubmitImageRenderJobParams, SubmitVideoRenderJobParams, RenderVideoEditorConfig, } from './render';
14
16
  export type { ClientConfig, } from './base';
15
17
  export type { SuccessResponse, ErrorResponse, ApiResponse, Account, AccountStat, AccountTask, EditProfileInfo, Task, TaskType, Post, PostType, PostStat, ApiKey, EditorConfig, VideoEditorConfig, ImageEditorNodeConfig, ImageEditorElement, ImageEditorNodeInput, ImageEditorNodeOutput, DimensionPresetKey, EditorChannel, TimeValue, BaseSegmentProps, VisualSegmentProps, EditorSegment, VideoSegment, AudioSegment, ImageSegment, TextSegment, StaticSegment, PositionAnchor, RelativePositionConfig, GetAccountsParams, GetAccountStatsParams, GetAccountStatusParams, UpdateAccountInfoParams, UpdateAccountSocialParams, GetTasksParams, GetPostsParams, CreateSlideshowParams, GetPostStatsParams, GetPostStatusParams, CreateVideoParams, RefreshStatsParams, RefreshStatsResponse, RefreshStatsError, DailyAggregatedStat, GetDailyAggregatedStatsParams, DailyPostStat, GetDailyPostStatsParams, TopAccount, GetTopAccountsParams, TopPost, GetTopPostsParams, MediaType, NodePort, NodeControlConfig, NodeTypeEnum, WorkflowNodeDefinition, WorkflowDefinition, CanvasState, AutomationTemplate, AutomationRun, NodeRun, OutputSchemaProperty, SelectionMode, ExhaustionBehavior, SelectionConfig, SelectionState, OutputMode, OutputInput, OutputNodeConfig, UserMedia, SocialAudio, Media, GetMediaParams, UploadMediaParams, UploadMediaResponse, UpdateMediaTagParams, DeleteMediaParams, DeleteMediaResponse, CreateSocialAudioParams, CreateMediaFromUrlParams, } from './types';
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@
5
5
  * Official TypeScript/JavaScript client for the UGC Inc API
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.MediaClient = exports.getNodeByType = exports.getAllNodes = exports.AutomationsClient = exports.OrganizationClient = exports.StatsClient = exports.PostsClient = exports.TasksClient = exports.AccountsClient = exports.UGCClient = void 0;
8
+ exports.MediaClient = exports.getNodeByType = exports.getAllNodes = exports.AutomationsClient = exports.RenderClient = exports.OrganizationClient = exports.StatsClient = exports.PostsClient = exports.TasksClient = exports.AccountsClient = exports.UGCClient = void 0;
9
9
  var client_1 = require("./client");
10
10
  Object.defineProperty(exports, "UGCClient", { enumerable: true, get: function () { return client_1.UGCClient; } });
11
11
  var accounts_1 = require("./accounts");
@@ -18,7 +18,8 @@ var stats_1 = require("./stats");
18
18
  Object.defineProperty(exports, "StatsClient", { enumerable: true, get: function () { return stats_1.StatsClient; } });
19
19
  var org_1 = require("./org");
20
20
  Object.defineProperty(exports, "OrganizationClient", { enumerable: true, get: function () { return org_1.OrganizationClient; } });
21
- // RenderClient removed - replaced by Remotion rendering
21
+ var render_1 = require("./render");
22
+ Object.defineProperty(exports, "RenderClient", { enumerable: true, get: function () { return render_1.RenderClient; } });
22
23
  var automations_1 = require("./automations");
23
24
  Object.defineProperty(exports, "AutomationsClient", { enumerable: true, get: function () { return automations_1.AutomationsClient; } });
24
25
  Object.defineProperty(exports, "getAllNodes", { enumerable: true, get: function () { return automations_1.getAllNodes; } });
package/dist/render.d.ts CHANGED
@@ -1,78 +1,64 @@
1
- import { BaseClient } from './base';
2
- import type { ApiResponse, RenderJobSubmit, RenderVideoRequest, RenderImageRequest, RenderJobResponse, RenderJobStatus } from './types';
1
+ import type { ApiResponse } from './types';
2
+ import type { ImageEditorNodeConfig } from 'ugcinc-render';
3
+ export interface RenderJobResponse {
4
+ job_id: string;
5
+ status: string;
6
+ output_type: string;
7
+ message: string;
8
+ }
9
+ export interface RenderJobStatus {
10
+ job_id: string;
11
+ status: 'pending' | 'processing' | 'completed' | 'failed' | 'error';
12
+ progress?: number;
13
+ message?: string;
14
+ download_url?: string;
15
+ error?: string;
16
+ render_time_ms?: number;
17
+ size_bytes?: number;
18
+ }
19
+ export interface SubmitImageRenderJobParams {
20
+ config: ImageEditorNodeConfig;
21
+ /** Map of inputId -> URL for images and background */
22
+ imageUrls: Record<string, string>;
23
+ /** Map of textInputId -> text content for text elements */
24
+ textValues: Record<string, string>;
25
+ output_type?: 'image';
26
+ image_format?: 'png' | 'jpeg';
27
+ }
28
+ export interface RenderVideoEditorConfig {
29
+ width: number;
30
+ height: number;
31
+ fps: number;
32
+ duration?: number;
33
+ channels: Array<{
34
+ id: string;
35
+ segments: Array<Record<string, unknown>>;
36
+ }>;
37
+ dynamicCrop?: Record<string, unknown>;
38
+ }
39
+ export interface SubmitVideoRenderJobParams {
40
+ config: RenderVideoEditorConfig;
41
+ sources?: Record<string, string>;
42
+ output_type?: 'video' | 'image';
43
+ image_format?: 'png' | 'jpeg';
44
+ video_codec?: 'h264' | 'h265';
45
+ }
3
46
  /**
4
- * Client for video rendering operations
47
+ * Client for rendering operations
48
+ * Note: This calls Modal endpoints directly, not the UGC Inc API
5
49
  */
6
- export declare class RenderClient extends BaseClient {
7
- /**
8
- * Render a video
9
- * @param params - Video render parameters
10
- * @returns Job ID and initial status
11
- * @example
12
- * ```typescript
13
- * const videoJob = await client.render.renderVideo({
14
- * editor: myVideoEditorConfig, // Can include video/audio/text/image segments
15
- * });
16
- * ```
17
- */
18
- renderVideo(params: Omit<RenderVideoRequest, 'output_type'>): Promise<ApiResponse<RenderJobResponse>>;
19
- /**
20
- * Render a static image (text and images only)
21
- * @param params - Image render parameters
22
- * @returns Job ID and initial status
23
- * @example
24
- * ```typescript
25
- * const imageJob = await client.render.renderImage({
26
- * editor: myImageEditorConfig, // Can only include text/image segments
27
- * image_format: 'png'
28
- * });
29
- * ```
30
- */
31
- renderImage(params: Omit<RenderImageRequest, 'output_type'>): Promise<ApiResponse<RenderJobResponse>>;
50
+ export declare class RenderClient {
32
51
  /**
33
- * Submit a render job (generic - use renderVideo or renderImage for type safety)
34
- * @param params - Render job parameters
35
- * @returns Job ID and initial status
36
- * @example
37
- * ```typescript
38
- * // Less type-safe, prefer renderVideo() or renderImage()
39
- * const job = await client.render.submit({
40
- * use_example: true,
41
- * output_type: 'video'
42
- * });
43
- *
44
- * // Poll status separately
45
- * const status = await client.render.getStatus(job.data.job_id);
46
- * ```
52
+ * Submit an image render job to the Modal renderer
53
+ * Uses the new element-based format for single-source-of-truth rendering
47
54
  */
48
- submit(params: RenderJobSubmit): Promise<ApiResponse<RenderJobResponse>>;
55
+ submitImageRenderJob(params: SubmitImageRenderJobParams): Promise<ApiResponse<RenderJobResponse>>;
49
56
  /**
50
- * Get the status of a render job
51
- * @param jobId - The job ID returned from submit()
52
- * @returns Current job status with progress, stats, and download URL when completed
53
- * @example
54
- * ```typescript
55
- * const status = await client.render.getStatus(jobId);
56
- * if (status.data.status === 'completed') {
57
- * console.log('Output type:', status.data.output_type); // 'video' or 'image'
58
- * console.log('Download URL:', status.data.download_url);
59
- * }
60
- * ```
57
+ * Submit a render job to the Modal renderer
61
58
  */
62
- getStatus(jobId: string): Promise<ApiResponse<RenderJobStatus>>;
59
+ submitVideoRenderJob(params: SubmitVideoRenderJobParams): Promise<ApiResponse<RenderJobResponse>>;
63
60
  /**
64
- * Download the rendered file (video or image)
65
- * @param jobId - The job ID
66
- * @returns The rendered file as a blob
67
- * @example
68
- * ```typescript
69
- * const file = await client.render.download(jobId);
70
- * if (file.ok) {
71
- * // Create download link
72
- * const url = URL.createObjectURL(file.data);
73
- * window.location.href = url;
74
- * }
75
- * ```
61
+ * Get render job status from the Modal renderer
76
62
  */
77
- download(jobId: string): Promise<ApiResponse<Blob>>;
63
+ getRenderJobStatus(jobId: string): Promise<ApiResponse<RenderJobStatus>>;
78
64
  }
package/dist/render.js CHANGED
@@ -1,114 +1,186 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RenderClient = void 0;
4
- const base_1 = require("./base");
4
+ // Modal renderer endpoints
5
+ const RENDER_SUBMIT_URL = "https://aidangollan--ugcinc-render-renderer-submit-job.modal.run";
6
+ const RENDER_STATUS_URL = "https://aidangollan--ugcinc-render-renderer-get-status.modal.run";
5
7
  /**
6
- * Client for video rendering operations
8
+ * Client for rendering operations
9
+ * Note: This calls Modal endpoints directly, not the UGC Inc API
7
10
  */
8
- class RenderClient extends base_1.BaseClient {
11
+ class RenderClient {
9
12
  /**
10
- * Render a video
11
- * @param params - Video render parameters
12
- * @returns Job ID and initial status
13
- * @example
14
- * ```typescript
15
- * const videoJob = await client.render.renderVideo({
16
- * editor: myVideoEditorConfig, // Can include video/audio/text/image segments
17
- * });
18
- * ```
13
+ * Submit an image render job to the Modal renderer
14
+ * Uses the new element-based format for single-source-of-truth rendering
19
15
  */
20
- async renderVideo(params) {
21
- return this.post('/render/submit', { ...params, output_type: 'video' });
22
- }
23
- /**
24
- * Render a static image (text and images only)
25
- * @param params - Image render parameters
26
- * @returns Job ID and initial status
27
- * @example
28
- * ```typescript
29
- * const imageJob = await client.render.renderImage({
30
- * editor: myImageEditorConfig, // Can only include text/image segments
31
- * image_format: 'png'
32
- * });
33
- * ```
34
- */
35
- async renderImage(params) {
36
- return this.post('/render/submit', { ...params, output_type: 'image' });
37
- }
38
- /**
39
- * Submit a render job (generic - use renderVideo or renderImage for type safety)
40
- * @param params - Render job parameters
41
- * @returns Job ID and initial status
42
- * @example
43
- * ```typescript
44
- * // Less type-safe, prefer renderVideo() or renderImage()
45
- * const job = await client.render.submit({
46
- * use_example: true,
47
- * output_type: 'video'
48
- * });
49
- *
50
- * // Poll status separately
51
- * const status = await client.render.getStatus(job.data.job_id);
52
- * ```
53
- */
54
- async submit(params) {
55
- return this.post('/render/submit', params);
16
+ async submitImageRenderJob(params) {
17
+ try {
18
+ const response = await fetch(RENDER_SUBMIT_URL, {
19
+ method: 'POST',
20
+ headers: {
21
+ 'Content-Type': 'application/json',
22
+ },
23
+ body: JSON.stringify({
24
+ config: {
25
+ // New element-based format
26
+ width: params.config.width,
27
+ height: params.config.height,
28
+ elements: params.config.elements,
29
+ backgroundFit: params.config.backgroundFit ?? 'cover',
30
+ dynamicCrop: params.config.dynamicCrop,
31
+ // Inject imageUrls and textValues as sources for the renderer
32
+ imageUrls: params.imageUrls,
33
+ textValues: params.textValues,
34
+ },
35
+ output_type: params.output_type ?? 'image',
36
+ image_format: params.image_format ?? 'png',
37
+ })
38
+ });
39
+ const text = await response.text();
40
+ let data;
41
+ try {
42
+ data = JSON.parse(text);
43
+ }
44
+ catch (jsonError) {
45
+ console.error('[Render] JSON parse error:', text.substring(0, 200));
46
+ return {
47
+ ok: false,
48
+ code: response.status || 500,
49
+ message: `Modal endpoint error: ${text.substring(0, 100)}`,
50
+ };
51
+ }
52
+ if (data.status === 'error' || !response.ok) {
53
+ return {
54
+ ok: false,
55
+ code: response.status,
56
+ message: data.error ?? data.message ?? 'Failed to submit render job',
57
+ };
58
+ }
59
+ return {
60
+ ok: true,
61
+ code: 200,
62
+ message: "Render job submitted",
63
+ data,
64
+ };
65
+ }
66
+ catch (error) {
67
+ const errorMessage = error instanceof Error ? error.message : 'Unknown error';
68
+ console.error('[Render] Submit error:', error);
69
+ return {
70
+ ok: false,
71
+ code: 500,
72
+ message: `Failed to submit render job: ${errorMessage}`,
73
+ };
74
+ }
56
75
  }
57
76
  /**
58
- * Get the status of a render job
59
- * @param jobId - The job ID returned from submit()
60
- * @returns Current job status with progress, stats, and download URL when completed
61
- * @example
62
- * ```typescript
63
- * const status = await client.render.getStatus(jobId);
64
- * if (status.data.status === 'completed') {
65
- * console.log('Output type:', status.data.output_type); // 'video' or 'image'
66
- * console.log('Download URL:', status.data.download_url);
67
- * }
68
- * ```
77
+ * Submit a render job to the Modal renderer
69
78
  */
70
- async getStatus(jobId) {
71
- return this.post('/render/status', { job_id: jobId });
79
+ async submitVideoRenderJob(params) {
80
+ try {
81
+ const response = await fetch(RENDER_SUBMIT_URL, {
82
+ method: 'POST',
83
+ headers: {
84
+ 'Content-Type': 'application/json',
85
+ },
86
+ body: JSON.stringify({
87
+ config: params.config,
88
+ sources: params.sources,
89
+ output_type: params.output_type,
90
+ image_format: params.image_format,
91
+ video_codec: params.video_codec,
92
+ })
93
+ });
94
+ const text = await response.text();
95
+ let data;
96
+ try {
97
+ data = JSON.parse(text);
98
+ }
99
+ catch (jsonError) {
100
+ console.error('[Render] JSON parse error:', text.substring(0, 200));
101
+ return {
102
+ ok: false,
103
+ code: response.status || 500,
104
+ message: `Modal endpoint error: ${text.substring(0, 100)}`,
105
+ };
106
+ }
107
+ if (data.status === 'error' || !response.ok) {
108
+ return {
109
+ ok: false,
110
+ code: response.status,
111
+ message: data.error ?? data.message ?? 'Failed to submit render job',
112
+ };
113
+ }
114
+ return {
115
+ ok: true,
116
+ code: 200,
117
+ message: "Render job submitted",
118
+ data,
119
+ };
120
+ }
121
+ catch (error) {
122
+ const errorMessage = error instanceof Error ? error.message : 'Unknown error';
123
+ console.error('[Render] Submit error:', error);
124
+ return {
125
+ ok: false,
126
+ code: 500,
127
+ message: `Failed to submit render job: ${errorMessage}`,
128
+ };
129
+ }
72
130
  }
73
131
  /**
74
- * Download the rendered file (video or image)
75
- * @param jobId - The job ID
76
- * @returns The rendered file as a blob
77
- * @example
78
- * ```typescript
79
- * const file = await client.render.download(jobId);
80
- * if (file.ok) {
81
- * // Create download link
82
- * const url = URL.createObjectURL(file.data);
83
- * window.location.href = url;
84
- * }
85
- * ```
132
+ * Get render job status from the Modal renderer
86
133
  */
87
- async download(jobId) {
88
- const response = await fetch(`${this['baseUrl']}/render/download`, {
89
- method: 'POST',
90
- headers: {
91
- 'Authorization': this.orgId ? '' : `Bearer ${this.apiKey}`,
92
- 'x-api-key': this.orgId ? this.apiKey : '',
93
- 'Content-Type': 'application/json',
94
- },
95
- body: JSON.stringify({ job_id: jobId })
96
- });
97
- if (!response.ok) {
98
- const errorData = await response.json().catch(() => ({ message: 'Download failed' }));
134
+ async getRenderJobStatus(jobId) {
135
+ try {
136
+ const response = await fetch(RENDER_STATUS_URL, {
137
+ method: 'POST',
138
+ headers: {
139
+ 'Content-Type': 'application/json',
140
+ },
141
+ body: JSON.stringify({ job_id: jobId }),
142
+ });
143
+ const text = await response.text();
144
+ let data;
145
+ try {
146
+ data = JSON.parse(text);
147
+ }
148
+ catch (jsonError) {
149
+ console.error('[Render] JSON parse error:', text.substring(0, 200));
150
+ return {
151
+ ok: false,
152
+ code: response.status || 500,
153
+ message: `Modal endpoint error: ${text.substring(0, 100)}`,
154
+ };
155
+ }
156
+ if (data.status === 'error' || !response.ok) {
157
+ return {
158
+ ok: false,
159
+ code: response.status,
160
+ message: data.error ?? data.message ?? 'Failed to get job status',
161
+ };
162
+ }
163
+ // Modal returns Vercel Blob URL as download_url (fast CDN access)
164
+ // Fallback to download endpoint if not provided
165
+ if (data.status === 'completed' && !data.download_url) {
166
+ data.download_url = `https://aidangollan--ugcinc-render-renderer-download.modal.run?job_id=${jobId}`;
167
+ }
168
+ return {
169
+ ok: true,
170
+ code: 200,
171
+ message: "Job status retrieved",
172
+ data,
173
+ };
174
+ }
175
+ catch (error) {
176
+ const errorMessage = error instanceof Error ? error.message : 'Unknown error';
177
+ console.error('[Render] Status error:', error);
99
178
  return {
100
179
  ok: false,
101
- code: response.status,
102
- message: errorData.message || 'Failed to download file'
180
+ code: 500,
181
+ message: `Failed to get job status: ${errorMessage}`,
103
182
  };
104
183
  }
105
- const blob = await response.blob();
106
- return {
107
- ok: true,
108
- code: 200,
109
- message: 'Success',
110
- data: blob
111
- };
112
184
  }
113
185
  }
114
186
  exports.RenderClient = RenderClient;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ugcinc",
3
- "version": "2.63.1",
3
+ "version": "2.63.3",
4
4
  "description": "TypeScript/JavaScript client for the UGC Inc API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",