@editframe/cli 0.7.0-beta.1 → 0.7.0-beta.11

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.
Files changed (53) hide show
  1. package/dist/VERSION.cjs +1 -1
  2. package/dist/VERSION.js +1 -1
  3. package/dist/commands/auth.cjs +14 -11
  4. package/dist/commands/auth.js +15 -12
  5. package/dist/commands/check.cjs +2 -2
  6. package/dist/commands/check.js +2 -2
  7. package/dist/commands/process.cjs +36 -0
  8. package/dist/commands/process.js +35 -0
  9. package/dist/commands/render.cjs +34 -25
  10. package/dist/commands/render.js +34 -25
  11. package/dist/index.cjs +1 -11
  12. package/dist/index.js +1 -12
  13. package/dist/operations/getRenderInfo.cjs +59 -0
  14. package/dist/operations/getRenderInfo.js +59 -0
  15. package/dist/operations/processRenderInfo.cjs +30 -0
  16. package/dist/operations/processRenderInfo.js +30 -0
  17. package/dist/operations/syncAssetsDirectory.cjs +83 -40
  18. package/dist/operations/syncAssetsDirectory.js +82 -39
  19. package/dist/utils/index.cjs +8 -15
  20. package/dist/utils/index.js +8 -15
  21. package/dist/utils/launchBrowserAndWaitForSDK.cjs +7 -3
  22. package/dist/utils/launchBrowserAndWaitForSDK.js +7 -3
  23. package/dist/utils/validateVideoResolution.cjs +27 -0
  24. package/dist/utils/validateVideoResolution.js +27 -0
  25. package/package.json +6 -12
  26. package/src/commands/auth.ts +14 -12
  27. package/src/commands/check.ts +2 -2
  28. package/src/commands/process.ts +43 -37
  29. package/src/commands/render.ts +32 -30
  30. package/src/operations/getRenderInfo.ts +80 -0
  31. package/src/operations/processRenderInfo.ts +37 -0
  32. package/src/operations/syncAssetsDirectory.ts +77 -40
  33. package/src/utils/index.ts +7 -16
  34. package/src/utils/launchBrowserAndWaitForSDK.ts +9 -3
  35. package/src/utils/validateVideoResolution.ts +33 -0
  36. package/dist/api/caption-file.cjs +0 -48
  37. package/dist/api/caption-file.js +0 -48
  38. package/dist/api/image-file.cjs +0 -49
  39. package/dist/api/image-file.js +0 -49
  40. package/dist/api/index.cjs +0 -12
  41. package/dist/api/index.js +0 -12
  42. package/dist/api/isobmff-file.cjs +0 -48
  43. package/dist/api/isobmff-file.js +0 -48
  44. package/dist/api/isobmff-track.cjs +0 -63
  45. package/dist/api/isobmff-track.js +0 -63
  46. package/dist/api/renders.cjs +0 -51
  47. package/dist/api/renders.js +0 -51
  48. package/src/api/caption-file.ts +0 -60
  49. package/src/api/image-file.ts +0 -58
  50. package/src/api/index.ts +0 -17
  51. package/src/api/isobmff-file.ts +0 -59
  52. package/src/api/isobmff-track.ts +0 -77
  53. package/src/api/renders.ts +0 -59
