@editframe/api 0.16.4-beta.0 → 0.16.7-beta.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/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ export { createImageFile, CreateImageFilePayload, getImageFileMetadata, ImageFil
3
3
  export { createISOBMFFFile, CreateISOBMFFFilePayload, getISOBMFFFileTranscription, lookupISOBMFFFileByMd5, transcribeISOBMFFFile, TranscribeISOBMFFFilePayload, uploadFragmentIndex, type CreateISOBMFFFileResult, type GetISOBMFFFileTranscriptionResult, type LookupISOBMFFFileByMd5Result, type TranscribeISOBMFFFileResult, } from './resources/isobmff-file.js';
4
4
  export { AudioTrackPayload, createISOBMFFTrack, CreateISOBMFFTrackPayload, uploadISOBMFFTrack, VideoTrackPayload, type AudioStreamSchema, type CreateISOBMFFTrackResult, type VideoStreamSchema, } from './resources/isobmff-track.js';
5
5
  export { getIsobmffProcessInfo, getIsobmffProcessProgress, type IsobmffProcessInfoResult, } from './resources/process-isobmff.js';
6
- export { createRender, CreateRenderPayload, downloadRender, getRenderInfo, getRenderProgress, lookupRenderByMd5, uploadRender, type CreateRenderResult, type LookupRenderByMd5Result, } from './resources/renders.js';
6
+ export { createRender, CreateRenderPayload, downloadRender, getRenderInfo, getRenderProgress, lookupRenderByMd5, uploadRender, RenderOutputConfiguration, type CreateRenderResult, type LookupRenderByMd5Result, OutputConfiguration, } from './resources/renders.js';
7
7
  export { createTranscription, CreateTranscriptionPayload, getTranscriptionInfo, getTranscriptionProgress, type CreateTranscriptionResult, type TranscriptionInfoResult, } from './resources/transcriptions.js';
8
8
  export { createUnprocessedFile, CreateUnprocessedFilePayload, lookupUnprocessedFileByMd5, processIsobmffFile, uploadUnprocessedReadableStream, type CreateUnprocessedFileResult, type LookupUnprocessedFileByMd5Result, type ProcessIsobmffFileResult, type UnprocessedFile, type UnprocessedFileUploadDetails, } from './resources/unprocessed-file.js';
9
9
  export { createURLToken, type URLTokenResult, } from './resources/url-token.js';
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import { CreateImageFilePayload, ImageFileMimeTypes, createImageFile, getImageFi
3
3
  import { CreateISOBMFFFilePayload, TranscribeISOBMFFFilePayload, createISOBMFFFile, getISOBMFFFileTranscription, lookupISOBMFFFileByMd5, transcribeISOBMFFFile, uploadFragmentIndex } from "./resources/isobmff-file.js";
4
4
  import { AudioTrackPayload, CreateISOBMFFTrackPayload, VideoTrackPayload, createISOBMFFTrack, uploadISOBMFFTrack } from "./resources/isobmff-track.js";
5
5
  import { getIsobmffProcessInfo, getIsobmffProcessProgress } from "./resources/process-isobmff.js";
6
- import { CreateRenderPayload, createRender, downloadRender, getRenderInfo, getRenderProgress, lookupRenderByMd5, uploadRender } from "./resources/renders.js";
6
+ import { CreateRenderPayload, OutputConfiguration, RenderOutputConfiguration, createRender, downloadRender, getRenderInfo, getRenderProgress, lookupRenderByMd5, uploadRender } from "./resources/renders.js";
7
7
  import { CreateTranscriptionPayload, createTranscription, getTranscriptionInfo, getTranscriptionProgress } from "./resources/transcriptions.js";
8
8
  import { CreateUnprocessedFilePayload, createUnprocessedFile, lookupUnprocessedFileByMd5, processIsobmffFile, uploadUnprocessedReadableStream } from "./resources/unprocessed-file.js";
9
9
  import { createURLToken } from "./resources/url-token.js";
@@ -19,6 +19,8 @@ export {
19
19
  CreateTranscriptionPayload,
20
20
  CreateUnprocessedFilePayload,
21
21
  ImageFileMimeTypes,
22
+ OutputConfiguration,
23
+ RenderOutputConfiguration,
22
24
  TranscribeISOBMFFFilePayload,
23
25
  VideoTrackPayload,
24
26
  createCaptionFile,
package/dist/node.js CHANGED
@@ -11,7 +11,7 @@ import { CreateCaptionFilePayload, createCaptionFile, lookupCaptionFileByMd5, up
11
11
  import { CreateISOBMFFFilePayload, TranscribeISOBMFFFilePayload, createISOBMFFFile, getISOBMFFFileTranscription, lookupISOBMFFFileByMd5, transcribeISOBMFFFile, uploadFragmentIndex } from "./resources/isobmff-file.js";
12
12
  import { AudioTrackPayload, CreateISOBMFFTrackPayload, VideoTrackPayload, createISOBMFFTrack, uploadISOBMFFTrack } from "./resources/isobmff-track.js";
13
13
  import { getIsobmffProcessInfo, getIsobmffProcessProgress } from "./resources/process-isobmff.js";
14
- import { CreateRenderPayload, createRender, downloadRender, getRenderInfo, getRenderProgress, lookupRenderByMd5, uploadRender } from "./resources/renders.js";
14
+ import { CreateRenderPayload, OutputConfiguration, RenderOutputConfiguration, createRender, downloadRender, getRenderInfo, getRenderProgress, lookupRenderByMd5, uploadRender } from "./resources/renders.js";
15
15
  import { CreateTranscriptionPayload, createTranscription, getTranscriptionInfo, getTranscriptionProgress } from "./resources/transcriptions.js";
16
16
  import { createURLToken } from "./resources/url-token.js";
17
17
  import { Client } from "./client.js";
@@ -62,6 +62,8 @@ export {
62
62
  CreateTranscriptionPayload,
63
63
  CreateUnprocessedFilePayload,
64
64
  ImageFileMimeTypes,
65
+ OutputConfiguration,
66
+ RenderOutputConfiguration,
65
67
  TranscribeISOBMFFFilePayload,
66
68
  VideoTrackPayload,
67
69
  createCaptionFile,
@@ -1,6 +1,76 @@
1
1
  import { z } from 'zod';
2
2
  import { CompletionIterator } from '../ProgressIterator.js';
3
3
  import { Client } from '../client.js';
4
+ export declare const RenderOutputConfiguration: z.ZodDiscriminatedUnion<"container", [z.ZodObject<{
5
+ container: z.ZodLiteral<"mp4">;
6
+ video: z.ZodObject<{
7
+ codec: z.ZodLiteral<"h264">;
8
+ }, "strip", z.ZodTypeAny, {
9
+ codec: "h264";
10
+ }, {
11
+ codec: "h264";
12
+ }>;
13
+ audio: z.ZodObject<{
14
+ codec: z.ZodLiteral<"aac">;
15
+ }, "strip", z.ZodTypeAny, {
16
+ codec: "aac";
17
+ }, {
18
+ codec: "aac";
19
+ }>;
20
+ }, "strip", z.ZodTypeAny, {
21
+ audio: {
22
+ codec: "aac";
23
+ };
24
+ video: {
25
+ codec: "h264";
26
+ };
27
+ container: "mp4";
28
+ }, {
29
+ audio: {
30
+ codec: "aac";
31
+ };
32
+ video: {
33
+ codec: "h264";
34
+ };
35
+ container: "mp4";
36
+ }>, z.ZodObject<{
37
+ container: z.ZodLiteral<"jpeg">;
38
+ quality: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
39
+ }, "strip", z.ZodTypeAny, {
40
+ container: "jpeg";
41
+ quality?: number | undefined;
42
+ }, {
43
+ container: "jpeg";
44
+ quality?: number | undefined;
45
+ }>, z.ZodObject<{
46
+ container: z.ZodLiteral<"png">;
47
+ compression: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
48
+ transparency: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
49
+ }, "strip", z.ZodTypeAny, {
50
+ container: "png";
51
+ compression?: number | undefined;
52
+ transparency?: boolean | undefined;
53
+ }, {
54
+ container: "png";
55
+ compression?: number | undefined;
56
+ transparency?: boolean | undefined;
57
+ }>, z.ZodObject<{
58
+ container: z.ZodLiteral<"webp">;
59
+ quality: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
60
+ compression: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
61
+ transparency: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
62
+ }, "strip", z.ZodTypeAny, {
63
+ container: "webp";
64
+ quality?: number | undefined;
65
+ compression?: number | undefined;
66
+ transparency?: boolean | undefined;
67
+ }, {
68
+ container: "webp";
69
+ quality?: number | undefined;
70
+ compression?: number | undefined;
71
+ transparency?: boolean | undefined;
72
+ }>]>;
73
+ export type RenderOutputConfiguration = z.infer<typeof RenderOutputConfiguration>;
4
74
  export declare const CreateRenderPayload: z.ZodObject<{
5
75
  md5: z.ZodOptional<z.ZodString>;
6
76
  fps: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
@@ -11,6 +81,75 @@ export declare const CreateRenderPayload: z.ZodObject<{
11
81
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
12
82
  duration_ms: z.ZodOptional<z.ZodNumber>;
13
83
  strategy: z.ZodOptional<z.ZodDefault<z.ZodEnum<["v1"]>>>;
84
+ output: z.ZodOptional<z.ZodDefault<z.ZodDiscriminatedUnion<"container", [z.ZodObject<{
85
+ container: z.ZodLiteral<"mp4">;
86
+ video: z.ZodObject<{
87
+ codec: z.ZodLiteral<"h264">;
88
+ }, "strip", z.ZodTypeAny, {
89
+ codec: "h264";
90
+ }, {
91
+ codec: "h264";
92
+ }>;
93
+ audio: z.ZodObject<{
94
+ codec: z.ZodLiteral<"aac">;
95
+ }, "strip", z.ZodTypeAny, {
96
+ codec: "aac";
97
+ }, {
98
+ codec: "aac";
99
+ }>;
100
+ }, "strip", z.ZodTypeAny, {
101
+ audio: {
102
+ codec: "aac";
103
+ };
104
+ video: {
105
+ codec: "h264";
106
+ };
107
+ container: "mp4";
108
+ }, {
109
+ audio: {
110
+ codec: "aac";
111
+ };
112
+ video: {
113
+ codec: "h264";
114
+ };
115
+ container: "mp4";
116
+ }>, z.ZodObject<{
117
+ container: z.ZodLiteral<"jpeg">;
118
+ quality: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
119
+ }, "strip", z.ZodTypeAny, {
120
+ container: "jpeg";
121
+ quality?: number | undefined;
122
+ }, {
123
+ container: "jpeg";
124
+ quality?: number | undefined;
125
+ }>, z.ZodObject<{
126
+ container: z.ZodLiteral<"png">;
127
+ compression: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
128
+ transparency: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
129
+ }, "strip", z.ZodTypeAny, {
130
+ container: "png";
131
+ compression?: number | undefined;
132
+ transparency?: boolean | undefined;
133
+ }, {
134
+ container: "png";
135
+ compression?: number | undefined;
136
+ transparency?: boolean | undefined;
137
+ }>, z.ZodObject<{
138
+ container: z.ZodLiteral<"webp">;
139
+ quality: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
140
+ compression: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
141
+ transparency: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
142
+ }, "strip", z.ZodTypeAny, {
143
+ container: "webp";
144
+ quality?: number | undefined;
145
+ compression?: number | undefined;
146
+ transparency?: boolean | undefined;
147
+ }, {
148
+ container: "webp";
149
+ quality?: number | undefined;
150
+ compression?: number | undefined;
151
+ transparency?: boolean | undefined;
152
+ }>]>>>;
14
153
  }, "strip", z.ZodTypeAny, {
15
154
  width?: number | undefined;
16
155
  height?: number | undefined;
@@ -21,6 +160,27 @@ export declare const CreateRenderPayload: z.ZodObject<{
21
160
  work_slice_ms?: number | undefined;
22
161
  html?: string | undefined;
23
162
  metadata?: Record<string, string> | undefined;
163
+ output?: {
164
+ audio: {
165
+ codec: "aac";
166
+ };
167
+ video: {
168
+ codec: "h264";
169
+ };
170
+ container: "mp4";
171
+ } | {
172
+ container: "jpeg";
173
+ quality?: number | undefined;
174
+ } | {
175
+ container: "png";
176
+ compression?: number | undefined;
177
+ transparency?: boolean | undefined;
178
+ } | {
179
+ container: "webp";
180
+ quality?: number | undefined;
181
+ compression?: number | undefined;
182
+ transparency?: boolean | undefined;
183
+ } | undefined;
24
184
  }, {
25
185
  width?: number | undefined;
26
186
  height?: number | undefined;
@@ -31,7 +191,274 @@ export declare const CreateRenderPayload: z.ZodObject<{
31
191
  work_slice_ms?: number | undefined;
32
192
  html?: string | undefined;
33
193
  metadata?: Record<string, string> | undefined;
194
+ output?: {
195
+ audio: {
196
+ codec: "aac";
197
+ };
198
+ video: {
199
+ codec: "h264";
200
+ };
201
+ container: "mp4";
202
+ } | {
203
+ container: "jpeg";
204
+ quality?: number | undefined;
205
+ } | {
206
+ container: "png";
207
+ compression?: number | undefined;
208
+ transparency?: boolean | undefined;
209
+ } | {
210
+ container: "webp";
211
+ quality?: number | undefined;
212
+ compression?: number | undefined;
213
+ transparency?: boolean | undefined;
214
+ } | undefined;
34
215
  }>;
216
+ export declare const CreateRenderPayloadWithOutput: z.ZodObject<z.objectUtil.extendShape<{
217
+ md5: z.ZodOptional<z.ZodString>;
218
+ fps: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
219
+ width: z.ZodOptional<z.ZodNumber>;
220
+ height: z.ZodOptional<z.ZodNumber>;
221
+ work_slice_ms: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
222
+ html: z.ZodOptional<z.ZodString>;
223
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
224
+ duration_ms: z.ZodOptional<z.ZodNumber>;
225
+ strategy: z.ZodOptional<z.ZodDefault<z.ZodEnum<["v1"]>>>;
226
+ output: z.ZodOptional<z.ZodDefault<z.ZodDiscriminatedUnion<"container", [z.ZodObject<{
227
+ container: z.ZodLiteral<"mp4">;
228
+ video: z.ZodObject<{
229
+ codec: z.ZodLiteral<"h264">;
230
+ }, "strip", z.ZodTypeAny, {
231
+ codec: "h264";
232
+ }, {
233
+ codec: "h264";
234
+ }>;
235
+ audio: z.ZodObject<{
236
+ codec: z.ZodLiteral<"aac">;
237
+ }, "strip", z.ZodTypeAny, {
238
+ codec: "aac";
239
+ }, {
240
+ codec: "aac";
241
+ }>;
242
+ }, "strip", z.ZodTypeAny, {
243
+ audio: {
244
+ codec: "aac";
245
+ };
246
+ video: {
247
+ codec: "h264";
248
+ };
249
+ container: "mp4";
250
+ }, {
251
+ audio: {
252
+ codec: "aac";
253
+ };
254
+ video: {
255
+ codec: "h264";
256
+ };
257
+ container: "mp4";
258
+ }>, z.ZodObject<{
259
+ container: z.ZodLiteral<"jpeg">;
260
+ quality: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
261
+ }, "strip", z.ZodTypeAny, {
262
+ container: "jpeg";
263
+ quality?: number | undefined;
264
+ }, {
265
+ container: "jpeg";
266
+ quality?: number | undefined;
267
+ }>, z.ZodObject<{
268
+ container: z.ZodLiteral<"png">;
269
+ compression: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
270
+ transparency: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
271
+ }, "strip", z.ZodTypeAny, {
272
+ container: "png";
273
+ compression?: number | undefined;
274
+ transparency?: boolean | undefined;
275
+ }, {
276
+ container: "png";
277
+ compression?: number | undefined;
278
+ transparency?: boolean | undefined;
279
+ }>, z.ZodObject<{
280
+ container: z.ZodLiteral<"webp">;
281
+ quality: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
282
+ compression: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
283
+ transparency: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
284
+ }, "strip", z.ZodTypeAny, {
285
+ container: "webp";
286
+ quality?: number | undefined;
287
+ compression?: number | undefined;
288
+ transparency?: boolean | undefined;
289
+ }, {
290
+ container: "webp";
291
+ quality?: number | undefined;
292
+ compression?: number | undefined;
293
+ transparency?: boolean | undefined;
294
+ }>]>>>;
295
+ }, {
296
+ output: z.ZodDiscriminatedUnion<"container", [z.ZodObject<{
297
+ container: z.ZodLiteral<"mp4">;
298
+ video: z.ZodObject<{
299
+ codec: z.ZodLiteral<"h264">;
300
+ }, "strip", z.ZodTypeAny, {
301
+ codec: "h264";
302
+ }, {
303
+ codec: "h264";
304
+ }>;
305
+ audio: z.ZodObject<{
306
+ codec: z.ZodLiteral<"aac">;
307
+ }, "strip", z.ZodTypeAny, {
308
+ codec: "aac";
309
+ }, {
310
+ codec: "aac";
311
+ }>;
312
+ }, "strip", z.ZodTypeAny, {
313
+ audio: {
314
+ codec: "aac";
315
+ };
316
+ video: {
317
+ codec: "h264";
318
+ };
319
+ container: "mp4";
320
+ }, {
321
+ audio: {
322
+ codec: "aac";
323
+ };
324
+ video: {
325
+ codec: "h264";
326
+ };
327
+ container: "mp4";
328
+ }>, z.ZodObject<{
329
+ container: z.ZodLiteral<"jpeg">;
330
+ quality: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
331
+ }, "strip", z.ZodTypeAny, {
332
+ container: "jpeg";
333
+ quality?: number | undefined;
334
+ }, {
335
+ container: "jpeg";
336
+ quality?: number | undefined;
337
+ }>, z.ZodObject<{
338
+ container: z.ZodLiteral<"png">;
339
+ compression: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
340
+ transparency: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
341
+ }, "strip", z.ZodTypeAny, {
342
+ container: "png";
343
+ compression?: number | undefined;
344
+ transparency?: boolean | undefined;
345
+ }, {
346
+ container: "png";
347
+ compression?: number | undefined;
348
+ transparency?: boolean | undefined;
349
+ }>, z.ZodObject<{
350
+ container: z.ZodLiteral<"webp">;
351
+ quality: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
352
+ compression: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
353
+ transparency: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
354
+ }, "strip", z.ZodTypeAny, {
355
+ container: "webp";
356
+ quality?: number | undefined;
357
+ compression?: number | undefined;
358
+ transparency?: boolean | undefined;
359
+ }, {
360
+ container: "webp";
361
+ quality?: number | undefined;
362
+ compression?: number | undefined;
363
+ transparency?: boolean | undefined;
364
+ }>]>;
365
+ }>, "strip", z.ZodTypeAny, {
366
+ output: {
367
+ audio: {
368
+ codec: "aac";
369
+ };
370
+ video: {
371
+ codec: "h264";
372
+ };
373
+ container: "mp4";
374
+ } | {
375
+ container: "jpeg";
376
+ quality?: number | undefined;
377
+ } | {
378
+ container: "png";
379
+ compression?: number | undefined;
380
+ transparency?: boolean | undefined;
381
+ } | {
382
+ container: "webp";
383
+ quality?: number | undefined;
384
+ compression?: number | undefined;
385
+ transparency?: boolean | undefined;
386
+ };
387
+ width?: number | undefined;
388
+ height?: number | undefined;
389
+ md5?: string | undefined;
390
+ strategy?: "v1" | undefined;
391
+ duration_ms?: number | undefined;
392
+ fps?: number | undefined;
393
+ work_slice_ms?: number | undefined;
394
+ html?: string | undefined;
395
+ metadata?: Record<string, string> | undefined;
396
+ }, {
397
+ output: {
398
+ audio: {
399
+ codec: "aac";
400
+ };
401
+ video: {
402
+ codec: "h264";
403
+ };
404
+ container: "mp4";
405
+ } | {
406
+ container: "jpeg";
407
+ quality?: number | undefined;
408
+ } | {
409
+ container: "png";
410
+ compression?: number | undefined;
411
+ transparency?: boolean | undefined;
412
+ } | {
413
+ container: "webp";
414
+ quality?: number | undefined;
415
+ compression?: number | undefined;
416
+ transparency?: boolean | undefined;
417
+ };
418
+ width?: number | undefined;
419
+ height?: number | undefined;
420
+ md5?: string | undefined;
421
+ strategy?: "v1" | undefined;
422
+ duration_ms?: number | undefined;
423
+ fps?: number | undefined;
424
+ work_slice_ms?: number | undefined;
425
+ html?: string | undefined;
426
+ metadata?: Record<string, string> | undefined;
427
+ }>;
428
+ export declare class OutputConfiguration {
429
+ readonly output: RenderOutputConfiguration;
430
+ static parse(input?: any): OutputConfiguration;
431
+ constructor(output: RenderOutputConfiguration);
432
+ get isStill(): boolean;
433
+ get isVideo(): boolean;
434
+ get fileExtension(): "mp4" | "jpeg" | "png" | "webp";
435
+ get contentType(): string;
436
+ get container(): "mp4" | "jpeg" | "png" | "webp";
437
+ get jpegConfig(): {
438
+ container: "jpeg";
439
+ quality?: number | undefined;
440
+ } | null;
441
+ get pngConfig(): {
442
+ container: "png";
443
+ compression?: number | undefined;
444
+ transparency?: boolean | undefined;
445
+ } | null;
446
+ get webpConfig(): {
447
+ container: "webp";
448
+ quality?: number | undefined;
449
+ compression?: number | undefined;
450
+ transparency?: boolean | undefined;
451
+ } | null;
452
+ get mp4Config(): {
453
+ audio: {
454
+ codec: "aac";
455
+ };
456
+ video: {
457
+ codec: "h264";
458
+ };
459
+ container: "mp4";
460
+ } | null;
461
+ }
35
462
  export interface CreateRenderPayload {
36
463
  md5?: string;
37
464
  fps?: number;
@@ -42,6 +469,7 @@ export interface CreateRenderPayload {
42
469
  duration_ms?: number;
43
470
  metadata?: Record<string, string>;
44
471
  strategy?: "v1";
472
+ output?: z.infer<typeof RenderOutputConfiguration>;
45
473
  }
46
474
  export interface CreateRenderResult {
47
475
  id: string;
@@ -2,6 +2,38 @@ import debug from "debug";
2
2
  import { z } from "zod";
3
3
  import { CompletionIterator } from "../ProgressIterator.js";
4
4
  const log = debug("ef:api:renders");
5
+ const H264Configuration = z.object({
6
+ codec: z.literal("h264")
7
+ });
8
+ const AACConfiguration = z.object({
9
+ codec: z.literal("aac")
10
+ });
11
+ const MP4Configuration = z.object({
12
+ container: z.literal("mp4"),
13
+ video: H264Configuration,
14
+ audio: AACConfiguration
15
+ });
16
+ const JpegConfiguration = z.object({
17
+ container: z.literal("jpeg"),
18
+ quality: z.number().int().min(1).max(100).default(80).optional()
19
+ });
20
+ const PngConfiguration = z.object({
21
+ container: z.literal("png"),
22
+ compression: z.number().int().min(1).max(100).default(80).optional(),
23
+ transparency: z.boolean().default(false).optional()
24
+ });
25
+ const WebpConfiguration = z.object({
26
+ container: z.literal("webp"),
27
+ quality: z.number().int().min(1).max(100).default(80).optional(),
28
+ compression: z.number().int().min(0).max(6).default(4).optional(),
29
+ transparency: z.boolean().default(false).optional()
30
+ });
31
+ const RenderOutputConfiguration = z.discriminatedUnion("container", [
32
+ MP4Configuration,
33
+ JpegConfiguration,
34
+ PngConfiguration,
35
+ WebpConfiguration
36
+ ]);
5
37
  const CreateRenderPayload = z.object({
6
38
  md5: z.string().optional(),
7
39
  fps: z.number().int().min(1).max(120).default(30).optional(),
@@ -11,12 +43,82 @@ const CreateRenderPayload = z.object({
11
43
  html: z.string().optional(),
12
44
  metadata: z.record(z.string(), z.string()).optional(),
13
45
  duration_ms: z.number().int().optional(),
14
- strategy: z.enum(["v1"]).default("v1").optional()
46
+ strategy: z.enum(["v1"]).default("v1").optional(),
47
+ output: RenderOutputConfiguration.default({
48
+ container: "mp4",
49
+ video: {
50
+ codec: "h264"
51
+ },
52
+ audio: {
53
+ codec: "aac"
54
+ }
55
+ }).optional()
56
+ });
57
+ CreateRenderPayload.extend({
58
+ output: RenderOutputConfiguration
15
59
  });
60
+ class OutputConfiguration {
61
+ constructor(output) {
62
+ this.output = output;
63
+ }
64
+ static parse(input) {
65
+ const output = RenderOutputConfiguration.parse(
66
+ input ?? {
67
+ container: "mp4",
68
+ video: {
69
+ codec: "h264"
70
+ },
71
+ audio: {
72
+ codec: "aac"
73
+ }
74
+ }
75
+ );
76
+ return new OutputConfiguration(output);
77
+ }
78
+ get isStill() {
79
+ return this.output.container === "jpeg" || this.output.container === "png" || this.output.container === "webp";
80
+ }
81
+ get isVideo() {
82
+ return this.output.container === "mp4";
83
+ }
84
+ get fileExtension() {
85
+ return this.output.container;
86
+ }
87
+ get contentType() {
88
+ if (this.isStill) {
89
+ return `image/${this.fileExtension}`;
90
+ }
91
+ return `video/${this.fileExtension}`;
92
+ }
93
+ get container() {
94
+ return this.output.container;
95
+ }
96
+ get jpegConfig() {
97
+ return this.output.container === "jpeg" ? this.output : null;
98
+ }
99
+ get pngConfig() {
100
+ return this.output.container === "png" ? this.output : null;
101
+ }
102
+ get webpConfig() {
103
+ return this.output.container === "webp" ? this.output : null;
104
+ }
105
+ get mp4Config() {
106
+ return this.output.container === "mp4" ? this.output : null;
107
+ }
108
+ }
16
109
  const createRender = async (client, payload) => {
17
110
  log("Creating render", payload);
18
111
  payload.strategy ??= "v1";
19
112
  payload.work_slice_ms ??= 4e3;
113
+ payload.output ??= {
114
+ container: "mp4",
115
+ video: {
116
+ codec: "h264"
117
+ },
118
+ audio: {
119
+ codec: "aac"
120
+ }
121
+ };
20
122
  const response = await client.authenticatedFetch("/api/v1/renders", {
21
123
  method: "POST",
22
124
  body: JSON.stringify(payload)
@@ -84,6 +186,8 @@ const downloadRender = async (client, id) => {
84
186
  };
85
187
  export {
86
188
  CreateRenderPayload,
189
+ OutputConfiguration,
190
+ RenderOutputConfiguration,
87
191
  createRender,
88
192
  downloadRender,
89
193
  getRenderInfo,
@@ -49,7 +49,6 @@ function uploadChunks(client, {
49
49
  }
50
50
  log("Checking upload status", url);
51
51
  const uploadStatus = await client.authenticatedFetch(url);
52
- console.log("UPLOAD STATUS", url, uploadStatus);
53
52
  yield { type: "progress", progress: 0 };
54
53
  if (uploadStatus.status === 200) {
55
54
  log("Chunk already uploaded");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@editframe/api",
3
- "version": "0.16.4-beta.0",
3
+ "version": "0.16.7-beta.0",
4
4
  "description": "API functions for EditFrame",
5
5
  "exports": {
6
6
  ".": {
@@ -45,7 +45,7 @@
45
45
  "vite-plugin-dts": "^4.0.3"
46
46
  },
47
47
  "dependencies": {
48
- "@editframe/assets": "0.16.4-beta.0",
48
+ "@editframe/assets": "0.16.7-beta.0",
49
49
  "@vitejs/plugin-react": "^4.3.4",
50
50
  "debug": "^4.3.5",
51
51
  "eventsource-parser": "^3.0.0",
@@ -54,7 +54,7 @@
54
54
  "mime-types": "^2.1.35",
55
55
  "node-fetch": "^3.3.2",
56
56
  "tar": "^7.4.3",
57
- "vite": "^5.4.11",
57
+ "vite": "^6.3.5",
58
58
  "vite-plugin-singlefile": "^2.1.0",
59
59
  "vite-tsconfig-paths": "^4.3.2",
60
60
  "zod": "^3.23.8"