ugcinc 4.25.0 → 4.26.0
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/README.md +35 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +5 -3
- package/dist/render/types/native-text.d.ts +36 -0
- package/dist/render/types/native-text.js +22 -0
- package/dist/render.d.ts +19 -1
- package/dist/render.js +24 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -281,6 +281,41 @@ status/logs to inspect failures and the returned video for preview.
|
|
|
281
281
|
Server integrations can also call `submitRemotionCompositionRenderJob` and
|
|
282
282
|
`getRenderJobStatus` with the configured render-worker origin.
|
|
283
283
|
|
|
284
|
+
### Native text stickers
|
|
285
|
+
|
|
286
|
+
`submitNativeTextStickerRenderJob` submits the native classic text/emoji renderer
|
|
287
|
+
and returns the normal render job ID. Poll with `getRenderJobStatus`; the completed
|
|
288
|
+
`download_url` is a transparent PNG usable as an image layer in UGC compositions.
|
|
289
|
+
Server calls require `UGC_RENDER_URL`.
|
|
290
|
+
|
|
291
|
+
```ts
|
|
292
|
+
import {submitNativeTextStickerRenderJob, getRenderJobStatus} from 'ugcinc';
|
|
293
|
+
|
|
294
|
+
const submitted = await submitNativeTextStickerRenderJob({
|
|
295
|
+
text: 'Hello World 😭🙏', fontSizePt: 28,
|
|
296
|
+
canvasWidthPt: 360, canvasHeightPt: 120,
|
|
297
|
+
containerWidthPt: 320, originPt: [20, 18],
|
|
298
|
+
});
|
|
299
|
+
if (submitted.ok && submitted.data) {
|
|
300
|
+
const status = await getRenderJobStatus(submitted.data.job_id);
|
|
301
|
+
// Poll until completed/failed; use status.data.download_url when completed.
|
|
302
|
+
}
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
The versioned `tiktok-classic-ios-47` profile uses centered white text, a black
|
|
306
|
+
outline, TikTokDisplay-Medium and AppleColorEmoji. All dimensions are **native
|
|
307
|
+
points**, with fixed 3× output: the example produces 1080×360 pixels. Fractional
|
|
308
|
+
coordinates are preserved. Sizes are 11–72pt; canvas/container sides are 1–1365pt;
|
|
309
|
+
text is limited to 2048 UTF-16 code units. `containerHeightPt` limits visible
|
|
310
|
+
lines; omitted or zero means unlimited lines clipped by the canvas. Optional
|
|
311
|
+
`viewFontSizePt` reproduces a native editor whose view font differs from its text
|
|
312
|
+
run; normally omit it. Defaults are 28pt, a 600×180pt canvas, 560pt container width
|
|
313
|
+
and origin `[20,18]`.
|
|
314
|
+
|
|
315
|
+
Unsupported fallback fonts, bidi, styles and empty paragraphs fail explicitly.
|
|
316
|
+
The profile's recorded native PNG fixtures match exactly; this does not promise
|
|
317
|
+
pixel parity after resizing, browser composition or lossy video encoding.
|
|
318
|
+
|
|
284
319
|
## Social reference acquisition
|
|
285
320
|
|
|
286
321
|
Quick reference:
|
package/dist/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export { AutomationsClient } from './automations';
|
|
|
13
13
|
export { MediaClient } from './media';
|
|
14
14
|
export { CommentsClient } from './comments';
|
|
15
15
|
export { BillingClient } from './billing';
|
|
16
|
-
export { submitImageRenderJob, submitVideoRenderJob, getRenderJobStatus, submitDeduplicationJob, submitSceneSplitJob, submitScreenshotAnimationRenderJob, submitRemotionCompositionRenderJob, submitAutoCaptionRenderJob, submitInstagramDmRenderJob, submitIMessageDmRenderJob, } from './render';
|
|
16
|
+
export { submitImageRenderJob, submitVideoRenderJob, getRenderJobStatus, submitDeduplicationJob, submitSceneSplitJob, submitScreenshotAnimationRenderJob, submitRemotionCompositionRenderJob, submitNativeTextStickerRenderJob, nativeTextStickerSchema, submitAutoCaptionRenderJob, submitInstagramDmRenderJob, submitIMessageDmRenderJob, } from './render';
|
|
17
17
|
export { remotionCompositionSchema, remotionCompositionNodeSchema, remotionCompositionPortSchema, REMOTION_COMPOSITION_IMPORTS, parseRemotionPropsJson } from './render/types/remotion-composition';
|
|
18
18
|
export type { RemotionCompositionInput } from './render/types/remotion-composition';
|
|
19
19
|
export type { RemotionCompositionNodeConfig } from './automations/nodes/remotion-composition';
|
|
@@ -36,7 +36,7 @@ export type { Org, ApiKey, DeleteApiKeyParams, EditApiKeyParams, IntegrationKey,
|
|
|
36
36
|
export type { UserMedia, MediaUse, SocialAudio, Media, GetMediaParams, GetSocialAudioParams, UploadMediaParams, UploadMediaResponse, MediaTagUpdate, UpdateMediaTagsParams, MediaTagUpdateResult, UpdateMediaTagsResponse, UpdateMediaTagParams, UpdateMediaNameParams, DeleteMediaParams, DeleteMediaResponse, CreateSocialAudioParams, ImportTextParams, ImportTextResponse, CreateMediaFromUrlParams, GetMediaUseParams, GetMediaUseResponse, FilterMediaParams, FilterMediaResponse, PfpSearchParams, PfpSearchResponse, PfpCandidate, ImageSearchParams, ImageSearchResult, ImageSearchResponse, ImageSearchVideoFormat, } from './media';
|
|
37
37
|
export type { CommentStatus, Comment, CreateCommentParams, CreateCommentResponse, GetCommentsParams, } from './comments';
|
|
38
38
|
export type { BillingInfo, PortalUrlResponse, CancelAccountParams, CancelAccountResponse, ReactivateAccountParams, ReactivateAccountResponse, CancelSubscriptionResponse, RequestReplacementParams, RequestReplacementResponse, RequestRefundParams, RequestRefundResponse, BillingRequestInfo, PortalParams, } from './billing';
|
|
39
|
-
export type { RenderJobResponse, RenderJobStatus, SubmitImageRenderJobParams, SubmitVideoRenderJobParams, SubmitScreenshotAnimationRenderJobParams, SubmitAutoCaptionRenderJobParams, SubmitSceneSplitJobParams, SceneSplitDetectorConfig, SubmitInstagramDmRenderJobParams, SubmitIMessageDmRenderJobParams, IgDmMessage, ImDmMessage, RenderVideoEditorConfig, } from './render';
|
|
39
|
+
export type { RenderJobResponse, RenderJobStatus, SubmitImageRenderJobParams, NativeTextStickerInput, SubmitVideoRenderJobParams, SubmitScreenshotAnimationRenderJobParams, SubmitAutoCaptionRenderJobParams, SubmitSceneSplitJobParams, SceneSplitDetectorConfig, SubmitInstagramDmRenderJobParams, SubmitIMessageDmRenderJobParams, IgDmMessage, ImDmMessage, RenderVideoEditorConfig, } from './render';
|
|
40
40
|
export type { VideoEditorNodeConfig, VideoEditorChannel, VideoEditorSegment, VideoEditorVideoSegment, VideoEditorAudioSegment, VideoEditorImageSegment, VideoEditorTextSegment, VideoEditorImageSequenceSegment, VideoEditorVideoSequenceSegment, TimeValue, TimeMode, SegmentTimelinePosition, DeduplicationLevel, DeduplicationInput, ImageEditorElement, DimensionPresetKey, } from './render/types';
|
|
41
41
|
export type { ImageEditorNodeConfig, ImageComposerNodeConfig, ImageComposerRenderInput } from './automations/nodes/image-composer';
|
|
42
42
|
export { prepareImageComposerInput } from './automations/nodes/image-composer';
|
package/dist/index.js
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* Official TypeScript/JavaScript client for the UGC Inc API
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.
|
|
9
|
-
exports.
|
|
10
|
-
exports.mediaAnalysisResultSchema = exports.mediaAnalysisStatusSchema = exports.detectScenesSchema = exports.extractFramesSchema = exports.videoTextResultSchema = exports.imageTextResultSchema = exports.readVideoTextSchema = exports.readImageTextSchema = exports.audioLevelsResultSchema = exports.audioTranscriptResultSchema = exports.measureAudioLevelsSchema = exports.transcribeAudioSchema = exports.binaryMaskSchema = exports.measureLayoutResultSchema = exports.sampleColorsResultSchema = exports.measureLayoutSchema = exports.sampleColorsSchema = exports.matchTextStyleResultSchema = exports.matchTextStyleSchema = exports.prepareVideoComposerInput = exports.formatDateTag = exports.outputFieldsToZod = exports.outputFieldToZod = exports.LLMProviders = exports.applyLogicOperator = exports.IfLogicOperators = exports.resolvePath = exports.indexExpressionToString = exports.indexExpressionToIndexes = exports.resolveUnknownPath = exports.getOutputTypeFromCategory = void 0;
|
|
8
|
+
exports.getErrorNodeIds = exports.validateWorkflow = exports.getCapturedNodes = exports.getNodesDownstreamOfSet = exports.getDownstreamNodes = exports.checkCrossContextViolation = exports.getForEachContext = exports.getConnectedSource = exports.cleanupStaleConnections = exports.removeNodeConnections = exports.removeConnection = exports.addConnection = exports.deriveConnections = exports.createNode = exports.getOutputSchema = exports.getNodeByType = exports.getAllNodes = exports.getInputPreviewValue = exports.computeAllNodePortsWithPreviews = exports.computeAllNodePorts = exports.computePortsWithPreviews = exports.computePortsForNode = exports.areTypesCompatible = exports.parseRemotionPropsJson = exports.REMOTION_COMPOSITION_IMPORTS = exports.remotionCompositionPortSchema = exports.remotionCompositionNodeSchema = exports.remotionCompositionSchema = exports.submitIMessageDmRenderJob = exports.submitInstagramDmRenderJob = exports.submitAutoCaptionRenderJob = exports.nativeTextStickerSchema = exports.submitNativeTextStickerRenderJob = exports.submitRemotionCompositionRenderJob = exports.submitScreenshotAnimationRenderJob = exports.submitSceneSplitJob = exports.submitDeduplicationJob = exports.getRenderJobStatus = exports.submitVideoRenderJob = exports.submitImageRenderJob = exports.BillingClient = exports.CommentsClient = exports.MediaClient = exports.AutomationsClient = exports.OrganizationClient = exports.StatsClient = exports.PostsClient = exports.TasksClient = exports.AccountsClient = exports.UGCClient = void 0;
|
|
9
|
+
exports.mapOpenAPIType = exports.nodeConfigToCaptionStyle = exports.HttpMethods = exports.prepareImageComposerInput = exports.substituteVariables = exports.processTemplate = exports.extractTemplateVariables = exports.PortIdSchema = exports.normalizeToPortId = exports.portIdToTitle = exports.isValidPortId = exports.portId = exports.selectFromPool = exports.getModelDurations = exports.getModelAspectRatios = exports.ALL_VIDEO_MODELS = exports.getAvailableInputModes = exports.hasReferenceVariant = exports.getReferenceModelId = exports.hasFirstLastFrameVariant = exports.getFirstLastFrameModelId = exports.hasImageToVideoVariant = exports.getImageToVideoModelId = exports.isImageToVideoModel = exports.IMAGE_ASPECT_RATIOS = exports.ALL_IMAGE_MODELS = exports.getEditModelId = exports.isEditModel = exports.getCapturedSourceNodeTypes = exports.getFlowControlNodeTypes = exports.getAllNodeDefinitions = exports.getNodeDefinition = exports.isPortType = exports.formatPortType = exports.isAsyncExecutor = exports.internalNodeTypes = exports.nodeDefinitions = exports.extractWorkflowConfig = exports.generateNodeName = exports.shuffleNodePreview = exports.getPreviewValue = exports.removePreviewForConnection = exports.updatePreviewMapForConnection = exports.computePreviewMap = exports.computeAllNodePreviews = exports.resolveNodePreview = exports.getWorkflowOutputSchema = exports.hasMissingTerminalError = exports.hasMissingTriggerError = exports.getPortErrorsForNode = void 0;
|
|
10
|
+
exports.mediaAnalysisResultSchema = exports.mediaAnalysisStatusSchema = exports.detectScenesSchema = exports.extractFramesSchema = exports.videoTextResultSchema = exports.imageTextResultSchema = exports.readVideoTextSchema = exports.readImageTextSchema = exports.audioLevelsResultSchema = exports.audioTranscriptResultSchema = exports.measureAudioLevelsSchema = exports.transcribeAudioSchema = exports.binaryMaskSchema = exports.measureLayoutResultSchema = exports.sampleColorsResultSchema = exports.measureLayoutSchema = exports.sampleColorsSchema = exports.matchTextStyleResultSchema = exports.matchTextStyleSchema = exports.prepareVideoComposerInput = exports.formatDateTag = exports.outputFieldsToZod = exports.outputFieldToZod = exports.LLMProviders = exports.applyLogicOperator = exports.IfLogicOperators = exports.resolvePath = exports.indexExpressionToString = exports.indexExpressionToIndexes = exports.resolveUnknownPath = exports.getOutputTypeFromCategory = exports.parseOpenAPIOutputPath = exports.parseOpenAPIInputs = void 0;
|
|
11
11
|
// =============================================================================
|
|
12
12
|
// Client Exports
|
|
13
13
|
// =============================================================================
|
|
@@ -40,6 +40,8 @@ Object.defineProperty(exports, "submitDeduplicationJob", { enumerable: true, get
|
|
|
40
40
|
Object.defineProperty(exports, "submitSceneSplitJob", { enumerable: true, get: function () { return render_1.submitSceneSplitJob; } });
|
|
41
41
|
Object.defineProperty(exports, "submitScreenshotAnimationRenderJob", { enumerable: true, get: function () { return render_1.submitScreenshotAnimationRenderJob; } });
|
|
42
42
|
Object.defineProperty(exports, "submitRemotionCompositionRenderJob", { enumerable: true, get: function () { return render_1.submitRemotionCompositionRenderJob; } });
|
|
43
|
+
Object.defineProperty(exports, "submitNativeTextStickerRenderJob", { enumerable: true, get: function () { return render_1.submitNativeTextStickerRenderJob; } });
|
|
44
|
+
Object.defineProperty(exports, "nativeTextStickerSchema", { enumerable: true, get: function () { return render_1.nativeTextStickerSchema; } });
|
|
43
45
|
Object.defineProperty(exports, "submitAutoCaptionRenderJob", { enumerable: true, get: function () { return render_1.submitAutoCaptionRenderJob; } });
|
|
44
46
|
Object.defineProperty(exports, "submitInstagramDmRenderJob", { enumerable: true, get: function () { return render_1.submitInstagramDmRenderJob; } });
|
|
45
47
|
Object.defineProperty(exports, "submitIMessageDmRenderJob", { enumerable: true, get: function () { return render_1.submitIMessageDmRenderJob; } });
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** Native points, rendered at 3 pixels per point. No coordinate rounding. */
|
|
3
|
+
export declare const nativeTextStickerSchema: z.ZodObject<{
|
|
4
|
+
profile: z.ZodDefault<z.ZodLiteral<"tiktok-classic-ios-47">>;
|
|
5
|
+
text: z.ZodEffects<z.ZodString, string, string>;
|
|
6
|
+
fontSizePt: z.ZodDefault<z.ZodNumber>;
|
|
7
|
+
canvasWidthPt: z.ZodDefault<z.ZodNumber>;
|
|
8
|
+
canvasHeightPt: z.ZodDefault<z.ZodNumber>;
|
|
9
|
+
containerWidthPt: z.ZodDefault<z.ZodNumber>;
|
|
10
|
+
/** Omit for unlimited lines clipped by the canvas; zero has the same meaning. */
|
|
11
|
+
containerHeightPt: z.ZodOptional<z.ZodNumber>;
|
|
12
|
+
originPt: z.ZodDefault<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
|
|
13
|
+
/** Normally omitted. Reproduces an editor whose view font differs from the text run font. */
|
|
14
|
+
viewFontSizePt: z.ZodOptional<z.ZodNumber>;
|
|
15
|
+
}, "strict", z.ZodTypeAny, {
|
|
16
|
+
text: string;
|
|
17
|
+
profile: "tiktok-classic-ios-47";
|
|
18
|
+
fontSizePt: number;
|
|
19
|
+
canvasWidthPt: number;
|
|
20
|
+
canvasHeightPt: number;
|
|
21
|
+
containerWidthPt: number;
|
|
22
|
+
originPt: [number, number];
|
|
23
|
+
containerHeightPt?: number | undefined;
|
|
24
|
+
viewFontSizePt?: number | undefined;
|
|
25
|
+
}, {
|
|
26
|
+
text: string;
|
|
27
|
+
profile?: "tiktok-classic-ios-47" | undefined;
|
|
28
|
+
fontSizePt?: number | undefined;
|
|
29
|
+
canvasWidthPt?: number | undefined;
|
|
30
|
+
canvasHeightPt?: number | undefined;
|
|
31
|
+
containerWidthPt?: number | undefined;
|
|
32
|
+
containerHeightPt?: number | undefined;
|
|
33
|
+
originPt?: [number, number] | undefined;
|
|
34
|
+
viewFontSizePt?: number | undefined;
|
|
35
|
+
}>;
|
|
36
|
+
export type NativeTextStickerInput = z.input<typeof nativeTextStickerSchema>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.nativeTextStickerSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const dimension = zod_1.z.number().finite().min(1).max(1365);
|
|
6
|
+
const fontSize = zod_1.z.number().finite().min(11).max(72);
|
|
7
|
+
/** Native points, rendered at 3 pixels per point. No coordinate rounding. */
|
|
8
|
+
exports.nativeTextStickerSchema = zod_1.z.object({
|
|
9
|
+
profile: zod_1.z.literal('tiktok-classic-ios-47').default('tiktok-classic-ios-47'),
|
|
10
|
+
text: zod_1.z.string().min(1).max(2048).refine(text => text.split('\n').every(line => line.replace(/ /g, '').length > 0)
|
|
11
|
+
&& !/[\u0000-\u0009\u000b-\u001f\u007f-\u009f\u2028\u2029\u202a-\u202e\u2066-\u2069]/u.test(text)
|
|
12
|
+
&& !/[\uD800-\uDFFF]/u.test(text), 'Empty paragraphs, control characters and unpaired surrogates are not supported'),
|
|
13
|
+
fontSizePt: fontSize.default(28),
|
|
14
|
+
canvasWidthPt: dimension.default(600),
|
|
15
|
+
canvasHeightPt: dimension.default(180),
|
|
16
|
+
containerWidthPt: dimension.default(560),
|
|
17
|
+
/** Omit for unlimited lines clipped by the canvas; zero has the same meaning. */
|
|
18
|
+
containerHeightPt: zod_1.z.number().finite().min(0).max(1365).optional(),
|
|
19
|
+
originPt: zod_1.z.tuple([zod_1.z.number().finite().min(0).max(1365), zod_1.z.number().finite().min(0).max(1365)]).default([20, 18]),
|
|
20
|
+
/** Normally omitted. Reproduces an editor whose view font differs from the text run font. */
|
|
21
|
+
viewFontSizePt: fontSize.optional(),
|
|
22
|
+
}).strict();
|
package/dist/render.d.ts
CHANGED
|
@@ -13,6 +13,25 @@ import type { CaptionWord, CaptionStyle } from './render/types/caption';
|
|
|
13
13
|
import type { ImageEditorNodeConfig } from './automations/nodes/image-composer';
|
|
14
14
|
import type { CreateDmMessage } from './automations/nodes/create-dm';
|
|
15
15
|
import { type RemotionCompositionInput } from './render/types/remotion-composition';
|
|
16
|
+
import { type NativeTextStickerInput } from './render/types/native-text';
|
|
17
|
+
export { nativeTextStickerSchema, type NativeTextStickerInput } from './render/types/native-text';
|
|
18
|
+
/** Render a native text/emoji sticker directly to a transparent PNG. */
|
|
19
|
+
export declare function submitNativeTextStickerRenderJob(params: NativeTextStickerInput): Promise<{
|
|
20
|
+
ok: boolean;
|
|
21
|
+
code: number;
|
|
22
|
+
message: string;
|
|
23
|
+
data?: undefined;
|
|
24
|
+
} | {
|
|
25
|
+
ok: boolean;
|
|
26
|
+
code: number;
|
|
27
|
+
message: string;
|
|
28
|
+
data: {
|
|
29
|
+
message: string;
|
|
30
|
+
status: string;
|
|
31
|
+
job_id: string;
|
|
32
|
+
output_type: string;
|
|
33
|
+
};
|
|
34
|
+
}>;
|
|
16
35
|
/** Submit TSX source and props; UGC owns registration and bundling. */
|
|
17
36
|
export declare function submitRemotionCompositionRenderJob(params: RemotionCompositionInput & {
|
|
18
37
|
outputType?: 'video' | 'image';
|
|
@@ -208,4 +227,3 @@ export declare function submitInstagramDmRenderJob(params: SubmitInstagramDmRend
|
|
|
208
227
|
* Renders a fake iMessage conversation image.
|
|
209
228
|
*/
|
|
210
229
|
export declare function submitIMessageDmRenderJob(params: SubmitIMessageDmRenderJobParams): Promise<ApiResponse<RenderJobResponse>>;
|
|
211
|
-
export {};
|
package/dist/render.js
CHANGED
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
* variable set fails fast.
|
|
10
10
|
*/
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.nativeTextStickerSchema = void 0;
|
|
13
|
+
exports.submitNativeTextStickerRenderJob = submitNativeTextStickerRenderJob;
|
|
12
14
|
exports.submitRemotionCompositionRenderJob = submitRemotionCompositionRenderJob;
|
|
13
15
|
exports.submitImageRenderJob = submitImageRenderJob;
|
|
14
16
|
exports.submitVideoRenderJob = submitVideoRenderJob;
|
|
@@ -21,6 +23,9 @@ exports.submitInstagramDmRenderJob = submitInstagramDmRenderJob;
|
|
|
21
23
|
exports.submitIMessageDmRenderJob = submitIMessageDmRenderJob;
|
|
22
24
|
const zod_1 = require("zod");
|
|
23
25
|
const remotion_composition_1 = require("./render/types/remotion-composition");
|
|
26
|
+
const native_text_1 = require("./render/types/native-text");
|
|
27
|
+
var native_text_2 = require("./render/types/native-text");
|
|
28
|
+
Object.defineProperty(exports, "nativeTextStickerSchema", { enumerable: true, get: function () { return native_text_2.nativeTextStickerSchema; } });
|
|
24
29
|
function renderBaseUrl() {
|
|
25
30
|
const url = process.env.UGC_RENDER_URL?.trim();
|
|
26
31
|
if (!url) {
|
|
@@ -29,6 +34,25 @@ function renderBaseUrl() {
|
|
|
29
34
|
return url.replace(/\/+$/, '');
|
|
30
35
|
}
|
|
31
36
|
const MAX_RETRIES = 3;
|
|
37
|
+
/** Render a native text/emoji sticker directly to a transparent PNG. */
|
|
38
|
+
async function submitNativeTextStickerRenderJob(params) {
|
|
39
|
+
const parsed = native_text_1.nativeTextStickerSchema.safeParse(params);
|
|
40
|
+
if (!parsed.success)
|
|
41
|
+
return { ok: false, code: 400, message: parsed.error.message };
|
|
42
|
+
const response = await renderFetch('/submit-job', {
|
|
43
|
+
method: 'POST', headers: { 'Content-Type': 'application/json' },
|
|
44
|
+
body: JSON.stringify({ config: { _compositionType: 'native-text', ...parsed.data },
|
|
45
|
+
output_type: 'image', image_format: 'png' }),
|
|
46
|
+
});
|
|
47
|
+
const data = await response.json();
|
|
48
|
+
const result = zod_1.z.object({ job_id: zod_1.z.string(), status: zod_1.z.string(), output_type: zod_1.z.string(), message: zod_1.z.string() }).safeParse(data);
|
|
49
|
+
if (!response.ok || !result.success || result.data.status === 'error') {
|
|
50
|
+
const error = zod_1.z.object({ error: zod_1.z.string() }).safeParse(data);
|
|
51
|
+
return { ok: false, code: response.ok ? 400 : response.status,
|
|
52
|
+
message: error.success ? error.data.error : 'Failed to submit native text sticker' };
|
|
53
|
+
}
|
|
54
|
+
return { ok: true, code: 200, message: 'Native text sticker submitted', data: result.data };
|
|
55
|
+
}
|
|
32
56
|
/** Submit TSX source and props; UGC owns registration and bundling. */
|
|
33
57
|
async function submitRemotionCompositionRenderJob(params) {
|
|
34
58
|
const { outputType = 'video', ...composition } = params;
|