@editframe/cli 0.12.0-beta.8 → 0.13.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.
Files changed (48) hide show
  1. package/dist/VERSION.d.ts +1 -1
  2. package/dist/VERSION.js +1 -1
  3. package/dist/commands/process-file.js +1 -1
  4. package/dist/commands/process.js +3 -3
  5. package/dist/commands/render.js +1 -4
  6. package/dist/commands/webhook.js +3 -3
  7. package/dist/operations/getRenderInfo.d.ts +4 -4
  8. package/dist/operations/processRenderInfo.d.ts +1 -1
  9. package/dist/operations/syncAssetsDirectory/SubAssetSync.d.ts +5 -5
  10. package/dist/operations/syncAssetsDirectory/SyncCaption.d.ts +3 -3
  11. package/dist/operations/syncAssetsDirectory/SyncFragmentIndex.d.ts +3 -3
  12. package/dist/operations/syncAssetsDirectory/SyncImage.d.ts +3 -3
  13. package/dist/operations/syncAssetsDirectory/SyncStatus.d.ts +3 -3
  14. package/dist/operations/syncAssetsDirectory/SyncTrack.d.ts +10 -6
  15. package/dist/operations/syncAssetsDirectory/SyncTrack.js +6 -0
  16. package/dist/operations/syncAssetsDirectory/doAssetSync.d.ts +1 -1
  17. package/dist/utils/getFolderSize.d.ts +1 -1
  18. package/dist/utils/index.d.ts +1 -0
  19. package/dist/utils/startPreviewServer.js +1 -1
  20. package/dist/utils/validateVideoResolution.d.ts +1 -1
  21. package/package.json +5 -5
  22. package/src/commands/auth.ts +1 -1
  23. package/src/commands/process-file.ts +3 -3
  24. package/src/commands/process.ts +5 -5
  25. package/src/commands/render.ts +10 -13
  26. package/src/commands/sync.ts +1 -1
  27. package/src/commands/webhook.ts +4 -4
  28. package/src/operations/processRenderInfo.ts +2 -2
  29. package/src/operations/syncAssetsDirectory/SubAssetSync.ts +5 -5
  30. package/src/operations/syncAssetsDirectory/SyncCaption.test.ts +4 -4
  31. package/src/operations/syncAssetsDirectory/SyncCaption.ts +4 -4
  32. package/src/operations/syncAssetsDirectory/SyncFragmentIndex.test.ts +4 -4
  33. package/src/operations/syncAssetsDirectory/SyncFragmentIndex.ts +4 -4
  34. package/src/operations/syncAssetsDirectory/SyncImage.test.ts +4 -4
  35. package/src/operations/syncAssetsDirectory/SyncImage.ts +4 -4
  36. package/src/operations/syncAssetsDirectory/SyncTrack.test.ts +4 -4
  37. package/src/operations/syncAssetsDirectory/SyncTrack.ts +11 -7
  38. package/src/operations/syncAssetsDirectory/doAssetSync.test.ts +3 -3
  39. package/src/operations/syncAssetsDirectory/doAssetSync.ts +1 -1
  40. package/src/operations/syncAssetsDirectory.test.ts +3 -3
  41. package/src/operations/syncAssetsDirectory.ts +2 -2
  42. package/src/utils/getFolderSize.ts +12 -16
  43. package/src/utils/launchBrowserAndWaitForSDK.ts +1 -1
  44. package/src/utils/startDevServer.ts +1 -1
  45. package/src/utils/startPreviewServer.ts +2 -2
  46. package/test-fixtures/fixture.ts +2 -2
  47. package/test-fixtures/network.ts +1 -1
  48. package/dist/utils/getFolderSize.js +0 -22
package/dist/VERSION.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "0.12.0-beta.8";
1
+ export declare const VERSION = "0.13.0-beta.2";
package/dist/VERSION.js CHANGED
@@ -1,4 +1,4 @@
1
- const VERSION = "0.12.0-beta.8";
1
+ const VERSION = "0.13.0-beta.2";
2
2
  export {
3
3
  VERSION
4
4
  };
@@ -1,6 +1,6 @@
1
1
  import { program } from "commander";
2
2
  import { withSpinner } from "../utils/withSpinner.js";
3
- import { uploadUnprocessedFile, getIsobmffProcessProgress, getIsobmffProcessInfo, createUnprocessedFileFromPath, processIsobmffFile } from "@editframe/api";
3
+ import { uploadUnprocessedFile, getIsobmffProcessProgress, getIsobmffProcessInfo, createUnprocessedFileFromPath, processIsobmffFile } from "@editframe/api/node";
4
4
  import ora from "ora";
5
5
  import { getClient } from "../utils/index.js";
