@editframe/api 0.20.3-beta.0 → 0.21.0-beta.0

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.
@@ -1,13 +1,12 @@
1
- const promiseWithResolvers = () => {
1
+ var promiseWithResolvers = () => {
2
2
  if (typeof Promise.withResolvers === "function") return Promise.withResolvers();
3
3
  let resolve;
4
4
  let reject;
5
- const promise = new Promise((res, rej) => {
6
- resolve = res;
7
- reject = rej;
8
- });
9
5
  return {
10
- promise,
6
+ promise: new Promise((res, rej) => {
7
+ resolve = res;
8
+ reject = rej;
9
+ }),
11
10
  resolve,
12
11
  reject
13
12
  };
@@ -1,6 +1,6 @@
1
1
  import debug from "debug";
2
2
  import { createParser } from "eventsource-parser";
3
- const log = debug("ef:StreamEventSource");
3
+ var log = debug("ef:StreamEventSource");
4
4
  var StreamEventSource = class {
5
5
  constructor(stream, abortController) {
6
6
  this.activeReader = null;
package/dist/client.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { StreamEventSource } from "./StreamEventSource.js";
2
2
  import debug from "debug";
3
- const log = debug("ef:api:client");
3
+ var log = debug("ef:api:client");
4
4
  var Client = class {
5
5
  #token;
6
6
  #efHost;
package/dist/node.js CHANGED
@@ -15,8 +15,7 @@ import { basename } from "node:path";
15
15
  import { md5FilePath } from "@editframe/assets";
16
16
  import mime from "mime";
17
17
  const createImageFileFromPath = async (client, path$1) => {
18
- const fileInfo = await stat(path$1);
19
- const byte_size = fileInfo.size;
18
+ const byte_size = (await stat(path$1)).size;
20
19
  const md5 = await md5FilePath(path$1);
21
20
  const mime_type = mime.getType(path$1);
22
21
  return createImageFile(client, { ...CreateImageFilePayload.parse({
@@ -29,8 +28,7 @@ const createImageFileFromPath = async (client, path$1) => {
29
28
  }) });
30
29
  };
31
30
  const createUnprocessedFileFromPath = async (client, path$1) => {
32
- const fileInfo = await stat(path$1);
33
- const byte_size = fileInfo.size;
31
+ const byte_size = (await stat(path$1)).size;
34
32
  const md5 = await md5FilePath(path$1);
35
33
  return createUnprocessedFile(client, {
36
34
  md5,
@@ -1,32 +1,15 @@
1
1
  import debug from "debug";
2
2
  import { z } from "zod";
3
- const log = debug("ef:api:caption-file");
4
- const MAX_CAPTION_SIZE = 1024 * 1024 * 2;
3
+ var log = debug("ef:api:caption-file");
4
+ var MAX_CAPTION_SIZE = 1024 * 1024 * 2;
5
5
  const CreateCaptionFilePayload = z.object({
6
6
  md5: z.string(),
7
7
  filename: z.string(),
8
8
  byte_size: z.number().int().max(MAX_CAPTION_SIZE)
9
9
  });
10
- const restrictSize = (size) => {
10
+ var restrictSize = (size) => {
11
11
  if (size > MAX_CAPTION_SIZE) throw new Error(`File size ${size} bytes exceeds limit ${MAX_CAPTION_SIZE} bytes\n`);
12
12
  };
13
- /**
14
- * Create a caption file
15
- * @param client - The authenticated client to use for the request
16
- * @param payload - The payload to send to the server
17
- * @returns The result of the request
18
- * @example
19
- * ```ts
20
- * const result = await createCaptionFile(client, {
21
- * id: "123",
22
- * filename: "caption.srt",
23
- * });
24
- * console.log(result);
25
- * ```
26
- * @category CaptionFile
27
- * @resource
28
- * @beta
29
- */
30
13
  const createCaptionFile = async (client, payload) => {
31
14
  log("Creating caption file", payload);
32
15
  restrictSize(payload.byte_size);
@@ -2,8 +2,8 @@ import { uploadChunks } from "../uploadChunks.js";
2
2
  import debug from "debug";
3
3
  import { types } from "mime-types";
4
4
  import { z } from "zod";
5
- const log = debug("ef:api:image-file");
6
- const MAX_IMAGE_SIZE = 1024 * 1024 * 16;
5
+ var log = debug("ef:api:image-file");
6
+ var MAX_IMAGE_SIZE = 1024 * 1024 * 16;
7
7
  const ImageFileMimeTypes = z.enum([
8
8
  "image/jpeg",
9
9
  "image/png",
@@ -1,7 +1,7 @@
1
1
  import debug from "debug";
2
2
  import { z } from "zod";
3
- const log = debug("ef:api:isobmff-file");
4
- const FILE_SIZE_LIMIT = 1024 * 1024 * 2;
3
+ var log = debug("ef:api:isobmff-file");
4
+ var FILE_SIZE_LIMIT = 1024 * 1024 * 2;
5
5
  const CreateISOBMFFFilePayload = z.object({
6
6
  md5: z.string(),
7
7
  filename: z.string()
@@ -48,8 +48,8 @@ const VideoStreamSchema = z.object({
48
48
  disposition: z.record(z.unknown())
49
49
  });
50
50
  assertTypesMatch(true);
51
- const log = debug("ef:api:isobmff-track");
52
- const MAX_TRACK_SIZE = 1024 * 1024 * 1024;
51
+ var log = debug("ef:api:isobmff-track");
52
+ var MAX_TRACK_SIZE = 1024 * 1024 * 1024;
53
53
  const AudioTrackPayload = z.object({
54
54
  file_id: z.string(),
55
55
  track_id: z.number().int(),
@@ -31,7 +31,6 @@ const bundleRender = async (options) => {
31
31
  }, ["."]);
32
32
  const passthrough = new PassThrough();
33
33
  tarStream.pipe(passthrough);
34
- const tarReadStream = createReadableStreamFromReadable(passthrough);
35
- return tarReadStream;
34
+ return createReadableStreamFromReadable(passthrough);
36
35
  };
37
36
  export { bundleRender };
@@ -2,24 +2,24 @@ import { assertTypesMatch } from "../utils/assertTypesMatch.js";
2
2
  import { CompletionIterator } from "../ProgressIterator.js";
3
3
  import debug from "debug";
4
4
  import { z } from "zod";
5
- const log = debug("ef:api:renders");
6
- const H264Configuration = z.object({ codec: z.literal("h264") });
7
- const AACConfiguration = z.object({ codec: z.literal("aac") });
8
- const MP4Configuration = z.object({
5
+ var log = debug("ef:api:renders");
6
+ var H264Configuration = z.object({ codec: z.literal("h264") });
7
+ var AACConfiguration = z.object({ codec: z.literal("aac") });
8
+ var MP4Configuration = z.object({
9
9
  container: z.literal("mp4"),
10
10
  video: H264Configuration,
11
11
  audio: AACConfiguration
12
12
  });
13
- const JpegConfiguration = z.object({
13
+ var JpegConfiguration = z.object({
14
14
  container: z.literal("jpeg"),
15
15
  quality: z.number().int().min(1).max(100).default(80).optional()
16
16
  });
17
- const PngConfiguration = z.object({
17
+ var PngConfiguration = z.object({
18
18
  container: z.literal("png"),
19
19
  compression: z.number().int().min(1).max(100).default(80).optional(),
20
20
  transparency: z.boolean().default(false).optional()
21
21
  });
22
- const WebpConfiguration = z.object({
22
+ var WebpConfiguration = z.object({
23
23
  container: z.literal("webp"),
24
24
  quality: z.number().int().min(1).max(100).default(80).optional(),
25
25
  compression: z.number().int().min(0).max(6).default(4).optional(),
@@ -47,7 +47,7 @@ const CreateRenderPayload = z.object({
47
47
  audio: { codec: "aac" }
48
48
  }).optional()
49
49
  });
50
- const CreateRenderPayloadWithOutput = CreateRenderPayload.extend({ output: RenderOutputConfiguration });
50
+ CreateRenderPayload.extend({ output: RenderOutputConfiguration });
51
51
  var OutputConfiguration = class OutputConfiguration {
52
52
  static parse(input) {
53
53
  const output = RenderOutputConfiguration.parse(input ?? {
@@ -118,8 +118,7 @@ const uploadRender = async (client, renderId, fileStream) => {
118
118
  throw new Error(`Failed to upload render ${response.status} ${response.statusText}`);
119
119
  };
120
120
  const getRenderInfo = async (client, id) => {
121
- const response = await client.authenticatedFetch(`/api/v1/renders/${id}`);
122
- return response.json();
121
+ return (await client.authenticatedFetch(`/api/v1/renders/${id}`)).json();
123
122
  };
124
123
  const lookupRenderByMd5 = async (client, md5) => {
125
124
  const response = await client.authenticatedFetch(`/api/v1/renders/md5/${md5}`, { method: "GET" });
@@ -1,7 +1,7 @@
1
1
  import { CompletionIterator } from "../ProgressIterator.js";
2
2
  import debug from "debug";
3
3
  import { z } from "zod";
4
- const log = debug("ef:api:transcriptions");
4
+ var log = debug("ef:api:transcriptions");
5
5
  const CreateTranscriptionPayload = z.object({
6
6
  file_id: z.string(),
7
7
  track_id: z.number().int()
@@ -2,14 +2,14 @@ import { uploadChunks } from "../uploadChunks.js";
2
2
  import { assertTypesMatch } from "../utils/assertTypesMatch.js";
3
3
  import debug from "debug";
4
4
  import { z } from "zod";
5
- const log = debug("ef:api:unprocessed-file");
6
- const MAX_FILE_SIZE = 1024 * 1024 * 1024;
5
+ var log = debug("ef:api:unprocessed-file");
6
+ var MAX_FILE_SIZE = 1024 * 1024 * 1024;
7
7
  const CreateUnprocessedFilePayload = z.object({
8
8
  md5: z.string(),
9
9
  filename: z.string(),
10
10
  byte_size: z.number().int().max(MAX_FILE_SIZE)
11
11
  });
12
- const UpdateUnprocessedFilePayload = z.object({});
12
+ z.object({});
13
13
  assertTypesMatch(true);
14
14
  const createUnprocessedFile = async (client, payload) => {
15
15
  log("Creating an unprocessed file", payload);
@@ -1,5 +1,5 @@
1
1
  import debug from "debug";
2
- const log = debug("ef:api:url-token");
2
+ var log = debug("ef:api:url-token");
3
3
  const createURLToken = async (client, url) => {
4
4
  log("Creating signed url for", url);
5
5
  const response = await client.authenticatedFetch("/api/v1/url-token", {
@@ -1,8 +1,8 @@
1
1
  import { CHUNK_SIZE_BYTES } from "./CHUNK_SIZE_BYTES.js";
2
2
  import { streamChunker } from "./streamChunker.js";
3
3
  import debug from "debug";
4
- const log = debug("ef:api:uploadChunk");
5
- const uploadChunk = async (client, { url, chunkBuffer, chunkNumber, fileSize, chunkSizeBytes = CHUNK_SIZE_BYTES }) => {
4
+ var log = debug("ef:api:uploadChunk");
5
+ var uploadChunk = async (client, { url, chunkBuffer, chunkNumber, fileSize, chunkSizeBytes = CHUNK_SIZE_BYTES }) => {
6
6
  const startByte = chunkNumber * chunkSizeBytes;
7
7
  const endByte = startByte + chunkBuffer.length - 1;
8
8
  log(`Uploading chunk ${chunkNumber} for ${url}`);
@@ -1,8 +1,7 @@
1
1
  import { Stream } from "node:stream";
2
2
  const createReadableStreamFromReadable = (source) => {
3
3
  const pump = new StreamPump(source);
4
- const stream = new ReadableStream(pump, pump);
5
- return stream;
4
+ return new ReadableStream(pump, pump);
6
5
  };
7
6
  var StreamPump = class {
8
7
  constructor(stream) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@editframe/api",
3
- "version": "0.20.3-beta.0",
3
+ "version": "0.21.0-beta.0",
4
4
  "description": "API functions for EditFrame",
5
5
  "exports": {
6
6
  ".": {
@@ -45,7 +45,7 @@
45
45
  "vite-plugin-dts": "^4.5.4"
46
46
  },
47
47
  "dependencies": {
48
- "@editframe/assets": "0.20.3-beta.0",
48
+ "@editframe/assets": "0.21.0-beta.0",
49
49
  "@vitejs/plugin-react": "^4.3.4",
50
50
  "debug": "^4.3.5",
51
51
  "eventsource-parser": "^3.0.0",
@@ -53,7 +53,7 @@
53
53
  "mime": "^4.0.4",
54
54
  "mime-types": "^2.1.35",
55
55
  "node-fetch": "^3.3.2",
56
- "rolldown-vite": "^6.3.21",
56
+ "rolldown-vite": "^7.1.15",
57
57
  "tar": "^7.4.3",
58
58
  "vite-plugin-singlefile": "^2.1.0",
59
59
  "vite-tsconfig-paths": "^4.3.2",