@deepgram/sdk 1.4.0 → 1.4.4

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 (220) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/browser/index.js +1 -0
  3. package/dist/index.d.ts +1342 -0
  4. package/dist/index.js +1 -0
  5. package/package.json +9 -6
  6. package/tsconfig-es6.json +16 -0
  7. package/webpack.config.js +21 -1
  8. package/bundle/billing.d.ts +0 -19
  9. package/bundle/billing.js +0 -73
  10. package/bundle/billing.js.map +0 -1
  11. package/bundle/browser/httpFetch.d.ts +0 -1
  12. package/bundle/browser/httpFetch.js +0 -75
  13. package/bundle/browser/httpFetch.js.map +0 -1
  14. package/bundle/browser/index.d.ts +0 -21
  15. package/bundle/browser/index.js +0 -35
  16. package/bundle/browser/index.js.map +0 -1
  17. package/bundle/browser/transcription/index.d.ts +0 -17
  18. package/bundle/browser/transcription/index.js +0 -75
  19. package/bundle/browser/transcription/index.js.map +0 -1
  20. package/bundle/browser/transcription/preRecordedTranscription.d.ts +0 -9
  21. package/bundle/browser/transcription/preRecordedTranscription.js +0 -87
  22. package/bundle/browser/transcription/preRecordedTranscription.js.map +0 -1
  23. package/bundle/constants/defaultOptions.d.ts +0 -6
  24. package/bundle/constants/defaultOptions.js +0 -10
  25. package/bundle/constants/defaultOptions.js.map +0 -1
  26. package/bundle/constants/index.d.ts +0 -1
  27. package/bundle/constants/index.js +0 -18
  28. package/bundle/constants/index.js.map +0 -1
  29. package/bundle/enums/alternatives.d.ts +0 -4
  30. package/bundle/enums/alternatives.js +0 -3
  31. package/bundle/enums/alternatives.js.map +0 -1
  32. package/bundle/enums/connectionState.d.ts +0 -6
  33. package/bundle/enums/connectionState.js +0 -11
  34. package/bundle/enums/connectionState.js.map +0 -1
  35. package/bundle/enums/diarization.d.ts +0 -4
  36. package/bundle/enums/diarization.js +0 -3
  37. package/bundle/enums/diarization.js.map +0 -1
  38. package/bundle/enums/index.d.ts +0 -7
  39. package/bundle/enums/index.js +0 -24
  40. package/bundle/enums/index.js.map +0 -1
  41. package/bundle/enums/liveTranscriptionEvents.d.ts +0 -6
  42. package/bundle/enums/liveTranscriptionEvents.js +0 -3
  43. package/bundle/enums/liveTranscriptionEvents.js.map +0 -1
  44. package/bundle/enums/models.d.ts +0 -5
  45. package/bundle/enums/models.js +0 -3
  46. package/bundle/enums/models.js.map +0 -1
  47. package/bundle/enums/punctuation.d.ts +0 -4
  48. package/bundle/enums/punctuation.js +0 -3
  49. package/bundle/enums/punctuation.js.map +0 -1
  50. package/bundle/enums/searchKind.d.ts +0 -4
  51. package/bundle/enums/searchKind.js +0 -3
  52. package/bundle/enums/searchKind.js.map +0 -1
  53. package/bundle/helpers/index.d.ts +0 -2
  54. package/bundle/helpers/index.js +0 -19
  55. package/bundle/helpers/index.js.map +0 -1
  56. package/bundle/helpers/secondsToTimestamp.d.ts +0 -1
  57. package/bundle/helpers/secondsToTimestamp.js +0 -8
  58. package/bundle/helpers/secondsToTimestamp.js.map +0 -1
  59. package/bundle/helpers/validateOptions.d.ts +0 -1
  60. package/bundle/helpers/validateOptions.js +0 -13
  61. package/bundle/helpers/validateOptions.js.map +0 -1
  62. package/bundle/httpRequest.d.ts +0 -3
  63. package/bundle/httpRequest.js +0 -91
  64. package/bundle/httpRequest.js.map +0 -1
  65. package/bundle/index.d.ts +0 -21
  66. package/bundle/index.js +0 -35
  67. package/bundle/index.js.map +0 -1
  68. package/bundle/invitation.d.ts +0 -30
  69. package/bundle/invitation.js +0 -99
  70. package/bundle/invitation.js.map +0 -1
  71. package/bundle/keys.d.ts +0 -33
  72. package/bundle/keys.js +0 -132
  73. package/bundle/keys.js.map +0 -1
  74. package/bundle/members.d.ts +0 -19
  75. package/bundle/members.js +0 -73
  76. package/bundle/members.js.map +0 -1
  77. package/bundle/projects.d.ts +0 -22
  78. package/bundle/projects.js +0 -82
  79. package/bundle/projects.js.map +0 -1
  80. package/bundle/scopes.d.ts +0 -21
  81. package/bundle/scopes.js +0 -77
  82. package/bundle/scopes.js.map +0 -1
  83. package/bundle/transcription/index.d.ts +0 -18
  84. package/bundle/transcription/index.js +0 -72
  85. package/bundle/transcription/index.js.map +0 -1
  86. package/bundle/transcription/liveTranscription.d.ts +0 -23
  87. package/bundle/transcription/liveTranscription.js +0 -83
  88. package/bundle/transcription/liveTranscription.js.map +0 -1
  89. package/bundle/transcription/preRecordedTranscription.d.ts +0 -8
  90. package/bundle/transcription/preRecordedTranscription.js +0 -114
  91. package/bundle/transcription/preRecordedTranscription.js.map +0 -1
  92. package/bundle/types/balance.d.ts +0 -6
  93. package/bundle/types/balance.js +0 -3
  94. package/bundle/types/balance.js.map +0 -1
  95. package/bundle/types/balanceList.d.ts +0 -4
  96. package/bundle/types/balanceList.js +0 -3
  97. package/bundle/types/balanceList.js.map +0 -1
  98. package/bundle/types/channel.d.ts +0 -25
  99. package/bundle/types/channel.js +0 -3
  100. package/bundle/types/channel.js.map +0 -1
  101. package/bundle/types/createKeyOptions.d.ts +0 -13
  102. package/bundle/types/createKeyOptions.js +0 -3
  103. package/bundle/types/createKeyOptions.js.map +0 -1
  104. package/bundle/types/hit.d.ts +0 -21
  105. package/bundle/types/hit.js +0 -3
  106. package/bundle/types/hit.js.map +0 -1
  107. package/bundle/types/index.d.ts +0 -38
  108. package/bundle/types/index.js +0 -55
  109. package/bundle/types/index.js.map +0 -1
  110. package/bundle/types/invitationList.d.ts +0 -4
  111. package/bundle/types/invitationList.js +0 -3
  112. package/bundle/types/invitationList.js.map +0 -1
  113. package/bundle/types/invitationOptions.d.ts +0 -4
  114. package/bundle/types/invitationOptions.js +0 -3
  115. package/bundle/types/invitationOptions.js.map +0 -1
  116. package/bundle/types/key.d.ts +0 -25
  117. package/bundle/types/key.js +0 -3
  118. package/bundle/types/key.js.map +0 -1
  119. package/bundle/types/keyResponse.d.ts +0 -10
  120. package/bundle/types/keyResponse.js +0 -3
  121. package/bundle/types/keyResponse.js.map +0 -1
  122. package/bundle/types/keyResponseObj.d.ts +0 -42
  123. package/bundle/types/keyResponseObj.js +0 -3
  124. package/bundle/types/keyResponseObj.js.map +0 -1
  125. package/bundle/types/keyword.d.ts +0 -4
  126. package/bundle/types/keyword.js +0 -3
  127. package/bundle/types/keyword.js.map +0 -1
  128. package/bundle/types/liveTranscriptionOptions.d.ts +0 -148
  129. package/bundle/types/liveTranscriptionOptions.js +0 -3
  130. package/bundle/types/liveTranscriptionOptions.js.map +0 -1
  131. package/bundle/types/liveTranscriptionResponse.d.ts +0 -9
  132. package/bundle/types/liveTranscriptionResponse.js +0 -3
  133. package/bundle/types/liveTranscriptionResponse.js.map +0 -1
  134. package/bundle/types/member.d.ts +0 -7
  135. package/bundle/types/member.js +0 -3
  136. package/bundle/types/member.js.map +0 -1
  137. package/bundle/types/memberList.d.ts +0 -4
  138. package/bundle/types/memberList.js +0 -3
  139. package/bundle/types/memberList.js.map +0 -1
  140. package/bundle/types/message.d.ts +0 -3
  141. package/bundle/types/message.js +0 -3
  142. package/bundle/types/message.js.map +0 -1
  143. package/bundle/types/metadata.d.ts +0 -8
  144. package/bundle/types/metadata.js +0 -3
  145. package/bundle/types/metadata.js.map +0 -1
  146. package/bundle/types/prerecordedTranscriptionOptions.d.ts +0 -126
  147. package/bundle/types/prerecordedTranscriptionOptions.js +0 -3
  148. package/bundle/types/prerecordedTranscriptionOptions.js.map +0 -1
  149. package/bundle/types/prerecordedTranscriptionResponse.d.ts +0 -25
  150. package/bundle/types/prerecordedTranscriptionResponse.js +0 -51
  151. package/bundle/types/prerecordedTranscriptionResponse.js.map +0 -1
  152. package/bundle/types/project.d.ts +0 -17
  153. package/bundle/types/project.js +0 -3
  154. package/bundle/types/project.js.map +0 -1
  155. package/bundle/types/projectPatchRequest.d.ts +0 -4
  156. package/bundle/types/projectPatchRequest.js +0 -3
  157. package/bundle/types/projectPatchRequest.js.map +0 -1
  158. package/bundle/types/projectPatchResponse.d.ts +0 -6
  159. package/bundle/types/projectPatchResponse.js +0 -3
  160. package/bundle/types/projectPatchResponse.js.map +0 -1
  161. package/bundle/types/projectResponse.d.ts +0 -4
  162. package/bundle/types/projectResponse.js +0 -3
  163. package/bundle/types/projectResponse.js.map +0 -1
  164. package/bundle/types/requestFunction.d.ts +0 -5
  165. package/bundle/types/requestFunction.js +0 -3
  166. package/bundle/types/requestFunction.js.map +0 -1
  167. package/bundle/types/scopeList.d.ts +0 -3
  168. package/bundle/types/scopeList.js +0 -3
  169. package/bundle/types/scopeList.js.map +0 -1
  170. package/bundle/types/search.d.ts +0 -14
  171. package/bundle/types/search.js +0 -3
  172. package/bundle/types/search.js.map +0 -1
  173. package/bundle/types/transcriptionSource.d.ts +0 -14
  174. package/bundle/types/transcriptionSource.js +0 -3
  175. package/bundle/types/transcriptionSource.js.map +0 -1
  176. package/bundle/types/usageCallback.d.ts +0 -4
  177. package/bundle/types/usageCallback.js +0 -3
  178. package/bundle/types/usageCallback.js.map +0 -1
  179. package/bundle/types/usageField.d.ts +0 -7
  180. package/bundle/types/usageField.js +0 -3
  181. package/bundle/types/usageField.js.map +0 -1
  182. package/bundle/types/usageFieldOptions.d.ts +0 -4
  183. package/bundle/types/usageFieldOptions.js +0 -3
  184. package/bundle/types/usageFieldOptions.js.map +0 -1
  185. package/bundle/types/usageOptions.d.ts +0 -23
  186. package/bundle/types/usageOptions.js +0 -3
  187. package/bundle/types/usageOptions.js.map +0 -1
  188. package/bundle/types/usageRequest.d.ts +0 -11
  189. package/bundle/types/usageRequest.js +0 -3
  190. package/bundle/types/usageRequest.js.map +0 -1
  191. package/bundle/types/usageRequestDetail.d.ts +0 -30
  192. package/bundle/types/usageRequestDetail.js +0 -3
  193. package/bundle/types/usageRequestDetail.js.map +0 -1
  194. package/bundle/types/usageRequestList.d.ts +0 -6
  195. package/bundle/types/usageRequestList.js +0 -3
  196. package/bundle/types/usageRequestList.js.map +0 -1
  197. package/bundle/types/usageRequestListOptions.d.ts +0 -7
  198. package/bundle/types/usageRequestListOptions.js +0 -3
  199. package/bundle/types/usageRequestListOptions.js.map +0 -1
  200. package/bundle/types/usageRequestMessage.d.ts +0 -3
  201. package/bundle/types/usageRequestMessage.js +0 -3
  202. package/bundle/types/usageRequestMessage.js.map +0 -1
  203. package/bundle/types/usageResponse.d.ts +0 -10
  204. package/bundle/types/usageResponse.js +0 -3
  205. package/bundle/types/usageResponse.js.map +0 -1
  206. package/bundle/types/usageResponseDetail.d.ts +0 -6
  207. package/bundle/types/usageResponseDetail.js +0 -3
  208. package/bundle/types/usageResponseDetail.js.map +0 -1
  209. package/bundle/types/utterance.d.ts +0 -39
  210. package/bundle/types/utterance.js +0 -3
  211. package/bundle/types/utterance.js.map +0 -1
  212. package/bundle/types/wordBase.d.ts +0 -8
  213. package/bundle/types/wordBase.js +0 -3
  214. package/bundle/types/wordBase.js.map +0 -1
  215. package/bundle/usage.d.ts +0 -35
  216. package/bundle/usage.js +0 -122
  217. package/bundle/usage.js.map +0 -1
  218. package/bundle/userAgent.d.ts +0 -1
  219. package/bundle/userAgent.js +0 -20
  220. package/bundle/userAgent.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -9,11 +9,36 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9