6
6
  program.command("process-file <file>").description("Upload a audio/video to Editframe for processing.").action(async (path) => {
@@ -1,11 +1,11 @@
1
1
  import { spawnSync } from "node:child_process";
2
2
  import path from "node:path";
3
3
  import { program } from "commander";
4
- import { withSpinner } from "../utils/withSpinner.js";
5
- import { launchBrowserAndWaitForSDK } from "../utils/launchBrowserAndWaitForSDK.js";
6
- import { PreviewServer } from "../utils/startPreviewServer.js";
7
4
  import { getRenderInfo } from "../operations/getRenderInfo.js";
8
5
  import { processRenderInfo } from "../operations/processRenderInfo.js";
6
+ import { launchBrowserAndWaitForSDK } from "../utils/launchBrowserAndWaitForSDK.js";
7
+ import { PreviewServer } from "../utils/startPreviewServer.js";
8
+ import { withSpinner } from "../utils/withSpinner.js";
9
9
  program.command("process [directory]").description(
10
10
  "Process's a directory's index.html file, analyzing assets and processing them for rendering"
11
11
  ).action(async (directory) => {
@@ -14,7 +14,6 @@ import { processRenderInfo } from "../operations/processRenderInfo.js";
14
14
  import { syncAssetDirectory } from "../operations/syncAssetsDirectory.js";
15
15
  import { SyncStatus } from "../operations/syncAssetsDirectory/SyncStatus.js";
16
16
  import { createReadableStreamFromReadable } from "../utils/createReadableStreamFromReadable.js";
17
- import { getFolderSize } from "../utils/getFolderSize.js";
18
17
  import { getClient } from "../utils/index.js";
19
18
  import { launchBrowserAndWaitForSDK } from "../utils/launchBrowserAndWaitForSDK.js";
20
19
  import { PreviewServer } from "../utils/startPreviewServer.js";
@@ -152,12 +151,10 @@ program.command("render [directory]").description(
152
151
  );
153
152
  const readable = new PassThrough();
154
153
  tarStream.pipe(readable);
155
- const folderSize = await getFolderSize(distDir);
156
154
  await uploadRender(
157
155
  getClient(),
158
156
  render.id,
159
- createReadableStreamFromReadable(readable),
160
- folderSize
157
+ createReadableStreamFromReadable(readable)
161
158
  );
162
159
  process.stderr.write("Render assets uploaded\n");
163
160
  process.stderr.write(inspect(render));
@@ -1,8 +1,8 @@
1
- import { program, Option } from "commander";
2
- import ora from "ora";
1
+ import { input, select } from "@inquirer/prompts";
3
2
  import chalk from "chalk";
3
+ import { program, Option } from "commander";
4
4
  import debug from "debug";
5
- import { input, select } from "@inquirer/prompts";
5
+ import ora from "ora";
6
6
  import { getClient } from "../utils/index.js";
7
7
  const log = debug("ef:cli:auth");
8
8
  const topics = [
@@ -18,24 +18,24 @@ export declare const RenderInfo: z.ZodObject<{
18
18
  efImage: string[];
19
19
  }>;
20
20
  }, "strip", z.ZodTypeAny, {
21
- width: number;
22
21
  height: number;
22
+ width: number;
23
+ fps: number;
23
24
  assets: {
24
25
  efMedia: Record<string, any>;
25
26
  efCaptions: string[];
26
27
  efImage: string[];
27
28
  };
28
- fps: number;
29
29
  durationMs: number;
30
30
  }, {
31
- width: number;
32
31
  height: number;
32
+ width: number;
33
+ fps: number;
33
34
  assets: {
34
35
  efMedia: Record<string, any>;
35
36
  efCaptions: string[];
36
37
  efImage: string[];
37
38
  };
38
- fps: number;
39
39
  durationMs: number;
40
40
  }>;
41
41
  export declare const getRenderInfo: () => Promise<{
@@ -1,2 +1,2 @@
1
- import { getRenderInfo } from './getRenderInfo.ts';
1
+ import { getRenderInfo } from './getRenderInfo.js';
2
2
  export declare const processRenderInfo: (renderInfo: Awaited<ReturnType<typeof getRenderInfo>>) => Promise<void>;
@@ -1,8 +1,8 @@
1
- import { SyncStatus } from './SyncStatus.ts';
2
- import { SyncCaption } from './SyncCaption.ts';
3
- import { SyncFragmentIndex } from './SyncFragmentIndex.ts';
4
- import { SyncImage } from './SyncImage.ts';
5
- import { SyncTrack } from './SyncTrack.ts';
1
+ import { SyncStatus } from './SyncStatus.js';
2
+ import { SyncCaption } from './SyncCaption.js';
3
+ import { SyncFragmentIndex } from './SyncFragmentIndex.js';
4
+ import { SyncImage } from './SyncImage.js';
5
+ import { SyncTrack } from './SyncTrack.js';
6
6
  export interface SubAssetSync<CreationType> {
7
7
  icon: string;
8
8
  label: string;
@@ -1,6 +1,6 @@
1
- import { CreateCaptionFileResult, LookupCaptionFileByMd5Result } from '../../../../api/src/browser.ts';
2
- import { SubAssetSync } from './SubAssetSync.ts';
3
- import { SyncStatus } from './SyncStatus.ts';
1
+ import { CreateCaptionFileResult, LookupCaptionFileByMd5Result } from '../../../../api/src/index.ts';
2
+ import { SubAssetSync } from './SubAssetSync.js';
3
+ import { SyncStatus } from './SyncStatus.js';
4
4
  export declare class SyncCaption implements SubAssetSync<CreateCaptionFileResult> {
5
5
  path: string;
6
6
  md5: string;
@@ -1,6 +1,6 @@
1
- import { CreateISOBMFFFileResult, LookupISOBMFFFileByMd5Result } from '../../../../api/src/browser.ts';
2
- import { SubAssetSync } from './SubAssetSync.ts';
3
- import { SyncStatus } from './SyncStatus.ts';
1
+ import { CreateISOBMFFFileResult, LookupISOBMFFFileByMd5Result } from '../../../../api/src/index.ts';
2
+ import { SubAssetSync } from './SubAssetSync.js';
3
+ import { SyncStatus } from './SyncStatus.js';
4
4
  export declare class SyncFragmentIndex implements SubAssetSync<CreateISOBMFFFileResult> {
5
5
  path: string;
6
6
  md5: string;
@@ -1,7 +1,7 @@
1
- import { CreateImageFileResult, LookupImageFileByMd5Result } from '../../../../api/src/browser.ts';
1
+ import { CreateImageFileResult, LookupImageFileByMd5Result } from '../../../../api/src/index.ts';
2
2
  import { Probe } from '../../../../assets/src/index.ts';
3
- import { SubAssetSync } from './SubAssetSync.ts';
4
- import { SyncStatus } from './SyncStatus.ts';
3
+ import { SubAssetSync } from './SubAssetSync.js';
4
+ import { SyncStatus } from './SyncStatus.js';
5
5
  export declare class SyncImage implements SubAssetSync<CreateImageFileResult> {
6
6
  path: string;
7
7
  md5: string;
@@ -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;
10
9
  complete: boolean;
11
10
  id: string;
12
11
  md5: string;
13
12
  byte_size: number;
14
- }, {
15
13
  version: string;
14
+ }, {
16
15
  complete: boolean;
17
16
  id: string;
18
17
  md5: string;
19
18
  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;
30
29
  complete: boolean;
31
30
  id: string;
32
31
  md5: string;
33
32
  byte_size: number;
33
+ version: string;
34
34
  } | null>;
35
35
  markSynced(info: SyncStatusInfo): Promise<void>;
36
36
  }
@@ -1,7 +1,7 @@
1
- import { CreateISOBMFFTrackResult } from '../../../../api/src/browser.ts';
1
+ import { CreateISOBMFFFileResult, CreateISOBMFFTrackResult, LookupISOBMFFFileByMd5Result } from '../../../../api/src/index.ts';
2
2
  import { Probe } from '../../../../assets/src/index.ts';
3
- import { SubAssetSync } from './SubAssetSync.ts';
4
- import { SyncStatus } from './SyncStatus.ts';
3
+ import { SubAssetSync } from './SubAssetSync.js';
4
+ import { SyncStatus } from './SyncStatus.js';
5
5
  export declare class SyncTrack implements SubAssetSync<CreateISOBMFFTrackResult> {
6
6
  path: string;
7
7
  md5: string;
@@ -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(): any;
15
+ get isoFile(): CreateISOBMFFFileResult | LookupISOBMFFFileByMd5Result;
16
16
  byteSize(): Promise<number>;
17
17
  private _probeResult;
18
18
  get probeResult(): Probe;
@@ -39,6 +39,8 @@ 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;
42
44
  index: number;
43
45
  codec_name: string;
44
46
  codec_long_name: string;
@@ -49,8 +51,6 @@ export declare class SyncTrack implements SubAssetSync<CreateISOBMFFTrackResult>
49
51
  avg_frame_rate: string;
50
52
  time_base: string;
51
53
  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;
@@ -58,6 +58,10 @@ export declare class SyncTrack implements SubAssetSync<CreateISOBMFFTrackResult>
58
58
  duration_ts?: number | undefined;
59
59
  duration?: number | undefined;
60
60
  bit_rate?: string | undefined;
61
+ } | {
62
+ index: number;
63
+ codec_type: "data";
64
+ duration?: string | undefined;
61
65
  };
62
66
  prepare(): Promise<void>;
63
67
  get trackId(): string;
@@ -64,6 +64,9 @@ class SyncTrack {
64
64
  if (!track.duration) {
65
65
  throw new Error(`No duration found in track: ${this.path}`);
66
66
  }
67
+ if (typeof track.duration === "string") {
68
+ return Number.parseFloat(track.duration);
69
+ }
67
70
  return track.duration;
68
71
  }
69
72
  async validate() {
@@ -74,6 +77,9 @@ class SyncTrack {
74
77
  async create() {
75
78
  const track = this.track;
76
79
  const isoFile = this.isoFile;
80
+ if (track.codec_type === "data") {
81
+ throw new Error(`Unsupported codec type: ${track.codec_type}`);
82
+ }
77
83
  const createPayload = track.codec_type === "audio" ? {
78
84
  type: track.codec_type,
79
85
  file_id: isoFile.id,
@@ -1,4 +1,4 @@
1
- import { SubAssetSync } from './SubAssetSync.ts';
1
+ import { SubAssetSync } from './SubAssetSync.js';
2
2
  export declare const doAssetSync: (assetSync: SubAssetSync<unknown>) => AsyncGenerator<{
3
3
  status: "info" | "success";
4
4
  message: string;
@@ -1 +1 @@
1
- export declare const getFolderSize: (folderPath: string) => Promise<number>;
1
+ export declare function getFolderSize(dir: string): Promise<number>;
@@ -1 +1,2 @@
1
+ import { Client } from '../../../api/src/index.ts';
1
2
  export declare const getClient: () => Client;
@@ -1,5 +1,5 @@
1
- import { createServer } from "vite";
2
1
  import path from "node:path";
2
+ import { createServer } from "vite";
3
3
  import { vitePluginEditframe } from "@editframe/vite-plugin";
4
4
  import { withSpinner } from "./withSpinner.js";
5
5
  class PreviewServer {
@@ -3,7 +3,7 @@ type VideoPayload = {
3
3
  height: number;
4
4
  };
5
5
  export declare const validateVideoResolution: (rawPayload: VideoPayload) => Promise<{
6
- width: number;
7
6
  height: number;
7
+ width: 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.8",
3
+ "version": "0.13.0-beta.2",
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.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",
26
+ "@editframe/api": "0.13.0-beta.2",
27
+ "@editframe/assets": "0.13.0-beta.2",
28
+ "@editframe/elements": "0.13.0-beta.2",
29
+ "@editframe/vite-plugin": "0.13.0-beta.2",
30
30
  "@inquirer/prompts": "^5.3.8",
31
31
  "axios": "^1.6.8",
32
32
  "chalk": "^5.3.0",
@@ -3,7 +3,7 @@ import { program } from "commander";
3
3
  import debug from "debug";
4
4
  import ora from "ora";
5
5
 
6
- import { getClient } from "../utils/index.ts";
6
+ import { getClient } from "../utils/index.js";
7
7
 
8
8
  const log = debug("ef:cli:auth");
9
9
 
@@ -1,6 +1,6 @@
1
1
  import { program } from "commander";
2
2
 
3
- import { withSpinner } from "../utils/withSpinner.ts";
3
+ import { withSpinner } from "../utils/withSpinner.js";
4
4
 
5
5
  import {
6
6
  createUnprocessedFileFromPath,
@@ -8,9 +8,9 @@ import {
8
8
  getIsobmffProcessProgress,
9
9
  processIsobmffFile,
10
10
  uploadUnprocessedFile,
11
- } from "@editframe/api";
11
+ } from "@editframe/api/node";
12
12
  import ora from "ora";
13
- import { getClient } from "../utils/index.ts";
13
+ import { getClient } from "../utils/index.js";
14
14
 
15
15
  program
16
16
  .command("process-file <file>")
@@ -3,11 +3,11 @@ import path from "node:path";
3
3
 
4
4
  import { program } from "commander";
5
5
 
6
- import { withSpinner } from "../utils/withSpinner.ts";
7
- import { launchBrowserAndWaitForSDK } from "../utils/launchBrowserAndWaitForSDK.ts";
8
- import { PreviewServer } from "../utils/startPreviewServer.ts";
9
- import { getRenderInfo } from "../operations/getRenderInfo.ts";
10
- import { processRenderInfo } from "../operations/processRenderInfo.ts";
6
+ import { getRenderInfo } from "../operations/getRenderInfo.js";
7
+ import { processRenderInfo } from "../operations/processRenderInfo.js";
8
+ import { launchBrowserAndWaitForSDK } from "../utils/launchBrowserAndWaitForSDK.js";
9
+ import { PreviewServer } from "../utils/startPreviewServer.js";
10
+ import { withSpinner } from "../utils/withSpinner.js";
11
11
 
12
12
  program
13
13
  .command("process [directory]")
@@ -12,17 +12,16 @@ import { md5Directory, md5FilePath } from "@editframe/assets";
12
12
  import { spawnSync } from "node:child_process";
13
13
  import { createRender, uploadRender } from "@editframe/api";
14
14
  import debug from "debug";
15
- import { RenderInfo, getRenderInfo } from "../operations/getRenderInfo.ts";
16
- import { processRenderInfo } from "../operations/processRenderInfo.ts";
17
- import { syncAssetDirectory } from "../operations/syncAssetsDirectory.ts";
18
- import { SyncStatus } from "../operations/syncAssetsDirectory/SyncStatus.ts";
19
- import { createReadableStreamFromReadable } from "../utils/createReadableStreamFromReadable.ts";
20
- import { getFolderSize } from "../utils/getFolderSize.ts";
21
- import { getClient } from "../utils/index.ts";
22
- import { launchBrowserAndWaitForSDK } from "../utils/launchBrowserAndWaitForSDK.ts";
23
- import { PreviewServer } from "../utils/startPreviewServer.ts";
24
- import { validateVideoResolution } from "../utils/validateVideoResolution.ts";
25
- import { withSpinner } from "../utils/withSpinner.ts";
15
+ import { RenderInfo, getRenderInfo } from "../operations/getRenderInfo.js";
16
+ import { processRenderInfo } from "../operations/processRenderInfo.js";
17
+ import { syncAssetDirectory } from "../operations/syncAssetsDirectory.js";
18
+ import { SyncStatus } from "../operations/syncAssetsDirectory/SyncStatus.js";
19
+ import { createReadableStreamFromReadable } from "../utils/createReadableStreamFromReadable.js";
20
+ import { getClient } from "../utils/index.js";
21
+ import { launchBrowserAndWaitForSDK } from "../utils/launchBrowserAndWaitForSDK.js";
22
+ import { PreviewServer } from "../utils/startPreviewServer.js";
23
+ import { validateVideoResolution } from "../utils/validateVideoResolution.js";
24
+ import { withSpinner } from "../utils/withSpinner.js";
26
25
 
27
26
  const log = debug("ef:cli:render");
28
27
 
@@ -181,12 +180,10 @@ program
181
180
  const readable = new PassThrough();
182
181
  tarStream.pipe(readable);
183
182
 
184
- const folderSize = await getFolderSize(distDir);
185
183
  await uploadRender(
186
184
  getClient(),
187
185
  render.id,
188
186
  createReadableStreamFromReadable(readable),
189
- folderSize,
190
187
  );
191
188
  process.stderr.write("Render assets uploaded\n");
192
189
  process.stderr.write(inspect(render));
@@ -1,6 +1,6 @@
1
1
  import { join } from "node:path";
2
2
  import { program } from "commander";
3
- import { syncAssetDirectory } from "../operations/syncAssetsDirectory.ts";
3
+ import { syncAssetDirectory } from "../operations/syncAssetsDirectory.js";
4
4
 
5
5
  program
6
6
  .command("sync")
@@ -1,10 +1,10 @@
1
- import { program, Option } from "commander";
2
- import ora from "ora";
1
+ import { input, select } from "@inquirer/prompts";
3
2
  import chalk from "chalk";
3
+ import { Option, program } from "commander";
4
4
  import debug from "debug";
5
- import { input, select } from "@inquirer/prompts";
5
+ import ora from "ora";
6
6
 
7
- import { getClient } from "../utils/index.ts";
7
+ import { getClient } from "../utils/index.js";
8
8
 
9
9
  const log = debug("ef:cli:auth");
10
10
 
@@ -1,9 +1,9 @@
1
1
  import {
2
- generateTrack,
3
2
  cacheImage,
4
3
  findOrCreateCaptions,
4
+ generateTrack,
5
5
  } from "@editframe/assets";
6
- import type { getRenderInfo } from "./getRenderInfo.ts";
6
+ import type { getRenderInfo } from "./getRenderInfo.js";
7
7
 
8
8
  export const processRenderInfo = async (
9
9
  renderInfo: Awaited<ReturnType<typeof getRenderInfo>>,
@@ -1,10 +1,10 @@
1
1
  import debug from "debug";
2
- import type { SyncStatus } from "./SyncStatus.ts";
2
+ import type { SyncStatus } from "./SyncStatus.js";
3
3
 
4
- import { SyncCaption } from "./SyncCaption.ts";
5
- import { SyncFragmentIndex } from "./SyncFragmentIndex.ts";
6
- import { SyncImage } from "./SyncImage.ts";
7
- import { SyncTrack } from "./SyncTrack.ts";
4
+ import { SyncCaption } from "./SyncCaption.js";
5
+ import { SyncFragmentIndex } from "./SyncFragmentIndex.js";
6
+ import { SyncImage } from "./SyncImage.js";
7
+ import { SyncTrack } from "./SyncTrack.js";
8
8
 
9
9
  export interface SubAssetSync<CreationType> {
10
10
  icon: string;
@@ -1,13 +1,13 @@
1
- import { useMSW } from "TEST/useMSW.ts";
1
+ import { useMSW } from "TEST/useMSW.js";
2
2
  import { describe, expect, test } from "vitest";
3
- import { fixture, withFixtures } from "../../../test-fixtures/fixture.ts";
3
+ import { fixture, withFixtures } from "../../../test-fixtures/fixture.js";
4
4
  import {
5
5
  mockCreateCaptionFile,
6
6
  mockLookupCaptionFileByMd5,
7
7
  mockLookupCaptionFileByMd5NotFound,
8
8
  mockUploadCaptionFile,
9
- } from "../../../test-fixtures/network.ts";
10
- import { SyncCaption } from "./SyncCaption.ts";
9
+ } from "../../../test-fixtures/network.js";
10
+ import { SyncCaption } from "./SyncCaption.js";
11
11
  describe("SyncCaption", async () => {
12
12
  const server = useMSW();
13
13
  await withFixtures(
@@ -9,12 +9,12 @@ import {
9
9
  } from "@editframe/api";
10
10
 
11
11
  import { Readable } from "node:stream";
12
- import { getClient } from "../../utils/index.ts";
12
+ import { getClient } from "../../utils/index.js";
13
13
 
14
14
  import { basename } from "node:path";
15
- import { createReadableStreamFromReadable } from "../../utils/createReadableStreamFromReadable.ts";
16
- import type { SubAssetSync } from "./SubAssetSync.ts";
17
- import { SyncStatus } from "./SyncStatus.ts";
15
+ import { createReadableStreamFromReadable } from "../../utils/createReadableStreamFromReadable.js";
16
+ import type { SubAssetSync } from "./SubAssetSync.js";
17
+ import { SyncStatus } from "./SyncStatus.js";
18
18
  export class SyncCaption implements SubAssetSync<CreateCaptionFileResult> {
19
19
  icon = "📝";
20
20
  label = "captions";
@@ -1,13 +1,13 @@
1
- import { useMSW } from "TEST/useMSW.ts";
1
+ import { useMSW } from "TEST/useMSW.js";
2
2
  import { describe, expect, test } from "vitest";
3
- import { fixture, withFixtures } from "../../../test-fixtures/fixture.ts";
3
+ import { fixture, withFixtures } from "../../../test-fixtures/fixture.js";
4
4
  import {
5
5
  mockCreateIsobmffFile,
6
6
  mockLookupISOBMFFFileByMd5,
7
7
  mockLookupISOBMFFFileByMd5NotFound,
8
8
  mockUploadIsobmffFileIndex,
9
- } from "../../../test-fixtures/network.ts";
10
- import { SyncFragmentIndex } from "./SyncFragmentIndex.ts";
9
+ } from "../../../test-fixtures/network.js";
10
+ import { SyncFragmentIndex } from "./SyncFragmentIndex.js";
11
11
 
12
12
  describe("SyncFragmentIndex", async () => {
13
13
  const server = useMSW();
@@ -10,10 +10,10 @@ import {
10
10
  uploadFragmentIndex,
11
11
  } from "@editframe/api";
12
12
 
13
- import { createReadableStreamFromReadable } from "../../utils/createReadableStreamFromReadable.ts";
14
- import { getClient } from "../../utils/index.ts";
15
- import type { SubAssetSync } from "./SubAssetSync.ts";
16
- import { SyncStatus } from "./SyncStatus.ts";
13
+ import { createReadableStreamFromReadable } from "../../utils/createReadableStreamFromReadable.js";
14
+ import { getClient } from "../../utils/index.js";
15
+ import type { SubAssetSync } from "./SubAssetSync.js";
16
+ import { SyncStatus } from "./SyncStatus.js";
17
17
 
18
18
  export class SyncFragmentIndex
19
19
  implements SubAssetSync<CreateISOBMFFFileResult>
@@ -1,13 +1,13 @@
1
- import { useMSW } from "TEST/useMSW.ts";
1
+ import { useMSW } from "TEST/useMSW.js";
2
2
  import { describe, expect, test } from "vitest";
3
- import { fixture, withFixtures } from "../../../test-fixtures/fixture.ts";
3
+ import { fixture, withFixtures } from "../../../test-fixtures/fixture.js";
4
4
  import {
5
5
  mockCreateImageFile,
6
6
  mockGetUploadImageFile,
7
7
  mockLookupImageFileByMd5,
8
8
  mockLookupImageFileByMd5NotFound,
9
- } from "../../../test-fixtures/network.ts";
10
- import { SyncImage } from "./SyncImage.ts";
9
+ } from "../../../test-fixtures/network.js";
10
+ import { SyncImage } from "./SyncImage.js";
11
11
  describe("SyncImage", async () => {
12
12
  const server = useMSW();
13
13
  await withFixtures(
@@ -12,10 +12,10 @@ import {
12
12
 
13
13
  import { Probe } from "@editframe/assets";
14
14
 
15
- import { createReadableStreamFromReadable } from "../../utils/createReadableStreamFromReadable.ts";
16
- import { getClient } from "../../utils/index.ts";
17
- import type { SubAssetSync } from "./SubAssetSync.ts";
18
- import { SyncStatus } from "./SyncStatus.ts";
15
+ import { createReadableStreamFromReadable } from "../../utils/createReadableStreamFromReadable.js";
16
+ import { getClient } from "../../utils/index.js";
17
+ import type { SubAssetSync } from "./SubAssetSync.js";
18
+ import { SyncStatus } from "./SyncStatus.js";
19
19
 
20
20
  export class SyncImage implements SubAssetSync<CreateImageFileResult> {
21
21
  icon = "🖼️";
@@ -1,14 +1,14 @@
1
- import { useMSW } from "TEST/useMSW.ts";
1
+ import { useMSW } from "TEST/useMSW.js";
2
2
  import { describe, expect, test } from "vitest";
3
- import { fixture, withFixtures } from "../../../test-fixtures/fixture.ts";
3
+ import { fixture, withFixtures } from "../../../test-fixtures/fixture.js";
4
4
  import {
5
5
  mockCreateIsobmffFile,
6
6
  mockCreateIsobmffTrack,
7
7
  mockGetIsobmffTrackUpload,
8
8
  mockLookupISOBMFFFileByMd5,
9
9
  mockLookupISOBMFFFileByMd5NotFound,
10
- } from "../../../test-fixtures/network.ts";
11
- import { SyncTrack } from "./SyncTrack.ts";
10
+ } from "../../../test-fixtures/network.js";
11
+ import { SyncTrack } from "./SyncTrack.js";
12
12
 
13
13
  describe("SyncTrack", async () => {
14
14
  const server = useMSW();
@@ -2,8 +2,6 @@ import { createReadStream } from "node:fs";
2
2
  import fs from "node:fs/promises";
3
3
  import { basename, dirname, join } from "node:path";
4
4
 
5
- import type { z } from "zod";
6
-
7
5
  import {
8
6
  type CreateISOBMFFFileResult,
9
7
  type CreateISOBMFFTrackPayload,
@@ -16,10 +14,10 @@ import {
16
14
  } from "@editframe/api";
17
15
  import { Probe } from "@editframe/assets";
18
16
 
19
- import { createReadableStreamFromReadable } from "../../utils/createReadableStreamFromReadable.ts";
20
- import { getClient } from "../../utils/index.ts";
21
- import type { SubAssetSync } from "./SubAssetSync.ts";
22
- import { SyncStatus } from "./SyncStatus.ts";
17
+ import { createReadableStreamFromReadable } from "../../utils/createReadableStreamFromReadable.js";
18
+ import { getClient } from "../../utils/index.js";
19
+ import type { SubAssetSync } from "./SubAssetSync.js";
20
+ import { SyncStatus } from "./SyncStatus.js";
23
21
 
24
22
  export class SyncTrack implements SubAssetSync<CreateISOBMFFTrackResult> {
25
23
  icon = "📼";
@@ -91,6 +89,9 @@ export class SyncTrack implements SubAssetSync<CreateISOBMFFTrackResult> {
91
89
  if (!track.duration) {
92
90
  throw new Error(`No duration found in track: ${this.path}`);
93
91
  }
92
+ if (typeof track.duration === "string") {
93
+ return Number.parseFloat(track.duration);
94
+ }
94
95
  return track.duration;
95
96
  }
96
97
 
@@ -104,7 +105,10 @@ export class SyncTrack implements SubAssetSync<CreateISOBMFFTrackResult> {
104
105
  const track = this.track;
105
106
  const isoFile = this.isoFile;
106
107
 
107
- const createPayload: z.infer<typeof CreateISOBMFFTrackPayload> =
108
+ if (track.codec_type === "data") {
109
+ throw new Error(`Unsupported codec type: ${track.codec_type}`);
110
+ }
111
+ const createPayload: CreateISOBMFFTrackPayload =
108
112
  track.codec_type === "audio"
109
113
  ? {
110
114
  type: track.codec_type,
@@ -1,7 +1,7 @@
1
1
  import { describe, expect, test, vi } from "vitest";
2
- import type { SubAssetSync } from "./SubAssetSync.ts";
3
- import type { SyncStatusInfo } from "./SyncStatus.ts";
4
- import { doAssetSync } from "./doAssetSync.ts";
2
+ import type { SubAssetSync } from "./SubAssetSync.js";
3
+ import type { SyncStatusInfo } from "./SyncStatus.js";
4
+ import { doAssetSync } from "./doAssetSync.js";
5
5
 
6
6
  const collectAsyncGenerator = async (
7
7
  generator: SubAssetSync<unknown>,
@@ -1,4 +1,4 @@
1
- import type { SubAssetSync } from "./SubAssetSync.ts";
1
+ import type { SubAssetSync } from "./SubAssetSync.js";
2
2
 
3
3
  export const doAssetSync = async function* (
4
4
  assetSync: SubAssetSync<unknown>,
@@ -1,7 +1,7 @@
1
1
  import { describe, it } from "vitest";
2
2
 
3
- import { useMSW } from "TEST/useMSW.ts";
4
- import { fixture, withFixtures } from "../../test-fixtures/fixture.ts";
3
+ import { useMSW } from "TEST/useMSW.js";
4
+ import { fixture, withFixtures } from "../../test-fixtures/fixture.js";
5
5
  import {
6
6
  mockCreateImageFile,
7
7
  mockCreateIsobmffFile,
@@ -10,7 +10,7 @@ import {
10
10
  mockLookupISOBMFFFileByMd5NotFound,
11
11
  mockLookupImageFileByMd5NotFound,
12
12
  mockUploadIsobmffFileIndex,
13
- } from "../../test-fixtures/network.ts";
13
+ } from "../../test-fixtures/network.js";
14
14
 
15
15
  describe("syncAssetsDirectory", () => {
16
16
  const server = useMSW();
@@ -1,7 +1,7 @@
1
1
  import fs from "node:fs/promises";
2
2
  import path from "node:path";
3
- import { getAssetSync } from "./syncAssetsDirectory/SubAssetSync.ts";
4
- import { doAssetSync } from "./syncAssetsDirectory/doAssetSync.ts";
3
+ import { getAssetSync } from "./syncAssetsDirectory/SubAssetSync.js";
4
+ import { doAssetSync } from "./syncAssetsDirectory/doAssetSync.js";
5
5
 
6
6
  export const syncAssetDirectory = async (
7
7
  /**
@@ -1,24 +1,20 @@
1
1
  import { promises as fs } from "node:fs";
2
2
  import path from "node:path";
3
3
 
4
- export const getFolderSize = async (folderPath: string): Promise<number> => {
5
- let totalSize = 0;
4
+ export async function getFolderSize(dir: string): Promise<number> {
5
+ const files = await fs.readdir(dir);
6
+ let size = 0;
6
7
 
7
- async function calculateSize(dir: string): Promise<void> {
8
- const files = await fs.readdir(dir);
8
+ for (const file of files) {
9
+ const filePath = path.join(dir, file);
10
+ const stats = await fs.stat(filePath);
9
11
 
10
- for (const file of files) {
11
- const filePath = path.join(dir, file);
12
- const stats = await fs.stat(filePath);
13
-
14
- if (stats.isDirectory()) {
15
- await calculateSize(filePath);
16
- } else {
17
- totalSize += stats.size;
18
- }
12
+ if (stats.isDirectory()) {
13
+ size += await getFolderSize(filePath);
14
+ } else {
15
+ size += stats.size;
19
16
  }
20
17
  }
21
18
 
22
- await calculateSize(folderPath);
23
- return totalSize;
24
- };
19
+ return size;
20
+ }
@@ -2,7 +2,7 @@ import chalk from "chalk";
2
2
  import debug from "debug";
3
3
  import { type Browser, type Page, chromium } from "playwright";
4
4
 
5
- import { withSpinner } from "./withSpinner.ts";
5
+ import { withSpinner } from "./withSpinner.js";
6
6
 
7
7
  const browserLog = debug("ef:cli::browser");
8
8
 
@@ -5,7 +5,7 @@ import { type ViteDevServer, createServer } from "vite";
5
5
 
6
6
  import { vitePluginEditframe as editframe } from "@editframe/vite-plugin";
7
7
 
8
- import { withSpinner } from "./withSpinner.ts";
8
+ import { withSpinner } from "./withSpinner.js";
9
9
 
10
10
  export class DevServer {
11
11
  static async start(directory: string) {
@@ -1,9 +1,9 @@
1
- import { type ViteDevServer, createServer } from "vite";
2
1
  import path from "node:path";
2
+ import { type ViteDevServer, createServer } from "vite";
3
3
 
4
4
  import { vitePluginEditframe as editframe } from "@editframe/vite-plugin";
5
5
 
6
- import { withSpinner } from "./withSpinner.ts";
6
+ import { withSpinner } from "./withSpinner.js";
7
7
 
8
8
  export class PreviewServer {
9
9
  static async start(directory: string) {
@@ -7,8 +7,8 @@ import { expect } from "vitest";
7
7
 
8
8
  import { md5Buffer } from "@editframe/assets";
9
9
 
10
- import { syncAssetDirectory } from "../src/operations/syncAssetsDirectory.ts";
11
- import type { SyncStatusInfo } from "../src/operations/syncAssetsDirectory/SyncStatus.ts";
10
+ import { syncAssetDirectory } from "../src/operations/syncAssetsDirectory.js";
11
+ import type { SyncStatusInfo } from "../src/operations/syncAssetsDirectory/SyncStatus.js";
12
12
 
13
13
  export const fixture = async (
14
14
  fixture: string,
@@ -1,5 +1,5 @@
1
1
  import { http, HttpResponse } from "msw";
2
- import type { Fixture } from "./fixture.ts";
2
+ import type { Fixture } from "./fixture.js";
3
3
 
4
4
  export const mockCreateImageFile = ({
5
5
  complete = true,
@@ -1,22 +0,0 @@
1
- import { promises } from "node:fs";
2
- import path from "node:path";
3
- const getFolderSize = async (folderPath) => {
4
- let totalSize = 0;
5
- async function calculateSize(dir) {
6
- const files = await promises.readdir(dir);
7
- for (const file of files) {
8
- const filePath = path.join(dir, file);
9
- const stats = await promises.stat(filePath);
10
- if (stats.isDirectory()) {
11
- await calculateSize(filePath);
12
- } else {
13
- totalSize += stats.size;
14
- }
15
- }
16
- }
17
- await calculateSize(folderPath);
18
- return totalSize;
19
- };
20
- export {
21
- getFolderSize
22
- };