@deepgram/sdk 5.0.0-beta.4 → 5.1.0

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 (703) hide show
  1. package/README.md +232 -1511
  2. package/dist/browser/index.global.js +1517 -448
  3. package/dist/cjs/BaseClient.js +3 -3
  4. package/dist/cjs/Client.d.ts +15 -0
  5. package/dist/cjs/Client.js +79 -0
  6. package/dist/cjs/CustomClient.js +83 -107
  7. package/dist/cjs/api/resources/agent/exports.d.ts +3 -0
  8. package/dist/cjs/api/resources/agent/exports.js +22 -0
  9. package/dist/cjs/api/resources/agent/resources/v1/client/Client.d.ts +6 -0
  10. package/dist/cjs/api/resources/agent/resources/v1/client/Client.js +11 -6
  11. package/dist/cjs/api/resources/agent/resources/v1/client/Socket.d.ts +6 -5
  12. package/dist/cjs/api/resources/agent/resources/v1/client/Socket.js +6 -2
  13. package/dist/cjs/api/resources/agent/resources/v1/exports.d.ts +4 -0
  14. package/dist/cjs/api/resources/agent/resources/v1/exports.js +24 -0
  15. package/dist/cjs/api/resources/agent/resources/v1/resources/settings/exports.d.ts +3 -0
  16. package/dist/cjs/api/resources/agent/resources/v1/resources/settings/exports.js +22 -0
  17. package/dist/cjs/api/resources/agent/resources/v1/resources/settings/resources/think/exports.d.ts +3 -0
  18. package/dist/cjs/api/resources/agent/resources/v1/resources/settings/resources/think/exports.js +22 -0
  19. package/dist/cjs/api/resources/agent/resources/v1/resources/settings/resources/think/resources/models/client/Client.js +1 -1
  20. package/dist/cjs/api/resources/agent/resources/v1/resources/settings/resources/think/resources/models/exports.d.ts +2 -0
  21. package/dist/cjs/api/resources/agent/resources/v1/resources/settings/resources/think/resources/models/exports.js +21 -0
  22. package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1FunctionCallRequest.d.ts +2 -0
  23. package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1History.d.ts +24 -0
  24. package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1History.js +3 -0
  25. package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1ReceiveFunctionCallResponse.d.ts +1 -1
  26. package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1SendFunctionCallResponse.d.ts +1 -1
  27. package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1Settings.d.ts +21 -20
  28. package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1SettingsAgentListenProvider.d.ts +5 -5
  29. package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1ThinkUpdated.d.ts +4 -0
  30. package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1ThinkUpdated.js +3 -0
  31. package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1UpdateThink.d.ts +9 -0
  32. package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1UpdateThink.js +3 -0
  33. package/dist/cjs/api/resources/agent/resources/v1/types/index.d.ts +3 -0
  34. package/dist/cjs/api/resources/agent/resources/v1/types/index.js +3 -0
  35. package/dist/cjs/api/resources/auth/exports.d.ts +3 -0
  36. package/dist/cjs/api/resources/auth/exports.js +22 -0
  37. package/dist/cjs/api/resources/auth/resources/v1/exports.d.ts +3 -0
  38. package/dist/cjs/api/resources/auth/resources/v1/exports.js +22 -0
  39. package/dist/cjs/api/resources/auth/resources/v1/resources/tokens/client/Client.js +1 -1
  40. package/dist/cjs/api/resources/auth/resources/v1/resources/tokens/exports.d.ts +2 -0
  41. package/dist/cjs/api/resources/auth/resources/v1/resources/tokens/exports.js +21 -0
  42. package/dist/cjs/api/resources/index.d.ts +1 -0
  43. package/dist/cjs/api/resources/index.js +2 -1
  44. package/dist/cjs/api/resources/listen/exports.d.ts +3 -0
  45. package/dist/cjs/api/resources/listen/exports.js +22 -0
  46. package/dist/cjs/api/resources/listen/resources/v1/client/Client.d.ts +35 -28
  47. package/dist/cjs/api/resources/listen/resources/v1/client/Client.js +43 -33
  48. package/dist/cjs/api/resources/listen/resources/v1/client/Socket.d.ts +3 -3
  49. package/dist/cjs/api/resources/listen/resources/v1/client/Socket.js +2 -2
  50. package/dist/cjs/api/resources/listen/resources/v1/exports.d.ts +4 -0
  51. package/dist/cjs/api/resources/listen/resources/v1/exports.js +24 -0
  52. package/dist/cjs/api/resources/listen/resources/v1/resources/media/client/Client.d.ts +1 -0
  53. package/dist/cjs/api/resources/listen/resources/v1/resources/media/client/Client.js +11 -2
  54. package/dist/cjs/api/resources/listen/resources/v1/resources/media/client/requests/ListenV1RequestUrl.d.ts +1 -0
  55. package/dist/cjs/api/resources/listen/resources/v1/resources/media/client/requests/MediaTranscribeRequestOctetStream.d.ts +0 -3
  56. package/dist/cjs/api/resources/listen/resources/v1/resources/media/exports.d.ts +2 -0
  57. package/dist/cjs/api/resources/listen/resources/v1/resources/media/exports.js +21 -0
  58. package/dist/cjs/api/resources/listen/resources/v1/types/ListenV1Results.d.ts +8 -8
  59. package/dist/cjs/api/resources/listen/resources/v2/client/Client.d.ts +16 -9
  60. package/dist/cjs/api/resources/listen/resources/v2/client/Client.js +32 -14
  61. package/dist/cjs/api/resources/listen/resources/v2/client/Socket.d.ts +6 -5
  62. package/dist/cjs/api/resources/listen/resources/v2/client/Socket.js +6 -2
  63. package/dist/cjs/api/resources/listen/resources/v2/exports.d.ts +3 -0
  64. package/dist/cjs/api/resources/listen/resources/v2/exports.js +23 -0
  65. package/dist/cjs/api/resources/listen/resources/v2/types/ListenV2Configure.d.ts +28 -0
  66. package/dist/cjs/api/resources/listen/resources/v2/types/ListenV2Configure.js +3 -0
  67. package/dist/cjs/api/resources/listen/resources/v2/types/ListenV2ConfigureFailure.d.ts +12 -0
  68. package/dist/cjs/api/resources/listen/resources/v2/types/ListenV2ConfigureFailure.js +3 -0
  69. package/dist/cjs/api/resources/listen/resources/v2/types/ListenV2ConfigureSuccess.d.ts +30 -0
  70. package/dist/cjs/api/resources/listen/resources/v2/types/ListenV2ConfigureSuccess.js +3 -0
  71. package/dist/cjs/api/resources/listen/resources/v2/types/ListenV2TurnInfo.d.ts +11 -0
  72. package/dist/cjs/api/resources/listen/resources/v2/types/index.d.ts +3 -0
  73. package/dist/cjs/api/resources/listen/resources/v2/types/index.js +3 -0
  74. package/dist/cjs/api/resources/manage/exports.d.ts +3 -0
  75. package/dist/cjs/api/resources/manage/exports.js +22 -0
  76. package/dist/cjs/api/resources/manage/resources/v1/exports.d.ts +3 -0
  77. package/dist/cjs/api/resources/manage/resources/v1/exports.js +22 -0
  78. package/dist/cjs/api/resources/manage/resources/v1/resources/models/client/Client.js +6 -2
  79. package/dist/cjs/api/resources/manage/resources/v1/resources/models/exports.d.ts +2 -0
  80. package/dist/cjs/api/resources/manage/resources/v1/resources/models/exports.js +21 -0
  81. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/client/Client.js +9 -5
  82. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/exports.d.ts +3 -0
  83. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/exports.js +22 -0
  84. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/billing/exports.d.ts +3 -0
  85. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/billing/exports.js +22 -0
  86. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/balances/client/Client.js +2 -2
  87. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/balances/exports.d.ts +2 -0
  88. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/balances/exports.js +21 -0
  89. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/breakdown/client/Client.d.ts +2 -1
  90. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/breakdown/client/Client.js +7 -2
  91. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/breakdown/client/requests/BreakdownListRequest.d.ts +2 -1
  92. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/breakdown/exports.d.ts +2 -0
  93. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/breakdown/exports.js +21 -0
  94. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/fields/client/Client.js +5 -1
  95. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/fields/exports.d.ts +2 -0
  96. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/fields/exports.js +21 -0
  97. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/purchases/client/Client.js +5 -1
  98. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/purchases/exports.d.ts +2 -0
  99. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/purchases/exports.js +21 -0
  100. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/keys/client/Client.js +8 -4
  101. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/keys/exports.d.ts +2 -0
  102. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/keys/exports.js +21 -0
  103. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/members/client/Client.js +2 -2
  104. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/members/exports.d.ts +3 -0
  105. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/members/exports.js +22 -0
  106. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/members/resources/invites/client/Client.js +3 -3
  107. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/members/resources/invites/exports.d.ts +2 -0
  108. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/members/resources/invites/exports.js +21 -0
  109. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/members/resources/scopes/client/Client.js +2 -2
  110. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/members/resources/scopes/exports.d.ts +2 -0
  111. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/members/resources/scopes/exports.js +21 -0
  112. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/models/client/Client.js +6 -2
  113. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/models/exports.d.ts +2 -0
  114. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/models/exports.js +21 -0
  115. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/requests/client/Client.js +6 -2
  116. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/requests/exports.d.ts +2 -0
  117. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/requests/exports.js +21 -0
  118. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/usage/client/Client.d.ts +2 -0
  119. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/usage/client/Client.js +7 -1
  120. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/usage/exports.d.ts +3 -0
  121. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/usage/exports.js +22 -0
  122. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/usage/resources/breakdown/client/Client.js +5 -1
  123. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/usage/resources/breakdown/exports.d.ts +2 -0
  124. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/usage/resources/breakdown/exports.js +21 -0
  125. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/usage/resources/fields/client/Client.js +5 -1
  126. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/usage/resources/fields/exports.d.ts +2 -0
  127. package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/usage/resources/fields/exports.js +21 -0
  128. package/dist/cjs/api/resources/read/exports.d.ts +3 -0
  129. package/dist/cjs/api/resources/read/exports.js +22 -0
  130. package/dist/cjs/api/resources/read/resources/v1/exports.d.ts +3 -0
  131. package/dist/cjs/api/resources/read/resources/v1/exports.js +22 -0
  132. package/dist/cjs/api/resources/read/resources/v1/resources/text/client/Client.js +5 -1
  133. package/dist/cjs/api/resources/read/resources/v1/resources/text/exports.d.ts +2 -0
  134. package/dist/cjs/api/resources/read/resources/v1/resources/text/exports.js +21 -0
  135. package/dist/cjs/api/resources/selfHosted/exports.d.ts +3 -0
  136. package/dist/cjs/api/resources/selfHosted/exports.js +22 -0
  137. package/dist/cjs/api/resources/selfHosted/resources/v1/exports.d.ts +3 -0
  138. package/dist/cjs/api/resources/selfHosted/resources/v1/exports.js +22 -0
  139. package/dist/cjs/api/resources/selfHosted/resources/v1/resources/distributionCredentials/client/Client.d.ts +1 -0
  140. package/dist/cjs/api/resources/selfHosted/resources/v1/resources/distributionCredentials/client/Client.js +9 -4
  141. package/dist/cjs/api/resources/selfHosted/resources/v1/resources/distributionCredentials/client/requests/CreateProjectDistributionCredentialsV1Request.d.ts +1 -0
  142. package/dist/cjs/api/resources/selfHosted/resources/v1/resources/distributionCredentials/exports.d.ts +2 -0
  143. package/dist/cjs/api/resources/selfHosted/resources/v1/resources/distributionCredentials/exports.js +21 -0
  144. package/dist/cjs/api/resources/speak/exports.d.ts +3 -0
  145. package/dist/cjs/api/resources/speak/exports.js +22 -0
  146. package/dist/cjs/api/resources/speak/resources/v1/client/Client.d.ts +12 -4
  147. package/dist/cjs/api/resources/speak/resources/v1/client/Client.js +17 -10
  148. package/dist/cjs/api/resources/speak/resources/v1/client/Socket.d.ts +2 -2
  149. package/dist/cjs/api/resources/speak/resources/v1/client/Socket.js +2 -2
  150. package/dist/cjs/api/resources/speak/resources/v1/exports.d.ts +4 -0
  151. package/dist/cjs/api/resources/speak/resources/v1/exports.js +24 -0
  152. package/dist/cjs/api/resources/speak/resources/v1/resources/audio/client/Client.d.ts +1 -0
  153. package/dist/cjs/api/resources/speak/resources/v1/resources/audio/client/Client.js +8 -2
  154. package/dist/cjs/api/resources/speak/resources/v1/resources/audio/client/requests/SpeakV1Request.d.ts +2 -0
  155. package/dist/cjs/api/resources/speak/resources/v1/resources/audio/exports.d.ts +2 -0
  156. package/dist/cjs/api/resources/speak/resources/v1/resources/audio/exports.js +21 -0
  157. package/dist/cjs/api/resources/voiceAgent/client/Client.d.ts +15 -0
  158. package/dist/cjs/api/resources/voiceAgent/client/Client.js +21 -0
  159. package/dist/cjs/api/resources/voiceAgent/exports.d.ts +3 -0
  160. package/dist/cjs/api/resources/voiceAgent/exports.js +22 -0
  161. package/dist/cjs/api/resources/voiceAgent/index.d.ts +2 -0
  162. package/dist/cjs/api/resources/voiceAgent/index.js +18 -0
  163. package/dist/cjs/api/resources/voiceAgent/resources/configurations/client/Client.d.ts +89 -0
  164. package/dist/cjs/api/resources/voiceAgent/resources/configurations/client/Client.js +325 -0
  165. package/dist/cjs/api/resources/voiceAgent/resources/configurations/client/index.d.ts +1 -0
  166. package/dist/cjs/api/resources/voiceAgent/resources/configurations/client/index.js +17 -0
  167. package/dist/cjs/api/resources/voiceAgent/resources/configurations/client/requests/CreateAgentConfigurationV1Request.d.ts +14 -0
  168. package/dist/cjs/api/resources/voiceAgent/resources/configurations/client/requests/CreateAgentConfigurationV1Request.js +3 -0
  169. package/dist/cjs/api/resources/voiceAgent/resources/configurations/client/requests/UpdateAgentMetadataV1Request.d.ts +12 -0
  170. package/dist/cjs/api/resources/voiceAgent/resources/configurations/client/requests/UpdateAgentMetadataV1Request.js +3 -0
  171. package/dist/cjs/api/resources/voiceAgent/resources/configurations/client/requests/index.d.ts +2 -0
  172. package/dist/cjs/api/resources/voiceAgent/resources/configurations/client/requests/index.js +2 -0
  173. package/dist/cjs/api/resources/voiceAgent/resources/configurations/exports.d.ts +2 -0
  174. package/dist/cjs/api/resources/voiceAgent/resources/configurations/exports.js +21 -0
  175. package/dist/cjs/api/resources/voiceAgent/resources/configurations/index.d.ts +1 -0
  176. package/dist/cjs/api/resources/voiceAgent/resources/configurations/index.js +17 -0
  177. package/dist/cjs/api/resources/voiceAgent/resources/index.d.ts +4 -0
  178. package/dist/cjs/api/resources/voiceAgent/resources/index.js +43 -0
  179. package/dist/cjs/api/resources/voiceAgent/resources/variables/client/Client.d.ts +92 -0
  180. package/dist/cjs/api/resources/voiceAgent/resources/variables/client/Client.js +325 -0
  181. package/dist/cjs/api/resources/voiceAgent/resources/variables/client/index.d.ts +1 -0
  182. package/dist/cjs/api/resources/voiceAgent/resources/variables/client/index.js +17 -0
  183. package/dist/cjs/api/resources/voiceAgent/resources/variables/client/requests/CreateAgentVariableV1Request.d.ts +16 -0
  184. package/dist/cjs/api/resources/voiceAgent/resources/variables/client/requests/CreateAgentVariableV1Request.js +3 -0
  185. package/dist/cjs/api/resources/voiceAgent/resources/variables/client/requests/UpdateAgentVariableV1Request.d.ts +11 -0
  186. package/dist/cjs/api/resources/voiceAgent/resources/variables/client/requests/UpdateAgentVariableV1Request.js +3 -0
  187. package/dist/cjs/api/resources/voiceAgent/resources/variables/client/requests/index.d.ts +2 -0
  188. package/dist/cjs/api/resources/voiceAgent/resources/variables/client/requests/index.js +2 -0
  189. package/dist/cjs/api/resources/voiceAgent/resources/variables/exports.d.ts +2 -0
  190. package/dist/cjs/api/resources/voiceAgent/resources/variables/exports.js +21 -0
  191. package/dist/cjs/api/resources/voiceAgent/resources/variables/index.d.ts +1 -0
  192. package/dist/cjs/api/resources/voiceAgent/resources/variables/index.js +17 -0
  193. package/dist/cjs/api/types/AgentConfigurationV1.d.ts +15 -0
  194. package/dist/cjs/api/types/AgentConfigurationV1.js +3 -0
  195. package/dist/cjs/api/types/AgentVariableV1.d.ts +14 -0
  196. package/dist/cjs/api/types/AgentVariableV1.js +3 -0
  197. package/dist/cjs/api/types/Anthropic.d.ts +2 -2
  198. package/dist/cjs/api/types/AwsBedrockThinkProvider.d.ts +7 -7
  199. package/dist/cjs/api/types/AwsPollySpeakProvider.d.ts +2 -2
  200. package/dist/cjs/api/types/BillingBreakdownV1Response.d.ts +6 -6
  201. package/dist/cjs/api/types/Cartesia.d.ts +4 -2
  202. package/dist/cjs/api/types/CreateAgentConfigurationV1Response.d.ts +8 -0
  203. package/dist/cjs/api/types/CreateAgentConfigurationV1Response.js +3 -0
  204. package/dist/cjs/api/types/CreateKeyV1Response.d.ts +6 -6
  205. package/dist/cjs/api/types/CreateProjectDistributionCredentialsV1Response.d.ts +1 -1
  206. package/dist/cjs/api/types/CreateProjectInviteV1Response.d.ts +1 -1
  207. package/dist/cjs/api/types/Deepgram.d.ts +3 -1
  208. package/dist/cjs/api/types/DeleteAgentConfigurationV1Response.d.ts +4 -0
  209. package/dist/cjs/api/types/DeleteAgentConfigurationV1Response.js +3 -0
  210. package/dist/cjs/api/types/DeleteAgentVariableV1Response.d.ts +4 -0
  211. package/dist/cjs/api/types/DeleteAgentVariableV1Response.js +3 -0
  212. package/dist/cjs/api/types/DeleteProjectInviteV1Response.d.ts +1 -1
  213. package/dist/cjs/api/types/DeleteProjectKeyV1Response.d.ts +1 -1
  214. package/dist/cjs/api/types/DeleteProjectMemberV1Response.d.ts +1 -1
  215. package/dist/cjs/api/types/DeleteProjectV1Response.d.ts +1 -1
  216. package/dist/cjs/api/types/ElevenLabsSpeakProvider.d.ts +3 -3
  217. package/dist/cjs/api/types/ErrorResponseLegacyError.d.ts +3 -3
  218. package/dist/cjs/api/types/ErrorResponseModernError.d.ts +4 -4
  219. package/dist/cjs/api/types/GetProjectBalanceV1Response.d.ts +4 -4
  220. package/dist/cjs/api/types/GetProjectDistributionCredentialsV1Response.d.ts +1 -1
  221. package/dist/cjs/api/types/GetProjectKeyV1Response.d.ts +13 -13
  222. package/dist/cjs/api/types/GetProjectRequestV1Response.d.ts +1 -1
  223. package/dist/cjs/api/types/GetProjectV1Response.d.ts +3 -3
  224. package/dist/cjs/api/types/Google.d.ts +2 -2
  225. package/dist/cjs/api/types/GrantV1Response.d.ts +1 -1
  226. package/dist/cjs/api/types/Groq.d.ts +2 -2
  227. package/dist/cjs/api/types/LeaveProjectV1Response.d.ts +1 -1
  228. package/dist/cjs/api/types/ListAgentConfigurationsV1Response.d.ts +5 -0
  229. package/dist/cjs/api/types/ListAgentConfigurationsV1Response.js +3 -0
  230. package/dist/cjs/api/types/ListAgentVariablesV1Response.d.ts +5 -0
  231. package/dist/cjs/api/types/ListAgentVariablesV1Response.js +3 -0
  232. package/dist/cjs/api/types/ListBillingFieldsV1Response.d.ts +4 -4
  233. package/dist/cjs/api/types/ListModelsV1Response.d.ts +2 -2
  234. package/dist/cjs/api/types/ListModelsV1ResponseSttModels.d.ts +9 -9
  235. package/dist/cjs/api/types/ListModelsV1ResponseTtsModels.d.ts +14 -14
  236. package/dist/cjs/api/types/ListProjectBalancesV1Response.d.ts +5 -5
  237. package/dist/cjs/api/types/ListProjectDistributionCredentialsV1Response.d.ts +2 -2
  238. package/dist/cjs/api/types/ListProjectInvitesV1Response.d.ts +3 -3
  239. package/dist/cjs/api/types/ListProjectKeysV1Response.d.ts +9 -9
  240. package/dist/cjs/api/types/ListProjectMemberScopesV1Response.d.ts +1 -1
  241. package/dist/cjs/api/types/ListProjectMembersV1Response.d.ts +3 -3
  242. package/dist/cjs/api/types/ListProjectPurchasesV1Response.d.ts +7 -7
  243. package/dist/cjs/api/types/ListProjectRequestsV1Response.d.ts +3 -3
  244. package/dist/cjs/api/types/ListProjectsV1Response.d.ts +3 -3
  245. package/dist/cjs/api/types/ListenV1Callback.d.ts +3 -0
  246. package/dist/cjs/api/types/ListenV1Channels.d.ts +3 -0
  247. package/dist/cjs/api/types/ListenV1Endpointing.d.ts +3 -0
  248. package/dist/cjs/api/types/ListenV1Extra.d.ts +3 -0
  249. package/dist/cjs/api/types/ListenV1Keyterm.d.ts +3 -0
  250. package/dist/cjs/api/types/ListenV1Keywords.d.ts +3 -0
  251. package/dist/cjs/api/types/ListenV1Language.d.ts +3 -0
  252. package/dist/cjs/api/types/ListenV1MipOptOut.d.ts +3 -0
  253. package/dist/cjs/api/types/ListenV1Replace.d.ts +3 -0
  254. package/dist/cjs/api/types/ListenV1ResponseMetadata.d.ts +18 -18
  255. package/dist/cjs/api/types/ListenV1ResponseResults.d.ts +5 -5
  256. package/dist/cjs/api/types/ListenV1ResponseResultsChannelsItem.d.ts +43 -43
  257. package/dist/cjs/api/types/ListenV1ResponseResultsSummary.d.ts +2 -2
  258. package/dist/cjs/api/types/ListenV1ResponseResultsUtterancesItem.d.ts +15 -15
  259. package/dist/cjs/api/types/ListenV1SampleRate.d.ts +3 -0
  260. package/dist/cjs/api/types/ListenV1Search.d.ts +3 -0
  261. package/dist/cjs/api/types/ListenV1Tag.d.ts +3 -0
  262. package/dist/cjs/api/types/ListenV1UtteranceEndMs.d.ts +3 -0
  263. package/dist/cjs/api/types/ListenV1Version.d.ts +3 -0
  264. package/dist/cjs/api/types/ListenV2EagerEotThreshold.d.ts +5 -0
  265. package/dist/cjs/api/types/ListenV2EotThreshold.d.ts +4 -0
  266. package/dist/cjs/api/types/ListenV2EotTimeoutMs.d.ts +4 -0
  267. package/dist/cjs/api/types/ListenV2MipOptOut.d.ts +5 -0
  268. package/dist/cjs/api/types/ListenV2Model.d.ts +6 -4
  269. package/dist/cjs/api/types/ListenV2Model.js +6 -0
  270. package/dist/cjs/api/types/ListenV2SampleRate.d.ts +3 -0
  271. package/dist/cjs/api/types/ListenV2Tag.d.ts +4 -0
  272. package/dist/cjs/api/types/OpenAiSpeakProvider.d.ts +1 -1
  273. package/dist/cjs/api/types/OpenAiThinkProvider.d.ts +2 -2
  274. package/dist/cjs/api/types/ProjectRequestResponse.d.ts +9 -9
  275. package/dist/cjs/api/types/ReadV1ResponseMetadata.d.ts +20 -20
  276. package/dist/cjs/api/types/ReadV1ResponseResults.d.ts +4 -4
  277. package/dist/cjs/api/types/ReadV1ResponseResultsSummary.d.ts +3 -3
  278. package/dist/cjs/api/types/SharedIntents.d.ts +9 -9
  279. package/dist/cjs/api/types/SharedSentiments.d.ts +9 -9
  280. package/dist/cjs/api/types/SharedTopics.d.ts +9 -9
  281. package/dist/cjs/api/types/SpeakSettingsV1.d.ts +3 -3
  282. package/dist/cjs/api/types/SpeakV1MipOptOut.d.ts +3 -0
  283. package/dist/cjs/api/types/SpeakV1Speed.d.ts +4 -0
  284. package/dist/cjs/api/types/SpeakV1Speed.js +3 -0
  285. package/dist/cjs/api/types/ThinkSettingsV1.d.ts +13 -13
  286. package/dist/cjs/api/types/UpdateProjectMemberScopesV1Response.d.ts +1 -1
  287. package/dist/cjs/api/types/UpdateProjectV1Response.d.ts +1 -1
  288. package/dist/cjs/api/types/UsageBreakdownV1Response.d.ts +10 -11
  289. package/dist/cjs/api/types/UsageFieldsV1Response.d.ts +8 -8
  290. package/dist/cjs/api/types/UsageV1Response.d.ts +5 -5
  291. package/dist/cjs/api/types/index.d.ts +8 -0
  292. package/dist/cjs/api/types/index.js +8 -0
  293. package/dist/cjs/core/auth/BasicAuth.d.ts +2 -2
  294. package/dist/cjs/core/auth/BasicAuth.js +7 -1
  295. package/dist/cjs/core/fetcher/BinaryResponse.d.ts +1 -1
  296. package/dist/cjs/core/fetcher/Fetcher.d.ts +8 -0
  297. package/dist/cjs/core/fetcher/Fetcher.js +21 -10
  298. package/dist/cjs/core/fetcher/index.d.ts +2 -0
  299. package/dist/cjs/core/fetcher/index.js +3 -1
  300. package/dist/cjs/core/fetcher/makePassthroughRequest.d.ts +49 -0
  301. package/dist/cjs/core/fetcher/makePassthroughRequest.js +135 -0
  302. package/dist/cjs/core/fetcher/makeRequest.d.ts +6 -1
  303. package/dist/cjs/core/fetcher/makeRequest.js +30 -9
  304. package/dist/cjs/core/file/file.js +3 -2
  305. package/dist/cjs/core/runtime/runtime.js +8 -7
  306. package/dist/cjs/core/url/QueryStringBuilder.d.ts +47 -0
  307. package/dist/cjs/core/url/QueryStringBuilder.js +83 -0
  308. package/dist/cjs/core/url/index.d.ts +1 -0
  309. package/dist/cjs/core/url/index.js +3 -1
  310. package/dist/cjs/core/url/qs.d.ts +2 -1
  311. package/dist/cjs/core/url/qs.js +24 -12
  312. package/dist/cjs/core/websocket/ws.d.ts +14 -2
  313. package/dist/cjs/core/websocket/ws.js +51 -7
  314. package/dist/cjs/environments.d.ts +3 -3
  315. package/dist/cjs/environments.js +2 -2
  316. package/dist/cjs/errors/DeepgramError.d.ts +3 -1
  317. package/dist/cjs/errors/DeepgramError.js +4 -1
  318. package/dist/cjs/errors/DeepgramTimeoutError.d.ts +4 -1
  319. package/dist/cjs/errors/DeepgramTimeoutError.js +4 -1
  320. package/dist/cjs/errors/handleNonStatusCodeError.js +4 -1
  321. package/dist/cjs/version.d.ts +1 -1
  322. package/dist/cjs/version.js +1 -1
  323. package/dist/esm/BaseClient.mjs +3 -3
  324. package/dist/esm/Client.d.mts +15 -0
  325. package/dist/esm/Client.mjs +46 -0
  326. package/dist/esm/CustomClient.mjs +83 -107
  327. package/dist/esm/api/resources/agent/exports.d.mts +3 -0
  328. package/dist/esm/api/resources/agent/exports.mjs +4 -0
  329. package/dist/esm/api/resources/agent/resources/v1/client/Client.d.mts +6 -0
  330. package/dist/esm/api/resources/agent/resources/v1/client/Client.mjs +11 -6
  331. package/dist/esm/api/resources/agent/resources/v1/client/Socket.d.mts +6 -5
  332. package/dist/esm/api/resources/agent/resources/v1/client/Socket.mjs +6 -2
  333. package/dist/esm/api/resources/agent/resources/v1/exports.d.mts +4 -0
  334. package/dist/esm/api/resources/agent/resources/v1/exports.mjs +5 -0
  335. package/dist/esm/api/resources/agent/resources/v1/resources/settings/exports.d.mts +3 -0
  336. package/dist/esm/api/resources/agent/resources/v1/resources/settings/exports.mjs +4 -0
  337. package/dist/esm/api/resources/agent/resources/v1/resources/settings/resources/think/exports.d.mts +3 -0
  338. package/dist/esm/api/resources/agent/resources/v1/resources/settings/resources/think/exports.mjs +4 -0
  339. package/dist/esm/api/resources/agent/resources/v1/resources/settings/resources/think/resources/models/client/Client.mjs +1 -1
  340. package/dist/esm/api/resources/agent/resources/v1/resources/settings/resources/think/resources/models/exports.d.mts +2 -0
  341. package/dist/esm/api/resources/agent/resources/v1/resources/settings/resources/think/resources/models/exports.mjs +3 -0
  342. package/dist/esm/api/resources/agent/resources/v1/types/AgentV1FunctionCallRequest.d.mts +2 -0
  343. package/dist/esm/api/resources/agent/resources/v1/types/AgentV1History.d.mts +24 -0
  344. package/dist/esm/api/resources/agent/resources/v1/types/AgentV1History.mjs +2 -0
  345. package/dist/esm/api/resources/agent/resources/v1/types/AgentV1ReceiveFunctionCallResponse.d.mts +1 -1
  346. package/dist/esm/api/resources/agent/resources/v1/types/AgentV1SendFunctionCallResponse.d.mts +1 -1
  347. package/dist/esm/api/resources/agent/resources/v1/types/AgentV1Settings.d.mts +21 -20
  348. package/dist/esm/api/resources/agent/resources/v1/types/AgentV1SettingsAgentListenProvider.d.mts +5 -5
  349. package/dist/esm/api/resources/agent/resources/v1/types/AgentV1ThinkUpdated.d.mts +4 -0
  350. package/dist/esm/api/resources/agent/resources/v1/types/AgentV1ThinkUpdated.mjs +2 -0
  351. package/dist/esm/api/resources/agent/resources/v1/types/AgentV1UpdateThink.d.mts +9 -0
  352. package/dist/esm/api/resources/agent/resources/v1/types/AgentV1UpdateThink.mjs +2 -0
  353. package/dist/esm/api/resources/agent/resources/v1/types/index.d.mts +3 -0
  354. package/dist/esm/api/resources/agent/resources/v1/types/index.mjs +3 -0
  355. package/dist/esm/api/resources/auth/exports.d.mts +3 -0
  356. package/dist/esm/api/resources/auth/exports.mjs +4 -0
  357. package/dist/esm/api/resources/auth/resources/v1/exports.d.mts +3 -0
  358. package/dist/esm/api/resources/auth/resources/v1/exports.mjs +4 -0
  359. package/dist/esm/api/resources/auth/resources/v1/resources/tokens/client/Client.mjs +1 -1
  360. package/dist/esm/api/resources/auth/resources/v1/resources/tokens/exports.d.mts +2 -0
  361. package/dist/esm/api/resources/auth/resources/v1/resources/tokens/exports.mjs +3 -0
  362. package/dist/esm/api/resources/index.d.mts +1 -0
  363. package/dist/esm/api/resources/index.mjs +1 -0
  364. package/dist/esm/api/resources/listen/exports.d.mts +3 -0
  365. package/dist/esm/api/resources/listen/exports.mjs +4 -0
  366. package/dist/esm/api/resources/listen/resources/v1/client/Client.d.mts +35 -28
  367. package/dist/esm/api/resources/listen/resources/v1/client/Client.mjs +43 -33
  368. package/dist/esm/api/resources/listen/resources/v1/client/Socket.d.mts +3 -3
  369. package/dist/esm/api/resources/listen/resources/v1/client/Socket.mjs +2 -2
  370. package/dist/esm/api/resources/listen/resources/v1/exports.d.mts +4 -0
  371. package/dist/esm/api/resources/listen/resources/v1/exports.mjs +5 -0
  372. package/dist/esm/api/resources/listen/resources/v1/resources/media/client/Client.d.mts +1 -0
  373. package/dist/esm/api/resources/listen/resources/v1/resources/media/client/Client.mjs +11 -2
  374. package/dist/esm/api/resources/listen/resources/v1/resources/media/client/requests/ListenV1RequestUrl.d.mts +1 -0
  375. package/dist/esm/api/resources/listen/resources/v1/resources/media/client/requests/MediaTranscribeRequestOctetStream.d.mts +0 -3
  376. package/dist/esm/api/resources/listen/resources/v1/resources/media/exports.d.mts +2 -0
  377. package/dist/esm/api/resources/listen/resources/v1/resources/media/exports.mjs +3 -0
  378. package/dist/esm/api/resources/listen/resources/v1/types/ListenV1Results.d.mts +8 -8
  379. package/dist/esm/api/resources/listen/resources/v2/client/Client.d.mts +16 -9
  380. package/dist/esm/api/resources/listen/resources/v2/client/Client.mjs +32 -14
  381. package/dist/esm/api/resources/listen/resources/v2/client/Socket.d.mts +6 -5
  382. package/dist/esm/api/resources/listen/resources/v2/client/Socket.mjs +6 -2
  383. package/dist/esm/api/resources/listen/resources/v2/exports.d.mts +3 -0
  384. package/dist/esm/api/resources/listen/resources/v2/exports.mjs +4 -0
  385. package/dist/esm/api/resources/listen/resources/v2/types/ListenV2Configure.d.mts +28 -0
  386. package/dist/esm/api/resources/listen/resources/v2/types/ListenV2Configure.mjs +2 -0
  387. package/dist/esm/api/resources/listen/resources/v2/types/ListenV2ConfigureFailure.d.mts +12 -0
  388. package/dist/esm/api/resources/listen/resources/v2/types/ListenV2ConfigureFailure.mjs +2 -0
  389. package/dist/esm/api/resources/listen/resources/v2/types/ListenV2ConfigureSuccess.d.mts +30 -0
  390. package/dist/esm/api/resources/listen/resources/v2/types/ListenV2ConfigureSuccess.mjs +2 -0
  391. package/dist/esm/api/resources/listen/resources/v2/types/ListenV2TurnInfo.d.mts +11 -0
  392. package/dist/esm/api/resources/listen/resources/v2/types/index.d.mts +3 -0
  393. package/dist/esm/api/resources/listen/resources/v2/types/index.mjs +3 -0
  394. package/dist/esm/api/resources/manage/exports.d.mts +3 -0
  395. package/dist/esm/api/resources/manage/exports.mjs +4 -0
  396. package/dist/esm/api/resources/manage/resources/v1/exports.d.mts +3 -0
  397. package/dist/esm/api/resources/manage/resources/v1/exports.mjs +4 -0
  398. package/dist/esm/api/resources/manage/resources/v1/resources/models/client/Client.mjs +6 -2
  399. package/dist/esm/api/resources/manage/resources/v1/resources/models/exports.d.mts +2 -0
  400. package/dist/esm/api/resources/manage/resources/v1/resources/models/exports.mjs +3 -0
  401. package/dist/esm/api/resources/manage/resources/v1/resources/projects/client/Client.mjs +9 -5
  402. package/dist/esm/api/resources/manage/resources/v1/resources/projects/exports.d.mts +3 -0
  403. package/dist/esm/api/resources/manage/resources/v1/resources/projects/exports.mjs +4 -0
  404. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/billing/exports.d.mts +3 -0
  405. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/billing/exports.mjs +4 -0
  406. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/balances/client/Client.mjs +2 -2
  407. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/balances/exports.d.mts +2 -0
  408. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/balances/exports.mjs +3 -0
  409. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/breakdown/client/Client.d.mts +2 -1
  410. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/breakdown/client/Client.mjs +7 -2
  411. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/breakdown/client/requests/BreakdownListRequest.d.mts +2 -1
  412. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/breakdown/exports.d.mts +2 -0
  413. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/breakdown/exports.mjs +3 -0
  414. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/fields/client/Client.mjs +5 -1
  415. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/fields/exports.d.mts +2 -0
  416. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/fields/exports.mjs +3 -0
  417. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/purchases/client/Client.mjs +5 -1
  418. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/purchases/exports.d.mts +2 -0
  419. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/purchases/exports.mjs +3 -0
  420. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/keys/client/Client.mjs +8 -4
  421. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/keys/exports.d.mts +2 -0
  422. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/keys/exports.mjs +3 -0
  423. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/members/client/Client.mjs +2 -2
  424. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/members/exports.d.mts +3 -0
  425. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/members/exports.mjs +4 -0
  426. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/members/resources/invites/client/Client.mjs +3 -3
  427. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/members/resources/invites/exports.d.mts +2 -0
  428. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/members/resources/invites/exports.mjs +3 -0
  429. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/members/resources/scopes/client/Client.mjs +2 -2
  430. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/members/resources/scopes/exports.d.mts +2 -0
  431. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/members/resources/scopes/exports.mjs +3 -0
  432. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/models/client/Client.mjs +6 -2
  433. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/models/exports.d.mts +2 -0
  434. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/models/exports.mjs +3 -0
  435. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/requests/client/Client.mjs +6 -2
  436. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/requests/exports.d.mts +2 -0
  437. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/requests/exports.mjs +3 -0
  438. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/usage/client/Client.d.mts +2 -0
  439. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/usage/client/Client.mjs +7 -1
  440. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/usage/exports.d.mts +3 -0
  441. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/usage/exports.mjs +4 -0
  442. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/usage/resources/breakdown/client/Client.mjs +5 -1
  443. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/usage/resources/breakdown/exports.d.mts +2 -0
  444. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/usage/resources/breakdown/exports.mjs +3 -0
  445. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/usage/resources/fields/client/Client.mjs +5 -1
  446. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/usage/resources/fields/exports.d.mts +2 -0
  447. package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/usage/resources/fields/exports.mjs +3 -0
  448. package/dist/esm/api/resources/read/exports.d.mts +3 -0
  449. package/dist/esm/api/resources/read/exports.mjs +4 -0
  450. package/dist/esm/api/resources/read/resources/v1/exports.d.mts +3 -0
  451. package/dist/esm/api/resources/read/resources/v1/exports.mjs +4 -0
  452. package/dist/esm/api/resources/read/resources/v1/resources/text/client/Client.mjs +5 -1
  453. package/dist/esm/api/resources/read/resources/v1/resources/text/exports.d.mts +2 -0
  454. package/dist/esm/api/resources/read/resources/v1/resources/text/exports.mjs +3 -0
  455. package/dist/esm/api/resources/selfHosted/exports.d.mts +3 -0
  456. package/dist/esm/api/resources/selfHosted/exports.mjs +4 -0
  457. package/dist/esm/api/resources/selfHosted/resources/v1/exports.d.mts +3 -0
  458. package/dist/esm/api/resources/selfHosted/resources/v1/exports.mjs +4 -0
  459. package/dist/esm/api/resources/selfHosted/resources/v1/resources/distributionCredentials/client/Client.d.mts +1 -0
  460. package/dist/esm/api/resources/selfHosted/resources/v1/resources/distributionCredentials/client/Client.mjs +9 -4
  461. package/dist/esm/api/resources/selfHosted/resources/v1/resources/distributionCredentials/client/requests/CreateProjectDistributionCredentialsV1Request.d.mts +1 -0
  462. package/dist/esm/api/resources/selfHosted/resources/v1/resources/distributionCredentials/exports.d.mts +2 -0
  463. package/dist/esm/api/resources/selfHosted/resources/v1/resources/distributionCredentials/exports.mjs +3 -0
  464. package/dist/esm/api/resources/speak/exports.d.mts +3 -0
  465. package/dist/esm/api/resources/speak/exports.mjs +4 -0
  466. package/dist/esm/api/resources/speak/resources/v1/client/Client.d.mts +12 -4
  467. package/dist/esm/api/resources/speak/resources/v1/client/Client.mjs +17 -10
  468. package/dist/esm/api/resources/speak/resources/v1/client/Socket.d.mts +2 -2
  469. package/dist/esm/api/resources/speak/resources/v1/client/Socket.mjs +2 -2
  470. package/dist/esm/api/resources/speak/resources/v1/exports.d.mts +4 -0
  471. package/dist/esm/api/resources/speak/resources/v1/exports.mjs +5 -0
  472. package/dist/esm/api/resources/speak/resources/v1/resources/audio/client/Client.d.mts +1 -0
  473. package/dist/esm/api/resources/speak/resources/v1/resources/audio/client/Client.mjs +8 -2
  474. package/dist/esm/api/resources/speak/resources/v1/resources/audio/client/requests/SpeakV1Request.d.mts +2 -0
  475. package/dist/esm/api/resources/speak/resources/v1/resources/audio/exports.d.mts +2 -0
  476. package/dist/esm/api/resources/speak/resources/v1/resources/audio/exports.mjs +3 -0
  477. package/dist/esm/api/resources/voiceAgent/client/Client.d.mts +15 -0
  478. package/dist/esm/api/resources/voiceAgent/client/Client.mjs +17 -0
  479. package/dist/esm/api/resources/voiceAgent/client/index.d.mts +1 -0
  480. package/dist/esm/api/resources/voiceAgent/client/index.mjs +1 -0
  481. package/dist/esm/api/resources/voiceAgent/exports.d.mts +3 -0
  482. package/dist/esm/api/resources/voiceAgent/exports.mjs +4 -0
  483. package/dist/esm/api/resources/voiceAgent/index.d.mts +2 -0
  484. package/dist/esm/api/resources/voiceAgent/index.mjs +2 -0
  485. package/dist/esm/api/resources/voiceAgent/resources/configurations/client/Client.d.mts +89 -0
  486. package/dist/esm/api/resources/voiceAgent/resources/configurations/client/Client.mjs +288 -0
  487. package/dist/esm/api/resources/voiceAgent/resources/configurations/client/index.d.mts +1 -0
  488. package/dist/esm/api/resources/voiceAgent/resources/configurations/client/index.mjs +1 -0
  489. package/dist/esm/api/resources/voiceAgent/resources/configurations/client/requests/CreateAgentConfigurationV1Request.d.mts +14 -0
  490. package/dist/esm/api/resources/voiceAgent/resources/configurations/client/requests/CreateAgentConfigurationV1Request.mjs +2 -0
  491. package/dist/esm/api/resources/voiceAgent/resources/configurations/client/requests/UpdateAgentMetadataV1Request.d.mts +12 -0
  492. package/dist/esm/api/resources/voiceAgent/resources/configurations/client/requests/UpdateAgentMetadataV1Request.mjs +2 -0
  493. package/dist/esm/api/resources/voiceAgent/resources/configurations/client/requests/index.d.mts +2 -0
  494. package/dist/esm/api/resources/voiceAgent/resources/configurations/client/requests/index.mjs +1 -0
  495. package/dist/esm/api/resources/voiceAgent/resources/configurations/exports.d.mts +2 -0
  496. package/dist/esm/api/resources/voiceAgent/resources/configurations/exports.mjs +3 -0
  497. package/dist/esm/api/resources/voiceAgent/resources/configurations/index.d.mts +1 -0
  498. package/dist/esm/api/resources/voiceAgent/resources/configurations/index.mjs +1 -0
  499. package/dist/esm/api/resources/voiceAgent/resources/index.d.mts +4 -0
  500. package/dist/esm/api/resources/voiceAgent/resources/index.mjs +4 -0
  501. package/dist/esm/api/resources/voiceAgent/resources/variables/client/Client.d.mts +92 -0
  502. package/dist/esm/api/resources/voiceAgent/resources/variables/client/Client.mjs +288 -0
  503. package/dist/esm/api/resources/voiceAgent/resources/variables/client/index.d.mts +1 -0
  504. package/dist/esm/api/resources/voiceAgent/resources/variables/client/index.mjs +1 -0
  505. package/dist/esm/api/resources/voiceAgent/resources/variables/client/requests/CreateAgentVariableV1Request.d.mts +16 -0
  506. package/dist/esm/api/resources/voiceAgent/resources/variables/client/requests/CreateAgentVariableV1Request.mjs +2 -0
  507. package/dist/esm/api/resources/voiceAgent/resources/variables/client/requests/UpdateAgentVariableV1Request.d.mts +11 -0
  508. package/dist/esm/api/resources/voiceAgent/resources/variables/client/requests/UpdateAgentVariableV1Request.mjs +2 -0
  509. package/dist/esm/api/resources/voiceAgent/resources/variables/client/requests/index.d.mts +2 -0
  510. package/dist/esm/api/resources/voiceAgent/resources/variables/client/requests/index.mjs +1 -0
  511. package/dist/esm/api/resources/voiceAgent/resources/variables/exports.d.mts +2 -0
  512. package/dist/esm/api/resources/voiceAgent/resources/variables/exports.mjs +3 -0
  513. package/dist/esm/api/resources/voiceAgent/resources/variables/index.d.mts +1 -0
  514. package/dist/esm/api/resources/voiceAgent/resources/variables/index.mjs +1 -0
  515. package/dist/esm/api/types/AgentConfigurationV1.d.mts +15 -0
  516. package/dist/esm/api/types/AgentConfigurationV1.mjs +2 -0
  517. package/dist/esm/api/types/AgentVariableV1.d.mts +14 -0
  518. package/dist/esm/api/types/AgentVariableV1.mjs +2 -0
  519. package/dist/esm/api/types/Anthropic.d.mts +2 -2
  520. package/dist/esm/api/types/AwsBedrockThinkProvider.d.mts +7 -7
  521. package/dist/esm/api/types/AwsPollySpeakProvider.d.mts +2 -2
  522. package/dist/esm/api/types/BillingBreakdownV1Response.d.mts +6 -6
  523. package/dist/esm/api/types/Cartesia.d.mts +4 -2
  524. package/dist/esm/api/types/CreateAgentConfigurationV1Response.d.mts +8 -0
  525. package/dist/esm/api/types/CreateAgentConfigurationV1Response.mjs +2 -0
  526. package/dist/esm/api/types/CreateKeyV1Response.d.mts +6 -6
  527. package/dist/esm/api/types/CreateProjectDistributionCredentialsV1Response.d.mts +1 -1
  528. package/dist/esm/api/types/CreateProjectInviteV1Response.d.mts +1 -1
  529. package/dist/esm/api/types/Deepgram.d.mts +3 -1
  530. package/dist/esm/api/types/DeleteAgentConfigurationV1Response.d.mts +4 -0
  531. package/dist/esm/api/types/DeleteAgentConfigurationV1Response.mjs +2 -0
  532. package/dist/esm/api/types/DeleteAgentVariableV1Response.d.mts +4 -0
  533. package/dist/esm/api/types/DeleteAgentVariableV1Response.mjs +2 -0
  534. package/dist/esm/api/types/DeleteProjectInviteV1Response.d.mts +1 -1
  535. package/dist/esm/api/types/DeleteProjectKeyV1Response.d.mts +1 -1
  536. package/dist/esm/api/types/DeleteProjectMemberV1Response.d.mts +1 -1
  537. package/dist/esm/api/types/DeleteProjectV1Response.d.mts +1 -1
  538. package/dist/esm/api/types/ElevenLabsSpeakProvider.d.mts +3 -3
  539. package/dist/esm/api/types/ErrorResponseLegacyError.d.mts +3 -3
  540. package/dist/esm/api/types/ErrorResponseModernError.d.mts +4 -4
  541. package/dist/esm/api/types/GetProjectBalanceV1Response.d.mts +4 -4
  542. package/dist/esm/api/types/GetProjectDistributionCredentialsV1Response.d.mts +1 -1
  543. package/dist/esm/api/types/GetProjectKeyV1Response.d.mts +13 -13
  544. package/dist/esm/api/types/GetProjectRequestV1Response.d.mts +1 -1
  545. package/dist/esm/api/types/GetProjectV1Response.d.mts +3 -3
  546. package/dist/esm/api/types/Google.d.mts +2 -2
  547. package/dist/esm/api/types/GrantV1Response.d.mts +1 -1
  548. package/dist/esm/api/types/Groq.d.mts +2 -2
  549. package/dist/esm/api/types/LeaveProjectV1Response.d.mts +1 -1
  550. package/dist/esm/api/types/ListAgentConfigurationsV1Response.d.mts +5 -0
  551. package/dist/esm/api/types/ListAgentConfigurationsV1Response.mjs +2 -0
  552. package/dist/esm/api/types/ListAgentVariablesV1Response.d.mts +5 -0
  553. package/dist/esm/api/types/ListAgentVariablesV1Response.mjs +2 -0
  554. package/dist/esm/api/types/ListBillingFieldsV1Response.d.mts +4 -4
  555. package/dist/esm/api/types/ListModelsV1Response.d.mts +2 -2
  556. package/dist/esm/api/types/ListModelsV1ResponseSttModels.d.mts +9 -9
  557. package/dist/esm/api/types/ListModelsV1ResponseTtsModels.d.mts +14 -14
  558. package/dist/esm/api/types/ListProjectBalancesV1Response.d.mts +5 -5
  559. package/dist/esm/api/types/ListProjectDistributionCredentialsV1Response.d.mts +2 -2
  560. package/dist/esm/api/types/ListProjectInvitesV1Response.d.mts +3 -3
  561. package/dist/esm/api/types/ListProjectKeysV1Response.d.mts +9 -9
  562. package/dist/esm/api/types/ListProjectMemberScopesV1Response.d.mts +1 -1
  563. package/dist/esm/api/types/ListProjectMembersV1Response.d.mts +3 -3
  564. package/dist/esm/api/types/ListProjectPurchasesV1Response.d.mts +7 -7
  565. package/dist/esm/api/types/ListProjectRequestsV1Response.d.mts +3 -3
  566. package/dist/esm/api/types/ListProjectsV1Response.d.mts +3 -3
  567. package/dist/esm/api/types/ListenV1Callback.d.mts +3 -0
  568. package/dist/esm/api/types/ListenV1Channels.d.mts +3 -0
  569. package/dist/esm/api/types/ListenV1Endpointing.d.mts +3 -0
  570. package/dist/esm/api/types/ListenV1Extra.d.mts +3 -0
  571. package/dist/esm/api/types/ListenV1Keyterm.d.mts +3 -0
  572. package/dist/esm/api/types/ListenV1Keywords.d.mts +3 -0
  573. package/dist/esm/api/types/ListenV1Language.d.mts +3 -0
  574. package/dist/esm/api/types/ListenV1MipOptOut.d.mts +3 -0
  575. package/dist/esm/api/types/ListenV1Replace.d.mts +3 -0
  576. package/dist/esm/api/types/ListenV1ResponseMetadata.d.mts +18 -18
  577. package/dist/esm/api/types/ListenV1ResponseResults.d.mts +5 -5
  578. package/dist/esm/api/types/ListenV1ResponseResultsChannelsItem.d.mts +43 -43
  579. package/dist/esm/api/types/ListenV1ResponseResultsSummary.d.mts +2 -2
  580. package/dist/esm/api/types/ListenV1ResponseResultsUtterancesItem.d.mts +15 -15
  581. package/dist/esm/api/types/ListenV1SampleRate.d.mts +3 -0
  582. package/dist/esm/api/types/ListenV1Search.d.mts +3 -0
  583. package/dist/esm/api/types/ListenV1Tag.d.mts +3 -0
  584. package/dist/esm/api/types/ListenV1UtteranceEndMs.d.mts +3 -0
  585. package/dist/esm/api/types/ListenV1Version.d.mts +3 -0
  586. package/dist/esm/api/types/ListenV2EagerEotThreshold.d.mts +5 -0
  587. package/dist/esm/api/types/ListenV2EotThreshold.d.mts +4 -0
  588. package/dist/esm/api/types/ListenV2EotTimeoutMs.d.mts +4 -0
  589. package/dist/esm/api/types/ListenV2MipOptOut.d.mts +5 -0
  590. package/dist/esm/api/types/ListenV2Model.d.mts +6 -4
  591. package/dist/esm/api/types/ListenV2Model.mjs +5 -1
  592. package/dist/esm/api/types/ListenV2SampleRate.d.mts +3 -0
  593. package/dist/esm/api/types/ListenV2Tag.d.mts +4 -0
  594. package/dist/esm/api/types/OpenAiSpeakProvider.d.mts +1 -1
  595. package/dist/esm/api/types/OpenAiThinkProvider.d.mts +2 -2
  596. package/dist/esm/api/types/ProjectRequestResponse.d.mts +9 -9
  597. package/dist/esm/api/types/ReadV1ResponseMetadata.d.mts +20 -20
  598. package/dist/esm/api/types/ReadV1ResponseResults.d.mts +4 -4
  599. package/dist/esm/api/types/ReadV1ResponseResultsSummary.d.mts +3 -3
  600. package/dist/esm/api/types/SharedIntents.d.mts +9 -9
  601. package/dist/esm/api/types/SharedSentiments.d.mts +9 -9
  602. package/dist/esm/api/types/SharedTopics.d.mts +9 -9
  603. package/dist/esm/api/types/SpeakSettingsV1.d.mts +3 -3
  604. package/dist/esm/api/types/SpeakV1MipOptOut.d.mts +3 -0
  605. package/dist/esm/api/types/SpeakV1Speed.d.mts +4 -0
  606. package/dist/esm/api/types/SpeakV1Speed.mjs +2 -0
  607. package/dist/esm/api/types/ThinkSettingsV1.d.mts +13 -13
  608. package/dist/esm/api/types/UpdateProjectMemberScopesV1Response.d.mts +1 -1
  609. package/dist/esm/api/types/UpdateProjectV1Response.d.mts +1 -1
  610. package/dist/esm/api/types/UsageBreakdownV1Response.d.mts +10 -11
  611. package/dist/esm/api/types/UsageFieldsV1Response.d.mts +8 -8
  612. package/dist/esm/api/types/UsageV1Response.d.mts +5 -5
  613. package/dist/esm/api/types/index.d.mts +8 -0
  614. package/dist/esm/api/types/index.mjs +8 -0
  615. package/dist/esm/core/auth/BasicAuth.d.mts +2 -2
  616. package/dist/esm/core/auth/BasicAuth.mjs +7 -1
  617. package/dist/esm/core/fetcher/BinaryResponse.d.mts +1 -1
  618. package/dist/esm/core/fetcher/Fetcher.d.mts +8 -0
  619. package/dist/esm/core/fetcher/Fetcher.mjs +21 -10
  620. package/dist/esm/core/fetcher/index.d.mts +2 -0
  621. package/dist/esm/core/fetcher/index.mjs +1 -0
  622. package/dist/esm/core/fetcher/makePassthroughRequest.d.mts +49 -0
  623. package/dist/esm/core/fetcher/makePassthroughRequest.mjs +132 -0
  624. package/dist/esm/core/fetcher/makeRequest.d.mts +6 -1
  625. package/dist/esm/core/fetcher/makeRequest.mjs +28 -9
  626. package/dist/esm/core/file/file.mjs +3 -2
  627. package/dist/esm/core/runtime/runtime.mjs +8 -7
  628. package/dist/esm/core/url/QueryStringBuilder.d.mts +47 -0
  629. package/dist/esm/core/url/QueryStringBuilder.mjs +80 -0
  630. package/dist/esm/core/url/index.d.mts +1 -0
  631. package/dist/esm/core/url/index.mjs +1 -0
  632. package/dist/esm/core/url/qs.d.mts +2 -1
  633. package/dist/esm/core/url/qs.mjs +24 -12
  634. package/dist/esm/core/websocket/ws.d.mts +14 -2
  635. package/dist/esm/core/websocket/ws.mjs +51 -7
  636. package/dist/esm/environments.d.mts +3 -3
  637. package/dist/esm/environments.mjs +2 -2
  638. package/dist/esm/errors/DeepgramError.d.mts +3 -1
  639. package/dist/esm/errors/DeepgramError.mjs +4 -1
  640. package/dist/esm/errors/DeepgramTimeoutError.d.mts +4 -1
  641. package/dist/esm/errors/DeepgramTimeoutError.mjs +4 -1
  642. package/dist/esm/errors/handleNonStatusCodeError.mjs +4 -1
  643. package/dist/esm/version.d.mts +1 -1
  644. package/dist/esm/version.mjs +1 -1
  645. package/package.json +539 -70
  646. package/reference.md +732 -1
  647. package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1SettingsAgentSpeakEndpointProvider.d.ts +0 -201
  648. package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1SettingsAgentSpeakEndpointProvider.js +0 -139
  649. package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1SettingsAgentSpeakOneItemProvider.d.ts +0 -201
  650. package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1SettingsAgentSpeakOneItemProvider.js +0 -139
  651. package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1SettingsAgentThinkProvider.d.ts +0 -115
  652. package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1SettingsAgentThinkProvider.js +0 -57
  653. package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1UpdateSpeakSpeakProvider.d.ts +0 -201
  654. package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1UpdateSpeakSpeakProvider.js +0 -139
  655. package/dist/cjs/api/types/OpenAi.d.ts +0 -27
  656. package/dist/cjs/api/types/OpenAi.js +0 -21
  657. package/dist/cjs/middleware/adapters/express.d.ts +0 -103
  658. package/dist/cjs/middleware/adapters/express.js +0 -141
  659. package/dist/cjs/middleware/adapters/fastify.d.ts +0 -32
  660. package/dist/cjs/middleware/adapters/fastify.js +0 -194
  661. package/dist/cjs/middleware/adapters/http.d.ts +0 -153
  662. package/dist/cjs/middleware/adapters/http.js +0 -192
  663. package/dist/cjs/middleware/core/ProxyHandler.d.ts +0 -35
  664. package/dist/cjs/middleware/core/ProxyHandler.js +0 -225
  665. package/dist/cjs/middleware/core/TokenManager.d.ts +0 -29
  666. package/dist/cjs/middleware/core/TokenManager.js +0 -110
  667. package/dist/cjs/middleware/core/WebSocketProxy.d.ts +0 -32
  668. package/dist/cjs/middleware/core/WebSocketProxy.js +0 -169
  669. package/dist/cjs/middleware/core/jwt.d.ts +0 -71
  670. package/dist/cjs/middleware/core/jwt.js +0 -136
  671. package/dist/cjs/middleware/core/types.d.ts +0 -37
  672. package/dist/cjs/middleware/index.d.ts +0 -55
  673. package/dist/cjs/middleware/index.js +0 -75
  674. package/dist/cjs/tests/manual/test-custom-baseurl.js +0 -124
  675. package/dist/esm/api/resources/agent/resources/v1/types/AgentV1SettingsAgentSpeakEndpointProvider.d.mts +0 -201
  676. package/dist/esm/api/resources/agent/resources/v1/types/AgentV1SettingsAgentSpeakEndpointProvider.mjs +0 -136
  677. package/dist/esm/api/resources/agent/resources/v1/types/AgentV1SettingsAgentSpeakOneItemProvider.d.mts +0 -201
  678. package/dist/esm/api/resources/agent/resources/v1/types/AgentV1SettingsAgentSpeakOneItemProvider.mjs +0 -136
  679. package/dist/esm/api/resources/agent/resources/v1/types/AgentV1SettingsAgentThinkProvider.d.mts +0 -115
  680. package/dist/esm/api/resources/agent/resources/v1/types/AgentV1SettingsAgentThinkProvider.mjs +0 -54
  681. package/dist/esm/api/resources/agent/resources/v1/types/AgentV1UpdateSpeakSpeakProvider.d.mts +0 -201
  682. package/dist/esm/api/resources/agent/resources/v1/types/AgentV1UpdateSpeakSpeakProvider.mjs +0 -136
  683. package/dist/esm/api/types/OpenAi.d.mts +0 -27
  684. package/dist/esm/api/types/OpenAi.mjs +0 -18
  685. package/dist/esm/middleware/adapters/express.d.mts +0 -103
  686. package/dist/esm/middleware/adapters/express.mjs +0 -136
  687. package/dist/esm/middleware/adapters/fastify.d.mts +0 -32
  688. package/dist/esm/middleware/adapters/fastify.mjs +0 -157
  689. package/dist/esm/middleware/adapters/http.d.mts +0 -153
  690. package/dist/esm/middleware/adapters/http.mjs +0 -187
  691. package/dist/esm/middleware/core/ProxyHandler.d.mts +0 -35
  692. package/dist/esm/middleware/core/ProxyHandler.mjs +0 -218
  693. package/dist/esm/middleware/core/TokenManager.d.mts +0 -29
  694. package/dist/esm/middleware/core/TokenManager.mjs +0 -106
  695. package/dist/esm/middleware/core/WebSocketProxy.d.mts +0 -32
  696. package/dist/esm/middleware/core/WebSocketProxy.mjs +0 -162
  697. package/dist/esm/middleware/core/jwt.d.mts +0 -71
  698. package/dist/esm/middleware/core/jwt.mjs +0 -99
  699. package/dist/esm/middleware/core/types.d.mts +0 -37
  700. package/dist/esm/middleware/index.d.mts +0 -55
  701. package/dist/esm/middleware/index.mjs +0 -59
  702. /package/dist/{esm/middleware/core/types.mjs → cjs/api/resources/voiceAgent/client/index.d.ts} +0 -0
  703. /package/dist/cjs/{middleware/core/types.js → api/resources/voiceAgent/client/index.js} +0 -0
