-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from AssemblyAI/E07417BDFEA3614F5967B1520F8B2F61
Release 3.0.1 👻
- Loading branch information
Showing
22 changed files
with
444 additions
and
403 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Changelog | ||
|
||
## [3.0.1] - 2023-10-30 | ||
### Changed | ||
- The SDK uses `fetch` instead of Axios. This removes the Axios dependency. Axios relies on XMLHttpRequest which isn't supported in Cloudflare Workers, Deno, Bun, etc. By using `fetch`, the SDK is now more compatible on the forementioned runtimes. | ||
|
||
### Fixed | ||
- The SDK uses relative imports instead of using path aliases, to make the library transpilable with tsc for consumers. Fixes [#14](https://github.com/AssemblyAI/assemblyai-node-sdk/issues/14). | ||
- Added `speaker` property to the `TranscriptUtterance` type, and removed `channel` property. | ||
|
||
## [3.0.0] - 2023-10-24 | ||
### Changed | ||
- `AssemblyAI.files.upload` accepts streams and buffers, in addition to a string (path to file). | ||
|
||
### Removed | ||
- **Breaking**: The module does not have a default export anymore, because of inconsistent functionality across module systems. Instead, use `AssemblyAI` as a named import like this: `import { AssemblyAI } from 'assemblyai'`. | ||
|
||
## [2.0.2] - 2023-10-13 | ||
|
||
### Added | ||
- `AssemblyAI.transcripts.wordSearch` searches for keywords in the transcript. | ||
- `AssemblyAI.lemur.purgeRequestData` deletes data related to your LeMUR request. | ||
- `RealtimeService.stream` creates a writable stream that you can write audio data to instead of using `RealtimeService.sendAudio``. | ||
|
||
### Fixed | ||
- The AssemblyAI class would be exported as default named export instead in certain module systems. | ||
|
||
## [2.0.1] - 2023-10-10 | ||
|
||
Re-implement the Node SDK in TypeScript and add all AssemblyAI APIs. | ||
|
||
### Added | ||
- Transcript API client | ||
- LeMUR API client | ||
- Real-time transcript client |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,53 @@ | ||
import { AxiosInstance } from "axios"; | ||
import { BaseServiceParams } from ".."; | ||
import { Error as JsonError } from ".."; | ||
|
||
/** | ||
* Base class for services that communicate with the API. | ||
*/ | ||
export abstract class BaseService { | ||
/** | ||
* Create a new service. | ||
* @param params The AxiosInstance to send HTTP requests to the API. | ||
* @param params The parameters to use for the service. | ||
*/ | ||
constructor(protected client: AxiosInstance) {} | ||
constructor(private params: BaseServiceParams) {} | ||
protected async fetch( | ||
input: string, | ||
init?: RequestInit | undefined | ||
): Promise<Response> { | ||
init = init ?? {}; | ||
init.headers = init.headers ?? {}; | ||
init.headers = { | ||
Authorization: this.params.apiKey, | ||
"Content-Type": "application/json", | ||
...init.headers, | ||
}; | ||
if (!input.startsWith("http")) input = this.params.baseUrl + input; | ||
|
||
const response = await fetch(input, init); | ||
|
||
if (response.status >= 400) { | ||
let json: JsonError | undefined; | ||
const text = await response.text(); | ||
if (text) { | ||
try { | ||
json = JSON.parse(text); | ||
} catch { | ||
/* empty */ | ||
} | ||
if (json?.error) throw new Error(json.error); | ||
throw new Error(text); | ||
} | ||
throw new Error(`HTTP Error: ${response.status} ${response.statusText}`); | ||
} | ||
|
||
return response; | ||
} | ||
|
||
protected async fetchJson<T>( | ||
input: string, | ||
init?: RequestInit | undefined | ||
): Promise<T> { | ||
const response = await this.fetch(input, init); | ||
return response.json() as Promise<T>; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
export * from "@/services/realtime/factory"; | ||
export * from "@/services/realtime/service"; | ||
export * from "./factory"; | ||
export * from "./service"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.