@@ -1,63 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const zod = require("zod");
4
- const assets = require("@editframe/assets");
5
- const index = require("../utils/index.cjs");
6
- const CreateISOBMFFTrackPayload = zod.z.discriminatedUnion("type", [
7
- zod.z.object({
8
- file_id: zod.z.string(),
9
- track_id: zod.z.number().int(),
10
- type: zod.z.literal("audio"),
11
- probe_info: assets.AudioStreamSchema,
12
- duration_ms: zod.z.number().int(),
13
- codec_name: zod.z.string(),
14
- byte_size: zod.z.number().int()
15
- }),
16
- zod.z.object({
17
- file_id: zod.z.string(),
18
- track_id: zod.z.number().int(),
19
- type: zod.z.literal("video"),
20
- probe_info: assets.VideoStreamSchema,
21
- duration_ms: zod.z.number().int(),
22
- codec_name: zod.z.string(),
23
- byte_size: zod.z.number().int()
24
- })
25
- ]);
26
- const createISOBMFFTrack = async (payload) => {
27
- const response = await index.authenticatedFetch("/api/video2/isobmff_tracks", {
28
- method: "POST",
29
- body: JSON.stringify(payload)
30
- });
31
- switch (response.status) {
32
- case 200: {
33
- return await response.json();
34
- }
35
- default: {
36
- console.error("Failed to create track");
37
- console.error(await response.json());
38
- return;
39
- }
40
- }
41
- };
42
- const uploadISOBMFFTrack = async (fileId, trackId, fileStream) => {
43
- const trackIndex = await index.authenticatedFetch(
44
- `/api/video2/isobmff_tracks/${fileId}/${trackId}/upload`,
45
- {
46
- method: "POST",
47
- body: fileStream
48
- }
49
- );
50
- switch (trackIndex.status) {
51
- case 200: {
52
- return trackIndex.json();
53
- }
54
- default: {
55
- console.error("Failed to upload track");
56
- console.error(trackIndex.status, trackIndex.statusText);
57
- return;
58
- }
59
- }
60
- };
61
- exports.CreateISOBMFFTrackPayload = CreateISOBMFFTrackPayload;
62
- exports.createISOBMFFTrack = createISOBMFFTrack;
63
- exports.uploadISOBMFFTrack = uploadISOBMFFTrack;
@@ -1,63 +0,0 @@
1
- import { z } from "zod";
2
- import { AudioStreamSchema, VideoStreamSchema } from "@editframe/assets";
3
- import { authenticatedFetch } from "../utils/index.js";
4
- const CreateISOBMFFTrackPayload = z.discriminatedUnion("type", [
5
- z.object({
6
- file_id: z.string(),
7
- track_id: z.number().int(),
8
- type: z.literal("audio"),
9
- probe_info: AudioStreamSchema,
10
- duration_ms: z.number().int(),
11
- codec_name: z.string(),
12
- byte_size: z.number().int()
13
- }),
14
- z.object({
15
- file_id: z.string(),
16
- track_id: z.number().int(),
17
- type: z.literal("video"),
18
- probe_info: VideoStreamSchema,
19
- duration_ms: z.number().int(),
20
- codec_name: z.string(),
21
- byte_size: z.number().int()
22
- })
23
- ]);
24
- const createISOBMFFTrack = async (payload) => {
25
- const response = await authenticatedFetch("/api/video2/isobmff_tracks", {
26
- method: "POST",
27
- body: JSON.stringify(payload)
28
- });
29
- switch (response.status) {
30
- case 200: {
31
- return await response.json();
32
- }
33
- default: {
34
- console.error("Failed to create track");
35
- console.error(await response.json());
36
- return;
37
- }
38
- }
39
- };
40
- const uploadISOBMFFTrack = async (fileId, trackId, fileStream) => {
41
- const trackIndex = await authenticatedFetch(
42
- `/api/video2/isobmff_tracks/${fileId}/${trackId}/upload`,
43
- {
44
- method: "POST",
45
- body: fileStream
46
- }
47
- );
48
- switch (trackIndex.status) {
49
- case 200: {
50
- return trackIndex.json();
51
- }
52
- default: {
53
- console.error("Failed to upload track");
54
- console.error(trackIndex.status, trackIndex.statusText);
55
- return;
56
- }
57
- }
58
- };
59
- export {
60
- CreateISOBMFFTrackPayload,
61
- createISOBMFFTrack,
62
- uploadISOBMFFTrack
63
- };
@@ -1,51 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const zod = require("zod");
4
- const index = require("../utils/index.cjs");
5
- const CreateRenderPayload = zod.z.object({
6
- id: zod.z.string().uuid(),
7
- fps: zod.z.number(),
8
- width: zod.z.number().int(),
9
- height: zod.z.number().int(),
10
- work_slice_ms: zod.z.number().int(),
11
- duration_ms: zod.z.number().int(),
12
- strategy: zod.z.enum(["v1", "v2"])
13
- });
14
- const createRender = async (payload) => {
15
- const response = await index.authenticatedFetch("/api/video2/renders", {
16
- method: "POST",
17
- body: JSON.stringify(payload)
18
- });
19
- switch (response.status) {
20
- case 200: {
21
- return await response.json();
22
- }
23
- default: {
24
- console.error("Failed to create render");
25
- console.error(await response.json());
26
- return;
27
- }
28
- }
29
- };
30
- const uploadRender = async (fileId, fileStream) => {
31
- const fileIndex = await index.authenticatedFetch(
32
- `/api/video2/renders/${fileId}/upload`,
33
- {
34
- method: "POST",
35
- body: fileStream
36
- }
37
- );
38
- switch (fileIndex.status) {
39
- case 200: {
40
- return fileIndex.json();
41
- }
42
- default: {
43
- console.error("Failed to upload render");
44
- console.error(fileIndex.status, fileIndex.statusText);
45
- return;
46
- }
47
- }
48
- };
49
- exports.CreateRenderPayload = CreateRenderPayload;
50
- exports.createRender = createRender;
51
- exports.uploadRender = uploadRender;
@@ -1,51 +0,0 @@
1
- import { z } from "zod";
2
- import { authenticatedFetch } from "../utils/index.js";
3
- const CreateRenderPayload = z.object({
4
- id: z.string().uuid(),
5
- fps: z.number(),
6
- width: z.number().int(),
7
- height: z.number().int(),
8
- work_slice_ms: z.number().int(),
9
- duration_ms: z.number().int(),
10
- strategy: z.enum(["v1", "v2"])
11
- });
12
- const createRender = async (payload) => {
13
- const response = await authenticatedFetch("/api/video2/renders", {
14
- method: "POST",
15
- body: JSON.stringify(payload)
16
- });
17
- switch (response.status) {
18
- case 200: {
19
- return await response.json();
20
- }
21
- default: {
22
- console.error("Failed to create render");
23
- console.error(await response.json());
24
- return;
25
- }
26
- }
27
- };
28
- const uploadRender = async (fileId, fileStream) => {
29
- const fileIndex = await authenticatedFetch(
30
- `/api/video2/renders/${fileId}/upload`,
31
- {
32
- method: "POST",
33
- body: fileStream
34
- }
35
- );
36
- switch (fileIndex.status) {
37
- case 200: {
38
- return fileIndex.json();
39
- }
40
- default: {
41
- console.error("Failed to upload render");
42
- console.error(fileIndex.status, fileIndex.statusText);
43
- return;
44
- }
45
- }
46
- };
47
- export {
48
- CreateRenderPayload,
49
- createRender,
50
- uploadRender
51
- };
@@ -1,60 +0,0 @@
1
- import type { Readable } from "node:stream";
2
-
3
- import { z } from "zod";
4
-
5
- import { authenticatedFetch } from "../utils";
6
-
7
- export const CreateCaptionFilePayload = z.object({
8
- id: z.string(),
9
- filename: z.string(),
10
- });
11
-
12
- export interface CreateCaptionFileResult {
13
- complete: boolean | null;
14
- id: string;
15
- }
16
-
17
- export const createCaptionFile = async (
18
- payload: z.infer<typeof CreateCaptionFilePayload>,
19
- ) => {
20
- const fileCreation = await authenticatedFetch("/api/video2/caption_files", {
21
- method: "POST",
22
- body: JSON.stringify(payload),
23
- });
24
-
25
- switch (fileCreation.status) {
26
- case 200: {
27
- return (await fileCreation.json()) as CreateCaptionFileResult;
28
- }
29
- default: {
30
- console.log(
31
- `Failed to create file ${fileCreation.status} ${fileCreation.statusText}`,
32
- );
33
- return;
34
- }
35
- }
36
- };
37
-
38
- export const uploadCaptionFile = async (
39
- fileId: string,
40
- fileStream: Readable,
41
- ) => {
42
- const fileIndex = await authenticatedFetch(
43
- `/api/video2/caption_files/${fileId}/upload`,
44
- {
45
- method: "POST",
46
- body: fileStream,
47
- },
48
- );
49
- switch (fileIndex.status) {
50
- case 200: {
51
- return fileIndex.json();
52
- }
53
- default: {
54
- console.log(
55
- `Failed to upload caption ${fileIndex.status} ${fileIndex.statusText}`,
56
- );
57
- return;
58
- }
59
- }
60
- };
@@ -1,58 +0,0 @@
1
- import type { Readable } from "node:stream";
2
-
3
- import { z } from "zod";
4
-
5
- import { authenticatedFetch } from "../utils";
6
-
7
- export const CreateImageFilePayload = z.object({
8
- id: z.string(),
9
- height: z.number().int(),
10
- width: z.number().int(),
11
- mime_type: z.enum(["image/jpeg", "image/png", "image/jpg", "image/webp"]),
12
- filename: z.string(),
13
- });
14
-
15
- export interface CreateImageFileResult {
16
- complete: boolean | null;
17
- id: string;
18
- }
19
-
20
- export const createImageFile = async (
21
- payload: z.infer<typeof CreateImageFilePayload>,
22
- ) => {
23
- const response = await authenticatedFetch("/api/video2/image_files", {
24
- method: "POST",
25
- body: JSON.stringify(payload),
26
- });
27
-
28
- switch (response.status) {
29
- case 200: {
30
- return (await response.json()) as CreateImageFileResult;
31
- }
32
- default: {
33
- console.error(
34
- `Failed to create file ${response.status} ${response.statusText}`,
35
- );
36
- return;
37
- }
38
- }
39
- };
40
-
41
- export const uploadImageFile = async (fileId: string, fileStream: Readable) => {
42
- const fileIndex = await authenticatedFetch(
43
- `/api/video2/image_files/${fileId}/upload`,
44
- {
45
- method: "POST",
46
- body: fileStream,
47
- },
48
- );
49
- switch (fileIndex.status) {
50
- case 200: {
51
- return fileIndex.json();
52
- }
53
- default: {
54
- console.log("Failed to upload image");
55
- return;
56
- }
57
- }
58
- };
package/src/api/index.ts DELETED
@@ -1,17 +0,0 @@
1
- export {
2
- CreateCaptionFilePayload,
3
- type CreateCaptionFileResult,
4
- } from "./caption-file";
5
- export {
6
- CreateImageFilePayload,
7
- type CreateImageFileResult,
8
- } from "./image-file";
9
- export {
10
- CreateISOBMFFFilePayload,
11
- type CreateISOBMFFFileResult,
12
- } from "./isobmff-file";
13
- export {
14
- CreateISOBMFFTrackPayload,
15
- type CreateISOBMFFTrackResult,
16
- } from "./isobmff-track";
17
- export { CreateRenderPayload, type CreateRenderResult } from "./renders";
@@ -1,59 +0,0 @@
1
- import type { Readable } from "node:stream";
2
-
3
- import { z } from "zod";
4
-
5
- import { authenticatedFetch } from "../utils";
6
-
7
- export const CreateISOBMFFFilePayload = z.object({
8
- id: z.string(),
9
- filename: z.string(),
10
- });
11
-
12
- export interface CreateISOBMFFFileResult {
13
- fragment_index_complete: boolean;
14
- id: string;
15
- }
16
-
17
- export const createISOBMFFFile = async (
18
- payload: z.infer<typeof CreateISOBMFFFilePayload>,
19
- ) => {
20
- const response = await authenticatedFetch("/api/video2/isobmff_files", {
21
- method: "POST",
22
- body: JSON.stringify(payload),
23
- });
24
- switch (response.status) {
25
- case 200: {
26
- return (await response.json()) as CreateISOBMFFFileResult;
27
- }
28
- default: {
29
- console.log(
30
- `Failed to create file ${response.status} ${response.statusText}`,
31
- );
32
- return;
33
- }
34
- }
35
- };
36
-
37
- export const uploadFragmentIndex = async (
38
- fileId: string,
39
- fileStream: Readable,
40
- ) => {
41
- const fileIndex = await authenticatedFetch(
42
- `/api/video2/isobmff_files/${fileId}/index/upload`,
43
- {
44
- method: "POST",
45
- body: fileStream,
46
- },
47
- );
48
- switch (fileIndex.status) {
49
- case 200: {
50
- return fileIndex.json();
51
- }
52
- default: {
53
- console.log(
54
- `Failed to create fragment index ${fileIndex.status} ${fileIndex.statusText}`,
55
- );
56
- return;
57
- }
58
- }
59
- };
@@ -1,77 +0,0 @@
1
- import type { Readable } from "node:stream";
2
-
3
- import { z } from "zod";
4
-
5
- import { AudioStreamSchema, VideoStreamSchema } from "@editframe/assets";
6
- import { authenticatedFetch } from "../utils";
7
-
8
- export const CreateISOBMFFTrackPayload = z.discriminatedUnion("type", [
9
- z.object({
10
- file_id: z.string(),
11
- track_id: z.number().int(),
12
- type: z.literal("audio"),
13
- probe_info: AudioStreamSchema,
14
- duration_ms: z.number().int(),
15
- codec_name: z.string(),
16
- byte_size: z.number().int(),
17
- }),
18
- z.object({
19
- file_id: z.string(),
20
- track_id: z.number().int(),
21
- type: z.literal("video"),
22
- probe_info: VideoStreamSchema,
23
- duration_ms: z.number().int(),
24
- codec_name: z.string(),
25
- byte_size: z.number().int(),
26
- }),
27
- ]);
28
-
29
- export interface CreateISOBMFFTrackResult {
30
- last_received_byte: number;
31
- byte_size: number;
32
- track_id: number;
33
- file_id: string;
34
- }
35
-
36
- export const createISOBMFFTrack = async (
37
- payload: z.infer<typeof CreateISOBMFFTrackPayload>,
38
- ) => {
39
- const response = await authenticatedFetch("/api/video2/isobmff_tracks", {
40
- method: "POST",
41
- body: JSON.stringify(payload),
42
- });
43
- switch (response.status) {
44
- case 200: {
45
- return (await response.json()) as CreateISOBMFFTrackResult;
46
- }
47
- default: {
48
- console.error("Failed to create track");
49
- console.error(await response.json());
50
- return;
51
- }
52
- }
53
- };
54
-
55
- export const uploadISOBMFFTrack = async (
56
- fileId: string,
57
- trackId: number,
58
- fileStream: Readable,
59
- ) => {
60
- const trackIndex = await authenticatedFetch(
61
- `/api/video2/isobmff_tracks/${fileId}/${trackId}/upload`,
62
- {
63
- method: "POST",
64
- body: fileStream,
65
- },
66
- );
67
- switch (trackIndex.status) {
68
- case 200: {
69
- return trackIndex.json();
70
- }
71
- default: {
72
- console.error("Failed to upload track");
73
- console.error(trackIndex.status, trackIndex.statusText);
74
- return;
75
- }
76
- }
77
- };
@@ -1,59 +0,0 @@
1
- import type { Readable } from "node:stream";
2
-
3
- import { z } from "zod";
4
-
5
- import { authenticatedFetch } from "../utils";
6
-
7
- export const CreateRenderPayload = z.object({
8
- id: z.string().uuid(),
9
- fps: z.number(),
10
- width: z.number().int(),
11
- height: z.number().int(),
12
- work_slice_ms: z.number().int(),
13
- duration_ms: z.number().int(),
14
- strategy: z.enum(["v1", "v2"]),
15
- });
16
-
17
- export interface CreateRenderResult {
18
- status: "complete" | "created" | "failed" | "pending" | "rendering";
19
- id: string;
20
- }
21
-
22
- export const createRender = async (
23
- payload: z.infer<typeof CreateRenderPayload>,
24
- ) => {
25
- const response = await authenticatedFetch("/api/video2/renders", {
26
- method: "POST",
27
- body: JSON.stringify(payload),
28
- });
29
- switch (response.status) {
30
- case 200: {
31
- return (await response.json()) as CreateRenderResult;
32
- }
33
- default: {
34
- console.error("Failed to create render");
35
- console.error(await response.json());
36
- return;
37
- }
38
- }
39
- };
40
-
41
- export const uploadRender = async (fileId: string, fileStream: Readable) => {
42
- const fileIndex = await authenticatedFetch(
43
- `/api/video2/renders/${fileId}/upload`,
44
- {
45
- method: "POST",
46
- body: fileStream,
47
- },
48
- );
49
- switch (fileIndex.status) {
50
- case 200: {
51
- return fileIndex.json();
52
- }
53
- default: {
54
- console.error("Failed to upload render");
55
- console.error(fileIndex.status, fileIndex.statusText);
56
- return;
57
- }
58
- }
59
- };