@editframe/api 0.12.0-beta.6 → 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/api/src/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CreateCaptionFilePayload, createCaptionFile, lookupCaptionFileByMd5, uploadCaptionFile } from "./resources/caption-file.js";
|
|
2
|
-
import { CreateImageFilePayload, createImageFile,
|
|
2
|
+
import { CreateImageFilePayload, createImageFile, lookupImageFileByMd5, uploadImageFile } from "./resources/image-file.js";
|
|
3
3
|
import { CreateISOBMFFFilePayload, TranscribeISOBMFFFilePayload, createISOBMFFFile, getISOBMFFFileTranscription, lookupISOBMFFFileByMd5, transcribeISOBMFFFile, uploadFragmentIndex } from "./resources/isobmff-file.js";
|
|
4
4
|
import { CreateISOBMFFTrackPayload, createISOBMFFTrack, uploadISOBMFFTrack } from "./resources/isobmff-track.js";
|
|
5
5
|
import { CreateRenderPayload, createRender, lookupRenderByMd5, uploadRender } from "./resources/renders.js";
|
|
@@ -22,7 +22,6 @@ export {
|
|
|
22
22
|
createISOBMFFFile,
|
|
23
23
|
createISOBMFFTrack,
|
|
24
24
|
createImageFile,
|
|
25
|
-
createImageFileFromPath,
|
|
26
25
|
createRender,
|
|
27
26
|
createTranscription,
|
|
28
27
|
createURLToken,
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import debug from "debug";
|
|
2
|
-
import
|
|
2
|
+
import "mime";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
-
import { stat } from "node:fs/promises";
|
|
5
|
-
import { basename } from "node:path";
|
|
6
|
-
import { md5FilePath } from "@editframe/assets";
|
|
7
4
|
import { uploadChunks } from "../uploadChunks.js";
|
|
8
5
|
const log = debug("ef:api:image-file");
|
|
9
6
|
const MAX_IMAGE_SIZE = 1024 * 1024 * 16;
|
|
@@ -15,22 +12,6 @@ const CreateImageFilePayload = z.object({
|
|
|
15
12
|
filename: z.string(),
|
|
16
13
|
byte_size: z.number().int().max(MAX_IMAGE_SIZE)
|
|
17
14
|
});
|
|
18
|
-
const createImageFileFromPath = async (client, path) => {
|
|
19
|
-
const fileInfo = await stat(path);
|
|
20
|
-
const byte_size = fileInfo.size;
|
|
21
|
-
const md5 = await md5FilePath(path);
|
|
22
|
-
const mime_type = mime.getType(path);
|
|
23
|
-
return createImageFile(client, {
|
|
24
|
-
...CreateImageFilePayload.parse({
|
|
25
|
-
md5,
|
|
26
|
-
height: 0,
|
|
27
|
-
width: 0,
|
|
28
|
-
mime_type,
|
|
29
|
-
filename: basename(path),
|
|
30
|
-
byte_size
|
|
31
|
-
})
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
15
|
const createImageFile = async (client, payload) => {
|
|
35
16
|
log("Creating image file", payload);
|
|
36
17
|
CreateImageFilePayload.parse(payload);
|
|
@@ -76,7 +57,6 @@ const lookupImageFileByMd5 = async (client, md5) => {
|
|
|
76
57
|
export {
|
|
77
58
|
CreateImageFilePayload,
|
|
78
59
|
createImageFile,
|
|
79
|
-
createImageFileFromPath,
|
|
80
60
|
lookupImageFileByMd5,
|
|
81
61
|
uploadImageFile
|
|
82
62
|
};
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
import { stat } from "node:fs/promises";
|
|
2
1
|
import debug from "debug";
|
|
3
2
|
import { z } from "zod";
|
|
4
|
-
import { createReadStream } from "node:fs";
|
|
5
|
-
import { basename } from "node:path";
|
|
6
|
-
import { md5FilePath } from "@editframe/assets";
|
|
7
|
-
import { createReadableStreamFromReadable } from "../../../cli/src/utils/createReadableStreamFromReadable.js";
|
|
8
3
|
import { uploadChunks } from "../uploadChunks.js";
|
|
9
4
|
const log = debug("ef:api:unprocessed-file");
|
|
10
5
|
const MAX_FILE_SIZE = 1024 * 1024 * 1024;
|
|
@@ -15,6 +10,17 @@ const CreateUnprocessedFilePayload = z.object({
|
|
|
15
10
|
});
|
|
16
11
|
z.object({});
|
|
17
12
|
const createUnprocessedFileFromPath = async (client, path) => {
|
|
13
|
+
const [{ stat }, { basename }, { md5FilePath }] = await Promise.all([
|
|
14
|
+
import("node:fs/promises"),
|
|
15
|
+
import("node:path"),
|
|
16
|
+
import("@editframe/assets")
|
|
17
|
+
]).catch((error) => {
|
|
18
|
+
console.error("Error importing modules", error);
|
|
19
|
+
console.error(
|
|
20
|
+
"This is likely because you are bundling for the browser. createUnprocessedFileFromPath can only be run in environments that support importing `node:path`"
|
|
21
|
+
);
|
|
22
|
+
throw error;
|
|
23
|
+
});
|
|
18
24
|
const fileInfo = await stat(path);
|
|
19
25
|
const byte_size = fileInfo.size;
|
|
20
26
|
const md5 = await md5FilePath(path);
|
|
@@ -48,7 +54,9 @@ const createUnprocessedFile = async (client, payload) => {
|
|
|
48
54
|
);
|
|
49
55
|
};
|
|
50
56
|
const uploadUnprocessedFile = async (client, uploadDetails, path) => {
|
|
57
|
+
const { createReadStream } = await import("node:fs");
|
|
51
58
|
const readStream = createReadStream(path);
|
|
59
|
+
const { createReadableStreamFromReadable } = await import("../../../cli/src/utils/createReadableStreamFromReadable.js");
|
|
52
60
|
return uploadUnprocessedReadableStream(
|
|
53
61
|
client,
|
|
54
62
|
uploadDetails,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export { createCaptionFile, CreateCaptionFilePayload, type CreateCaptionFileResult, uploadCaptionFile, type LookupCaptionFileByMd5Result, lookupCaptionFileByMd5, } from './resources/caption-file.ts';
|
|
2
|
-
export { createImageFile,
|
|
2
|
+
export { createImageFile, CreateImageFilePayload, type CreateImageFileResult, uploadImageFile, type LookupImageFileByMd5Result, lookupImageFileByMd5, } from './resources/image-file.ts';
|
|
3
3
|
export { createISOBMFFFile, CreateISOBMFFFilePayload, type CreateISOBMFFFileResult, uploadFragmentIndex, type LookupISOBMFFFileByMd5Result, lookupISOBMFFFileByMd5, type GetISOBMFFFileTranscriptionResult, getISOBMFFFileTranscription, type TranscribeISOBMFFFileResult, transcribeISOBMFFFile, TranscribeISOBMFFFilePayload, } from './resources/isobmff-file.ts';
|
|
4
4
|
export { createISOBMFFTrack, CreateISOBMFFTrackPayload, type CreateISOBMFFTrackResult, uploadISOBMFFTrack, } from './resources/isobmff-track.ts';
|
|
5
5
|
export { createRender, CreateRenderPayload, type CreateRenderResult, uploadRender, type LookupRenderByMd5Result, lookupRenderByMd5, } from './resources/renders.ts';
|
|
6
6
|
export { createTranscription, CreateTranscriptionPayload, type CreateTranscriptionResult, getTranscriptionInfo, getTranscriptionProgress, type TranscriptionInfoResult, } from './resources/transcriptions.ts';
|
|
7
7
|
export { createURLToken, type URLTokenResult, } from './resources/url-token.ts';
|
|
8
|
-
export { createUnprocessedFile, CreateUnprocessedFilePayload, type CreateUnprocessedFileResult,
|
|
8
|
+
export { createUnprocessedFile, CreateUnprocessedFilePayload, type CreateUnprocessedFileResult, uploadUnprocessedReadableStream, type LookupUnprocessedFileByMd5Result, lookupUnprocessedFileByMd5, processIsobmffFile, type ProcessIsobmffFileResult, createUnprocessedFileFromPath, uploadUnprocessedFile, } from './resources/unprocessed-file.ts';
|
|
9
9
|
export { getIsobmffProcessInfo, getIsobmffProcessProgress, type IsobmffProcessInfoResult, } from './resources/process-isobmff.ts';
|
|
10
10
|
export { Client } from './client.ts';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@editframe/api",
|
|
3
|
-
"version": "0.12.0-beta.
|
|
3
|
+
"version": "0.12.0-beta.8",
|
|
4
4
|
"description": "API functions for EditFrame",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"vite-tsconfig-paths": "^4.3.2"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@editframe/assets": "0.12.0-beta.
|
|
32
|
+
"@editframe/assets": "0.12.0-beta.8",
|
|
33
33
|
"debug": "^4.3.5",
|
|
34
34
|
"jsonwebtoken": "^9.0.2",
|
|
35
35
|
"node-fetch": "^3.3.2",
|
|
@@ -2,9 +2,6 @@ import debug from "debug";
|
|
|
2
2
|
import mime from "mime";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
|
|
5
|
-
import { stat } from "node:fs/promises";
|
|
6
|
-
import { basename } from "node:path";
|
|
7
|
-
import { md5FilePath } from "@editframe/assets";
|
|
8
5
|
import type { Client } from "../client.ts";
|
|
9
6
|
import { uploadChunks } from "../uploadChunks.ts";
|
|
10
7
|
|
|
@@ -36,6 +33,18 @@ export interface LookupImageFileByMd5Result {
|
|
|
36
33
|
}
|
|
37
34
|
|
|
38
35
|
export const createImageFileFromPath = async (client: Client, path: string) => {
|
|
36
|
+
const [{ stat }, { basename }, { md5FilePath }] = await Promise.all([
|
|
37
|
+
import("node:fs/promises"),
|
|
38
|
+
import("node:path"),
|
|
39
|
+
import("@editframe/assets"),
|
|
40
|
+
]).catch((error) => {
|
|
41
|
+
console.error("Error importing modules", error);
|
|
42
|
+
console.error(
|
|
43
|
+
"This is likely because you are bundling for the browser. createImageFileFromPath can only be run in environments that support importing `node:path`",
|
|
44
|
+
);
|
|
45
|
+
throw error;
|
|
46
|
+
});
|
|
47
|
+
|
|
39
48
|
const fileInfo = await stat(path);
|
|
40
49
|
|
|
41
50
|
const byte_size = fileInfo.size;
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import { stat } from "node:fs/promises";
|
|
2
1
|
import debug from "debug";
|
|
3
2
|
import { z } from "zod";
|
|
4
3
|
|
|
5
|
-
import { createReadStream } from "node:fs";
|
|
6
|
-
import { basename } from "node:path";
|
|
7
|
-
import { md5FilePath } from "@editframe/assets";
|
|
8
|
-
import { createReadableStreamFromReadable } from "packages/cli/src/utils/createReadableStreamFromReadable.ts";
|
|
9
4
|
import type { Client } from "../client.ts";
|
|
10
5
|
import { uploadChunks } from "../uploadChunks.ts";
|
|
11
6
|
|
|
@@ -45,6 +40,18 @@ export const createUnprocessedFileFromPath = async (
|
|
|
45
40
|
client: Client,
|
|
46
41
|
path: string,
|
|
47
42
|
) => {
|
|
43
|
+
const [{ stat }, { basename }, { md5FilePath }] = await Promise.all([
|
|
44
|
+
import("node:fs/promises"),
|
|
45
|
+
import("node:path"),
|
|
46
|
+
import("@editframe/assets"),
|
|
47
|
+
]).catch((error) => {
|
|
48
|
+
console.error("Error importing modules", error);
|
|
49
|
+
console.error(
|
|
50
|
+
"This is likely because you are bundling for the browser. createUnprocessedFileFromPath can only be run in environments that support importing `node:path`",
|
|
51
|
+
);
|
|
52
|
+
throw error;
|
|
53
|
+
});
|
|
54
|
+
|
|
48
55
|
const fileInfo = await stat(path);
|
|
49
56
|
|
|
50
57
|
const byte_size = fileInfo.size;
|
|
@@ -93,8 +100,13 @@ export const uploadUnprocessedFile = async (
|
|
|
93
100
|
uploadDetails: UnprocessedFileUploadDetails,
|
|
94
101
|
path: string,
|
|
95
102
|
) => {
|
|
103
|
+
const { createReadStream } = await import("node:fs");
|
|
96
104
|
const readStream = createReadStream(path);
|
|
97
105
|
|
|
106
|
+
const { createReadableStreamFromReadable } = await import(
|
|
107
|
+
"packages/cli/src/utils/createReadableStreamFromReadable.ts"
|
|
108
|
+
);
|
|
109
|
+
|
|
98
110
|
return uploadUnprocessedReadableStream(
|
|
99
111
|
client,
|
|
100
112
|
uploadDetails,
|