ugcinc 4.1.48 → 4.1.49

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
@@ -31,7 +31,7 @@ export type { RefreshStatsParams, RefreshStatsError, RefreshStatsResponse, Daily
31
31
  export type { ApiKey, DeleteApiKeyParams, EditApiKeyParams } from './org';
32
32
  export type { UserMedia, MediaUse, SocialAudio, Media, GetMediaParams, GetSocialAudioParams, UploadMediaParams, UploadMediaResponse, MediaTagUpdate, UpdateMediaTagsParams, MediaTagUpdateResult, UpdateMediaTagsResponse, UpdateMediaTagParams, DeleteMediaParams, DeleteMediaResponse, CreateSocialAudioParams, ImportTextParams, ImportTextResponse, CreateMediaFromUrlParams, GetMediaUseParams, GetMediaUseResponse, FilterMediaParams, FilterMediaResponse, GetUploadTokenParams, UploadTokenResponse, } from './media';
33
33
  export type { CommentStatus, Comment, CreateCommentParams, CreateCommentResponse, GetCommentsParams, } from './comments';
34
- export type { RenderJobResponse, RenderJobStatus, SubmitImageRenderJobParams, SubmitVideoRenderJobParams, SubmitScreenshotAnimationRenderJobParams, SubmitInstagramDmRenderJobParams, SubmitIMessageDmRenderJobParams, IgDmMessage, ImDmMessage, RenderVideoEditorConfig, } from './render';
34
+ export type { RenderJobResponse, RenderJobStatus, SubmitImageRenderJobParams, SubmitVideoRenderJobParams, SubmitScreenshotAnimationRenderJobParams, SubmitAutoCaptionRenderJobParams, SubmitInstagramDmRenderJobParams, SubmitIMessageDmRenderJobParams, IgDmMessage, ImDmMessage, RenderVideoEditorConfig, } from './render';
35
35
  export type { VideoEditorNodeConfig, VideoEditorChannel, VideoEditorSegment, VideoEditorVideoSegment, VideoEditorAudioSegment, VideoEditorImageSegment, VideoEditorTextSegment, VideoEditorImageSequenceSegment, VideoEditorVideoSequenceSegment, TimeValue, TimeMode, SegmentTimelinePosition, DeduplicationLevel, DeduplicationInput, ImageEditorElement, DimensionPresetKey, } from './render/types';
36
36
  export type { ImageEditorNodeConfig, ImageComposerNodeConfig, ImageComposerRenderInput } from './automations/nodes/image-composer';
37
37
  export { prepareImageComposerInput } from './automations/nodes/image-composer';
package/dist/render.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import type { ApiResponse } from './types';
2
2
  import type { VideoEditorNodeConfig, DeduplicationInput } from './render/types';
3
+ import type { CaptionWord, CaptionStyle } from './render/types/caption';
3
4
  import type { ImageEditorNodeConfig } from './automations/nodes/image-composer';
4
5
  import type { CreateDmMessage } from './automations/nodes/create-dm';
5
6
  export interface RenderJobResponse {
@@ -61,6 +62,22 @@ export interface SubmitScreenshotAnimationRenderJobParams {
61
62
  /** Duration to hold at end after animation completes (ms) - default 500 */
62
63
  holdDurationMs?: number;
63
64
  }
65
+ export interface SubmitAutoCaptionRenderJobParams {
66
+ /** Video source URL */
67
+ videoUrl: string;
68
+ /** Output width in pixels */
69
+ width: number;
70
+ /** Output height in pixels */
71
+ height: number;
72
+ /** Video duration in milliseconds */
73
+ durationMs: number;
74
+ /** Frames per second */
75
+ fps: number;
76
+ /** Caption words with timing from transcription */
77
+ captions: CaptionWord[];
78
+ /** Caption styling configuration */
79
+ style: CaptionStyle;
80
+ }
64
81
  interface IgDmMessageInternal {
65
82
  text: string;
66
83
  sender: 'user' | 'recipient';
@@ -140,6 +157,11 @@ export declare class RenderClient {
140
157
  * Renders an iPhone screenshot animation video from a source image
141
158
  */
142
159
  submitScreenshotAnimationRenderJob(params: SubmitScreenshotAnimationRenderJobParams): Promise<ApiResponse<RenderJobResponse>>;
160
+ /**
161
+ * Submit an auto-caption render job to the Modal renderer
162
+ * Renders a video with captions overlaid
163
+ */
164
+ submitAutoCaptionRenderJob(params: SubmitAutoCaptionRenderJobParams): Promise<ApiResponse<RenderJobResponse>>;
143
165
  /**
144
166
  * Submit an Instagram DM render job to the Modal renderer
145
167
  * Renders a fake Instagram DM conversation image
package/dist/render.js CHANGED
@@ -355,6 +355,69 @@ class RenderClient {
355
355
  };
356
356
  }
357
357
  }
358
+ /**
359
+ * Submit an auto-caption render job to the Modal renderer
360
+ * Renders a video with captions overlaid
361
+ */
362
+ async submitAutoCaptionRenderJob(params) {
363
+ try {
364
+ const response = await fetch(RENDER_SUBMIT_URL, {
365
+ method: 'POST',
366
+ headers: {
367
+ 'Content-Type': 'application/json',
368
+ },
369
+ body: JSON.stringify({
370
+ config: {
371
+ _compositionType: 'auto-caption',
372
+ videoUrl: params.videoUrl,
373
+ width: params.width,
374
+ height: params.height,
375
+ durationMs: params.durationMs,
376
+ fps: params.fps,
377
+ captions: params.captions,
378
+ style: params.style,
379
+ },
380
+ output_type: 'video',
381
+ video_codec: 'h264',
382
+ })
383
+ });
384
+ const text = await response.text();
385
+ let data;
386
+ try {
387
+ data = JSON.parse(text);
388
+ }
389
+ catch (jsonError) {
390
+ console.error('[Render] JSON parse error:', text.substring(0, 200));
391
+ return {
392
+ ok: false,
393
+ code: response.status || 500,
394
+ message: `Modal endpoint error: ${text.substring(0, 100)}`,
395
+ };
396
+ }
397
+ if (data.status === 'error' || !response.ok) {
398
+ return {
399
+ ok: false,
400
+ code: response.status,
401
+ message: data.error ?? data.message ?? 'Failed to submit auto-caption job',
402
+ };
403
+ }
404
+ return {
405
+ ok: true,
406
+ code: 200,
407
+ message: "Auto-caption job submitted",
408
+ data,
409
+ };
410
+ }
411
+ catch (error) {
412
+ const errorMessage = error instanceof Error ? error.message : 'Unknown error';
413
+ console.error('[Render] Submit auto-caption error:', error);
414
+ return {
415
+ ok: false,
416
+ code: 500,
417
+ message: `Failed to submit auto-caption job: ${errorMessage}`,
418
+ };
419
+ }
420
+ }
358
421
  /**
359
422
  * Submit an Instagram DM render job to the Modal renderer
360
423
  * Renders a fake Instagram DM conversation image
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ugcinc",
3
- "version": "4.1.48",
3
+ "version": "4.1.49",
4
4
  "description": "TypeScript/JavaScript client for the UGC Inc API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",