@editframe/api 0.16.7-beta.0 → 0.17.6-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/node.js CHANGED
@@ -1,11 +1,5 @@
1
- import { stat } from "node:fs/promises";
2
- import { basename } from "node:path";
3
- import mime from "mime";
4
- import { md5FilePath } from "@editframe/assets";
5
- import { createImageFile, CreateImageFilePayload } from "./resources/image-file.js";
6
- import { ImageFileMimeTypes, getImageFileMetadata, lookupImageFileByMd5, uploadImageFile } from "./resources/image-file.js";
7
- import { createUnprocessedFile, uploadUnprocessedReadableStream } from "./resources/unprocessed-file.js";
8
- import { CreateUnprocessedFilePayload, lookupUnprocessedFileByMd5, processIsobmffFile } from "./resources/unprocessed-file.js";
1
+ import { CreateImageFilePayload, ImageFileMimeTypes, createImageFile, getImageFileMetadata, lookupImageFileByMd5, uploadImageFile } from "./resources/image-file.js";
2
+ import { CreateUnprocessedFilePayload, createUnprocessedFile, lookupUnprocessedFileByMd5, processIsobmffFile, uploadUnprocessedReadableStream } from "./resources/unprocessed-file.js";
9
3
  import { createReadableStreamFromReadable } from "./utils/createReadableStreamFromReadable.js";
10
4
  import { CreateCaptionFilePayload, createCaptionFile, lookupCaptionFileByMd5, uploadCaptionFile } from "./resources/caption-file.js";
11
5
  import { CreateISOBMFFFilePayload, TranscribeISOBMFFFilePayload, createISOBMFFFile, getISOBMFFFileTranscription, lookupISOBMFFFileByMd5, transcribeISOBMFFFile, uploadFragmentIndex } from "./resources/isobmff-file.js";
