@editframe/api 0.15.0-beta.9 → 0.16.0-beta.1

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.
@@ -10,14 +10,14 @@ export declare const AudioStreamSchema: z.ZodObject<{
10
10
  sample_fmt: z.ZodString;
11
11
  sample_rate: z.ZodString;
12
12
  channels: z.ZodNumber;
13
- channel_layout: z.ZodString;
13
+ channel_layout: z.ZodOptional<z.ZodString>;
14
14
  bits_per_sample: z.ZodNumber;
15
15
  initial_padding: z.ZodOptional<z.ZodNumber>;
16
16
  r_frame_rate: z.ZodString;
17
17
  avg_frame_rate: z.ZodString;
18
18
  time_base: z.ZodString;
19
- start_pts: z.ZodNumber;
20
- start_time: z.ZodNumber;
19
+ start_pts: z.ZodOptional<z.ZodNumber>;
20
+ start_time: z.ZodOptional<z.ZodNumber>;
21
21
  duration_ts: z.ZodNumber;
22
22
  duration: z.ZodNumber;
23
23
  bit_rate: z.ZodString;
@@ -32,18 +32,18 @@ export declare const AudioStreamSchema: z.ZodObject<{
32
32
  sample_fmt: string;
33
33
  sample_rate: string;
34
34
  channels: number;
35
- channel_layout: string;
36
35
  bits_per_sample: number;
37
36
  r_frame_rate: string;
38
37
  avg_frame_rate: string;
39
38
  time_base: string;
40
- start_pts: number;
41
- start_time: number;
42
39
  duration_ts: number;
43
40
  duration: number;
44
41
  bit_rate: string;
45
42
  disposition: Record<string, unknown>;
43
+ channel_layout?: string | undefined;
46
44
  initial_padding?: number | undefined;
45
+ start_pts?: number | undefined;
46
+ start_time?: number | undefined;
47
47
  }, {
48
48
  index: number;
49
49
  codec_name: string;
@@ -54,18 +54,18 @@ export declare const AudioStreamSchema: z.ZodObject<{
54
54
  sample_fmt: string;
55
55
  sample_rate: string;
56
56
  channels: number;
57
- channel_layout: string;
58
57
  bits_per_sample: number;
59
58
  r_frame_rate: string;
60
59
  avg_frame_rate: string;
61
60
  time_base: string;
62
- start_pts: number;
63
- start_time: number;
64
61
  duration_ts: number;
65
62
  duration: number;
66
63
  bit_rate: string;
67
64
  disposition: Record<string, unknown>;
65
+ channel_layout?: string | undefined;
68
66
  initial_padding?: number | undefined;
67
+ start_pts?: number | undefined;
68
+ start_time?: number | undefined;
69
69
  }>;
70
70
  export interface AudioStreamSchema {
71
71
  /** The index of the stream in the file */
@@ -87,7 +87,7 @@ export interface AudioStreamSchema {
87
87
  /** The number of channels */
88
88
  channels: number;
89
89
  /** The channel layout */
90
- channel_layout: string;
90
+ channel_layout?: string;
91
91
  /** The number of bits per sample */
92
92
  bits_per_sample: number;
93
93
  /** The initial padding */
@@ -99,9 +99,9 @@ export interface AudioStreamSchema {
99
99
  /** The time base */
100
100
  time_base: string;
101
101
  /** The start presentation timestamp */
102
- start_pts: number;
102
+ start_pts?: number;
103
103
  /** The start time */
104
- start_time: number;
104
+ start_time?: number;
105
105
  /** The duration timestamp */
106
106
  duration_ts: number;
107
107
  /** The duration */
@@ -226,14 +226,14 @@ export declare const AudioTrackPayload: z.ZodObject<{
226
226
  sample_fmt: z.ZodString;
227
227
  sample_rate: z.ZodString;
228
228
  channels: z.ZodNumber;
229
- channel_layout: z.ZodString;
229
+ channel_layout: z.ZodOptional<z.ZodString>;
230
230
  bits_per_sample: z.ZodNumber;
231
231
  initial_padding: z.ZodOptional<z.ZodNumber>;
232
232
  r_frame_rate: z.ZodString;
233
233
  avg_frame_rate: z.ZodString;
234
234
  time_base: z.ZodString;
235
- start_pts: z.ZodNumber;
236
- start_time: z.ZodNumber;
235
+ start_pts: z.ZodOptional<z.ZodNumber>;
236
+ start_time: z.ZodOptional<z.ZodNumber>;
237
237
  duration_ts: z.ZodNumber;
238
238
  duration: z.ZodNumber;
239
239
  bit_rate: z.ZodString;
@@ -248,18 +248,18 @@ export declare const AudioTrackPayload: z.ZodObject<{
248
248
  sample_fmt: string;
249
249
  sample_rate: string;
250
250
  channels: number;
251
- channel_layout: string;
252
251
  bits_per_sample: number;
253
252
  r_frame_rate: string;
254
253
  avg_frame_rate: string;
255
254
  time_base: string;
256
- start_pts: number;
257
- start_time: number;
258
255
  duration_ts: number;
259
256
  duration: number;
260
257
  bit_rate: string;
261
258
  disposition: Record<string, unknown>;
259
+ channel_layout?: string | undefined;
262
260
  initial_padding?: number | undefined;
261
+ start_pts?: number | undefined;
262
+ start_time?: number | undefined;
263
263
  }, {
264
264
  index: number;
265
265
  codec_name: string;
@@ -270,18 +270,18 @@ export declare const AudioTrackPayload: z.ZodObject<{
270
270
  sample_fmt: string;
271
271
  sample_rate: string;
272
272
  channels: number;
273
- channel_layout: string;
274
273
  bits_per_sample: number;
275
274
  r_frame_rate: string;
276
275
  avg_frame_rate: string;
277
276
  time_base: string;
278
- start_pts: number;
279
- start_time: number;
280
277
  duration_ts: number;
281
278
  duration: number;
282
279
  bit_rate: string;
283
280
  disposition: Record<string, unknown>;
281
+ channel_layout?: string | undefined;
284
282
  initial_padding?: number | undefined;
283
+ start_pts?: number | undefined;
284
+ start_time?: number | undefined;
285
285
  }>;
286
286
  duration_ms: z.ZodNumber;
287
287
  codec_name: z.ZodString;
@@ -302,18 +302,18 @@ export declare const AudioTrackPayload: z.ZodObject<{
302
302
  sample_fmt: string;
303
303
  sample_rate: string;
304
304
  channels: number;
305
- channel_layout: string;
306
305
  bits_per_sample: number;
307
306
  r_frame_rate: string;
308
307
  avg_frame_rate: string;
309
308
  time_base: string;
310
- start_pts: number;
311
- start_time: number;
312
309
  duration_ts: number;
313
310
  duration: number;
314
311
  bit_rate: string;
315
312
  disposition: Record<string, unknown>;
313
+ channel_layout?: string | undefined;
316
314
  initial_padding?: number | undefined;
315
+ start_pts?: number | undefined;
316
+ start_time?: number | undefined;
317
317
  };
318
318
  duration_ms: number;
319
319
  }, {
@@ -332,18 +332,18 @@ export declare const AudioTrackPayload: z.ZodObject<{
332
332
  sample_fmt: string;
333
333
  sample_rate: string;
334
334
  channels: number;
335
- channel_layout: string;
336
335
  bits_per_sample: number;
337
336
  r_frame_rate: string;
338
337
  avg_frame_rate: string;
339
338
  time_base: string;
340
- start_pts: number;
341
- start_time: number;
342
339
  duration_ts: number;
343
340
  duration: number;
344
341
  bit_rate: string;
345
342
  disposition: Record<string, unknown>;
343
+ channel_layout?: string | undefined;
346
344
  initial_padding?: number | undefined;
345
+ start_pts?: number | undefined;
346
+ start_time?: number | undefined;
347
347
  };
348
348
  duration_ms: number;
349
349
  }>;
@@ -504,14 +504,14 @@ export declare const CreateISOBMFFTrackPayload: z.ZodDiscriminatedUnion<"type",
504
504
  sample_fmt: z.ZodString;
505
505
  sample_rate: z.ZodString;
506
506
  channels: z.ZodNumber;
507
- channel_layout: z.ZodString;
507
+ channel_layout: z.ZodOptional<z.ZodString>;
508
508
  bits_per_sample: z.ZodNumber;
509
509
  initial_padding: z.ZodOptional<z.ZodNumber>;
510
510
  r_frame_rate: z.ZodString;
511
511
  avg_frame_rate: z.ZodString;
512
512
  time_base: z.ZodString;
513
- start_pts: z.ZodNumber;
514
- start_time: z.ZodNumber;
513
+ start_pts: z.ZodOptional<z.ZodNumber>;
514
+ start_time: z.ZodOptional<z.ZodNumber>;
515
515
  duration_ts: z.ZodNumber;
516
516
  duration: z.ZodNumber;
517
517
  bit_rate: z.ZodString;
@@ -526,18 +526,18 @@ export declare const CreateISOBMFFTrackPayload: z.ZodDiscriminatedUnion<"type",
526
526
  sample_fmt: string;
527
527
  sample_rate: string;
528
528
  channels: number;
529
- channel_layout: string;
530
529
  bits_per_sample: number;
531
530
  r_frame_rate: string;
532
531
  avg_frame_rate: string;
533
532
  time_base: string;
534
- start_pts: number;
535
- start_time: number;
536
533
  duration_ts: number;
537
534
  duration: number;
538
535
  bit_rate: string;
539
536
  disposition: Record<string, unknown>;
537
+ channel_layout?: string | undefined;
540
538
  initial_padding?: number | undefined;
539
+ start_pts?: number | undefined;
540
+ start_time?: number | undefined;
541
541
  }, {
542
542
  index: number;
543
543
  codec_name: string;
@@ -548,18 +548,18 @@ export declare const CreateISOBMFFTrackPayload: z.ZodDiscriminatedUnion<"type",
548
548
  sample_fmt: string;
549
549
  sample_rate: string;
550
550
  channels: number;
551
- channel_layout: string;
552
551
  bits_per_sample: number;
553
552
  r_frame_rate: string;
554
553
  avg_frame_rate: string;
555
554
  time_base: string;
556
- start_pts: number;
557
- start_time: number;
558
555
  duration_ts: number;
559
556
  duration: number;
560
557
  bit_rate: string;
561
558
  disposition: Record<string, unknown>;
559
+ channel_layout?: string | undefined;
562
560
  initial_padding?: number | undefined;
561
+ start_pts?: number | undefined;
562
+ start_time?: number | undefined;
563
563
  }>;
564
564
  duration_ms: z.ZodNumber;
565
565
  codec_name: z.ZodString;
@@ -580,18 +580,18 @@ export declare const CreateISOBMFFTrackPayload: z.ZodDiscriminatedUnion<"type",
580
580
  sample_fmt: string;
581
581
  sample_rate: string;
582
582
  channels: number;
583
- channel_layout: string;
584
583
  bits_per_sample: number;
585
584
  r_frame_rate: string;
586
585
  avg_frame_rate: string;
587
586
  time_base: string;
588
- start_pts: number;
589
- start_time: number;
590
587
  duration_ts: number;
591
588
  duration: number;
592
589
  bit_rate: string;
593
590
  disposition: Record<string, unknown>;
591
+ channel_layout?: string | undefined;
594
592
  initial_padding?: number | undefined;
593
+ start_pts?: number | undefined;
594
+ start_time?: number | undefined;
595
595
  };
596
596
  duration_ms: number;
597
597
  }, {
@@ -610,18 +610,18 @@ export declare const CreateISOBMFFTrackPayload: z.ZodDiscriminatedUnion<"type",
610
610
  sample_fmt: string;
611
611
  sample_rate: string;
612
612
  channels: number;
613
- channel_layout: string;
614
613
  bits_per_sample: number;
615
614
  r_frame_rate: string;
616
615
  avg_frame_rate: string;
617
616
  time_base: string;
618
- start_pts: number;
619
- start_time: number;
620
617
  duration_ts: number;
621
618
  duration: number;
622
619
  bit_rate: string;
623
620
  disposition: Record<string, unknown>;
621
+ channel_layout?: string | undefined;
624
622
  initial_padding?: number | undefined;
623
+ start_pts?: number | undefined;
624
+ start_time?: number | undefined;
625
625
  };
626
626
  duration_ms: number;
627
627
  }>, z.ZodObject<{
@@ -11,14 +11,14 @@ const AudioStreamSchema = z.object({
11
11
  sample_fmt: z.string(),
12
12
  sample_rate: z.string(),
13
13
  channels: z.number(),
14
- channel_layout: z.string(),
14
+ channel_layout: z.string().optional(),
15
15
  bits_per_sample: z.number(),
16
16
  initial_padding: z.number().optional(),
17
17
  r_frame_rate: z.string(),
18
18
  avg_frame_rate: z.string(),
19
19
  time_base: z.string(),
20
- start_pts: z.number(),
21
- start_time: z.coerce.number(),
20
+ start_pts: z.number().optional(),
21
+ start_time: z.coerce.number().optional(),
22
22
  duration_ts: z.number(),
23
23
  duration: z.coerce.number(),
24
24
  bit_rate: z.string(),
@@ -6,7 +6,7 @@ export interface IsobmffProcessInfoResult {
6
6
  completed_at: string | null;
7
7
  failed_at: string | null;
8
8
  isobmff_file_id: string | null;
9
- unprocessed_file_id: string;
9
+ unprocessed_file_id: string | null;
10
10
  }
11
11
  export declare const getIsobmffProcessProgress: (client: Client, id: string) => Promise<ProgressIterator>;
12
12
  export declare const getIsobmffProcessInfo: (client: Client, id: string) => Promise<IsobmffProcessInfoResult>;
@@ -8,6 +8,7 @@ export declare const CreateRenderPayload: z.ZodObject<{
8
8
  height: z.ZodOptional<z.ZodNumber>;
9
9
  work_slice_ms: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
10
10
  html: z.ZodOptional<z.ZodString>;
11
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
11
12
  duration_ms: z.ZodOptional<z.ZodNumber>;
12
13
  strategy: z.ZodOptional<z.ZodDefault<z.ZodEnum<["v1"]>>>;
13
14
  }, "strip", z.ZodTypeAny, {
@@ -19,6 +20,7 @@ export declare const CreateRenderPayload: z.ZodObject<{
19
20
  fps?: number | undefined;
20
21
  work_slice_ms?: number | undefined;
21
22
  html?: string | undefined;
23
+ metadata?: Record<string, string> | undefined;
22
24
  }, {
23
25
  width?: number | undefined;
24
26
  height?: number | undefined;
@@ -28,6 +30,7 @@ export declare const CreateRenderPayload: z.ZodObject<{
28
30
  fps?: number | undefined;
29
31
  work_slice_ms?: number | undefined;
30
32
  html?: string | undefined;
33
+ metadata?: Record<string, string> | undefined;
31
34
  }>;
32
35
  export interface CreateRenderPayload {
33
36
  md5?: string;
@@ -37,17 +40,20 @@ export interface CreateRenderPayload {
37
40
  work_slice_ms?: number;
38
41
  html?: string;
39
42
  duration_ms?: number;
43
+ metadata?: Record<string, string>;
40
44
  strategy?: "v1";
41
45
  }
42
46
  export interface CreateRenderResult {
43
47
  id: string;
44
- md5: string;
48
+ md5: string | null;
45
49
  status: "complete" | "created" | "failed" | "pending" | "rendering" | string;
50
+ metadata: Record<string, string>;
46
51
  }
47
52
  export interface LookupRenderByMd5Result {
48
53
  id: string;
49
- md5: string;
54
+ md5: string | null;
50
55
  status: "complete" | "created" | "failed" | "pending" | "rendering" | string;
56
+ metadata: Record<string, string>;
51
57
  }
52
58
  export declare const createRender: (client: Client, payload: CreateRenderPayload) => Promise<CreateRenderResult>;
53
59
  export declare const uploadRender: (client: Client, renderId: string, fileStream: ReadableStream) => Promise<any>;
@@ -9,6 +9,7 @@ const CreateRenderPayload = z.object({
9
9
  height: z.number().int().min(2).optional(),
10
10
  work_slice_ms: z.number().int().min(1e3).max(1e4).default(4e3).optional(),
11
11
  html: z.string().optional(),
12
+ metadata: z.record(z.string(), z.string()).optional(),
12
13
  duration_ms: z.number().int().optional(),
13
14
  strategy: z.enum(["v1"]).default("v1").optional()
14
15
  });
@@ -49,6 +49,7 @@ 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);
52
53
  yield { type: "progress", progress: 0 };
53
54
  if (uploadStatus.status === 200) {
54
55
  log("Chunk already uploaded");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@editframe/api",
3
- "version": "0.15.0-beta.9",
3
+ "version": "0.16.0-beta.1",
4
4
  "description": "API functions for EditFrame",
5
5
  "exports": {
6
6
  ".": {
@@ -38,23 +38,25 @@
38
38
  "license": "UNLICENSED",
39
39
  "devDependencies": {
40
40
  "@types/jsonwebtoken": "^9.0.6",
41
+ "@types/mime-types": "^2.1.4",
41
42
  "@types/node": "^20.14.13",
42
43
  "typedoc": "^0.26.5",
43
44
  "typescript": "^5.5.4",
44
45
  "vite-plugin-dts": "^4.0.3"
45
46
  },
46
47
  "dependencies": {
47
- "@editframe/assets": "0.15.0-beta.9",
48
+ "@editframe/assets": "0.16.0-beta.1",
48
49
  "@vitejs/plugin-react": "^4.3.4",
49
- "vite-tsconfig-paths": "^4.3.2",
50
- "vite": "^5.4.11",
51
50
  "debug": "^4.3.5",
52
51
  "eventsource-parser": "^3.0.0",
53
52
  "jsonwebtoken": "^9.0.2",
54
53
  "mime": "^4.0.4",
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
58
  "vite-plugin-singlefile": "^2.1.0",
59
+ "vite-tsconfig-paths": "^4.3.2",
58
60
  "zod": "^3.23.8"
59
61
  }
60
62
  }
@@ -6,6 +6,7 @@ import { ZodError } from "zod";
6
6
  import { Client } from "../client.js";
7
7
  import { webReadableFromBuffers } from "../readableFromBuffers.js";
8
8
  import {
9
+ CreateImageFilePayload,
9
10
  createImageFile,
10
11
  lookupImageFileByMd5,
11
12
  uploadImageFile,
@@ -19,6 +20,28 @@ const UploadMustContinue = (id = "test-file") =>
19
20
  HttpResponse.json({}, { status: 202 }),
20
21
  );
21
22
 
23
+ describe("CreateImageFilePayload", () => {
24
+ test("parses mime type from filename", () => {
25
+ const payload = CreateImageFilePayload.parse({
26
+ byte_size: 100,
27
+ filename: "test.jpg",
28
+ });
29
+
30
+ expect(payload.mime_type).toBe("image/jpeg");
31
+ });
32
+
33
+ test("rejects unsupported mime types", () => {
34
+ const payload = CreateImageFilePayload.safeParse({
35
+ byte_size: 100,
36
+ filename: "test.txt",
37
+ });
38
+
39
+ expect(
40
+ payload.error?.issues.some((issue) => issue.path.includes("mime_type")),
41
+ ).toBe(true);
42
+ });
43
+ });
44
+
22
45
  describe("ImageFile", () => {
23
46
  beforeAll(() => server.listen());
24
47
  afterEach(() => server.resetHandlers());
@@ -1,4 +1,5 @@
1
1
  import debug from "debug";
2
+ import { types } from "mime-types";
2
3
  import { z } from "zod";
3
4
 
4
5
  import type { Client } from "../client.js";
@@ -8,32 +9,63 @@ const log = debug("ef:api:image-file");
8
9
 
9
10
  const MAX_IMAGE_SIZE = 1024 * 1024 * 16; // 16MB
10
11
 
11
- export const CreateImageFilePayload = z.object({
12
- /**
13
- * The md5 hash of the image file.
14
- */
15
- md5: z.string().nullable(),
16
- /**
17
- * The height of the image file in pixels.
18
- */
19
- height: z.number().int().nullable(),
20
- /**
21
- * The width of the image file in pixels.
22
- */
23
- width: z.number().int().nullable(),
24
- /**
25
- * The mime type of the image file.
26
- */
27
- mime_type: z.enum(["image/jpeg", "image/png", "image/jpg", "image/webp"]),
28
- /**
29
- * The filename of the image file.
30
- */
31
- filename: z.string(),
32
- /**
33
- * The byte size of the image file.
34
- */
35
- byte_size: z.number().int().max(MAX_IMAGE_SIZE),
36
- });
12
+ export const ImageFileMimeTypes = z.enum([
13
+ "image/jpeg",
14
+ "image/png",
15
+ "image/jpg",
16
+ "image/webp",
17
+ ]);
18
+
19
+ function getFileExtension(path: string) {
20
+ const match = path.match(/\.([^.]+)$/);
21
+ return match ? match[1] : null;
22
+ }
23
+
24
+ export const CreateImageFilePayload = z
25
+ .object({
26
+ /**
27
+ * The md5 hash of the image file.
28
+ */
29
+ md5: z.string().optional(),
30
+ /**
31
+ * The height of the image file in pixels.
32
+ */
33
+ height: z.number().int().optional(),
34
+ /**
35
+ * The width of the image file in pixels.
36
+ */
37
+ width: z.number().int().optional(),
38
+ /**
39
+ * The mime type of the image file. Optional if the filename has a known file extension.
40
+ */
41
+ mime_type: ImageFileMimeTypes.optional(),
42
+ /**
43
+ * The filename of the image file.
44
+ */
45
+ filename: z.string(),
46
+ /**
47
+ * The byte size of the image file.
48
+ */
49
+ byte_size: z.number().int().max(MAX_IMAGE_SIZE),
50
+ })
51
+ .superRefine((data, ctx) => {
52
+ const extension = getFileExtension(data.filename);
53
+ const mimeType = extension ? types[extension] : null;
54
+ const parsedMimeType = ImageFileMimeTypes.safeParse(mimeType).data;
55
+
56
+ if (parsedMimeType) {
57
+ data.mime_type = parsedMimeType;
58
+ }
59
+
60
+ if (!parsedMimeType && !data.mime_type) {
61
+ ctx.addIssue({
62
+ code: z.ZodIssueCode.custom,
63
+ message:
64
+ "mime_type is required when filename extension doesn't match a known image type",
65
+ path: ["mime_type"],
66
+ });
67
+ }
68
+ });
37
69
 
38
70
  export type CreateImageFilePayload = z.infer<typeof CreateImageFilePayload>;
39
71
 
@@ -53,16 +85,39 @@ export interface CreateImageFileResult {
53
85
  /**
54
86
  * The md5 hash of the image file.
55
87
  */
56
- md5: string;
88
+ md5: string | null;
57
89
  }
58
90
 
59
91
  export interface LookupImageFileByMd5Result {
92
+ /**
93
+ * Whether the image file has been fully uploaded.
94
+ */
60
95
  complete: boolean | null;
96
+ /**
97
+ * The byte size of the image file.
98
+ */
61
99
  byte_size: number;
100
+ /**
101
+ * The id of the image file.
102
+ */
62
103
  id: string;
63
- md5: string;
104
+ /**
105
+ * md5 hash of the image file.
106
+ */
107
+ md5: string | null;
108
+ /**
109
+ * The height of the image file in pixels.
110
+ */
111
+ height: number | null;
112
+ /**
113
+ * The width of the image file in pixels.
114
+ */
115
+ width: number | null;
64
116
  }
65
117
 
118
+ export interface GetImageFileMetadataResult
119
+ extends LookupImageFileByMd5Result {}
120
+
66
121
  export const createImageFile = async (
67
122
  client: Client,
68
123
  payload: CreateImageFilePayload,
@@ -92,6 +147,7 @@ export const uploadImageFile = (
92
147
  byte_size: number;
93
148
  },
94
149
  fileStream: ReadableStream,
150
+ chunkSizeBytes?: number,
95
151
  ) => {
96
152
  log("Uploading image file", uploadDetails.id);
97
153
 
@@ -100,9 +156,28 @@ export const uploadImageFile = (
100
156
  fileSize: uploadDetails.byte_size,
101
157
  fileStream,
102
158
  maxSize: MAX_IMAGE_SIZE,
159
+ chunkSizeBytes,
103
160
  });
104
161
  };
105
162
 
163
+ export const getImageFileMetadata = async (
164
+ client: Client,
165
+ id: string,
166
+ ): Promise<GetImageFileMetadataResult | null> => {
167
+ const response = await client.authenticatedFetch(
168
+ `/api/v1/image_files/${id}.json`,
169
+ {
170
+ method: "GET",
171
+ },
172
+ );
173
+
174
+ if (response.ok) {
175
+ return (await response.json()) as LookupImageFileByMd5Result;
176
+ }
177
+
178
+ return null;
179
+ };
180
+
106
181
  export const lookupImageFileByMd5 = async (
107
182
  client: Client,
108
183
  md5: string,
@@ -14,14 +14,14 @@ export const AudioStreamSchema = z.object({
14
14
  sample_fmt: z.string(),
15
15
  sample_rate: z.string(),
16
16
  channels: z.number(),
17
- channel_layout: z.string(),
17
+ channel_layout: z.string().optional(),
18
18
  bits_per_sample: z.number(),
19
19
  initial_padding: z.number().optional(),
20
20
  r_frame_rate: z.string(),
21
21
  avg_frame_rate: z.string(),
22
22
  time_base: z.string(),
23
- start_pts: z.number(),
24
- start_time: z.coerce.number(),
23
+ start_pts: z.number().optional(),
24
+ start_time: z.coerce.number().optional(),
25
25
  duration_ts: z.number(),
26
26
  duration: z.coerce.number(),
27
27
  bit_rate: z.string(),
@@ -48,7 +48,7 @@ export interface AudioStreamSchema {
48
48
  /** The number of channels */
49
49
  channels: number;
50
50
  /** The channel layout */
51
- channel_layout: string;
51
+ channel_layout?: string;
52
52
  /** The number of bits per sample */
53
53
  bits_per_sample: number;
54
54
  /** The initial padding */
@@ -60,9 +60,9 @@ export interface AudioStreamSchema {
60
60
  /** The time base */
61
61
  time_base: string;
62
62
  /** The start presentation timestamp */
63
- start_pts: number;
63
+ start_pts?: number;
64
64
  /** The start time */
65
- start_time: number;
65
+ start_time?: number;
66
66
  /** The duration timestamp */
67
67
  duration_ts: number;
68
68
  /** The duration */
@@ -7,7 +7,7 @@ export interface IsobmffProcessInfoResult {
7
7
  completed_at: string | null;
8
8
  failed_at: string | null;
9
9
  isobmff_file_id: string | null;
10
- unprocessed_file_id: string;
10
+ unprocessed_file_id: string | null;
11
11
  }
12
12
 
13
13
  export const getIsobmffProcessProgress = async (client: Client, id: string) => {