@@ -130,9 +130,9 @@ var Deepgram = (() => {
130
130
  }
131
131
  });
132
132
 
133
- // node_modules/.pnpm/ws@8.19.0/node_modules/ws/browser.js
133
+ // node_modules/.pnpm/ws@8.20.0/node_modules/ws/browser.js
134
134
  var require_browser = __commonJS({
135
- "node_modules/.pnpm/ws@8.19.0/node_modules/ws/browser.js"(exports, module) {
135
+ "node_modules/.pnpm/ws@8.20.0/node_modules/ws/browser.js"(exports, module) {
136
136
  "use strict";
137
137
  module.exports = function() {
138
138
  throw new Error(
@@ -142,16 +142,59 @@ var Deepgram = (() => {
142
142
  }
143
143
  });
144
144
 
145
+ // (disabled):crypto
146
+ var require_crypto = __commonJS({
147
+ "(disabled):crypto"() {
148
+ "use strict";
149
+ }
150
+ });
151
+
145
152
  // src/index.ts
146
153
  var index_exports = {};
147
154
  __export(index_exports, {
155
+ Anthropic: () => Anthropic,
156
+ AwsBedrockThinkProvider: () => AwsBedrockThinkProvider,
157
+ AwsPollySpeakProvider: () => AwsPollySpeakProvider,
158
+ Cartesia: () => Cartesia,
148
159
  Deepgram: () => api_exports,
149
160
  DeepgramClient: () => CustomDeepgramClient,
150
161
  DeepgramEnvironment: () => DeepgramEnvironment,
151
162
  DeepgramError: () => DeepgramError,
152
163
  DeepgramTimeoutError: () => DeepgramTimeoutError,
153
164
  DefaultDeepgramClient: () => DeepgramClient,
154
- logging: () => logging
165
+ ElevenLabsSpeakProvider: () => ElevenLabsSpeakProvider,
166
+ Google: () => Google,
167
+ ListBillingFieldsV1Response: () => ListBillingFieldsV1Response,
168
+ ListenV1CallbackMethod: () => ListenV1CallbackMethod,
169
+ ListenV1DetectEntities: () => ListenV1DetectEntities,
170
+ ListenV1Diarize: () => ListenV1Diarize,
171
+ ListenV1Dictation: () => ListenV1Dictation,
172
+ ListenV1Encoding: () => ListenV1Encoding,
173
+ ListenV1InterimResults: () => ListenV1InterimResults,
174
+ ListenV1Model: () => ListenV1Model,
175
+ ListenV1Multichannel: () => ListenV1Multichannel,
176
+ ListenV1Numerals: () => ListenV1Numerals,
177
+ ListenV1ProfanityFilter: () => ListenV1ProfanityFilter,
178
+ ListenV1Punctuate: () => ListenV1Punctuate,
179
+ ListenV1Redact: () => ListenV1Redact,
180
+ ListenV1SmartFormat: () => ListenV1SmartFormat,
181
+ ListenV1VadEvents: () => ListenV1VadEvents,
182
+ ListenV2Encoding: () => ListenV2Encoding,
183
+ ListenV2Model: () => ListenV2Model,
184
+ OpenAiSpeakProvider: () => OpenAiSpeakProvider,
185
+ OpenAiThinkProvider: () => OpenAiThinkProvider,
186
+ SpeakV1Encoding: () => SpeakV1Encoding,
187
+ SpeakV1Model: () => SpeakV1Model,
188
+ SpeakV1SampleRate: () => SpeakV1SampleRate,
189
+ agent: () => agent_exports,
190
+ auth: () => auth_exports,
191
+ listen: () => listen_exports,
192
+ logging: () => logging,
193
+ manage: () => manage_exports,
194
+ read: () => read_exports,
195
+ selfHosted: () => selfHosted_exports,
196
+ speak: () => speak_exports,
197
+ voiceAgent: () => voiceAgent_exports
155
198
  });
156
199
 
157
200
  // src/api/index.ts
@@ -181,7 +224,9 @@ var Deepgram = (() => {
181
224
  ListenV1SmartFormat: () => ListenV1SmartFormat,
182
225
  ListenV1VadEvents: () => ListenV1VadEvents,
183
226
  ListenV2Encoding: () => ListenV2Encoding,
184
- OpenAi: () => OpenAi,
227
+ ListenV2Model: () => ListenV2Model,
228
+ OpenAiSpeakProvider: () => OpenAiSpeakProvider,
229
+ OpenAiThinkProvider: () => OpenAiThinkProvider,
185
230
  SpeakV1Encoding: () => SpeakV1Encoding,
186
231
  SpeakV1Model: () => SpeakV1Model,
187
232
  SpeakV1SampleRate: () => SpeakV1SampleRate,
@@ -191,7 +236,8 @@ var Deepgram = (() => {
191
236
  manage: () => manage_exports,
192
237
  read: () => read_exports,
193
238
  selfHosted: () => selfHosted_exports,
194
- speak: () => speak_exports
239
+ speak: () => speak_exports,
240
+ voiceAgent: () => voiceAgent_exports
195
241
  });
196
242
 
197
243
  // src/core/json.ts
@@ -208,7 +254,8 @@ var Deepgram = (() => {
208
254
  message,
209
255
  statusCode,
210
256
  body,
211
- rawResponse
257
+ rawResponse,
258
+ cause
212
259
  }) {
213
260
  super(buildMessage({ message, statusCode, body }));
214
261
  Object.setPrototypeOf(this, new.target.prototype);
@@ -219,6 +266,9 @@ var Deepgram = (() => {
219
266
  this.statusCode = statusCode;
220
267
  this.body = body;
221
268
  this.rawResponse = rawResponse;
269
+ if (cause != null) {
270
+ this.cause = cause;
271
+ }
222
272
  }
223
273
  };
224
274
  function buildMessage({
@@ -241,13 +291,16 @@ var Deepgram = (() => {
241
291
 
242
292
  // src/errors/DeepgramTimeoutError.ts
243
293
  var DeepgramTimeoutError = class extends Error {
244
- constructor(message) {
294
+ constructor(message, opts) {
245
295
  super(message);
246
296
  Object.setPrototypeOf(this, new.target.prototype);
247
297
  if (Error.captureStackTrace) {
248
298
  Error.captureStackTrace(this, this.constructor);
249
299
  }
250
300
  this.name = this.constructor.name;
301
+ if ((opts == null ? void 0 : opts.cause) != null) {
302
+ this.cause = opts.cause;
303
+ }
251
304
  }
252
305
  };
253
306
 
@@ -1003,6 +1056,19 @@ var Deepgram = (() => {
1003
1056
  };
1004
1057
  })(SpeakV1Flushed || (SpeakV1Flushed = {}));
1005
1058
 
1059
+ // src/api/resources/voiceAgent/index.ts
1060
+ var voiceAgent_exports = {};
1061
+ __export(voiceAgent_exports, {
1062
+ configurations: () => configurations_exports,
1063
+ variables: () => variables_exports
1064
+ });
1065
+
1066
+ // src/api/resources/voiceAgent/resources/configurations/index.ts
1067
+ var configurations_exports = {};
1068
+
1069
+ // src/api/resources/voiceAgent/resources/variables/index.ts
1070
+ var variables_exports = {};
1071
+
1006
1072
  // src/api/types/Anthropic.ts
1007
1073
  var Anthropic;
1008
1074
  ((Anthropic2) => {
@@ -1306,14 +1372,20 @@ var Deepgram = (() => {
1306
1372
  OggOpus: "ogg-opus"
1307
1373
  };
1308
1374
 
1309
- // src/api/types/OpenAi.ts
1310
- var OpenAi;
1311
- ((OpenAi2) => {
1312
- OpenAi2.Model = {
1375
+ // src/api/types/ListenV2Model.ts
1376
+ var ListenV2Model = {
1377
+ FluxGeneralEn: "flux-general-en",
1378
+ FluxGeneralMulti: "flux-general-multi"
1379
+ };
1380
+
1381
+ // src/api/types/OpenAiSpeakProvider.ts
1382
+ var OpenAiSpeakProvider;
1383
+ ((OpenAiSpeakProvider2) => {
1384
+ OpenAiSpeakProvider2.Model = {
1313
1385
  Tts1: "tts-1",
1314
1386
  Tts1Hd: "tts-1-hd"
1315
1387
  };
1316
- OpenAi2.Voice = {
1388
+ OpenAiSpeakProvider2.Voice = {
1317
1389
  Alloy: "alloy",
1318
1390
  Echo: "echo",
1319
1391
  Fable: "fable",
@@ -1321,7 +1393,22 @@ var Deepgram = (() => {
1321
1393
  Nova: "nova",
1322
1394
  Shimmer: "shimmer"
1323
1395
  };
1324
- })(OpenAi || (OpenAi = {}));
1396
+ })(OpenAiSpeakProvider || (OpenAiSpeakProvider = {}));
1397
+
1398
+ // src/api/types/OpenAiThinkProvider.ts
1399
+ var OpenAiThinkProvider;
1400
+ ((OpenAiThinkProvider2) => {
1401
+ OpenAiThinkProvider2.Model = {
1402
+ Gpt5: "gpt-5",
1403
+ Gpt5Mini: "gpt-5-mini",
1404
+ Gpt5Nano: "gpt-5-nano",
1405
+ Gpt41: "gpt-4.1",
1406
+ Gpt41Mini: "gpt-4.1-mini",
1407
+ Gpt41Nano: "gpt-4.1-nano",
1408
+ Gpt4O: "gpt-4o",
1409
+ Gpt4OMini: "gpt-4o-mini"
1410
+ };
1411
+ })(OpenAiThinkProvider || (OpenAiThinkProvider = {}));
1325
1412
 
1326
1413
  // src/api/types/SpeakV1Encoding.ts
1327
1414
  var SpeakV1Encoding = {
@@ -1584,18 +1671,27 @@ var Deepgram = (() => {
1584
1671
  if (value.length === 0) {
1585
1672
  continue;
1586
1673
  }
1587
- for (let i = 0; i < value.length; i++) {
1588
- const item = value[i];
1589
- if (item === void 0) {
1590
- continue;
1674
+ const effectiveFormat = options.arrayFormat;
1675
+ if (effectiveFormat === "comma") {
1676
+ const encodedKey = options.encode ? encodeURIComponent(fullKey) : fullKey;
1677
+ const encodedValues = value.filter((item) => item !== void 0 && item !== null).map((item) => encodeValue(item, options.encode));
1678
+ if (encodedValues.length > 0) {
1679
+ parts.push(`${encodedKey}=${encodedValues.join(",")}`);
1591
1680
  }
1592
- if (typeof item === "object" && !Array.isArray(item) && item !== null) {
1593
- const arrayKey = options.arrayFormat === "indices" ? `${fullKey}[${i}]` : fullKey;
1594
- parts.push(...stringifyObject(item, arrayKey, options));
1595
- } else {
1596
- const arrayKey = options.arrayFormat === "indices" ? `${fullKey}[${i}]` : fullKey;
1597
- const encodedKey = options.encode ? encodeURIComponent(arrayKey) : arrayKey;
1598
- parts.push(`${encodedKey}=${encodeValue(item, options.encode)}`);
1681
+ } else {
1682
+ for (let i = 0; i < value.length; i++) {
1683
+ const item = value[i];
1684
+ if (item === void 0) {
1685
+ continue;
1686
+ }
1687
+ if (typeof item === "object" && !Array.isArray(item) && item !== null) {
1688
+ const arrayKey = effectiveFormat === "indices" ? `${fullKey}[${i}]` : fullKey;
1689
+ parts.push(...stringifyObject(item, arrayKey, options));
1690
+ } else {
1691
+ const arrayKey = effectiveFormat === "indices" ? `${fullKey}[${i}]` : fullKey;
1692
+ const encodedKey = options.encode ? encodeURIComponent(arrayKey) : arrayKey;
1693
+ parts.push(`${encodedKey}=${encodeValue(item, options.encode)}`);
1694
+ }
1599
1695
  }
1600
1696
  }
1601
1697
  } else if (typeof value === "object" && value !== null) {
@@ -1748,15 +1844,15 @@ var Deepgram = (() => {
1748
1844
  }
1749
1845
 
1750
1846
  // src/core/fetcher/Headers.ts
1751
- var Headers;
1847
+ var Headers2;
1752
1848
  if (typeof globalThis.Headers !== "undefined") {
1753
- Headers = globalThis.Headers;
1849
+ Headers2 = globalThis.Headers;
1754
1850
  } else {
1755
- Headers = class Headers2 {
1851
+ Headers2 = class Headers3 {
1756
1852
  constructor(init) {
1757
1853
  this.headers = /* @__PURE__ */ new Map();
1758
1854
  if (init) {
1759
- if (init instanceof Headers2) {
1855
+ if (init instanceof Headers3) {
1760
1856
  init.forEach((value, key) => this.append(key, value));
1761
1857
  } else if (Array.isArray(init)) {
1762
1858
  for (const [key, value] of init) {
@@ -1848,7 +1944,20 @@ var Deepgram = (() => {
1848
1944
  }
1849
1945
 
1850
1946
  // src/core/fetcher/makeRequest.ts
1851
- var makeRequest = (fetchFn, url, method, headers, requestBody, timeoutMs, abortSignal, withCredentials, duplex) => __async(null, null, function* () {
1947
+ var _cacheNoStoreSupported;
1948
+ function isCacheNoStoreSupported() {
1949
+ if (_cacheNoStoreSupported != null) {
1950
+ return _cacheNoStoreSupported;
1951
+ }
1952
+ try {
1953
+ new Request("http://localhost", { cache: "no-store" });
1954
+ _cacheNoStoreSupported = true;
1955
+ } catch (e) {
1956
+ _cacheNoStoreSupported = false;
1957
+ }
1958
+ return _cacheNoStoreSupported;
1959
+ }
1960
+ var makeRequest = (fetchFn, url, method, headers, requestBody, timeoutMs, abortSignal, withCredentials, duplex, disableCache) => __async(null, null, function* () {
1852
1961
  const signals = [];
1853
1962
  let timeoutAbortId;
1854
1963
  if (timeoutMs != null) {
@@ -1860,7 +1969,7 @@ var Deepgram = (() => {
1860
1969
  signals.push(abortSignal);
1861
1970
  }
1862
1971
  const newSignals = anySignal(signals);
1863
- const response = yield fetchFn(url, {
1972
+ const response = yield fetchFn(url, __spreadValues({
1864
1973
  method,
1865
1974
  headers,
1866
1975
  body: requestBody,
@@ -1868,7 +1977,7 @@ var Deepgram = (() => {
1868
1977
  credentials: withCredentials ? "include" : void 0,
1869
1978
  // @ts-ignore
1870
1979
  duplex
1871
- });
1980
+ }, disableCache && isCacheNoStoreSupported() ? { cache: "no-store" } : {}));
1872
1981
  if (timeoutAbortId != null) {
1873
1982
  clearTimeout(timeoutAbortId);
1874
1983
  }
@@ -1877,7 +1986,7 @@ var Deepgram = (() => {
1877
1986
 
1878
1987
  // src/core/fetcher/RawResponse.ts
1879
1988
  var abortRawResponse = {
1880
- headers: new Headers(),
1989
+ headers: new Headers2(),
1881
1990
  redirected: false,
1882
1991
  status: 499,
1883
1992
  statusText: "Client Closed Request",
@@ -1885,7 +1994,7 @@ var Deepgram = (() => {
1885
1994
  url: ""
1886
1995
  };
1887
1996
  var unknownRawResponse = {
1888
- headers: new Headers(),
1997
+ headers: new Headers2(),
1889
1998
  redirected: false,
1890
1999
  status: 0,
1891
2000
  statusText: "Unknown Error",
@@ -1980,7 +2089,7 @@ var Deepgram = (() => {
1980
2089
  ]);
1981
2090
  function redactHeaders(headers) {
1982
2091
  const filtered = {};
1983
- for (const [key, value] of headers instanceof Headers ? headers.entries() : Object.entries(headers)) {
2092
+ for (const [key, value] of headers instanceof Headers2 ? headers.entries() : Object.entries(headers)) {
1984
2093
  if (SENSITIVE_HEADERS.has(key.toLowerCase())) {
1985
2094
  filtered[key] = "[REDACTED]";
1986
2095
  } else {
@@ -2011,15 +2120,11 @@ var Deepgram = (() => {
2011
2120
  ]);
2012
2121
  function redactQueryParameters(queryParameters) {
2013
2122
  if (queryParameters == null) {
2014
- return queryParameters;
2123
+ return void 0;
2015
2124
  }
2016
2125
  const redacted = {};
2017
2126
  for (const [key, value] of Object.entries(queryParameters)) {
2018
- if (SENSITIVE_QUERY_PARAMS.has(key.toLowerCase())) {
2019
- redacted[key] = "[REDACTED]";
2020
- } else {
2021
- redacted[key] = value;
2022
- }
2127
+ redacted[key] = SENSITIVE_QUERY_PARAMS.has(key.toLowerCase()) ? "[REDACTED]" : value;
2023
2128
  }
2024
2129
  return redacted;
2025
2130
  }
@@ -2079,10 +2184,10 @@ var Deepgram = (() => {
2079
2184
  function getHeaders(args) {
2080
2185
  return __async(this, null, function* () {
2081
2186
  var _a;
2082
- const newHeaders = new Headers();
2187
+ const newHeaders = new Headers2();
2083
2188
  newHeaders.set(
2084
2189
  "Accept",
2085
- args.responseType === "json" ? "application/json" : args.responseType === "text" ? "text/plain" : "*/*"
2190
+ args.responseType === "json" ? "application/json" : args.responseType === "text" ? "text/plain" : args.responseType === "sse" ? "text/event-stream" : "*/*"
2086
2191
  );
2087
2192
  if (args.body !== void 0 && args.contentType != null) {
2088
2193
  newHeaders.set("Content-Type", args.contentType);
@@ -2107,7 +2212,12 @@ var Deepgram = (() => {
2107
2212
  function fetcherImpl(args) {
2108
2213
  return __async(this, null, function* () {
2109
2214
  var _a, _b, _c;
2110
- const url = createRequestUrl(args.url, args.queryParameters);
2215
+ let url = args.url;
2216
+ if (args.queryString != null && args.queryString.length > 0) {
2217
+ url = `${url}?${args.queryString}`;
2218
+ } else {
2219
+ url = createRequestUrl(args.url, args.queryParameters);
2220
+ }
2111
2221
  const requestBody = yield getRequestBody({
2112
2222
  body: args.body,
2113
2223
  type: (_a = args.requestType) != null ? _a : "other"
@@ -2137,7 +2247,8 @@ var Deepgram = (() => {
2137
2247
  args.timeoutMs,
2138
2248
  args.abortSignal,
2139
2249
  args.withCredentials,
2140
- args.duplex
2250
+ args.duplex,
2251
+ args.responseType === "streaming" || args.responseType === "sse"
2141
2252
  );
2142
2253
  }),
2143
2254
  args.maxRetries
@@ -2192,7 +2303,8 @@ var Deepgram = (() => {
2192
2303
  ok: false,
2193
2304
  error: {
2194
2305
  reason: "unknown",
2195
- errorMessage: "The user aborted a request"
2306
+ errorMessage: "The user aborted a request",
2307
+ cause: error
2196
2308
  },
2197
2309
  rawResponse: abortRawResponse
2198
2310
  };
@@ -2208,7 +2320,8 @@ var Deepgram = (() => {
2208
2320
  return {
2209
2321
  ok: false,
2210
2322
  error: {
2211
- reason: "timeout"
2323
+ reason: "timeout",
2324
+ cause: error
2212
2325
  },
2213
2326
  rawResponse: abortRawResponse
2214
2327
  };
@@ -2225,7 +2338,8 @@ var Deepgram = (() => {
2225
2338
  ok: false,
2226
2339
  error: {
2227
2340
  reason: "unknown",
2228
- errorMessage: error.message
2341
+ errorMessage: error.message,
2342
+ cause: error
2229
2343
  },
2230
2344
  rawResponse: unknownRawResponse
2231
2345
  };
@@ -2242,7 +2356,8 @@ var Deepgram = (() => {
2242
2356
  ok: false,
2243
2357
  error: {
2244
2358
  reason: "unknown",
2245
- errorMessage: toJson(error)
2359
+ errorMessage: toJson(error),
2360
+ cause: error
2246
2361
  },
2247
2362
  rawResponse: unknownRawResponse
2248
2363
  };
@@ -2339,6 +2454,69 @@ var Deepgram = (() => {
2339
2454
  }
2340
2455
  };
2341
2456
 
2457
+ // src/core/url/join.ts
2458
+ function join(base, ...segments) {
2459
+ if (!base) {
2460
+ return "";
2461
+ }
2462
+ if (segments.length === 0) {
2463
+ return base;
2464
+ }
2465
+ if (base.includes("://")) {
2466
+ let url;
2467
+ try {
2468
+ url = new URL(base);
2469
+ } catch (e) {
2470
+ return joinPath(base, ...segments);
2471
+ }
2472
+ const lastSegment = segments[segments.length - 1];
2473
+ const shouldPreserveTrailingSlash = lastSegment == null ? void 0 : lastSegment.endsWith("/");
2474
+ for (const segment of segments) {
2475
+ const cleanSegment = trimSlashes(segment);
2476
+ if (cleanSegment) {
2477
+ url.pathname = joinPathSegments(url.pathname, cleanSegment);
2478
+ }
2479
+ }
2480
+ if (shouldPreserveTrailingSlash && !url.pathname.endsWith("/")) {
2481
+ url.pathname += "/";
2482
+ }
2483
+ return url.toString();
2484
+ }
2485
+ return joinPath(base, ...segments);
2486
+ }
2487
+ function joinPath(base, ...segments) {
2488
+ if (segments.length === 0) {
2489
+ return base;
2490
+ }
2491
+ let result = base;
2492
+ const lastSegment = segments[segments.length - 1];
2493
+ const shouldPreserveTrailingSlash = lastSegment == null ? void 0 : lastSegment.endsWith("/");
2494
+ for (const segment of segments) {
2495
+ const cleanSegment = trimSlashes(segment);
2496
+ if (cleanSegment) {
2497
+ result = joinPathSegments(result, cleanSegment);
2498
+ }
2499
+ }
2500
+ if (shouldPreserveTrailingSlash && !result.endsWith("/")) {
2501
+ result += "/";
2502
+ }
2503
+ return result;
2504
+ }
2505
+ function joinPathSegments(left, right) {
2506
+ if (left.endsWith("/")) {
2507
+ return left + right;
2508
+ }
2509
+ return `${left}/${right}`;
2510
+ }
2511
+ function trimSlashes(str) {
2512
+ if (!str) return str;
2513
+ let start = 0;
2514
+ let end = str.length;
2515
+ if (str.startsWith("/")) start = 1;
2516
+ if (str.endsWith("/")) end = str.length - 1;
2517
+ return start === 0 && end === str.length ? str : str.slice(start, end);
2518
+ }
2519
+
2342
2520
  // src/core/fetcher/Supplier.ts
2343
2521
  var Supplier = {
2344
2522
  get: (supplier) => __async(null, null, function* () {
@@ -2350,6 +2528,113 @@ var Deepgram = (() => {
2350
2528
  })
2351
2529
  };
2352
2530
 
2531
+ // src/core/fetcher/makePassthroughRequest.ts
2532
+ function makePassthroughRequest(input, init, clientOptions, requestOptions) {
2533
+ return __async(this, null, function* () {
2534
+ var _a, _b, _c, _d, _e, _f, _g;
2535
+ const logger = createLogger(clientOptions.logging);
2536
+ let url;
2537
+ let effectiveInit = init;
2538
+ if (input instanceof Request) {
2539
+ url = input.url;
2540
+ if (init == null) {
2541
+ effectiveInit = {
2542
+ method: input.method,
2543
+ headers: Object.fromEntries(input.headers.entries()),
2544
+ body: input.body,
2545
+ signal: input.signal,
2546
+ credentials: input.credentials,
2547
+ cache: input.cache,
2548
+ redirect: input.redirect,
2549
+ referrer: input.referrer,
2550
+ integrity: input.integrity,
2551
+ mode: input.mode
2552
+ };
2553
+ }
2554
+ } else {
2555
+ url = input instanceof URL ? input.toString() : input;
2556
+ }
2557
+ const baseUrl = (_a = clientOptions.baseUrl != null ? yield Supplier.get(clientOptions.baseUrl) : void 0) != null ? _a : clientOptions.environment != null ? yield Supplier.get(clientOptions.environment) : void 0;
2558
+ let fullUrl;
2559
+ if (url.startsWith("http://") || url.startsWith("https://")) {
2560
+ fullUrl = url;
2561
+ } else if (baseUrl != null) {
2562
+ fullUrl = join(baseUrl, url);
2563
+ } else {
2564
+ fullUrl = url;
2565
+ }
2566
+ const mergedHeaders = {};
2567
+ if (clientOptions.headers != null) {
2568
+ for (const [key, value] of Object.entries(clientOptions.headers)) {
2569
+ const resolved = yield EndpointSupplier.get(value, { endpointMetadata: {} });
2570
+ if (resolved != null) {
2571
+ mergedHeaders[key.toLowerCase()] = `${resolved}`;
2572
+ }
2573
+ }
2574
+ }
2575
+ if (clientOptions.getAuthHeaders != null) {
2576
+ const authHeaders = yield clientOptions.getAuthHeaders();
2577
+ for (const [key, value] of Object.entries(authHeaders)) {
2578
+ mergedHeaders[key.toLowerCase()] = value;
2579
+ }
2580
+ }
2581
+ if ((effectiveInit == null ? void 0 : effectiveInit.headers) != null) {
2582
+ const initHeaders = effectiveInit.headers instanceof Headers ? Object.fromEntries(effectiveInit.headers.entries()) : Array.isArray(effectiveInit.headers) ? Object.fromEntries(effectiveInit.headers) : effectiveInit.headers;
2583
+ for (const [key, value] of Object.entries(initHeaders)) {
2584
+ if (value != null) {
2585
+ mergedHeaders[key.toLowerCase()] = value;
2586
+ }
2587
+ }
2588
+ }
2589
+ if ((requestOptions == null ? void 0 : requestOptions.headers) != null) {
2590
+ for (const [key, value] of Object.entries(requestOptions.headers)) {
2591
+ mergedHeaders[key.toLowerCase()] = value;
2592
+ }
2593
+ }
2594
+ const method = (_b = effectiveInit == null ? void 0 : effectiveInit.method) != null ? _b : "GET";
2595
+ const body = effectiveInit == null ? void 0 : effectiveInit.body;
2596
+ const timeoutInSeconds = (_c = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _c : clientOptions.timeoutInSeconds;
2597
+ const timeoutMs = timeoutInSeconds != null ? timeoutInSeconds * 1e3 : void 0;
2598
+ const maxRetries = (_d = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _d : clientOptions.maxRetries;
2599
+ const abortSignal = (_f = (_e = requestOptions == null ? void 0 : requestOptions.abortSignal) != null ? _e : effectiveInit == null ? void 0 : effectiveInit.signal) != null ? _f : void 0;
2600
+ const fetchFn = (_g = clientOptions.fetch) != null ? _g : yield getFetchFn();
2601
+ if (logger.isDebug()) {
2602
+ logger.debug("Making passthrough HTTP request", {
2603
+ method,
2604
+ url: fullUrl,
2605
+ hasBody: body != null
2606
+ });
2607
+ }
2608
+ const response = yield requestWithRetries(
2609
+ () => __async(null, null, function* () {
2610
+ return makeRequest(
2611
+ fetchFn,
2612
+ fullUrl,
2613
+ method,
2614
+ mergedHeaders,
2615
+ body != null ? body : void 0,
2616
+ timeoutMs,
2617
+ abortSignal,
2618
+ (effectiveInit == null ? void 0 : effectiveInit.credentials) === "include",
2619
+ void 0,
2620
+ // duplex
2621
+ false
2622
+ // disableCache
2623
+ );
2624
+ }),
2625
+ maxRetries
2626
+ );
2627
+ if (logger.isDebug()) {
2628
+ logger.debug("Passthrough HTTP request completed", {
2629
+ method,
2630
+ url: fullUrl,
2631
+ statusCode: response.status
2632
+ });
2633
+ }
2634
+ return response;
2635
+ });
2636
+ }
2637
+
2353
2638
  // src/core/file/index.ts
2354
2639
  var file_exports = {};
2355
2640
  __export(file_exports, {
@@ -2402,7 +2687,7 @@ var Deepgram = (() => {
2402
2687
  }
2403
2688
  if ("path" in file) {
2404
2689
  const fs = yield Promise.resolve().then(() => __toESM(require_fs()));
2405
- if (!fs || !fs.createReadStream) {
2690
+ if (!(fs == null ? void 0 : fs.createReadStream)) {
2406
2691
  throw new Error("File path uploads are not supported in this environment.");
2407
2692
  }
2408
2693
  const data = fs.createReadStream(file.path);
@@ -2436,9 +2721,10 @@ var Deepgram = (() => {
2436
2721
  }
2437
2722
  function tryGetFileSizeFromPath(path) {
2438
2723
  return __async(this, null, function* () {
2724
+ var _a;
2439
2725
  try {
2440
2726
  const fs = yield Promise.resolve().then(() => __toESM(require_fs()));
2441
- if (!fs || !fs.promises || !fs.promises.stat) {
2727
+ if (!((_a = fs == null ? void 0 : fs.promises) == null ? void 0 : _a.stat)) {
2442
2728
  return void 0;
2443
2729
  }
2444
2730
  const fileStat = yield fs.promises.stat(path);
@@ -2587,12 +2873,13 @@ var Deepgram = (() => {
2587
2873
  type: "react-native"
2588
2874
  };
2589
2875
  }
2590
- const isNode = typeof process !== "undefined" && "version" in process && !!process.version && "versions" in process && !!((_e = process.versions) == null ? void 0 : _e.node);
2876
+ const _process = typeof process !== "undefined" ? process : void 0;
2877
+ const isNode = typeof _process !== "undefined" && typeof ((_e = _process.versions) == null ? void 0 : _e.node) === "string";
2591
2878
  if (isNode) {
2592
2879
  return {
2593
2880
  type: "node",
2594
- version: process.versions.node,
2595
- parsedVersion: Number(process.versions.node.split(".")[0])
2881
+ version: _process.versions.node,
2882
+ parsedVersion: Number(_process.versions.node.split(".")[0])
2596
2883
  };
2597
2884
  }
2598
2885
  return {
@@ -2605,6 +2892,7 @@ var Deepgram = (() => {
2605
2892
  __export(url_exports, {
2606
2893
  encodePathParam: () => encodePathParam,
2607
2894
  join: () => join,
2895
+ queryBuilder: () => queryBuilder,
2608
2896
  toQueryString: () => toQueryString
2609
2897
  });
2610
2898
 
@@ -2628,68 +2916,75 @@ var Deepgram = (() => {
2628
2916
  return encodeURIComponent(param);
2629
2917
  }
2630
2918
 
2631
- // src/core/url/join.ts
2632
- function join(base, ...segments) {
2633
- if (!base) {
2634
- return "";
2635
- }
2636
- if (segments.length === 0) {
2637
- return base;
2919
+ // src/core/url/QueryStringBuilder.ts
2920
+ function queryBuilder() {
2921
+ return new QueryStringBuilder();
2922
+ }
2923
+ var QueryStringBuilder = class {
2924
+ constructor() {
2925
+ this.parts = /* @__PURE__ */ new Map();
2638
2926
  }
2639
- if (base.includes("://")) {
2640
- let url;
2641
- try {
2642
- url = new URL(base);
2643
- } catch (e) {
2644
- return joinPath(base, ...segments);
2645
- }
2646
- const lastSegment = segments[segments.length - 1];
2647
- const shouldPreserveTrailingSlash = lastSegment == null ? void 0 : lastSegment.endsWith("/");
2648
- for (const segment of segments) {
2649
- const cleanSegment = trimSlashes(segment);
2650
- if (cleanSegment) {
2651
- url.pathname = joinPathSegments(url.pathname, cleanSegment);
2652
- }
2927
+ /**
2928
+ * Adds a query parameter, serializing it immediately.
2929
+ *
2930
+ * By default arrays use "repeat" format (`key=a&key=b`).
2931
+ * Pass `{ style: "comma" }` for OpenAPI `explode: false` parameters
2932
+ * to get comma-separated values (`key=a,b,c`).
2933
+ *
2934
+ * Null / undefined values are silently skipped.
2935
+ */
2936
+ add(key, value, options) {
2937
+ if (value === void 0 || value === null) {
2938
+ return this;
2653
2939
  }
2654
- if (shouldPreserveTrailingSlash && !url.pathname.endsWith("/")) {
2655
- url.pathname += "/";
2940
+ const serialized = toQueryString(
2941
+ { [key]: value },
2942
+ { arrayFormat: (options == null ? void 0 : options.style) === "comma" ? "comma" : "repeat" }
2943
+ );
2944
+ if (serialized.length > 0) {
2945
+ this.parts.set(key, serialized);
2656
2946
  }
2657
- return url.toString();
2658
- }
2659
- return joinPath(base, ...segments);
2660
- }
2661
- function joinPath(base, ...segments) {
2662
- if (segments.length === 0) {
2663
- return base;
2947
+ return this;
2664
2948
  }
2665
- let result = base;
2666
- const lastSegment = segments[segments.length - 1];
2667
- const shouldPreserveTrailingSlash = lastSegment == null ? void 0 : lastSegment.endsWith("/");
2668
- for (const segment of segments) {
2669
- const cleanSegment = trimSlashes(segment);
2670
- if (cleanSegment) {
2671
- result = joinPathSegments(result, cleanSegment);
2949
+ /**
2950
+ * Adds multiple query parameters at once from a record.
2951
+ * All parameters use the default "repeat" array format.
2952
+ * Null / undefined values are silently skipped.
2953
+ */
2954
+ addMany(params) {
2955
+ if (params != null) {
2956
+ for (const [key, value] of Object.entries(params)) {
2957
+ this.add(key, value);
2958
+ }
2672
2959
  }
2960
+ return this;
2673
2961
  }
2674
- if (shouldPreserveTrailingSlash && !result.endsWith("/")) {
2675
- result += "/";
2962
+ /**
2963
+ * Merges additional query parameters supplied at call-time via
2964
+ * `requestOptions.queryParams`. Overrides existing keys (last-write-wins).
2965
+ */
2966
+ mergeAdditional(additionalParams) {
2967
+ if (additionalParams != null) {
2968
+ for (const [key, value] of Object.entries(additionalParams)) {
2969
+ if (value === void 0 || value === null) {
2970
+ continue;
2971
+ }
2972
+ const serialized = toQueryString({ [key]: value }, { arrayFormat: "repeat" });
2973
+ if (serialized.length > 0) {
2974
+ this.parts.set(key, serialized);
2975
+ }
2976
+ }
2977
+ }
2978
+ return this;
2676
2979
  }
2677
- return result;
2678
- }
2679
- function joinPathSegments(left, right) {
2680
- if (left.endsWith("/")) {
2681
- return left + right;
2980
+ /**
2981
+ * Returns the assembled query string (without the leading `?`).
2982
+ * Returns an empty string when no parameters were added.
2983
+ */
2984
+ build() {
2985
+ return [...this.parts.values()].join("&");
2682
2986
  }
2683
- return `${left}/${right}`;
2684
- }
2685
- function trimSlashes(str) {
2686
- if (!str) return str;
2687
- let start = 0;
2688
- let end = str.length;
2689
- if (str.startsWith("/")) start = 1;
2690
- if (str.endsWith("/")) end = str.length - 1;
2691
- return start === 0 && end === str.length ? str : str.slice(start, end);
2692
- }
2987
+ };
2693
2988
 
2694
2989
  // src/core/websocket/ws.ts
2695
2990
  var import_ws = __toESM(require_browser());
@@ -2719,10 +3014,10 @@ var Deepgram = (() => {
2719
3014
 
2720
3015
  // src/core/websocket/ws.ts
2721
3016
  var getGlobalWebSocket = () => {
2722
- if (typeof WebSocket !== "undefined") {
2723
- return WebSocket;
2724
- } else if (RUNTIME.type === "node") {
3017
+ if (RUNTIME.type === "node" || RUNTIME.type === "bun" || RUNTIME.type === "deno") {
2725
3018
  return import_ws.WebSocket;
3019
+ } else if (typeof WebSocket !== "undefined") {
3020
+ return WebSocket;
2726
3021
  }
2727
3022
  return void 0;
2728
3023
  };
@@ -2739,7 +3034,7 @@ var Deepgram = (() => {
2739
3034
  debug: false
2740
3035
  };
2741
3036
  var _ReconnectingWebSocket = class _ReconnectingWebSocket {
2742
- constructor({ url, protocols, options, headers, queryParameters }) {
3037
+ constructor({ url, protocols, options, headers, queryParameters, abortSignal }) {
2743
3038
  this._listeners = {
2744
3039
  error: [],
2745
3040
  message: [],
@@ -2773,6 +3068,25 @@ var Deepgram = (() => {
2773
3068
  * this indicates that the connection is ready to send and receive data
2774
3069
  */
2775
3070
  this.onopen = null;
3071
+ this._handleAbort = () => {
3072
+ if (this._closeCalled) {
3073
+ return;
3074
+ }
3075
+ this._debug("abort signal fired");
3076
+ this._shouldReconnect = false;
3077
+ this._closeCalled = true;
3078
+ this._clearTimeouts();
3079
+ if (this._ws) {
3080
+ this._removeListeners();
3081
+ this._ws.addEventListener("error", () => {
3082
+ });
3083
+ try {
3084
+ this._ws.close(1e3, "aborted");
3085
+ this._handleClose(new CloseEvent(1e3, "aborted", this));
3086
+ } catch (_error) {
3087
+ }
3088
+ }
3089
+ };
2776
3090
  this._handleOpen = (event) => {
2777
3091
  this._debug("open event");
2778
3092
  const { minUptime = DEFAULT_OPTIONS.minUptime } = this._options;
@@ -2825,6 +3139,10 @@ var Deepgram = (() => {
2825
3139
  this._options = options != null ? options : DEFAULT_OPTIONS;
2826
3140
  this._headers = headers;
2827
3141
  this._queryParameters = queryParameters;
3142
+ this._abortSignal = abortSignal;
3143
+ if (this._abortSignal) {
3144
+ this._abortSignal.addEventListener("abort", this._handleAbort, { once: true });
3145
+ }
2828
3146
  if (this._options.startClosed) {
2829
3147
  this._shouldReconnect = false;
2830
3148
  }
@@ -2886,7 +3204,7 @@ var Deepgram = (() => {
2886
3204
  if (this._ws) {
2887
3205
  return this._ws.readyState;
2888
3206
  }
2889
- return this._options.startClosed ? _ReconnectingWebSocket.CLOSED : _ReconnectingWebSocket.CONNECTING;
3207
+ return this._options.startClosed ? _ReconnectingWebSocket.ReadyState.CLOSED : _ReconnectingWebSocket.ReadyState.CONNECTING;
2890
3208
  }
2891
3209
  /**
2892
3210
  * The URL as resolved by the constructor
@@ -3012,9 +3330,14 @@ var Deepgram = (() => {
3012
3330
  throw Error("Invalid URL");
3013
3331
  }
3014
3332
  _connect() {
3333
+ var _a;
3015
3334
  if (this._connectLock || !this._shouldReconnect) {
3016
3335
  return;
3017
3336
  }
3337
+ if ((_a = this._abortSignal) == null ? void 0 : _a.aborted) {
3338
+ this._debug("connect aborted");
3339
+ return;
3340
+ }
3018
3341
  this._connectLock = true;
3019
3342
  const {
3020
3343
  maxRetries = DEFAULT_OPTIONS.maxRetries,
@@ -3032,7 +3355,9 @@ var Deepgram = (() => {
3032
3355
  throw Error("No valid WebSocket class provided");
3033
3356
  }
3034
3357
  this._wait().then(() => this._getNextUrl(this._url)).then((url) => {
3035
- if (this._closeCalled) {
3358
+ var _a2;
3359
+ if (this._closeCalled || ((_a2 = this._abortSignal) == null ? void 0 : _a2.aborted)) {
3360
+ this._connectLock = false;
3036
3361
  return;
3037
3362
  }
3038
3363
  const options = {};
@@ -3062,6 +3387,8 @@ var Deepgram = (() => {
3062
3387
  return;
3063
3388
  }
3064
3389
  this._removeListeners();
3390
+ this._ws.addEventListener("error", () => {
3391
+ });
3065
3392
  try {
3066
3393
  this._ws.close(code, reason);
3067
3394
  this._handleClose(new CloseEvent(code, reason, this));
@@ -3109,6 +3436,14 @@ var Deepgram = (() => {
3109
3436
  _ReconnectingWebSocket.CLOSING = 2;
3110
3437
  _ReconnectingWebSocket.CLOSED = 3;
3111
3438
  var ReconnectingWebSocket = _ReconnectingWebSocket;
3439
+ ((ReconnectingWebSocket2) => {
3440
+ ReconnectingWebSocket2.ReadyState = {
3441
+ CONNECTING: 0,
3442
+ OPEN: 1,
3443
+ CLOSING: 2,
3444
+ CLOSED: 3
3445
+ };
3446
+ })(ReconnectingWebSocket || (ReconnectingWebSocket = {}));
3112
3447
 
3113
3448
  // src/auth/HeaderAuthProvider.ts
3114
3449
  var PARAM_KEY = "apiKey";
@@ -3177,9 +3512,9 @@ var Deepgram = (() => {
3177
3512
  const headers = mergeHeaders(
3178
3513
  {
3179
3514
  "X-Fern-Language": "JavaScript",
3180
- "X-Fern-SDK-Name": "",
3181
- "X-Fern-SDK-Version": "0.0.283",
3182
- "User-Agent": "/0.0.283",
3515
+ "X-Fern-SDK-Name": "@deepgram/sdk",
3516
+ "X-Fern-SDK-Version": "5.0.1",
3517
+ "User-Agent": "@deepgram/sdk/5.0.1",
3183
3518
  "X-Fern-Runtime": RUNTIME.type,
3184
3519
  "X-Fern-Runtime-Version": RUNTIME.version
3185
3520
  },
@@ -3207,13 +3542,13 @@ var Deepgram = (() => {
3207
3542
  var DeepgramEnvironment = {
3208
3543
  Production: {
3209
3544
  base: "https://api.deepgram.com",
3210
- production: "wss://api.deepgram.com",
3211
- agent: "wss://agent.deepgram.com"
3545
+ agent: "wss://agent.deepgram.com",
3546
+ production: "wss://api.deepgram.com"
3212
3547
  },
3213
3548
  Agent: {
3214
3549
  base: "https://agent.deepgram.com",
3215
- production: "wss://api.deepgram.com",
3216
- agent: "wss://agent.deepgram.com"
3550
+ agent: "wss://agent.deepgram.com",
3551
+ production: "wss://api.deepgram.com"
3217
3552
  }
3218
3553
  };
3219
3554
 
@@ -3232,11 +3567,14 @@ var Deepgram = (() => {
3232
3567
  rawResponse
3233
3568
  });
3234
3569
  case "timeout":
3235
- throw new DeepgramTimeoutError(`Timeout exceeded when calling ${method} ${path}.`);
3570
+ throw new DeepgramTimeoutError(`Timeout exceeded when calling ${method} ${path}.`, {
3571
+ cause: error.cause
3572
+ });
3236
3573
  case "unknown":
3237
3574
  throw new DeepgramError({
3238
3575
  message: error.errorMessage,
3239
- rawResponse
3576
+ rawResponse,
3577
+ cause: error.cause
3240
3578
  });
3241
3579
  default:
3242
3580
  throw new DeepgramError({
@@ -3275,7 +3613,7 @@ var Deepgram = (() => {
3275
3613
  ),
3276
3614
  method: "GET",
3277
3615
  headers: _headers,
3278
- queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
3616
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
3279
3617
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
3280
3618
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
3281
3619
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -3402,6 +3740,10 @@ var Deepgram = (() => {
3402
3740
  this.assertSocketIsOpen();
3403
3741
  this.sendJson(message);
3404
3742
  }
3743
+ sendUpdateThink(message) {
3744
+ this.assertSocketIsOpen();
3745
+ this.sendJson(message);
3746
+ }
3405
3747
  sendMedia(message) {
3406
3748
  this.assertSocketIsOpen();
3407
3749
  this.sendBinary(message);
@@ -3427,7 +3769,7 @@ var Deepgram = (() => {
3427
3769
  /** Returns a promise that resolves when the websocket is open. */
3428
3770
  waitForOpen() {
3429
3771
  return __async(this, null, function* () {
3430
- if (this.socket.readyState === ReconnectingWebSocket.OPEN) {
3772
+ if (this.socket.readyState === ReconnectingWebSocket.ReadyState.OPEN) {
3431
3773
  return this.socket;
3432
3774
  }
3433
3775
  return new Promise((resolve, reject) => {
@@ -3445,7 +3787,7 @@ var Deepgram = (() => {
3445
3787
  if (!this.socket) {
3446
3788
  throw new Error("Socket is not connected.");
3447
3789
  }
3448
- if (this.socket.readyState !== ReconnectingWebSocket.OPEN) {
3790
+ if (this.socket.readyState !== ReconnectingWebSocket.ReadyState.OPEN) {
3449
3791
  throw new Error("Socket is not open.");
3450
3792
  }
3451
3793
  }
@@ -3471,21 +3813,27 @@ var Deepgram = (() => {
3471
3813
  }
3472
3814
  connect(args) {
3473
3815
  return __async(this, null, function* () {
3474
- var _a, _b;
3475
- const { headers, debug, reconnectAttempts } = args;
3816
+ var _a, _b, _c;
3817
+ const { protocols, queryParams, headers, debug, reconnectAttempts, connectionTimeoutInSeconds, abortSignal } = args;
3476
3818
  const _headers = mergeHeaders(
3819
+ (_a = this._options) == null ? void 0 : _a.headers,
3477
3820
  mergeOnlyDefinedHeaders({ Authorization: args.Authorization }),
3478
3821
  headers
3479
3822
  );
3480
3823
  const socket = new ReconnectingWebSocket({
3481
3824
  url: url_exports.join(
3482
- (_b = yield Supplier.get(this._options.baseUrl)) != null ? _b : ((_a = yield Supplier.get(this._options.environment)) != null ? _a : DeepgramEnvironment.Production).agent,
3825
+ (_c = yield Supplier.get(this._options.baseUrl)) != null ? _c : ((_b = yield Supplier.get(this._options.environment)) != null ? _b : DeepgramEnvironment.Production).agent,
3483
3826
  "/v1/agent/converse"
3484
3827
  ),
3485
- protocols: [],
3486
- queryParameters: {},
3828
+ protocols: protocols != null ? protocols : [],
3829
+ queryParameters: queryParams != null ? queryParams : {},
3487
3830
  headers: _headers,
3488
- options: { debug: debug != null ? debug : false, maxRetries: reconnectAttempts != null ? reconnectAttempts : 30 }
3831
+ options: {
3832
+ debug: debug != null ? debug : false,
3833
+ maxRetries: reconnectAttempts != null ? reconnectAttempts : 30,
3834
+ connectionTimeout: connectionTimeoutInSeconds != null ? connectionTimeoutInSeconds * 1e3 : void 0
3835
+ },
3836
+ abortSignal
3489
3837
  });
3490
3838
  return new V1Socket({ socket });
3491
3839
  });
@@ -3539,7 +3887,7 @@ var Deepgram = (() => {
3539
3887
  method: "POST",
3540
3888
  headers: _headers,
3541
3889
  contentType: "application/json",
3542
- queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
3890
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
3543
3891
  requestType: "json",
3544
3892
  body: request,
3545
3893
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
@@ -3623,6 +3971,7 @@ var Deepgram = (() => {
3623
3971
  * dictation: true,
3624
3972
  * encoding: "linear16",
3625
3973
  * filler_words: true,
3974
+ * keyterm: ["keyterm"],
3626
3975
  * keywords: "keywords",
3627
3976
  * language: "language",
3628
3977
  * measurements: true,
@@ -3776,7 +4125,7 @@ var Deepgram = (() => {
3776
4125
  method: "POST",
3777
4126
  headers: _headers,
3778
4127
  contentType: "application/json",
3779
- queryParameters: __spreadValues(__spreadValues({}, _queryParams), requestOptions == null ? void 0 : requestOptions.queryParams),
4128
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
3780
4129
  requestType: "json",
3781
4130
  body: _body,
3782
4131
  timeoutMs: ((_h = (_g = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _g : (_f = this._options) == null ? void 0 : _f.timeoutInSeconds) != null ? _h : 60) * 1e3,
@@ -3879,7 +4228,7 @@ var Deepgram = (() => {
3879
4228
  method: "POST",
3880
4229
  headers: _headers,
3881
4230
  contentType: "application/octet-stream",
3882
- queryParameters: __spreadValues(__spreadValues({}, _queryParams), requestOptions == null ? void 0 : requestOptions.queryParams),
4231
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
3883
4232
  requestType: "bytes",
3884
4233
  duplex: "half",
3885
4234
  body: _binaryUploadRequest.body,
@@ -3994,7 +4343,7 @@ var Deepgram = (() => {
3994
4343
  /** Returns a promise that resolves when the websocket is open. */
3995
4344
  waitForOpen() {
3996
4345
  return __async(this, null, function* () {
3997
- if (this.socket.readyState === ReconnectingWebSocket.OPEN) {
4346
+ if (this.socket.readyState === ReconnectingWebSocket.ReadyState.OPEN) {
3998
4347
  return this.socket;
3999
4348
  }
4000
4349
  return new Promise((resolve, reject) => {
@@ -4012,7 +4361,7 @@ var Deepgram = (() => {
4012
4361
  if (!this.socket) {
4013
4362
  throw new Error("Socket is not connected.");
4014
4363
  }
4015
- if (this.socket.readyState !== ReconnectingWebSocket.OPEN) {
4364
+ if (this.socket.readyState !== ReconnectingWebSocket.ReadyState.OPEN) {
4016
4365
  throw new Error("Socket is not open.");
4017
4366
  }
4018
4367
  }
@@ -4038,7 +4387,7 @@ var Deepgram = (() => {
4038
4387
  }
4039
4388
  connect(args) {
4040
4389
  return __async(this, null, function* () {
4041
- var _a, _b;
4390
+ var _a, _b, _c;
4042
4391
  const {
4043
4392
  callback,
4044
4393
  callback_method: callbackMethod,
@@ -4068,53 +4417,63 @@ var Deepgram = (() => {
4068
4417
  utterance_end_ms: utteranceEndMs,
4069
4418
  vad_events: vadEvents,
4070
4419
  version,
4420
+ protocols,
4421
+ queryParams,
4071
4422
  headers,
4072
4423
  debug,
4073
- reconnectAttempts
4424
+ reconnectAttempts,
4425
+ connectionTimeoutInSeconds,
4426
+ abortSignal
4074
4427
  } = args;
4075
4428
  const _queryParams = {
4076
- callback,
4077
- callback_method: callbackMethod,
4078
- channels,
4079
- detect_entities: detectEntities,
4080
- diarize,
4081
- dictation,
4082
- encoding,
4083
- endpointing,
4084
- extra,
4085
- interim_results: interimResults,
4086
- keyterm,
4087
- keywords,
4088
- language,
4089
- mip_opt_out: mipOptOut,
4429
+ callback: callback != null ? typeof callback === "string" ? callback : toJson(callback) : void 0,
4430
+ callback_method: callbackMethod != null ? callbackMethod : void 0,
4431
+ channels: channels != null ? typeof channels === "string" ? channels : toJson(channels) : void 0,
4432
+ detect_entities: detectEntities != null ? detectEntities : void 0,
4433
+ diarize: diarize != null ? diarize : void 0,
4434
+ dictation: dictation != null ? dictation : void 0,
4435
+ encoding: encoding != null ? encoding : void 0,
4436
+ endpointing: endpointing != null ? typeof endpointing === "string" ? endpointing : toJson(endpointing) : void 0,
4437
+ extra: extra != null ? typeof extra === "string" ? extra : toJson(extra) : void 0,
4438
+ interim_results: interimResults != null ? interimResults : void 0,
4439
+ keyterm: keyterm != null ? typeof keyterm === "string" ? keyterm : toJson(keyterm) : void 0,
4440
+ keywords: keywords != null ? typeof keywords === "string" ? keywords : toJson(keywords) : void 0,
4441
+ language: language != null ? typeof language === "string" ? language : toJson(language) : void 0,
4442
+ mip_opt_out: mipOptOut != null ? typeof mipOptOut === "string" ? mipOptOut : toJson(mipOptOut) : void 0,
4090
4443
  model,
4091
- multichannel,
4092
- numerals,
4093
- profanity_filter: profanityFilter,
4094
- punctuate,
4095
- redact,
4096
- replace,
4097
- sample_rate: sampleRate,
4098
- search,
4099
- smart_format: smartFormat,
4100
- tag,
4101
- utterance_end_ms: utteranceEndMs,
4102
- vad_events: vadEvents,
4103
- version
4444
+ multichannel: multichannel != null ? multichannel : void 0,
4445
+ numerals: numerals != null ? numerals : void 0,
4446
+ profanity_filter: profanityFilter != null ? profanityFilter : void 0,
4447
+ punctuate: punctuate != null ? punctuate : void 0,
4448
+ redact: redact != null ? redact : void 0,
4449
+ replace: replace != null ? typeof replace === "string" ? replace : toJson(replace) : void 0,
4450
+ sample_rate: sampleRate != null ? typeof sampleRate === "string" ? sampleRate : toJson(sampleRate) : void 0,
4451
+ search: search != null ? typeof search === "string" ? search : toJson(search) : void 0,
4452
+ smart_format: smartFormat != null ? smartFormat : void 0,
4453
+ tag: tag != null ? typeof tag === "string" ? tag : toJson(tag) : void 0,
4454
+ utterance_end_ms: utteranceEndMs != null ? typeof utteranceEndMs === "string" ? utteranceEndMs : toJson(utteranceEndMs) : void 0,
4455
+ vad_events: vadEvents != null ? vadEvents : void 0,
4456
+ version: version != null ? typeof version === "string" ? version : toJson(version) : void 0
4104
4457
  };
4105
4458
  const _headers = mergeHeaders(
4459
+ (_a = this._options) == null ? void 0 : _a.headers,
4106
4460
  mergeOnlyDefinedHeaders({ Authorization: args.Authorization }),
4107
4461
  headers
4108
4462
  );
4109
4463
  const socket = new ReconnectingWebSocket({
4110
4464
  url: url_exports.join(
4111
- (_b = yield Supplier.get(this._options.baseUrl)) != null ? _b : ((_a = yield Supplier.get(this._options.environment)) != null ? _a : DeepgramEnvironment.Production).production,
4465
+ (_c = yield Supplier.get(this._options.baseUrl)) != null ? _c : ((_b = yield Supplier.get(this._options.environment)) != null ? _b : DeepgramEnvironment.Production).production,
4112
4466
  "/v1/listen"
4113
4467
  ),
4114
- protocols: [],
4115
- queryParameters: _queryParams,
4468
+ protocols: protocols != null ? protocols : [],
4469
+ queryParameters: __spreadValues(__spreadValues({}, _queryParams), queryParams),
4116
4470
  headers: _headers,
4117
- options: { debug: debug != null ? debug : false, maxRetries: reconnectAttempts != null ? reconnectAttempts : 30 }
4471
+ options: {
4472
+ debug: debug != null ? debug : false,
4473
+ maxRetries: reconnectAttempts != null ? reconnectAttempts : 30,
4474
+ connectionTimeout: connectionTimeoutInSeconds != null ? connectionTimeoutInSeconds * 1e3 : void 0
4475
+ },
4476
+ abortSignal
4118
4477
  });
4119
4478
  return new V1Socket2({ socket });
4120
4479
  });
@@ -4174,6 +4533,10 @@ var Deepgram = (() => {
4174
4533
  this.assertSocketIsOpen();
4175
4534
  this.sendJson(message);
4176
4535
  }
4536
+ sendConfigure(message) {
4537
+ this.assertSocketIsOpen();
4538
+ this.sendJson(message);
4539
+ }
4177
4540
  /** Connect to the websocket and register event handlers. */
4178
4541
  connect() {
4179
4542
  this.socket.reconnect();
@@ -4195,7 +4558,7 @@ var Deepgram = (() => {
4195
4558
  /** Returns a promise that resolves when the websocket is open. */
4196
4559
  waitForOpen() {
4197
4560
  return __async(this, null, function* () {
4198
- if (this.socket.readyState === ReconnectingWebSocket.OPEN) {
4561
+ if (this.socket.readyState === ReconnectingWebSocket.ReadyState.OPEN) {
4199
4562
  return this.socket;
4200
4563
  }
4201
4564
  return new Promise((resolve, reject) => {
@@ -4213,7 +4576,7 @@ var Deepgram = (() => {
4213
4576
  if (!this.socket) {
4214
4577
  throw new Error("Socket is not connected.");
4215
4578
  }
4216
- if (this.socket.readyState !== ReconnectingWebSocket.OPEN) {
4579
+ if (this.socket.readyState !== ReconnectingWebSocket.ReadyState.OPEN) {
4217
4580
  throw new Error("Socket is not open.");
4218
4581
  }
4219
4582
  }
@@ -4235,7 +4598,7 @@ var Deepgram = (() => {
4235
4598
  }
4236
4599
  connect(args) {
4237
4600
  return __async(this, null, function* () {
4238
- var _a, _b;
4601
+ var _a, _b, _c;
4239
4602
  const {
4240
4603
  model,
4241
4604
  encoding,
@@ -4246,34 +4609,44 @@ var Deepgram = (() => {
4246
4609
  keyterm,
4247
4610
  mip_opt_out: mipOptOut,
4248
4611
  tag,
4612
+ protocols,
4613
+ queryParams,
4249
4614
  headers,
4250
4615
  debug,
4251
- reconnectAttempts
4616
+ reconnectAttempts,
4617
+ connectionTimeoutInSeconds,
4618
+ abortSignal
4252
4619
  } = args;
4253
4620
  const _queryParams = {
4254
4621
  model,
4255
- encoding,
4256
- sample_rate: sampleRate,
4257
- eager_eot_threshold: eagerEotThreshold,
4258
- eot_threshold: eotThreshold,
4259
- eot_timeout_ms: eotTimeoutMs,
4260
- keyterm,
4261
- mip_opt_out: mipOptOut,
4262
- tag
4622
+ encoding: encoding != null ? encoding : void 0,
4623
+ sample_rate: sampleRate != null ? typeof sampleRate === "string" ? sampleRate : toJson(sampleRate) : void 0,
4624
+ eager_eot_threshold: eagerEotThreshold != null ? typeof eagerEotThreshold === "string" ? eagerEotThreshold : toJson(eagerEotThreshold) : void 0,
4625
+ eot_threshold: eotThreshold != null ? typeof eotThreshold === "string" ? eotThreshold : toJson(eotThreshold) : void 0,
4626
+ eot_timeout_ms: eotTimeoutMs != null ? typeof eotTimeoutMs === "string" ? eotTimeoutMs : toJson(eotTimeoutMs) : void 0,
4627
+ keyterm: keyterm != null ? typeof keyterm === "string" ? keyterm : toJson(keyterm) : void 0,
4628
+ mip_opt_out: mipOptOut != null ? typeof mipOptOut === "string" ? mipOptOut : toJson(mipOptOut) : void 0,
4629
+ tag: tag != null ? typeof tag === "string" ? tag : toJson(tag) : void 0
4263
4630
  };
4264
4631
  const _headers = mergeHeaders(
4632
+ (_a = this._options) == null ? void 0 : _a.headers,
4265
4633
  mergeOnlyDefinedHeaders({ Authorization: args.Authorization }),
4266
4634
  headers
4267
4635
  );
4268
4636
  const socket = new ReconnectingWebSocket({
4269
4637
  url: url_exports.join(
4270
- (_b = yield Supplier.get(this._options.baseUrl)) != null ? _b : ((_a = yield Supplier.get(this._options.environment)) != null ? _a : DeepgramEnvironment.Production).production,
4638
+ (_c = yield Supplier.get(this._options.baseUrl)) != null ? _c : ((_b = yield Supplier.get(this._options.environment)) != null ? _b : DeepgramEnvironment.Production).production,
4271
4639
  "/v2/listen"
4272
4640
  ),
4273
- protocols: [],
4274
- queryParameters: _queryParams,
4641
+ protocols: protocols != null ? protocols : [],
4642
+ queryParameters: __spreadValues(__spreadValues({}, _queryParams), queryParams),
4275
4643
  headers: _headers,
4276
- options: { debug: debug != null ? debug : false, maxRetries: reconnectAttempts != null ? reconnectAttempts : 30 }
4644
+ options: {
4645
+ debug: debug != null ? debug : false,
4646
+ maxRetries: reconnectAttempts != null ? reconnectAttempts : 30,
4647
+ connectionTimeout: connectionTimeoutInSeconds != null ? connectionTimeoutInSeconds * 1e3 : void 0
4648
+ },
4649
+ abortSignal
4277
4650
  });
4278
4651
  return new V2Socket({ socket });
4279
4652
  });
@@ -4336,7 +4709,7 @@ var Deepgram = (() => {
4336
4709
  ),
4337
4710
  method: "GET",
4338
4711
  headers: _headers,
4339
- queryParameters: __spreadValues(__spreadValues({}, _queryParams), requestOptions == null ? void 0 : requestOptions.queryParams),
4712
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
4340
4713
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
4341
4714
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
4342
4715
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -4391,7 +4764,7 @@ var Deepgram = (() => {
4391
4764
  ),
4392
4765
  method: "GET",
4393
4766
  headers: _headers,
4394
- queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
4767
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
4395
4768
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
4396
4769
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
4397
4770
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -4453,7 +4826,7 @@ var Deepgram = (() => {
4453
4826
  ),
4454
4827
  method: "GET",
4455
4828
  headers: _headers,
4456
- queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
4829
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
4457
4830
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
4458
4831
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
4459
4832
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -4517,7 +4890,7 @@ var Deepgram = (() => {
4517
4890
  ),
4518
4891
  method: "GET",
4519
4892
  headers: _headers,
4520
- queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
4893
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
4521
4894
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
4522
4895
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
4523
4896
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -4570,7 +4943,8 @@ var Deepgram = (() => {
4570
4943
  * accessor: "12345678-1234-1234-1234-123456789012",
4571
4944
  * deployment: "hosted",
4572
4945
  * tag: "tag1",
4573
- * line_item: "streaming::nova-3"
4946
+ * line_item: "streaming::nova-3",
4947
+ * grouping: ["deployment", "line_item"]
4574
4948
  * })
4575
4949
  */
4576
4950
  list(project_id, request = {}, requestOptions) {
@@ -4602,7 +4976,7 @@ var Deepgram = (() => {
4602
4976
  ),
4603
4977
  method: "GET",
4604
4978
  headers: _headers,
4605
- queryParameters: __spreadValues(__spreadValues({}, _queryParams), requestOptions == null ? void 0 : requestOptions.queryParams),
4979
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
4606
4980
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
4607
4981
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
4608
4982
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -4678,7 +5052,7 @@ var Deepgram = (() => {
4678
5052
  ),
4679
5053
  method: "GET",
4680
5054
  headers: _headers,
4681
- queryParameters: __spreadValues(__spreadValues({}, _queryParams), requestOptions == null ? void 0 : requestOptions.queryParams),
5055
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
4682
5056
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
4683
5057
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
4684
5058
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -4752,7 +5126,7 @@ var Deepgram = (() => {
4752
5126
  ),
4753
5127
  method: "GET",
4754
5128
  headers: _headers,
4755
- queryParameters: __spreadValues(__spreadValues({}, _queryParams), requestOptions == null ? void 0 : requestOptions.queryParams),
5129
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
4756
5130
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
4757
5131
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
4758
5132
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -4852,7 +5226,7 @@ var Deepgram = (() => {
4852
5226
  ),
4853
5227
  method: "GET",
4854
5228
  headers: _headers,
4855
- queryParameters: __spreadValues(__spreadValues({}, _queryParams), requestOptions == null ? void 0 : requestOptions.queryParams),
5229
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
4856
5230
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
4857
5231
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
4858
5232
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -4916,7 +5290,7 @@ var Deepgram = (() => {
4916
5290
  method: "POST",
4917
5291
  headers: _headers,
4918
5292
  contentType: "application/json",
4919
- queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
5293
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
4920
5294
  requestType: "json",
4921
5295
  body: request,
4922
5296
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
@@ -4979,7 +5353,7 @@ var Deepgram = (() => {
4979
5353
  ),
4980
5354
  method: "GET",
4981
5355
  headers: _headers,
4982
- queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
5356
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
4983
5357
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
4984
5358
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
4985
5359
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -5040,7 +5414,7 @@ var Deepgram = (() => {
5040
5414
  ),
5041
5415
  method: "DELETE",
5042
5416
  headers: _headers,
5043
- queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
5417
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
5044
5418
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
5045
5419
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
5046
5420
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -5107,7 +5481,7 @@ var Deepgram = (() => {
5107
5481
  ),
5108
5482
  method: "GET",
5109
5483
  headers: _headers,
5110
- queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
5484
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
5111
5485
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
5112
5486
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
5113
5487
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -5175,7 +5549,7 @@ var Deepgram = (() => {
5175
5549
  method: "POST",
5176
5550
  headers: _headers,
5177
5551
  contentType: "application/json",
5178
- queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
5552
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
5179
5553
  requestType: "json",
5180
5554
  body: request,
5181
5555
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
@@ -5241,7 +5615,7 @@ var Deepgram = (() => {
5241
5615
  ),
5242
5616
  method: "DELETE",
5243
5617
  headers: _headers,
5244
- queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
5618
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
5245
5619
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
5246
5620
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
5247
5621
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -5312,7 +5686,7 @@ var Deepgram = (() => {
5312
5686
  ),
5313
5687
  method: "GET",
5314
5688
  headers: _headers,
5315
- queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
5689
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
5316
5690
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
5317
5691
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
5318
5692
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -5380,7 +5754,7 @@ var Deepgram = (() => {
5380
5754
  method: "PUT",
5381
5755
  headers: _headers,
5382
5756
  contentType: "application/json",
5383
- queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
5757
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
5384
5758
  requestType: "json",
5385
5759
  body: request,
5386
5760
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
@@ -5460,7 +5834,7 @@ var Deepgram = (() => {
5460
5834
  ),
5461
5835
  method: "GET",
5462
5836
  headers: _headers,
5463
- queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
5837
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
5464
5838
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
5465
5839
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
5466
5840
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -5524,7 +5898,7 @@ var Deepgram = (() => {
5524
5898
  ),
5525
5899
  method: "DELETE",
5526
5900
  headers: _headers,
5527
- queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
5901
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
5528
5902
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
5529
5903
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
5530
5904
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -5601,7 +5975,7 @@ var Deepgram = (() => {
5601
5975
  ),
5602
5976
  method: "GET",
5603
5977
  headers: _headers,
5604
- queryParameters: __spreadValues(__spreadValues({}, _queryParams), requestOptions == null ? void 0 : requestOptions.queryParams),
5978
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
5605
5979
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
5606
5980
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
5607
5981
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -5662,7 +6036,7 @@ var Deepgram = (() => {
5662
6036
  ),
5663
6037
  method: "GET",
5664
6038
  headers: _headers,
5665
- queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
6039
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
5666
6040
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
5667
6041
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
5668
6042
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -5765,7 +6139,7 @@ var Deepgram = (() => {
5765
6139
  ),
5766
6140
  method: "GET",
5767
6141
  headers: _headers,
5768
- queryParameters: __spreadValues(__spreadValues({}, _queryParams), requestOptions == null ? void 0 : requestOptions.queryParams),
6142
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
5769
6143
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
5770
6144
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
5771
6145
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -5829,7 +6203,7 @@ var Deepgram = (() => {
5829
6203
  ),
5830
6204
  method: "GET",
5831
6205
  headers: _headers,
5832
- queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
6206
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
5833
6207
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
5834
6208
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
5835
6209
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -6037,7 +6411,7 @@ var Deepgram = (() => {
6037
6411
  ),
6038
6412
  method: "GET",
6039
6413
  headers: _headers,
6040
- queryParameters: __spreadValues(__spreadValues({}, _queryParams), requestOptions == null ? void 0 : requestOptions.queryParams),
6414
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
6041
6415
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
6042
6416
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
6043
6417
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -6113,7 +6487,7 @@ var Deepgram = (() => {
6113
6487
  ),
6114
6488
  method: "GET",
6115
6489
  headers: _headers,
6116
- queryParameters: __spreadValues(__spreadValues({}, _queryParams), requestOptions == null ? void 0 : requestOptions.queryParams),
6490
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
6117
6491
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
6118
6492
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
6119
6493
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -6159,6 +6533,8 @@ var Deepgram = (() => {
6159
6533
  return (_a = this._fields) != null ? _a : this._fields = new FieldsClient2(this._options);
6160
6534
  }
6161
6535
  /**
6536
+ * @deprecated
6537
+ *
6162
6538
  * Retrieves the usage for a specific project. Use Get Project Usage Breakdown for a more comprehensive usage summary.
6163
6539
  *
6164
6540
  * @param {string} project_id - The unique identifier of the project
@@ -6326,7 +6702,7 @@ var Deepgram = (() => {
6326
6702
  ),
6327
6703
  method: "GET",
6328
6704
  headers: _headers,
6329
- queryParameters: __spreadValues(__spreadValues({}, _queryParams), requestOptions == null ? void 0 : requestOptions.queryParams),
6705
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
6330
6706
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
6331
6707
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
6332
6708
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -6416,7 +6792,7 @@ var Deepgram = (() => {
6416
6792
  ),
6417
6793
  method: "GET",
6418
6794
  headers: _headers,
6419
- queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
6795
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
6420
6796
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
6421
6797
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
6422
6798
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -6480,7 +6856,7 @@ var Deepgram = (() => {
6480
6856
  ),
6481
6857
  method: "GET",
6482
6858
  headers: _headers,
6483
- queryParameters: __spreadValues(__spreadValues({}, _queryParams), requestOptions == null ? void 0 : requestOptions.queryParams),
6859
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
6484
6860
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
6485
6861
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
6486
6862
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -6535,7 +6911,7 @@ var Deepgram = (() => {
6535
6911
  ),
6536
6912
  method: "DELETE",
6537
6913
  headers: _headers,
6538
- queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
6914
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
6539
6915
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
6540
6916
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
6541
6917
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -6592,7 +6968,7 @@ var Deepgram = (() => {
6592
6968
  method: "PATCH",
6593
6969
  headers: _headers,
6594
6970
  contentType: "application/json",
6595
- queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
6971
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
6596
6972
  requestType: "json",
6597
6973
  body: request,
6598
6974
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
@@ -6649,7 +7025,7 @@ var Deepgram = (() => {
6649
7025
  ),
6650
7026
  method: "DELETE",
6651
7027
  headers: _headers,
6652
- queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
7028
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
6653
7029
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
6654
7030
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
6655
7031
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -6788,7 +7164,7 @@ var Deepgram = (() => {
6788
7164
  method: "POST",
6789
7165
  headers: _headers,
6790
7166
  contentType: "application/json",
6791
- queryParameters: __spreadValues(__spreadValues({}, _queryParams), requestOptions == null ? void 0 : requestOptions.queryParams),
7167
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
6792
7168
  requestType: "json",
6793
7169
  body: _body,
6794
7170
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
@@ -6874,7 +7250,7 @@ var Deepgram = (() => {
6874
7250
  ),
6875
7251
  method: "GET",
6876
7252
  headers: _headers,
6877
- queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
7253
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
6878
7254
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
6879
7255
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
6880
7256
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -6918,6 +7294,7 @@ var Deepgram = (() => {
6918
7294
  *
6919
7295
  * @example
6920
7296
  * await client.selfHosted.v1.distributionCredentials.create("123456-7890-1234-5678-901234", {
7297
+ * scopes: ["self-hosted:products"],
6921
7298
  * provider: "quay"
6922
7299
  * })
6923
7300
  */
@@ -6946,7 +7323,7 @@ var Deepgram = (() => {
6946
7323
  method: "POST",
6947
7324
  headers: _headers,
6948
7325
  contentType: "application/json",
6949
- queryParameters: __spreadValues(__spreadValues({}, _queryParams), requestOptions == null ? void 0 : requestOptions.queryParams),
7326
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
6950
7327
  requestType: "json",
6951
7328
  body: _body,
6952
7329
  timeoutMs: ((_h = (_g = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _g : (_f = this._options) == null ? void 0 : _f.timeoutInSeconds) != null ? _h : 60) * 1e3,
@@ -7014,7 +7391,7 @@ var Deepgram = (() => {
7014
7391
  ),
7015
7392
  method: "GET",
7016
7393
  headers: _headers,
7017
- queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
7394
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
7018
7395
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
7019
7396
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
7020
7397
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -7080,7 +7457,7 @@ var Deepgram = (() => {
7080
7457
  ),
7081
7458
  method: "DELETE",
7082
7459
  headers: _headers,
7083
- queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
7460
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
7084
7461
  timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
7085
7462
  maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
7086
7463
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
@@ -7144,6 +7521,7 @@ var Deepgram = (() => {
7144
7521
  }
7145
7522
  /**
7146
7523
  * Convert text into natural-sounding speech using Deepgram's TTS REST API
7524
+ *
7147
7525
  * @throws {@link Deepgram.BadRequestError}
7148
7526
  */
7149
7527
  generate(request, requestOptions) {
@@ -7161,7 +7539,8 @@ var Deepgram = (() => {
7161
7539
  container,
7162
7540
  encoding,
7163
7541
  model,
7164
- sample_rate: sampleRate
7542
+ sample_rate: sampleRate,
7543
+ speed
7165
7544
  } = _a, _body = __objRest(_a, [
7166
7545
  "callback",
7167
7546
  "callback_method",
@@ -7171,7 +7550,8 @@ var Deepgram = (() => {
7171
7550
  "container",
7172
7551
  "encoding",
7173
7552
  "model",
7174
- "sample_rate"
7553
+ "sample_rate",
7554
+ "speed"
7175
7555
  ]);
7176
7556
  const _queryParams = {
7177
7557
  callback,
@@ -7182,7 +7562,8 @@ var Deepgram = (() => {
7182
7562
  container: container != null ? container : void 0,
7183
7563
  encoding: encoding != null ? encoding : void 0,
7184
7564
  model: model != null ? model : void 0,
7185
- sample_rate: sampleRate
7565
+ sample_rate: sampleRate,
7566
+ speed
7186
7567
  };
7187
7568
  const _authRequest = yield this._options.authProvider.getAuthRequest();
7188
7569
  const _headers = mergeHeaders(
@@ -7198,7 +7579,7 @@ var Deepgram = (() => {
7198
7579
  method: "POST",
7199
7580
  headers: _headers,
7200
7581
  contentType: "application/json",
7201
- queryParameters: __spreadValues(__spreadValues({}, _queryParams), requestOptions == null ? void 0 : requestOptions.queryParams),
7582
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
7202
7583
  requestType: "json",
7203
7584
  body: _body,
7204
7585
  responseType: "binary-response",
@@ -7310,7 +7691,7 @@ var Deepgram = (() => {
7310
7691
  /** Returns a promise that resolves when the websocket is open. */
7311
7692
  waitForOpen() {
7312
7693
  return __async(this, null, function* () {
7313
- if (this.socket.readyState === ReconnectingWebSocket.OPEN) {
7694
+ if (this.socket.readyState === ReconnectingWebSocket.ReadyState.OPEN) {
7314
7695
  return this.socket;
7315
7696
  }
7316
7697
  return new Promise((resolve, reject) => {
@@ -7328,7 +7709,7 @@ var Deepgram = (() => {
7328
7709
  if (!this.socket) {
7329
7710
  throw new Error("Socket is not connected.");
7330
7711
  }
7331
- if (this.socket.readyState !== ReconnectingWebSocket.OPEN) {
7712
+ if (this.socket.readyState !== ReconnectingWebSocket.ReadyState.OPEN) {
7332
7713
  throw new Error("Socket is not open.");
7333
7714
  }
7334
7715
  }
@@ -7354,35 +7735,47 @@ var Deepgram = (() => {
7354
7735
  }
7355
7736
  connect(args) {
7356
7737
  return __async(this, null, function* () {
7357
- var _a, _b;
7738
+ var _a, _b, _c;
7358
7739
  const {
7359
7740
  encoding,
7360
7741
  mip_opt_out: mipOptOut,
7361
7742
  model,
7362
7743
  sample_rate: sampleRate,
7744
+ speed,
7745
+ protocols,
7746
+ queryParams,
7363
7747
  headers,
7364
7748
  debug,
7365
- reconnectAttempts
7749
+ reconnectAttempts,
7750
+ connectionTimeoutInSeconds,
7751
+ abortSignal
7366
7752
  } = args;
7367
7753
  const _queryParams = {
7368
- encoding,
7369
- mip_opt_out: mipOptOut,
7370
- model,
7371
- sample_rate: sampleRate
7754
+ encoding: encoding != null ? encoding : void 0,
7755
+ mip_opt_out: mipOptOut != null ? typeof mipOptOut === "string" ? mipOptOut : toJson(mipOptOut) : void 0,
7756
+ model: model != null ? model : void 0,
7757
+ sample_rate: sampleRate != null ? sampleRate : void 0,
7758
+ speed
7372
7759
  };
7373
7760
  const _headers = mergeHeaders(
7761
+ (_a = this._options) == null ? void 0 : _a.headers,
7374
7762
  mergeOnlyDefinedHeaders({ Authorization: args.Authorization }),
7375
7763
  headers
7376
7764
  );
7377
7765
  const socket = new ReconnectingWebSocket({
7378
7766
  url: url_exports.join(
7379
- (_b = yield Supplier.get(this._options.baseUrl)) != null ? _b : ((_a = yield Supplier.get(this._options.environment)) != null ? _a : DeepgramEnvironment.Production).production,
7767
+ (_c = yield Supplier.get(this._options.baseUrl)) != null ? _c : ((_b = yield Supplier.get(this._options.environment)) != null ? _b : DeepgramEnvironment.Production).production,
7380
7768
  "/v1/speak"
7381
7769
  ),
7382
- protocols: [],
7383
- queryParameters: _queryParams,
7770
+ protocols: protocols != null ? protocols : [],
7771
+ queryParameters: __spreadValues(__spreadValues({}, _queryParams), queryParams),
7384
7772
  headers: _headers,
7385
- options: { debug: debug != null ? debug : false, maxRetries: reconnectAttempts != null ? reconnectAttempts : 30 }
7773
+ options: {
7774
+ debug: debug != null ? debug : false,
7775
+ maxRetries: reconnectAttempts != null ? reconnectAttempts : 30,
7776
+ connectionTimeout: connectionTimeoutInSeconds != null ? connectionTimeoutInSeconds * 1e3 : void 0
7777
+ },
7778
+ abortSignal
7386
7779
  });
7387
7780
  return new V1Socket3({ socket });
7388
7781
  });
@@ -7400,123 +7793,866 @@ var Deepgram = (() => {
7400
7793
  }
7401
7794
  };
7402
7795
 
7403
- // src/Client.ts
7404
- var DeepgramClient = class {
7796
+ // src/api/resources/voiceAgent/resources/configurations/client/Client.ts
7797
+ var ConfigurationsClient = class {
7405
7798
  constructor(options = {}) {
7406
7799
  this._options = normalizeClientOptionsWithAuth(options);
7407
7800
  }
7408
- get agent() {
7409
- var _a;
7410
- return (_a = this._agent) != null ? _a : this._agent = new AgentClient(this._options);
7411
- }
7412
- get auth() {
7413
- var _a;
7414
- return (_a = this._auth) != null ? _a : this._auth = new AuthClient(this._options);
7415
- }
7416
- get listen() {
7417
- var _a;
7418
- return (_a = this._listen) != null ? _a : this._listen = new ListenClient(this._options);
7419
- }
7420
- get manage() {
7421
- var _a;
7422
- return (_a = this._manage) != null ? _a : this._manage = new ManageClient(this._options);
7423
- }
7424
- get read() {
7425
- var _a;
7426
- return (_a = this._read) != null ? _a : this._read = new ReadClient(this._options);
7427
- }
7428
- get selfHosted() {
7429
- var _a;
7430
- return (_a = this._selfHosted) != null ? _a : this._selfHosted = new SelfHostedClient(this._options);
7431
- }
7432
- get speak() {
7433
- var _a;
7434
- return (_a = this._speak) != null ? _a : this._speak = new SpeakClient(this._options);
7435
- }
7436
- };
7437
-
7438
- // src/CustomClient.ts
7439
- var DEFAULT_CONNECTION_TIMEOUT_MS = 1e4;
7440
- var NodeWebSocket2;
7441
- try {
7442
- NodeWebSocket2 = require_browser();
7443
- NodeWebSocket2 = NodeWebSocket2.WebSocket || NodeWebSocket2.default || NodeWebSocket2;
7444
- } catch (e) {
7445
- NodeWebSocket2 = void 0;
7446
- }
7447
- function generateUUID() {
7448
- if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
7449
- return crypto.randomUUID();
7450
- }
7451
- if (RUNTIME.type === "node") {
7452
- try {
7453
- const nodeCrypto = __require("crypto");
7454
- return nodeCrypto.randomUUID();
7455
- } catch (e) {
7456
- }
7457
- }
7458
- return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
7459
- const r = Math.random() * 16 | 0;
7460
- const v = c === "x" ? r : r & 3 | 8;
7461
- return v.toString(16);
7462
- });
7463
- }
7464
- var ApiKeyAuthProviderWrapper = class {
7465
- constructor(originalProvider) {
7466
- this.originalProvider = originalProvider;
7801
+ /**
7802
+ * Returns all agent configurations for the specified project. Configurations are returned in their uninterpolated form—template variable placeholders appear as-is rather than with their substituted values.
7803
+ *
7804
+ * @param {string} project_id - The unique identifier of the project
7805
+ * @param {ConfigurationsClient.RequestOptions} requestOptions - Request-specific configuration.
7806
+ *
7807
+ * @throws {@link Deepgram.BadRequestError}
7808
+ *
7809
+ * @example
7810
+ * await client.voiceAgent.configurations.list("123456-7890-1234-5678-901234")
7811
+ */
7812
+ list(project_id, requestOptions) {
7813
+ return HttpResponsePromise.fromPromise(this.__list(project_id, requestOptions));
7467
7814
  }
7468
- getAuthRequest(arg) {
7815
+ __list(project_id, requestOptions) {
7469
7816
  return __async(this, null, function* () {
7470
- var _a, _b;
7471
- const authRequest = yield this.originalProvider.getAuthRequest(arg);
7472
- const authHeader = ((_a = authRequest.headers) == null ? void 0 : _a.Authorization) || ((_b = authRequest.headers) == null ? void 0 : _b.authorization);
7473
- if (authHeader && typeof authHeader === "string") {
7474
- if (!authHeader.startsWith("Bearer ") && !authHeader.startsWith("Token ") && !authHeader.startsWith("token ")) {
7475
- return {
7476
- headers: __spreadProps(__spreadValues({}, authRequest.headers), {
7477
- Authorization: `Token ${authHeader}`
7478
- })
7479
- };
7817
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
7818
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
7819
+ const _headers = mergeHeaders(
7820
+ _authRequest.headers,
7821
+ (_a = this._options) == null ? void 0 : _a.headers,
7822
+ requestOptions == null ? void 0 : requestOptions.headers
7823
+ );
7824
+ const _response = yield ((_b = this._options.fetcher) != null ? _b : fetcher)({
7825
+ url: url_exports.join(
7826
+ (_d = yield Supplier.get(this._options.baseUrl)) != null ? _d : ((_c = yield Supplier.get(this._options.environment)) != null ? _c : DeepgramEnvironment.Production).base,
7827
+ `v1/projects/${url_exports.encodePathParam(project_id)}/agents`
7828
+ ),
7829
+ method: "GET",
7830
+ headers: _headers,
7831
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
7832
+ timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
7833
+ maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
7834
+ abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
7835
+ fetchFn: (_j = this._options) == null ? void 0 : _j.fetch,
7836
+ logging: this._options.logging
7837
+ });
7838
+ if (_response.ok) {
7839
+ return {
7840
+ data: _response.body,
7841
+ rawResponse: _response.rawResponse
7842
+ };
7843
+ }
7844
+ if (_response.error.reason === "status-code") {
7845
+ switch (_response.error.statusCode) {
7846
+ case 400:
7847
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
7848
+ default:
7849
+ throw new DeepgramError({
7850
+ statusCode: _response.error.statusCode,
7851
+ body: _response.error.body,
7852
+ rawResponse: _response.rawResponse
7853
+ });
7480
7854
  }
7481
7855
  }
7482
- return authRequest;
7856
+ return handleNonStatusCodeError(
7857
+ _response.error,
7858
+ _response.rawResponse,
7859
+ "GET",
7860
+ "/v1/projects/{project_id}/agents"
7861
+ );
7483
7862
  });
7484
7863
  }
7485
- };
7486
- var AccessTokenAuthProviderWrapper = class {
7487
- constructor(originalProvider, accessToken) {
7488
- this.originalProvider = originalProvider;
7489
- this.accessToken = accessToken;
7864
+ /**
7865
+ * Creates a new reusable agent configuration. The `config` field must be a valid JSON string representing the `agent` block of a Settings message. The returned `agent_id` can be passed in place of the full `agent` object in future Settings messages.
7866
+ *
7867
+ * @param {string} project_id - The unique identifier of the project
7868
+ * @param {Deepgram.voiceAgent.CreateAgentConfigurationV1Request} request
7869
+ * @param {ConfigurationsClient.RequestOptions} requestOptions - Request-specific configuration.
7870
+ *
7871
+ * @throws {@link Deepgram.BadRequestError}
7872
+ *
7873
+ * @example
7874
+ * await client.voiceAgent.configurations.create("123456-7890-1234-5678-901234", {
7875
+ * config: "config"
7876
+ * })
7877
+ */
7878
+ create(project_id, request, requestOptions) {
7879
+ return HttpResponsePromise.fromPromise(this.__create(project_id, request, requestOptions));
7490
7880
  }
7491
- getAuthRequest(arg) {
7881
+ __create(project_id, request, requestOptions) {
7492
7882
  return __async(this, null, function* () {
7493
- var _a, _b;
7494
- const accessToken = (_b = yield Supplier.get(this.accessToken)) != null ? _b : (_a = process.env) == null ? void 0 : _a.DEEPGRAM_ACCESS_TOKEN;
7495
- if (accessToken != null) {
7883
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
7884
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
7885
+ const _headers = mergeHeaders(
7886
+ _authRequest.headers,
7887
+ (_a = this._options) == null ? void 0 : _a.headers,
7888
+ requestOptions == null ? void 0 : requestOptions.headers
7889
+ );
7890
+ const _response = yield ((_b = this._options.fetcher) != null ? _b : fetcher)({
7891
+ url: url_exports.join(
7892
+ (_d = yield Supplier.get(this._options.baseUrl)) != null ? _d : ((_c = yield Supplier.get(this._options.environment)) != null ? _c : DeepgramEnvironment.Production).base,
7893
+ `v1/projects/${url_exports.encodePathParam(project_id)}/agents`
7894
+ ),
7895
+ method: "POST",
7896
+ headers: _headers,
7897
+ contentType: "application/json",
7898
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
7899
+ requestType: "json",
7900
+ body: request,
7901
+ timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
7902
+ maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
7903
+ abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
7904
+ fetchFn: (_j = this._options) == null ? void 0 : _j.fetch,
7905
+ logging: this._options.logging
7906
+ });
7907
+ if (_response.ok) {
7496
7908
  return {
7497
- headers: { Authorization: `Bearer ${accessToken}` }
7909
+ data: _response.body,
7910
+ rawResponse: _response.rawResponse
7498
7911
  };
7499
7912
  }
7500
- return this.originalProvider.getAuthRequest(arg);
7913
+ if (_response.error.reason === "status-code") {
7914
+ switch (_response.error.statusCode) {
7915
+ case 400:
7916
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
7917
+ default:
7918
+ throw new DeepgramError({
7919
+ statusCode: _response.error.statusCode,
7920
+ body: _response.error.body,
7921
+ rawResponse: _response.rawResponse
7922
+ });
7923
+ }
7924
+ }
7925
+ return handleNonStatusCodeError(
7926
+ _response.error,
7927
+ _response.rawResponse,
7928
+ "POST",
7929
+ "/v1/projects/{project_id}/agents"
7930
+ );
7501
7931
  });
7502
7932
  }
7503
- };
7504
- var CustomDeepgramClient = class extends DeepgramClient {
7505
- constructor(options = {}) {
7506
- const sessionId = generateUUID();
7507
- const optionsWithSessionId = __spreadProps(__spreadValues({}, options), {
7508
- headers: __spreadProps(__spreadValues({}, options.headers), {
7509
- "x-deepgram-session-id": sessionId
7510
- })
7511
- });
7512
- super(optionsWithSessionId);
7513
- this._sessionId = sessionId;
7514
- this._options.authProvider = new ApiKeyAuthProviderWrapper(this._options.authProvider);
7515
- if (options.accessToken != null) {
7516
- this._options.authProvider = new AccessTokenAuthProviderWrapper(
7517
- this._options.authProvider,
7518
- options.accessToken
7519
- );
7933
+ /**
7934
+ * Returns the specified agent configuration in its uninterpolated form
7935
+ *
7936
+ * @param {string} project_id - The unique identifier of the project
7937
+ * @param {string} agent_id - The unique identifier of the agent configuration
7938
+ * @param {ConfigurationsClient.RequestOptions} requestOptions - Request-specific configuration.
7939
+ *
7940
+ * @throws {@link Deepgram.BadRequestError}
7941
+ *
7942
+ * @example
7943
+ * await client.voiceAgent.configurations.get("123456-7890-1234-5678-901234", "a1b2c3d4-e5f6-7890-abcd-ef1234567890")
7944
+ */
7945
+ get(project_id, agent_id, requestOptions) {
7946
+ return HttpResponsePromise.fromPromise(this.__get(project_id, agent_id, requestOptions));
7947
+ }
7948
+ __get(project_id, agent_id, requestOptions) {
7949
+ return __async(this, null, function* () {
7950
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
7951
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
7952
+ const _headers = mergeHeaders(
7953
+ _authRequest.headers,
7954
+ (_a = this._options) == null ? void 0 : _a.headers,
7955
+ requestOptions == null ? void 0 : requestOptions.headers
7956
+ );
7957
+ const _response = yield ((_b = this._options.fetcher) != null ? _b : fetcher)({
7958
+ url: url_exports.join(
7959
+ (_d = yield Supplier.get(this._options.baseUrl)) != null ? _d : ((_c = yield Supplier.get(this._options.environment)) != null ? _c : DeepgramEnvironment.Production).base,
7960
+ `v1/projects/${url_exports.encodePathParam(project_id)}/agents/${url_exports.encodePathParam(agent_id)}`
7961
+ ),
7962
+ method: "GET",
7963
+ headers: _headers,
7964
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
7965
+ timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
7966
+ maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
7967
+ abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
7968
+ fetchFn: (_j = this._options) == null ? void 0 : _j.fetch,
7969
+ logging: this._options.logging
7970
+ });
7971
+ if (_response.ok) {
7972
+ return { data: _response.body, rawResponse: _response.rawResponse };
7973
+ }
7974
+ if (_response.error.reason === "status-code") {
7975
+ switch (_response.error.statusCode) {
7976
+ case 400:
7977
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
7978
+ default:
7979
+ throw new DeepgramError({
7980
+ statusCode: _response.error.statusCode,
7981
+ body: _response.error.body,
7982
+ rawResponse: _response.rawResponse
7983
+ });
7984
+ }
7985
+ }
7986
+ return handleNonStatusCodeError(
7987
+ _response.error,
7988
+ _response.rawResponse,
7989
+ "GET",
7990
+ "/v1/projects/{project_id}/agents/{agent_id}"
7991
+ );
7992
+ });
7993
+ }
7994
+ /**
7995
+ * Updates the metadata associated with an agent configuration. The config itself is immutable—to change the configuration, delete the existing agent and create a new one.
7996
+ *
7997
+ * @param {string} project_id - The unique identifier of the project
7998
+ * @param {string} agent_id - The unique identifier of the agent configuration
7999
+ * @param {Deepgram.voiceAgent.UpdateAgentMetadataV1Request} request
8000
+ * @param {ConfigurationsClient.RequestOptions} requestOptions - Request-specific configuration.
8001
+ *
8002
+ * @throws {@link Deepgram.BadRequestError}
8003
+ *
8004
+ * @example
8005
+ * await client.voiceAgent.configurations.update("123456-7890-1234-5678-901234", "a1b2c3d4-e5f6-7890-abcd-ef1234567890", {
8006
+ * metadata: {
8007
+ * "key": "value"
8008
+ * }
8009
+ * })
8010
+ */
8011
+ update(project_id, agent_id, request, requestOptions) {
8012
+ return HttpResponsePromise.fromPromise(this.__update(project_id, agent_id, request, requestOptions));
8013
+ }
8014
+ __update(project_id, agent_id, request, requestOptions) {
8015
+ return __async(this, null, function* () {
8016
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
8017
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
8018
+ const _headers = mergeHeaders(
8019
+ _authRequest.headers,
8020
+ (_a = this._options) == null ? void 0 : _a.headers,
8021
+ requestOptions == null ? void 0 : requestOptions.headers
8022
+ );
8023
+ const _response = yield ((_b = this._options.fetcher) != null ? _b : fetcher)({
8024
+ url: url_exports.join(
8025
+ (_d = yield Supplier.get(this._options.baseUrl)) != null ? _d : ((_c = yield Supplier.get(this._options.environment)) != null ? _c : DeepgramEnvironment.Production).base,
8026
+ `v1/projects/${url_exports.encodePathParam(project_id)}/agents/${url_exports.encodePathParam(agent_id)}`
8027
+ ),
8028
+ method: "PUT",
8029
+ headers: _headers,
8030
+ contentType: "application/json",
8031
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
8032
+ requestType: "json",
8033
+ body: request,
8034
+ timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
8035
+ maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
8036
+ abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
8037
+ fetchFn: (_j = this._options) == null ? void 0 : _j.fetch,
8038
+ logging: this._options.logging
8039
+ });
8040
+ if (_response.ok) {
8041
+ return { data: _response.body, rawResponse: _response.rawResponse };
8042
+ }
8043
+ if (_response.error.reason === "status-code") {
8044
+ switch (_response.error.statusCode) {
8045
+ case 400:
8046
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
8047
+ default:
8048
+ throw new DeepgramError({
8049
+ statusCode: _response.error.statusCode,
8050
+ body: _response.error.body,
8051
+ rawResponse: _response.rawResponse
8052
+ });
8053
+ }
8054
+ }
8055
+ return handleNonStatusCodeError(
8056
+ _response.error,
8057
+ _response.rawResponse,
8058
+ "PUT",
8059
+ "/v1/projects/{project_id}/agents/{agent_id}"
8060
+ );
8061
+ });
8062
+ }
8063
+ /**
8064
+ * Deletes the specified agent configuration. Deleting an agent configuration can cause a production outage if your service references this agent UUID. Migrate all active sessions to a new configuration before deleting.
8065
+ *
8066
+ * @param {string} project_id - The unique identifier of the project
8067
+ * @param {string} agent_id - The unique identifier of the agent configuration
8068
+ * @param {ConfigurationsClient.RequestOptions} requestOptions - Request-specific configuration.
8069
+ *
8070
+ * @throws {@link Deepgram.BadRequestError}
8071
+ *
8072
+ * @example
8073
+ * await client.voiceAgent.configurations.delete("123456-7890-1234-5678-901234", "a1b2c3d4-e5f6-7890-abcd-ef1234567890")
8074
+ */
8075
+ delete(project_id, agent_id, requestOptions) {
8076
+ return HttpResponsePromise.fromPromise(this.__delete(project_id, agent_id, requestOptions));
8077
+ }
8078
+ __delete(project_id, agent_id, requestOptions) {
8079
+ return __async(this, null, function* () {
8080
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
8081
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
8082
+ const _headers = mergeHeaders(
8083
+ _authRequest.headers,
8084
+ (_a = this._options) == null ? void 0 : _a.headers,
8085
+ requestOptions == null ? void 0 : requestOptions.headers
8086
+ );
8087
+ const _response = yield ((_b = this._options.fetcher) != null ? _b : fetcher)({
8088
+ url: url_exports.join(
8089
+ (_d = yield Supplier.get(this._options.baseUrl)) != null ? _d : ((_c = yield Supplier.get(this._options.environment)) != null ? _c : DeepgramEnvironment.Production).base,
8090
+ `v1/projects/${url_exports.encodePathParam(project_id)}/agents/${url_exports.encodePathParam(agent_id)}`
8091
+ ),
8092
+ method: "DELETE",
8093
+ headers: _headers,
8094
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
8095
+ timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
8096
+ maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
8097
+ abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
8098
+ fetchFn: (_j = this._options) == null ? void 0 : _j.fetch,
8099
+ logging: this._options.logging
8100
+ });
8101
+ if (_response.ok) {
8102
+ return {
8103
+ data: _response.body,
8104
+ rawResponse: _response.rawResponse
8105
+ };
8106
+ }
8107
+ if (_response.error.reason === "status-code") {
8108
+ switch (_response.error.statusCode) {
8109
+ case 400:
8110
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
8111
+ default:
8112
+ throw new DeepgramError({
8113
+ statusCode: _response.error.statusCode,
8114
+ body: _response.error.body,
8115
+ rawResponse: _response.rawResponse
8116
+ });
8117
+ }
8118
+ }
8119
+ return handleNonStatusCodeError(
8120
+ _response.error,
8121
+ _response.rawResponse,
8122
+ "DELETE",
8123
+ "/v1/projects/{project_id}/agents/{agent_id}"
8124
+ );
8125
+ });
8126
+ }
8127
+ };
8128
+
8129
+ // src/api/resources/voiceAgent/resources/variables/client/Client.ts
8130
+ var VariablesClient = class {
8131
+ constructor(options = {}) {
8132
+ this._options = normalizeClientOptionsWithAuth(options);
8133
+ }
8134
+ /**
8135
+ * Returns all template variables for the specified project
8136
+ *
8137
+ * @param {string} project_id - The unique identifier of the project
8138
+ * @param {VariablesClient.RequestOptions} requestOptions - Request-specific configuration.
8139
+ *
8140
+ * @throws {@link Deepgram.BadRequestError}
8141
+ *
8142
+ * @example
8143
+ * await client.voiceAgent.variables.list("123456-7890-1234-5678-901234")
8144
+ */
8145
+ list(project_id, requestOptions) {
8146
+ return HttpResponsePromise.fromPromise(this.__list(project_id, requestOptions));
8147
+ }
8148
+ __list(project_id, requestOptions) {
8149
+ return __async(this, null, function* () {
8150
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
8151
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
8152
+ const _headers = mergeHeaders(
8153
+ _authRequest.headers,
8154
+ (_a = this._options) == null ? void 0 : _a.headers,
8155
+ requestOptions == null ? void 0 : requestOptions.headers
8156
+ );
8157
+ const _response = yield ((_b = this._options.fetcher) != null ? _b : fetcher)({
8158
+ url: url_exports.join(
8159
+ (_d = yield Supplier.get(this._options.baseUrl)) != null ? _d : ((_c = yield Supplier.get(this._options.environment)) != null ? _c : DeepgramEnvironment.Production).base,
8160
+ `v1/projects/${url_exports.encodePathParam(project_id)}/agent-variables`
8161
+ ),
8162
+ method: "GET",
8163
+ headers: _headers,
8164
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
8165
+ timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
8166
+ maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
8167
+ abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
8168
+ fetchFn: (_j = this._options) == null ? void 0 : _j.fetch,
8169
+ logging: this._options.logging
8170
+ });
8171
+ if (_response.ok) {
8172
+ return {
8173
+ data: _response.body,
8174
+ rawResponse: _response.rawResponse
8175
+ };
8176
+ }
8177
+ if (_response.error.reason === "status-code") {
8178
+ switch (_response.error.statusCode) {
8179
+ case 400:
8180
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
8181
+ default:
8182
+ throw new DeepgramError({
8183
+ statusCode: _response.error.statusCode,
8184
+ body: _response.error.body,
8185
+ rawResponse: _response.rawResponse
8186
+ });
8187
+ }
8188
+ }
8189
+ return handleNonStatusCodeError(
8190
+ _response.error,
8191
+ _response.rawResponse,
8192
+ "GET",
8193
+ "/v1/projects/{project_id}/agent-variables"
8194
+ );
8195
+ });
8196
+ }
8197
+ /**
8198
+ * Creates a new template variable. Variables follow the `DG_<VARIABLE_NAME>` naming format and can substitute any JSON value in an agent configuration.
8199
+ *
8200
+ * @param {string} project_id - The unique identifier of the project
8201
+ * @param {Deepgram.voiceAgent.CreateAgentVariableV1Request} request
8202
+ * @param {VariablesClient.RequestOptions} requestOptions - Request-specific configuration.
8203
+ *
8204
+ * @throws {@link Deepgram.BadRequestError}
8205
+ *
8206
+ * @example
8207
+ * await client.voiceAgent.variables.create("project_id", {
8208
+ * key: "key",
8209
+ * value: {
8210
+ * "key": "value"
8211
+ * }
8212
+ * })
8213
+ */
8214
+ create(project_id, request, requestOptions) {
8215
+ return HttpResponsePromise.fromPromise(this.__create(project_id, request, requestOptions));
8216
+ }
8217
+ __create(project_id, request, requestOptions) {
8218
+ return __async(this, null, function* () {
8219
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
8220
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
8221
+ const _headers = mergeHeaders(
8222
+ _authRequest.headers,
8223
+ (_a = this._options) == null ? void 0 : _a.headers,
8224
+ requestOptions == null ? void 0 : requestOptions.headers
8225
+ );
8226
+ const _response = yield ((_b = this._options.fetcher) != null ? _b : fetcher)({
8227
+ url: url_exports.join(
8228
+ (_d = yield Supplier.get(this._options.baseUrl)) != null ? _d : ((_c = yield Supplier.get(this._options.environment)) != null ? _c : DeepgramEnvironment.Production).base,
8229
+ `v1/projects/${url_exports.encodePathParam(project_id)}/agent-variables`
8230
+ ),
8231
+ method: "POST",
8232
+ headers: _headers,
8233
+ contentType: "application/json",
8234
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
8235
+ requestType: "json",
8236
+ body: request,
8237
+ timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
8238
+ maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
8239
+ abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
8240
+ fetchFn: (_j = this._options) == null ? void 0 : _j.fetch,
8241
+ logging: this._options.logging
8242
+ });
8243
+ if (_response.ok) {
8244
+ return { data: _response.body, rawResponse: _response.rawResponse };
8245
+ }
8246
+ if (_response.error.reason === "status-code") {
8247
+ switch (_response.error.statusCode) {
8248
+ case 400:
8249
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
8250
+ default:
8251
+ throw new DeepgramError({
8252
+ statusCode: _response.error.statusCode,
8253
+ body: _response.error.body,
8254
+ rawResponse: _response.rawResponse
8255
+ });
8256
+ }
8257
+ }
8258
+ return handleNonStatusCodeError(
8259
+ _response.error,
8260
+ _response.rawResponse,
8261
+ "POST",
8262
+ "/v1/projects/{project_id}/agent-variables"
8263
+ );
8264
+ });
8265
+ }
8266
+ /**
8267
+ * Returns the specified template variable
8268
+ *
8269
+ * @param {string} project_id - The unique identifier of the project
8270
+ * @param {string} variable_id - The unique identifier of the agent variable
8271
+ * @param {VariablesClient.RequestOptions} requestOptions - Request-specific configuration.
8272
+ *
8273
+ * @throws {@link Deepgram.BadRequestError}
8274
+ *
8275
+ * @example
8276
+ * await client.voiceAgent.variables.get("123456-7890-1234-5678-901234", "v1a2b3c4-d5e6-7890-abcd-ef1234567890")
8277
+ */
8278
+ get(project_id, variable_id, requestOptions) {
8279
+ return HttpResponsePromise.fromPromise(this.__get(project_id, variable_id, requestOptions));
8280
+ }
8281
+ __get(project_id, variable_id, requestOptions) {
8282
+ return __async(this, null, function* () {
8283
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
8284
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
8285
+ const _headers = mergeHeaders(
8286
+ _authRequest.headers,
8287
+ (_a = this._options) == null ? void 0 : _a.headers,
8288
+ requestOptions == null ? void 0 : requestOptions.headers
8289
+ );
8290
+ const _response = yield ((_b = this._options.fetcher) != null ? _b : fetcher)({
8291
+ url: url_exports.join(
8292
+ (_d = yield Supplier.get(this._options.baseUrl)) != null ? _d : ((_c = yield Supplier.get(this._options.environment)) != null ? _c : DeepgramEnvironment.Production).base,
8293
+ `v1/projects/${url_exports.encodePathParam(project_id)}/agent-variables/${url_exports.encodePathParam(variable_id)}`
8294
+ ),
8295
+ method: "GET",
8296
+ headers: _headers,
8297
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
8298
+ timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
8299
+ maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
8300
+ abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
8301
+ fetchFn: (_j = this._options) == null ? void 0 : _j.fetch,
8302
+ logging: this._options.logging
8303
+ });
8304
+ if (_response.ok) {
8305
+ return { data: _response.body, rawResponse: _response.rawResponse };
8306
+ }
8307
+ if (_response.error.reason === "status-code") {
8308
+ switch (_response.error.statusCode) {
8309
+ case 400:
8310
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
8311
+ default:
8312
+ throw new DeepgramError({
8313
+ statusCode: _response.error.statusCode,
8314
+ body: _response.error.body,
8315
+ rawResponse: _response.rawResponse
8316
+ });
8317
+ }
8318
+ }
8319
+ return handleNonStatusCodeError(
8320
+ _response.error,
8321
+ _response.rawResponse,
8322
+ "GET",
8323
+ "/v1/projects/{project_id}/agent-variables/{variable_id}"
8324
+ );
8325
+ });
8326
+ }
8327
+ /**
8328
+ * Deletes the specified template variable
8329
+ *
8330
+ * @param {string} project_id - The unique identifier of the project
8331
+ * @param {string} variable_id - The unique identifier of the agent variable
8332
+ * @param {VariablesClient.RequestOptions} requestOptions - Request-specific configuration.
8333
+ *
8334
+ * @throws {@link Deepgram.BadRequestError}
8335
+ *
8336
+ * @example
8337
+ * await client.voiceAgent.variables.delete("123456-7890-1234-5678-901234", "v1a2b3c4-d5e6-7890-abcd-ef1234567890")
8338
+ */
8339
+ delete(project_id, variable_id, requestOptions) {
8340
+ return HttpResponsePromise.fromPromise(this.__delete(project_id, variable_id, requestOptions));
8341
+ }
8342
+ __delete(project_id, variable_id, requestOptions) {
8343
+ return __async(this, null, function* () {
8344
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
8345
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
8346
+ const _headers = mergeHeaders(
8347
+ _authRequest.headers,
8348
+ (_a = this._options) == null ? void 0 : _a.headers,
8349
+ requestOptions == null ? void 0 : requestOptions.headers
8350
+ );
8351
+ const _response = yield ((_b = this._options.fetcher) != null ? _b : fetcher)({
8352
+ url: url_exports.join(
8353
+ (_d = yield Supplier.get(this._options.baseUrl)) != null ? _d : ((_c = yield Supplier.get(this._options.environment)) != null ? _c : DeepgramEnvironment.Production).base,
8354
+ `v1/projects/${url_exports.encodePathParam(project_id)}/agent-variables/${url_exports.encodePathParam(variable_id)}`
8355
+ ),
8356
+ method: "DELETE",
8357
+ headers: _headers,
8358
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
8359
+ timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
8360
+ maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
8361
+ abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
8362
+ fetchFn: (_j = this._options) == null ? void 0 : _j.fetch,
8363
+ logging: this._options.logging
8364
+ });
8365
+ if (_response.ok) {
8366
+ return {
8367
+ data: _response.body,
8368
+ rawResponse: _response.rawResponse
8369
+ };
8370
+ }
8371
+ if (_response.error.reason === "status-code") {
8372
+ switch (_response.error.statusCode) {
8373
+ case 400:
8374
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
8375
+ default:
8376
+ throw new DeepgramError({
8377
+ statusCode: _response.error.statusCode,
8378
+ body: _response.error.body,
8379
+ rawResponse: _response.rawResponse
8380
+ });
8381
+ }
8382
+ }
8383
+ return handleNonStatusCodeError(
8384
+ _response.error,
8385
+ _response.rawResponse,
8386
+ "DELETE",
8387
+ "/v1/projects/{project_id}/agent-variables/{variable_id}"
8388
+ );
8389
+ });
8390
+ }
8391
+ /**
8392
+ * Updates the value of an existing template variable
8393
+ *
8394
+ * @param {string} project_id - The unique identifier of the project
8395
+ * @param {string} variable_id - The unique identifier of the agent variable
8396
+ * @param {Deepgram.voiceAgent.UpdateAgentVariableV1Request} request
8397
+ * @param {VariablesClient.RequestOptions} requestOptions - Request-specific configuration.
8398
+ *
8399
+ * @throws {@link Deepgram.BadRequestError}
8400
+ *
8401
+ * @example
8402
+ * await client.voiceAgent.variables.update("project_id", "variable_id", {
8403
+ * value: {
8404
+ * "key": "value"
8405
+ * }
8406
+ * })
8407
+ */
8408
+ update(project_id, variable_id, request, requestOptions) {
8409
+ return HttpResponsePromise.fromPromise(this.__update(project_id, variable_id, request, requestOptions));
8410
+ }
8411
+ __update(project_id, variable_id, request, requestOptions) {
8412
+ return __async(this, null, function* () {
8413
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
8414
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
8415
+ const _headers = mergeHeaders(
8416
+ _authRequest.headers,
8417
+ (_a = this._options) == null ? void 0 : _a.headers,
8418
+ requestOptions == null ? void 0 : requestOptions.headers
8419
+ );
8420
+ const _response = yield ((_b = this._options.fetcher) != null ? _b : fetcher)({
8421
+ url: url_exports.join(
8422
+ (_d = yield Supplier.get(this._options.baseUrl)) != null ? _d : ((_c = yield Supplier.get(this._options.environment)) != null ? _c : DeepgramEnvironment.Production).base,
8423
+ `v1/projects/${url_exports.encodePathParam(project_id)}/agent-variables/${url_exports.encodePathParam(variable_id)}`
8424
+ ),
8425
+ method: "PATCH",
8426
+ headers: _headers,
8427
+ contentType: "application/json",
8428
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions == null ? void 0 : requestOptions.queryParams).build(),
8429
+ requestType: "json",
8430
+ body: request,
8431
+ timeoutMs: ((_g = (_f = requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? _f : (_e = this._options) == null ? void 0 : _e.timeoutInSeconds) != null ? _g : 60) * 1e3,
8432
+ maxRetries: (_i = requestOptions == null ? void 0 : requestOptions.maxRetries) != null ? _i : (_h = this._options) == null ? void 0 : _h.maxRetries,
8433
+ abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal,
8434
+ fetchFn: (_j = this._options) == null ? void 0 : _j.fetch,
8435
+ logging: this._options.logging
8436
+ });
8437
+ if (_response.ok) {
8438
+ return { data: _response.body, rawResponse: _response.rawResponse };
8439
+ }
8440
+ if (_response.error.reason === "status-code") {
8441
+ switch (_response.error.statusCode) {
8442
+ case 400:
8443
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
8444
+ default:
8445
+ throw new DeepgramError({
8446
+ statusCode: _response.error.statusCode,
8447
+ body: _response.error.body,
8448
+ rawResponse: _response.rawResponse
8449
+ });
8450
+ }
8451
+ }
8452
+ return handleNonStatusCodeError(
8453
+ _response.error,
8454
+ _response.rawResponse,
8455
+ "PATCH",
8456
+ "/v1/projects/{project_id}/agent-variables/{variable_id}"
8457
+ );
8458
+ });
8459
+ }
8460
+ };
8461
+
8462
+ // src/api/resources/voiceAgent/client/Client.ts
8463
+ var VoiceAgentClient = class {
8464
+ constructor(options = {}) {
8465
+ this._options = normalizeClientOptionsWithAuth(options);
8466
+ }
8467
+ get configurations() {
8468
+ var _a;
8469
+ return (_a = this._configurations) != null ? _a : this._configurations = new ConfigurationsClient(this._options);
8470
+ }
8471
+ get variables() {
8472
+ var _a;
8473
+ return (_a = this._variables) != null ? _a : this._variables = new VariablesClient(this._options);
8474
+ }
8475
+ };
8476
+
8477
+ // src/Client.ts
8478
+ var DeepgramClient = class {
8479
+ constructor(options = {}) {
8480
+ this._options = normalizeClientOptionsWithAuth(options);
8481
+ }
8482
+ get agent() {
8483
+ var _a;
8484
+ return (_a = this._agent) != null ? _a : this._agent = new AgentClient(this._options);
8485
+ }
8486
+ get auth() {
8487
+ var _a;
8488
+ return (_a = this._auth) != null ? _a : this._auth = new AuthClient(this._options);
8489
+ }
8490
+ get listen() {
8491
+ var _a;
8492
+ return (_a = this._listen) != null ? _a : this._listen = new ListenClient(this._options);
8493
+ }
8494
+ get manage() {
8495
+ var _a;
8496
+ return (_a = this._manage) != null ? _a : this._manage = new ManageClient(this._options);
8497
+ }
8498
+ get read() {
8499
+ var _a;
8500
+ return (_a = this._read) != null ? _a : this._read = new ReadClient(this._options);
8501
+ }
8502
+ get selfHosted() {
8503
+ var _a;
8504
+ return (_a = this._selfHosted) != null ? _a : this._selfHosted = new SelfHostedClient(this._options);
8505
+ }
8506
+ get speak() {
8507
+ var _a;
8508
+ return (_a = this._speak) != null ? _a : this._speak = new SpeakClient(this._options);
8509
+ }
8510
+ get voiceAgent() {
8511
+ var _a;
8512
+ return (_a = this._voiceAgent) != null ? _a : this._voiceAgent = new VoiceAgentClient(this._options);
8513
+ }
8514
+ /**
8515
+ * Make a passthrough request using the SDK's configured auth, retry, logging, etc.
8516
+ * This is useful for making requests to endpoints not yet supported in the SDK.
8517
+ * The input can be a URL string, URL object, or Request object. Relative paths are resolved against the configured base URL.
8518
+ *
8519
+ * @param {Request | string | URL} input - The URL, path, or Request object.
8520
+ * @param {RequestInit} init - Standard fetch RequestInit options.
8521
+ * @param {core.PassthroughRequest.RequestOptions} requestOptions - Per-request overrides (timeout, retries, headers, abort signal).
8522
+ * @returns {Promise<Response>} A standard Response object.
8523
+ */
8524
+ fetch(input, init, requestOptions) {
8525
+ return __async(this, null, function* () {
8526
+ var _a;
8527
+ return makePassthroughRequest(
8528
+ input,
8529
+ init,
8530
+ {
8531
+ baseUrl: (_a = this._options.baseUrl) != null ? _a : (() => __async(this, null, function* () {
8532
+ var _a2;
8533
+ const env = yield Supplier.get(this._options.environment);
8534
+ return typeof env === "string" ? env : (_a2 = env == null ? void 0 : env.base) != null ? _a2 : DeepgramEnvironment.Production.base;
8535
+ })),
8536
+ headers: this._options.headers,
8537
+ timeoutInSeconds: this._options.timeoutInSeconds,
8538
+ maxRetries: this._options.maxRetries,
8539
+ fetch: this._options.fetch,
8540
+ logging: this._options.logging,
8541
+ getAuthHeaders: () => __async(this, null, function* () {
8542
+ return (yield this._options.authProvider.getAuthRequest()).headers;
8543
+ })
8544
+ },
8545
+ requestOptions
8546
+ );
8547
+ });
8548
+ }
8549
+ };
8550
+
8551
+ // src/CustomClient.ts
8552
+ var DEFAULT_CONNECTION_TIMEOUT_MS = 1e4;
8553
+ var WEBSOCKET_OPTION_KEYS = /* @__PURE__ */ new Set([
8554
+ "Authorization",
8555
+ "headers",
8556
+ "debug",
8557
+ "reconnectAttempts",
8558
+ "connectionTimeoutInSeconds",
8559
+ "abortSignal",
8560
+ "queryParams"
8561
+ ]);
8562
+ var NodeWebSocket2;
8563
+ var _wsInitialized = false;
8564
+ function loadNodeWebSocket() {
8565
+ return __async(this, null, function* () {
8566
+ var _a;
8567
+ if (_wsInitialized) return;
8568
+ _wsInitialized = true;
8569
+ try {
8570
+ if (typeof __require !== "undefined") {
8571
+ let ws = require_browser();
8572
+ NodeWebSocket2 = ws.WebSocket || ws.default || ws;
8573
+ } else if (typeof process !== "undefined" && ((_a = process.versions) == null ? void 0 : _a.node)) {
8574
+ const dynamicImport = new Function("specifier", "return import(specifier)");
8575
+ const ws = yield dynamicImport("ws");
8576
+ NodeWebSocket2 = ws.WebSocket || ws.default || ws;
8577
+ }
8578
+ } catch (e) {
8579
+ NodeWebSocket2 = void 0;
8580
+ }
8581
+ });
8582
+ }
8583
+ function generateUUID() {
8584
+ if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
8585
+ return crypto.randomUUID();
8586
+ }
8587
+ if (RUNTIME.type === "node") {
8588
+ try {
8589
+ const nodeCrypto = require_crypto();
8590
+ return nodeCrypto.randomUUID();
8591
+ } catch (e) {
8592
+ }
8593
+ }
8594
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
8595
+ const r = Math.random() * 16 | 0;
8596
+ const v = c === "x" ? r : r & 3 | 8;
8597
+ return v.toString(16);
8598
+ });
8599
+ }
8600
+ var ApiKeyAuthProviderWrapper = class {
8601
+ constructor(originalProvider) {
8602
+ this.originalProvider = originalProvider;
8603
+ }
8604
+ getAuthRequest(arg) {
8605
+ return __async(this, null, function* () {
8606
+ var _a, _b;
8607
+ const authRequest = yield this.originalProvider.getAuthRequest(arg);
8608
+ const authHeader = ((_a = authRequest.headers) == null ? void 0 : _a.Authorization) || ((_b = authRequest.headers) == null ? void 0 : _b.authorization);
8609
+ if (authHeader && typeof authHeader === "string") {
8610
+ if (!authHeader.startsWith("Bearer ") && !authHeader.startsWith("Token ") && !authHeader.startsWith("token ")) {
8611
+ return {
8612
+ headers: __spreadProps(__spreadValues({}, authRequest.headers), {
8613
+ Authorization: `Token ${authHeader}`
8614
+ })
8615
+ };
8616
+ }
8617
+ }
8618
+ return authRequest;
8619
+ });
8620
+ }
8621
+ };
8622
+ var AccessTokenAuthProviderWrapper = class {
8623
+ constructor(originalProvider, accessToken) {
8624
+ this.originalProvider = originalProvider;
8625
+ this.accessToken = accessToken;
8626
+ }
8627
+ getAuthRequest(arg) {
8628
+ return __async(this, null, function* () {
8629
+ var _a, _b;
8630
+ const accessToken = (_b = yield Supplier.get(this.accessToken)) != null ? _b : (_a = process.env) == null ? void 0 : _a.DEEPGRAM_ACCESS_TOKEN;
8631
+ if (accessToken != null) {
8632
+ return {
8633
+ headers: { Authorization: `Bearer ${accessToken}` }
8634
+ };
8635
+ }
8636
+ return this.originalProvider.getAuthRequest(arg);
8637
+ });
8638
+ }
8639
+ };
8640
+ var CustomDeepgramClient = class extends DeepgramClient {
8641
+ constructor(options = {}) {
8642
+ const sessionId = generateUUID();
8643
+ const optionsWithSessionId = __spreadProps(__spreadValues({}, options), {
8644
+ headers: __spreadProps(__spreadValues({}, options.headers), {
8645
+ "x-deepgram-session-id": sessionId
8646
+ })
8647
+ });
8648
+ super(optionsWithSessionId);
8649
+ this._sessionId = sessionId;
8650
+ this._options.authProvider = new ApiKeyAuthProviderWrapper(this._options.authProvider);
8651
+ if (options.accessToken != null) {
8652
+ this._options.authProvider = new AccessTokenAuthProviderWrapper(
8653
+ this._options.authProvider,
8654
+ options.accessToken
8655
+ );
7520
8656
  }
7521
8657
  }
7522
8658
  /**
@@ -7589,6 +8725,18 @@ var Deepgram = (() => {
7589
8725
  return resolved;
7590
8726
  });
7591
8727
  }
8728
+ function buildQueryParams(args) {
8729
+ const result = {};
8730
+ for (const [key, value] of Object.entries(args)) {
8731
+ if (!WEBSOCKET_OPTION_KEYS.has(key) && value != null) {
8732
+ result[key] = value;
8733
+ }
8734
+ }
8735
+ if (args.queryParams != null && typeof args.queryParams === "object") {
8736
+ Object.assign(result, args.queryParams);
8737
+ }
8738
+ return result;
8739
+ }
7592
8740
  function getWebSocketOptions(headers) {
7593
8741
  const options = {};
7594
8742
  const isBrowser = RUNTIME.type === "browser" || RUNTIME.type === "web-worker";
@@ -7679,9 +8827,12 @@ var Deepgram = (() => {
7679
8827
  queryParams,
7680
8828
  headers,
7681
8829
  debug,
7682
- reconnectAttempts
8830
+ reconnectAttempts,
8831
+ connectionTimeoutInSeconds,
8832
+ abortSignal
7683
8833
  }) {
7684
8834
  var _a, _b, _c, _d, _e, _f;
8835
+ yield loadNodeWebSocket();
7685
8836
  const authRequest = yield (_a = options.authProvider) == null ? void 0 : _a.getAuthRequest();
7686
8837
  const mergedHeaders = mergeHeaders(
7687
8838
  (_b = options.headers) != null ? _b : {},
@@ -7701,23 +8852,26 @@ var Deepgram = (() => {
7701
8852
  debug: debug != null ? debug : false,
7702
8853
  maxRetries: reconnectAttempts != null ? reconnectAttempts : 30,
7703
8854
  startClosed: true,
7704
- connectionTimeout: DEFAULT_CONNECTION_TIMEOUT_MS
7705
- }
8855
+ connectionTimeout: connectionTimeoutInSeconds != null ? connectionTimeoutInSeconds * 1e3 : DEFAULT_CONNECTION_TIMEOUT_MS
8856
+ },
8857
+ abortSignal
7706
8858
  });
7707
8859
  });
7708
8860
  }
7709
8861
  var WrappedAgentV1Client = class extends V1Client {
7710
8862
  connect() {
7711
8863
  return __async(this, arguments, function* (args = {}) {
7712
- const { headers, debug, reconnectAttempts } = args;
8864
+ const { headers, debug, reconnectAttempts, connectionTimeoutInSeconds, abortSignal } = args;
7713
8865
  const socket = yield createWebSocketConnection({
7714
8866
  options: this._options,
7715
8867
  urlPath: "/v1/agent/converse",
7716
8868
  environmentKey: "agent",
7717
- queryParams: {},
8869
+ queryParams: buildQueryParams(args),
7718
8870
  headers,
7719
8871
  debug,
7720
- reconnectAttempts
8872
+ reconnectAttempts,
8873
+ connectionTimeoutInSeconds,
8874
+ abortSignal
7721
8875
  });
7722
8876
  return new WrappedAgentV1Socket({ socket });
7723
8877
  });
@@ -7766,74 +8920,17 @@ var Deepgram = (() => {
7766
8920
  var WrappedListenV1Client = class extends V1Client3 {
7767
8921
  connect(args) {
7768
8922
  return __async(this, null, function* () {
7769
- const {
7770
- callback,
7771
- callback_method: callbackMethod,
7772
- channels,
7773
- diarize,
7774
- dictation,
7775
- encoding,
7776
- endpointing,
7777
- extra,
7778
- interim_results: interimResults,
7779
- keyterm,
7780
- keywords,
7781
- language,
7782
- mip_opt_out: mipOptOut,
7783
- model,
7784
- multichannel,
7785
- numerals,
7786
- profanity_filter: profanityFilter,
7787
- punctuate,
7788
- redact,
7789
- replace,
7790
- sample_rate: sampleRate,
7791
- search,
7792
- smart_format: smartFormat,
7793
- tag,
7794
- utterance_end_ms: utteranceEndMs,
7795
- vad_events: vadEvents,
7796
- version,
7797
- headers,
7798
- debug,
7799
- reconnectAttempts
7800
- } = args;
7801
- const _queryParams = {};
7802
- if (callback != null) _queryParams.callback = callback;
7803
- if (callbackMethod != null) _queryParams.callback_method = callbackMethod;
7804
- if (channels != null) _queryParams.channels = channels;
7805
- if (diarize != null) _queryParams.diarize = diarize;
7806
- if (dictation != null) _queryParams.dictation = dictation;
7807
- if (encoding != null) _queryParams.encoding = encoding;
7808
- if (endpointing != null) _queryParams.endpointing = endpointing;
7809
- if (extra != null) _queryParams.extra = extra;
7810
- if (interimResults != null) _queryParams.interim_results = interimResults;
7811
- if (keyterm != null) _queryParams.keyterm = keyterm;
7812
- if (keywords != null) _queryParams.keywords = keywords;
7813
- if (language != null) _queryParams.language = language;
7814
- if (mipOptOut != null) _queryParams.mip_opt_out = mipOptOut;
7815
- _queryParams.model = model;
7816
- if (multichannel != null) _queryParams.multichannel = multichannel;
7817
- if (numerals != null) _queryParams.numerals = numerals;
7818
- if (profanityFilter != null) _queryParams.profanity_filter = profanityFilter;
7819
- if (punctuate != null) _queryParams.punctuate = punctuate;
7820
- if (redact != null) _queryParams.redact = redact;
7821
- if (replace != null) _queryParams.replace = replace;
7822
- if (sampleRate != null) _queryParams.sample_rate = sampleRate;
7823
- if (search != null) _queryParams.search = search;
7824
- if (smartFormat != null) _queryParams.smart_format = smartFormat;
7825
- if (tag != null) _queryParams.tag = tag;
7826
- if (utteranceEndMs != null) _queryParams.utterance_end_ms = utteranceEndMs;
7827
- if (vadEvents != null) _queryParams.vad_events = vadEvents;
7828
- if (version != null) _queryParams.version = version;
8923
+ const { headers, debug, reconnectAttempts, connectionTimeoutInSeconds, abortSignal } = args;
7829
8924
  const socket = yield createWebSocketConnection({
7830
8925
  options: this._options,
7831
8926
  urlPath: "/v1/listen",
7832
8927
  environmentKey: "production",
7833
- queryParams: _queryParams,
8928
+ queryParams: buildQueryParams(args),
7834
8929
  headers,
7835
8930
  debug,
7836
- reconnectAttempts
8931
+ reconnectAttempts,
8932
+ connectionTimeoutInSeconds,
8933
+ abortSignal
7837
8934
  });
7838
8935
  return new WrappedListenV1Socket({ socket });
7839
8936
  });
@@ -7882,38 +8979,17 @@ var Deepgram = (() => {
7882
8979
  var WrappedListenV2Client = class extends V2Client {
7883
8980
  connect(args) {
7884
8981
  return __async(this, null, function* () {
7885
- const {
7886
- model,
7887
- encoding,
7888
- sample_rate: sampleRate,
7889
- eager_eot_threshold: eagerEotThreshold,
7890
- eot_threshold: eotThreshold,
7891
- eot_timeout_ms: eotTimeoutMs,
7892
- keyterm,
7893
- mip_opt_out: mipOptOut,
7894
- tag,
7895
- headers,
7896
- debug,
7897
- reconnectAttempts
7898
- } = args;
7899
- const _queryParams = {};
7900
- _queryParams.model = model;
7901
- if (encoding != null) _queryParams.encoding = encoding;
7902
- if (sampleRate != null) _queryParams.sample_rate = sampleRate;
7903
- if (eagerEotThreshold != null) _queryParams.eager_eot_threshold = eagerEotThreshold;
7904
- if (eotThreshold != null) _queryParams.eot_threshold = eotThreshold;
7905
- if (eotTimeoutMs != null) _queryParams.eot_timeout_ms = eotTimeoutMs;
7906
- if (keyterm != null) _queryParams.keyterm = keyterm;
7907
- if (mipOptOut != null) _queryParams.mip_opt_out = mipOptOut;
7908
- if (tag != null) _queryParams.tag = tag;
8982
+ const { headers, debug, reconnectAttempts, connectionTimeoutInSeconds, abortSignal } = args;
7909
8983
  const socket = yield createWebSocketConnection({
7910
8984
  options: this._options,
7911
8985
  urlPath: "/v2/listen",
7912
8986
  environmentKey: "production",
7913
- queryParams: _queryParams,
8987
+ queryParams: buildQueryParams(args),
7914
8988
  headers,
7915
8989
  debug,
7916
- reconnectAttempts
8990
+ reconnectAttempts,
8991
+ connectionTimeoutInSeconds,
8992
+ abortSignal
7917
8993
  });
7918
8994
  return new WrappedListenV2Socket({ socket });
7919
8995
  });
@@ -7988,28 +9064,17 @@ var Deepgram = (() => {
7988
9064
  var WrappedSpeakV1Client = class extends V1Client7 {
7989
9065
  connect(args) {
7990
9066
  return __async(this, null, function* () {
7991
- const {
7992
- encoding,
7993
- mip_opt_out: mipOptOut,
7994
- model,
7995
- sample_rate: sampleRate,
7996
- headers,
7997
- debug,
7998
- reconnectAttempts
7999
- } = args;
8000
- const _queryParams = {};
8001
- if (encoding != null) _queryParams.encoding = encoding;
8002
- if (mipOptOut != null) _queryParams.mip_opt_out = mipOptOut;
8003
- if (model != null) _queryParams.model = model;
8004
- if (sampleRate != null) _queryParams.sample_rate = sampleRate;
9067
+ const { headers, debug, reconnectAttempts, connectionTimeoutInSeconds, abortSignal } = args;
8005
9068
  const socket = yield createWebSocketConnection({
8006
9069
  options: this._options,
8007
9070
  urlPath: "/v1/speak",
8008
9071
  environmentKey: "production",
8009
- queryParams: _queryParams,
9072
+ queryParams: buildQueryParams(args),
8010
9073
  headers,
8011
9074
  debug,
8012
- reconnectAttempts
9075
+ reconnectAttempts,
9076
+ connectionTimeoutInSeconds,
9077
+ abortSignal
8013
9078
  });
8014
9079
  return new WrappedSpeakV1Socket({ socket });
8015
9080
  });
@@ -8036,6 +9101,10 @@ var Deepgram = (() => {
8036
9101
  var WrappedSpeakV1Socket = class extends V1Socket3 {
8037
9102
  constructor(args) {
8038
9103
  super(args);
9104
+ const socketAny = this;
9105
+ if (socketAny.handleMessage) {
9106
+ this.socket.removeEventListener("message", socketAny.handleMessage);
9107
+ }
8039
9108
  this.setupBinaryHandling();
8040
9109
  }
8041
9110
  setupBinaryHandling() {