@@ -15,89 +9,39 @@ import { CreateRenderPayload, OutputConfiguration, RenderOutputConfiguration, cr
15
9
  import { CreateTranscriptionPayload, createTranscription, getTranscriptionInfo, getTranscriptionProgress } from "./resources/transcriptions.js";
16
10
  import { createURLToken } from "./resources/url-token.js";
17
11
  import { Client } from "./client.js";
18
- const createImageFileFromPath = async (client, path) => {
19
- const fileInfo = await stat(path);
20
- const byte_size = fileInfo.size;
21
- const md5 = await md5FilePath(path);
22
- const mime_type = mime.getType(path);
23
- return createImageFile(client, {
24
- ...CreateImageFilePayload.parse({
25
- md5,
26
- height: 0,
27
- width: 0,
28
- mime_type,
29
- filename: basename(path),
30
- byte_size
31
- })
32
- });
33
- };
34
- const createUnprocessedFileFromPath = async (client, path) => {
35
- const fileInfo = await stat(path);
36
- const byte_size = fileInfo.size;
37
- const md5 = await md5FilePath(path);
38
- return createUnprocessedFile(client, {
39
- md5,
40
- filename: basename(path),
41
- byte_size
42
- });
12
+ import "./index.js";
13
+ import { stat } from "node:fs/promises";
14
+ import { basename } from "node:path";
15
+ import mime from "mime";
16
+ import { md5FilePath } from "@editframe/assets";
17
+ const createImageFileFromPath = async (client, path$1) => {
18
+ const fileInfo = await stat(path$1);
19
+ const byte_size = fileInfo.size;
20
+ const md5 = await md5FilePath(path$1);
21
+ const mime_type = mime.getType(path$1);
22
+ return createImageFile(client, { ...CreateImageFilePayload.parse({
23
+ md5,
24
+ height: 0,
25
+ width: 0,
26
+ mime_type,
27
+ filename: basename(path$1),
28
+ byte_size
29
+ }) });
43
30
  };
44
- const uploadUnprocessedFile = async (client, uploadDetails, path) => {
45
- const { createReadStream } = await import("node:fs");
46
- const readStream = createReadStream(path);
47
- const { createReadableStreamFromReadable: createReadableStreamFromReadable2 } = await import("./utils/createReadableStreamFromReadable.js");
48
- return uploadUnprocessedReadableStream(
49
- client,
50
- uploadDetails,
51
- createReadableStreamFromReadable2(readStream)
52
- );
31
+ const createUnprocessedFileFromPath = async (client, path$1) => {
32
+ const fileInfo = await stat(path$1);
33
+ const byte_size = fileInfo.size;
34
+ const md5 = await md5FilePath(path$1);
35
+ return createUnprocessedFile(client, {
36
+ md5,
37
+ filename: basename(path$1),
38
+ byte_size
39
+ });
53
40
  };
54
- export {
55
- AudioTrackPayload,
56
- Client,
57
- CreateCaptionFilePayload,
58
- CreateISOBMFFFilePayload,
59
- CreateISOBMFFTrackPayload,
60
- CreateImageFilePayload,
61
- CreateRenderPayload,
62
- CreateTranscriptionPayload,
63
- CreateUnprocessedFilePayload,
64
- ImageFileMimeTypes,
65
- OutputConfiguration,
66
- RenderOutputConfiguration,
67
- TranscribeISOBMFFFilePayload,
68
- VideoTrackPayload,
69
- createCaptionFile,
70
- createISOBMFFFile,
71
- createISOBMFFTrack,
72
- createImageFile,
73
- createImageFileFromPath,
74
- createReadableStreamFromReadable,
75
- createRender,
76
- createTranscription,
77
- createURLToken,
78
- createUnprocessedFile,
79
- createUnprocessedFileFromPath,
80
- downloadRender,
81
- getISOBMFFFileTranscription,
82
- getImageFileMetadata,
83
- getIsobmffProcessInfo,
84
- getIsobmffProcessProgress,
85
- getRenderInfo,
86
- getRenderProgress,
87
- getTranscriptionInfo,
88
- getTranscriptionProgress,
89
- lookupCaptionFileByMd5,
90
- lookupISOBMFFFileByMd5,
91
- lookupImageFileByMd5,
92
- lookupRenderByMd5,
93
- lookupUnprocessedFileByMd5,
94
- processIsobmffFile,
95
- transcribeISOBMFFFile,
96
- uploadCaptionFile,
97
- uploadFragmentIndex,
98
- uploadISOBMFFTrack,
99
- uploadImageFile,
100
- uploadRender,
101
- uploadUnprocessedFile,
102
- uploadUnprocessedReadableStream
41
+ const uploadUnprocessedFile = async (client, uploadDetails, path$1) => {
42
+ const { createReadStream } = await import("node:fs");
43
+ const readStream = createReadStream(path$1);
44
+ const { createReadableStreamFromReadable: createReadableStreamFromReadable$1 } = await import("./utils/createReadableStreamFromReadable.js");
45
+ return uploadUnprocessedReadableStream(client, uploadDetails, createReadableStreamFromReadable$1(readStream));
103
46
  };
47
+ export { AudioTrackPayload, Client, CreateCaptionFilePayload, CreateISOBMFFFilePayload, CreateISOBMFFTrackPayload, CreateImageFilePayload, CreateRenderPayload, CreateTranscriptionPayload, CreateUnprocessedFilePayload, ImageFileMimeTypes, OutputConfiguration, RenderOutputConfiguration, TranscribeISOBMFFFilePayload, VideoTrackPayload, createCaptionFile, createISOBMFFFile, createISOBMFFTrack, createImageFile, createImageFileFromPath, createReadableStreamFromReadable, createRender, createTranscription, createURLToken, createUnprocessedFile, createUnprocessedFileFromPath, downloadRender, getISOBMFFFileTranscription, getImageFileMetadata, getIsobmffProcessInfo, getIsobmffProcessProgress, getRenderInfo, getRenderProgress, getTranscriptionInfo, getTranscriptionProgress, lookupCaptionFileByMd5, lookupISOBMFFFileByMd5, lookupImageFileByMd5, lookupRenderByMd5, lookupUnprocessedFileByMd5, processIsobmffFile, transcribeISOBMFFFile, uploadCaptionFile, uploadFragmentIndex, uploadISOBMFFTrack, uploadImageFile, uploadRender, uploadUnprocessedFile, uploadUnprocessedReadableStream };
@@ -3,82 +3,58 @@ import { z } from "zod";
3
3
  const log = debug("ef:api:caption-file");
4
4
  const MAX_CAPTION_SIZE = 1024 * 1024 * 2;
5
5
  const CreateCaptionFilePayload = z.object({
6
- /**
7
- * The md5 hash of the caption file
8
- */
9
- md5: z.string(),
10
- /**
11
- * The filename of the caption file
12
- */
13
- filename: z.string(),
14
- /**
15
- * The size of the caption file in bytes
16
- */
17
- byte_size: z.number().int().max(MAX_CAPTION_SIZE)
6
+ md5: z.string(),
7
+ filename: z.string(),
8
+ byte_size: z.number().int().max(MAX_CAPTION_SIZE)
18
9
  });
19
10
  const restrictSize = (size) => {
20
- if (size > MAX_CAPTION_SIZE) {
21
- throw new Error(
22
- `File size ${size} bytes exceeds limit ${MAX_CAPTION_SIZE} bytes
23
- `
24
- );
25
- }
11
+ if (size > MAX_CAPTION_SIZE) throw new Error(`File size ${size} bytes exceeds limit ${MAX_CAPTION_SIZE} bytes\n`);
26
12
  };
13
+ /**
14
+ * Create a caption file
15
+ * @param client - The authenticated client to use for the request
16
+ * @param payload - The payload to send to the server
17
+ * @returns The result of the request
18
+ * @example
19
+ * ```ts
20
+ * const result = await createCaptionFile(client, {
21
+ * id: "123",
22
+ * filename: "caption.srt",
23
+ * });
24
+ * console.log(result);
25
+ * ```
26
+ * @category CaptionFile
27
+ * @resource
28
+ * @beta
29
+ */
27
30
  const createCaptionFile = async (client, payload) => {
28
- log("Creating caption file", payload);
29
- restrictSize(payload.byte_size);
30
- const response = await client.authenticatedFetch("/api/v1/caption_files", {
31
- method: "POST",
32
- body: JSON.stringify(payload)
33
- });
34
- log("Caption file created", response);
35
- if (response.ok) {
36
- return await response.json();
37
- }
38
- throw new Error(
39
- `Failed to create caption ${response.status} ${response.statusText}`
40
- );
31
+ log("Creating caption file", payload);
32
+ restrictSize(payload.byte_size);
33
+ const response = await client.authenticatedFetch("/api/v1/caption_files", {
34
+ method: "POST",
35
+ body: JSON.stringify(payload)
36
+ });
37
+ log("Caption file created", response);
38
+ if (response.ok) return await response.json();
39
+ throw new Error(`Failed to create caption ${response.status} ${response.statusText}`);
41
40
  };
42
41
  const uploadCaptionFile = async (client, fileId, fileStream, fileSize) => {
43
- log("Uploading caption file", fileId);
44
- restrictSize(fileSize);
45
- const response = await client.authenticatedFetch(
46
- `/api/v1/caption_files/${fileId}/upload`,
47
- {
48
- method: "POST",
49
- body: fileStream,
50
- duplex: "half"
51
- }
52
- );
53
- log("Caption file uploaded", response);
54
- if (response.ok) {
55
- return response.json();
56
- }
57
- throw new Error(
58
- `Failed to upload caption ${response.status} ${response.statusText}`
59
- );
42
+ log("Uploading caption file", fileId);
43
+ restrictSize(fileSize);
44
+ const response = await client.authenticatedFetch(`/api/v1/caption_files/${fileId}/upload`, {
45
+ method: "POST",
46
+ body: fileStream,
47
+ duplex: "half"
48
+ });
49
+ log("Caption file uploaded", response);
50
+ if (response.ok) return response.json();
51
+ throw new Error(`Failed to upload caption ${response.status} ${response.statusText}`);
60
52
  };
61
53
  const lookupCaptionFileByMd5 = async (client, md5) => {
62
- const response = await client.authenticatedFetch(
63
- `/api/v1/caption_files/md5/${md5}`,
64
- {
65
- method: "GET"
66
- }
67
- );
68
- log("Caption file lookup", response);
69
- if (response.ok) {
70
- return await response.json();
71
- }
72
- if (response.status === 404) {
73
- return null;
74
- }
75
- throw new Error(
76
- `Failed to lookup caption by md5 ${md5} ${response.status} ${response.statusText}`
77
- );
78
- };
79
- export {
80
- CreateCaptionFilePayload,
81
- createCaptionFile,
82
- lookupCaptionFileByMd5,
83
- uploadCaptionFile
54
+ const response = await client.authenticatedFetch(`/api/v1/caption_files/md5/${md5}`, { method: "GET" });
55
+ log("Caption file lookup", response);
56
+ if (response.ok) return await response.json();
57
+ if (response.status === 404) return null;
58
+ throw new Error(`Failed to lookup caption by md5 ${md5} ${response.status} ${response.statusText}`);
84
59
  };
60
+ export { CreateCaptionFilePayload, createCaptionFile, lookupCaptionFileByMd5, uploadCaptionFile };
@@ -1,119 +1,68 @@
1
+ import { uploadChunks } from "../uploadChunks.js";
1
2
  import debug from "debug";
2
3
  import { types } from "mime-types";
3
4
  import { z } from "zod";
4
- import { uploadChunks } from "../uploadChunks.js";
5
5
  const log = debug("ef:api:image-file");
6
6
  const MAX_IMAGE_SIZE = 1024 * 1024 * 16;
7
7
  const ImageFileMimeTypes = z.enum([
8
- "image/jpeg",
9
- "image/png",
10
- "image/jpg",
11
- "image/webp"
8
+ "image/jpeg",
9
+ "image/png",
10
+ "image/jpg",
11
+ "image/webp"
12
12
  ]);
13
13
  function getFileExtension(path) {
14
- const match = path.match(/\.([^.]+)$/);
15
- return match ? match[1] : null;
14
+ const match = path.match(/\.([^.]+)$/);
15
+ return match ? match[1] : null;
16
16
  }
17
17
  const CreateImageFilePayload = z.object({
18
- /**
19
- * The md5 hash of the image file.
20
- */
21
- md5: z.string().optional(),
22
- /**
23
- * The height of the image file in pixels.
24
- */
25
- height: z.number().int().optional(),
26
- /**
27
- * The width of the image file in pixels.
28
- */
29
- width: z.number().int().optional(),
30
- /**
31
- * The mime type of the image file. Optional if the filename has a known file extension.
32
- */
33
- mime_type: ImageFileMimeTypes.optional(),
34
- /**
35
- * The filename of the image file.
36
- */
37
- filename: z.string(),
38
- /**
39
- * The byte size of the image file.
40
- */
41
- byte_size: z.number().int().max(MAX_IMAGE_SIZE)
18
+ md5: z.string().optional(),
19
+ height: z.number().int().optional(),
20
+ width: z.number().int().optional(),
21
+ mime_type: ImageFileMimeTypes.optional(),
22
+ filename: z.string(),
23
+ byte_size: z.number().int().max(MAX_IMAGE_SIZE)
42
24
  }).superRefine((data, ctx) => {
43
- const extension = getFileExtension(data.filename);
44
- const mimeType = extension ? types[extension] : null;
45
- const parsedMimeType = ImageFileMimeTypes.safeParse(mimeType).data;
46
- if (parsedMimeType) {
47
- data.mime_type = parsedMimeType;
48
- }
49
- if (!parsedMimeType && !data.mime_type) {
50
- ctx.addIssue({
51
- code: z.ZodIssueCode.custom,
52
- message: "mime_type is required when filename extension doesn't match a known image type",
53
- path: ["mime_type"]
54
- });
55
- }
25
+ const extension = getFileExtension(data.filename);
26
+ const mimeType = extension ? types[extension] : null;
27
+ const parsedMimeType = ImageFileMimeTypes.safeParse(mimeType).data;
28
+ if (parsedMimeType) data.mime_type = parsedMimeType;
29
+ if (!parsedMimeType && !data.mime_type) ctx.addIssue({
30
+ code: z.ZodIssueCode.custom,
31
+ message: "mime_type is required when filename extension doesn't match a known image type",
32
+ path: ["mime_type"]
33
+ });
56
34
  });
57
35
  const createImageFile = async (client, payload) => {
58
- log("Creating image file", payload);
59
- CreateImageFilePayload.parse(payload);
60
- const response = await client.authenticatedFetch("/api/v1/image_files", {
61
- method: "POST",
62
- body: JSON.stringify(payload)
63
- });
64
- log("Image file created", response);
65
- if (response.ok) {
66
- return await response.json();
67
- }
68
- throw new Error(
69
- `Failed to create file ${response.status} ${response.statusText}`
70
- );
36
+ log("Creating image file", payload);
37
+ CreateImageFilePayload.parse(payload);
38
+ const response = await client.authenticatedFetch("/api/v1/image_files", {
39
+ method: "POST",
40
+ body: JSON.stringify(payload)
41
+ });
42
+ log("Image file created", response);
43
+ if (response.ok) return await response.json();
44
+ throw new Error(`Failed to create file ${response.status} ${response.statusText}`);
71
45
  };
72
46
  const uploadImageFile = (client, uploadDetails, fileStream, chunkSizeBytes) => {
73
- log("Uploading image file", uploadDetails.id);
74
- return uploadChunks(client, {
75
- url: `/api/v1/image_files/${uploadDetails.id}/upload`,
76
- fileSize: uploadDetails.byte_size,
77
- fileStream,
78
- maxSize: MAX_IMAGE_SIZE,
79
- chunkSizeBytes
80
- });
47
+ log("Uploading image file", uploadDetails.id);
48
+ return uploadChunks(client, {
49
+ url: `/api/v1/image_files/${uploadDetails.id}/upload`,
50
+ fileSize: uploadDetails.byte_size,
51
+ fileStream,
52
+ maxSize: MAX_IMAGE_SIZE,
53
+ chunkSizeBytes
54
+ });
81
55
  };
82
56
  const getImageFileMetadata = async (client, id) => {
83
- const response = await client.authenticatedFetch(
84
- `/api/v1/image_files/${id}.json`,
85
- {
86
- method: "GET"
87
- }
88
- );
89
- if (response.ok) {
90
- return await response.json();
91
- }
92
- return null;
57
+ const response = await client.authenticatedFetch(`/api/v1/image_files/${id}.json`, { method: "GET" });
58
+ if (response.ok) return await response.json();
59
+ return null;
93
60
  };
94
61
  const lookupImageFileByMd5 = async (client, md5) => {
95
- const response = await client.authenticatedFetch(
96
- `/api/v1/image_files/md5/${md5}`,
97
- {
98
- method: "GET"
99
- }
100
- );
101
- log("Image file lookup", response);
102
- if (response.ok) {
103
- return await response.json();
104
- }
105
- if (response.status === 404) {
106
- return null;
107
- }
108
- throw new Error(
109
- `Failed to lookup image by md5 ${md5} ${response.status} ${response.statusText}`
110
- );
111
- };
112
- export {
113
- CreateImageFilePayload,
114
- ImageFileMimeTypes,
115
- createImageFile,
116
- getImageFileMetadata,
117
- lookupImageFileByMd5,
118
- uploadImageFile
62
+ const response = await client.authenticatedFetch(`/api/v1/image_files/md5/${md5}`, { method: "GET" });
63
+ log("Image file lookup", response);
64
+ if (response.ok) return await response.json();
65
+ if (response.status === 404) return null;
66
+ throw new Error(`Failed to lookup image by md5 ${md5} ${response.status} ${response.statusText}`);
119
67
  };
68
+ export { CreateImageFilePayload, ImageFileMimeTypes, createImageFile, getImageFileMetadata, lookupImageFileByMd5, uploadImageFile };
@@ -3,100 +3,51 @@ import { z } from "zod";
3
3
  const log = debug("ef:api:isobmff-file");
4
4
  const FILE_SIZE_LIMIT = 1024 * 1024 * 2;
5
5
  const CreateISOBMFFFilePayload = z.object({
6
- md5: z.string(),
7
- filename: z.string()
6
+ md5: z.string(),
7
+ filename: z.string()
8
8
  });
9
9
  const createISOBMFFFile = async (client, payload) => {
10
- log("Creating isobmff file", payload);
11
- const response = await client.authenticatedFetch("/api/v1/isobmff_files", {
12
- method: "POST",
13
- body: JSON.stringify(payload)
14
- });
15
- log("ISOBMFF file created", response);
16
- if (response.ok) {
17
- return await response.json();
18
- }
19
- throw new Error(
20
- `Failed to create isobmff file ${response.status} ${response.statusText}`
21
- );
10
+ log("Creating isobmff file", payload);
11
+ const response = await client.authenticatedFetch("/api/v1/isobmff_files", {
12
+ method: "POST",
13
+ body: JSON.stringify(payload)
14
+ });
15
+ log("ISOBMFF file created", response);
16
+ if (response.ok) return await response.json();
17
+ throw new Error(`Failed to create isobmff file ${response.status} ${response.statusText}`);
22
18
  };
23
19
  const uploadFragmentIndex = async (client, fileId, fileStream, fileSize) => {
24
- log("Uploading fragment index", fileId);
25
- if (fileSize > FILE_SIZE_LIMIT) {
26
- throw new Error(`File size exceeds limit of ${FILE_SIZE_LIMIT} bytes`);
27
- }
28
- const response = await client.authenticatedFetch(
29
- `/api/v1/isobmff_files/${fileId}/index/upload`,
30
- {
31
- method: "POST",
32
- body: fileStream,
33
- duplex: "half"
34
- }
35
- );
36
- log("Fragment index uploaded", response);
37
- if (response.ok) {
38
- return response.json();
39
- }
40
- throw new Error(
41
- `Failed to create fragment index ${response.status} ${response.statusText}`
42
- );
20
+ log("Uploading fragment index", fileId);
21
+ if (fileSize > FILE_SIZE_LIMIT) throw new Error(`File size exceeds limit of ${FILE_SIZE_LIMIT} bytes`);
22
+ const response = await client.authenticatedFetch(`/api/v1/isobmff_files/${fileId}/index/upload`, {
23
+ method: "POST",
24
+ body: fileStream,
25
+ duplex: "half"
26
+ });
27
+ log("Fragment index uploaded", response);
28
+ if (response.ok) return response.json();
29
+ throw new Error(`Failed to create fragment index ${response.status} ${response.statusText}`);
43
30
  };
44
31
  const lookupISOBMFFFileByMd5 = async (client, md5) => {
45
- const response = await client.authenticatedFetch(
46
- `/api/v1/isobmff_files/md5/${md5}`,
47
- {
48
- method: "GET"
49
- }
50
- );
51
- log("ISOBMFF file lookup", response);
52
- if (response.ok) {
53
- return await response.json();
54
- }
55
- if (response.status === 404) {
56
- return null;
57
- }
58
- throw new Error(
59
- `Failed to lookup isobmff file by md5 ${md5} ${response.status} ${response.statusText}`
60
- );
32
+ const response = await client.authenticatedFetch(`/api/v1/isobmff_files/md5/${md5}`, { method: "GET" });
33
+ log("ISOBMFF file lookup", response);
34
+ if (response.ok) return await response.json();
35
+ if (response.status === 404) return null;
36
+ throw new Error(`Failed to lookup isobmff file by md5 ${md5} ${response.status} ${response.statusText}`);
61
37
  };
62
38
  const getISOBMFFFileTranscription = async (client, id) => {
63
- const response = await client.authenticatedFetch(
64
- `/api/v1/isobmff_files/${id}/transcription`
65
- );
66
- if (response.ok) {
67
- return await response.json();
68
- }
69
- if (response.status === 404) {
70
- return null;
71
- }
72
- throw new Error(
73
- `Failed to get isobmff file transcription ${id} ${response.status} ${response.statusText}`
74
- );
39
+ const response = await client.authenticatedFetch(`/api/v1/isobmff_files/${id}/transcription`);
40
+ if (response.ok) return await response.json();
41
+ if (response.status === 404) return null;
42
+ throw new Error(`Failed to get isobmff file transcription ${id} ${response.status} ${response.statusText}`);
75
43
  };
76
- const TranscribeISOBMFFFilePayload = z.object({
77
- trackId: z.string().optional()
78
- });
44
+ const TranscribeISOBMFFFilePayload = z.object({ trackId: z.string().optional() });
79
45
  const transcribeISOBMFFFile = async (client, id, payload = {}) => {
80
- const response = await client.authenticatedFetch(
81
- `/api/v1/isobmff_files/${id}/transcribe`,
82
- {
83
- method: "POST",
84
- body: JSON.stringify(payload)
85
- }
86
- );
87
- if (response.ok) {
88
- return await response.json();
89
- }
90
- throw new Error(
91
- `Failed to transcribe isobmff file ${id} ${response.status} ${response.statusText}`
92
- );
93
- };
94
- export {
95
- CreateISOBMFFFilePayload,
96
- TranscribeISOBMFFFilePayload,
97
- createISOBMFFFile,
98
- getISOBMFFFileTranscription,
99
- lookupISOBMFFFileByMd5,
100
- transcribeISOBMFFFile,
101
- uploadFragmentIndex
46
+ const response = await client.authenticatedFetch(`/api/v1/isobmff_files/${id}/transcribe`, {
47
+ method: "POST",
48
+ body: JSON.stringify(payload)
49
+ });
50
+ if (response.ok) return await response.json();
51
+ throw new Error(`Failed to transcribe isobmff file ${id} ${response.status} ${response.statusText}`);
102
52
  };
53
+ export { CreateISOBMFFFilePayload, TranscribeISOBMFFFilePayload, createISOBMFFFile, getISOBMFFFileTranscription, lookupISOBMFFFileByMd5, transcribeISOBMFFFile, uploadFragmentIndex };