@editframe/cli 0.12.0-beta.3 → 0.12.0-beta.8

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/VERSION.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "0.12.0-beta.3";
1
+ export declare const VERSION = "0.12.0-beta.8";
package/dist/VERSION.js CHANGED
@@ -1,4 +1,4 @@
1
- const VERSION = "0.12.0-beta.3";
1
+ const VERSION = "0.12.0-beta.8";
2
2
  export {
3
3
  VERSION
4
4
  };
@@ -1,44 +1,30 @@
1
- import { createReadStream } from "node:fs";
2
- import { stat } from "node:fs/promises";
3
- import { basename } from "node:path";
4
1
  import { program } from "commander";
5
2
  import { withSpinner } from "../utils/withSpinner.js";
6
- import { uploadUnprocessedFile, getIsobmffProcessProgress, getIsobmffProcessInfo, createUnprocessedFile, processIsobmffFile } from "@editframe/api";
7
- import { md5FilePath } from "@editframe/assets";
3
+ import { uploadUnprocessedFile, getIsobmffProcessProgress, getIsobmffProcessInfo, createUnprocessedFileFromPath, processIsobmffFile } from "@editframe/api";
8
4
  import ora from "ora";
9
- import { createReadableStreamFromReadable } from "../utils/createReadableStreamFromReadable.js";
10
5
  import { getClient } from "../utils/index.js";
11
6
  program.command("process-file <file>").description("Upload a audio/video to Editframe for processing.").action(async (path) => {
12
7
  const client = getClient();
13
- const md5 = await md5FilePath(path);
14
- const byte_size = (await stat(path)).size;
15
8
  const unprocessedFile = await withSpinner(
16
9
  "Creating unprocessed file record",
17
- async () => await createUnprocessedFile(client, {
18
- md5,
19
- filename: basename(path),
20
- byte_size
21
- })
22
- );
23
- const readStream = createReadStream(path);
24
- const upload = uploadUnprocessedFile(
25
- client,
26
- unprocessedFile.id,
27
- createReadableStreamFromReadable(readStream),
28
- byte_size
10
+ () => createUnprocessedFileFromPath(client, path)
29
11
  );
12
+ const upload = await uploadUnprocessedFile(client, unprocessedFile, path);
30
13
  const uploadSpinner = ora("Uploading file");
31
14
  for await (const event of upload) {
32
15
  uploadSpinner.text = `Uploading file: ${(100 * event.progress).toFixed(2)}%`;
33
16
  }
34
17
  uploadSpinner.succeed("Upload complete");
35
- const processor = await withSpinner(
18
+ const processorRecord = await withSpinner(
36
19
  "Marking for processing",
37
20
  async () => await processIsobmffFile(client, unprocessedFile.id)
38
21
  );
39
22
  const processSpinner = ora("Waiting for processing to complete");
40
23
  processSpinner.start();
41
- const progress = await getIsobmffProcessProgress(client, processor.id);
24
+ const progress = await getIsobmffProcessProgress(
25
+ client,
26
+ processorRecord.id
27
+ );
42
28
  for await (const event of progress) {
43
29
  if (event.type === "progress") {
44
30
  processSpinner.text = `Processing: ${(100 * event.data.progress).toFixed(2)}%`;
@@ -46,7 +32,7 @@ program.command("process-file <file>").description("Upload a audio/video to Edit
46
32
  processSpinner.succeed("Processing complete");
47
33
  }
48
34
  }
49
- const info = await getIsobmffProcessInfo(client, processor.id);
35
+ const info = await getIsobmffProcessInfo(client, processorRecord.id);
50
36
  console.log("Processed file info");
51
37
  console.log(info);
52
38
  });
@@ -18,24 +18,24 @@ export declare const RenderInfo: z.ZodObject<{
18
18
  efImage: string[];
19
19
  }>;
20
20
  }, "strip", z.ZodTypeAny, {
21
- height: number;
22
21
  width: number;
23
- fps: number;
22
+ height: number;
24
23
  assets: {
25
24
  efMedia: Record<string, any>;
26
25
  efCaptions: string[];
27
26
  efImage: string[];
28
27
  };
28
+ fps: number;
29
29
  durationMs: number;
30
30
  }, {
31
- height: number;
32
31
  width: number;
33
- fps: number;
32
+ height: number;
34
33
  assets: {
35
34
  efMedia: Record<string, any>;
36
35
  efCaptions: string[];
37
36
  efImage: string[];
38
37
  };
38
+ fps: number;
39
39
  durationMs: number;
40
40
  }>;
41
41
  export declare const getRenderInfo: () => Promise<{
@@ -1,4 +1,4 @@
1
- import { CreateCaptionFileResult, LookupCaptionFileByMd5Result } from '../../../../api/src/index.ts';
1
+ import { CreateCaptionFileResult, LookupCaptionFileByMd5Result } from '../../../../api/src/browser.ts';
2
2
  import { SubAssetSync } from './SubAssetSync.ts';
3
3
  import { SyncStatus } from './SyncStatus.ts';
4
4
  export declare class SyncCaption implements SubAssetSync<CreateCaptionFileResult> {
@@ -1,4 +1,4 @@
1
- import { CreateISOBMFFFileResult, LookupISOBMFFFileByMd5Result } from '../../../../api/src/index.ts';
1
+ import { CreateISOBMFFFileResult, LookupISOBMFFFileByMd5Result } from '../../../../api/src/browser.ts';
2
2
  import { SubAssetSync } from './SubAssetSync.ts';
3
3
  import { SyncStatus } from './SyncStatus.ts';
4
4
  export declare class SyncFragmentIndex implements SubAssetSync<CreateISOBMFFFileResult> {
@@ -1,4 +1,4 @@
1
- import { CreateImageFileResult, LookupImageFileByMd5Result } from '../../../../api/src/index.ts';
1
+ import { CreateImageFileResult, LookupImageFileByMd5Result } from '../../../../api/src/browser.ts';
2
2
  import { Probe } from '../../../../assets/src/index.ts';
3
3
  import { SubAssetSync } from './SubAssetSync.ts';
4
4
  import { SyncStatus } from './SyncStatus.ts';
@@ -74,9 +74,11 @@ class SyncImage {
74
74
  }
75
75
  await uploadImageFile(
76
76
  getClient(),
77
- this.created.id,
78
- createReadableStreamFromReadable(createReadStream(this.path)),
79
- Number.parseInt(this.probeResult.format.size || "0")
77
+ {
78
+ id: this.created.id,
79
+ byte_size: Number.parseInt(this.probeResult.format.size || "0")
80
+ },
81
+ createReadableStreamFromReadable(createReadStream(this.path))
80
82
  ).whenUploaded();
81
83
  }
82
84
  async markSynced() {
@@ -6,17 +6,17 @@ declare const SyncStatusSchema: z.ZodObject<{
6
6
  md5: z.ZodString;
7
7
  byte_size: z.ZodNumber;
8
8
  }, "strip", z.ZodTypeAny, {
9
+ version: string;
9
10
  complete: boolean;
10
11
  id: string;
11
12
  md5: string;
12
13
  byte_size: number;
13
- version: string;
14
14
  }, {
15
+ version: string;
15
16
  complete: boolean;
16
17
  id: string;
17
18
  md5: string;
18
19
  byte_size: number;
19
- version: string;
20
20
  }>;
21
21
  export interface SyncStatusInfo extends z.infer<typeof SyncStatusSchema> {
22
22
  }
@@ -26,11 +26,11 @@ export declare class SyncStatus {
26
26
  constructor(basePath: string);
27
27
  isSynced(): Promise<boolean>;
28
28
  readInfo(): Promise<{
29
+ version: string;
29
30
  complete: boolean;
30
31
  id: string;
31
32
  md5: string;
32
33
  byte_size: number;
33
- version: string;
34
34
  } | null>;
35
35
  markSynced(info: SyncStatusInfo): Promise<void>;
36
36
  }
@@ -1,4 +1,4 @@
1
- import { CreateISOBMFFFileResult, CreateISOBMFFTrackResult, LookupISOBMFFFileByMd5Result } from '../../../../api/src/index.ts';
1
+ import { CreateISOBMFFTrackResult } from '../../../../api/src/browser.ts';
2
2
  import { Probe } from '../../../../assets/src/index.ts';
3
3
  import { SubAssetSync } from './SubAssetSync.ts';
4
4
  import { SyncStatus } from './SyncStatus.ts';
@@ -12,7 +12,7 @@ export declare class SyncTrack implements SubAssetSync<CreateISOBMFFTrackResult>
12
12
  created: CreateISOBMFFTrackResult | null;
13
13
  constructor(path: string, md5: string);
14
14
  private _isoFile;
15
- get isoFile(): CreateISOBMFFFileResult | LookupISOBMFFFileByMd5Result;
15
+ get isoFile(): any;
16
16
  byteSize(): Promise<number>;
17
17
  private _probeResult;
18
18
  get probeResult(): Probe;
@@ -39,8 +39,6 @@ export declare class SyncTrack implements SubAssetSync<CreateISOBMFFTrackResult>
39
39
  disposition: Record<string, unknown>;
40
40
  initial_padding?: number | undefined;
41
41
  } | {
42
- height: number;
43
- width: number;
44
42
  index: number;
45
43
  codec_name: string;
46
44
  codec_long_name: string;
@@ -51,6 +49,8 @@ export declare class SyncTrack implements SubAssetSync<CreateISOBMFFTrackResult>
51
49
  avg_frame_rate: string;
52
50
  time_base: string;
53
51
  disposition: Record<string, unknown>;
52
+ width: number;
53
+ height: number;
54
54
  coded_width: number;
55
55
  coded_height: number;
56
56
  start_pts?: number | undefined;
@@ -1,2 +1 @@
1
- import { Client } from '../../../api/src/index.ts';
2
1
  export declare const getClient: () => Client;
@@ -3,7 +3,7 @@ type VideoPayload = {
3
3
  height: number;
4
4
  };
5
5
  export declare const validateVideoResolution: (rawPayload: VideoPayload) => Promise<{
6
- height: number;
7
6
  width: number;
7
+ height: number;
8
8
  }>;
9
9
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@editframe/cli",
3
- "version": "0.12.0-beta.3",
3
+ "version": "0.12.0-beta.8",
4
4
  "description": "Command line interface for EditFrame",
5
5
  "bin": {
6
6
  "editframe": "./dist/index.js"
@@ -23,10 +23,10 @@
23
23
  "vite-tsconfig-paths": "^4.3.2"
24
24
  },
25
25
  "dependencies": {
26
- "@editframe/api": "0.12.0-beta.3",
27
- "@editframe/assets": "0.12.0-beta.3",
28
- "@editframe/elements": "0.12.0-beta.3",
29
- "@editframe/vite-plugin": "0.12.0-beta.3",
26
+ "@editframe/api": "0.12.0-beta.8",
27
+ "@editframe/assets": "0.12.0-beta.8",
28
+ "@editframe/elements": "0.12.0-beta.8",
29
+ "@editframe/vite-plugin": "0.12.0-beta.8",
30
30
  "@inquirer/prompts": "^5.3.8",
31
31
  "axios": "^1.6.8",
32
32
  "chalk": "^5.3.0",
@@ -1,21 +1,15 @@
1
- import { createReadStream } from "node:fs";
2
- import { stat } from "node:fs/promises";
3
- import { basename } from "node:path";
4
-
5
1
  import { program } from "commander";
6
2
 
7
3
  import { withSpinner } from "../utils/withSpinner.ts";
8
4
 
9
5
  import {
10
- createUnprocessedFile,
6
+ createUnprocessedFileFromPath,
11
7
  getIsobmffProcessInfo,
12
8
  getIsobmffProcessProgress,
13
9
  processIsobmffFile,
14
10
  uploadUnprocessedFile,
15
11
  } from "@editframe/api";
16
- import { md5FilePath } from "@editframe/assets";
17
12
  import ora from "ora";
18
- import { createReadableStreamFromReadable } from "../utils/createReadableStreamFromReadable.ts";
19
13
  import { getClient } from "../utils/index.ts";
20
14
 
21
15
  program
@@ -24,41 +18,29 @@ program
24
18
  .action(async (path: string) => {
25
19
  const client = getClient();
26
20
 
27
- const md5 = await md5FilePath(path);
28
-
29
- const byte_size = (await stat(path)).size;
30
-
31
21
  const unprocessedFile = await withSpinner(
32
22
  "Creating unprocessed file record",
33
- async () =>
34
- await createUnprocessedFile(client, {
35
- md5,
36
- filename: basename(path),
37
- byte_size,
38
- }),
23
+ () => createUnprocessedFileFromPath(client, path),
39
24
  );
40
25
 
41
- const readStream = createReadStream(path);
42
-
43
- const upload = uploadUnprocessedFile(
44
- client,
45
- unprocessedFile.id,
46
- createReadableStreamFromReadable(readStream),
47
- byte_size,
48
- );
26
+ const upload = await uploadUnprocessedFile(client, unprocessedFile, path);
49
27
  const uploadSpinner = ora("Uploading file");
28
+
50
29
  for await (const event of upload) {
51
30
  uploadSpinner.text = `Uploading file: ${(100 * event.progress).toFixed(2)}%`;
52
31
  }
53
32
  uploadSpinner.succeed("Upload complete");
54
- const processor = await withSpinner(
33
+ const processorRecord = await withSpinner(
55
34
  "Marking for processing",
56
35
  async () => await processIsobmffFile(client, unprocessedFile.id),
57
36
  );
58
37
 
59
38
  const processSpinner = ora("Waiting for processing to complete");
60
39
  processSpinner.start();
61
- const progress = await getIsobmffProcessProgress(client, processor.id);
40
+ const progress = await getIsobmffProcessProgress(
41
+ client,
42
+ processorRecord.id,
43
+ );
62
44
 
63
45
  for await (const event of progress) {
64
46
  if (event.type === "progress") {
@@ -68,7 +50,7 @@ program
68
50
  }
69
51
  }
70
52
 
71
- const info = await getIsobmffProcessInfo(client, processor.id);
53
+ const info = await getIsobmffProcessInfo(client, processorRecord.id);
72
54
 
73
55
  console.log("Processed file info");
74
56
  console.log(info);
@@ -97,9 +97,11 @@ export class SyncImage implements SubAssetSync<CreateImageFileResult> {
97
97
  }
98
98
  await uploadImageFile(
99
99
  getClient(),
100
- this.created.id,
100
+ {
101
+ id: this.created.id,
102
+ byte_size: Number.parseInt(this.probeResult.format.size || "0"),
103
+ },
101
104
  createReadableStreamFromReadable(createReadStream(this.path)),
102
- Number.parseInt(this.probeResult.format.size || "0"),
103
105
  ).whenUploaded();
104
106
  }
105
107
  async markSynced() {