Skip to content

Conversation

@fern-api
Copy link

@fern-api fern-api bot commented Nov 10, 2025

Description

This PR represents a complete regeneration of the Deepgram JavaScript SDK using the Fern code generation framework. This is a major architectural change that modernizes the SDK structure and improves maintainability.

Type of Change

  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (code change that improves structure without changing functionality)
  • Build/infrastructure change

Key Changes

SDK Architecture

  • Migrated from custom implementation to Fern-generated SDK structure
  • New client architecture with namespaced API resources:
    • agent - AI Agent APIs
    • auth - Authentication/token management
    • listen - Speech-to-text (v1 and v2)
    • manage - Project and account management
    • read - Text analysis
    • selfHosted - Self-hosted/on-prem credentials
    • speak - Text-to-speech

Breaking Changes

⚠️ This is a breaking change - The entire API surface has changed:

Checklist

  • Code follows the project's style guidelines
  • Build succeeds for both CJS and ESM
  • Tests pass
  • TypeScript types are properly generated
  • Package exports are configured correctly

Notes

This regeneration was performed by Fern's code generation tooling and represents the foundation for future SDK development. Examples and additional documentation will be added in follow-up PRs.

@fern-api fern-api bot requested a review from lukeocodes as a code owner November 10, 2025 17:34
@deepgram deepgram deleted a comment from coderabbitai bot Nov 11, 2025
@lukeocodes lukeocodes requested a review from Copilot November 12, 2025 07:45
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR is an automated code regeneration from Fern based on the latest API Definition, dated November 10, 2025. The changes introduce new API client structures and types across multiple Deepgram API endpoints.

Key changes:

  • Added new Read API v1 text analysis capabilities with support for summarization, sentiment, topics, and intents
  • Introduced Listen API v2 with streaming support and turn-based conversation features
  • Expanded Management API with comprehensive project, billing, and usage tracking endpoints
  • Added Authentication API v1 for token management

Reviewed Changes

