@editframe/api 0.9.0-beta.1 → 0.10.0-beta.2

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.
@@ -19,7 +19,7 @@ describe("ImageFile", () => {
19
19
  test("Throws when file is too large", async () => {
20
20
  await expect(
21
21
  createImageFile(client, {
22
- id: "test-id",
22
+ md5: "test-md5",
23
23
  filename: "test",
24
24
  byte_size: 1024 * 1024 * 17,
25
25
  height: 100,
@@ -43,14 +43,14 @@ describe("ImageFile", () => {
43
43
 
44
44
  test("Throws when server returns an error", async () => {
45
45
  server.use(
46
- http.post("http://localhost/api/video2/image_files", () =>
46
+ http.post("http://localhost/api/v1/image_files", () =>
47
47
  HttpResponse.text("Internal Server Error", { status: 500 }),
48
48
  ),
49
49
  );
50
50
 
51
51
  await expect(
52
52
  createImageFile(client, {
53
- id: "test-id",
53
+ md5: "test-md5",
54
54
  filename: "test",
55
55
  byte_size: 4,
56
56
  height: 100,
@@ -62,16 +62,16 @@ describe("ImageFile", () => {
62
62
 
63
63
  test("Returns json data from the http response", async () => {
64
64
  server.use(
65
- http.post("http://localhost/api/video2/image_files", () =>
65
+ http.post("http://localhost/api/v1/image_files", () =>
66
66
  HttpResponse.json(
67
- { id: "test-id" },
67
+ { md5: "test-md5" },
68
68
  { status: 200, statusText: "OK" },
69
69
  ),
70
70
  ),
71
71
  );
72
72
 
73
73
  const response = await createImageFile(client, {
74
- id: "test-id",
74
+ md5: "test-md5",
75
75
  filename: "test",
76
76
  byte_size: 4,
77
77
  height: 100,
@@ -79,7 +79,7 @@ describe("ImageFile", () => {
79
79
  mime_type: "image/jpeg",
80
80
  });
81
81
 
82
- expect(response).toEqual({ id: "test-id" });
82
+ expect(response).toEqual({ md5: "test-md5" });
83
83
  });
84
84
  });
85
85
 
@@ -100,7 +100,7 @@ describe("ImageFile", () => {
100
100
  test("Throws if upload fails", async () => {
101
101
  server.use(
102
102
  http.post(
103
- "http://localhost/api/video2/image_files/test-file-id/upload",
103
+ "http://localhost/api/v1/image_files/test-file-id/upload",
104
104
  () => HttpResponse.text("Internal Server Error", { status: 500 }),
105
105
  ),
106
106
  );
@@ -113,14 +113,14 @@ describe("ImageFile", () => {
113
113
  4,
114
114
  ),
115
115
  ).rejects.toThrowError(
116
- "Failed to upload chunk 0 for /api/video2/image_files/test-file-id/upload 500 Internal Server Error",
116
+ "Failed to upload chunk 0 for /api/v1/image_files/test-file-id/upload 500 Internal Server Error",
117
117
  );
118
118
  });
119
119
 
120
120
  test("Uploads file", async () => {
121
121
  server.use(
122
122
  http.post(
123
- "http://localhost/api/video2/image_files/test-file-id/upload",
123
+ "http://localhost/api/v1/image_files/test-file-id/upload",
124
124
  () => HttpResponse.json(null, { status: 201 }),
125
125
  ),
126
126
  );
@@ -11,7 +11,7 @@ const log = debug("ef:api:image-file");
11
11
  const MAX_IMAGE_SIZE = 1024 * 1024 * 16; // 16MB
12
12
 
13
13
  export const CreateImageFilePayload = z.object({
14
- id: z.string(),
14
+ md5: z.string(),
15
15
  height: z.number().int(),
16
16
  width: z.number().int(),
17
17
  mime_type: z.enum(["image/jpeg", "image/png", "image/jpg", "image/webp"]),
@@ -22,7 +22,8 @@ export const CreateImageFilePayload = z.object({
22
22
  export interface CreateImageFileResult {
23
23
  complete: boolean | null;
24
24
  id: string;
25
- assetId: string;
25
+ md5: string;
26
+ asset_id: string;
26
27
  }
27
28
 
28
29
  export const createImageFile = async (
@@ -31,7 +32,7 @@ export const createImageFile = async (
31
32
  ) => {
32
33
  log("Creating image file", payload);
33
34
  CreateImageFilePayload.parse(payload);
34
- const response = await client.authenticatedFetch("/api/video2/image_files", {
35
+ const response = await client.authenticatedFetch("/api/v1/image_files", {
35
36
  method: "POST",
36
37
  body: JSON.stringify(payload),
37
38
  });
@@ -61,7 +62,7 @@ export const uploadImageFile = async (
61
62
  }
62
63
 
63
64
  const result = await uploadChunks(client, {
64
- url: `/api/video2/image_files/${fileId}/upload`,
65
+ url: `/api/v1/image_files/${fileId}/upload`,
65
66
  fileSize,
66
67
  fileStream,
67
68
  });
@@ -17,14 +17,14 @@ describe("ISOBMFFFile", () => {
17
17
  describe("createISOBMFFFile", () => {
18
18
  test("Throws when server returns an error", async () => {
19
19
  server.use(
20
- http.post("http://localhost/api/video2/isobmff_files", () =>
20
+ http.post("http://localhost/api/v1/isobmff_files", () =>
21
21
  HttpResponse.text("Internal Server Error", { status: 500 }),
22
22
  ),
23
23
  );
24
24
 
25
25
  await expect(
26
26
  createISOBMFFFile(client, {
27
- id: "test-id",
27
+ md5: "test-md5",
28
28
  filename: "test",
29
29
  }),
30
30
  ).rejects.toThrowError(
@@ -34,7 +34,7 @@ describe("ISOBMFFFile", () => {
34
34
 
35
35
  test("Returns json data from the http response", async () => {
36
36
  server.use(
37
- http.post("http://localhost/api/video2/isobmff_files", () =>
37
+ http.post("http://localhost/api/v1/isobmff_files", () =>
38
38
  HttpResponse.json(
39
39
  { id: "test-id" },
40
40
  { status: 200, statusText: "OK" },
@@ -43,7 +43,7 @@ describe("ISOBMFFFile", () => {
43
43
  );
44
44
 
45
45
  const response = await createISOBMFFFile(client, {
46
- id: "test-id",
46
+ md5: "test-md5",
47
47
  filename: "test",
48
48
  });
49
49
 
@@ -66,7 +66,7 @@ describe("ISOBMFFFile", () => {
66
66
  test("Throws when server returns an error", async () => {
67
67
  server.use(
68
68
  http.post(
69
- "http://localhost/api/video2/isobmff_files/test-id/index/upload",
69
+ "http://localhost/api/v1/isobmff_files/test-id/index/upload",
70
70
  () => HttpResponse.text("Internal Server Error", { status: 500 }),
71
71
  ),
72
72
  );
@@ -86,7 +86,7 @@ describe("ISOBMFFFile", () => {
86
86
  test("Returns json data from the http response", async () => {
87
87
  server.use(
88
88
  http.post(
89
- "http://localhost/api/video2/isobmff_files/test-id/index/upload",
89
+ "http://localhost/api/v1/isobmff_files/test-id/index/upload",
90
90
  () =>
91
91
  HttpResponse.json(
92
92
  { fragment_index_complete: true },
@@ -9,14 +9,16 @@ const log = debug("ef:api:isobmff-file");
9
9
  const FILE_SIZE_LIMIT = 1024 * 1024 * 2; // 32MB
10
10
 
11
11
  export const CreateISOBMFFFilePayload = z.object({
12
- id: z.string(),
12
+ md5: z.string(),
13
13
  filename: z.string(),
14
14
  });
15
15
 
16
16
  export interface CreateISOBMFFFileResult {
17
17
  fragment_index_complete: boolean;
18
+ filename: string;
18
19
  id: string;
19
- assetId: string;
20
+ md5: string;
21
+ asset_id: string;
20
22
  }
21
23
 
22
24
  export const createISOBMFFFile = async (
@@ -24,13 +26,10 @@ export const createISOBMFFFile = async (
24
26
  payload: z.infer<typeof CreateISOBMFFFilePayload>,
25
27
  ) => {
26
28
  log("Creating isobmff file", payload);
27
- const response = await client.authenticatedFetch(
28
- "/api/video2/isobmff_files",
29
- {
30
- method: "POST",
31
- body: JSON.stringify(payload),
32
- },
33
- );
29
+ const response = await client.authenticatedFetch("/api/v1/isobmff_files", {
30
+ method: "POST",
31
+ body: JSON.stringify(payload),
32
+ });
34
33
 
35
34
  log("ISOBMFF file created", response);
36
35
 
@@ -54,7 +53,7 @@ export const uploadFragmentIndex = async (
54
53
  throw new Error(`File size exceeds limit of ${FILE_SIZE_LIMIT} bytes`);
55
54
  }
56
55
  const response = await client.authenticatedFetch(
57
- `/api/video2/isobmff_files/${fileId}/index/upload`,
56
+ `/api/v1/isobmff_files/${fileId}/index/upload`,
58
57
  {
59
58
  method: "POST",
60
59
  body: fileStream,
@@ -39,7 +39,7 @@ describe("ISOBMFF Track", () => {
39
39
 
40
40
  test("Throws when server returns an error", async () => {
41
41
  server.use(
42
- http.post("http://localhost/api/video2/isobmff_tracks", () =>
42
+ http.post("http://localhost/api/v1/isobmff_tracks", () =>
43
43
  HttpResponse.text("Internal Server Error", { status: 500 }),
44
44
  ),
45
45
  );
@@ -53,7 +53,7 @@ describe("ISOBMFF Track", () => {
53
53
 
54
54
  test("Returns json data from the http response", async () => {
55
55
  server.use(
56
- http.post("http://localhost/api/video2/isobmff_tracks", () =>
56
+ http.post("http://localhost/api/v1/isobmff_tracks", () =>
57
57
  HttpResponse.json(
58
58
  { testResponse: "test" },
59
59
  { status: 200, statusText: "OK" },
@@ -74,7 +74,7 @@ describe("ISOBMFF Track", () => {
74
74
  test("Throws when server returns an error", async () => {
75
75
  server.use(
76
76
  http.post(
77
- "http://localhost/api/video2/isobmff_tracks/test-file/1/upload",
77
+ "http://localhost/api/v1/isobmff_tracks/test-file/1/upload",
78
78
  () => HttpResponse.text("Internal Server Error", { status: 500 }),
79
79
  ),
80
80
  );
@@ -88,14 +88,14 @@ describe("ISOBMFF Track", () => {
88
88
  4,
89
89
  ),
90
90
  ).rejects.toThrowError(
91
- "Failed to upload chunk 0 for /api/video2/isobmff_tracks/test-file/1/upload 500 Internal Server Error",
91
+ "Failed to upload chunk 0 for /api/v1/isobmff_tracks/test-file/1/upload 500 Internal Server Error",
92
92
  );
93
93
  });
94
94
 
95
95
  test("Succeeds when server returns a success", async () => {
96
96
  server.use(
97
97
  http.post(
98
- "http://localhost/api/video2/isobmff_tracks/test-file/1/upload",
98
+ "http://localhost/api/v1/isobmff_tracks/test-file/1/upload",
99
99
  () => HttpResponse.json({}, { status: 201 }),
100
100
  ),
101
101
  );
@@ -46,13 +46,10 @@ export const createISOBMFFTrack = async (
46
46
  ) => {
47
47
  log("Creating isobmff track", payload);
48
48
  CreateISOBMFFTrackPayload.parse(payload);
49
- const response = await client.authenticatedFetch(
50
- "/api/video2/isobmff_tracks",
51
- {
52
- method: "POST",
53
- body: JSON.stringify(payload),
54
- },
55
- );
49
+ const response = await client.authenticatedFetch("/api/v1/isobmff_tracks", {
50
+ method: "POST",
51
+ body: JSON.stringify(payload),
52
+ });
56
53
 
57
54
  log("ISOBMFF track created", response);
58
55
  if (response.ok) {
@@ -74,7 +71,7 @@ export const uploadISOBMFFTrack = async (
74
71
  log("Uploading fragment track", fileId);
75
72
 
76
73
  await uploadChunks(client, {
77
- url: `/api/video2/isobmff_tracks/${fileId}/${trackId}/upload`,
74
+ url: `/api/v1/isobmff_tracks/${fileId}/${trackId}/upload`,
78
75
  fileStream,
79
76
  fileSize: trackSize,
80
77
  });
@@ -17,7 +17,7 @@ describe("Renders", () => {
17
17
  describe("createRender", () => {
18
18
  test("throws if server returns an error", async () => {
19
19
  server.use(
20
- http.post("http://localhost/api/video2/renders", () =>
20
+ http.post("http://localhost/api/v1/renders", () =>
21
21
  HttpResponse.text("Internal Server Error", { status: 500 }),
22
22
  ),
23
23
  );
@@ -31,7 +31,7 @@ describe("Renders", () => {
31
31
 
32
32
  test("returns json data from the http response", async () => {
33
33
  server.use(
34
- http.post("http://localhost/api/video2/renders", () =>
34
+ http.post("http://localhost/api/v1/renders", () =>
35
35
  HttpResponse.json(
36
36
  { testResponse: "test" },
37
37
  { status: 200, statusText: "OK" },
@@ -61,7 +61,7 @@ describe("Renders", () => {
61
61
 
62
62
  test("throws if server returns an error", async () => {
63
63
  server.use(
64
- http.post("http://localhost/api/video2/renders/test-id/upload", () =>
64
+ http.post("http://localhost/api/v1/renders/test-id/upload", () =>
65
65
  HttpResponse.text("Internal Server Error", { status: 500 }),
66
66
  ),
67
67
  );
@@ -80,7 +80,7 @@ describe("Renders", () => {
80
80
 
81
81
  test("returns json data from the http response", async () => {
82
82
  server.use(
83
- http.post("http://localhost/api/video2/renders/test-id/upload", () =>
83
+ http.post("http://localhost/api/v1/renders/test-id/upload", () =>
84
84
  HttpResponse.json(
85
85
  { testResponse: "test" },
86
86
  { status: 200, statusText: "OK" },
@@ -102,7 +102,7 @@ describe("Renders", () => {
102
102
 
103
103
  const createTestRender = () =>
104
104
  ({
105
- id: "test-id",
105
+ md5: "test-md5",
106
106
  fps: 30,
107
107
  width: 1920,
108
108
  height: 1080,
@@ -9,7 +9,7 @@ const log = debug("ef:api:renders");
9
9
  const FILE_SIZE_LIMIT = 1024 * 1024 * 16; // 16MiB
10
10
 
11
11
  export const CreateRenderPayload = z.object({
12
- id: z.string().uuid(),
12
+ md5: z.string(),
13
13
  fps: z.number(),
14
14
  width: z.number().int(),
15
15
  height: z.number().int(),
@@ -19,8 +19,9 @@ export const CreateRenderPayload = z.object({
19
19
  });
20
20
 
21
21
  export interface CreateRenderResult {
22
- status: "complete" | "created" | "failed" | "pending" | "rendering";
23
22
  id: string;
23
+ md5: string;
24
+ status: "complete" | "created" | "failed" | "pending" | "rendering";
24
25
  }
25
26
 
26
27
  export const createRender = async (
@@ -28,7 +29,7 @@ export const createRender = async (
28
29
  payload: z.infer<typeof CreateRenderPayload>,
29
30
  ) => {
30
31
  log("Creating render", payload);
31
- const response = await client.authenticatedFetch("/api/video2/renders", {
32
+ const response = await client.authenticatedFetch("/api/v1/renders", {
32
33
  method: "POST",
33
34
  body: JSON.stringify(payload),
34
35
  });
@@ -55,7 +56,7 @@ export const uploadRender = async (
55
56
  throw new Error(`File size exceeds limit of ${FILE_SIZE_LIMIT} bytes`);
56
57
  }
57
58
  const response = await client.authenticatedFetch(
58
- `/api/video2/renders/${fileId}/upload`,
59
+ `/api/v1/renders/${fileId}/upload`,
59
60
  {
60
61
  method: "POST",
61
62
  body: fileStream,