9
 
10
10
  ---
11
11
 
12
+ ## [1.4.4]
13
+
14
+ ### Added
15
+
16
+ - Added `replace` to transcription option types
17
+
18
+ ## [1.4.3]
19
+
20
+ ### Added
21
+
22
+ - Added `tier` to transcription option types
23
+
24
+ ## [1.4.2]
25
+
26
+ ### Added
27
+
28
+ - Updated build step to build separate files for browser version
29
+
30
+ ## [1.4.1]
31
+
32
+ ### Added
33
+
34
+ - Small fix for npm deployment
35
+
12
36
  ## [1.4.0]
13
37
 
14
38
  ### Added
15
39
 
16
40
  - Added Browser compatible versions of the live and preRecorded transcription methods
41
+
17
42
  ## [1.3.1]
18
43
 
19
44
  ### Updated
@@ -0,0 +1 @@
1
+ var t={587:t=>{function e(t,e){return Object.prototype.hasOwnProperty.call(t,e)}t.exports=function(t,i,n,r){i=i||"&",n=n||"=";var s={};if("string"!=typeof t||0===t.length)return s;var a=/\+/g;t=t.split(i);var o=1e3;r&&"number"==typeof r.maxKeys&&(o=r.maxKeys);var c=t.length;o>0&&c>o&&(c=o);for(var h=0;h<c;++h){var u,l,p,d,v=t[h].replace(a,"%20"),f=v.indexOf(n);f>=0?(u=v.substr(0,f),l=v.substr(f+1)):(u=v,l=""),p=decodeURIComponent(u),d=decodeURIComponent(l),e(s,p)?Array.isArray(s[p])?s[p].push(d):s[p]=[s[p],d]:s[p]=d}return s}},361:t=>{var e=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};t.exports=function(t,i,n,r){return i=i||"&",n=n||"=",null===t&&(t=void 0),"object"==typeof t?Object.keys(t).map((function(r){var s=encodeURIComponent(e(r))+n;return Array.isArray(t[r])?t[r].map((function(t){return s+encodeURIComponent(e(t))})).join(i):s+encodeURIComponent(e(t[r]))})).join(i):r?encodeURIComponent(e(r))+n+encodeURIComponent(e(t)):""}},673:(t,e,i)=>{e.decode=e.parse=i(587),e.encode=e.stringify=i(361)}},e={};function i(n){var r=e[n];if(void 0!==r)return r.exports;var s=e[n]={exports:{}};return t[n](s,s.exports,i),s.exports}i.d=(t,e)=>{for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var n={};(()=>{i.d(n,{X:()=>g});var t=i(673);function e(t){return new Date(1e3*t).toISOString().substr(11,12)}class r{toWebVTT(){var t,i,n,r;if(!this.results||!this.results.utterances)throw new Error("This function requires a transcript that was generated with the utterances feature.");let s="WEBVTT\n\n";s+=`NOTE\nTranscription provided by Deepgram\nRequest Id: ${null===(t=this.metadata)||void 0===t?void 0:t.request_id}\nCreated: ${null===(i=this.metadata)||void 0===i?void 0:i.created}\nDuration: ${null===(n=this.metadata)||void 0===n?void 0:n.duration}\nChannels: ${null===(r=this.metadata)||void 0===r?void 0:r.channels}\n\n`;for(let t=0;t<this.results.utterances.length;t++){const i=this.results.utterances[t];s+=`${t+1}\n${e(i.start)} --\x3e ${e(i.end)}\n- ${i.transcript}\n\n`}return s}toSRT(){if(!this.results||!this.results.utterances)throw new Error("This function requires a transcript that was generated with the utterances feature.");let t="";for(let i=0;i<this.results.utterances.length;i++){const n=this.results.utterances[i];t+=`${i+1}\n${e(n.start).replace(".",",")} --\x3e ${e(n.end).replace(".",",")}\n${n.transcript}\n\n`}return t}}function s(){let t="@deepgram/sdk/UNKNOWN node/UNKNOWN";try{t=`@deepgram/sdk/1.4.4 node/${process.version.replace("v","")}`}catch(t){console.warn("Could not load package details")}return t}function a(t,e,i,n,r){return a=this,o=void 0,h=function*(){const a=`https://${i}${n}`;try{const i=yield fetch(a,{method:t,headers:{Authorization:`token ${e}`,"Content-Type":"application/json","X-DG-Agent":s()},body:r});return yield i.json()}catch(t){throw new Error(`DG: ${t}`)}},new((c=void 0)||(c=Promise))((function(t,e){function i(t){try{r(h.next(t))}catch(t){e(t)}}function n(t){try{r(h.throw(t))}catch(t){e(t)}}function r(e){var r;e.done?t(e.value):(r=e.value,r instanceof c?r:new c((function(t){t(r)}))).then(i,n)}r((h=h.apply(a,o||[])).next())}));var a,o,c,h}class o{constructor(t,e){this._credentials=t,this._apiUrl=e}preRecorded(e,i){return n=this,s=void 0,c=function*(){return yield((e,i,n,s)=>{return o=void 0,c=void 0,u=function*(){const o=Object.assign({},s);if(!n.url)throw new Error("DG: Source must be a URL string");const c=JSON.stringify(n),h=yield a("POST",e,i,`/v1/listen?${t.stringify(o)}`,c);return Object.assign(new r,h)},new((h=void 0)||(h=Promise))((function(t,e){function i(t){try{r(u.next(t))}catch(t){e(t)}}function n(t){try{r(u.throw(t))}catch(t){e(t)}}function r(e){var r;e.done?t(e.value):(r=e.value,r instanceof h?r:new h((function(t){t(r)}))).then(i,n)}r((u=u.apply(o,c||[])).next())}));var o,c,h,u})(this._credentials,this._apiUrl||"",e,i)},new((o=void 0)||(o=Promise))((function(t,e){function i(t){try{a(c.next(t))}catch(t){e(t)}}function r(t){try{a(c.throw(t))}catch(t){e(t)}}function a(e){var n;e.done?t(e.value):(n=e.value,n instanceof o?n:new o((function(t){t(n)}))).then(i,r)}a((c=c.apply(n,s||[])).next())}));var n,s,o,c}live(e){return new WebSocket(`wss://${this._apiUrl}/v1/listen?${t.stringify(e)}`,["token",this._credentials])}}var c=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function a(t){try{c(n.next(t))}catch(t){s(t)}}function o(t){try{c(n.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}c((n=n.apply(t,e||[])).next())}))};class h{constructor(t,e,i){this._credentials=t,this._apiUrl=e,this._request=i,this.apiPath="/v1/projects"}list(){return c(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,this.apiPath)}))}get(t){return c(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${t}`)}))}update(t,e){return c(this,void 0,void 0,(function*(){return this._request("PATCH",this._credentials,this._apiUrl,`${this.apiPath}/${t.project_id}`,JSON.stringify(e))}))}}var u=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function a(t){try{c(n.next(t))}catch(t){s(t)}}function o(t){try{c(n.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}c((n=n.apply(t,e||[])).next())}))};class l{constructor(t,e,i){this._credentials=t,this._apiUrl=e,this._request=i,this.apiPath="/v1/projects"}list(t){return u(this,void 0,void 0,(function*(){return{api_keys:(yield this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${t}/keys`)).api_keys.map((t=>Object.assign(Object.assign({},t),t.api_key)))}}))}get(t,e){return u(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${t}/keys/${e}`)}))}create(t,e,i,n){return u(this,void 0,void 0,(function*(){if(n&&void 0!==n.expirationDate&&void 0!==n.timeToLive)throw new Error("Please provide expirationDate or timeToLive or neither. Providing both is not allowed.");return this._request("POST",this._credentials,this._apiUrl,`${this.apiPath}/${t}/keys`,JSON.stringify({comment:e,scopes:i,expiration_date:n&&n.expirationDate?n.expirationDate:void 0,time_to_live_in_seconds:n&&n.timeToLive?n.timeToLive:void 0}))}))}delete(t,e){return u(this,void 0,void 0,(function*(){return this._request("DELETE",this._credentials,this._apiUrl,`${this.apiPath}/${t}/keys/${e}`)}))}}var p=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function a(t){try{c(n.next(t))}catch(t){s(t)}}function o(t){try{c(n.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}c((n=n.apply(t,e||[])).next())}))};class d{constructor(t,e,i){this._credentials=t,this._apiUrl=e,this._request=i,this.apiPath="/v1/projects"}listRequests(e,i){return p(this,void 0,void 0,(function*(){const n=Object.assign({},i);return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${e}/requests?${t.stringify(n)}`)}))}getRequest(t,e){return p(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${t}/requests/${e}`)}))}getUsage(e,i){return p(this,void 0,void 0,(function*(){const n=Object.assign({},i);return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${e}/usage?${t.stringify(n)}`)}))}getFields(e,i){return p(this,void 0,void 0,(function*(){const n=Object.assign({},i);return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${e}/usage/fields?${t.stringify(n)}`)}))}}var v=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function a(t){try{c(n.next(t))}catch(t){s(t)}}function o(t){try{c(n.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}c((n=n.apply(t,e||[])).next())}))};class f{constructor(t,e,i){this._credentials=t,this._apiUrl=e,this._request=i,this.apiPath="/v1/projects"}listMembers(t){return v(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${t}/members`)}))}removeMember(t,e){return v(this,void 0,void 0,(function*(){return this._request("DELETE",this._credentials,this._apiUrl,`${this.apiPath}/${t}/members/${e}`)}))}}var _=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function a(t){try{c(n.next(t))}catch(t){s(t)}}function o(t){try{c(n.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}c((n=n.apply(t,e||[])).next())}))};class y{constructor(t,e,i){this._credentials=t,this._apiUrl=e,this._request=i,this.apiPath="/v1/projects"}list(t){return _(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${t}/invites`)}))}send(t,e){return _(this,void 0,void 0,(function*(){return this._request("POST",this._credentials,this._apiUrl,`${this.apiPath}/${t}/invites`,JSON.stringify({email:e.email,scope:e.scope}))}))}leave(t){return _(this,void 0,void 0,(function*(){return this._request("DELETE",this._credentials,this._apiUrl,`${this.apiPath}/${t}/leave`)}))}delete(t,e){return _(this,void 0,void 0,(function*(){return this._request("DELETE",this._credentials,this._apiUrl,`${this.apiPath}/${t}/invites/${e}`)}))}}var $=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function a(t){try{c(n.next(t))}catch(t){s(t)}}function o(t){try{c(n.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}c((n=n.apply(t,e||[])).next())}))};class w{constructor(t,e,i){this._credentials=t,this._apiUrl=e,this._request=i,this.apiPath="/v1/projects"}listBalances(t){return $(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${t}/balances`)}))}getBalance(t,e){return $(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${t}/balances/${e}`)}))}}var m=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function a(t){try{c(n.next(t))}catch(t){s(t)}}function o(t){try{c(n.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}c((n=n.apply(t,e||[])).next())}))};class U{constructor(t,e,i){this._credentials=t,this._apiUrl=e,this._request=i,this.apiPath="/v1/projects"}get(t,e){return m(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${t}/members/${e}/scopes`)}))}update(t,e,i){return m(this,void 0,void 0,(function*(){return this._request("PUT",this._credentials,this._apiUrl,`${this.apiPath}/${t}/members/${e}/scopes`,JSON.stringify({scope:i}))}))}}class g{constructor(t,e){this._apiKey=t,this._apiUrl=e||"api.deepgram.com",function(t,e){if(!t||0===t.trim().length)throw new Error("DG: API key is required");if(!e||0===e.trim().length)throw new Error("DG: API url should be a valid url or not provided")}(this._apiKey,this._apiUrl),this.transcription=new o(this._apiKey,this._apiUrl),this.projects=new h(this._apiKey,this._apiUrl,a),this.keys=new l(this._apiKey,this._apiUrl,a),this.usage=new d(this._apiKey,this._apiUrl,a),this.members=new f(this._apiKey,this._apiUrl,a),this.invitation=new y(this._apiKey,this._apiUrl,a),this.billing=new w(this._apiKey,this._apiUrl,a),this.scopes=new U(this._apiKey,this._apiUrl,a)}}})();var r=n.X;export{r as Deepgram};