@editframe/cli 0.10.0-beta.7 → 0.11.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.
package/dist/VERSION.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "0.10.0-beta.7";
1
+ export declare const VERSION = "0.11.0-beta.2";
package/dist/VERSION.js CHANGED
@@ -1,4 +1,4 @@
1
- const VERSION = "0.10.0-beta.7";
1
+ const VERSION = "0.11.0-beta.2";
2
2
  export {
3
3
  VERSION
4
4
  };
@@ -1,4 +1,4 @@
1
- import { CreateCaptionFileResult } from '../../../../api/src';
1
+ import { CreateCaptionFileResult } from '../../../../api/src/index.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 } from '../../../../api/src';
1
+ import { CreateISOBMFFFileResult } from '../../../../api/src/index.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,5 +1,5 @@
1
- import { CreateImageFileResult } from '../../../../api/src';
2
- import { Probe } from '../../../../assets/src';
1
+ import { CreateImageFileResult } from '../../../../api/src/index.ts';
2
+ import { Probe } from '../../../../assets/src/index.ts';
3
3
  import { SubAssetSync } from './SubAssetSync.ts';
4
4
  import { SyncStatus } from './SyncStatus.ts';
5
5
  export declare class SyncImage implements SubAssetSync<CreateImageFileResult> {
@@ -60,18 +60,18 @@ class SyncImage {
60
60
  isComplete() {
61
61
  return !!this.created?.complete;
62
62
  }
63
- upload() {
63
+ async upload() {
64
64
  if (!this.created) {
65
65
  throw new Error(
66
66
  "Image not created. Should have been prevented by .isComplete()"
67
67
  );
68
68
  }
69
- return uploadImageFile(
69
+ await uploadImageFile(
70
70
  getClient(),
71
71
  this.created.id,
72
72
  createReadStream(this.path),
73
73
  Number.parseInt(this.probeResult.format.size || "0")
74
- );
74
+ ).whenUploaded();
75
75
  }
76
76
  async markSynced() {
77
77
  if (!this.created) {
@@ -1,5 +1,5 @@
1
- import { CreateISOBMFFFileResult, CreateISOBMFFTrackResult } from '../../../../api/src';
2
- import { Probe } from '../../../../assets/src';
1
+ import { CreateISOBMFFFileResult, CreateISOBMFFTrackResult } from '../../../../api/src/index.ts';
2
+ import { Probe } from '../../../../assets/src/index.ts';
3
3
  import { SubAssetSync } from './SubAssetSync.ts';
4
4
  import { SyncStatus } from './SyncStatus.ts';
5
5
  export declare class SyncTrack implements SubAssetSync<CreateISOBMFFTrackResult> {
@@ -98,13 +98,13 @@ class SyncTrack {
98
98
  "Track not created. Should have been prevented by .isComplete()"
99
99
  );
100
100
  }
101
- return uploadISOBMFFTrack(
101
+ await uploadISOBMFFTrack(
102
102
  getClient(),
103
103
  this.isoFile.id,
104
104
  Number(this.trackId),
105
105
  createReadStream(this.path),
106
106
  this.created?.byte_size
107
- );
107
+ ).whenUploaded();
108
108
  }
109
109
  async markSynced() {
110
110
  if (!this.created) {
@@ -1,2 +1,2 @@
1
- import { Client } from '../../../api/src';
1
+ import { Client } from '../../../api/src/index.ts';
2
2
  export declare const getClient: () => Client;
@@ -5,10 +5,14 @@ let client;
5
5
  const getClient = () => {
6
6
  if (!client) {
7
7
  const programOpts = program.opts();
8
- client = new Client(
9
- programOpts.token || process.env.EF_TOKEN,
10
- programOpts.efHost || process.env.EF_HOST
11
- );
8
+ const token = programOpts.token || process.env.EF_TOKEN;
9
+ const efHost = programOpts.efHost || process.env.EF_HOST;
10
+ if (!token) {
11
+ throw new Error(
12
+ "EF_TOKEN must be set or supplied as command line argument"
13
+ );
14
+ }
15
+ client = new Client(token, efHost);
12
16
  }
13
17
  return client;
14
18
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@editframe/cli",
3
- "version": "0.10.0-beta.7",
3
+ "version": "0.11.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.10.0-beta.7",
27
- "@editframe/assets": "0.10.0-beta.7",
28
- "@editframe/elements": "0.10.0-beta.7",
29
- "@editframe/vite-plugin": "0.10.0-beta.7",
26
+ "@editframe/api": "0.11.0-beta.2",
27
+ "@editframe/assets": "0.11.0-beta.2",
28
+ "@editframe/elements": "0.11.0-beta.2",
29
+ "@editframe/vite-plugin": "0.11.0-beta.2",
30
30
  "@inquirer/prompts": "^5.3.8",
31
31
  "axios": "^1.6.8",
32
32
  "chalk": "^5.3.0",
@@ -70,9 +70,7 @@ describe("SyncImage", async () => {
70
70
  test("throws when not created", async () => {
71
71
  const syncImage = new SyncImage(await cacheImage(image!), image!.md5);
72
72
  await syncImage.prepare();
73
- // This is throwing syncronously because the error is thrown before
74
- // any async operations are awaited.
75
- expect(() => syncImage.upload()).toThrow();
73
+ await expect(() => syncImage.upload()).rejects.toThrow();
76
74
  });
77
75
  test("uploads image", async () => {
78
76
  server.use(
@@ -80,18 +80,18 @@ export class SyncImage implements SubAssetSync<CreateImageFileResult> {
80
80
  isComplete() {
81
81
  return !!this.created?.complete;
82
82
  }
83
- upload() {
83
+ async upload() {
84
84
  if (!this.created) {
85
85
  throw new Error(
86
86
  "Image not created. Should have been prevented by .isComplete()",
87
87
  );
88
88
  }
89
- return uploadImageFile(
89
+ await uploadImageFile(
90
90
  getClient(),
91
91
  this.created.id,
92
92
  createReadStream(this.path),
93
93
  Number.parseInt(this.probeResult.format.size || "0"),
94
- );
94
+ ).whenUploaded();
95
95
  }
96
96
  async markSynced() {
97
97
  if (!this.created) {
@@ -127,13 +127,13 @@ export class SyncTrack implements SubAssetSync<CreateISOBMFFTrackResult> {
127
127
  "Track not created. Should have been prevented by .isComplete()",
128
128
  );
129
129
  }
130
- return uploadISOBMFFTrack(
130
+ await uploadISOBMFFTrack(
131
131
  getClient(),
132
132
  this.isoFile.id,
133
133
  Number(this.trackId),
134
134
  createReadStream(this.path),
135
135
  this.created?.byte_size,
136
- );
136
+ ).whenUploaded();
137
137
  }
138
138
  async markSynced() {
139
139
  if (!this.created) {
@@ -7,10 +7,14 @@ let client: Client;
7
7
  export const getClient = () => {
8
8
  if (!client) {
9
9
  const programOpts = program.opts();
10
- client = new Client(
11
- programOpts.token || process.env.EF_TOKEN,
12
- programOpts.efHost || process.env.EF_HOST,
13
- );
10
+ const token = programOpts.token || process.env.EF_TOKEN;
11
+ const efHost = programOpts.efHost || process.env.EF_HOST;
12
+ if (!token) {
13
+ throw new Error(
14
+ "EF_TOKEN must be set or supplied as command line argument",
15
+ );
16
+ }
17
+ client = new Client(token, efHost);
14
18
  }
15
19
  return client;
16
20
  };
@@ -1,26 +0,0 @@
1
- import { SyncStatusInfo } from '../src/operations/syncAssetsDirectory/SyncStatus.ts';
2
- export declare const fixture: (fixture: string, name: string) => Promise<Fixture>;
3
- export interface Fixture {
4
- name: string;
5
- fixture: string;
6
- md5: string;
7
- content: Buffer;
8
- originalPath: string;
9
- write: (dir: string) => Promise<void>;
10
- }
11
- export declare const withFixtures: (fixtures: Promise<Fixture>[], fn: (props: {
12
- files: Fixture[];
13
- rootDir: string;
14
- srcDir: string;
15
- assetsDir: string;
16
- cacheDir: string;
17
- expectCacheFiles: (fixture: Fixture, files: string[]) => Promise<void>;
18
- expectInfoFileContent: (fileName: string, fixture: Fixture, expectedContent: Pick<SyncStatusInfo, "complete" | "id"> & {
19
- byte_size?: number;
20
- }) => Promise<void>;
21
- syncAssetsDirectory: () => Promise<void>;
22
- cacheImage: (fixture: Fixture) => Promise<string>;
23
- generateTrack: (fixture: Fixture, trackId: number) => Promise<string>;
24
- generateTrackFragmentIndex: (fixture: Fixture) => Promise<string>;
25
- generateCaptions: (fixture: Fixture) => Promise<string>;
26
- }) => Promise<void>) => Promise<void>;