assemblyai 4.0.0-beta.0 → 4.0.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/CHANGELOG.md +92 -0
- package/dist/assemblyai.umd.js +26 -33
- package/dist/assemblyai.umd.min.js +1 -1
- package/dist/{index.browser.js → bun.mjs} +167 -303
- package/dist/deno.mjs +540 -0
- package/dist/fs/bun.d.ts +1 -0
- package/dist/fs/deno.d.ts +1 -0
- package/dist/fs/index.d.ts +1 -0
- package/dist/fs/node.d.ts +1 -0
- package/dist/index.cjs +11 -4
- package/dist/index.mjs +11 -4
- package/dist/node.cjs +549 -0
- package/dist/node.mjs +542 -0
- package/dist/services/realtime/service.d.ts +0 -2
- package/docs/compat.md +59 -0
- package/package.json +38 -11
- package/src/fs/bun.ts +8 -0
- package/src/fs/deno.ts +9 -0
- package/src/fs/index.ts +8 -0
- package/src/fs/node.ts +7 -0
- package/src/services/files/index.ts +2 -2
- package/src/services/realtime/service.ts +2 -2
- package/dist/browser/fs.d.ts +0 -6
- package/src/browser/fs.ts +0 -8
package/package.json
CHANGED
|
@@ -1,22 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "assemblyai",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.2",
|
|
4
4
|
"description": "The AssemblyAI JavaScript SDK provides an easy-to-use interface for interacting with the AssemblyAI API, which supports async and real-time transcription, as well as the latest LeMUR models.",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
|
+
"node": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/node.mjs",
|
|
11
|
+
"require": "./dist/node.cjs"
|
|
12
|
+
},
|
|
13
|
+
"bun": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"default": "./dist/bun.mjs"
|
|
16
|
+
},
|
|
17
|
+
"deno": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"default": "./dist/deno.mjs"
|
|
20
|
+
},
|
|
21
|
+
"workerd": "./dist/index.mjs",
|
|
22
|
+
"browser": "./dist/index.mjs",
|
|
8
23
|
"import": "./dist/index.mjs",
|
|
9
24
|
"require": "./dist/index.cjs",
|
|
10
|
-
"browser": "./dist/index.browser.js",
|
|
11
25
|
"default": "./dist/index.cjs"
|
|
12
26
|
},
|
|
13
27
|
"./package.json": "./package.json"
|
|
14
28
|
},
|
|
29
|
+
"imports": {
|
|
30
|
+
"#fs": {
|
|
31
|
+
"node": "./src/fs/node.ts",
|
|
32
|
+
"bun": "./src/fs/bun.ts",
|
|
33
|
+
"deno": "./src/fs/deno.ts",
|
|
34
|
+
"default": "./src/fs/index.ts"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
15
37
|
"type": "commonjs",
|
|
16
|
-
"main": "dist/index.cjs",
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
38
|
+
"main": "./dist/index.cjs",
|
|
39
|
+
"require": "./dist/index.cjs",
|
|
40
|
+
"module": "./dist/index.mjs",
|
|
41
|
+
"types": "./dist/index.d.ts",
|
|
42
|
+
"typings": "./dist/index.d.ts",
|
|
20
43
|
"repository": {
|
|
21
44
|
"type": "git",
|
|
22
45
|
"url": "git+https://github.com/AssemblyAI/assemblyai-node-sdk.git"
|
|
@@ -28,10 +51,9 @@
|
|
|
28
51
|
},
|
|
29
52
|
"scripts": {
|
|
30
53
|
"build": "pnpm clean && pnpm rollup -c",
|
|
31
|
-
"clean": "rimraf dist",
|
|
54
|
+
"clean": "rimraf dist/*",
|
|
32
55
|
"lint": "eslint -c .eslintrc.json '{src,tests}/**/*.{js,ts}' && publint",
|
|
33
|
-
"test": "
|
|
34
|
-
"test:unit": "jest --config jest.config.rollup.ts",
|
|
56
|
+
"test": "jest --config jest.config.rollup.ts",
|
|
35
57
|
"format": "prettier '**/*' --write",
|
|
36
58
|
"generate-types": "tsx ./scripts/generate-types.ts && pnpm format",
|
|
37
59
|
"copybara:dry-run": "./copybara.sh dry_run --init-history",
|
|
@@ -49,12 +71,17 @@
|
|
|
49
71
|
"homepage": "https://www.assemblyai.com/docs",
|
|
50
72
|
"files": [
|
|
51
73
|
"dist",
|
|
52
|
-
"src"
|
|
74
|
+
"src",
|
|
75
|
+
"package.json",
|
|
76
|
+
"README.md",
|
|
77
|
+
"CHANGELOG.md",
|
|
78
|
+
"docs"
|
|
53
79
|
],
|
|
54
80
|
"devDependencies": {
|
|
55
81
|
"@rollup/plugin-alias": "^5.0.1",
|
|
56
82
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
57
83
|
"@rollup/plugin-terser": "^0.4.4",
|
|
84
|
+
"@rollup/plugin-typescript": "^11.1.5",
|
|
58
85
|
"@types/jest": "^29.5.5",
|
|
59
86
|
"@types/node": "^20.5.7",
|
|
60
87
|
"@types/websocket": "^1.0.8",
|
|
@@ -83,7 +110,7 @@
|
|
|
83
110
|
"typescript": "^5.2.2"
|
|
84
111
|
},
|
|
85
112
|
"dependencies": {
|
|
86
|
-
"@swimburger/isomorphic-streams": "^1.
|
|
113
|
+
"@swimburger/isomorphic-streams": "^1.1.1",
|
|
87
114
|
"isomorphic-ws": "^5.0.0",
|
|
88
115
|
"ws": "^8.13.0"
|
|
89
116
|
}
|
package/src/fs/bun.ts
ADDED
package/src/fs/deno.ts
ADDED
package/src/fs/index.ts
ADDED
|
@@ -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
|
+
};
|
package/src/fs/node.ts
ADDED
|
@@ -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", {
|
|
@@ -33,8 +33,8 @@ export class RealtimeService {
|
|
|
33
33
|
this.realtimeUrl = params.realtimeUrl ?? defaultRealtimeUrl;
|
|
34
34
|
this.sampleRate = params.sampleRate ?? 16_000;
|
|
35
35
|
this.wordBoost = params.wordBoost;
|
|
36
|
-
if ("apiKey" in params) this.apiKey = params.apiKey;
|
|
37
|
-
if ("token" in params) this.token = params.token;
|
|
36
|
+
if ("apiKey" in params && params.apiKey) this.apiKey = params.apiKey;
|
|
37
|
+
if ("token" in params && params.token) this.token = params.token;
|
|
38
38
|
|
|
39
39
|
if (!(this.apiKey || this.token)) {
|
|
40
40
|
throw new Error("API key or temporary token is required.");
|
package/dist/browser/fs.d.ts
DELETED