Copilot reviewed 295 out of 723 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/api/resources/read/** New Read API v1 structure for text analysis with various configuration types and client implementations
src/api/resources/listen/resources/v2/** New Listen API v2 with WebSocket support for streaming transcription and turn-based interactions
src/api/resources/manage/** Comprehensive Management API v1 for projects, keys, members, models, usage, billing, and requests
src/api/resources/listen/resources/v1/** Expanded Listen API v1 with media transcription types and request interfaces
src/api/resources/auth/** New Authentication API v1 for token grant operations

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@lukeocodes lukeocodes added the wip label Nov 12, 2025
@lukeocodes lukeocodes marked this pull request as draft November 12, 2025 08:45
@lukeocodes lukeocodes changed the title 🌿 Fern Regeneration -- November 10, 2025 refactor!: regenerate SDK with Fern code generator Nov 12, 2025
- Add 24 manual test scripts covering all major SDK features
- Include tests for Listen (v1/v2), Speak, Read, and Agent APIs
- Each endpoint has 3 test variants: basic, with auth token, and with raw response
- Tests use locally built SDK from dist/cjs for validation
- Add fixtures (audio.mp3, audio.wav) for file-based tests
- Add comprehensive README with setup and usage instructions
- Update .fernignore to exclude manual tests from Fern modifications

Tests are simple Node.js scripts requiring DEEPGRAM_API_KEY environment variable.
All tests complete without user interaction using async/await patterns.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 12, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands and usage tips.

lukeocodes and others added 6 commits November 12, 2025 10:26
Add standalone Playwright browser test that validates the SDK works in
browser environments. The test uses webpack to bundle the SDK for browser
compatibility, removing Node.js dependencies.

- Creates browser-standalone.js that builds SDK bundle on-the-fly
- Includes browser-standalone.html template with API key placeholder
- Tests transcribeUrl method with remote audio file
- Handles expected CORS errors gracefully
- Validates SDK loads and executes correctly in headless Chromium
Add standalone Playwright browser test for file upload transcription. This
test validates the SDK can handle binary audio data in browser environments.

- Creates browser-standalone.js that builds SDK bundle with webpack
- Includes browser-standalone.html template for file-based transcription
- Fetches audio file via HTTP and converts to ArrayBuffer
- Tests transcribeFile method with local audio file
- Runs on port 8766 to avoid conflicts with transcribeUrl test
- Validates file reading, upload, and API interaction in browser
lukeocodes and others added 9 commits November 14, 2025 11:24
Create reusable utilities for Playwright-based browser testing of the SDK.
This module provides common functionality for all browser tests.

Features:
- buildBrowserBundle(): Webpack bundling with Node.js dependency exclusion
- createServer(): HTTP server with custom route support
- prepareHtmlTemplate(): Template processing with placeholder replacement
- launchBrowserTest(): Playwright browser initialization
- waitForTestResult(): Test execution and result collection
- evaluateTestResult(): Result evaluation with CORS error handling
- cleanup(): Resource cleanup (files, server, browser)
- runBrowserTest(): Complete test orchestration

This abstraction enables consistent browser testing across all SDK methods
while eliminating code duplication.
Refactor transcribeUrl and transcribeFile browser tests to use the new
shared browser-test-utils module, eliminating code duplication.

Changes:
- transcribeUrl test: Reduced from 248 to 16 lines (93% reduction)
- transcribeFile test: Reduced from 261 to 46 lines (82% reduction)
- Both tests now use runBrowserTest() orchestration function
- transcribeFile includes custom file handler for audio fixtures
- Overall code reduction: 509 lines -> 426 lines (16% improvement)

Benefits:
- Single source of truth for browser testing infrastructure
- Easier maintenance and bug fixes
- Consistent behavior across all browser tests
- Simple template for adding new browser tests
Add comments to .fernignore explaining why specific files are excluded:
- Manual test directory used in development
- Custom README modifications
- Custom websocket reference documentation
Add comprehensive WebSocket API reference documentation covering:
- Listen V1 WebSocket connections for live transcription
- Speak V1 WebSocket connections for text-to-speech streaming
- Agent V1 WebSocket connections for voice agent functionality

This complements the main reference.md with detailed WebSocket-specific documentation.
Simplify README from 729 to 32 lines by:
- Removing extensive inline API documentation
- Adding clear references to reference.md and websockets-reference.md
- Focusing on quick start and authentication basics
- Maintaining links to migration guides and usage examples

Full API documentation now lives in dedicated reference files.
- Add manual tests for agent/v1/settings/think/models API
- Add manual tests for auth/v1/tokens API
- Add manual tests for manage/v1/models API
- Add manual tests for manage/v1/projects and nested resources
- Add manual tests for selfHosted/v1/distributionCredentials API
- All tests include TypeScript JSDoc annotations
- Tests use simplified DeepgramClient() constructor
- Tests re-throw errors for proper exit codes
- Add TypeScript JSDoc annotations to all existing manual tests
- Simplify client constructors to use environment variables
- Improve error handling to re-throw exceptions
- Remove with_auth_token and with_raw_response test variants
- Add run_examples.sh script to execute all manual tests
- Automatically builds SDK if not already built
- Exits on first test failure
- Validates DEEPGRAM_API_KEY is configured
Comment on lines +26 to +42
runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Set up node
uses: actions/setup-node@v4

- name: Install pnpm
uses: pnpm/action-setup@v4

- name: Install dependencies
run: pnpm install

- name: Test
run: pnpm test

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 27 days ago

To address the issue, add a permissions block at the root of the workflow file (.github/workflows/ci.yml) to restrict the GitHub Actions token. Since none of the jobs require write access (they just check out code, install dependencies, build, and run tests), the minimal permission contents: read suffices. Place this permissions entry beneath the name: and on: keys but above jobs:. No additional imports, dependencies, or code changes are required.

Suggested changeset 1
.github/workflows/ci.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -1,6 +1,8 @@
 name: ci
 
 on: [push]
+permissions:
+  contents: read
 
 jobs:
   compile:
EOF
@@ -1,6 +1,8 @@
name: ci

on: [push]
permissions:
contents: read

jobs:
compile:
Copilot is powered by AI and may make mistakes. Always verify output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants