@editframe/api 0.7.0-beta.6 → 0.7.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/client.cjs CHANGED
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const debug = require("debug");
4
+ const fetch = require("node-fetch");
4
5
  const log = debug("ef:api:client");
5
6
  class Client {
6
7
  constructor(token, efHost) {
package/dist/client.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import debug from "debug";
2
+ import fetch from "node-fetch";
2
3
  const log = debug("ef:api:client");
3
4
  class Client {
4
5
  constructor(token, efHost) {
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const zod = require("zod");
4
4
  const debug = require("debug");
5
- const nodeStreamToWebStream = require("../util/nodeStreamToWebStream.cjs");
6
5
  const log = debug("ef:api:caption-file");
7
6
  const CreateCaptionFilePayload = zod.z.object({
8
7
  id: zod.z.string(),
@@ -36,7 +35,7 @@ const uploadCaptionFile = async (client, fileId, fileStream) => {
36
35
  `/api/video2/caption_files/${fileId}/upload`,
37
36
  {
38
37
  method: "POST",
39
- body: nodeStreamToWebStream.nodeStreamToWebStream(fileStream)
38
+ body: fileStream
40
39
  }
41
40
  );
42
41
  log("Caption file uploaded", fileIndex);
@@ -1,6 +1,5 @@
1
1
  import { z } from "zod";
2
2
  import debug from "debug";
3
- import { nodeStreamToWebStream } from "../util/nodeStreamToWebStream.js";
4
3
  const log = debug("ef:api:caption-file");
5
4
  const CreateCaptionFilePayload = z.object({
6
5
  id: z.string(),
@@ -34,7 +33,7 @@ const uploadCaptionFile = async (client, fileId, fileStream) => {
34
33
  `/api/video2/caption_files/${fileId}/upload`,
35
34
  {
36
35
  method: "POST",
37
- body: nodeStreamToWebStream(fileStream)
36
+ body: fileStream
38
37
  }
39
38
  );
40
39
  log("Caption file uploaded", fileIndex);
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const zod = require("zod");
4
4
  const debug = require("debug");
5
- const nodeStreamToWebStream = require("../util/nodeStreamToWebStream.cjs");
6
5
  const log = debug("ef:api:image-file");
7
6
  const CreateImageFilePayload = zod.z.object({
8
7
  id: zod.z.string(),
@@ -35,7 +34,7 @@ const uploadImageFile = async (client, fileId, fileStream) => {
35
34
  `/api/video2/image_files/${fileId}/upload`,
36
35
  {
37
36
  method: "POST",
38
- body: nodeStreamToWebStream.nodeStreamToWebStream(fileStream)
37
+ body: fileStream
39
38
  }
40
39
  );
41
40
  switch (fileIndex.status) {
@@ -1,6 +1,5 @@
1
1
  import { z } from "zod";
2
2
  import debug from "debug";
3
- import { nodeStreamToWebStream } from "../util/nodeStreamToWebStream.js";
4
3
  const log = debug("ef:api:image-file");
5
4
  const CreateImageFilePayload = z.object({
6
5
  id: z.string(),
@@ -33,7 +32,7 @@ const uploadImageFile = async (client, fileId, fileStream) => {
33
32
  `/api/video2/image_files/${fileId}/upload`,
34
33
  {
35
34
  method: "POST",
36
- body: nodeStreamToWebStream(fileStream)
35
+ body: fileStream
37
36
  }
38
37
  );
39
38
  switch (fileIndex.status) {
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const zod = require("zod");
4
4
  const debug = require("debug");
5
- const nodeStreamToWebStream = require("../util/nodeStreamToWebStream.cjs");
6
5
  const log = debug("ef:api:isobmff-file");
7
6
  const CreateISOBMFFFilePayload = zod.z.object({
8
7
  id: zod.z.string(),
@@ -36,7 +35,7 @@ const uploadFragmentIndex = async (client, fileId, fileStream) => {
36
35
  `/api/video2/isobmff_files/${fileId}/index/upload`,
37
36
  {
38
37
  method: "POST",
39
- body: nodeStreamToWebStream.nodeStreamToWebStream(fileStream)
38
+ body: fileStream
40
39
  }
41
40
  );
42
41
  log("Fragment index uploaded", fileIndex);
@@ -1,6 +1,5 @@
1
1
  import { z } from "zod";
2
2
  import debug from "debug";
3
- import { nodeStreamToWebStream } from "../util/nodeStreamToWebStream.js";
4
3
  const log = debug("ef:api:isobmff-file");
5
4
  const CreateISOBMFFFilePayload = z.object({
6
5
  id: z.string(),
@@ -34,7 +33,7 @@ const uploadFragmentIndex = async (client, fileId, fileStream) => {
34
33
  `/api/video2/isobmff_files/${fileId}/index/upload`,
35
34
  {
36
35
  method: "POST",
37
- body: nodeStreamToWebStream(fileStream)
36
+ body: fileStream
38
37
  }
39
38
  );
40
39
  log("Fragment index uploaded", fileIndex);
@@ -3,7 +3,6 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const zod = require("zod");
4
4
  const debug = require("debug");
5
5
  const assets = require("@editframe/assets");
6
- const nodeStreamToWebStream = require("../util/nodeStreamToWebStream.cjs");
7
6
  const log = debug("ef:api:isobmff-track");
8
7
  const CreateISOBMFFTrackPayload = zod.z.discriminatedUnion("type", [
9
8
  zod.z.object({
@@ -52,7 +51,7 @@ const uploadISOBMFFTrack = async (client, fileId, trackId, fileStream) => {
52
51
  `/api/video2/isobmff_tracks/${fileId}/${trackId}/upload`,
53
52
  {
54
53
  method: "POST",
55
- body: nodeStreamToWebStream.nodeStreamToWebStream(fileStream)
54
+ body: fileStream
56
55
  }
57
56
  );
58
57
  log("ISOBMFF track uploaded", trackIndex);
@@ -1,7 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import debug from "debug";
3
3
  import { AudioStreamSchema, VideoStreamSchema } from "@editframe/assets";
4
- import { nodeStreamToWebStream } from "../util/nodeStreamToWebStream.js";
5
4
  const log = debug("ef:api:isobmff-track");
6
5
  const CreateISOBMFFTrackPayload = z.discriminatedUnion("type", [
7
6
  z.object({
@@ -50,7 +49,7 @@ const uploadISOBMFFTrack = async (client, fileId, trackId, fileStream) => {
50
49
  `/api/video2/isobmff_tracks/${fileId}/${trackId}/upload`,
51
50
  {
52
51
  method: "POST",
53
- body: nodeStreamToWebStream(fileStream)
52
+ body: fileStream
54
53
  }
55
54
  );
56
55
  log("ISOBMFF track uploaded", trackIndex);
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const zod = require("zod");
4
4
  const debug = require("debug");
5
- const nodeStreamToWebStream = require("../util/nodeStreamToWebStream.cjs");
6
5
  const log = debug("ef:api:renders");
7
6
  const CreateRenderPayload = zod.z.object({
8
7
  id: zod.z.string().uuid(),
@@ -37,7 +36,7 @@ const uploadRender = async (client, fileId, fileStream) => {
37
36
  `/api/video2/renders/${fileId}/upload`,
38
37
  {
39
38
  method: "POST",
40
- body: nodeStreamToWebStream.nodeStreamToWebStream(fileStream)
39
+ body: fileStream
41
40
  }
42
41
  );
43
42
  log("Render uploaded", fileIndex);
@@ -1,6 +1,5 @@
1
1
  import { z } from "zod";
2
2
  import debug from "debug";
3
- import { nodeStreamToWebStream } from "../util/nodeStreamToWebStream.js";
4
3
  const log = debug("ef:api:renders");
5
4
  const CreateRenderPayload = z.object({
6
5
  id: z.string().uuid(),
@@ -35,7 +34,7 @@ const uploadRender = async (client, fileId, fileStream) => {
35
34
  `/api/video2/renders/${fileId}/upload`,
36
35
  {
37
36
  method: "POST",
38
- body: nodeStreamToWebStream(fileStream)
37
+ body: fileStream
39
38
  }
40
39
  );
41
40
  log("Render uploaded", fileIndex);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@editframe/api",
3
- "version": "0.7.0-beta.6",
3
+ "version": "0.7.0-beta.8",
4
4
  "description": "API functions for EditFrame",
5
5
  "exports": {
6
6
  ".": {
@@ -30,7 +30,7 @@
30
30
  "vite-tsconfig-paths": "^4.3.2"
31
31
  },
32
32
  "dependencies": {
33
- "@editframe/assets": "0.7.0-beta.6",
33
+ "@editframe/assets": "0.7.0-beta.8",
34
34
  "debug": "^4.3.5",
35
35
  "zod": "^3.23.8"
36
36
  }
@@ -4,7 +4,6 @@ import { z } from "zod";
4
4
  import debug from "debug";
5
5
 
6
6
  import type { Client } from "../client";
7
- import { nodeStreamToWebStream } from "../util/nodeStreamToWebStream";
8
7
 
9
8
  const log = debug("ef:api:caption-file");
10
9
 
@@ -55,7 +54,7 @@ export const uploadCaptionFile = async (
55
54
  `/api/video2/caption_files/${fileId}/upload`,
56
55
  {
57
56
  method: "POST",
58
- body: nodeStreamToWebStream(fileStream),
57
+ body: fileStream,
59
58
  },
60
59
  );
61
60
  log("Caption file uploaded", fileIndex);
@@ -4,7 +4,6 @@ import { z } from "zod";
4
4
  import debug from "debug";
5
5
 
6
6
  import type { Client } from "../client";
7
- import { nodeStreamToWebStream } from "../util/nodeStreamToWebStream";
8
7
 
9
8
  const log = debug("ef:api:image-file");
10
9
 
@@ -54,7 +53,7 @@ export const uploadImageFile = async (
54
53
  `/api/video2/image_files/${fileId}/upload`,
55
54
  {
56
55
  method: "POST",
57
- body: nodeStreamToWebStream(fileStream),
56
+ body: fileStream,
58
57
  },
59
58
  );
60
59
  switch (fileIndex.status) {
@@ -4,7 +4,6 @@ import { z } from "zod";
4
4
  import debug from "debug";
5
5
 
6
6
  import type { Client } from "../client";
7
- import { nodeStreamToWebStream } from "../util/nodeStreamToWebStream";
8
7
 
9
8
  const log = debug("ef:api:isobmff-file");
10
9
 
@@ -56,7 +55,7 @@ export const uploadFragmentIndex = async (
56
55
  `/api/video2/isobmff_files/${fileId}/index/upload`,
57
56
  {
58
57
  method: "POST",
59
- body: nodeStreamToWebStream(fileStream),
58
+ body: fileStream,
60
59
  },
61
60
  );
62
61
 
@@ -6,7 +6,6 @@ import debug from "debug";
6
6
  import { AudioStreamSchema, VideoStreamSchema } from "@editframe/assets";
7
7
 
8
8
  import type { Client } from "../client";
9
- import { nodeStreamToWebStream } from "../util/nodeStreamToWebStream";
10
9
 
11
10
  const log = debug("ef:api:isobmff-track");
12
11
 
@@ -75,7 +74,7 @@ export const uploadISOBMFFTrack = async (
75
74
  `/api/video2/isobmff_tracks/${fileId}/${trackId}/upload`,
76
75
  {
77
76
  method: "POST",
78
- body: nodeStreamToWebStream(fileStream),
77
+ body: fileStream,
79
78
  },
80
79
  );
81
80
 
@@ -4,7 +4,6 @@ import { z } from "zod";
4
4
  import debug from "debug";
5
5
 
6
6
  import type { Client } from "../client";
7
- import { nodeStreamToWebStream } from "../util/nodeStreamToWebStream";
8
7
 
9
8
  const log = debug("ef:api:renders");
10
9
 
@@ -56,7 +55,7 @@ export const uploadRender = async (
56
55
  `/api/video2/renders/${fileId}/upload`,
57
56
  {
58
57
  method: "POST",
59
- body: nodeStreamToWebStream(fileStream),
58
+ body: fileStream,
60
59
  },
61
60
  );
62
61
 
@@ -1,6 +1,6 @@
1
1
  import type { Readable } from "node:stream";
2
2
 
3
- export const nodeStreamToWebStream = (nodeStream: Readable): ReadableStream => {
3
+ export const nodeStreamToWebStream = (nodeStream: Readable): BodyInit => {
4
4
  return new ReadableStream({
5
5
  start(controller) {
6
6
  nodeStream.on("data", (chunk) => {
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const nodeStreamToWebStream = (nodeStream) => {
4
- return new ReadableStream({
5
- start(controller) {
6
- nodeStream.on("data", (chunk) => {
7
- controller.enqueue(chunk);
8
- });
9
- nodeStream.on("end", () => {
10
- controller.close();
11
- });
12
- nodeStream.on("error", (err) => {
13
- controller.error(err);
14
- });
15
- },
16
- cancel() {
17
- nodeStream.destroy();
18
- }
19
- });
20
- };
21
- exports.nodeStreamToWebStream = nodeStreamToWebStream;
@@ -1,21 +0,0 @@
1
- const nodeStreamToWebStream = (nodeStream) => {
2
- return new ReadableStream({
3
- start(controller) {
4
- nodeStream.on("data", (chunk) => {
5
- controller.enqueue(chunk);
6
- });
7
- nodeStream.on("end", () => {
8
- controller.close();
9
- });
10
- nodeStream.on("error", (err) => {
11
- controller.error(err);
12
- });
13
- },
14
- cancel() {
15
- nodeStream.destroy();
16
- }
17
- });
18
- };
19
- export {
20
- nodeStreamToWebStream
21
- };