diff --git a/.github/workflows/api-reference.yml b/.github/workflows/api-reference.yml index 46d08ee..d4006ea 100644 --- a/.github/workflows/api-reference.yml +++ b/.github/workflows/api-reference.yml @@ -24,10 +24,10 @@ jobs: name: Build and publish to npmjs.com runs-on: ubuntu-latest steps: - - name: Setup Node.js 20 + - name: Setup Node.js 24 uses: actions/setup-node@v4 with: - node-version: 20 + node-version: 24 - name: Checkout source code uses: actions/checkout@v4 - uses: pnpm/action-setup@v3 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index b1d3ce9..0c2e830 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -9,10 +9,10 @@ jobs: name: Build and publish to npmjs.com runs-on: ubuntu-latest steps: - - name: Setup Node.js 20 + - name: Setup Node.js 24 uses: actions/setup-node@v4 with: - node-version: 20 + node-version: 24 - name: Checkout source code uses: actions/checkout@v4 - name: Install pnpm diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0365126..e54c76c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,8 +13,8 @@ jobs: fail-fast: false matrix: node-version: - - "20" - - "18" + - "24" + - "22" os: - ubuntu-latest # - macos-latest diff --git a/.github/workflows/version-bump.yml b/.github/workflows/version-bump.yml index afc6d06..d7cd795 100644 --- a/.github/workflows/version-bump.yml +++ b/.github/workflows/version-bump.yml @@ -27,7 +27,7 @@ jobs: - uses: actions/setup-node@v4 with: - node-version: 20 + node-version: 24 - name: Compare version against base branch env: diff --git a/CHANGELOG.md b/CHANGELOG.md index de78dbd..1c102e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## [5.0.0] + +- **Breaking**: Require Node.js 22 or later. `engines.node` is now `>=22` (was `>=18`), because Node.js 18 and 20 have reached end of life. There is no runtime change in this release, but installing it on Node.js 18 or 20 fails under package managers that enforce `engines` (Yarn 1, or npm and pnpm with `engine-strict`) + ## [4.41.4] - Fix `RealtimeTranscriber.connect()` promise hanging indefinitely when a socket error or unexpected close occurs before `SessionBegins`. The promise now rejects, and the socket reference is discarded so that connections can be safely retried. diff --git a/CLAUDE.md b/CLAUDE.md index 153594b..82917f0 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -428,7 +428,7 @@ strings, when present). - **Never expose API keys client-side** — use temporary auth tokens for browser streaming - **Sync timeout is a total deadline** — `transcribe()`, `transcribeLive()` and `openLive()` all default to a 180 s deadline spanning the whole request (upload plus transcription), and the sync API still caps audio at 120 s - **Dictation timeout is a total 300 s deadline** — `client.dictation` spans the upload, the transcription and the LLM pass in one deadline; the service caps audio at 120 s and accepts WAV or raw 16-bit PCM only -- **Node >= 18 required** +- **Node >= 22 required** - **Only runtime dependency**: ws (WebSocket library) - **Multi-runtime support**: Works in Node.js, Deno, Bun, Cloudflare Workers, and browsers diff --git a/docs/compat.md b/docs/compat.md index 79a37bb..fc33afe 100644 --- a/docs/compat.md +++ b/docs/compat.md @@ -5,8 +5,8 @@ such as the browser, Deno, Bun, Cloudflare Workers, etc. ## Node.js compatibility -The SDK supports Node.js 18, 20, and 21. -If you do use an older version of Node.js like version 16, you'll need to polyfill `fetch`. +The SDK supports Node.js 22 and later. +If you're still on Node.js 18 or 20, use version 4 of the SDK. ## Browser compatibility diff --git a/package.json b/package.json index cff4429..5130150 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,9 @@ { "name": "assemblyai", - "version": "4.41.4", + "version": "5.0.0", "description": "The AssemblyAI JavaScript SDK provides an easy-to-use interface for interacting with the AssemblyAI API, which supports async and real-time transcription.", "engines": { - "node": ">=18" + "node": ">=22" }, "exports": { ".": { diff --git a/src/utils/live.ts b/src/utils/live.ts index 08e78f5..6b880ad 100644 --- a/src/utils/live.ts +++ b/src/utils/live.ts @@ -21,7 +21,7 @@ const encoder = new TextEncoder(); /** * Generates a multipart boundary. Random alphanumerics behind a fixed prefix, * as `FormData` implementations do; `Math.random` rather than Web Crypto - * because `globalThis.crypto` is flagged on Node 18, which is still supported. + * because `globalThis.crypto` was flagged on Node 18. * @returns The boundary token, without the leading dashes. */ export function multipartBoundary(): string { diff --git a/tests/unit/utils.test.ts b/tests/unit/utils.test.ts index 306bce2..893bc59 100644 --- a/tests/unit/utils.test.ts +++ b/tests/unit/utils.test.ts @@ -58,7 +58,9 @@ describe("utils", () => { const userAgent = buildUserAgent({}); expect(userAgent).toContain("AssemblyAI/1.0 ("); expect(userAgent).toContain("sdk=JavaScript/__SDK_VERSION__"); - expect(userAgent).toContain("runtime_env=Node/"); + // Node 21+ sets `navigator.userAgent` to "Node.js/", which prefixes + // the UA in place of a `runtime_env` entry. + expect(userAgent).toMatch(/^Node\.js\/\d+ /); }); it("should build a user-agent with extras", () => { @@ -67,7 +69,7 @@ describe("utils", () => { }); expect(userAgent).toContain("AssemblyAI/1.0 ("); expect(userAgent).toContain("sdk=JavaScript/__SDK_VERSION__"); - expect(userAgent).toContain("runtime_env=Node/"); + expect(userAgent).toMatch(/^Node\.js\/\d+ /); expect(userAgent).toContain("integration=Zapier/1.0.0"); }); @@ -89,7 +91,7 @@ describe("utils", () => { }); expect(userAgent).toContain("AssemblyAI/1.0 ("); expect(userAgent).toContain("sdk=TS/1.0"); - expect(userAgent).toContain("runtime_env=Node/"); + expect(userAgent).toMatch(/^Node\.js\/\d+ /); expect(userAgent).not.toContain("os="); });