assemblyai 4.0.0-beta.1 → 4.0.0-beta.3
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/CHANGELOG.md +1 -1
- package/dist/assemblyai.umd.js +17 -50
- package/dist/assemblyai.umd.min.js +1 -1
- package/dist/{index.node.mjs → bun.mjs} +168 -234
- package/dist/deno.mjs +545 -0
- package/dist/index.cjs +15 -11
- package/dist/index.mjs +14 -10
- package/dist/{index.node.cjs → node.cjs} +165 -234
- package/dist/node.mjs +542 -0
- package/dist/polyfills/fs/bun.d.ts +1 -0
- package/dist/polyfills/fs/deno.d.ts +1 -0
- package/dist/polyfills/fs/index.d.ts +1 -0
- package/dist/polyfills/fs/node.d.ts +1 -0
- package/dist/polyfills/streams/index.d.ts +4 -0
- package/dist/polyfills/streams/node.d.ts +1 -0
- package/dist/services/realtime/service.d.ts +0 -2
- package/docs/compat.md +1 -1
- package/package.json +31 -14
- package/src/polyfills/fs/bun.ts +8 -0
- package/src/polyfills/fs/deno.ts +9 -0
- package/src/polyfills/fs/index.ts +8 -0
- package/src/polyfills/fs/node.ts +7 -0
- package/src/polyfills/streams/index.ts +6 -0
- package/src/polyfills/streams/node.ts +1 -0
- package/src/polyfills/ws/browser.mjs +15 -0
- package/src/polyfills/ws/index.cjs +1 -0
- package/src/polyfills/ws/index.d.ts +2 -0
- package/src/polyfills/ws/index.mjs +2 -0
- package/src/services/files/index.ts +2 -2
- package/src/services/realtime/service.ts +2 -2
- package/dist/polyfills/no-fs.d.ts +0 -6
- package/src/polyfills/no-fs.ts +0 -8
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const readFile = async function (
|
|
2
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3
|
+
path: string
|
|
4
|
+
): Promise<ReadableStream<Uint8Array>> {
|
|
5
|
+
throw new Error(
|
|
6
|
+
"Interacting with the file system is not supported in this environment."
|
|
7
|
+
);
|
|
8
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { WritableStream } from "stream/web";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
var ws = null;
|
|
2
|
+
|
|
3
|
+
if (typeof WebSocket !== "undefined") {
|
|
4
|
+
ws = WebSocket;
|
|
5
|
+
} else if (typeof MozWebSocket !== "undefined") {
|
|
6
|
+
ws = MozWebSocket;
|
|
7
|
+
} else if (typeof global !== "undefined") {
|
|
8
|
+
ws = global.WebSocket || global.MozWebSocket;
|
|
9
|
+
} else if (typeof window !== "undefined") {
|
|
10
|
+
ws = window.WebSocket || window.MozWebSocket;
|
|
11
|
+
} else if (typeof self !== "undefined") {
|
|
12
|
+
ws = self.WebSocket || self.MozWebSocket;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default ws;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require("ws");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { readFile } from "#fs";
|
|
2
2
|
import { BaseService } from "../base";
|
|
3
3
|
import { UploadedFile, FileUploadParams, FileUploadData } from "../..";
|
|
4
4
|
|
|
@@ -10,7 +10,7 @@ export class FileService extends BaseService {
|
|
|
10
10
|
*/
|
|
11
11
|
async upload(input: FileUploadParams): Promise<string> {
|
|
12
12
|
let fileData: FileUploadData;
|
|
13
|
-
if (typeof input === "string") fileData =
|
|
13
|
+
if (typeof input === "string") fileData = await readFile(input);
|
|
14
14
|
else fileData = input;
|
|
15
15
|
|
|
16
16
|
const data = await this.fetchJson<UploadedFile>("/v2/upload", {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { WritableStream } from "
|
|
2
|
-
import WebSocket from "
|
|
1
|
+
import { WritableStream } from "#streams";
|
|
2
|
+
import WebSocket from "#ws";
|
|
3
3
|
import { ErrorEvent, MessageEvent, CloseEvent } from "ws";
|
|
4
4
|
import {
|
|
5
5
|
RealtimeEvents,
|