@editframe/cli 0.12.0-beta.2 → 0.12.0-beta.20
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 +1 -1
- package/dist/VERSION.js +1 -1
- package/dist/commands/process-file.js +9 -23
- package/dist/commands/process.js +3 -3
- package/dist/commands/webhook.js +3 -3
- package/dist/operations/processRenderInfo.d.ts +1 -1
- package/dist/operations/syncAssetsDirectory/SubAssetSync.d.ts +5 -5
- package/dist/operations/syncAssetsDirectory/SyncCaption.d.ts +2 -2
- package/dist/operations/syncAssetsDirectory/SyncFragmentIndex.d.ts +2 -2
- package/dist/operations/syncAssetsDirectory/SyncImage.d.ts +2 -2
- package/dist/operations/syncAssetsDirectory/SyncImage.js +5 -3
- package/dist/operations/syncAssetsDirectory/SyncTrack.d.ts +6 -2
- package/dist/operations/syncAssetsDirectory/SyncTrack.js +6 -0
- package/dist/operations/syncAssetsDirectory/doAssetSync.d.ts +1 -1
- package/dist/utils/startPreviewServer.js +1 -1
- package/package.json +5 -5
- package/src/commands/auth.ts +1 -1
- package/src/commands/process-file.ts +13 -31
- package/src/commands/process.ts +5 -5
- package/src/commands/render.ts +11 -11
- package/src/commands/sync.ts +1 -1
- package/src/commands/webhook.ts +4 -4
- package/src/operations/processRenderInfo.ts +2 -2
- package/src/operations/syncAssetsDirectory/SubAssetSync.ts +5 -5
- package/src/operations/syncAssetsDirectory/SyncCaption.test.ts +4 -4
- package/src/operations/syncAssetsDirectory/SyncCaption.ts +4 -4
- package/src/operations/syncAssetsDirectory/SyncFragmentIndex.test.ts +4 -4
- package/src/operations/syncAssetsDirectory/SyncFragmentIndex.ts +4 -4
- package/src/operations/syncAssetsDirectory/SyncImage.test.ts +4 -4
- package/src/operations/syncAssetsDirectory/SyncImage.ts +8 -6
- package/src/operations/syncAssetsDirectory/SyncTrack.test.ts +4 -4
- package/src/operations/syncAssetsDirectory/SyncTrack.ts +11 -7
- package/src/operations/syncAssetsDirectory/doAssetSync.test.ts +3 -3
- package/src/operations/syncAssetsDirectory/doAssetSync.ts +1 -1
- package/src/operations/syncAssetsDirectory.test.ts +3 -3
- package/src/operations/syncAssetsDirectory.ts +2 -2
- package/src/utils/launchBrowserAndWaitForSDK.ts +1 -1
- package/src/utils/startDevServer.ts +1 -1
- package/src/utils/startPreviewServer.ts +2 -2
- package/test-fixtures/fixture.ts +2 -2
- package/test-fixtures/network.ts +1 -1
package/dist/VERSION.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.12.0-beta.
|
|
1
|
+
export declare const VERSION = "0.12.0-beta.20";
|
package/dist/VERSION.js
CHANGED
|
@@ -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,
|
|
7
|
-
import { md5FilePath } from "@editframe/assets";
|
|
3
|
+
import { uploadUnprocessedFile, getIsobmffProcessProgress, getIsobmffProcessInfo, createUnprocessedFileFromPath, processIsobmffFile } from "@editframe/api/node";
|
|
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
|
-
|
|
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
|
|
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(
|
|
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,
|
|
35
|
+
const info = await getIsobmffProcessInfo(client, processorRecord.id);
|
|
50
36
|
console.log("Processed file info");
|
|
51
37
|
console.log(info);
|
|
52
38
|
});
|
package/dist/commands/process.js
CHANGED
|
@@ -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) => {
|
package/dist/commands/webhook.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
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
|
|
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 = [
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { getRenderInfo } from './getRenderInfo.
|
|
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.
|
|
2
|
-
import { SyncCaption } from './SyncCaption.
|
|
3
|
-
import { SyncFragmentIndex } from './SyncFragmentIndex.
|
|
4
|
-
import { SyncImage } from './SyncImage.
|
|
5
|
-
import { SyncTrack } from './SyncTrack.
|
|
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
1
|
import { CreateCaptionFileResult, LookupCaptionFileByMd5Result } from '../../../../api/src/index.ts';
|
|
2
|
-
import { SubAssetSync } from './SubAssetSync.
|
|
3
|
-
import { SyncStatus } from './SyncStatus.
|
|
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
1
|
import { CreateISOBMFFFileResult, LookupISOBMFFFileByMd5Result } from '../../../../api/src/index.ts';
|
|
2
|
-
import { SubAssetSync } from './SubAssetSync.
|
|
3
|
-
import { SyncStatus } from './SyncStatus.
|
|
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
1
|
import { CreateImageFileResult, LookupImageFileByMd5Result } from '../../../../api/src/index.ts';
|
|
2
2
|
import { Probe } from '../../../../assets/src/index.ts';
|
|
3
|
-
import { SubAssetSync } from './SubAssetSync.
|
|
4
|
-
import { SyncStatus } from './SyncStatus.
|
|
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;
|
|
@@ -74,9 +74,11 @@ class SyncImage {
|
|
|
74
74
|
}
|
|
75
75
|
await uploadImageFile(
|
|
76
76
|
getClient(),
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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() {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CreateISOBMFFFileResult, CreateISOBMFFTrackResult, LookupISOBMFFFileByMd5Result } from '../../../../api/src/index.ts';
|
|
2
2
|
import { Probe } from '../../../../assets/src/index.ts';
|
|
3
|
-
import { SubAssetSync } from './SubAssetSync.
|
|
4
|
-
import { SyncStatus } from './SyncStatus.
|
|
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;
|
|
@@ -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,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@editframe/cli",
|
|
3
|
-
"version": "0.12.0-beta.
|
|
3
|
+
"version": "0.12.0-beta.20",
|
|
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.
|
|
27
|
-
"@editframe/assets": "0.12.0-beta.
|
|
28
|
-
"@editframe/elements": "0.12.0-beta.
|
|
29
|
-
"@editframe/vite-plugin": "0.12.0-beta.
|
|
26
|
+
"@editframe/api": "0.12.0-beta.20",
|
|
27
|
+
"@editframe/assets": "0.12.0-beta.20",
|
|
28
|
+
"@editframe/elements": "0.12.0-beta.20",
|
|
29
|
+
"@editframe/vite-plugin": "0.12.0-beta.20",
|
|
30
30
|
"@inquirer/prompts": "^5.3.8",
|
|
31
31
|
"axios": "^1.6.8",
|
|
32
32
|
"chalk": "^5.3.0",
|
package/src/commands/auth.ts
CHANGED
|
@@ -1,22 +1,16 @@
|
|
|
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
|
-
import { withSpinner } from "../utils/withSpinner.
|
|
3
|
+
import { withSpinner } from "../utils/withSpinner.js";
|
|
8
4
|
|
|
9
5
|
import {
|
|
10
|
-
|
|
6
|
+
createUnprocessedFileFromPath,
|
|
11
7
|
getIsobmffProcessInfo,
|
|
12
8
|
getIsobmffProcessProgress,
|
|
13
9
|
processIsobmffFile,
|
|
14
10
|
uploadUnprocessedFile,
|
|
15
|
-
} from "@editframe/api";
|
|
16
|
-
import { md5FilePath } from "@editframe/assets";
|
|
11
|
+
} from "@editframe/api/node";
|
|
17
12
|
import ora from "ora";
|
|
18
|
-
import {
|
|
19
|
-
import { getClient } from "../utils/index.ts";
|
|
13
|
+
import { getClient } from "../utils/index.js";
|
|
20
14
|
|
|
21
15
|
program
|
|
22
16
|
.command("process-file <file>")
|
|
@@ -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
|
-
|
|
34
|
-
await createUnprocessedFile(client, {
|
|
35
|
-
md5,
|
|
36
|
-
filename: basename(path),
|
|
37
|
-
byte_size,
|
|
38
|
-
}),
|
|
23
|
+
() => createUnprocessedFileFromPath(client, path),
|
|
39
24
|
);
|
|
40
25
|
|
|
41
|
-
const
|
|
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
|
|
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(
|
|
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,
|
|
53
|
+
const info = await getIsobmffProcessInfo(client, processorRecord.id);
|
|
72
54
|
|
|
73
55
|
console.log("Processed file info");
|
|
74
56
|
console.log(info);
|
package/src/commands/process.ts
CHANGED
|
@@ -3,11 +3,11 @@ import path from "node:path";
|
|
|
3
3
|
|
|
4
4
|
import { program } from "commander";
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
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]")
|
package/src/commands/render.ts
CHANGED
|
@@ -12,17 +12,17 @@ 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.
|
|
16
|
-
import { processRenderInfo } from "../operations/processRenderInfo.
|
|
17
|
-
import { syncAssetDirectory } from "../operations/syncAssetsDirectory.
|
|
18
|
-
import { SyncStatus } from "../operations/syncAssetsDirectory/SyncStatus.
|
|
19
|
-
import { createReadableStreamFromReadable } from "../utils/createReadableStreamFromReadable.
|
|
20
|
-
import { getFolderSize } from "../utils/getFolderSize.
|
|
21
|
-
import { getClient } from "../utils/index.
|
|
22
|
-
import { launchBrowserAndWaitForSDK } from "../utils/launchBrowserAndWaitForSDK.
|
|
23
|
-
import { PreviewServer } from "../utils/startPreviewServer.
|
|
24
|
-
import { validateVideoResolution } from "../utils/validateVideoResolution.
|
|
25
|
-
import { withSpinner } from "../utils/withSpinner.
|
|
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 { getFolderSize } from "../utils/getFolderSize.js";
|
|
21
|
+
import { getClient } from "../utils/index.js";
|
|
22
|
+
import { launchBrowserAndWaitForSDK } from "../utils/launchBrowserAndWaitForSDK.js";
|
|
23
|
+
import { PreviewServer } from "../utils/startPreviewServer.js";
|
|
24
|
+
import { validateVideoResolution } from "../utils/validateVideoResolution.js";
|
|
25
|
+
import { withSpinner } from "../utils/withSpinner.js";
|
|
26
26
|
|
|
27
27
|
const log = debug("ef:cli:render");
|
|
28
28
|
|
package/src/commands/sync.ts
CHANGED
package/src/commands/webhook.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
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
|
|
5
|
+
import ora from "ora";
|
|
6
6
|
|
|
7
|
-
import { getClient } from "../utils/index.
|
|
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.
|
|
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.
|
|
2
|
+
import type { SyncStatus } from "./SyncStatus.js";
|
|
3
3
|
|
|
4
|
-
import { SyncCaption } from "./SyncCaption.
|
|
5
|
-
import { SyncFragmentIndex } from "./SyncFragmentIndex.
|
|
6
|
-
import { SyncImage } from "./SyncImage.
|
|
7
|
-
import { SyncTrack } from "./SyncTrack.
|
|
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.
|
|
1
|
+
import { useMSW } from "TEST/useMSW.js";
|
|
2
2
|
import { describe, expect, test } from "vitest";
|
|
3
|
-
import { fixture, withFixtures } from "../../../test-fixtures/fixture.
|
|
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.
|
|
10
|
-
import { SyncCaption } from "./SyncCaption.
|
|
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.
|
|
12
|
+
import { getClient } from "../../utils/index.js";
|
|
13
13
|
|
|
14
14
|
import { basename } from "node:path";
|
|
15
|
-
import { createReadableStreamFromReadable } from "../../utils/createReadableStreamFromReadable.
|
|
16
|
-
import type { SubAssetSync } from "./SubAssetSync.
|
|
17
|
-
import { SyncStatus } from "./SyncStatus.
|
|
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.
|
|
1
|
+
import { useMSW } from "TEST/useMSW.js";
|
|
2
2
|
import { describe, expect, test } from "vitest";
|
|
3
|
-
import { fixture, withFixtures } from "../../../test-fixtures/fixture.
|
|
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.
|
|
10
|
-
import { SyncFragmentIndex } from "./SyncFragmentIndex.
|
|
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.
|
|
14
|
-
import { getClient } from "../../utils/index.
|
|
15
|
-
import type { SubAssetSync } from "./SubAssetSync.
|
|
16
|
-
import { SyncStatus } from "./SyncStatus.
|
|
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.
|
|
1
|
+
import { useMSW } from "TEST/useMSW.js";
|
|
2
2
|
import { describe, expect, test } from "vitest";
|
|
3
|
-
import { fixture, withFixtures } from "../../../test-fixtures/fixture.
|
|
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.
|
|
10
|
-
import { SyncImage } from "./SyncImage.
|
|
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.
|
|
16
|
-
import { getClient } from "../../utils/index.
|
|
17
|
-
import type { SubAssetSync } from "./SubAssetSync.
|
|
18
|
-
import { SyncStatus } from "./SyncStatus.
|
|
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 = "🖼️";
|
|
@@ -97,9 +97,11 @@ export class SyncImage implements SubAssetSync<CreateImageFileResult> {
|
|
|
97
97
|
}
|
|
98
98
|
await uploadImageFile(
|
|
99
99
|
getClient(),
|
|
100
|
-
|
|
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() {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { useMSW } from "TEST/useMSW.
|
|
1
|
+
import { useMSW } from "TEST/useMSW.js";
|
|
2
2
|
import { describe, expect, test } from "vitest";
|
|
3
|
-
import { fixture, withFixtures } from "../../../test-fixtures/fixture.
|
|
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.
|
|
11
|
-
import { SyncTrack } from "./SyncTrack.
|
|
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.
|
|
20
|
-
import { getClient } from "../../utils/index.
|
|
21
|
-
import type { SubAssetSync } from "./SubAssetSync.
|
|
22
|
-
import { SyncStatus } from "./SyncStatus.
|
|
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
|
-
|
|
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.
|
|
3
|
-
import type { SyncStatusInfo } from "./SyncStatus.
|
|
4
|
-
import { doAssetSync } from "./doAssetSync.
|
|
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,7 +1,7 @@
|
|
|
1
1
|
import { describe, it } from "vitest";
|
|
2
2
|
|
|
3
|
-
import { useMSW } from "TEST/useMSW.
|
|
4
|
-
import { fixture, withFixtures } from "../../test-fixtures/fixture.
|
|
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.
|
|
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.
|
|
4
|
-
import { doAssetSync } from "./syncAssetsDirectory/doAssetSync.
|
|
3
|
+
import { getAssetSync } from "./syncAssetsDirectory/SubAssetSync.js";
|
|
4
|
+
import { doAssetSync } from "./syncAssetsDirectory/doAssetSync.js";
|
|
5
5
|
|
|
6
6
|
export const syncAssetDirectory = async (
|
|
7
7
|
/**
|
|
@@ -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.
|
|
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.
|
|
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.
|
|
6
|
+
import { withSpinner } from "./withSpinner.js";
|
|
7
7
|
|
|
8
8
|
export class PreviewServer {
|
|
9
9
|
static async start(directory: string) {
|
package/test-fixtures/fixture.ts
CHANGED
|
@@ -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.
|
|
11
|
-
import type { SyncStatusInfo } from "../src/operations/syncAssetsDirectory/SyncStatus.
|
|
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,
|
package/test-fixtures/network.ts
CHANGED