@deepgram/sdk 4.8.0 → 4.9.1

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.
Files changed (31) hide show
  1. package/README.md +155 -331
  2. package/dist/main/lib/helpers.d.ts.map +1 -1
  3. package/dist/main/lib/helpers.js +11 -2
  4. package/dist/main/lib/helpers.js.map +1 -1
  5. package/dist/main/lib/types/AgentLiveSchema.d.ts +11 -10
  6. package/dist/main/lib/types/AgentLiveSchema.d.ts.map +1 -1
  7. package/dist/main/lib/types/DeepgramSource.d.ts +1 -1
  8. package/dist/main/lib/types/DeepgramSource.d.ts.map +1 -1
  9. package/dist/main/lib/version.d.ts +1 -1
  10. package/dist/main/lib/version.js +1 -1
  11. package/dist/main/packages/AbstractRestClient.d.ts +1 -1
  12. package/dist/main/packages/AbstractRestClient.d.ts.map +1 -1
  13. package/dist/module/lib/helpers.d.ts.map +1 -1
  14. package/dist/module/lib/helpers.js +11 -2
  15. package/dist/module/lib/helpers.js.map +1 -1
  16. package/dist/module/lib/types/AgentLiveSchema.d.ts +11 -10
  17. package/dist/module/lib/types/AgentLiveSchema.d.ts.map +1 -1
  18. package/dist/module/lib/types/DeepgramSource.d.ts +1 -1
  19. package/dist/module/lib/types/DeepgramSource.d.ts.map +1 -1
  20. package/dist/module/lib/version.d.ts +1 -1
  21. package/dist/module/lib/version.js +1 -1
  22. package/dist/module/packages/AbstractRestClient.d.ts +1 -1
  23. package/dist/module/packages/AbstractRestClient.d.ts.map +1 -1
  24. package/dist/umd/deepgram.js +1 -2
  25. package/package.json +1 -1
  26. package/src/lib/helpers.ts +14 -2
  27. package/src/lib/types/AgentLiveSchema.ts +12 -10
  28. package/src/lib/types/DeepgramSource.ts +1 -1
  29. package/src/lib/version.ts +1 -1
  30. package/src/packages/AbstractRestClient.ts +1 -1
  31. package/dist/umd/deepgram.js.LICENSE.txt +0 -10
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepgram/sdk",
3
- "version": "4.8.0",
3
+ "version": "4.9.1",
4
4
  "description": "Isomorphic Javascript client for Deepgram",
5
5
  "keywords": [
6
6
  "javascript",
@@ -9,8 +9,9 @@ import {
9
9
  TranscriptionSchema,
10
10
  } from "./types";
11
11
  import { Headers as CrossFetchHeaders } from "cross-fetch";
12
- import { Readable } from "stream";
12
+ import type { Readable } from "stream";
13
13
  import merge from "deepmerge";
14
+ import { isBrowser } from "./runtime";
14
15
 
15
16
  export function stripTrailingSlash(url: string): string {
16
17
  return url.replace(/\/$/, "");
@@ -71,7 +72,18 @@ const isBufferSource = (providedSource: PrerecordedSource): providedSource is Bu
71
72
  };
72
73
 
73
74
  const isReadStreamSource = (providedSource: PrerecordedSource): providedSource is Readable => {
74
- return providedSource != null && providedSource instanceof Readable;
75
+ if (providedSource == null) return false;
76
+
77
+ // In browser environments, there's no Readable stream from Node.js
78
+ if (isBrowser()) return false;
79
+
80
+ // Check for stream-like properties without importing Readable
81
+ return (
82
+ typeof providedSource === "object" &&
83
+ typeof (providedSource as any).pipe === "function" &&
84
+ typeof (providedSource as any).read === "function" &&
85
+ typeof (providedSource as any)._readableState === "object"
86
+ );
75
87
  };
76
88
 
77
89
  export class CallbackUrl extends URL {
@@ -1,7 +1,15 @@
1
1
  type Provider = { type: string } & Record<string, unknown>;
2
2
 
3
+ type SpeakProvider = {
4
+ provider: Provider;
5
+ endpoint?: {
6
+ url: string;
7
+ headers?: Record<string, string>;
8
+ };
9
+ };
10
+
3
11
  /**
4
- * @see https://developers.deepgram.com/reference/voicebot-api-phase-preview#settingsconfiguration
12
+ * @see https://developers.deepgram.com/docs/configure-voice-agent
5
13
  */
6
14
  interface AgentLiveSchema extends Record<string, unknown> {
7
15
  /**
@@ -42,15 +50,9 @@ interface AgentLiveSchema extends Record<string, unknown> {
42
50
  listen?: {
43
51
  provider: Provider;
44
52
  };
45
- speak?: {
46
- provider: Provider;
47
- endpoint?: {
48
- url: string;
49
- headers?: Record<string, string>;
50
- };
51
- };
53
+ speak?: SpeakProvider | SpeakProvider[];
52
54
  /**
53
- * @see https://developers.deepgram.com/reference/voicebot-api-phase-preview#supported-llm-providers-and-models
55
+ * @see https://developers.deepgram.com/docs/voice-agent-tts-models
54
56
  */
55
57
  think?: {
56
58
  provider: Provider;
@@ -81,4 +83,4 @@ interface AgentLiveSchema extends Record<string, unknown> {
81
83
  };
82
84
  }
83
85
 
84
- export type { AgentLiveSchema };
86
+ export type { AgentLiveSchema, SpeakProvider };
@@ -1,4 +1,4 @@
1
- import { Readable } from "stream";
1
+ import type { Readable } from "stream";
2
2
 
3
3
  export type PrerecordedSource = UrlSource | Buffer | Readable;
4
4
 
@@ -1 +1 @@
1
- export const version = "4.8.0";
1
+ export const version = "4.9.1";
@@ -1,5 +1,5 @@
1
1
  import { DeepgramApiError, DeepgramError, DeepgramUnknownError } from "../lib/errors";
2
- import { Readable } from "stream";
2
+ import type { Readable } from "stream";
3
3
  import { fetchWithAuth, resolveResponse } from "../lib/fetch";
4
4
  import type { Fetch, FetchOptions, RequestMethodType } from "../lib/types/Fetch";
5
5
  import { AbstractClient } from "./AbstractClient";
@@ -1,10 +0,0 @@
1
- /*!
2
- * The buffer module from node.js, for the browser.
3
- *
4
- * @author Feross Aboukhadijeh <https://feross.org>
5
- * @license MIT
6
- */
7
-
8
- /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
9
-
10
- /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */