@deepgram/sdk 5.0.0-alpha.2 → 5.0.0-beta.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 (191) hide show
  1. package/LICENSE +1 -1
  2. package/dist/browser/index.global.js +674 -1135
  3. package/dist/cjs/BaseClient.d.ts +7 -7
  4. package/dist/cjs/BaseClient.js +2 -2
  5. package/dist/cjs/Client.d.ts +1 -2
  6. package/dist/cjs/CustomClient.d.ts +9 -1
  7. package/dist/cjs/CustomClient.js +346 -232
  8. package/dist/cjs/api/resources/agent/client/Client.d.ts +1 -2
  9. package/dist/cjs/api/resources/agent/resources/v1/client/Client.d.ts +1 -2
  10. package/dist/cjs/api/resources/agent/resources/v1/client/Socket.d.ts +8 -8
  11. package/dist/cjs/api/resources/agent/resources/v1/client/Socket.js +9 -9
  12. package/dist/cjs/api/resources/agent/resources/v1/resources/settings/client/Client.d.ts +1 -2
  13. package/dist/cjs/api/resources/agent/resources/v1/resources/settings/resources/think/client/Client.d.ts +1 -2
  14. package/dist/cjs/api/resources/agent/resources/v1/resources/settings/resources/think/resources/models/client/Client.d.ts +1 -2
  15. package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1Settings.d.ts +3 -43
  16. package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1SettingsAgentListenProvider.d.ts +26 -0
  17. package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1SettingsAgentListenProvider.js +3 -0
  18. package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1SettingsAgentSpeakEndpointProvider.d.ts +28 -13
  19. package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1SettingsAgentSpeakEndpointProvider.js +19 -17
  20. package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1SettingsAgentSpeakOneItemProvider.d.ts +28 -13
  21. package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1SettingsAgentSpeakOneItemProvider.js +19 -17
  22. package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1SettingsAgentThinkProvider.d.ts +115 -0
  23. package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1SettingsAgentThinkProvider.js +57 -0
  24. package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1UpdateSpeakSpeakProvider.d.ts +18 -3
  25. package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1UpdateSpeakSpeakProvider.js +2 -0
  26. package/dist/cjs/api/resources/agent/resources/v1/types/index.d.ts +2 -0
  27. package/dist/cjs/api/resources/agent/resources/v1/types/index.js +2 -0
  28. package/dist/cjs/api/resources/auth/client/Client.d.ts +1 -2
  29. package/dist/cjs/api/resources/auth/resources/v1/client/Client.d.ts +1 -2
  30. package/dist/cjs/api/resources/auth/resources/v1/resources/tokens/client/Client.d.ts +1 -2
  31. package/dist/cjs/api/resources/listen/client/Client.d.ts +1 -2
  32. package/dist/cjs/api/resources/listen/resources/v1/client/Client.d.ts +1 -2
  33. package/dist/cjs/api/resources/listen/resources/v1/client/Client.js +29 -80
  34. package/dist/cjs/api/resources/listen/resources/v1/client/Socket.d.ts +4 -4
  35. package/dist/cjs/api/resources/listen/resources/v1/client/Socket.js +5 -5
  36. package/dist/cjs/api/resources/listen/resources/v1/resources/media/client/Client.d.ts +1 -2
  37. package/dist/cjs/api/resources/listen/resources/v1/resources/media/client/Client.js +76 -298
  38. package/dist/cjs/api/resources/listen/resources/v1/types/ListenV1Results.d.ts +3 -3
  39. package/dist/cjs/api/resources/listen/resources/v2/client/Client.d.ts +1 -2
  40. package/dist/cjs/api/resources/listen/resources/v2/client/Client.js +11 -26
  41. package/dist/cjs/api/resources/listen/resources/v2/client/Socket.d.ts +2 -2
  42. package/dist/cjs/api/resources/listen/resources/v2/client/Socket.js +3 -3
  43. package/dist/cjs/api/resources/manage/client/Client.d.ts +1 -2
  44. package/dist/cjs/api/resources/manage/resources/v1/client/Client.d.ts +1 -2
  45. package/dist/cjs/api/resources/manage/resources/v1/resources/models/client/Client.d.ts +1 -2
  46. package/dist/cjs/api/resources/manage/resources/v1/resources/models/client/Client.js +3 -4
  47. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/client/Client.d.ts +1 -2
  48. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/client/Client.js +4 -7
  49. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/billing/client/Client.d.ts +1 -2
  50. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/balances/client/Client.d.ts +1 -2
  51. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/breakdown/client/Client.d.ts +1 -2
  52. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/breakdown/client/Client.js +9 -27
  53. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/fields/client/Client.d.ts +1 -2
  54. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/fields/client/Client.js +4 -7
  55. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/purchases/client/Client.d.ts +1 -2
  56. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/purchases/client/Client.js +3 -4
  57. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/keys/client/Client.d.ts +1 -2
  58. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/keys/client/Client.js +3 -4
  59. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/members/client/Client.d.ts +1 -2
  60. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/members/resources/invites/client/Client.d.ts +1 -2
  61. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/members/resources/scopes/client/Client.d.ts +1 -2
  62. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/models/client/Client.d.ts +1 -2
  63. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/models/client/Client.js +3 -4
  64. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/requests/client/Client.d.ts +1 -2
  65. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/requests/client/Client.js +12 -31
  66. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/usage/client/Client.d.ts +1 -2
  67. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/usage/client/Client.js +46 -133
  68. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/usage/resources/breakdown/client/Client.d.ts +1 -2
  69. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/usage/resources/breakdown/client/Client.js +47 -136
  70. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/usage/resources/fields/client/Client.d.ts +1 -2
  71. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/usage/resources/fields/client/Client.js +4 -7
  72. package/dist/cjs/api/resources/read/client/Client.d.ts +1 -2
  73. package/dist/cjs/api/resources/read/resources/v1/client/Client.d.ts +1 -2
  74. package/dist/cjs/api/resources/read/resources/v1/resources/text/client/Client.d.ts +1 -2
  75. package/dist/cjs/api/resources/read/resources/v1/resources/text/client/Client.js +14 -52
  76. package/dist/cjs/api/resources/selfHosted/client/Client.d.ts +1 -2
  77. package/dist/cjs/api/resources/selfHosted/resources/v1/client/Client.d.ts +1 -2
  78. package/dist/cjs/api/resources/selfHosted/resources/v1/resources/distributionCredentials/client/Client.d.ts +1 -2
  79. package/dist/cjs/api/resources/selfHosted/resources/v1/resources/distributionCredentials/client/Client.js +4 -12
  80. package/dist/cjs/api/resources/speak/client/Client.d.ts +1 -2
  81. package/dist/cjs/api/resources/speak/resources/v1/client/Client.d.ts +1 -2
  82. package/dist/cjs/api/resources/speak/resources/v1/client/Client.js +6 -13
  83. package/dist/cjs/api/resources/speak/resources/v1/client/Socket.d.ts +4 -4
  84. package/dist/cjs/api/resources/speak/resources/v1/client/Socket.js +4 -4
  85. package/dist/cjs/api/resources/speak/resources/v1/resources/audio/client/Client.d.ts +1 -2
  86. package/dist/cjs/api/resources/speak/resources/v1/resources/audio/client/Client.js +11 -33
  87. package/dist/cjs/api/types/SpeakV1SampleRate.d.ts +1 -1
  88. package/dist/cjs/api/types/SpeakV1SampleRate.js +1 -1
  89. package/dist/cjs/auth/HeaderAuthProvider.d.ts +14 -8
  90. package/dist/cjs/auth/HeaderAuthProvider.js +19 -9
  91. package/dist/cjs/core/fetcher/EndpointSupplier.d.ts +2 -2
  92. package/dist/cjs/core/fetcher/Fetcher.d.ts +1 -2
  93. package/dist/cjs/core/headers.d.ts +2 -2
  94. package/dist/cjs/core/websocket/ws.d.ts +1 -1
  95. package/dist/cjs/version.d.ts +1 -1
  96. package/dist/cjs/version.js +1 -1
  97. package/dist/esm/BaseClient.d.mts +7 -7
  98. package/dist/esm/BaseClient.mjs +2 -2
  99. package/dist/esm/Client.d.mts +1 -2
  100. package/dist/esm/CustomClient.d.mts +9 -1
  101. package/dist/esm/CustomClient.mjs +347 -233
  102. package/dist/esm/api/resources/agent/client/Client.d.mts +1 -2
  103. package/dist/esm/api/resources/agent/resources/v1/client/Client.d.mts +1 -2
  104. package/dist/esm/api/resources/agent/resources/v1/client/Socket.d.mts +8 -8
  105. package/dist/esm/api/resources/agent/resources/v1/client/Socket.mjs +9 -9
  106. package/dist/esm/api/resources/agent/resources/v1/resources/settings/client/Client.d.mts +1 -2
  107. package/dist/esm/api/resources/agent/resources/v1/resources/settings/resources/think/client/Client.d.mts +1 -2
  108. package/dist/esm/api/resources/agent/resources/v1/resources/settings/resources/think/resources/models/client/Client.d.mts +1 -2
  109. package/dist/esm/api/resources/agent/resources/v1/types/AgentV1Settings.d.mts +3 -43
  110. package/dist/esm/api/resources/agent/resources/v1/types/AgentV1SettingsAgentListenProvider.d.mts +26 -0
  111. package/dist/esm/api/resources/agent/resources/v1/types/AgentV1SettingsAgentListenProvider.mjs +2 -0
  112. package/dist/esm/api/resources/agent/resources/v1/types/AgentV1SettingsAgentSpeakEndpointProvider.d.mts +28 -13
  113. package/dist/esm/api/resources/agent/resources/v1/types/AgentV1SettingsAgentSpeakEndpointProvider.mjs +19 -17
  114. package/dist/esm/api/resources/agent/resources/v1/types/AgentV1SettingsAgentSpeakOneItemProvider.d.mts +28 -13
  115. package/dist/esm/api/resources/agent/resources/v1/types/AgentV1SettingsAgentSpeakOneItemProvider.mjs +19 -17
  116. package/dist/esm/api/resources/agent/resources/v1/types/AgentV1SettingsAgentThinkProvider.d.mts +115 -0
  117. package/dist/esm/api/resources/agent/resources/v1/types/AgentV1SettingsAgentThinkProvider.mjs +54 -0
  118. package/dist/esm/api/resources/agent/resources/v1/types/AgentV1UpdateSpeakSpeakProvider.d.mts +18 -3
  119. package/dist/esm/api/resources/agent/resources/v1/types/AgentV1UpdateSpeakSpeakProvider.mjs +2 -0
  120. package/dist/esm/api/resources/agent/resources/v1/types/index.d.mts +2 -0
  121. package/dist/esm/api/resources/agent/resources/v1/types/index.mjs +2 -0
  122. package/dist/esm/api/resources/auth/client/Client.d.mts +1 -2
  123. package/dist/esm/api/resources/auth/resources/v1/client/Client.d.mts +1 -2
  124. package/dist/esm/api/resources/auth/resources/v1/resources/tokens/client/Client.d.mts +1 -2
  125. package/dist/esm/api/resources/listen/client/Client.d.mts +1 -2
  126. package/dist/esm/api/resources/listen/resources/v1/client/Client.d.mts +1 -2
  127. package/dist/esm/api/resources/listen/resources/v1/client/Client.mjs +29 -80
  128. package/dist/esm/api/resources/listen/resources/v1/client/Socket.d.mts +4 -4
  129. package/dist/esm/api/resources/listen/resources/v1/client/Socket.mjs +5 -5
  130. package/dist/esm/api/resources/listen/resources/v1/resources/media/client/Client.d.mts +1 -2
  131. package/dist/esm/api/resources/listen/resources/v1/resources/media/client/Client.mjs +76 -298
  132. package/dist/esm/api/resources/listen/resources/v1/types/ListenV1Results.d.mts +3 -3
  133. package/dist/esm/api/resources/listen/resources/v2/client/Client.d.mts +1 -2
  134. package/dist/esm/api/resources/listen/resources/v2/client/Client.mjs +11 -26
  135. package/dist/esm/api/resources/listen/resources/v2/client/Socket.d.mts +2 -2
  136. package/dist/esm/api/resources/listen/resources/v2/client/Socket.mjs +3 -3
  137. package/dist/esm/api/resources/manage/client/Client.d.mts +1 -2
  138. package/dist/esm/api/resources/manage/resources/v1/client/Client.d.mts +1 -2
  139. package/dist/esm/api/resources/manage/resources/v1/resources/models/client/Client.d.mts +1 -2
  140. package/dist/esm/api/resources/manage/resources/v1/resources/models/client/Client.mjs +3 -4
  141. package/dist/esm/api/resources/manage/resources/v1/resources/projects/client/Client.d.mts +1 -2
  142. package/dist/esm/api/resources/manage/resources/v1/resources/projects/client/Client.mjs +4 -7
  143. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/billing/client/Client.d.mts +1 -2
  144. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/balances/client/Client.d.mts +1 -2
  145. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/breakdown/client/Client.d.mts +1 -2
  146. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/breakdown/client/Client.mjs +9 -27
  147. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/fields/client/Client.d.mts +1 -2
  148. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/fields/client/Client.mjs +4 -7
  149. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/purchases/client/Client.d.mts +1 -2
  150. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/purchases/client/Client.mjs +3 -4
  151. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/keys/client/Client.d.mts +1 -2
  152. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/keys/client/Client.mjs +3 -4
  153. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/members/client/Client.d.mts +1 -2
  154. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/members/resources/invites/client/Client.d.mts +1 -2
  155. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/members/resources/scopes/client/Client.d.mts +1 -2
  156. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/models/client/Client.d.mts +1 -2
  157. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/models/client/Client.mjs +3 -4
  158. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/requests/client/Client.d.mts +1 -2
  159. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/requests/client/Client.mjs +12 -31
  160. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/usage/client/Client.d.mts +1 -2
  161. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/usage/client/Client.mjs +46 -133
  162. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/usage/resources/breakdown/client/Client.d.mts +1 -2
  163. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/usage/resources/breakdown/client/Client.mjs +47 -136
  164. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/usage/resources/fields/client/Client.d.mts +1 -2
  165. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/usage/resources/fields/client/Client.mjs +4 -7
  166. package/dist/esm/api/resources/read/client/Client.d.mts +1 -2
  167. package/dist/esm/api/resources/read/resources/v1/client/Client.d.mts +1 -2
  168. package/dist/esm/api/resources/read/resources/v1/resources/text/client/Client.d.mts +1 -2
  169. package/dist/esm/api/resources/read/resources/v1/resources/text/client/Client.mjs +14 -52
  170. package/dist/esm/api/resources/selfHosted/client/Client.d.mts +1 -2
  171. package/dist/esm/api/resources/selfHosted/resources/v1/client/Client.d.mts +1 -2
  172. package/dist/esm/api/resources/selfHosted/resources/v1/resources/distributionCredentials/client/Client.d.mts +1 -2
  173. package/dist/esm/api/resources/selfHosted/resources/v1/resources/distributionCredentials/client/Client.mjs +4 -12
  174. package/dist/esm/api/resources/speak/client/Client.d.mts +1 -2
  175. package/dist/esm/api/resources/speak/resources/v1/client/Client.d.mts +1 -2
  176. package/dist/esm/api/resources/speak/resources/v1/client/Client.mjs +6 -13
  177. package/dist/esm/api/resources/speak/resources/v1/client/Socket.d.mts +4 -4
  178. package/dist/esm/api/resources/speak/resources/v1/client/Socket.mjs +4 -4
  179. package/dist/esm/api/resources/speak/resources/v1/resources/audio/client/Client.d.mts +1 -2
  180. package/dist/esm/api/resources/speak/resources/v1/resources/audio/client/Client.mjs +11 -33
  181. package/dist/esm/api/types/SpeakV1SampleRate.d.mts +1 -1
  182. package/dist/esm/api/types/SpeakV1SampleRate.mjs +1 -1
  183. package/dist/esm/auth/HeaderAuthProvider.d.mts +14 -8
  184. package/dist/esm/auth/HeaderAuthProvider.mjs +19 -9
  185. package/dist/esm/core/fetcher/EndpointSupplier.d.mts +2 -2
  186. package/dist/esm/core/fetcher/Fetcher.d.mts +1 -2
  187. package/dist/esm/core/headers.d.mts +2 -2
  188. package/dist/esm/core/websocket/ws.d.mts +1 -1
  189. package/dist/esm/version.d.mts +1 -1
  190. package/dist/esm/version.mjs +1 -1
  191. package/package.json +11 -10
