@cartesia/cartesia-js 2.1.4 → 2.1.5

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 (442) hide show
  1. package/Client.d.ts +10 -6
  2. package/api/resources/apiStatus/client/Client.d.ts +4 -0
  3. package/api/resources/apiStatus/client/Client.js +21 -11
  4. package/api/resources/datasets/client/Client.d.ts +4 -1
  5. package/api/resources/datasets/client/Client.js +34 -24
  6. package/api/resources/datasets/types/FilePurpose.d.ts +1 -1
  7. package/api/resources/embedding/types/Embedding.d.ts +1 -1
  8. package/api/resources/index.js +17 -7
  9. package/api/resources/infill/client/Client.d.ts +6 -1
  10. package/api/resources/infill/client/Client.js +44 -23
  11. package/api/resources/infill/client/requests/InfillBytesRequest.d.ts +7 -3
  12. package/api/resources/tts/client/Client.js +21 -11
  13. package/api/resources/tts/types/ContextId.d.ts +1 -1
  14. package/api/resources/tts/types/Emotion.d.ts +1 -1
  15. package/api/resources/tts/types/FlushId.d.ts +9 -0
  16. package/api/resources/tts/types/FlushId.js +5 -0
  17. package/api/resources/tts/types/GenerationRequest.d.ts +5 -2
  18. package/api/resources/tts/types/NaturalSpecifier.d.ts +1 -1
  19. package/api/resources/tts/types/NumericalSpecifier.d.ts +1 -1
  20. package/api/resources/tts/types/OutputFormat.d.ts +1 -1
  21. package/api/resources/tts/types/RawEncoding.d.ts +1 -1
  22. package/api/resources/tts/types/RawOutputFormat.d.ts +1 -0
  23. package/api/resources/tts/types/Speed.d.ts +1 -1
  24. package/api/resources/tts/types/SupportedLanguage.d.ts +1 -1
  25. package/api/resources/tts/types/TtsRequestVoiceSpecifier.d.ts +1 -1
  26. package/api/resources/tts/types/WebSocketFlushDoneResponse.d.ts +8 -0
  27. package/api/resources/tts/types/WebSocketFlushDoneResponse.js +5 -0
  28. package/api/resources/tts/types/WebSocketRequest.d.ts +1 -1
  29. package/api/resources/tts/types/WebSocketResponse.d.ts +4 -1
  30. package/api/resources/tts/types/WebSocketTtsOutput.d.ts +2 -0
  31. package/api/resources/tts/types/index.d.ts +2 -0
  32. package/api/resources/tts/types/index.js +2 -0
  33. package/api/resources/voiceChanger/client/Client.d.ts +3 -4
  34. package/api/resources/voiceChanger/client/Client.js +23 -13
  35. package/api/resources/voiceChanger/types/OutputFormatContainer.d.ts +1 -1
  36. package/api/resources/voiceChanger/types/StreamingResponse.d.ts +1 -1
  37. package/api/resources/voices/client/Client.d.ts +4 -1
  38. package/api/resources/voices/client/Client.js +55 -45
  39. package/api/resources/voices/types/BaseVoiceId.d.ts +1 -1
  40. package/api/resources/voices/types/CloneMode.d.ts +1 -1
  41. package/api/resources/voices/types/Gender.d.ts +1 -1
  42. package/api/resources/voices/types/LocalizeDialect.d.ts +12 -4
  43. package/api/resources/voices/types/LocalizeEnglishDialect.d.ts +1 -1
  44. package/api/resources/voices/types/LocalizePortugueseDialect.d.ts +8 -0
  45. package/api/resources/voices/types/LocalizePortugueseDialect.js +10 -0
  46. package/api/resources/voices/types/LocalizeSpanishDialect.d.ts +8 -0
  47. package/api/resources/voices/types/LocalizeSpanishDialect.js +10 -0
  48. package/api/resources/voices/types/LocalizeTargetLanguage.d.ts +1 -1
  49. package/api/resources/voices/types/MixVoiceSpecifier.d.ts +1 -1
  50. package/api/resources/voices/types/VoiceId.d.ts +1 -1
  51. package/api/resources/voices/types/Weight.d.ts +1 -1
  52. package/api/resources/voices/types/index.d.ts +2 -0
  53. package/api/resources/voices/types/index.js +2 -0
  54. package/core/fetcher/APIResponse.d.ts +1 -1
  55. package/core/fetcher/Fetcher.d.ts +1 -1
  56. package/core/fetcher/Fetcher.js +2 -2
  57. package/core/fetcher/Supplier.d.ts +1 -1
  58. package/core/fetcher/createRequestUrl.d.ts +1 -1
  59. package/core/fetcher/createRequestUrl.js +1 -2
  60. package/core/fetcher/getFetchFn.js +18 -9
  61. package/core/fetcher/getHeader.js +1 -2
  62. package/core/fetcher/getRequestBody.js +5 -5
  63. package/core/fetcher/getResponseBody.js +1 -2
  64. package/core/fetcher/makeRequest.d.ts +1 -1
  65. package/core/fetcher/requestWithRetries.js +4 -5
  66. package/core/fetcher/signals.d.ts +0 -1
  67. package/core/fetcher/signals.js +2 -3
  68. package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +0 -1
  69. package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +6 -4
  70. package/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +1 -1
  71. package/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +1 -1
  72. package/core/fetcher/stream-wrappers/chooseStreamWrapper.js +18 -9
  73. package/core/form-data-utils/FormDataWrapper.d.ts +4 -4
  74. package/core/form-data-utils/FormDataWrapper.js +22 -12
  75. package/core/index.js +17 -7
  76. package/core/json.d.ts +15 -0
  77. package/core/json.js +24 -0
  78. package/core/runtime/runtime.d.ts +1 -1
  79. package/core/runtime/runtime.js +51 -41
  80. package/core/schemas/Schema.d.ts +7 -5
  81. package/core/schemas/Schema.js +2 -0
  82. package/core/schemas/builders/bigint/bigint.d.ts +1 -1
  83. package/core/schemas/builders/bigint/bigint.js +22 -19
  84. package/core/schemas/builders/date/date.js +1 -2
  85. package/core/schemas/builders/enum/enum.js +1 -2
  86. package/core/schemas/builders/lazy/lazy.d.ts +1 -1
  87. package/core/schemas/builders/lazy/lazy.js +3 -4
  88. package/core/schemas/builders/lazy/lazyObject.js +1 -2
  89. package/core/schemas/builders/list/list.js +1 -2
  90. package/core/schemas/builders/literals/booleanLiteral.js +1 -2
  91. package/core/schemas/builders/literals/stringLiteral.js +1 -2
  92. package/core/schemas/builders/object/object.d.ts +1 -1
  93. package/core/schemas/builders/object/object.js +31 -3
  94. package/core/schemas/builders/object/objectWithoutOptionalProperties.d.ts +3 -3
  95. package/core/schemas/builders/object/objectWithoutOptionalProperties.js +1 -2
  96. package/core/schemas/builders/object/property.js +2 -3
  97. package/core/schemas/builders/object/types.d.ts +16 -11
  98. package/core/schemas/builders/object-like/getObjectLikeUtils.js +2 -3
  99. package/core/schemas/builders/object-like/types.d.ts +1 -1
  100. package/core/schemas/builders/record/record.js +2 -4
  101. package/core/schemas/builders/record/types.d.ts +2 -2
  102. package/core/schemas/builders/schema-utils/getSchemaUtils.d.ts +4 -0
  103. package/core/schemas/builders/schema-utils/getSchemaUtils.js +67 -4
  104. package/core/schemas/builders/schema-utils/stringifyValidationErrors.js +1 -2
  105. package/core/schemas/builders/set/set.js +1 -2
  106. package/core/schemas/builders/undiscriminated-union/types.d.ts +4 -4
  107. package/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.js +1 -2
  108. package/core/schemas/builders/union/discriminant.js +1 -2
  109. package/core/schemas/builders/union/types.d.ts +6 -6
  110. package/core/schemas/builders/union/union.d.ts +1 -1
  111. package/core/schemas/builders/union/union.js +1 -2
  112. package/core/schemas/utils/MaybePromise.d.ts +1 -1
  113. package/core/schemas/utils/addQuestionMarksToNullableProperties.d.ts +4 -4
  114. package/core/schemas/utils/createIdentitySchemaCreator.js +1 -2
  115. package/core/schemas/utils/entries.d.ts +1 -1
  116. package/core/schemas/utils/entries.js +1 -2
  117. package/core/schemas/utils/filterObject.d.ts +1 -1
  118. package/core/schemas/utils/filterObject.js +1 -2
  119. package/core/schemas/utils/getErrorMessageForIncorrectType.js +1 -2
  120. package/core/schemas/utils/isPlainObject.js +1 -2
  121. package/core/schemas/utils/keys.d.ts +1 -1
  122. package/core/schemas/utils/keys.js +1 -2
  123. package/core/schemas/utils/maybeSkipValidation.js +1 -2
  124. package/core/schemas/utils/partition.js +1 -2
  125. package/core/streaming-fetcher/Stream.d.ts +0 -1
  126. package/core/streaming-fetcher/Stream.js +20 -21
  127. package/core/websocket/ws.d.ts +7 -7
  128. package/core/websocket/ws.js +17 -7
  129. package/dist/Client.d.ts +10 -6
  130. package/dist/api/resources/apiStatus/client/Client.d.ts +4 -0
  131. package/dist/api/resources/apiStatus/client/Client.js +21 -11
  132. package/dist/api/resources/datasets/client/Client.d.ts +4 -1
  133. package/dist/api/resources/datasets/client/Client.js +34 -24
  134. package/dist/api/resources/datasets/types/FilePurpose.d.ts +1 -1
  135. package/dist/api/resources/embedding/types/Embedding.d.ts +1 -1
  136. package/dist/api/resources/index.js +17 -7
  137. package/dist/api/resources/infill/client/Client.d.ts +6 -1
  138. package/dist/api/resources/infill/client/Client.js +44 -23
  139. package/dist/api/resources/infill/client/requests/InfillBytesRequest.d.ts +7 -3
  140. package/dist/api/resources/tts/client/Client.js +21 -11
  141. package/dist/api/resources/tts/types/ContextId.d.ts +1 -1
  142. package/dist/api/resources/tts/types/Emotion.d.ts +1 -1
  143. package/dist/api/resources/tts/types/FlushId.d.ts +9 -0
  144. package/dist/api/resources/tts/types/FlushId.js +5 -0
  145. package/dist/api/resources/tts/types/GenerationRequest.d.ts +5 -2
  146. package/dist/api/resources/tts/types/NaturalSpecifier.d.ts +1 -1
  147. package/dist/api/resources/tts/types/NumericalSpecifier.d.ts +1 -1
  148. package/dist/api/resources/tts/types/OutputFormat.d.ts +1 -1
  149. package/dist/api/resources/tts/types/RawEncoding.d.ts +1 -1
  150. package/dist/api/resources/tts/types/RawOutputFormat.d.ts +1 -0
  151. package/dist/api/resources/tts/types/Speed.d.ts +1 -1
  152. package/dist/api/resources/tts/types/SupportedLanguage.d.ts +1 -1
  153. package/dist/api/resources/tts/types/TtsRequestVoiceSpecifier.d.ts +1 -1
  154. package/dist/api/resources/tts/types/WebSocketFlushDoneResponse.d.ts +8 -0
  155. package/dist/api/resources/tts/types/WebSocketFlushDoneResponse.js +5 -0
  156. package/dist/api/resources/tts/types/WebSocketRequest.d.ts +1 -1
  157. package/dist/api/resources/tts/types/WebSocketResponse.d.ts +4 -1
  158. package/dist/api/resources/tts/types/WebSocketTtsOutput.d.ts +2 -0
  159. package/dist/api/resources/tts/types/index.d.ts +2 -0
  160. package/dist/api/resources/tts/types/index.js +2 -0
  161. package/dist/api/resources/voiceChanger/client/Client.d.ts +3 -4
  162. package/dist/api/resources/voiceChanger/client/Client.js +23 -13
  163. package/dist/api/resources/voiceChanger/types/OutputFormatContainer.d.ts +1 -1
  164. package/dist/api/resources/voiceChanger/types/StreamingResponse.d.ts +1 -1
  165. package/dist/api/resources/voices/client/Client.d.ts +4 -1
  166. package/dist/api/resources/voices/client/Client.js +55 -45
  167. package/dist/api/resources/voices/types/BaseVoiceId.d.ts +1 -1
  168. package/dist/api/resources/voices/types/CloneMode.d.ts +1 -1
  169. package/dist/api/resources/voices/types/Gender.d.ts +1 -1
  170. package/dist/api/resources/voices/types/LocalizeDialect.d.ts +12 -4
  171. package/dist/api/resources/voices/types/LocalizeEnglishDialect.d.ts +1 -1
  172. package/dist/api/resources/voices/types/LocalizePortugueseDialect.d.ts +8 -0
  173. package/dist/api/resources/voices/types/LocalizePortugueseDialect.js +10 -0
  174. package/dist/api/resources/voices/types/LocalizeSpanishDialect.d.ts +8 -0
  175. package/dist/api/resources/voices/types/LocalizeSpanishDialect.js +10 -0
  176. package/dist/api/resources/voices/types/LocalizeTargetLanguage.d.ts +1 -1
  177. package/dist/api/resources/voices/types/MixVoiceSpecifier.d.ts +1 -1
  178. package/dist/api/resources/voices/types/VoiceId.d.ts +1 -1
  179. package/dist/api/resources/voices/types/Weight.d.ts +1 -1
  180. package/dist/api/resources/voices/types/index.d.ts +2 -0
  181. package/dist/api/resources/voices/types/index.js +2 -0
  182. package/dist/core/fetcher/APIResponse.d.ts +1 -1
  183. package/dist/core/fetcher/Fetcher.d.ts +1 -1
  184. package/dist/core/fetcher/Fetcher.js +2 -2
  185. package/dist/core/fetcher/Supplier.d.ts +1 -1
  186. package/dist/core/fetcher/createRequestUrl.d.ts +1 -1
  187. package/dist/core/fetcher/createRequestUrl.js +1 -2
  188. package/dist/core/fetcher/getFetchFn.js +18 -9
  189. package/dist/core/fetcher/getHeader.js +1 -2
  190. package/dist/core/fetcher/getRequestBody.js +5 -5
  191. package/dist/core/fetcher/getResponseBody.js +1 -2
  192. package/dist/core/fetcher/makeRequest.d.ts +1 -1
  193. package/dist/core/fetcher/requestWithRetries.js +4 -5
  194. package/dist/core/fetcher/signals.d.ts +0 -1
  195. package/dist/core/fetcher/signals.js +2 -3
  196. package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +0 -1
  197. package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +6 -4
  198. package/dist/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +1 -1
  199. package/dist/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +1 -1
  200. package/dist/core/fetcher/stream-wrappers/chooseStreamWrapper.js +18 -9
  201. package/dist/core/form-data-utils/FormDataWrapper.d.ts +4 -4
  202. package/dist/core/form-data-utils/FormDataWrapper.js +22 -12
  203. package/dist/core/index.js +17 -7
  204. package/dist/core/json.d.ts +15 -0
  205. package/dist/core/json.js +24 -0
  206. package/dist/core/runtime/runtime.d.ts +1 -1
  207. package/dist/core/runtime/runtime.js +51 -41
  208. package/dist/core/schemas/Schema.d.ts +7 -5
  209. package/dist/core/schemas/Schema.js +2 -0
  210. package/dist/core/schemas/builders/bigint/bigint.d.ts +1 -1
  211. package/dist/core/schemas/builders/bigint/bigint.js +22 -19
  212. package/dist/core/schemas/builders/date/date.js +1 -2
  213. package/dist/core/schemas/builders/enum/enum.js +1 -2
  214. package/dist/core/schemas/builders/lazy/lazy.d.ts +1 -1
  215. package/dist/core/schemas/builders/lazy/lazy.js +3 -4
  216. package/dist/core/schemas/builders/lazy/lazyObject.js +1 -2
  217. package/dist/core/schemas/builders/list/list.js +1 -2
  218. package/dist/core/schemas/builders/literals/booleanLiteral.js +1 -2
  219. package/dist/core/schemas/builders/literals/stringLiteral.js +1 -2
  220. package/dist/core/schemas/builders/object/object.d.ts +1 -1
  221. package/dist/core/schemas/builders/object/object.js +31 -3
  222. package/dist/core/schemas/builders/object/objectWithoutOptionalProperties.d.ts +3 -3
  223. package/dist/core/schemas/builders/object/objectWithoutOptionalProperties.js +1 -2
  224. package/dist/core/schemas/builders/object/property.js +2 -3
  225. package/dist/core/schemas/builders/object/types.d.ts +16 -11
  226. package/dist/core/schemas/builders/object-like/getObjectLikeUtils.js +2 -3
  227. package/dist/core/schemas/builders/object-like/types.d.ts +1 -1
  228. package/dist/core/schemas/builders/record/record.js +2 -4
  229. package/dist/core/schemas/builders/record/types.d.ts +2 -2
  230. package/dist/core/schemas/builders/schema-utils/getSchemaUtils.d.ts +4 -0
  231. package/dist/core/schemas/builders/schema-utils/getSchemaUtils.js +67 -4
  232. package/dist/core/schemas/builders/schema-utils/stringifyValidationErrors.js +1 -2
  233. package/dist/core/schemas/builders/set/set.js +1 -2
  234. package/dist/core/schemas/builders/undiscriminated-union/types.d.ts +4 -4
  235. package/dist/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.js +1 -2
  236. package/dist/core/schemas/builders/union/discriminant.js +1 -2
  237. package/dist/core/schemas/builders/union/types.d.ts +6 -6
  238. package/dist/core/schemas/builders/union/union.d.ts +1 -1
  239. package/dist/core/schemas/builders/union/union.js +1 -2
  240. package/dist/core/schemas/utils/MaybePromise.d.ts +1 -1
  241. package/dist/core/schemas/utils/addQuestionMarksToNullableProperties.d.ts +4 -4
  242. package/dist/core/schemas/utils/createIdentitySchemaCreator.js +1 -2
  243. package/dist/core/schemas/utils/entries.d.ts +1 -1
  244. package/dist/core/schemas/utils/entries.js +1 -2
  245. package/dist/core/schemas/utils/filterObject.d.ts +1 -1
  246. package/dist/core/schemas/utils/filterObject.js +1 -2
  247. package/dist/core/schemas/utils/getErrorMessageForIncorrectType.js +1 -2
  248. package/dist/core/schemas/utils/isPlainObject.js +1 -2
  249. package/dist/core/schemas/utils/keys.d.ts +1 -1
  250. package/dist/core/schemas/utils/keys.js +1 -2
  251. package/dist/core/schemas/utils/maybeSkipValidation.js +1 -2
  252. package/dist/core/schemas/utils/partition.js +1 -2
  253. package/dist/core/streaming-fetcher/Stream.d.ts +0 -1
  254. package/dist/core/streaming-fetcher/Stream.js +20 -21
  255. package/dist/core/websocket/ws.d.ts +7 -7
  256. package/dist/core/websocket/ws.js +17 -7
  257. package/dist/environments.d.ts +1 -1
  258. package/dist/errors/CartesiaError.js +2 -1
  259. package/dist/errors/CartesiaTimeoutError.d.ts +1 -1
  260. package/dist/errors/CartesiaTimeoutError.js +2 -2
  261. package/dist/index.js +17 -7
  262. package/dist/serialization/resources/apiStatus/types/ApiInfo.js +17 -7
  263. package/dist/serialization/resources/datasets/types/CreateDatasetRequest.js +17 -7
  264. package/dist/serialization/resources/datasets/types/Dataset.js +17 -7
  265. package/dist/serialization/resources/datasets/types/DatasetFile.js +17 -7
  266. package/dist/serialization/resources/datasets/types/FilePurpose.js +17 -7
  267. package/dist/serialization/resources/datasets/types/PaginatedDatasetFiles.js +17 -7
  268. package/dist/serialization/resources/datasets/types/PaginatedDatasets.js +17 -7
  269. package/dist/serialization/resources/embedding/types/Embedding.js +17 -7
  270. package/dist/serialization/resources/index.js +17 -7
  271. package/dist/serialization/resources/tts/types/CancelContextRequest.js +17 -7
  272. package/dist/serialization/resources/tts/types/ContextId.js +17 -7
  273. package/dist/serialization/resources/tts/types/Controls.js +17 -7
  274. package/dist/serialization/resources/tts/types/Emotion.js +17 -7
  275. package/dist/serialization/resources/tts/types/FlushId.d.ts +10 -0
  276. package/dist/serialization/resources/tts/types/FlushId.js +41 -0
  277. package/dist/serialization/resources/tts/types/GenerationRequest.d.ts +3 -2
  278. package/dist/serialization/resources/tts/types/GenerationRequest.js +20 -9
  279. package/dist/serialization/resources/tts/types/Mp3OutputFormat.js +17 -7
  280. package/dist/serialization/resources/tts/types/NaturalSpecifier.js +17 -7
  281. package/dist/serialization/resources/tts/types/NumericalSpecifier.js +17 -7
  282. package/dist/serialization/resources/tts/types/OutputFormat.js +17 -7
  283. package/dist/serialization/resources/tts/types/PhonemeTimestamps.js +17 -7
  284. package/dist/serialization/resources/tts/types/RawEncoding.js +17 -7
  285. package/dist/serialization/resources/tts/types/RawOutputFormat.d.ts +1 -0
  286. package/dist/serialization/resources/tts/types/RawOutputFormat.js +18 -7
  287. package/dist/serialization/resources/tts/types/Speed.js +17 -7
  288. package/dist/serialization/resources/tts/types/SupportedLanguage.js +17 -7
  289. package/dist/serialization/resources/tts/types/TtsRequest.js +17 -7
  290. package/dist/serialization/resources/tts/types/TtsRequestEmbeddingSpecifier.js +17 -7
  291. package/dist/serialization/resources/tts/types/TtsRequestIdSpecifier.js +17 -7
  292. package/dist/serialization/resources/tts/types/TtsRequestVoiceSpecifier.js +17 -7
  293. package/dist/serialization/resources/tts/types/WavOutputFormat.js +17 -7
  294. package/dist/serialization/resources/tts/types/WebSocketBaseResponse.js +17 -7
  295. package/dist/serialization/resources/tts/types/WebSocketChunkResponse.js +17 -7
  296. package/dist/serialization/resources/tts/types/WebSocketDoneResponse.js +17 -7
  297. package/dist/serialization/resources/tts/types/WebSocketErrorResponse.js +17 -7
  298. package/dist/serialization/resources/tts/types/WebSocketFlushDoneResponse.d.ts +15 -0
  299. package/dist/serialization/resources/tts/types/WebSocketFlushDoneResponse.js +48 -0
  300. package/dist/serialization/resources/tts/types/WebSocketPhonemeTimestampsResponse.js +17 -7
  301. package/dist/serialization/resources/tts/types/WebSocketRawOutputFormat.js +17 -7
  302. package/dist/serialization/resources/tts/types/WebSocketRequest.js +17 -7
  303. package/dist/serialization/resources/tts/types/WebSocketResponse.d.ts +5 -1
  304. package/dist/serialization/resources/tts/types/WebSocketResponse.js +19 -7
  305. package/dist/serialization/resources/tts/types/WebSocketStreamOptions.js +17 -7
  306. package/dist/serialization/resources/tts/types/WebSocketTimestampsResponse.js +17 -7
  307. package/dist/serialization/resources/tts/types/WebSocketTtsOutput.d.ts +3 -0
  308. package/dist/serialization/resources/tts/types/WebSocketTtsOutput.js +20 -7
  309. package/dist/serialization/resources/tts/types/WebSocketTtsRequest.js +17 -7
  310. package/dist/serialization/resources/tts/types/WordTimestamps.js +17 -7
  311. package/dist/serialization/resources/tts/types/index.d.ts +2 -0
  312. package/dist/serialization/resources/tts/types/index.js +2 -0
  313. package/dist/serialization/resources/voiceChanger/types/OutputFormatContainer.js +17 -7
  314. package/dist/serialization/resources/voiceChanger/types/StreamingResponse.js +17 -7
  315. package/dist/serialization/resources/voices/client/index.js +17 -7
  316. package/dist/serialization/resources/voices/client/list.js +17 -7
  317. package/dist/serialization/resources/voices/types/CloneMode.js +17 -7
  318. package/dist/serialization/resources/voices/types/CreateVoiceRequest.js +17 -7
  319. package/dist/serialization/resources/voices/types/EmbeddingResponse.js +17 -7
  320. package/dist/serialization/resources/voices/types/EmbeddingSpecifier.js +17 -7
  321. package/dist/serialization/resources/voices/types/Gender.js +17 -7
  322. package/dist/serialization/resources/voices/types/IdSpecifier.js +17 -7
  323. package/dist/serialization/resources/voices/types/LocalizeDialect.d.ts +3 -1
  324. package/dist/serialization/resources/voices/types/LocalizeDialect.js +24 -8
  325. package/dist/serialization/resources/voices/types/LocalizeEnglishDialect.js +17 -7
  326. package/dist/serialization/resources/voices/types/LocalizePortugueseDialect.d.ts +10 -0
  327. package/dist/serialization/resources/voices/types/LocalizePortugueseDialect.js +41 -0
  328. package/dist/serialization/resources/voices/types/LocalizeSpanishDialect.d.ts +10 -0
  329. package/dist/serialization/resources/voices/types/LocalizeSpanishDialect.js +41 -0
  330. package/dist/serialization/resources/voices/types/LocalizeTargetLanguage.js +17 -7
  331. package/dist/serialization/resources/voices/types/LocalizeVoiceRequest.js +17 -7
  332. package/dist/serialization/resources/voices/types/MixVoiceSpecifier.js +17 -7
  333. package/dist/serialization/resources/voices/types/MixVoicesRequest.js +17 -7
  334. package/dist/serialization/resources/voices/types/UpdateVoiceRequest.js +17 -7
  335. package/dist/serialization/resources/voices/types/Voice.js +17 -7
  336. package/dist/serialization/resources/voices/types/VoiceId.js +17 -7
  337. package/dist/serialization/resources/voices/types/VoiceMetadata.js +17 -7
  338. package/dist/serialization/resources/voices/types/Weight.js +17 -7
  339. package/dist/serialization/resources/voices/types/index.d.ts +2 -0
  340. package/dist/serialization/resources/voices/types/index.js +2 -0
  341. package/dist/version.d.ts +1 -1
  342. package/dist/version.js +1 -1
  343. package/dist/wrapper/WebPlayer.js +1 -1
  344. package/dist/wrapper/Websocket.js +25 -15
  345. package/dist/wrapper/source.js +1 -1
  346. package/dist/wrapper/utils.d.ts +9 -9
  347. package/dist/wrapper/utils.js +10 -10
  348. package/environments.d.ts +1 -1
  349. package/errors/CartesiaError.js +2 -1
  350. package/errors/CartesiaTimeoutError.d.ts +1 -1
  351. package/errors/CartesiaTimeoutError.js +2 -2
  352. package/index.js +17 -7
  353. package/{jest.config.js → jest.config.mjs} +4 -1
  354. package/package.json +15 -16
  355. package/reference.md +4 -0
  356. package/scripts/rename-to-esm-files.js +115 -0
  357. package/serialization/resources/apiStatus/types/ApiInfo.js +17 -7
  358. package/serialization/resources/datasets/types/CreateDatasetRequest.js +17 -7
  359. package/serialization/resources/datasets/types/Dataset.js +17 -7
  360. package/serialization/resources/datasets/types/DatasetFile.js +17 -7
  361. package/serialization/resources/datasets/types/FilePurpose.js +17 -7
  362. package/serialization/resources/datasets/types/PaginatedDatasetFiles.js +17 -7
  363. package/serialization/resources/datasets/types/PaginatedDatasets.js +17 -7
  364. package/serialization/resources/embedding/types/Embedding.js +17 -7
  365. package/serialization/resources/index.js +17 -7
  366. package/serialization/resources/tts/types/CancelContextRequest.js +17 -7
  367. package/serialization/resources/tts/types/ContextId.js +17 -7
  368. package/serialization/resources/tts/types/Controls.js +17 -7
  369. package/serialization/resources/tts/types/Emotion.js +17 -7
  370. package/serialization/resources/tts/types/FlushId.d.ts +10 -0
  371. package/serialization/resources/tts/types/FlushId.js +41 -0
  372. package/serialization/resources/tts/types/GenerationRequest.d.ts +3 -2
  373. package/serialization/resources/tts/types/GenerationRequest.js +20 -9
  374. package/serialization/resources/tts/types/Mp3OutputFormat.js +17 -7
  375. package/serialization/resources/tts/types/NaturalSpecifier.js +17 -7
  376. package/serialization/resources/tts/types/NumericalSpecifier.js +17 -7
  377. package/serialization/resources/tts/types/OutputFormat.js +17 -7
  378. package/serialization/resources/tts/types/PhonemeTimestamps.js +17 -7
  379. package/serialization/resources/tts/types/RawEncoding.js +17 -7
  380. package/serialization/resources/tts/types/RawOutputFormat.d.ts +1 -0
  381. package/serialization/resources/tts/types/RawOutputFormat.js +18 -7
  382. package/serialization/resources/tts/types/Speed.js +17 -7
  383. package/serialization/resources/tts/types/SupportedLanguage.js +17 -7
  384. package/serialization/resources/tts/types/TtsRequest.js +17 -7
  385. package/serialization/resources/tts/types/TtsRequestEmbeddingSpecifier.js +17 -7
  386. package/serialization/resources/tts/types/TtsRequestIdSpecifier.js +17 -7
  387. package/serialization/resources/tts/types/TtsRequestVoiceSpecifier.js +17 -7
  388. package/serialization/resources/tts/types/WavOutputFormat.js +17 -7
  389. package/serialization/resources/tts/types/WebSocketBaseResponse.js +17 -7
  390. package/serialization/resources/tts/types/WebSocketChunkResponse.js +17 -7
  391. package/serialization/resources/tts/types/WebSocketDoneResponse.js +17 -7
  392. package/serialization/resources/tts/types/WebSocketErrorResponse.js +17 -7
  393. package/serialization/resources/tts/types/WebSocketFlushDoneResponse.d.ts +15 -0
  394. package/serialization/resources/tts/types/WebSocketFlushDoneResponse.js +48 -0
  395. package/serialization/resources/tts/types/WebSocketPhonemeTimestampsResponse.js +17 -7
  396. package/serialization/resources/tts/types/WebSocketRawOutputFormat.js +17 -7
  397. package/serialization/resources/tts/types/WebSocketRequest.js +17 -7
  398. package/serialization/resources/tts/types/WebSocketResponse.d.ts +5 -1
  399. package/serialization/resources/tts/types/WebSocketResponse.js +19 -7
  400. package/serialization/resources/tts/types/WebSocketStreamOptions.js +17 -7
  401. package/serialization/resources/tts/types/WebSocketTimestampsResponse.js +17 -7
  402. package/serialization/resources/tts/types/WebSocketTtsOutput.d.ts +3 -0
  403. package/serialization/resources/tts/types/WebSocketTtsOutput.js +20 -7
  404. package/serialization/resources/tts/types/WebSocketTtsRequest.js +17 -7
  405. package/serialization/resources/tts/types/WordTimestamps.js +17 -7
  406. package/serialization/resources/tts/types/index.d.ts +2 -0
  407. package/serialization/resources/tts/types/index.js +2 -0
  408. package/serialization/resources/voiceChanger/types/OutputFormatContainer.js +17 -7
  409. package/serialization/resources/voiceChanger/types/StreamingResponse.js +17 -7
  410. package/serialization/resources/voices/client/index.js +17 -7
  411. package/serialization/resources/voices/client/list.js +17 -7
  412. package/serialization/resources/voices/types/CloneMode.js +17 -7
  413. package/serialization/resources/voices/types/CreateVoiceRequest.js +17 -7
  414. package/serialization/resources/voices/types/EmbeddingResponse.js +17 -7
  415. package/serialization/resources/voices/types/EmbeddingSpecifier.js +17 -7
  416. package/serialization/resources/voices/types/Gender.js +17 -7
  417. package/serialization/resources/voices/types/IdSpecifier.js +17 -7
  418. package/serialization/resources/voices/types/LocalizeDialect.d.ts +3 -1
  419. package/serialization/resources/voices/types/LocalizeDialect.js +24 -8
  420. package/serialization/resources/voices/types/LocalizeEnglishDialect.js +17 -7
  421. package/serialization/resources/voices/types/LocalizePortugueseDialect.d.ts +10 -0
  422. package/serialization/resources/voices/types/LocalizePortugueseDialect.js +41 -0
  423. package/serialization/resources/voices/types/LocalizeSpanishDialect.d.ts +10 -0
  424. package/serialization/resources/voices/types/LocalizeSpanishDialect.js +41 -0
  425. package/serialization/resources/voices/types/LocalizeTargetLanguage.js +17 -7
  426. package/serialization/resources/voices/types/LocalizeVoiceRequest.js +17 -7
  427. package/serialization/resources/voices/types/MixVoiceSpecifier.js +17 -7
  428. package/serialization/resources/voices/types/MixVoicesRequest.js +17 -7
  429. package/serialization/resources/voices/types/UpdateVoiceRequest.js +17 -7
  430. package/serialization/resources/voices/types/Voice.js +17 -7
  431. package/serialization/resources/voices/types/VoiceId.js +17 -7
  432. package/serialization/resources/voices/types/VoiceMetadata.js +17 -7
  433. package/serialization/resources/voices/types/Weight.js +17 -7
  434. package/serialization/resources/voices/types/index.d.ts +2 -0
  435. package/serialization/resources/voices/types/index.js +2 -0
  436. package/version.d.ts +1 -1
  437. package/version.js +1 -1
  438. package/wrapper/WebPlayer.js +1 -1
  439. package/wrapper/Websocket.js +25 -15
  440. package/wrapper/source.js +1 -1
  441. package/wrapper/utils.d.ts +9 -9
  442. package/wrapper/utils.js +10 -10
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
- export declare type RawEncoding = "pcm_f32le" | "pcm_s16le" | "pcm_mulaw" | "pcm_alaw";
4
+ export type RawEncoding = "pcm_f32le" | "pcm_s16le" | "pcm_mulaw" | "pcm_alaw";
5
5
  export declare const RawEncoding: {
6
6
  readonly PcmF32Le: "pcm_f32le";
7
7
  readonly PcmS16Le: "pcm_s16le";
@@ -5,4 +5,5 @@ import * as Cartesia from "../../../index";
5
5
  export interface RawOutputFormat {
6
6
  encoding: Cartesia.RawEncoding;
7
7
  sampleRate: number;
8
+ bitRate?: number;
8
9
  }
@@ -7,4 +7,4 @@ import * as Cartesia from "../../../index";
7
7
  *
8
8
  * If you specify a number, 0.0 is the default speed, -1.0 is the slowest speed, and 1.0 is the fastest speed.
9
9
  */
10
- export declare type Speed = Cartesia.NumericalSpecifier | Cartesia.NaturalSpecifier;
10
+ export type Speed = Cartesia.NumericalSpecifier | Cartesia.NaturalSpecifier;
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * Options: English (en), French (fr), German (de), Spanish (es), Portuguese (pt), Chinese (zh), Japanese (ja), Hindi (hi), Italian (it), Korean (ko), Dutch (nl), Polish (pl), Russian (ru), Swedish (sv), Turkish (tr).
8
8
  */
9
- export declare type SupportedLanguage = "en" | "fr" | "de" | "es" | "pt" | "zh" | "ja" | "hi" | "it" | "ko" | "nl" | "pl" | "ru" | "sv" | "tr";
9
+ export type SupportedLanguage = "en" | "fr" | "de" | "es" | "pt" | "zh" | "ja" | "hi" | "it" | "ko" | "nl" | "pl" | "ru" | "sv" | "tr";
10
10
  export declare const SupportedLanguage: {
11
11
  readonly En: "en";
12
12
  readonly Fr: "fr";
@@ -2,4 +2,4 @@
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
4
  import * as Cartesia from "../../../index";
5
- export declare type TtsRequestVoiceSpecifier = Cartesia.TtsRequestIdSpecifier | Cartesia.TtsRequestEmbeddingSpecifier;
5
+ export type TtsRequestVoiceSpecifier = Cartesia.TtsRequestIdSpecifier | Cartesia.TtsRequestEmbeddingSpecifier;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Cartesia from "../../../index";
5
+ export interface WebSocketFlushDoneResponse extends Cartesia.WebSocketBaseResponse {
6
+ flushId: Cartesia.FlushId;
7
+ flushDone: boolean;
8
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -2,7 +2,7 @@
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
4
  import * as Cartesia from "../../../index";
5
- export declare type WebSocketRequest =
5
+ export type WebSocketRequest =
6
6
  /**
7
7
  * Use this to generate speech for a transcript.
8
8
  * */
@@ -2,11 +2,14 @@
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
4
  import * as Cartesia from "../../../index";
5
- export declare type WebSocketResponse = Cartesia.WebSocketResponse.Chunk | Cartesia.WebSocketResponse.Done | Cartesia.WebSocketResponse.Timestamps | Cartesia.WebSocketResponse.Error_ | Cartesia.WebSocketResponse.PhonemeTimestamps;
5
+ export type WebSocketResponse = Cartesia.WebSocketResponse.Chunk | Cartesia.WebSocketResponse.FlushDone | Cartesia.WebSocketResponse.Done | Cartesia.WebSocketResponse.Timestamps | Cartesia.WebSocketResponse.Error_ | Cartesia.WebSocketResponse.PhonemeTimestamps;
6
6
  export declare namespace WebSocketResponse {
7
7
  interface Chunk extends Cartesia.WebSocketChunkResponse {
8
8
  type: "chunk";
9
9
  }
10
+ interface FlushDone extends Cartesia.WebSocketFlushDoneResponse {
11
+ type: "flush_done";
12
+ }
10
13
  interface Done extends Cartesia.WebSocketDoneResponse {
11
14
  type: "done";
12
15
  }
@@ -7,4 +7,6 @@ export interface WebSocketTtsOutput {
7
7
  phonemeTimestamps?: Cartesia.PhonemeTimestamps;
8
8
  audio?: unknown;
9
9
  contextId?: Cartesia.ContextId;
10
+ flushId?: Cartesia.FlushId;
11
+ flushDone?: boolean;
10
12
  }
@@ -1,4 +1,5 @@
1
1
  export * from "./ContextId";
2
+ export * from "./FlushId";
2
3
  export * from "./WebSocketBaseResponse";
3
4
  export * from "./WebSocketResponse";
4
5
  export * from "./WebSocketErrorResponse";
@@ -10,6 +11,7 @@ export * from "./WebSocketStreamOptions";
10
11
  export * from "./WordTimestamps";
11
12
  export * from "./PhonemeTimestamps";
12
13
  export * from "./WebSocketDoneResponse";
14
+ export * from "./WebSocketFlushDoneResponse";
13
15
  export * from "./CancelContextRequest";
14
16
  export * from "./GenerationRequest";
15
17
  export * from "./WebSocketRawOutputFormat";
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./ContextId"), exports);
18
+ __exportStar(require("./FlushId"), exports);
18
19
  __exportStar(require("./WebSocketBaseResponse"), exports);
19
20
  __exportStar(require("./WebSocketResponse"), exports);
20
21
  __exportStar(require("./WebSocketErrorResponse"), exports);
@@ -26,6 +27,7 @@ __exportStar(require("./WebSocketStreamOptions"), exports);
26
27
  __exportStar(require("./WordTimestamps"), exports);
27
28
  __exportStar(require("./PhonemeTimestamps"), exports);
28
29
  __exportStar(require("./WebSocketDoneResponse"), exports);
30
+ __exportStar(require("./WebSocketFlushDoneResponse"), exports);
29
31
  __exportStar(require("./CancelContextRequest"), exports);
30
32
  __exportStar(require("./GenerationRequest"), exports);
31
33
  __exportStar(require("./WebSocketRawOutputFormat"), exports);
@@ -1,11 +1,10 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
- /// <reference types="node" />
5
- import * as environments from "../../../../environments";
6
- import * as core from "../../../../core";
7
- import * as fs from "fs";
8
4
  import { Blob } from "buffer";
5
+ import * as fs from "fs";
6
+ import * as core from "../../../../core";
7
+ import * as environments from "../../../../environments";
9
8
  import * as Cartesia from "../../../index";
10
9
  export declare namespace VoiceChanger {
11
10
  interface Options {
@@ -18,13 +18,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
18
18
  }) : function(o, v) {
19
19
  o["default"] = v;
20
20
  });
21
- var __importStar = (this && this.__importStar) || function (mod) {
22
- if (mod && mod.__esModule) return mod;
23
- var result = {};
24
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
- __setModuleDefault(result, mod);
26
- return result;
27
- };
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
28
38
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
29
39
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
30
40
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -39,9 +49,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
39
49
  };
40
50
  Object.defineProperty(exports, "__esModule", { value: true });
41
51
  exports.VoiceChanger = void 0;
42
- const environments = __importStar(require("../../../../environments"));
43
- const core = __importStar(require("../../../../core"));
44
52
  const url_join_1 = __importDefault(require("url-join"));
53
+ const core = __importStar(require("../../../../core"));
54
+ const environments = __importStar(require("../../../../environments"));
45
55
  const errors = __importStar(require("../../../../errors/index"));
46
56
  const serializers = __importStar(require("../../../../serialization/index"));
47
57
  class VoiceChanger {
@@ -54,8 +64,8 @@ class VoiceChanger {
54
64
  * This endpoint is priced at 15 characters per second of input audio.
55
65
  */
56
66
  bytes(clip, request, requestOptions) {
57
- var _a, _b, _c, _d, _e;
58
67
  return __awaiter(this, void 0, void 0, function* () {
68
+ var _a, _b, _c, _d, _e;
59
69
  const _request = yield core.newFormData();
60
70
  yield _request.appendFile("clip", clip);
61
71
  yield _request.append("voice[id]", request.voiceId);
@@ -96,7 +106,7 @@ class VoiceChanger {
96
106
  body: _response.error.rawBody,
97
107
  });
98
108
  case "timeout":
99
- throw new errors.CartesiaTimeoutError();
109
+ throw new errors.CartesiaTimeoutError("Timeout exceeded when calling POST /voice-changer/bytes.");
100
110
  case "unknown":
101
111
  throw new errors.CartesiaError({
102
112
  message: _response.error.errorMessage,
@@ -105,8 +115,8 @@ class VoiceChanger {
105
115
  });
106
116
  }
107
117
  sse(clip, request, requestOptions) {
108
- var _a, _b, _c, _d, _e;
109
118
  return __awaiter(this, void 0, void 0, function* () {
119
+ var _a, _b, _c, _d, _e;
110
120
  const _request = yield core.newFormData();
111
121
  yield _request.appendFile("clip", clip);
112
122
  yield _request.append("voice[id]", request.voiceId);
@@ -163,7 +173,7 @@ class VoiceChanger {
163
173
  body: _response.error.rawBody,
164
174
  });
165
175
  case "timeout":
166
- throw new errors.CartesiaTimeoutError();
176
+ throw new errors.CartesiaTimeoutError("Timeout exceeded when calling POST /voice-changer/sse.");
167
177
  case "unknown":
168
178
  throw new errors.CartesiaError({
169
179
  message: _response.error.errorMessage,
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
- export declare type OutputFormatContainer = "raw" | "wav" | "mp3";
4
+ export type OutputFormatContainer = "raw" | "wav" | "mp3";
5
5
  export declare const OutputFormatContainer: {
6
6
  readonly Raw: "raw";
7
7
  readonly Wav: "wav";
@@ -2,7 +2,7 @@
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
4
  import * as Cartesia from "../../../index";
5
- export declare type StreamingResponse = Cartesia.StreamingResponse.Chunk | Cartesia.StreamingResponse.Done | Cartesia.StreamingResponse.Error_;
5
+ export type StreamingResponse = Cartesia.StreamingResponse.Chunk | Cartesia.StreamingResponse.Done | Cartesia.StreamingResponse.Error_;
6
6
  export declare namespace StreamingResponse {
7
7
  interface Chunk extends Cartesia.WebSocketChunkResponse {
8
8
  type: "chunk";
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
- /// <reference types="node" />
5
4
  import * as environments from "../../../../environments";
6
5
  import * as core from "../../../../core";
7
6
  import * as Cartesia from "../../../index";
@@ -10,6 +9,8 @@ import { Blob } from "buffer";
10
9
  export declare namespace Voices {
11
10
  interface Options {
12
11
  environment?: core.Supplier<environments.CartesiaEnvironment | string>;
12
+ /** Specify a custom URL to connect the client to. */
13
+ baseUrl?: core.Supplier<string>;
13
14
  apiKey?: core.Supplier<string | undefined>;
14
15
  /** Override the Cartesia-Version header */
15
16
  cartesiaVersion?: "2024-06-10";
@@ -24,6 +25,8 @@ export declare namespace Voices {
24
25
  abortSignal?: AbortSignal;
25
26
  /** Override the Cartesia-Version header */
26
27
  cartesiaVersion?: "2024-06-10";
28
+ /** Additional headers to include in the request. */
29
+ headers?: Record<string, string>;
27
30
  }
28
31
  }
29
32
  export declare class Voices {
@@ -18,13 +18,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
18
18
  }) : function(o, v) {
19
19
  o["default"] = v;
20
20
  });
21
- var __importStar = (this && this.__importStar) || function (mod) {
22
- if (mod && mod.__esModule) return mod;
23
- var result = {};
24
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
- __setModuleDefault(result, mod);
26
- return result;
27
- };
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
28
38
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
29
39
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
30
40
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -55,12 +65,12 @@ class Voices {
55
65
  * await client.voices.list()
56
66
  */
57
67
  list(requestOptions) {
58
- var _a, _b, _c, _d, _e;
59
68
  return __awaiter(this, void 0, void 0, function* () {
69
+ var _a, _b, _c, _d, _e, _f;
60
70
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
61
- url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CartesiaEnvironment.Production, "/voices/"),
71
+ url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CartesiaEnvironment.Production, "/voices/"),
62
72
  method: "GET",
63
- headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1.4", "User-Agent": "@cartesia/cartesia-js/2.1.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
73
+ headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1.5", "User-Agent": "@cartesia/cartesia-js/2.1.5", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
64
74
  contentType: "application/json",
65
75
  requestType: "json",
66
76
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -89,7 +99,7 @@ class Voices {
89
99
  body: _response.error.rawBody,
90
100
  });
91
101
  case "timeout":
92
- throw new errors.CartesiaTimeoutError();
102
+ throw new errors.CartesiaTimeoutError("Timeout exceeded when calling GET /voices/.");
93
103
  case "unknown":
94
104
  throw new errors.CartesiaError({
95
105
  message: _response.error.errorMessage,
@@ -110,12 +120,12 @@ class Voices {
110
120
  * })
111
121
  */
112
122
  create(request, requestOptions) {
113
- var _a, _b, _c, _d, _e;
114
123
  return __awaiter(this, void 0, void 0, function* () {
124
+ var _a, _b, _c, _d, _e, _f;
115
125
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
116
- url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CartesiaEnvironment.Production, "/voices/"),
126
+ url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CartesiaEnvironment.Production, "/voices/"),
117
127
  method: "POST",
118
- headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1.4", "User-Agent": "@cartesia/cartesia-js/2.1.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
128
+ headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1.5", "User-Agent": "@cartesia/cartesia-js/2.1.5", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
119
129
  contentType: "application/json",
120
130
  requestType: "json",
121
131
  body: serializers.CreateVoiceRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -145,7 +155,7 @@ class Voices {
145
155
  body: _response.error.rawBody,
146
156
  });
147
157
  case "timeout":
148
- throw new errors.CartesiaTimeoutError();
158
+ throw new errors.CartesiaTimeoutError("Timeout exceeded when calling POST /voices/.");
149
159
  case "unknown":
150
160
  throw new errors.CartesiaError({
151
161
  message: _response.error.errorMessage,
@@ -161,12 +171,12 @@ class Voices {
161
171
  * await client.voices.delete("string")
162
172
  */
163
173
  delete(id, requestOptions) {
164
- var _a, _b, _c, _d, _e;
165
174
  return __awaiter(this, void 0, void 0, function* () {
175
+ var _a, _b, _c, _d, _e, _f;
166
176
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
167
- url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CartesiaEnvironment.Production, `/voices/${encodeURIComponent(serializers.VoiceId.jsonOrThrow(id))}`),
177
+ url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CartesiaEnvironment.Production, `/voices/${encodeURIComponent(serializers.VoiceId.jsonOrThrow(id))}`),
168
178
  method: "DELETE",
169
- headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1.4", "User-Agent": "@cartesia/cartesia-js/2.1.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
179
+ headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1.5", "User-Agent": "@cartesia/cartesia-js/2.1.5", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
170
180
  contentType: "application/json",
171
181
  requestType: "json",
172
182
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -189,7 +199,7 @@ class Voices {
189
199
  body: _response.error.rawBody,
190
200
  });
191
201
  case "timeout":
192
- throw new errors.CartesiaTimeoutError();
202
+ throw new errors.CartesiaTimeoutError("Timeout exceeded when calling DELETE /voices/{id}.");
193
203
  case "unknown":
194
204
  throw new errors.CartesiaError({
195
205
  message: _response.error.errorMessage,
@@ -209,12 +219,12 @@ class Voices {
209
219
  * })
210
220
  */
211
221
  update(id, request, requestOptions) {
212
- var _a, _b, _c, _d, _e;
213
222
  return __awaiter(this, void 0, void 0, function* () {
223
+ var _a, _b, _c, _d, _e, _f;
214
224
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
215
- url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CartesiaEnvironment.Production, `/voices/${encodeURIComponent(serializers.VoiceId.jsonOrThrow(id))}`),
225
+ url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CartesiaEnvironment.Production, `/voices/${encodeURIComponent(serializers.VoiceId.jsonOrThrow(id))}`),
216
226
  method: "PATCH",
217
- headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1.4", "User-Agent": "@cartesia/cartesia-js/2.1.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
227
+ headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1.5", "User-Agent": "@cartesia/cartesia-js/2.1.5", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
218
228
  contentType: "application/json",
219
229
  requestType: "json",
220
230
  body: serializers.UpdateVoiceRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -244,7 +254,7 @@ class Voices {
244
254
  body: _response.error.rawBody,
245
255
  });
246
256
  case "timeout":
247
- throw new errors.CartesiaTimeoutError();
257
+ throw new errors.CartesiaTimeoutError("Timeout exceeded when calling PATCH /voices/{id}.");
248
258
  case "unknown":
249
259
  throw new errors.CartesiaError({
250
260
  message: _response.error.errorMessage,
@@ -260,12 +270,12 @@ class Voices {
260
270
  * await client.voices.get("string")
261
271
  */
262
272
  get(id, requestOptions) {
263
- var _a, _b, _c, _d, _e;
264
273
  return __awaiter(this, void 0, void 0, function* () {
274
+ var _a, _b, _c, _d, _e, _f;
265
275
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
266
- url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CartesiaEnvironment.Production, `/voices/${encodeURIComponent(serializers.VoiceId.jsonOrThrow(id))}`),
276
+ url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CartesiaEnvironment.Production, `/voices/${encodeURIComponent(serializers.VoiceId.jsonOrThrow(id))}`),
267
277
  method: "GET",
268
- headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1.4", "User-Agent": "@cartesia/cartesia-js/2.1.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
278
+ headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1.5", "User-Agent": "@cartesia/cartesia-js/2.1.5", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
269
279
  contentType: "application/json",
270
280
  requestType: "json",
271
281
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -294,7 +304,7 @@ class Voices {
294
304
  body: _response.error.rawBody,
295
305
  });
296
306
  case "timeout":
297
- throw new errors.CartesiaTimeoutError();
307
+ throw new errors.CartesiaTimeoutError("Timeout exceeded when calling GET /voices/{id}.");
298
308
  case "unknown":
299
309
  throw new errors.CartesiaError({
300
310
  message: _response.error.errorMessage,
@@ -315,12 +325,12 @@ class Voices {
315
325
  * })
316
326
  */
317
327
  localize(request, requestOptions) {
318
- var _a, _b, _c, _d, _e;
319
328
  return __awaiter(this, void 0, void 0, function* () {
329
+ var _a, _b, _c, _d, _e, _f;
320
330
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
321
- url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CartesiaEnvironment.Production, "/voices/localize"),
331
+ url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CartesiaEnvironment.Production, "/voices/localize"),
322
332
  method: "POST",
323
- headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1.4", "User-Agent": "@cartesia/cartesia-js/2.1.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
333
+ headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1.5", "User-Agent": "@cartesia/cartesia-js/2.1.5", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
324
334
  contentType: "application/json",
325
335
  requestType: "json",
326
336
  body: serializers.LocalizeVoiceRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -350,7 +360,7 @@ class Voices {
350
360
  body: _response.error.rawBody,
351
361
  });
352
362
  case "timeout":
353
- throw new errors.CartesiaTimeoutError();
363
+ throw new errors.CartesiaTimeoutError("Timeout exceeded when calling POST /voices/localize.");
354
364
  case "unknown":
355
365
  throw new errors.CartesiaError({
356
366
  message: _response.error.errorMessage,
@@ -371,12 +381,12 @@ class Voices {
371
381
  * })
372
382
  */
373
383
  mix(request, requestOptions) {
374
- var _a, _b, _c, _d, _e;
375
384
  return __awaiter(this, void 0, void 0, function* () {
385
+ var _a, _b, _c, _d, _e, _f;
376
386
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
377
- url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CartesiaEnvironment.Production, "/voices/mix"),
387
+ url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CartesiaEnvironment.Production, "/voices/mix"),
378
388
  method: "POST",
379
- headers: Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1.4", "User-Agent": "@cartesia/cartesia-js/2.1.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
389
+ headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1.5", "User-Agent": "@cartesia/cartesia-js/2.1.5", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
380
390
  contentType: "application/json",
381
391
  requestType: "json",
382
392
  body: serializers.MixVoicesRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -406,7 +416,7 @@ class Voices {
406
416
  body: _response.error.rawBody,
407
417
  });
408
418
  case "timeout":
409
- throw new errors.CartesiaTimeoutError();
419
+ throw new errors.CartesiaTimeoutError("Timeout exceeded when calling POST /voices/mix.");
410
420
  case "unknown":
411
421
  throw new errors.CartesiaError({
412
422
  message: _response.error.errorMessage,
@@ -445,25 +455,25 @@ class Voices {
445
455
  * })
446
456
  */
447
457
  clone(clip, request, requestOptions) {
448
- var _a, _b, _c, _d, _e;
449
458
  return __awaiter(this, void 0, void 0, function* () {
459
+ var _a, _b, _c, _d, _e, _f;
450
460
  const _request = yield core.newFormData();
451
461
  yield _request.appendFile("clip", clip);
452
- yield _request.append("name", request.name);
462
+ _request.append("name", request.name);
453
463
  if (request.description != null) {
454
- yield _request.append("description", request.description);
464
+ _request.append("description", request.description);
455
465
  }
456
- yield _request.append("language", request.language);
457
- yield _request.append("mode", request.mode);
458
- yield _request.append("enhance", request.enhance.toString());
466
+ _request.append("language", serializers.SupportedLanguage.jsonOrThrow(request.language, { unrecognizedObjectKeys: "strip" }));
467
+ _request.append("mode", serializers.CloneMode.jsonOrThrow(request.mode, { unrecognizedObjectKeys: "strip" }));
468
+ _request.append("enhance", request.enhance.toString());
459
469
  if (request.transcript != null) {
460
- yield _request.append("transcript", request.transcript);
470
+ _request.append("transcript", request.transcript);
461
471
  }
462
472
  const _maybeEncodedRequest = yield _request.getRequest();
463
473
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
464
- url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CartesiaEnvironment.Production, "/voices/clone"),
474
+ url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CartesiaEnvironment.Production, "/voices/clone"),
465
475
  method: "POST",
466
- headers: Object.assign(Object.assign({ "Cartesia-Version": (_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.cartesiaVersion) !== null && _e !== void 0 ? _e : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1.4", "User-Agent": "@cartesia/cartesia-js/2.1.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), _maybeEncodedRequest.headers),
476
+ headers: Object.assign(Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1.5", "User-Agent": "@cartesia/cartesia-js/2.1.5", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), _maybeEncodedRequest.headers), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
467
477
  requestType: "file",
468
478
  duplex: _maybeEncodedRequest.duplex,
469
479
  body: _maybeEncodedRequest.body,
@@ -493,7 +503,7 @@ class Voices {
493
503
  body: _response.error.rawBody,
494
504
  });
495
505
  case "timeout":
496
- throw new errors.CartesiaTimeoutError();
506
+ throw new errors.CartesiaTimeoutError("Timeout exceeded when calling POST /voices/clone.");
497
507
  case "unknown":
498
508
  throw new errors.CartesiaError({
499
509
  message: _response.error.errorMessage,
@@ -5,4 +5,4 @@ import * as Cartesia from "../../../index";
5
5
  /**
6
6
  * The ID of the base voice associated with the voice, used for features like voice mixing.
7
7
  */
8
- export declare type BaseVoiceId = Cartesia.VoiceId;
8
+ export type BaseVoiceId = Cartesia.VoiceId;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
- export declare type CloneMode = "similarity" | "stability";
4
+ export type CloneMode = "similarity" | "stability";
5
5
  export declare const CloneMode: {
6
6
  readonly Similarity: "similarity";
7
7
  readonly Stability: "stability";
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
- export declare type Gender = "male" | "female";
4
+ export type Gender = "male" | "female";
5
5
  export declare const Gender: {
6
6
  readonly Male: "male";
7
7
  readonly Female: "female";
@@ -3,10 +3,18 @@
3
3
  */
4
4
  import * as Cartesia from "../../../index";
5
5
  /**
6
- * The dialect to localize to. Only supported for English (`en`).
6
+ * The dialect to localize to. Only supported for English (`en`), Spanish (`es`), and Portuguese (`pt`).
7
7
  */
8
- export declare type LocalizeDialect =
8
+ export type LocalizeDialect =
9
9
  /**
10
- * Only available when language is set to English (`en`).
10
+ * Only available when language is set to English (`en`). Options: Australian (`au`), Indian (`in`), Southern (`so`), British (`uk`), or American (`us`).
11
11
  * */
12
- Cartesia.LocalizeEnglishDialect;
12
+ Cartesia.LocalizeEnglishDialect
13
+ /**
14
+ * Only available when language is set to Spanish (`es`). Options: Mexican (`mx`) and Peninsular (`pe`).
15
+ * */
16
+ | Cartesia.LocalizeSpanishDialect
17
+ /**
18
+ * Only available when language is set to Portuguese (`pt`). Options: Brazilian (`br`) and European Portuguese (`eu`).
19
+ * */
20
+ | Cartesia.LocalizePortugueseDialect;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
- export declare type LocalizeEnglishDialect = "au" | "in" | "so" | "uk" | "us";
4
+ export type LocalizeEnglishDialect = "au" | "in" | "so" | "uk" | "us";
5
5
  export declare const LocalizeEnglishDialect: {
6
6
  readonly Au: "au";
7
7
  readonly In: "in";
@@ -0,0 +1,8 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export type LocalizePortugueseDialect = "br" | "eu";
5
+ export declare const LocalizePortugueseDialect: {
6
+ readonly Br: "br";
7
+ readonly Eu: "eu";
8
+ };
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.LocalizePortugueseDialect = void 0;
7
+ exports.LocalizePortugueseDialect = {
8
+ Br: "br",
9
+ Eu: "eu",
10
+ };