@deepgram/sdk 4.9.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepgram/sdk",
3
- "version": "4.9.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,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.9.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> */