@@ -28,6 +28,12 @@ var Deepgram = (() => {
28
28
  return a;
29
29
  };
30
30
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
31
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
32
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
33
+ }) : x)(function(x) {
34
+ if (typeof require !== "undefined") return require.apply(this, arguments);
35
+ throw Error('Dynamic require of "' + x + '" is not supported');
36
+ });
31
37
  var __objRest = (source, exclude) => {
32
38
  var target = {};
33
39
  for (var prop in source)
@@ -40,7 +46,7 @@ var Deepgram = (() => {
40
46
  }
41
47
  return target;
42
48
  };
43
- var __commonJS = (cb, mod) => function __require() {
49
+ var __commonJS = (cb, mod) => function __require2() {
44
50
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
45
51
  };
46
52
  var __export = (target, all) => {
@@ -124,9 +130,9 @@ var Deepgram = (() => {
124
130
  }
125
131
  });
126
132
 
127
- // node_modules/.pnpm/ws@8.18.3/node_modules/ws/browser.js
133
+ // node_modules/.pnpm/ws@8.19.0/node_modules/ws/browser.js
128
134
  var require_browser = __commonJS({
129
- "node_modules/.pnpm/ws@8.18.3/node_modules/ws/browser.js"(exports, module) {
135
+ "node_modules/.pnpm/ws@8.19.0/node_modules/ws/browser.js"(exports, module) {
130
136
  "use strict";
131
137
  module.exports = function() {
132
138
  throw new Error(
@@ -260,6 +266,7 @@ var Deepgram = (() => {
260
266
  AgentV1Settings: () => AgentV1Settings,
261
267
  AgentV1SettingsAgentSpeakEndpointProvider: () => AgentV1SettingsAgentSpeakEndpointProvider,
262
268
  AgentV1SettingsAgentSpeakOneItemProvider: () => AgentV1SettingsAgentSpeakOneItemProvider,
269
+ AgentV1SettingsAgentThinkProvider: () => AgentV1SettingsAgentThinkProvider,
263
270
  AgentV1UpdateSpeakSpeakProvider: () => AgentV1UpdateSpeakSpeakProvider,
264
271
  v1: () => v1_exports
265
272
  });
@@ -271,6 +278,7 @@ var Deepgram = (() => {
271
278
  AgentV1Settings: () => AgentV1Settings,
272
279
  AgentV1SettingsAgentSpeakEndpointProvider: () => AgentV1SettingsAgentSpeakEndpointProvider,
273
280
  AgentV1SettingsAgentSpeakOneItemProvider: () => AgentV1SettingsAgentSpeakOneItemProvider,
281
+ AgentV1SettingsAgentThinkProvider: () => AgentV1SettingsAgentThinkProvider,
274
282
  AgentV1UpdateSpeakSpeakProvider: () => AgentV1UpdateSpeakSpeakProvider,
275
283
  settings: () => settings_exports
276
284
  });
@@ -334,9 +342,9 @@ var Deepgram = (() => {
334
342
  // src/api/resources/agent/resources/v1/types/AgentV1SettingsAgentSpeakEndpointProvider.ts
335
343
  var AgentV1SettingsAgentSpeakEndpointProvider;
336
344
  ((AgentV1SettingsAgentSpeakEndpointProvider2) => {
337
- let AgentV1SettingsAgentSpeakEndpointProviderDeepgram;
338
- ((AgentV1SettingsAgentSpeakEndpointProviderDeepgram2) => {
339
- AgentV1SettingsAgentSpeakEndpointProviderDeepgram2.Model = {
345
+ let Deepgram;
346
+ ((Deepgram2) => {
347
+ Deepgram2.Model = {
340
348
  AuraAsteriaEn: "aura-asteria-en",
341
349
  AuraLunaEn: "aura-luna-en",
342
350
  AuraStellaEn: "aura-stella-en",
@@ -401,29 +409,30 @@ var Deepgram = (() => {
401
409
  Aura2EstrellaEs: "aura-2-estrella-es",
402
410
  Aura2JavierEs: "aura-2-javier-es"
403
411
  };
404
- })(AgentV1SettingsAgentSpeakEndpointProviderDeepgram = AgentV1SettingsAgentSpeakEndpointProvider2.AgentV1SettingsAgentSpeakEndpointProviderDeepgram || (AgentV1SettingsAgentSpeakEndpointProvider2.AgentV1SettingsAgentSpeakEndpointProviderDeepgram = {}));
405
- let AgentV1SettingsAgentSpeakEndpointProviderElevenLabs;
406
- ((AgentV1SettingsAgentSpeakEndpointProviderElevenLabs2) => {
407
- AgentV1SettingsAgentSpeakEndpointProviderElevenLabs2.ModelId = {
412
+ })(Deepgram = AgentV1SettingsAgentSpeakEndpointProvider2.Deepgram || (AgentV1SettingsAgentSpeakEndpointProvider2.Deepgram = {}));
413
+ let ElevenLabs;
414
+ ((ElevenLabs2) => {
415
+ ElevenLabs2.ModelId = {
408
416
  ElevenTurboV25: "eleven_turbo_v2_5",
409
417
  ElevenMonolingualV1: "eleven_monolingual_v1",
410
418
  ElevenMultilingualV2: "eleven_multilingual_v2"
411
419
  };
412
- })(AgentV1SettingsAgentSpeakEndpointProviderElevenLabs = AgentV1SettingsAgentSpeakEndpointProvider2.AgentV1SettingsAgentSpeakEndpointProviderElevenLabs || (AgentV1SettingsAgentSpeakEndpointProvider2.AgentV1SettingsAgentSpeakEndpointProviderElevenLabs = {}));
413
- let AgentV1SettingsAgentSpeakEndpointProviderCartesia;
414
- ((AgentV1SettingsAgentSpeakEndpointProviderCartesia2) => {
415
- AgentV1SettingsAgentSpeakEndpointProviderCartesia2.ModelId = {
420
+ })(ElevenLabs = AgentV1SettingsAgentSpeakEndpointProvider2.ElevenLabs || (AgentV1SettingsAgentSpeakEndpointProvider2.ElevenLabs = {}));
421
+ let Cartesia;
422
+ ((Cartesia2) => {
423
+ Cartesia2.Version = {};
424
+ Cartesia2.ModelId = {
416
425
  Sonic2: "sonic-2",
417
426
  SonicMultilingual: "sonic-multilingual"
418
427
  };
419
- })(AgentV1SettingsAgentSpeakEndpointProviderCartesia = AgentV1SettingsAgentSpeakEndpointProvider2.AgentV1SettingsAgentSpeakEndpointProviderCartesia || (AgentV1SettingsAgentSpeakEndpointProvider2.AgentV1SettingsAgentSpeakEndpointProviderCartesia = {}));
420
- let AgentV1SettingsAgentSpeakEndpointProviderOpenAi;
421
- ((AgentV1SettingsAgentSpeakEndpointProviderOpenAi2) => {
422
- AgentV1SettingsAgentSpeakEndpointProviderOpenAi2.Model = {
428
+ })(Cartesia = AgentV1SettingsAgentSpeakEndpointProvider2.Cartesia || (AgentV1SettingsAgentSpeakEndpointProvider2.Cartesia = {}));
429
+ let OpenAi;
430
+ ((OpenAi2) => {
431
+ OpenAi2.Model = {
423
432
  Tts1: "tts-1",
424
433
  Tts1Hd: "tts-1-hd"
425
434
  };
426
- AgentV1SettingsAgentSpeakEndpointProviderOpenAi2.Voice = {
435
+ OpenAi2.Voice = {
427
436
  Alloy: "alloy",
428
437
  Echo: "echo",
429
438
  Fable: "fable",
@@ -431,7 +440,7 @@ var Deepgram = (() => {
431
440
  Nova: "nova",
432
441
  Shimmer: "shimmer"
433
442
  };
434
- })(AgentV1SettingsAgentSpeakEndpointProviderOpenAi = AgentV1SettingsAgentSpeakEndpointProvider2.AgentV1SettingsAgentSpeakEndpointProviderOpenAi || (AgentV1SettingsAgentSpeakEndpointProvider2.AgentV1SettingsAgentSpeakEndpointProviderOpenAi = {}));
443
+ })(OpenAi = AgentV1SettingsAgentSpeakEndpointProvider2.OpenAi || (AgentV1SettingsAgentSpeakEndpointProvider2.OpenAi = {}));
435
444
  let AgentV1SettingsAgentSpeakEndpointProviderAwsPolly;
436
445
  ((AgentV1SettingsAgentSpeakEndpointProviderAwsPolly2) => {
437
446
  AgentV1SettingsAgentSpeakEndpointProviderAwsPolly2.Voice = {
@@ -463,9 +472,9 @@ var Deepgram = (() => {
463
472
  // src/api/resources/agent/resources/v1/types/AgentV1SettingsAgentSpeakOneItemProvider.ts
464
473
  var AgentV1SettingsAgentSpeakOneItemProvider;
465
474
  ((AgentV1SettingsAgentSpeakOneItemProvider2) => {
466
- let AgentV1SettingsAgentSpeakOneItemProviderDeepgram;
467
- ((AgentV1SettingsAgentSpeakOneItemProviderDeepgram2) => {
468
- AgentV1SettingsAgentSpeakOneItemProviderDeepgram2.Model = {
475
+ let Deepgram;
476
+ ((Deepgram2) => {
477
+ Deepgram2.Model = {
469
478
  AuraAsteriaEn: "aura-asteria-en",
470
479
  AuraLunaEn: "aura-luna-en",
471
480
  AuraStellaEn: "aura-stella-en",
@@ -530,29 +539,30 @@ var Deepgram = (() => {
530
539
  Aura2EstrellaEs: "aura-2-estrella-es",
531
540
  Aura2JavierEs: "aura-2-javier-es"
532
541
  };
533
- })(AgentV1SettingsAgentSpeakOneItemProviderDeepgram = AgentV1SettingsAgentSpeakOneItemProvider2.AgentV1SettingsAgentSpeakOneItemProviderDeepgram || (AgentV1SettingsAgentSpeakOneItemProvider2.AgentV1SettingsAgentSpeakOneItemProviderDeepgram = {}));
534
- let AgentV1SettingsAgentSpeakOneItemProviderElevenLabs;
535
- ((AgentV1SettingsAgentSpeakOneItemProviderElevenLabs2) => {
536
- AgentV1SettingsAgentSpeakOneItemProviderElevenLabs2.ModelId = {
542
+ })(Deepgram = AgentV1SettingsAgentSpeakOneItemProvider2.Deepgram || (AgentV1SettingsAgentSpeakOneItemProvider2.Deepgram = {}));
543
+ let ElevenLabs;
544
+ ((ElevenLabs2) => {
545
+ ElevenLabs2.ModelId = {
537
546
  ElevenTurboV25: "eleven_turbo_v2_5",
538
547
  ElevenMonolingualV1: "eleven_monolingual_v1",
539
548
  ElevenMultilingualV2: "eleven_multilingual_v2"
540
549
  };
541
- })(AgentV1SettingsAgentSpeakOneItemProviderElevenLabs = AgentV1SettingsAgentSpeakOneItemProvider2.AgentV1SettingsAgentSpeakOneItemProviderElevenLabs || (AgentV1SettingsAgentSpeakOneItemProvider2.AgentV1SettingsAgentSpeakOneItemProviderElevenLabs = {}));
542
- let AgentV1SettingsAgentSpeakOneItemProviderCartesia;
543
- ((AgentV1SettingsAgentSpeakOneItemProviderCartesia2) => {
544
- AgentV1SettingsAgentSpeakOneItemProviderCartesia2.ModelId = {
550
+ })(ElevenLabs = AgentV1SettingsAgentSpeakOneItemProvider2.ElevenLabs || (AgentV1SettingsAgentSpeakOneItemProvider2.ElevenLabs = {}));
551
+ let Cartesia;
552
+ ((Cartesia2) => {
553
+ Cartesia2.Version = {};
554
+ Cartesia2.ModelId = {
545
555
  Sonic2: "sonic-2",
546
556
  SonicMultilingual: "sonic-multilingual"
547
557
  };
548
- })(AgentV1SettingsAgentSpeakOneItemProviderCartesia = AgentV1SettingsAgentSpeakOneItemProvider2.AgentV1SettingsAgentSpeakOneItemProviderCartesia || (AgentV1SettingsAgentSpeakOneItemProvider2.AgentV1SettingsAgentSpeakOneItemProviderCartesia = {}));
549
- let AgentV1SettingsAgentSpeakOneItemProviderOpenAi;
550
- ((AgentV1SettingsAgentSpeakOneItemProviderOpenAi2) => {
551
- AgentV1SettingsAgentSpeakOneItemProviderOpenAi2.Model = {
558
+ })(Cartesia = AgentV1SettingsAgentSpeakOneItemProvider2.Cartesia || (AgentV1SettingsAgentSpeakOneItemProvider2.Cartesia = {}));
559
+ let OpenAi;
560
+ ((OpenAi2) => {
561
+ OpenAi2.Model = {
552
562
  Tts1: "tts-1",
553
563
  Tts1Hd: "tts-1-hd"
554
564
  };
555
- AgentV1SettingsAgentSpeakOneItemProviderOpenAi2.Voice = {
565
+ OpenAi2.Voice = {
556
566
  Alloy: "alloy",
557
567
  Echo: "echo",
558
568
  Fable: "fable",
@@ -560,7 +570,7 @@ var Deepgram = (() => {
560
570
  Nova: "nova",
561
571
  Shimmer: "shimmer"
562
572
  };
563
- })(AgentV1SettingsAgentSpeakOneItemProviderOpenAi = AgentV1SettingsAgentSpeakOneItemProvider2.AgentV1SettingsAgentSpeakOneItemProviderOpenAi || (AgentV1SettingsAgentSpeakOneItemProvider2.AgentV1SettingsAgentSpeakOneItemProviderOpenAi = {}));
573
+ })(OpenAi = AgentV1SettingsAgentSpeakOneItemProvider2.OpenAi || (AgentV1SettingsAgentSpeakOneItemProvider2.OpenAi = {}));
564
574
  let AgentV1SettingsAgentSpeakOneItemProviderAwsPolly;
565
575
  ((AgentV1SettingsAgentSpeakOneItemProviderAwsPolly2) => {
566
576
  AgentV1SettingsAgentSpeakOneItemProviderAwsPolly2.Voice = {
@@ -589,6 +599,55 @@ var Deepgram = (() => {
589
599
  })(AgentV1SettingsAgentSpeakOneItemProviderAwsPolly = AgentV1SettingsAgentSpeakOneItemProvider2.AgentV1SettingsAgentSpeakOneItemProviderAwsPolly || (AgentV1SettingsAgentSpeakOneItemProvider2.AgentV1SettingsAgentSpeakOneItemProviderAwsPolly = {}));
590
600
  })(AgentV1SettingsAgentSpeakOneItemProvider || (AgentV1SettingsAgentSpeakOneItemProvider = {}));
591
601
 
602
+ // src/api/resources/agent/resources/v1/types/AgentV1SettingsAgentThinkProvider.ts
603
+ var AgentV1SettingsAgentThinkProvider;
604
+ ((AgentV1SettingsAgentThinkProvider2) => {
605
+ let OpenAi;
606
+ ((OpenAi2) => {
607
+ OpenAi2.Model = {
608
+ Tts1: "tts-1",
609
+ Tts1Hd: "tts-1-hd"
610
+ };
611
+ OpenAi2.Voice = {
612
+ Alloy: "alloy",
613
+ Echo: "echo",
614
+ Fable: "fable",
615
+ Onyx: "onyx",
616
+ Nova: "nova",
617
+ Shimmer: "shimmer"
618
+ };
619
+ })(OpenAi = AgentV1SettingsAgentThinkProvider2.OpenAi || (AgentV1SettingsAgentThinkProvider2.OpenAi = {}));
620
+ let AgentV1SettingsAgentThinkProviderAwsBedrock;
621
+ ((AgentV1SettingsAgentThinkProviderAwsBedrock2) => {
622
+ AgentV1SettingsAgentThinkProviderAwsBedrock2.Model = {
623
+ AnthropicClaude35Sonnet20240620V10: "anthropic/claude-3-5-sonnet-20240620-v1:0",
624
+ AnthropicClaude35Haiku20240307V10: "anthropic/claude-3-5-haiku-20240307-v1:0"
625
+ };
626
+ let Credentials;
627
+ ((Credentials2) => {
628
+ Credentials2.Type = {
629
+ Sts: "sts",
630
+ Iam: "iam"
631
+ };
632
+ })(Credentials = AgentV1SettingsAgentThinkProviderAwsBedrock2.Credentials || (AgentV1SettingsAgentThinkProviderAwsBedrock2.Credentials = {}));
633
+ })(AgentV1SettingsAgentThinkProviderAwsBedrock = AgentV1SettingsAgentThinkProvider2.AgentV1SettingsAgentThinkProviderAwsBedrock || (AgentV1SettingsAgentThinkProvider2.AgentV1SettingsAgentThinkProviderAwsBedrock = {}));
634
+ let Anthropic;
635
+ ((Anthropic2) => {
636
+ Anthropic2.Model = {
637
+ Claude35HaikuLatest: "claude-3-5-haiku-latest",
638
+ ClaudeSonnet420250514: "claude-sonnet-4-20250514"
639
+ };
640
+ })(Anthropic = AgentV1SettingsAgentThinkProvider2.Anthropic || (AgentV1SettingsAgentThinkProvider2.Anthropic = {}));
641
+ let Google;
642
+ ((Google2) => {
643
+ Google2.Model = {
644
+ Gemini20Flash: "gemini-2.0-flash",
645
+ Gemini20FlashLite: "gemini-2.0-flash-lite",
646
+ Gemini25Flash: "gemini-2.5-flash"
647
+ };
648
+ })(Google = AgentV1SettingsAgentThinkProvider2.Google || (AgentV1SettingsAgentThinkProvider2.Google = {}));
649
+ })(AgentV1SettingsAgentThinkProvider || (AgentV1SettingsAgentThinkProvider = {}));
650
+
592
651
  // src/api/resources/agent/resources/v1/types/AgentV1UpdateSpeakSpeakProvider.ts
593
652
  var AgentV1UpdateSpeakSpeakProvider;
594
653
  ((AgentV1UpdateSpeakSpeakProvider2) => {
@@ -670,6 +729,7 @@ var Deepgram = (() => {
670
729
  })(AgentV1UpdateSpeakSpeakProviderElevenLabs = AgentV1UpdateSpeakSpeakProvider2.AgentV1UpdateSpeakSpeakProviderElevenLabs || (AgentV1UpdateSpeakSpeakProvider2.AgentV1UpdateSpeakSpeakProviderElevenLabs = {}));
671
730
  let AgentV1UpdateSpeakSpeakProviderCartesia;
672
731
  ((AgentV1UpdateSpeakSpeakProviderCartesia2) => {
732
+ AgentV1UpdateSpeakSpeakProviderCartesia2.Version = {};
673
733
  AgentV1UpdateSpeakSpeakProviderCartesia2.ModelId = {
674
734
  Sonic2: "sonic-2",
675
735
  SonicMultilingual: "sonic-multilingual"
@@ -1605,7 +1665,7 @@ var Deepgram = (() => {
1605
1665
  EightThousand: "8000",
1606
1666
  SixteenThousand: "16000",
1607
1667
  TwentyFourThousand: "24000",
1608
- FortyFourThousandOneHundred: "44100",
1668
+ ThirtyTwoThousand: "32000",
1609
1669
  FortyEightThousand: "48000"
1610
1670
  };
1611
1671
 
@@ -3314,30 +3374,42 @@ var Deepgram = (() => {
3314
3374
  var ReconnectingWebSocket = _ReconnectingWebSocket;
3315
3375
 
3316
3376
  // src/auth/HeaderAuthProvider.ts
3317
- var HeaderAuthProvider = class {
3377
+ var PARAM_KEY = "apiKey";
3378
+ var ENV_HEADER_KEY = "DEEPGRAM_API_KEY";
3379
+ var HEADER_NAME = "Authorization";
3380
+ var HeaderAuthProvider = class _HeaderAuthProvider {
3318
3381
  constructor(options) {
3319
- this.headerValue = options.apiKey;
3382
+ this.options = options;
3320
3383
  }
3321
3384
  static canCreate(options) {
3322
3385
  var _a;
3323
- return options.apiKey != null || ((_a = process.env) == null ? void 0 : _a.DEEPGRAM_API_KEY) != null;
3386
+ return (options == null ? void 0 : options[PARAM_KEY]) != null || ((_a = process.env) == null ? void 0 : _a[ENV_HEADER_KEY]) != null;
3324
3387
  }
3325
- getAuthRequest(_arg) {
3326
- return __async(this, null, function* () {
3388
+ getAuthRequest() {
3389
+ return __async(this, arguments, function* ({
3390
+ endpointMetadata
3391
+ } = {}) {
3327
3392
  var _a, _b;
3328
- const apiKey = (_b = yield Supplier.get(this.headerValue)) != null ? _b : (_a = process.env) == null ? void 0 : _a.DEEPGRAM_API_KEY;
3329
- if (apiKey == null) {
3393
+ const headerValue = (_b = yield Supplier.get(this.options[PARAM_KEY])) != null ? _b : (_a = process.env) == null ? void 0 : _a[ENV_HEADER_KEY];
3394
+ if (headerValue == null) {
3330
3395
  throw new DeepgramError({
3331
- message: "Please specify a apiKey by either passing it in to the constructor or initializing a DEEPGRAM_API_KEY environment variable"
3396
+ message: _HeaderAuthProvider.AUTH_CONFIG_ERROR_MESSAGE
3332
3397
  });
3333
3398
  }
3334
- const headerValue = `Token ${apiKey}`;
3335
3399
  return {
3336
- headers: { Authorization: headerValue }
3400
+ headers: { [HEADER_NAME]: headerValue }
3337
3401
  };
3338
3402
  });
3339
3403
  }
3340
3404
  };
3405
+ ((HeaderAuthProvider2) => {
3406
+ HeaderAuthProvider2.AUTH_SCHEME = "ApiKeyAuth";
3407
+ HeaderAuthProvider2.AUTH_CONFIG_ERROR_MESSAGE = `Please provide '${PARAM_KEY}' when initializing the client, or set the '${ENV_HEADER_KEY}' environment variable`;
3408
+ function createInstance(options) {
3409
+ return new HeaderAuthProvider2(options);
3410
+ }
3411
+ HeaderAuthProvider2.createInstance = createInstance;
3412
+ })(HeaderAuthProvider || (HeaderAuthProvider = {}));
3341
3413
 
3342
3414
  // src/core/headers.ts
3343
3415
  function mergeHeaders(...headersArray) {
@@ -3369,8 +3441,8 @@ var Deepgram = (() => {
3369
3441
  {
3370
3442
  "X-Fern-Language": "JavaScript",
3371
3443
  "X-Fern-SDK-Name": "",
3372
- "X-Fern-SDK-Version": "0.0.219",
3373
- "User-Agent": "/0.0.219",
3444
+ "X-Fern-SDK-Version": "0.0.259",
3445
+ "User-Agent": "/0.0.259",
3374
3446
  "X-Fern-Runtime": RUNTIME.type,
3375
3447
  "X-Fern-Runtime-Version": RUNTIME.version
3376
3448
  },
@@ -3565,37 +3637,37 @@ var Deepgram = (() => {
3565
3637
  on(event, callback) {
3566
3638
  this.eventHandlers[event] = callback;
3567
3639
  }
3568
- sendAgentV1Settings(message) {
3640
+ sendSettings(message) {
3569
3641
  this.assertSocketIsOpen();
3570
3642
  this.sendJson(message);
3571
3643
  }
3572
- sendAgentV1UpdateSpeak(message) {
3644
+ sendUpdateSpeak(message) {
3573
3645
  this.assertSocketIsOpen();
3574
3646
  this.sendJson(message);
3575
3647
  }
3576
- sendAgentV1InjectUserMessage(message) {
3648
+ sendInjectUserMessage(message) {
3577
3649
  this.assertSocketIsOpen();
3578
3650
  this.sendJson(message);
3579
3651
  }
3580
- sendAgentV1InjectAgentMessage(message) {
3652
+ sendInjectAgentMessage(message) {
3581
3653
  this.assertSocketIsOpen();
3582
3654
  this.sendJson(message);
3583
3655
  }
3584
- sendAgentV1SendFunctionCallResponse(message) {
3656
+ sendFunctionCallResponse(message) {
3585
3657
  this.assertSocketIsOpen();
3586
3658
  this.sendJson(message);
3587
3659
  }
3588
- sendAgentV1KeepAlive(message) {
3660
+ sendKeepAlive(message) {
3589
3661
  this.assertSocketIsOpen();
3590
3662
  this.sendJson(message);
3591
3663
  }
3592
- sendAgentV1UpdatePrompt(message) {
3664
+ sendUpdatePrompt(message) {
3593
3665
  this.assertSocketIsOpen();
3594
3666
  this.sendJson(message);
3595
3667
  }
3596
- sendAgentV1Media(message) {
3668
+ sendMedia(message) {
3597
3669
  this.assertSocketIsOpen();
3598
- this.sendJson(message);
3670
+ this.sendBinary(message);
3599
3671
  }
3600
3672
  /** Connect to the websocket and register event handlers. */
3601
3673
  connect() {
@@ -3915,147 +3987,44 @@ var Deepgram = (() => {
3915
3987
  "version",
3916
3988
  "mip_opt_out"
3917
3989
  ]);
3918
- const _queryParams = {};
3919
- if (callback != null) {
3920
- _queryParams.callback = callback;
3921
- }
3922
- if (callbackMethod != null) {
3923
- _queryParams.callback_method = callbackMethod;
3924
- }
3925
- if (extra != null) {
3926
- if (Array.isArray(extra)) {
3927
- _queryParams.extra = extra.map((item) => item);
3928
- } else {
3929
- _queryParams.extra = extra;
3930
- }
3931
- }
3932
- if (sentiment != null) {
3933
- _queryParams.sentiment = sentiment.toString();
3934
- }
3935
- if (summarize != null) {
3936
- _queryParams.summarize = summarize;
3937
- }
3938
- if (tag != null) {
3939
- if (Array.isArray(tag)) {
3940
- _queryParams.tag = tag.map((item) => item);
3941
- } else {
3942
- _queryParams.tag = tag;
3943
- }
3944
- }
3945
- if (topics != null) {
3946
- _queryParams.topics = topics.toString();
3947
- }
3948
- if (customTopic != null) {
3949
- if (Array.isArray(customTopic)) {
3950
- _queryParams.custom_topic = customTopic.map((item) => item);
3951
- } else {
3952
- _queryParams.custom_topic = customTopic;
3953
- }
3954
- }
3955
- if (customTopicMode != null) {
3956
- _queryParams.custom_topic_mode = customTopicMode;
3957
- }
3958
- if (intents != null) {
3959
- _queryParams.intents = intents.toString();
3960
- }
3961
- if (customIntent != null) {
3962
- if (Array.isArray(customIntent)) {
3963
- _queryParams.custom_intent = customIntent.map((item) => item);
3964
- } else {
3965
- _queryParams.custom_intent = customIntent;
3966
- }
3967
- }
3968
- if (customIntentMode != null) {
3969
- _queryParams.custom_intent_mode = customIntentMode;
3970
- }
3971
- if (detectEntities != null) {
3972
- _queryParams.detect_entities = detectEntities.toString();
3973
- }
3974
- if (detectLanguage != null) {
3975
- _queryParams.detect_language = detectLanguage.toString();
3976
- }
3977
- if (diarize != null) {
3978
- _queryParams.diarize = diarize.toString();
3979
- }
3980
- if (dictation != null) {
3981
- _queryParams.dictation = dictation.toString();
3982
- }
3983
- if (encoding != null) {
3984
- _queryParams.encoding = encoding;
3985
- }
3986
- if (fillerWords != null) {
3987
- _queryParams.filler_words = fillerWords.toString();
3988
- }
3989
- if (keyterm != null) {
3990
- if (Array.isArray(keyterm)) {
3991
- _queryParams.keyterm = keyterm.map((item) => item);
3992
- } else {
3993
- _queryParams.keyterm = keyterm;
3994
- }
3995
- }
3996
- if (keywords != null) {
3997
- if (Array.isArray(keywords)) {
3998
- _queryParams.keywords = keywords.map((item) => item);
3999
- } else {
4000
- _queryParams.keywords = keywords;
4001
- }
4002
- }
4003
- if (language != null) {
4004
- _queryParams.language = language;
4005
- }
4006
- if (measurements != null) {
4007
- _queryParams.measurements = measurements.toString();
4008
- }
4009
- if (model != null) {
4010
- _queryParams.model = model;
4011
- }
4012
- if (multichannel != null) {
4013
- _queryParams.multichannel = multichannel.toString();
4014
- }
4015
- if (numerals != null) {
4016
- _queryParams.numerals = numerals.toString();
4017
- }
4018
- if (paragraphs != null) {
4019
- _queryParams.paragraphs = paragraphs.toString();
4020
- }
4021
- if (profanityFilter != null) {
4022
- _queryParams.profanity_filter = profanityFilter.toString();
4023
- }
4024
- if (punctuate != null) {
4025
- _queryParams.punctuate = punctuate.toString();
4026
- }
4027
- if (redact != null) {
4028
- _queryParams.redact = redact;
4029
- }
4030
- if (replace != null) {
4031
- if (Array.isArray(replace)) {
4032
- _queryParams.replace = replace.map((item) => item);
4033
- } else {
4034
- _queryParams.replace = replace;
4035
- }
4036
- }
4037
- if (search != null) {
4038
- if (Array.isArray(search)) {
4039
- _queryParams.search = search.map((item) => item);
4040
- } else {
4041
- _queryParams.search = search;
4042
- }
4043
- }
4044
- if (smartFormat != null) {
4045
- _queryParams.smart_format = smartFormat.toString();
4046
- }
4047
- if (utterances != null) {
4048
- _queryParams.utterances = utterances.toString();
4049
- }
4050
- if (uttSplit != null) {
4051
- _queryParams.utt_split = uttSplit.toString();
4052
- }
4053
- if (version != null) {
4054
- _queryParams.version = version;
4055
- }
4056
- if (mipOptOut != null) {
4057
- _queryParams.mip_opt_out = mipOptOut.toString();
4058
- }
3990
+ const _queryParams = {
3991
+ callback,
3992
+ callback_method: callbackMethod != null ? callbackMethod : void 0,
3993
+ extra,
3994
+ sentiment,
3995
+ summarize: summarize != null ? summarize : void 0,
3996
+ tag,
3997
+ topics,
3998
+ custom_topic: customTopic,
3999
+ custom_topic_mode: customTopicMode != null ? customTopicMode : void 0,
4000
+ intents,
4001
+ custom_intent: customIntent,
4002
+ custom_intent_mode: customIntentMode != null ? customIntentMode : void 0,
4003
+ detect_entities: detectEntities,
4004
+ detect_language: detectLanguage,
4005
+ diarize,
4006
+ dictation,
4007
+ encoding: encoding != null ? encoding : void 0,
4008
+ filler_words: fillerWords,
4009
+ keyterm,
4010
+ keywords,
4011
+ language,
4012
+ measurements,
4013
+ model: model != null ? model : void 0,
4014
+ multichannel,
4015
+ numerals,
4016
+ paragraphs,
4017
+ profanity_filter: profanityFilter,
4018
+ punctuate,
4019
+ redact,
4020
+ replace,
4021
+ search,
4022
+ smart_format: smartFormat,
4023
+ utterances,
4024
+ utt_split: uttSplit,
4025
+ version: version != null ? version : void 0,
4026
+ mip_opt_out: mipOptOut
4027
+ };
4059
4028
  const _authRequest = yield this._options.authProvider.getAuthRequest();
4060
4029
  const _headers = mergeHeaders(
4061
4030
  _authRequest.headers,
@@ -4119,147 +4088,44 @@ var Deepgram = (() => {
4119
4088
  __transcribeFile(uploadable, request, requestOptions) {
4120
4089
  return __async(this, null, function* () {
4121
4090
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
4122
- const _queryParams = {};
4123
- if (request.callback != null) {
4124
- _queryParams.callback = request.callback;
4125
- }
4126
- if (request.callback_method != null) {
4127
- _queryParams.callback_method = request.callback_method;
4128
- }
4129
- if (request.extra != null) {
4130
- if (Array.isArray(request.extra)) {
4131
- _queryParams.extra = request.extra.map((item) => item);
4132
- } else {
4133
- _queryParams.extra = request.extra;
4134
- }
4135
- }
4136
- if (request.sentiment != null) {
4137
- _queryParams.sentiment = request.sentiment.toString();
4138
- }
4139
- if (request.summarize != null) {
4140
- _queryParams.summarize = request.summarize;
4141
- }
4142
- if (request.tag != null) {
4143
- if (Array.isArray(request.tag)) {
4144
- _queryParams.tag = request.tag.map((item) => item);
4145
- } else {
4146
- _queryParams.tag = request.tag;
4147
- }
4148
- }
4149
- if (request.topics != null) {
4150
- _queryParams.topics = request.topics.toString();
4151
- }
4152
- if (request.custom_topic != null) {
4153
- if (Array.isArray(request.custom_topic)) {
4154
- _queryParams.custom_topic = request.custom_topic.map((item) => item);
4155
- } else {
4156
- _queryParams.custom_topic = request.custom_topic;
4157
- }
4158
- }
4159
- if (request.custom_topic_mode != null) {
4160
- _queryParams.custom_topic_mode = request.custom_topic_mode;
4161
- }
4162
- if (request.intents != null) {
4163
- _queryParams.intents = request.intents.toString();
4164
- }
4165
- if (request.custom_intent != null) {
4166
- if (Array.isArray(request.custom_intent)) {
4167
- _queryParams.custom_intent = request.custom_intent.map((item) => item);
4168
- } else {
4169
- _queryParams.custom_intent = request.custom_intent;
4170
- }
4171
- }
4172
- if (request.custom_intent_mode != null) {
4173
- _queryParams.custom_intent_mode = request.custom_intent_mode;
4174
- }
4175
- if (request.detect_entities != null) {
4176
- _queryParams.detect_entities = request.detect_entities.toString();
4177
- }
4178
- if (request.detect_language != null) {
4179
- _queryParams.detect_language = request.detect_language.toString();
4180
- }
4181
- if (request.diarize != null) {
4182
- _queryParams.diarize = request.diarize.toString();
4183
- }
4184
- if (request.dictation != null) {
4185
- _queryParams.dictation = request.dictation.toString();
4186
- }
4187
- if (request.encoding != null) {
4188
- _queryParams.encoding = request.encoding;
4189
- }
4190
- if (request.filler_words != null) {
4191
- _queryParams.filler_words = request.filler_words.toString();
4192
- }
4193
- if (request.keyterm != null) {
4194
- if (Array.isArray(request.keyterm)) {
4195
- _queryParams.keyterm = request.keyterm.map((item) => item);
4196
- } else {
4197
- _queryParams.keyterm = request.keyterm;
4198
- }
4199
- }
4200
- if (request.keywords != null) {
4201
- if (Array.isArray(request.keywords)) {
4202
- _queryParams.keywords = request.keywords.map((item) => item);
4203
- } else {
4204
- _queryParams.keywords = request.keywords;
4205
- }
4206
- }
4207
- if (request.language != null) {
4208
- _queryParams.language = request.language;
4209
- }
4210
- if (request.measurements != null) {
4211
- _queryParams.measurements = request.measurements.toString();
4212
- }
4213
- if (request.model != null) {
4214
- _queryParams.model = request.model;
4215
- }
4216
- if (request.multichannel != null) {
4217
- _queryParams.multichannel = request.multichannel.toString();
4218
- }
4219
- if (request.numerals != null) {
4220
- _queryParams.numerals = request.numerals.toString();
4221
- }
4222
- if (request.paragraphs != null) {
4223
- _queryParams.paragraphs = request.paragraphs.toString();
4224
- }
4225
- if (request.profanity_filter != null) {
4226
- _queryParams.profanity_filter = request.profanity_filter.toString();
4227
- }
4228
- if (request.punctuate != null) {
4229
- _queryParams.punctuate = request.punctuate.toString();
4230
- }
4231
- if (request.redact != null) {
4232
- _queryParams.redact = request.redact;
4233
- }
4234
- if (request.replace != null) {
4235
- if (Array.isArray(request.replace)) {
4236
- _queryParams.replace = request.replace.map((item) => item);
4237
- } else {
4238
- _queryParams.replace = request.replace;
4239
- }
4240
- }
4241
- if (request.search != null) {
4242
- if (Array.isArray(request.search)) {
4243
- _queryParams.search = request.search.map((item) => item);
4244
- } else {
4245
- _queryParams.search = request.search;
4246
- }
4247
- }
4248
- if (request.smart_format != null) {
4249
- _queryParams.smart_format = request.smart_format.toString();
4250
- }
4251
- if (request.utterances != null) {
4252
- _queryParams.utterances = request.utterances.toString();
4253
- }
4254
- if (request.utt_split != null) {
4255
- _queryParams.utt_split = request.utt_split.toString();
4256
- }
4257
- if (request.version != null) {
4258
- _queryParams.version = request.version;
4259
- }
4260
- if (request.mip_opt_out != null) {
4261
- _queryParams.mip_opt_out = request.mip_opt_out.toString();
4262
- }
4091
+ const _queryParams = {
4092
+ callback: request.callback,
4093
+ callback_method: request.callback_method != null ? request.callback_method : void 0,
4094
+ extra: request.extra,
4095
+ sentiment: request.sentiment,
4096
+ summarize: request.summarize != null ? request.summarize : void 0,
4097
+ tag: request.tag,
4098
+ topics: request.topics,
4099
+ custom_topic: request.custom_topic,
4100
+ custom_topic_mode: request.custom_topic_mode != null ? request.custom_topic_mode : void 0,
4101
+ intents: request.intents,
4102
+ custom_intent: request.custom_intent,
4103
+ custom_intent_mode: request.custom_intent_mode != null ? request.custom_intent_mode : void 0,
4104
+ detect_entities: request.detect_entities,
4105
+ detect_language: request.detect_language,
4106
+ diarize: request.diarize,
4107
+ dictation: request.dictation,
4108
+ encoding: request.encoding != null ? request.encoding : void 0,
4109
+ filler_words: request.filler_words,
4110
+ keyterm: request.keyterm,
4111
+ keywords: request.keywords,
4112
+ language: request.language,
4113
+ measurements: request.measurements,
4114
+ model: request.model != null ? request.model : void 0,
4115
+ multichannel: request.multichannel,
4116
+ numerals: request.numerals,
4117
+ paragraphs: request.paragraphs,
4118
+ profanity_filter: request.profanity_filter,
4119
+ punctuate: request.punctuate,
4120
+ redact: request.redact,
4121
+ replace: request.replace,
4122
+ search: request.search,
4123
+ smart_format: request.smart_format,
4124
+ utterances: request.utterances,
4125
+ utt_split: request.utt_split,
4126
+ version: request.version != null ? request.version : void 0,
4127
+ mip_opt_out: request.mip_opt_out
4128
+ };
4263
4129
  const _binaryUploadRequest = yield file_exports.toBinaryUploadRequest(uploadable);
4264
4130
  const _authRequest = yield this._options.authProvider.getAuthRequest();
4265
4131
  const _headers = mergeHeaders(
@@ -4354,19 +4220,19 @@ var Deepgram = (() => {
4354
4220
  on(event, callback) {
4355
4221
  this.eventHandlers[event] = callback;
4356
4222
  }
4357
- sendListenV1Media(message) {
4223
+ sendMedia(message) {
4358
4224
  this.assertSocketIsOpen();
4359
- this.sendJson(message);
4225
+ this.sendBinary(message);
4360
4226
  }
4361
- sendListenV1Finalize(message) {
4227
+ sendFinalize(message) {
4362
4228
  this.assertSocketIsOpen();
4363
4229
  this.sendJson(message);
4364
4230
  }
4365
- sendListenV1CloseStream(message) {
4231
+ sendCloseStream(message) {
4366
4232
  this.assertSocketIsOpen();
4367
4233
  this.sendJson(message);
4368
4234
  }
4369
- sendListenV1KeepAlive(message) {
4235
+ sendKeepAlive(message) {
4370
4236
  this.assertSocketIsOpen();
4371
4237
  this.sendJson(message);
4372
4238
  }
@@ -4468,86 +4334,35 @@ var Deepgram = (() => {
4468
4334
  debug,
4469
4335
  reconnectAttempts
4470
4336
  } = args;
4471
- const _queryParams = {};
4472
- if (callback != null) {
4473
- _queryParams.callback = callback;
4474
- }
4475
- if (callbackMethod != null) {
4476
- _queryParams.callback_method = callbackMethod;
4477
- }
4478
- if (channels != null) {
4479
- _queryParams.channels = channels;
4480
- }
4481
- if (diarize != null) {
4482
- _queryParams.diarize = diarize;
4483
- }
4484
- if (dictation != null) {
4485
- _queryParams.dictation = dictation;
4486
- }
4487
- if (encoding != null) {
4488
- _queryParams.encoding = encoding;
4489
- }
4490
- if (endpointing != null) {
4491
- _queryParams.endpointing = endpointing;
4492
- }
4493
- if (extra != null) {
4494
- _queryParams.extra = extra;
4495
- }
4496
- if (interimResults != null) {
4497
- _queryParams.interim_results = interimResults;
4498
- }
4499
- if (keyterm != null) {
4500
- _queryParams.keyterm = keyterm;
4501
- }
4502
- if (keywords != null) {
4503
- _queryParams.keywords = keywords;
4504
- }
4505
- if (language != null) {
4506
- _queryParams.language = language;
4507
- }
4508
- if (mipOptOut != null) {
4509
- _queryParams.mip_opt_out = mipOptOut;
4510
- }
4511
- _queryParams.model = model;
4512
- if (multichannel != null) {
4513
- _queryParams.multichannel = multichannel;
4514
- }
4515
- if (numerals != null) {
4516
- _queryParams.numerals = numerals;
4517
- }
4518
- if (profanityFilter != null) {
4519
- _queryParams.profanity_filter = profanityFilter;
4520
- }
4521
- if (punctuate != null) {
4522
- _queryParams.punctuate = punctuate;
4523
- }
4524
- if (redact != null) {
4525
- _queryParams.redact = redact;
4526
- }
4527
- if (replace != null) {
4528
- _queryParams.replace = replace;
4529
- }
4530
- if (sampleRate != null) {
4531
- _queryParams.sample_rate = sampleRate;
4532
- }
4533
- if (search != null) {
4534
- _queryParams.search = search;
4535
- }
4536
- if (smartFormat != null) {
4537
- _queryParams.smart_format = smartFormat;
4538
- }
4539
- if (tag != null) {
4540
- _queryParams.tag = tag;
4541
- }
4542
- if (utteranceEndMs != null) {
4543
- _queryParams.utterance_end_ms = utteranceEndMs;
4544
- }
4545
- if (vadEvents != null) {
4546
- _queryParams.vad_events = vadEvents;
4547
- }
4548
- if (version != null) {
4549
- _queryParams.version = version;
4550
- }
4337
+ const _queryParams = {
4338
+ callback,
4339
+ callback_method: callbackMethod,
4340
+ channels,
4341
+ diarize,
4342
+ dictation,
4343
+ encoding,
4344
+ endpointing,
4345
+ extra,
4346
+ interim_results: interimResults,
4347
+ keyterm,
4348
+ keywords,
4349
+ language,
4350
+ mip_opt_out: mipOptOut,
4351
+ model,
4352
+ multichannel,
4353
+ numerals,
4354
+ profanity_filter: profanityFilter,
4355
+ punctuate,
4356
+ redact,
4357
+ replace,
4358
+ sample_rate: sampleRate,
4359
+ search,
4360
+ smart_format: smartFormat,
4361
+ tag,
4362
+ utterance_end_ms: utteranceEndMs,
4363
+ vad_events: vadEvents,
4364
+ version
4365
+ };
4551
4366
  const _headers = mergeHeaders(
4552
4367
  mergeOnlyDefinedHeaders({ Authorization: args.Authorization }),
4553
4368
  headers
@@ -4612,11 +4427,11 @@ var Deepgram = (() => {
4612
4427
  on(event, callback) {
4613
4428
  this.eventHandlers[event] = callback;
4614
4429
  }
4615
- sendListenV2Media(message) {
4430
+ sendMedia(message) {
4616
4431
  this.assertSocketIsOpen();
4617
- this.sendJson(message);
4432
+ this.sendBinary(message);
4618
4433
  }
4619
- sendListenV2CloseStream(message) {
4434
+ sendCloseStream(message) {
4620
4435
  this.assertSocketIsOpen();
4621
4436
  this.sendJson(message);
4622
4437
  }
@@ -4696,32 +4511,17 @@ var Deepgram = (() => {
4696
4511
  debug,
4697
4512
  reconnectAttempts
4698
4513
  } = args;
4699
- const _queryParams = {};
4700
- _queryParams.model = model;
4701
- if (encoding != null) {
4702
- _queryParams.encoding = encoding;
4703
- }
4704
- if (sampleRate != null) {
4705
- _queryParams.sample_rate = sampleRate;
4706
- }
4707
- if (eagerEotThreshold != null) {
4708
- _queryParams.eager_eot_threshold = eagerEotThreshold;
4709
- }
4710
- if (eotThreshold != null) {
4711
- _queryParams.eot_threshold = eotThreshold;
4712
- }
4713
- if (eotTimeoutMs != null) {
4714
- _queryParams.eot_timeout_ms = eotTimeoutMs;
4715
- }
4716
- if (keyterm != null) {
4717
- _queryParams.keyterm = keyterm;
4718
- }
4719
- if (mipOptOut != null) {
4720
- _queryParams.mip_opt_out = mipOptOut;
4721
- }
4722
- if (tag != null) {
4723
- _queryParams.tag = tag;
4724
- }
4514
+ const _queryParams = {
4515
+ model,
4516
+ encoding,
4517
+ sample_rate: sampleRate,
4518
+ eager_eot_threshold: eagerEotThreshold,
4519
+ eot_threshold: eotThreshold,
4520
+ eot_timeout_ms: eotTimeoutMs,
4521
+ keyterm,
4522
+ mip_opt_out: mipOptOut,
4523
+ tag
4524
+ };
4725
4525
  const _headers = mergeHeaders(
4726
4526
  mergeOnlyDefinedHeaders({ Authorization: args.Authorization }),
4727
4527
  headers
@@ -4781,10 +4581,9 @@ var Deepgram = (() => {
4781
4581
  return __async(this, arguments, function* (request = {}, requestOptions) {
4782
4582
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
4783
4583
  const { include_outdated: includeOutdated } = request;
4784
- const _queryParams = {};
4785
- if (includeOutdated != null) {
4786
- _queryParams.include_outdated = includeOutdated.toString();
4787
- }
4584
+ const _queryParams = {
4585
+ include_outdated: includeOutdated
4586
+ };
4788
4587
  const _authRequest = yield this._options.authProvider.getAuthRequest();
4789
4588
  const _headers = mergeHeaders(
4790
4589
  _authRequest.headers,
@@ -5042,36 +4841,19 @@ var Deepgram = (() => {
5042
4841
  return __async(this, arguments, function* (project_id, request = {}, requestOptions) {
5043
4842
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
5044
4843
  const { start, end, accessor, deployment, tag, line_item: lineItem, grouping } = request;
5045
- const _queryParams = {};
5046
- if (start != null) {
5047
- _queryParams.start = start;
5048
- }
5049
- if (end != null) {
5050
- _queryParams.end = end;
5051
- }
5052
- if (accessor != null) {
5053
- _queryParams.accessor = accessor;
5054
- }
5055
- if (deployment != null) {
5056
- _queryParams.deployment = deployment;
5057
- }
5058
- if (tag != null) {
5059
- _queryParams.tag = tag;
5060
- }
5061
- if (lineItem != null) {
5062
- _queryParams.line_item = lineItem;
5063
- }
5064
- if (grouping != null) {
5065
- if (Array.isArray(grouping)) {
5066
- _queryParams.grouping = grouping.map((item) => item);
5067
- } else {
5068
- _queryParams.grouping = grouping;
5069
- }
5070
- }
5071
- const _authRequest = yield this._options.authProvider.getAuthRequest();
5072
- const _headers = mergeHeaders(
5073
- _authRequest.headers,
5074
- (_a = this._options) == null ? void 0 : _a.headers,
4844
+ const _queryParams = {
4845
+ start,
4846
+ end,
4847
+ accessor,
4848
+ deployment: deployment != null ? deployment : void 0,
4849
+ tag,
4850
+ line_item: lineItem,
4851
+ grouping: Array.isArray(grouping) ? grouping.map((item) => item) : grouping != null ? grouping : void 0
4852
+ };
4853
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
4854
+ const _headers = mergeHeaders(
4855
+ _authRequest.headers,
4856
+ (_a = this._options) == null ? void 0 : _a.headers,
5075
4857
  requestOptions == null ? void 0 : requestOptions.headers
5076
4858
  );
5077
4859
  const _response = yield ((_b = this._options.fetcher) != null ? _b : fetcher)({
@@ -5140,13 +4922,10 @@ var Deepgram = (() => {
5140
4922
  return __async(this, arguments, function* (project_id, request = {}, requestOptions) {
5141
4923
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
5142
4924
  const { start, end } = request;
5143
- const _queryParams = {};
5144
- if (start != null) {
5145
- _queryParams.start = start;
5146
- }
5147
- if (end != null) {
5148
- _queryParams.end = end;
5149
- }
4925
+ const _queryParams = {
4926
+ start,
4927
+ end
4928
+ };
5150
4929
  const _authRequest = yield this._options.authProvider.getAuthRequest();
5151
4930
  const _headers = mergeHeaders(
5152
4931
  _authRequest.headers,
@@ -5218,10 +4997,9 @@ var Deepgram = (() => {
5218
4997
  return __async(this, arguments, function* (project_id, request = {}, requestOptions) {
5219
4998
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
5220
4999
  const { limit } = request;
5221
- const _queryParams = {};
5222
- if (limit != null) {
5223
- _queryParams.limit = limit.toString();
5224
- }
5000
+ const _queryParams = {
5001
+ limit
5002
+ };
5225
5003
  const _authRequest = yield this._options.authProvider.getAuthRequest();
5226
5004
  const _headers = mergeHeaders(
5227
5005
  _authRequest.headers,
@@ -5319,10 +5097,9 @@ var Deepgram = (() => {
5319
5097
  return __async(this, arguments, function* (project_id, request = {}, requestOptions) {
5320
5098
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
5321
5099
  const { status } = request;
5322
- const _queryParams = {};
5323
- if (status != null) {
5324
- _queryParams.status = status;
5325
- }
5100
+ const _queryParams = {
5101
+ status: status != null ? status : void 0
5102
+ };
5326
5103
  const _authRequest = yield this._options.authProvider.getAuthRequest();
5327
5104
  const _headers = mergeHeaders(
5328
5105
  _authRequest.headers,
@@ -6069,10 +5846,9 @@ var Deepgram = (() => {
6069
5846
  return __async(this, arguments, function* (project_id, request = {}, requestOptions) {
6070
5847
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
6071
5848
  const { include_outdated: includeOutdated } = request;
6072
- const _queryParams = {};
6073
- if (includeOutdated != null) {
6074
- _queryParams.include_outdated = includeOutdated.toString();
6075
- }
5849
+ const _queryParams = {
5850
+ include_outdated: includeOutdated
5851
+ };
6076
5852
  const _authRequest = yield this._options.authProvider.getAuthRequest();
6077
5853
  const _headers = mergeHeaders(
6078
5854
  _authRequest.headers,
@@ -6225,37 +6001,18 @@ var Deepgram = (() => {
6225
6001
  method,
6226
6002
  status
6227
6003
  } = request;
6228
- const _queryParams = {};
6229
- if (start != null) {
6230
- _queryParams.start = start;
6231
- }
6232
- if (end != null) {
6233
- _queryParams.end = end;
6234
- }
6235
- if (limit != null) {
6236
- _queryParams.limit = limit.toString();
6237
- }
6238
- if (page != null) {
6239
- _queryParams.page = page.toString();
6240
- }
6241
- if (accessor != null) {
6242
- _queryParams.accessor = accessor;
6243
- }
6244
- if (requestId != null) {
6245
- _queryParams.request_id = requestId;
6246
- }
6247
- if (deployment != null) {
6248
- _queryParams.deployment = deployment;
6249
- }
6250
- if (endpoint != null) {
6251
- _queryParams.endpoint = endpoint;
6252
- }
6253
- if (method != null) {
6254
- _queryParams.method = method;
6255
- }
6256
- if (status != null) {
6257
- _queryParams.status = status;
6258
- }
6004
+ const _queryParams = {
6005
+ start,
6006
+ end,
6007
+ limit,
6008
+ page,
6009
+ accessor,
6010
+ request_id: requestId,
6011
+ deployment: deployment != null ? deployment : void 0,
6012
+ endpoint: endpoint != null ? endpoint : void 0,
6013
+ method: method != null ? method : void 0,
6014
+ status: status != null ? status : void 0
6015
+ };
6259
6016
  const _authRequest = yield this._options.authProvider.getAuthRequest();
6260
6017
  const _headers = mergeHeaders(
6261
6018
  _authRequest.headers,
@@ -6481,142 +6238,53 @@ var Deepgram = (() => {
6481
6238
  utterances,
6482
6239
  version
6483
6240
  } = request;
6484
- const _queryParams = {};
6485
- if (start != null) {
6486
- _queryParams.start = start;
6487
- }
6488
- if (end != null) {
6489
- _queryParams.end = end;
6490
- }
6491
- if (grouping != null) {
6492
- _queryParams.grouping = grouping;
6493
- }
6494
- if (accessor != null) {
6495
- _queryParams.accessor = accessor;
6496
- }
6497
- if (alternatives != null) {
6498
- _queryParams.alternatives = alternatives.toString();
6499
- }
6500
- if (callbackMethod != null) {
6501
- _queryParams.callback_method = callbackMethod.toString();
6502
- }
6503
- if (callback != null) {
6504
- _queryParams.callback = callback.toString();
6505
- }
6506
- if (channels != null) {
6507
- _queryParams.channels = channels.toString();
6508
- }
6509
- if (customIntentMode != null) {
6510
- _queryParams.custom_intent_mode = customIntentMode.toString();
6511
- }
6512
- if (customIntent != null) {
6513
- _queryParams.custom_intent = customIntent.toString();
6514
- }
6515
- if (customTopicMode != null) {
6516
- _queryParams.custom_topic_mode = customTopicMode.toString();
6517
- }
6518
- if (customTopic != null) {
6519
- _queryParams.custom_topic = customTopic.toString();
6520
- }
6521
- if (deployment != null) {
6522
- _queryParams.deployment = deployment;
6523
- }
6524
- if (detectEntities != null) {
6525
- _queryParams.detect_entities = detectEntities.toString();
6526
- }
6527
- if (detectLanguage != null) {
6528
- _queryParams.detect_language = detectLanguage.toString();
6529
- }
6530
- if (diarize != null) {
6531
- _queryParams.diarize = diarize.toString();
6532
- }
6533
- if (dictation != null) {
6534
- _queryParams.dictation = dictation.toString();
6535
- }
6536
- if (encoding != null) {
6537
- _queryParams.encoding = encoding.toString();
6538
- }
6539
- if (endpoint != null) {
6540
- _queryParams.endpoint = endpoint;
6541
- }
6542
- if (extra != null) {
6543
- _queryParams.extra = extra.toString();
6544
- }
6545
- if (fillerWords != null) {
6546
- _queryParams.filler_words = fillerWords.toString();
6547
- }
6548
- if (intents != null) {
6549
- _queryParams.intents = intents.toString();
6550
- }
6551
- if (keyterm != null) {
6552
- _queryParams.keyterm = keyterm.toString();
6553
- }
6554
- if (keywords != null) {
6555
- _queryParams.keywords = keywords.toString();
6556
- }
6557
- if (language != null) {
6558
- _queryParams.language = language.toString();
6559
- }
6560
- if (measurements != null) {
6561
- _queryParams.measurements = measurements.toString();
6562
- }
6563
- if (method != null) {
6564
- _queryParams.method = method;
6565
- }
6566
- if (model != null) {
6567
- _queryParams.model = model;
6568
- }
6569
- if (multichannel != null) {
6570
- _queryParams.multichannel = multichannel.toString();
6571
- }
6572
- if (numerals != null) {
6573
- _queryParams.numerals = numerals.toString();
6574
- }
6575
- if (paragraphs != null) {
6576
- _queryParams.paragraphs = paragraphs.toString();
6577
- }
6578
- if (profanityFilter != null) {
6579
- _queryParams.profanity_filter = profanityFilter.toString();
6580
- }
6581
- if (punctuate != null) {
6582
- _queryParams.punctuate = punctuate.toString();
6583
- }
6584
- if (redact != null) {
6585
- _queryParams.redact = redact.toString();
6586
- }
6587
- if (replace != null) {
6588
- _queryParams.replace = replace.toString();
6589
- }
6590
- if (sampleRate != null) {
6591
- _queryParams.sample_rate = sampleRate.toString();
6592
- }
6593
- if (search != null) {
6594
- _queryParams.search = search.toString();
6595
- }
6596
- if (sentiment != null) {
6597
- _queryParams.sentiment = sentiment.toString();
6598
- }
6599
- if (smartFormat != null) {
6600
- _queryParams.smart_format = smartFormat.toString();
6601
- }
6602
- if (summarize != null) {
6603
- _queryParams.summarize = summarize.toString();
6604
- }
6605
- if (tag != null) {
6606
- _queryParams.tag = tag;
6607
- }
6608
- if (topics != null) {
6609
- _queryParams.topics = topics.toString();
6610
- }
6611
- if (uttSplit != null) {
6612
- _queryParams.utt_split = uttSplit.toString();
6613
- }
6614
- if (utterances != null) {
6615
- _queryParams.utterances = utterances.toString();
6616
- }
6617
- if (version != null) {
6618
- _queryParams.version = version.toString();
6619
- }
6241
+ const _queryParams = {
6242
+ start,
6243
+ end,
6244
+ grouping: grouping != null ? grouping : void 0,
6245
+ accessor,
6246
+ alternatives,
6247
+ callback_method: callbackMethod,
6248
+ callback,
6249
+ channels,
6250
+ custom_intent_mode: customIntentMode,
6251
+ custom_intent: customIntent,
6252
+ custom_topic_mode: customTopicMode,
6253
+ custom_topic: customTopic,
6254
+ deployment: deployment != null ? deployment : void 0,
6255
+ detect_entities: detectEntities,
6256
+ detect_language: detectLanguage,
6257
+ diarize,
6258
+ dictation,
6259
+ encoding,
6260
+ endpoint: endpoint != null ? endpoint : void 0,
6261
+ extra,
6262
+ filler_words: fillerWords,
6263
+ intents,
6264
+ keyterm,
6265
+ keywords,
6266
+ language,
6267
+ measurements,
6268
+ method: method != null ? method : void 0,
6269
+ model,
6270
+ multichannel,
6271
+ numerals,
6272
+ paragraphs,
6273
+ profanity_filter: profanityFilter,
6274
+ punctuate,
6275
+ redact,
6276
+ replace,
6277
+ sample_rate: sampleRate,
6278
+ search,
6279
+ sentiment,
6280
+ smart_format: smartFormat,
6281
+ summarize,
6282
+ tag,
6283
+ topics,
6284
+ utt_split: uttSplit,
6285
+ utterances,
6286
+ version
6287
+ };
6620
6288
  const _authRequest = yield this._options.authProvider.getAuthRequest();
6621
6289
  const _headers = mergeHeaders(
6622
6290
  _authRequest.headers,
@@ -6689,13 +6357,10 @@ var Deepgram = (() => {
6689
6357
  return __async(this, arguments, function* (project_id, request = {}, requestOptions) {
6690
6358
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
6691
6359
  const { start, end } = request;
6692
- const _queryParams = {};
6693
- if (start != null) {
6694
- _queryParams.start = start;
6695
- }
6696
- if (end != null) {
6697
- _queryParams.end = end;
6698
- }
6360
+ const _queryParams = {
6361
+ start,
6362
+ end
6363
+ };
6699
6364
  const _authRequest = yield this._options.authProvider.getAuthRequest();
6700
6365
  const _headers = mergeHeaders(
6701
6366
  _authRequest.headers,
@@ -6863,139 +6528,52 @@ var Deepgram = (() => {
6863
6528
  utterances,
6864
6529
  version
6865
6530
  } = request;
6866
- const _queryParams = {};
6867
- if (start != null) {
6868
- _queryParams.start = start;
6869
- }
6870
- if (end != null) {
6871
- _queryParams.end = end;
6872
- }
6873
- if (accessor != null) {
6874
- _queryParams.accessor = accessor;
6875
- }
6876
- if (alternatives != null) {
6877
- _queryParams.alternatives = alternatives.toString();
6878
- }
6879
- if (callbackMethod != null) {
6880
- _queryParams.callback_method = callbackMethod.toString();
6881
- }
6882
- if (callback != null) {
6883
- _queryParams.callback = callback.toString();
6884
- }
6885
- if (channels != null) {
6886
- _queryParams.channels = channels.toString();
6887
- }
6888
- if (customIntentMode != null) {
6889
- _queryParams.custom_intent_mode = customIntentMode.toString();
6890
- }
6891
- if (customIntent != null) {
6892
- _queryParams.custom_intent = customIntent.toString();
6893
- }
6894
- if (customTopicMode != null) {
6895
- _queryParams.custom_topic_mode = customTopicMode.toString();
6896
- }
6897
- if (customTopic != null) {
6898
- _queryParams.custom_topic = customTopic.toString();
6899
- }
6900
- if (deployment != null) {
6901
- _queryParams.deployment = deployment;
6902
- }
6903
- if (detectEntities != null) {
6904
- _queryParams.detect_entities = detectEntities.toString();
6905
- }
6906
- if (detectLanguage != null) {
6907
- _queryParams.detect_language = detectLanguage.toString();
6908
- }
6909
- if (diarize != null) {
6910
- _queryParams.diarize = diarize.toString();
6911
- }
6912
- if (dictation != null) {
6913
- _queryParams.dictation = dictation.toString();
6914
- }
6915
- if (encoding != null) {
6916
- _queryParams.encoding = encoding.toString();
6917
- }
6918
- if (endpoint != null) {
6919
- _queryParams.endpoint = endpoint;
6920
- }
6921
- if (extra != null) {
6922
- _queryParams.extra = extra.toString();
6923
- }
6924
- if (fillerWords != null) {
6925
- _queryParams.filler_words = fillerWords.toString();
6926
- }
6927
- if (intents != null) {
6928
- _queryParams.intents = intents.toString();
6929
- }
6930
- if (keyterm != null) {
6931
- _queryParams.keyterm = keyterm.toString();
6932
- }
6933
- if (keywords != null) {
6934
- _queryParams.keywords = keywords.toString();
6935
- }
6936
- if (language != null) {
6937
- _queryParams.language = language.toString();
6938
- }
6939
- if (measurements != null) {
6940
- _queryParams.measurements = measurements.toString();
6941
- }
6942
- if (method != null) {
6943
- _queryParams.method = method;
6944
- }
6945
- if (model != null) {
6946
- _queryParams.model = model;
6947
- }
6948
- if (multichannel != null) {
6949
- _queryParams.multichannel = multichannel.toString();
6950
- }
6951
- if (numerals != null) {
6952
- _queryParams.numerals = numerals.toString();
6953
- }
6954
- if (paragraphs != null) {
6955
- _queryParams.paragraphs = paragraphs.toString();
6956
- }
6957
- if (profanityFilter != null) {
6958
- _queryParams.profanity_filter = profanityFilter.toString();
6959
- }
6960
- if (punctuate != null) {
6961
- _queryParams.punctuate = punctuate.toString();
6962
- }
6963
- if (redact != null) {
6964
- _queryParams.redact = redact.toString();
6965
- }
6966
- if (replace != null) {
6967
- _queryParams.replace = replace.toString();
6968
- }
6969
- if (sampleRate != null) {
6970
- _queryParams.sample_rate = sampleRate.toString();
6971
- }
6972
- if (search != null) {
6973
- _queryParams.search = search.toString();
6974
- }
6975
- if (sentiment != null) {
6976
- _queryParams.sentiment = sentiment.toString();
6977
- }
6978
- if (smartFormat != null) {
6979
- _queryParams.smart_format = smartFormat.toString();
6980
- }
6981
- if (summarize != null) {
6982
- _queryParams.summarize = summarize.toString();
6983
- }
6984
- if (tag != null) {
6985
- _queryParams.tag = tag;
6986
- }
6987
- if (topics != null) {
6988
- _queryParams.topics = topics.toString();
6989
- }
6990
- if (uttSplit != null) {
6991
- _queryParams.utt_split = uttSplit.toString();
6992
- }
6993
- if (utterances != null) {
6994
- _queryParams.utterances = utterances.toString();
6995
- }
6996
- if (version != null) {
6997
- _queryParams.version = version.toString();
6998
- }
6531
+ const _queryParams = {
6532
+ start,
6533
+ end,
6534
+ accessor,
6535
+ alternatives,
6536
+ callback_method: callbackMethod,
6537
+ callback,
6538
+ channels,
6539
+ custom_intent_mode: customIntentMode,
6540
+ custom_intent: customIntent,
6541
+ custom_topic_mode: customTopicMode,
6542
+ custom_topic: customTopic,
6543
+ deployment: deployment != null ? deployment : void 0,
6544
+ detect_entities: detectEntities,
6545
+ detect_language: detectLanguage,
6546
+ diarize,
6547
+ dictation,
6548
+ encoding,
6549
+ endpoint: endpoint != null ? endpoint : void 0,
6550
+ extra,
6551
+ filler_words: fillerWords,
6552
+ intents,
6553
+ keyterm,
6554
+ keywords,
6555
+ language,
6556
+ measurements,
6557
+ method: method != null ? method : void 0,
6558
+ model,
6559
+ multichannel,
6560
+ numerals,
6561
+ paragraphs,
6562
+ profanity_filter: profanityFilter,
6563
+ punctuate,
6564
+ redact,
6565
+ replace,
6566
+ sample_rate: sampleRate,
6567
+ search,
6568
+ sentiment,
6569
+ smart_format: smartFormat,
6570
+ summarize,
6571
+ tag,
6572
+ topics,
6573
+ utt_split: uttSplit,
6574
+ utterances,
6575
+ version
6576
+ };
6999
6577
  const _authRequest = yield this._options.authProvider.getAuthRequest();
7000
6578
  const _headers = mergeHeaders(
7001
6579
  _authRequest.headers,
@@ -7146,13 +6724,10 @@ var Deepgram = (() => {
7146
6724
  return __async(this, arguments, function* (project_id, request = {}, requestOptions) {
7147
6725
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
7148
6726
  const { limit, page } = request;
7149
- const _queryParams = {};
7150
- if (limit != null) {
7151
- _queryParams.limit = limit.toString();
7152
- }
7153
- if (page != null) {
7154
- _queryParams.page = page.toString();
7155
- }
6727
+ const _queryParams = {
6728
+ limit,
6729
+ page
6730
+ };
7156
6731
  const _authRequest = yield this._options.authProvider.getAuthRequest();
7157
6732
  const _headers = mergeHeaders(
7158
6733
  _authRequest.headers,
@@ -7446,55 +7021,20 @@ var Deepgram = (() => {
7446
7021
  language,
7447
7022
  body: _body
7448
7023
  } = request;
7449
- const _queryParams = {};
7450
- if (callback != null) {
7451
- _queryParams.callback = callback;
7452
- }
7453
- if (callbackMethod != null) {
7454
- _queryParams.callback_method = callbackMethod;
7455
- }
7456
- if (sentiment != null) {
7457
- _queryParams.sentiment = sentiment.toString();
7458
- }
7459
- if (summarize != null) {
7460
- _queryParams.summarize = summarize;
7461
- }
7462
- if (tag != null) {
7463
- if (Array.isArray(tag)) {
7464
- _queryParams.tag = tag.map((item) => item);
7465
- } else {
7466
- _queryParams.tag = tag;
7467
- }
7468
- }
7469
- if (topics != null) {
7470
- _queryParams.topics = topics.toString();
7471
- }
7472
- if (customTopic != null) {
7473
- if (Array.isArray(customTopic)) {
7474
- _queryParams.custom_topic = customTopic.map((item) => item);
7475
- } else {
7476
- _queryParams.custom_topic = customTopic;
7477
- }
7478
- }
7479
- if (customTopicMode != null) {
7480
- _queryParams.custom_topic_mode = customTopicMode;
7481
- }
7482
- if (intents != null) {
7483
- _queryParams.intents = intents.toString();
7484
- }
7485
- if (customIntent != null) {
7486
- if (Array.isArray(customIntent)) {
7487
- _queryParams.custom_intent = customIntent.map((item) => item);
7488
- } else {
7489
- _queryParams.custom_intent = customIntent;
7490
- }
7491
- }
7492
- if (customIntentMode != null) {
7493
- _queryParams.custom_intent_mode = customIntentMode;
7494
- }
7495
- if (language != null) {
7496
- _queryParams.language = language;
7497
- }
7024
+ const _queryParams = {
7025
+ callback,
7026
+ callback_method: callbackMethod != null ? callbackMethod : void 0,
7027
+ sentiment,
7028
+ summarize: summarize != null ? summarize : void 0,
7029
+ tag,
7030
+ topics,
7031
+ custom_topic: customTopic,
7032
+ custom_topic_mode: customTopicMode != null ? customTopicMode : void 0,
7033
+ intents,
7034
+ custom_intent: customIntent,
7035
+ custom_intent_mode: customIntentMode != null ? customIntentMode : void 0,
7036
+ language
7037
+ };
7498
7038
  const _authRequest = yield this._options.authProvider.getAuthRequest();
7499
7039
  const _headers = mergeHeaders(
7500
7040
  _authRequest.headers,
@@ -7649,17 +7189,10 @@ var Deepgram = (() => {
7649
7189
  return __async(this, arguments, function* (project_id, request = {}, requestOptions) {
7650
7190
  var _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
7651
7191
  const _a = request, { scopes, provider } = _a, _body = __objRest(_a, ["scopes", "provider"]);
7652
- const _queryParams = {};
7653
- if (scopes != null) {
7654
- if (Array.isArray(scopes)) {
7655
- _queryParams.scopes = scopes.map((item) => item);
7656
- } else {
7657
- _queryParams.scopes = scopes;
7658
- }
7659
- }
7660
- if (provider != null) {
7661
- _queryParams.provider = provider;
7662
- }
7192
+ const _queryParams = {
7193
+ scopes: Array.isArray(scopes) ? scopes.map((item) => item) : scopes != null ? scopes : void 0,
7194
+ provider: provider != null ? provider : void 0
7195
+ };
7663
7196
  const _authRequest = yield this._options.authProvider.getAuthRequest();
7664
7197
  const _headers = mergeHeaders(
7665
7198
  _authRequest.headers,
@@ -7901,38 +7434,17 @@ var Deepgram = (() => {
7901
7434
  "model",
7902
7435
  "sample_rate"
7903
7436
  ]);
7904
- const _queryParams = {};
7905
- if (callback != null) {
7906
- _queryParams.callback = callback;
7907
- }
7908
- if (callbackMethod != null) {
7909
- _queryParams.callback_method = callbackMethod;
7910
- }
7911
- if (mipOptOut != null) {
7912
- _queryParams.mip_opt_out = mipOptOut.toString();
7913
- }
7914
- if (tag != null) {
7915
- if (Array.isArray(tag)) {
7916
- _queryParams.tag = tag.map((item) => item);
7917
- } else {
7918
- _queryParams.tag = tag;
7919
- }
7920
- }
7921
- if (bitRate != null) {
7922
- _queryParams.bit_rate = bitRate.toString();
7923
- }
7924
- if (container != null) {
7925
- _queryParams.container = container;
7926
- }
7927
- if (encoding != null) {
7928
- _queryParams.encoding = encoding;
7929
- }
7930
- if (model != null) {
7931
- _queryParams.model = model;
7932
- }
7933
- if (sampleRate != null) {
7934
- _queryParams.sample_rate = sampleRate.toString();
7935
- }
7437
+ const _queryParams = {
7438
+ callback,
7439
+ callback_method: callbackMethod != null ? callbackMethod : void 0,
7440
+ mip_opt_out: mipOptOut,
7441
+ tag,
7442
+ bit_rate: bitRate,
7443
+ container: container != null ? container : void 0,
7444
+ encoding: encoding != null ? encoding : void 0,
7445
+ model: model != null ? model : void 0,
7446
+ sample_rate: sampleRate
7447
+ };
7936
7448
  const _authRequest = yield this._options.authProvider.getAuthRequest();
7937
7449
  const _headers = mergeHeaders(
7938
7450
  _authRequest.headers,
@@ -8022,19 +7534,19 @@ var Deepgram = (() => {
8022
7534
  on(event, callback) {
8023
7535
  this.eventHandlers[event] = callback;
8024
7536
  }
8025
- sendSpeakV1Text(message) {
7537
+ sendText(message) {
8026
7538
  this.assertSocketIsOpen();
8027
7539
  this.sendJson(message);
8028
7540
  }
8029
- sendSpeakV1Flush(message) {
7541
+ sendFlush(message) {
8030
7542
  this.assertSocketIsOpen();
8031
7543
  this.sendJson(message);
8032
7544
  }
8033
- sendSpeakV1Clear(message) {
7545
+ sendClear(message) {
8034
7546
  this.assertSocketIsOpen();
8035
7547
  this.sendJson(message);
8036
7548
  }
8037
- sendSpeakV1Close(message) {
7549
+ sendClose(message) {
8038
7550
  this.assertSocketIsOpen();
8039
7551
  this.sendJson(message);
8040
7552
  }
@@ -8113,19 +7625,12 @@ var Deepgram = (() => {
8113
7625
  debug,
8114
7626
  reconnectAttempts
8115
7627
  } = args;
8116
- const _queryParams = {};
8117
- if (encoding != null) {
8118
- _queryParams.encoding = encoding;
8119
- }
8120
- if (mipOptOut != null) {
8121
- _queryParams.mip_opt_out = mipOptOut;
8122
- }
8123
- if (model != null) {
8124
- _queryParams.model = model;
8125
- }
8126
- if (sampleRate != null) {
8127
- _queryParams.sample_rate = sampleRate;
8128
- }
7628
+ const _queryParams = {
7629
+ encoding,
7630
+ mip_opt_out: mipOptOut,
7631
+ model,
7632
+ sample_rate: sampleRate
7633
+ };
8129
7634
  const _headers = mergeHeaders(
8130
7635
  mergeOnlyDefinedHeaders({ Authorization: args.Authorization }),
8131
7636
  headers
@@ -8192,6 +7697,7 @@ var Deepgram = (() => {
8192
7697
  };
8193
7698
 
8194
7699
  // src/CustomClient.ts
7700
+ var DEFAULT_CONNECTION_TIMEOUT_MS = 1e4;
8195
7701
  var NodeWebSocket2;
8196
7702
  try {
8197
7703
  NodeWebSocket2 = require_browser();
@@ -8199,9 +7705,86 @@ var Deepgram = (() => {
8199
7705
  } catch (e) {
8200
7706
  NodeWebSocket2 = void 0;
8201
7707
  }
7708
+ function generateUUID() {
7709
+ if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
7710
+ return crypto.randomUUID();
7711
+ }
7712
+ if (RUNTIME.type === "node") {
7713
+ try {
7714
+ const nodeCrypto = __require("crypto");
7715
+ return nodeCrypto.randomUUID();
7716
+ } catch (e) {
7717
+ }
7718
+ }
7719
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
7720
+ const r = Math.random() * 16 | 0;
7721
+ const v = c === "x" ? r : r & 3 | 8;
7722
+ return v.toString(16);
7723
+ });
7724
+ }
7725
+ var ApiKeyAuthProviderWrapper = class {
7726
+ constructor(originalProvider) {
7727
+ this.originalProvider = originalProvider;
7728
+ }
7729
+ getAuthRequest(arg) {
7730
+ return __async(this, null, function* () {
7731
+ var _a, _b;
7732
+ const authRequest = yield this.originalProvider.getAuthRequest(arg);
7733
+ const authHeader = ((_a = authRequest.headers) == null ? void 0 : _a.Authorization) || ((_b = authRequest.headers) == null ? void 0 : _b.authorization);
7734
+ if (authHeader && typeof authHeader === "string") {
7735
+ if (!authHeader.startsWith("Bearer ") && !authHeader.startsWith("Token ") && !authHeader.startsWith("token ")) {
7736
+ return {
7737
+ headers: __spreadProps(__spreadValues({}, authRequest.headers), {
7738
+ Authorization: `Token ${authHeader}`
7739
+ })
7740
+ };
7741
+ }
7742
+ }
7743
+ return authRequest;
7744
+ });
7745
+ }
7746
+ };
7747
+ var AccessTokenAuthProviderWrapper = class {
7748
+ constructor(originalProvider, accessToken) {
7749
+ this.originalProvider = originalProvider;
7750
+ this.accessToken = accessToken;
7751
+ }
7752
+ getAuthRequest(arg) {
7753
+ return __async(this, null, function* () {
7754
+ var _a, _b;
7755
+ const accessToken = (_b = yield Supplier.get(this.accessToken)) != null ? _b : (_a = process.env) == null ? void 0 : _a.DEEPGRAM_ACCESS_TOKEN;
7756
+ if (accessToken != null) {
7757
+ return {
7758
+ headers: { Authorization: `Bearer ${accessToken}` }
7759
+ };
7760
+ }
7761
+ return this.originalProvider.getAuthRequest(arg);
7762
+ });
7763
+ }
7764
+ };
8202
7765
  var CustomDeepgramClient = class extends DeepgramClient {
8203
7766
  constructor(options = {}) {
8204
- super(options);
7767
+ const sessionId = generateUUID();
7768
+ const optionsWithSessionId = __spreadProps(__spreadValues({}, options), {
7769
+ headers: __spreadProps(__spreadValues({}, options.headers), {
7770
+ "x-deepgram-session-id": sessionId
7771
+ })
7772
+ });
7773
+ super(optionsWithSessionId);
7774
+ this._sessionId = sessionId;
7775
+ this._options.authProvider = new ApiKeyAuthProviderWrapper(this._options.authProvider);
7776
+ if (options.accessToken != null) {
7777
+ this._options.authProvider = new AccessTokenAuthProviderWrapper(
7778
+ this._options.authProvider,
7779
+ options.accessToken
7780
+ );
7781
+ }
7782
+ }
7783
+ /**
7784
+ * Get the session ID that was generated for this client instance.
7785
+ */
7786
+ get sessionId() {
7787
+ return this._sessionId;
8205
7788
  }
8206
7789
  /**
8207
7790
  * Override the agent getter to return a wrapped client that ensures
@@ -8252,9 +7835,25 @@ var Deepgram = (() => {
8252
7835
  return new WrappedSpeakV1Client(this._options);
8253
7836
  }
8254
7837
  };
7838
+ function resolveHeaders(headers) {
7839
+ return __async(this, null, function* () {
7840
+ const resolved = {};
7841
+ for (const [key, value] of Object.entries(headers)) {
7842
+ if (value == null) {
7843
+ continue;
7844
+ }
7845
+ const resolvedValue = yield Supplier.get(value);
7846
+ if (resolvedValue != null) {
7847
+ resolved[key] = resolvedValue;
7848
+ }
7849
+ }
7850
+ return resolved;
7851
+ });
7852
+ }
8255
7853
  function getWebSocketOptions(headers) {
8256
7854
  const options = {};
8257
7855
  const isBrowser = RUNTIME.type === "browser" || RUNTIME.type === "web-worker";
7856
+ const sessionIdHeader = headers["x-deepgram-session-id"] || headers["X-Deepgram-Session-Id"];
8258
7857
  if (RUNTIME.type === "node" && NodeWebSocket2) {
8259
7858
  options.WebSocket = NodeWebSocket2;
8260
7859
  options.headers = headers;
@@ -8263,50 +7862,109 @@ var Deepgram = (() => {
8263
7862
  const browserHeaders = __spreadValues({}, headers);
8264
7863
  delete browserHeaders.Authorization;
8265
7864
  delete browserHeaders.authorization;
7865
+ delete browserHeaders["x-deepgram-session-id"];
7866
+ delete browserHeaders["X-Deepgram-Session-Id"];
8266
7867
  options.headers = browserHeaders;
7868
+ const protocols = [];
8267
7869
  if (authHeader && typeof authHeader === "string") {
8268
7870
  if (authHeader.startsWith("Token ")) {
8269
7871
  const apiKey = authHeader.substring(6);
8270
- options.protocols = ["token", apiKey];
7872
+ protocols.push("token", apiKey);
8271
7873
  } else if (authHeader.startsWith("Bearer ")) {
8272
7874
  const token = authHeader.substring(7);
8273
- options.protocols = ["bearer", token];
7875
+ protocols.push("bearer", token);
8274
7876
  } else {
8275
- options.protocols = [authHeader];
7877
+ protocols.push(authHeader);
8276
7878
  }
8277
7879
  }
7880
+ if (sessionIdHeader && typeof sessionIdHeader === "string") {
7881
+ protocols.push("x-deepgram-session-id", sessionIdHeader);
7882
+ }
7883
+ if (protocols.length > 0) {
7884
+ options.protocols = protocols;
7885
+ }
8278
7886
  } else {
8279
7887
  options.headers = headers;
8280
7888
  }
8281
7889
  return options;
8282
7890
  }
7891
+ function setupBinaryHandling(socket, eventHandlers) {
7892
+ var _a;
7893
+ const binaryAwareHandler = (event) => {
7894
+ var _a2, _b, _c;
7895
+ if (typeof event.data === "string") {
7896
+ try {
7897
+ const data = fromJson(event.data);
7898
+ (_a2 = eventHandlers.message) == null ? void 0 : _a2.call(eventHandlers, data);
7899
+ } catch (error) {
7900
+ (_b = eventHandlers.message) == null ? void 0 : _b.call(eventHandlers, event.data);
7901
+ }
7902
+ } else {
7903
+ (_c = eventHandlers.message) == null ? void 0 : _c.call(eventHandlers, event.data);
7904
+ }
7905
+ };
7906
+ const socketAny = socket;
7907
+ if ((_a = socketAny._listeners) == null ? void 0 : _a.message) {
7908
+ socketAny._listeners.message.forEach((listener) => {
7909
+ socket.removeEventListener("message", listener);
7910
+ });
7911
+ }
7912
+ socket.addEventListener("message", binaryAwareHandler);
7913
+ return binaryAwareHandler;
7914
+ }
7915
+ function resetSocketConnectionState(socket) {
7916
+ if (socket.readyState === socket.CLOSED) {
7917
+ socket._connectLock = false;
7918
+ socket._shouldReconnect = true;
7919
+ }
7920
+ }
7921
+ function createWebSocketConnection(_0) {
7922
+ return __async(this, arguments, function* ({
7923
+ options,
7924
+ urlPath,
7925
+ environmentKey,
7926
+ queryParams,
7927
+ headers,
7928
+ debug,
7929
+ reconnectAttempts
7930
+ }) {
7931
+ var _a, _b, _c, _d, _e, _f;
7932
+ const authRequest = yield (_a = options.authProvider) == null ? void 0 : _a.getAuthRequest();
7933
+ const mergedHeaders = mergeHeaders(
7934
+ (_b = options.headers) != null ? _b : {},
7935
+ (_c = authRequest == null ? void 0 : authRequest.headers) != null ? _c : {},
7936
+ headers
7937
+ );
7938
+ const _headers = yield resolveHeaders(mergedHeaders);
7939
+ const wsOptions = getWebSocketOptions(_headers);
7940
+ const baseUrl = (_e = yield Supplier.get(options.baseUrl)) != null ? _e : ((_d = yield Supplier.get(options.environment)) != null ? _d : DeepgramEnvironment.Production)[environmentKey];
7941
+ return new ReconnectingWebSocket({
7942
+ url: url_exports.join(baseUrl, urlPath),
7943
+ protocols: (_f = wsOptions.protocols) != null ? _f : [],
7944
+ queryParameters: queryParams,
7945
+ headers: wsOptions.headers,
7946
+ options: {
7947
+ WebSocket: wsOptions.WebSocket,
7948
+ debug: debug != null ? debug : false,
7949
+ maxRetries: reconnectAttempts != null ? reconnectAttempts : 30,
7950
+ startClosed: true,
7951
+ connectionTimeout: DEFAULT_CONNECTION_TIMEOUT_MS
7952
+ }
7953
+ });
7954
+ });
7955
+ }
8283
7956
  var WrappedAgentV1Client = class extends V1Client {
8284
7957
  connect() {
8285
7958
  return __async(this, arguments, function* (args = {}) {
8286
- var _a, _b, _c, _d, _e;
8287
7959
  const { headers, debug, reconnectAttempts } = args;
8288
- const authRequest = yield (_a = this._options.authProvider) == null ? void 0 : _a.getAuthRequest();
8289
- const _headers = mergeHeaders(
8290
- (_b = authRequest == null ? void 0 : authRequest.headers) != null ? _b : {},
8291
- headers
8292
- );
8293
- const wsOptions = getWebSocketOptions(_headers);
8294
- const socket = new ReconnectingWebSocket({
8295
- url: url_exports.join(
8296
- (_d = yield Supplier.get(this._options.baseUrl)) != null ? _d : ((_c = yield Supplier.get(this._options.environment)) != null ? _c : DeepgramEnvironment.Production).agent,
8297
- "/v1/agent/converse"
8298
- ),
8299
- protocols: (_e = wsOptions.protocols) != null ? _e : [],
8300
- queryParameters: {},
8301
- headers: wsOptions.headers,
8302
- options: {
8303
- WebSocket: wsOptions.WebSocket,
8304
- debug: debug != null ? debug : false,
8305
- maxRetries: reconnectAttempts != null ? reconnectAttempts : 30,
8306
- startClosed: true,
8307
- connectionTimeout: 1e4
8308
- // Increase timeout to 10 seconds
8309
- }
7960
+ const socket = yield createWebSocketConnection({
7961
+ options: this._options,
7962
+ urlPath: "/v1/agent/converse",
7963
+ environmentKey: "agent",
7964
+ queryParams: {},
7965
+ headers,
7966
+ debug,
7967
+ reconnectAttempts
8310
7968
  });
8311
7969
  return new WrappedAgentV1Socket({ socket });
8312
7970
  });
@@ -8318,35 +7976,10 @@ var Deepgram = (() => {
8318
7976
  this.setupBinaryHandling();
8319
7977
  }
8320
7978
  setupBinaryHandling() {
8321
- var _a;
8322
- this.binaryAwareHandler = (event) => {
8323
- var _a2, _b, _c, _d, _e, _f;
8324
- if (typeof event.data === "string") {
8325
- try {
8326
- const data = fromJson(event.data);
8327
- (_b = (_a2 = this.eventHandlers).message) == null ? void 0 : _b.call(_a2, data);
8328
- } catch (error) {
8329
- (_d = (_c = this.eventHandlers).message) == null ? void 0 : _d.call(_c, event.data);
8330
- }
8331
- } else {
8332
- (_f = (_e = this.eventHandlers).message) == null ? void 0 : _f.call(_e, event.data);
8333
- }
8334
- };
8335
- const socketAny = this.socket;
8336
- if ((_a = socketAny._listeners) == null ? void 0 : _a.message) {
8337
- socketAny._listeners.message.forEach((listener) => {
8338
- this.socket.removeEventListener("message", listener);
8339
- });
8340
- }
8341
- if (this.binaryAwareHandler) {
8342
- this.socket.addEventListener("message", this.binaryAwareHandler);
8343
- }
7979
+ this.binaryAwareHandler = setupBinaryHandling(this.socket, this.eventHandlers);
8344
7980
  }
8345
7981
  connect() {
8346
- if (this.socket.readyState === this.socket.CLOSED) {
8347
- this.socket._connectLock = false;
8348
- this.socket._shouldReconnect = true;
8349
- }
7982
+ resetSocketConnectionState(this.socket);
8350
7983
  super.connect();
8351
7984
  this.setupBinaryHandling();
8352
7985
  return this;
@@ -8355,7 +7988,6 @@ var Deepgram = (() => {
8355
7988
  var WrappedListenV1Client = class extends V1Client3 {
8356
7989
  connect(args) {
8357
7990
  return __async(this, null, function* () {
8358
- var _a, _b, _c;
8359
7991
  const {
8360
7992
  callback,
8361
7993
  callback_method: callbackMethod,
@@ -8416,28 +8048,14 @@ var Deepgram = (() => {
8416
8048
  if (utteranceEndMs != null) _queryParams.utterance_end_ms = utteranceEndMs;
8417
8049
  if (vadEvents != null) _queryParams.vad_events = vadEvents;
8418
8050
  if (version != null) _queryParams.version = version;
8419
- const authRequest = yield this._options.authProvider.getAuthRequest();
8420
- const _headers = mergeHeaders(
8421
- authRequest.headers,
8422
- headers
8423
- );
8424
- const wsOptions = getWebSocketOptions(_headers);
8425
- const socket = new ReconnectingWebSocket({
8426
- url: url_exports.join(
8427
- (_b = yield Supplier.get(this._options.baseUrl)) != null ? _b : ((_a = yield Supplier.get(this._options.environment)) != null ? _a : DeepgramEnvironment.Production).production,
8428
- "/v1/listen"
8429
- ),
8430
- protocols: (_c = wsOptions.protocols) != null ? _c : [],
8431
- queryParameters: _queryParams,
8432
- headers: wsOptions.headers,
8433
- options: {
8434
- WebSocket: wsOptions.WebSocket,
8435
- debug: debug != null ? debug : false,
8436
- maxRetries: reconnectAttempts != null ? reconnectAttempts : 30,
8437
- startClosed: true,
8438
- connectionTimeout: 1e4
8439
- // Increase timeout to 10 seconds
8440
- }
8051
+ const socket = yield createWebSocketConnection({
8052
+ options: this._options,
8053
+ urlPath: "/v1/listen",
8054
+ environmentKey: "production",
8055
+ queryParams: _queryParams,
8056
+ headers,
8057
+ debug,
8058
+ reconnectAttempts
8441
8059
  });
8442
8060
  return new WrappedListenV1Socket({ socket });
8443
8061
  });
@@ -8449,35 +8067,10 @@ var Deepgram = (() => {
8449
8067
  this.setupBinaryHandling();
8450
8068
  }
8451
8069
  setupBinaryHandling() {
8452
- var _a;
8453
- this.binaryAwareHandler = (event) => {
8454
- var _a2, _b, _c, _d, _e, _f;
8455
- if (typeof event.data === "string") {
8456
- try {
8457
- const data = fromJson(event.data);
8458
- (_b = (_a2 = this.eventHandlers).message) == null ? void 0 : _b.call(_a2, data);
8459
- } catch (error) {
8460
- (_d = (_c = this.eventHandlers).message) == null ? void 0 : _d.call(_c, event.data);
8461
- }
8462
- } else {
8463
- (_f = (_e = this.eventHandlers).message) == null ? void 0 : _f.call(_e, event.data);
8464
- }
8465
- };
8466
- const socketAny = this.socket;
8467
- if ((_a = socketAny._listeners) == null ? void 0 : _a.message) {
8468
- socketAny._listeners.message.forEach((listener) => {
8469
- this.socket.removeEventListener("message", listener);
8470
- });
8471
- }
8472
- if (this.binaryAwareHandler) {
8473
- this.socket.addEventListener("message", this.binaryAwareHandler);
8474
- }
8070
+ this.binaryAwareHandler = setupBinaryHandling(this.socket, this.eventHandlers);
8475
8071
  }
8476
8072
  connect() {
8477
- if (this.socket.readyState === this.socket.CLOSED) {
8478
- this.socket._connectLock = false;
8479
- this.socket._shouldReconnect = true;
8480
- }
8073
+ resetSocketConnectionState(this.socket);
8481
8074
  super.connect();
8482
8075
  this.setupBinaryHandling();
8483
8076
  return this;
@@ -8486,7 +8079,6 @@ var Deepgram = (() => {
8486
8079
  var WrappedListenV2Client = class extends V2Client {
8487
8080
  connect(args) {
8488
8081
  return __async(this, null, function* () {
8489
- var _a, _b, _c, _d, _e;
8490
8082
  const {
8491
8083
  model,
8492
8084
  encoding,
@@ -8511,28 +8103,14 @@ var Deepgram = (() => {
8511
8103
  if (keyterm != null) _queryParams.keyterm = keyterm;
8512
8104
  if (mipOptOut != null) _queryParams.mip_opt_out = mipOptOut;
8513
8105
  if (tag != null) _queryParams.tag = tag;
8514
- const authRequest = yield (_a = this._options.authProvider) == null ? void 0 : _a.getAuthRequest();
8515
- const _headers = mergeHeaders(
8516
- (_b = authRequest == null ? void 0 : authRequest.headers) != null ? _b : {},
8517
- headers
8518
- );
8519
- const wsOptions = getWebSocketOptions(_headers);
8520
- const socket = new ReconnectingWebSocket({
8521
- url: url_exports.join(
8522
- (_d = yield Supplier.get(this._options.baseUrl)) != null ? _d : ((_c = yield Supplier.get(this._options.environment)) != null ? _c : DeepgramEnvironment.Production).production,
8523
- "/v2/listen"
8524
- ),
8525
- protocols: (_e = wsOptions.protocols) != null ? _e : [],
8526
- queryParameters: _queryParams,
8527
- headers: wsOptions.headers,
8528
- options: {
8529
- WebSocket: wsOptions.WebSocket,
8530
- debug: debug != null ? debug : false,
8531
- maxRetries: reconnectAttempts != null ? reconnectAttempts : 30,
8532
- startClosed: true,
8533
- connectionTimeout: 1e4
8534
- // Increase timeout to 10 seconds
8535
- }
8106
+ const socket = yield createWebSocketConnection({
8107
+ options: this._options,
8108
+ urlPath: "/v2/listen",
8109
+ environmentKey: "production",
8110
+ queryParams: _queryParams,
8111
+ headers,
8112
+ debug,
8113
+ reconnectAttempts
8536
8114
  });
8537
8115
  return new WrappedListenV2Socket({ socket });
8538
8116
  });
@@ -8544,44 +8122,44 @@ var Deepgram = (() => {
8544
8122
  this.setupBinaryHandling();
8545
8123
  }
8546
8124
  setupBinaryHandling() {
8547
- var _a;
8548
- this.binaryAwareHandler = (event) => {
8549
- var _a2, _b, _c, _d, _e, _f;
8550
- if (typeof event.data === "string") {
8551
- try {
8552
- const data = fromJson(event.data);
8553
- (_b = (_a2 = this.eventHandlers).message) == null ? void 0 : _b.call(_a2, data);
8554
- } catch (error) {
8555
- (_d = (_c = this.eventHandlers).message) == null ? void 0 : _d.call(_c, event.data);
8556
- }
8557
- } else {
8558
- (_f = (_e = this.eventHandlers).message) == null ? void 0 : _f.call(_e, event.data);
8559
- }
8560
- };
8561
- const socketAny = this.socket;
8562
- if ((_a = socketAny._listeners) == null ? void 0 : _a.message) {
8563
- socketAny._listeners.message.forEach((listener) => {
8564
- this.socket.removeEventListener("message", listener);
8565
- });
8566
- }
8567
- if (this.binaryAwareHandler) {
8568
- this.socket.addEventListener("message", this.binaryAwareHandler);
8569
- }
8125
+ this.binaryAwareHandler = setupBinaryHandling(this.socket, this.eventHandlers);
8570
8126
  }
8571
8127
  connect() {
8572
- if (this.socket.readyState === this.socket.CLOSED) {
8573
- this.socket._connectLock = false;
8574
- this.socket._shouldReconnect = true;
8575
- }
8128
+ resetSocketConnectionState(this.socket);
8576
8129
  super.connect();
8577
8130
  this.setupBinaryHandling();
8578
8131
  return this;
8579
8132
  }
8133
+ /**
8134
+ * Send a WebSocket ping frame to keep the connection alive.
8135
+ *
8136
+ * In Node.js, this uses the native WebSocket ping() method from the 'ws' library.
8137
+ * In browsers, WebSocket ping/pong is handled automatically by the browser and
8138
+ * cannot be manually triggered, so this method will throw an error.
8139
+ *
8140
+ * @param data Optional data to send with the ping (Node.js only)
8141
+ * @throws Error if not in Node.js environment or WebSocket is not connected
8142
+ */
8143
+ ping(data) {
8144
+ const ws = this.socket._ws;
8145
+ if (!ws) {
8146
+ throw new Error("WebSocket is not connected. Call connect() and waitForOpen() first.");
8147
+ }
8148
+ if (ws.readyState !== ws.OPEN) {
8149
+ throw new Error("WebSocket is not in OPEN state.");
8150
+ }
8151
+ if (RUNTIME.type === "node" && typeof ws.ping === "function") {
8152
+ ws.ping(data);
8153
+ } else {
8154
+ throw new Error(
8155
+ "WebSocket ping is not supported in browser environments. Browser WebSocket connections handle ping/pong automatically. If you need keepalive in the browser, consider sending periodic audio data or using a timer."
8156
+ );
8157
+ }
8158
+ }
8580
8159
  };
8581
8160
  var WrappedSpeakV1Client = class extends V1Client7 {
8582
8161
  connect(args) {
8583
8162
  return __async(this, null, function* () {
8584
- var _a, _b, _c;
8585
8163
  const {
8586
8164
  encoding,
8587
8165
  mip_opt_out: mipOptOut,
@@ -8596,28 +8174,14 @@ var Deepgram = (() => {
8596
8174
  if (mipOptOut != null) _queryParams.mip_opt_out = mipOptOut;
8597
8175
  if (model != null) _queryParams.model = model;
8598
8176
  if (sampleRate != null) _queryParams.sample_rate = sampleRate;
8599
- const authRequest = yield this._options.authProvider.getAuthRequest();
8600
- const _headers = mergeHeaders(
8601
- authRequest.headers,
8602
- headers
8603
- );
8604
- const wsOptions = getWebSocketOptions(_headers);
8605
- const socket = new ReconnectingWebSocket({
8606
- url: url_exports.join(
8607
- (_b = yield Supplier.get(this._options.baseUrl)) != null ? _b : ((_a = yield Supplier.get(this._options.environment)) != null ? _a : DeepgramEnvironment.Production).production,
8608
- "/v1/speak"
8609
- ),
8610
- protocols: (_c = wsOptions.protocols) != null ? _c : [],
8611
- queryParameters: _queryParams,
8612
- headers: wsOptions.headers,
8613
- options: {
8614
- WebSocket: wsOptions.WebSocket,
8615
- debug: debug != null ? debug : false,
8616
- maxRetries: reconnectAttempts != null ? reconnectAttempts : 30,
8617
- startClosed: true,
8618
- connectionTimeout: 1e4
8619
- // Increase timeout to 10 seconds
8620
- }
8177
+ const socket = yield createWebSocketConnection({
8178
+ options: this._options,
8179
+ urlPath: "/v1/speak",
8180
+ environmentKey: "production",
8181
+ queryParams: _queryParams,
8182
+ headers,
8183
+ debug,
8184
+ reconnectAttempts
8621
8185
  });
8622
8186
  return new WrappedSpeakV1Socket({ socket });
8623
8187
  });
@@ -8629,35 +8193,10 @@ var Deepgram = (() => {
8629
8193
  this.setupBinaryHandling();
8630
8194
  }
8631
8195
  setupBinaryHandling() {
8632
- var _a;
8633
- this.binaryAwareHandler = (event) => {
8634
- var _a2, _b, _c, _d, _e, _f;
8635
- if (typeof event.data === "string") {
8636
- try {
8637
- const data = fromJson(event.data);
8638
- (_b = (_a2 = this.eventHandlers).message) == null ? void 0 : _b.call(_a2, data);
8639
- } catch (error) {
8640
- (_d = (_c = this.eventHandlers).message) == null ? void 0 : _d.call(_c, event.data);
8641
- }
8642
- } else {
8643
- (_f = (_e = this.eventHandlers).message) == null ? void 0 : _f.call(_e, event.data);
8644
- }
8645
- };
8646
- const socketAny = this.socket;
8647
- if ((_a = socketAny._listeners) == null ? void 0 : _a.message) {
8648
- socketAny._listeners.message.forEach((listener) => {
8649
- this.socket.removeEventListener("message", listener);
8650
- });
8651
- }
8652
- if (this.binaryAwareHandler) {
8653
- this.socket.addEventListener("message", this.binaryAwareHandler);
8654
- }
8196
+ this.binaryAwareHandler = setupBinaryHandling(this.socket, this.eventHandlers);
8655
8197
  }
8656
8198
  connect() {
8657
- if (this.socket.readyState === this.socket.CLOSED) {
8658
- this.socket._connectLock = false;
8659
- this.socket._shouldReconnect = true;
8660
- }
8199
+ resetSocketConnectionState(this.socket);
8661
8200
  super.connect();
8662
8201
  this.setupBinaryHandling();
8663
8202
  return this;