@cartesia/cartesia-js 2.1.3 → 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 (488) hide show
  1. package/Client.d.ts +12 -5
  2. package/Client.js +11 -6
  3. package/api/resources/apiStatus/client/Client.d.ts +4 -0
  4. package/api/resources/apiStatus/client/Client.js +21 -11
  5. package/api/resources/datasets/client/Client.d.ts +4 -1
  6. package/api/resources/datasets/client/Client.js +34 -24
  7. package/api/resources/datasets/types/FilePurpose.d.ts +1 -1
  8. package/api/resources/embedding/types/Embedding.d.ts +1 -1
  9. package/api/resources/index.d.ts +2 -0
  10. package/api/resources/index.js +20 -8
  11. package/api/resources/infill/client/Client.d.ts +49 -0
  12. package/api/resources/infill/client/Client.js +148 -0
  13. package/api/resources/infill/client/index.d.ts +1 -0
  14. package/api/resources/infill/client/index.js +17 -0
  15. package/api/resources/infill/client/requests/InfillBytesRequest.d.ts +71 -0
  16. package/api/resources/infill/client/requests/InfillBytesRequest.js +5 -0
  17. package/api/resources/infill/client/requests/index.d.ts +1 -0
  18. package/api/resources/infill/client/requests/index.js +2 -0
  19. package/api/resources/infill/index.d.ts +1 -0
  20. package/api/resources/infill/index.js +17 -0
  21. package/api/resources/tts/client/Client.js +21 -11
  22. package/api/resources/tts/types/ContextId.d.ts +1 -1
  23. package/api/resources/tts/types/Emotion.d.ts +5 -1
  24. package/api/resources/tts/types/Emotion.js +4 -0
  25. package/api/resources/tts/types/FlushId.d.ts +9 -0
  26. package/api/resources/tts/types/FlushId.js +5 -0
  27. package/api/resources/tts/types/GenerationRequest.d.ts +7 -2
  28. package/api/resources/tts/types/NaturalSpecifier.d.ts +1 -1
  29. package/api/resources/tts/types/NumericalSpecifier.d.ts +1 -1
  30. package/api/resources/tts/types/OutputFormat.d.ts +1 -1
  31. package/api/resources/tts/types/PhonemeTimestamps.d.ts +8 -0
  32. package/api/resources/tts/types/PhonemeTimestamps.js +5 -0
  33. package/api/resources/tts/types/RawEncoding.d.ts +1 -1
  34. package/api/resources/tts/types/RawOutputFormat.d.ts +1 -0
  35. package/api/resources/tts/types/Speed.d.ts +1 -1
  36. package/api/resources/tts/types/SupportedLanguage.d.ts +1 -1
  37. package/api/resources/tts/types/TtsRequestVoiceSpecifier.d.ts +1 -1
  38. package/api/resources/tts/types/WebSocketFlushDoneResponse.d.ts +8 -0
  39. package/api/resources/tts/types/WebSocketFlushDoneResponse.js +5 -0
  40. package/api/resources/tts/types/WebSocketPhonemeTimestampsResponse.d.ts +7 -0
  41. package/api/resources/tts/types/WebSocketPhonemeTimestampsResponse.js +5 -0
  42. package/api/resources/tts/types/WebSocketRequest.d.ts +1 -1
  43. package/api/resources/tts/types/WebSocketResponse.d.ts +7 -1
  44. package/api/resources/tts/types/WebSocketTtsOutput.d.ts +3 -0
  45. package/api/resources/tts/types/WebSocketTtsRequest.d.ts +1 -0
  46. package/api/resources/tts/types/index.d.ts +4 -0
  47. package/api/resources/tts/types/index.js +4 -0
  48. package/api/resources/voiceChanger/client/Client.d.ts +3 -4
  49. package/api/resources/voiceChanger/client/Client.js +23 -13
  50. package/api/resources/voiceChanger/types/OutputFormatContainer.d.ts +1 -1
  51. package/api/resources/voiceChanger/types/StreamingResponse.d.ts +1 -1
  52. package/api/resources/voices/client/Client.d.ts +5 -3
  53. package/api/resources/voices/client/Client.js +56 -47
  54. package/api/resources/voices/types/BaseVoiceId.d.ts +1 -1
  55. package/api/resources/voices/types/CloneMode.d.ts +1 -1
  56. package/api/resources/voices/types/CreateVoiceRequest.d.ts +0 -1
  57. package/api/resources/voices/types/Gender.d.ts +1 -1
  58. package/api/resources/voices/types/LocalizeDialect.d.ts +12 -4
  59. package/api/resources/voices/types/LocalizeEnglishDialect.d.ts +1 -1
  60. package/api/resources/voices/types/LocalizePortugueseDialect.d.ts +8 -0
  61. package/api/resources/voices/types/LocalizePortugueseDialect.js +10 -0
  62. package/api/resources/voices/types/LocalizeSpanishDialect.d.ts +8 -0
  63. package/api/resources/voices/types/LocalizeSpanishDialect.js +10 -0
  64. package/api/resources/voices/types/LocalizeTargetLanguage.d.ts +1 -1
  65. package/api/resources/voices/types/MixVoiceSpecifier.d.ts +1 -1
  66. package/api/resources/voices/types/Voice.d.ts +0 -1
  67. package/api/resources/voices/types/VoiceId.d.ts +1 -1
  68. package/api/resources/voices/types/Weight.d.ts +1 -1
  69. package/api/resources/voices/types/index.d.ts +2 -0
  70. package/api/resources/voices/types/index.js +2 -0
  71. package/core/fetcher/APIResponse.d.ts +1 -1
  72. package/core/fetcher/Fetcher.d.ts +1 -1
  73. package/core/fetcher/Fetcher.js +2 -2
  74. package/core/fetcher/Supplier.d.ts +1 -1
  75. package/core/fetcher/createRequestUrl.d.ts +1 -1
  76. package/core/fetcher/createRequestUrl.js +1 -2
  77. package/core/fetcher/getFetchFn.js +18 -9
  78. package/core/fetcher/getHeader.js +1 -2
  79. package/core/fetcher/getRequestBody.js +5 -5
  80. package/core/fetcher/getResponseBody.js +1 -2
  81. package/core/fetcher/makeRequest.d.ts +1 -1
  82. package/core/fetcher/requestWithRetries.js +4 -5
  83. package/core/fetcher/signals.d.ts +0 -1
  84. package/core/fetcher/signals.js +2 -3
  85. package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +0 -1
  86. package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +6 -4
  87. package/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +1 -1
  88. package/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +1 -1
  89. package/core/fetcher/stream-wrappers/chooseStreamWrapper.js +18 -9
  90. package/core/form-data-utils/FormDataWrapper.d.ts +4 -4
  91. package/core/form-data-utils/FormDataWrapper.js +22 -12
  92. package/core/index.js +17 -7
  93. package/core/json.d.ts +15 -0
  94. package/core/json.js +24 -0
  95. package/core/runtime/runtime.d.ts +1 -1
  96. package/core/runtime/runtime.js +51 -41
  97. package/core/schemas/Schema.d.ts +7 -5
  98. package/core/schemas/Schema.js +2 -0
  99. package/core/schemas/builders/bigint/bigint.d.ts +1 -1
  100. package/core/schemas/builders/bigint/bigint.js +22 -19
  101. package/core/schemas/builders/date/date.js +1 -2
  102. package/core/schemas/builders/enum/enum.js +1 -2
  103. package/core/schemas/builders/lazy/lazy.d.ts +1 -1
  104. package/core/schemas/builders/lazy/lazy.js +3 -4
  105. package/core/schemas/builders/lazy/lazyObject.js +1 -2
  106. package/core/schemas/builders/list/list.js +1 -2
  107. package/core/schemas/builders/literals/booleanLiteral.js +1 -2
  108. package/core/schemas/builders/literals/stringLiteral.js +1 -2
  109. package/core/schemas/builders/object/object.d.ts +1 -1
  110. package/core/schemas/builders/object/object.js +31 -3
  111. package/core/schemas/builders/object/objectWithoutOptionalProperties.d.ts +3 -3
  112. package/core/schemas/builders/object/objectWithoutOptionalProperties.js +1 -2
  113. package/core/schemas/builders/object/property.js +2 -3
  114. package/core/schemas/builders/object/types.d.ts +16 -11
  115. package/core/schemas/builders/object-like/getObjectLikeUtils.js +2 -3
  116. package/core/schemas/builders/object-like/types.d.ts +1 -1
  117. package/core/schemas/builders/record/record.js +2 -4
  118. package/core/schemas/builders/record/types.d.ts +2 -2
  119. package/core/schemas/builders/schema-utils/getSchemaUtils.d.ts +4 -0
  120. package/core/schemas/builders/schema-utils/getSchemaUtils.js +67 -4
  121. package/core/schemas/builders/schema-utils/stringifyValidationErrors.js +1 -2
  122. package/core/schemas/builders/set/set.js +1 -2
  123. package/core/schemas/builders/undiscriminated-union/types.d.ts +4 -4
  124. package/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.js +1 -2
  125. package/core/schemas/builders/union/discriminant.js +1 -2
  126. package/core/schemas/builders/union/types.d.ts +6 -6
  127. package/core/schemas/builders/union/union.d.ts +1 -1
  128. package/core/schemas/builders/union/union.js +1 -2
  129. package/core/schemas/utils/MaybePromise.d.ts +1 -1
  130. package/core/schemas/utils/addQuestionMarksToNullableProperties.d.ts +4 -4
  131. package/core/schemas/utils/createIdentitySchemaCreator.js +1 -2
  132. package/core/schemas/utils/entries.d.ts +1 -1
  133. package/core/schemas/utils/entries.js +1 -2
  134. package/core/schemas/utils/filterObject.d.ts +1 -1
  135. package/core/schemas/utils/filterObject.js +1 -2
  136. package/core/schemas/utils/getErrorMessageForIncorrectType.js +1 -2
  137. package/core/schemas/utils/isPlainObject.js +1 -2
  138. package/core/schemas/utils/keys.d.ts +1 -1
  139. package/core/schemas/utils/keys.js +1 -2
  140. package/core/schemas/utils/maybeSkipValidation.js +1 -2
  141. package/core/schemas/utils/partition.js +1 -2
  142. package/core/streaming-fetcher/Stream.d.ts +0 -1
  143. package/core/streaming-fetcher/Stream.js +20 -21
  144. package/core/websocket/ws.d.ts +7 -7
  145. package/core/websocket/ws.js +17 -7
  146. package/dist/Client.d.ts +12 -5
  147. package/dist/Client.js +11 -6
  148. package/dist/api/resources/apiStatus/client/Client.d.ts +4 -0
  149. package/dist/api/resources/apiStatus/client/Client.js +21 -11
  150. package/dist/api/resources/datasets/client/Client.d.ts +4 -1
  151. package/dist/api/resources/datasets/client/Client.js +34 -24
  152. package/dist/api/resources/datasets/types/FilePurpose.d.ts +1 -1
  153. package/dist/api/resources/embedding/types/Embedding.d.ts +1 -1
  154. package/dist/api/resources/index.d.ts +2 -0
  155. package/dist/api/resources/index.js +20 -8
  156. package/dist/api/resources/infill/client/Client.d.ts +49 -0
  157. package/dist/api/resources/infill/client/Client.js +148 -0
  158. package/dist/api/resources/infill/client/index.d.ts +1 -0
  159. package/dist/api/resources/infill/client/index.js +17 -0
  160. package/dist/api/resources/infill/client/requests/InfillBytesRequest.d.ts +71 -0
  161. package/dist/api/resources/infill/client/requests/InfillBytesRequest.js +5 -0
  162. package/dist/api/resources/infill/client/requests/index.d.ts +1 -0
  163. package/dist/api/resources/infill/client/requests/index.js +2 -0
  164. package/dist/api/resources/infill/index.d.ts +1 -0
  165. package/dist/api/resources/infill/index.js +17 -0
  166. package/dist/api/resources/tts/client/Client.js +21 -11
  167. package/dist/api/resources/tts/types/ContextId.d.ts +1 -1
  168. package/dist/api/resources/tts/types/Emotion.d.ts +5 -1
  169. package/dist/api/resources/tts/types/Emotion.js +4 -0
  170. package/dist/api/resources/tts/types/FlushId.d.ts +9 -0
  171. package/dist/api/resources/tts/types/FlushId.js +5 -0
  172. package/dist/api/resources/tts/types/GenerationRequest.d.ts +7 -2
  173. package/dist/api/resources/tts/types/NaturalSpecifier.d.ts +1 -1
  174. package/dist/api/resources/tts/types/NumericalSpecifier.d.ts +1 -1
  175. package/dist/api/resources/tts/types/OutputFormat.d.ts +1 -1
  176. package/dist/api/resources/tts/types/PhonemeTimestamps.d.ts +8 -0
  177. package/dist/api/resources/tts/types/PhonemeTimestamps.js +5 -0
  178. package/dist/api/resources/tts/types/RawEncoding.d.ts +1 -1
  179. package/dist/api/resources/tts/types/RawOutputFormat.d.ts +1 -0
  180. package/dist/api/resources/tts/types/Speed.d.ts +1 -1
  181. package/dist/api/resources/tts/types/SupportedLanguage.d.ts +1 -1
  182. package/dist/api/resources/tts/types/TtsRequestVoiceSpecifier.d.ts +1 -1
  183. package/dist/api/resources/tts/types/WebSocketFlushDoneResponse.d.ts +8 -0
  184. package/dist/api/resources/tts/types/WebSocketFlushDoneResponse.js +5 -0
  185. package/dist/api/resources/tts/types/WebSocketPhonemeTimestampsResponse.d.ts +7 -0
  186. package/dist/api/resources/tts/types/WebSocketPhonemeTimestampsResponse.js +5 -0
  187. package/dist/api/resources/tts/types/WebSocketRequest.d.ts +1 -1
  188. package/dist/api/resources/tts/types/WebSocketResponse.d.ts +7 -1
  189. package/dist/api/resources/tts/types/WebSocketTtsOutput.d.ts +3 -0
  190. package/dist/api/resources/tts/types/WebSocketTtsRequest.d.ts +1 -0
  191. package/dist/api/resources/tts/types/index.d.ts +4 -0
  192. package/dist/api/resources/tts/types/index.js +4 -0
  193. package/dist/api/resources/voiceChanger/client/Client.d.ts +3 -4
  194. package/dist/api/resources/voiceChanger/client/Client.js +23 -13
  195. package/dist/api/resources/voiceChanger/types/OutputFormatContainer.d.ts +1 -1
  196. package/dist/api/resources/voiceChanger/types/StreamingResponse.d.ts +1 -1
  197. package/dist/api/resources/voices/client/Client.d.ts +5 -3
  198. package/dist/api/resources/voices/client/Client.js +56 -47
  199. package/dist/api/resources/voices/types/BaseVoiceId.d.ts +1 -1
  200. package/dist/api/resources/voices/types/CloneMode.d.ts +1 -1
  201. package/dist/api/resources/voices/types/CreateVoiceRequest.d.ts +0 -1
  202. package/dist/api/resources/voices/types/Gender.d.ts +1 -1
  203. package/dist/api/resources/voices/types/LocalizeDialect.d.ts +12 -4
  204. package/dist/api/resources/voices/types/LocalizeEnglishDialect.d.ts +1 -1
  205. package/dist/api/resources/voices/types/LocalizePortugueseDialect.d.ts +8 -0
  206. package/dist/api/resources/voices/types/LocalizePortugueseDialect.js +10 -0
  207. package/dist/api/resources/voices/types/LocalizeSpanishDialect.d.ts +8 -0
  208. package/dist/api/resources/voices/types/LocalizeSpanishDialect.js +10 -0
  209. package/dist/api/resources/voices/types/LocalizeTargetLanguage.d.ts +1 -1
  210. package/dist/api/resources/voices/types/MixVoiceSpecifier.d.ts +1 -1
  211. package/dist/api/resources/voices/types/Voice.d.ts +0 -1
  212. package/dist/api/resources/voices/types/VoiceId.d.ts +1 -1
  213. package/dist/api/resources/voices/types/Weight.d.ts +1 -1
  214. package/dist/api/resources/voices/types/index.d.ts +2 -0
  215. package/dist/api/resources/voices/types/index.js +2 -0
  216. package/dist/core/fetcher/APIResponse.d.ts +1 -1
  217. package/dist/core/fetcher/Fetcher.d.ts +1 -1
  218. package/dist/core/fetcher/Fetcher.js +2 -2
  219. package/dist/core/fetcher/Supplier.d.ts +1 -1
  220. package/dist/core/fetcher/createRequestUrl.d.ts +1 -1
  221. package/dist/core/fetcher/createRequestUrl.js +1 -2
  222. package/dist/core/fetcher/getFetchFn.js +18 -9
  223. package/dist/core/fetcher/getHeader.js +1 -2
  224. package/dist/core/fetcher/getRequestBody.js +5 -5
  225. package/dist/core/fetcher/getResponseBody.js +1 -2
  226. package/dist/core/fetcher/makeRequest.d.ts +1 -1
  227. package/dist/core/fetcher/requestWithRetries.js +4 -5
  228. package/dist/core/fetcher/signals.d.ts +0 -1
  229. package/dist/core/fetcher/signals.js +2 -3
  230. package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +0 -1
  231. package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +6 -4
  232. package/dist/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +1 -1
  233. package/dist/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +1 -1
  234. package/dist/core/fetcher/stream-wrappers/chooseStreamWrapper.js +18 -9
  235. package/dist/core/form-data-utils/FormDataWrapper.d.ts +4 -4
  236. package/dist/core/form-data-utils/FormDataWrapper.js +22 -12
  237. package/dist/core/index.js +17 -7
  238. package/dist/core/json.d.ts +15 -0
  239. package/dist/core/json.js +24 -0
  240. package/dist/core/runtime/runtime.d.ts +1 -1
  241. package/dist/core/runtime/runtime.js +51 -41
  242. package/dist/core/schemas/Schema.d.ts +7 -5
  243. package/dist/core/schemas/Schema.js +2 -0
  244. package/dist/core/schemas/builders/bigint/bigint.d.ts +1 -1
  245. package/dist/core/schemas/builders/bigint/bigint.js +22 -19
  246. package/dist/core/schemas/builders/date/date.js +1 -2
  247. package/dist/core/schemas/builders/enum/enum.js +1 -2
  248. package/dist/core/schemas/builders/lazy/lazy.d.ts +1 -1
  249. package/dist/core/schemas/builders/lazy/lazy.js +3 -4
  250. package/dist/core/schemas/builders/lazy/lazyObject.js +1 -2
  251. package/dist/core/schemas/builders/list/list.js +1 -2
  252. package/dist/core/schemas/builders/literals/booleanLiteral.js +1 -2
  253. package/dist/core/schemas/builders/literals/stringLiteral.js +1 -2
  254. package/dist/core/schemas/builders/object/object.d.ts +1 -1
  255. package/dist/core/schemas/builders/object/object.js +31 -3
  256. package/dist/core/schemas/builders/object/objectWithoutOptionalProperties.d.ts +3 -3
  257. package/dist/core/schemas/builders/object/objectWithoutOptionalProperties.js +1 -2
  258. package/dist/core/schemas/builders/object/property.js +2 -3
  259. package/dist/core/schemas/builders/object/types.d.ts +16 -11
  260. package/dist/core/schemas/builders/object-like/getObjectLikeUtils.js +2 -3
  261. package/dist/core/schemas/builders/object-like/types.d.ts +1 -1
  262. package/dist/core/schemas/builders/record/record.js +2 -4
  263. package/dist/core/schemas/builders/record/types.d.ts +2 -2
  264. package/dist/core/schemas/builders/schema-utils/getSchemaUtils.d.ts +4 -0
  265. package/dist/core/schemas/builders/schema-utils/getSchemaUtils.js +67 -4
  266. package/dist/core/schemas/builders/schema-utils/stringifyValidationErrors.js +1 -2
  267. package/dist/core/schemas/builders/set/set.js +1 -2
  268. package/dist/core/schemas/builders/undiscriminated-union/types.d.ts +4 -4
  269. package/dist/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.js +1 -2
  270. package/dist/core/schemas/builders/union/discriminant.js +1 -2
  271. package/dist/core/schemas/builders/union/types.d.ts +6 -6
  272. package/dist/core/schemas/builders/union/union.d.ts +1 -1
  273. package/dist/core/schemas/builders/union/union.js +1 -2
  274. package/dist/core/schemas/utils/MaybePromise.d.ts +1 -1
  275. package/dist/core/schemas/utils/addQuestionMarksToNullableProperties.d.ts +4 -4
  276. package/dist/core/schemas/utils/createIdentitySchemaCreator.js +1 -2
  277. package/dist/core/schemas/utils/entries.d.ts +1 -1
  278. package/dist/core/schemas/utils/entries.js +1 -2
  279. package/dist/core/schemas/utils/filterObject.d.ts +1 -1
  280. package/dist/core/schemas/utils/filterObject.js +1 -2
  281. package/dist/core/schemas/utils/getErrorMessageForIncorrectType.js +1 -2
  282. package/dist/core/schemas/utils/isPlainObject.js +1 -2
  283. package/dist/core/schemas/utils/keys.d.ts +1 -1
  284. package/dist/core/schemas/utils/keys.js +1 -2
  285. package/dist/core/schemas/utils/maybeSkipValidation.js +1 -2
  286. package/dist/core/schemas/utils/partition.js +1 -2
  287. package/dist/core/streaming-fetcher/Stream.d.ts +0 -1
  288. package/dist/core/streaming-fetcher/Stream.js +20 -21
  289. package/dist/core/websocket/ws.d.ts +7 -7
  290. package/dist/core/websocket/ws.js +17 -7
  291. package/dist/environments.d.ts +1 -1
  292. package/dist/errors/CartesiaError.js +2 -1
  293. package/dist/errors/CartesiaTimeoutError.d.ts +1 -1
  294. package/dist/errors/CartesiaTimeoutError.js +2 -2
  295. package/dist/index.js +17 -7
  296. package/dist/serialization/resources/apiStatus/types/ApiInfo.js +17 -7
  297. package/dist/serialization/resources/datasets/types/CreateDatasetRequest.js +17 -7
  298. package/dist/serialization/resources/datasets/types/Dataset.js +17 -7
  299. package/dist/serialization/resources/datasets/types/DatasetFile.js +17 -7
  300. package/dist/serialization/resources/datasets/types/FilePurpose.js +17 -7
  301. package/dist/serialization/resources/datasets/types/PaginatedDatasetFiles.js +17 -7
  302. package/dist/serialization/resources/datasets/types/PaginatedDatasets.js +17 -7
  303. package/dist/serialization/resources/embedding/types/Embedding.js +17 -7
  304. package/dist/serialization/resources/index.js +17 -7
  305. package/dist/serialization/resources/tts/types/CancelContextRequest.js +17 -7
  306. package/dist/serialization/resources/tts/types/ContextId.js +17 -7
  307. package/dist/serialization/resources/tts/types/Controls.js +17 -7
  308. package/dist/serialization/resources/tts/types/Emotion.d.ts +1 -1
  309. package/dist/serialization/resources/tts/types/Emotion.js +21 -7
  310. package/dist/serialization/resources/tts/types/FlushId.d.ts +10 -0
  311. package/dist/serialization/resources/tts/types/FlushId.js +41 -0
  312. package/dist/serialization/resources/tts/types/GenerationRequest.d.ts +4 -2
  313. package/dist/serialization/resources/tts/types/GenerationRequest.js +21 -9
  314. package/dist/serialization/resources/tts/types/Mp3OutputFormat.js +17 -7
  315. package/dist/serialization/resources/tts/types/NaturalSpecifier.js +17 -7
  316. package/dist/serialization/resources/tts/types/NumericalSpecifier.js +17 -7
  317. package/dist/serialization/resources/tts/types/OutputFormat.js +17 -7
  318. package/dist/serialization/resources/tts/types/PhonemeTimestamps.d.ts +14 -0
  319. package/dist/serialization/resources/tts/types/PhonemeTimestamps.js +45 -0
  320. package/dist/serialization/resources/tts/types/RawEncoding.js +17 -7
  321. package/dist/serialization/resources/tts/types/RawOutputFormat.d.ts +1 -0
  322. package/dist/serialization/resources/tts/types/RawOutputFormat.js +18 -7
  323. package/dist/serialization/resources/tts/types/Speed.js +17 -7
  324. package/dist/serialization/resources/tts/types/SupportedLanguage.js +17 -7
  325. package/dist/serialization/resources/tts/types/TtsRequest.js +17 -7
  326. package/dist/serialization/resources/tts/types/TtsRequestEmbeddingSpecifier.js +17 -7
  327. package/dist/serialization/resources/tts/types/TtsRequestIdSpecifier.js +17 -7
  328. package/dist/serialization/resources/tts/types/TtsRequestVoiceSpecifier.js +17 -7
  329. package/dist/serialization/resources/tts/types/WavOutputFormat.js +17 -7
  330. package/dist/serialization/resources/tts/types/WebSocketBaseResponse.js +17 -7
  331. package/dist/serialization/resources/tts/types/WebSocketChunkResponse.js +17 -7
  332. package/dist/serialization/resources/tts/types/WebSocketDoneResponse.js +17 -7
  333. package/dist/serialization/resources/tts/types/WebSocketErrorResponse.js +17 -7
  334. package/dist/serialization/resources/tts/types/WebSocketFlushDoneResponse.d.ts +15 -0
  335. package/dist/serialization/resources/tts/types/WebSocketFlushDoneResponse.js +48 -0
  336. package/dist/serialization/resources/tts/types/WebSocketPhonemeTimestampsResponse.d.ts +14 -0
  337. package/dist/serialization/resources/tts/types/WebSocketPhonemeTimestampsResponse.js +47 -0
  338. package/dist/serialization/resources/tts/types/WebSocketRawOutputFormat.js +17 -7
  339. package/dist/serialization/resources/tts/types/WebSocketRequest.js +17 -7
  340. package/dist/serialization/resources/tts/types/WebSocketResponse.d.ts +9 -1
  341. package/dist/serialization/resources/tts/types/WebSocketResponse.js +21 -7
  342. package/dist/serialization/resources/tts/types/WebSocketStreamOptions.js +17 -7
  343. package/dist/serialization/resources/tts/types/WebSocketTimestampsResponse.js +17 -7
  344. package/dist/serialization/resources/tts/types/WebSocketTtsOutput.d.ts +5 -0
  345. package/dist/serialization/resources/tts/types/WebSocketTtsOutput.js +22 -7
  346. package/dist/serialization/resources/tts/types/WebSocketTtsRequest.d.ts +1 -0
  347. package/dist/serialization/resources/tts/types/WebSocketTtsRequest.js +18 -7
  348. package/dist/serialization/resources/tts/types/WordTimestamps.js +17 -7
  349. package/dist/serialization/resources/tts/types/index.d.ts +4 -0
  350. package/dist/serialization/resources/tts/types/index.js +4 -0
  351. package/dist/serialization/resources/voiceChanger/types/OutputFormatContainer.js +17 -7
  352. package/dist/serialization/resources/voiceChanger/types/StreamingResponse.js +17 -7
  353. package/dist/serialization/resources/voices/client/index.js +17 -7
  354. package/dist/serialization/resources/voices/client/list.js +17 -7
  355. package/dist/serialization/resources/voices/types/CloneMode.js +17 -7
  356. package/dist/serialization/resources/voices/types/CreateVoiceRequest.d.ts +0 -2
  357. package/dist/serialization/resources/voices/types/CreateVoiceRequest.js +17 -9
  358. package/dist/serialization/resources/voices/types/EmbeddingResponse.js +17 -7
  359. package/dist/serialization/resources/voices/types/EmbeddingSpecifier.js +17 -7
  360. package/dist/serialization/resources/voices/types/Gender.js +17 -7
  361. package/dist/serialization/resources/voices/types/IdSpecifier.js +17 -7
  362. package/dist/serialization/resources/voices/types/LocalizeDialect.d.ts +3 -1
  363. package/dist/serialization/resources/voices/types/LocalizeDialect.js +24 -8
  364. package/dist/serialization/resources/voices/types/LocalizeEnglishDialect.js +17 -7
  365. package/dist/serialization/resources/voices/types/LocalizePortugueseDialect.d.ts +10 -0
  366. package/dist/serialization/resources/voices/types/LocalizePortugueseDialect.js +41 -0
  367. package/dist/serialization/resources/voices/types/LocalizeSpanishDialect.d.ts +10 -0
  368. package/dist/serialization/resources/voices/types/LocalizeSpanishDialect.js +41 -0
  369. package/dist/serialization/resources/voices/types/LocalizeTargetLanguage.js +17 -7
  370. package/dist/serialization/resources/voices/types/LocalizeVoiceRequest.js +17 -7
  371. package/dist/serialization/resources/voices/types/MixVoiceSpecifier.js +17 -7
  372. package/dist/serialization/resources/voices/types/MixVoicesRequest.js +17 -7
  373. package/dist/serialization/resources/voices/types/UpdateVoiceRequest.js +17 -7
  374. package/dist/serialization/resources/voices/types/Voice.d.ts +0 -2
  375. package/dist/serialization/resources/voices/types/Voice.js +17 -9
  376. package/dist/serialization/resources/voices/types/VoiceId.js +17 -7
  377. package/dist/serialization/resources/voices/types/VoiceMetadata.js +17 -7
  378. package/dist/serialization/resources/voices/types/Weight.js +17 -7
  379. package/dist/serialization/resources/voices/types/index.d.ts +2 -0
  380. package/dist/serialization/resources/voices/types/index.js +2 -0
  381. package/dist/version.d.ts +1 -1
  382. package/dist/version.js +1 -1
  383. package/dist/wrapper/WebPlayer.js +1 -1
  384. package/dist/wrapper/Websocket.js +25 -15
  385. package/dist/wrapper/source.js +1 -1
  386. package/dist/wrapper/utils.d.ts +9 -9
  387. package/dist/wrapper/utils.js +10 -10
  388. package/environments.d.ts +1 -1
  389. package/errors/CartesiaError.js +2 -1
  390. package/errors/CartesiaTimeoutError.d.ts +1 -1
  391. package/errors/CartesiaTimeoutError.js +2 -2
  392. package/index.js +17 -7
  393. package/{jest.config.js → jest.config.mjs} +4 -1
  394. package/package.json +15 -16
  395. package/reference.md +97 -1
  396. package/scripts/rename-to-esm-files.js +115 -0
  397. package/serialization/resources/apiStatus/types/ApiInfo.js +17 -7
  398. package/serialization/resources/datasets/types/CreateDatasetRequest.js +17 -7
  399. package/serialization/resources/datasets/types/Dataset.js +17 -7
  400. package/serialization/resources/datasets/types/DatasetFile.js +17 -7
  401. package/serialization/resources/datasets/types/FilePurpose.js +17 -7
  402. package/serialization/resources/datasets/types/PaginatedDatasetFiles.js +17 -7
  403. package/serialization/resources/datasets/types/PaginatedDatasets.js +17 -7
  404. package/serialization/resources/embedding/types/Embedding.js +17 -7
  405. package/serialization/resources/index.js +17 -7
  406. package/serialization/resources/tts/types/CancelContextRequest.js +17 -7
  407. package/serialization/resources/tts/types/ContextId.js +17 -7
  408. package/serialization/resources/tts/types/Controls.js +17 -7
  409. package/serialization/resources/tts/types/Emotion.d.ts +1 -1
  410. package/serialization/resources/tts/types/Emotion.js +21 -7
  411. package/serialization/resources/tts/types/FlushId.d.ts +10 -0
  412. package/serialization/resources/tts/types/FlushId.js +41 -0
  413. package/serialization/resources/tts/types/GenerationRequest.d.ts +4 -2
  414. package/serialization/resources/tts/types/GenerationRequest.js +21 -9
  415. package/serialization/resources/tts/types/Mp3OutputFormat.js +17 -7
  416. package/serialization/resources/tts/types/NaturalSpecifier.js +17 -7
  417. package/serialization/resources/tts/types/NumericalSpecifier.js +17 -7
  418. package/serialization/resources/tts/types/OutputFormat.js +17 -7
  419. package/serialization/resources/tts/types/PhonemeTimestamps.d.ts +14 -0
  420. package/serialization/resources/tts/types/PhonemeTimestamps.js +45 -0
  421. package/serialization/resources/tts/types/RawEncoding.js +17 -7
  422. package/serialization/resources/tts/types/RawOutputFormat.d.ts +1 -0
  423. package/serialization/resources/tts/types/RawOutputFormat.js +18 -7
  424. package/serialization/resources/tts/types/Speed.js +17 -7
  425. package/serialization/resources/tts/types/SupportedLanguage.js +17 -7
  426. package/serialization/resources/tts/types/TtsRequest.js +17 -7
  427. package/serialization/resources/tts/types/TtsRequestEmbeddingSpecifier.js +17 -7
  428. package/serialization/resources/tts/types/TtsRequestIdSpecifier.js +17 -7
  429. package/serialization/resources/tts/types/TtsRequestVoiceSpecifier.js +17 -7
  430. package/serialization/resources/tts/types/WavOutputFormat.js +17 -7
  431. package/serialization/resources/tts/types/WebSocketBaseResponse.js +17 -7
  432. package/serialization/resources/tts/types/WebSocketChunkResponse.js +17 -7
  433. package/serialization/resources/tts/types/WebSocketDoneResponse.js +17 -7
  434. package/serialization/resources/tts/types/WebSocketErrorResponse.js +17 -7
  435. package/serialization/resources/tts/types/WebSocketFlushDoneResponse.d.ts +15 -0
  436. package/serialization/resources/tts/types/WebSocketFlushDoneResponse.js +48 -0
  437. package/serialization/resources/tts/types/WebSocketPhonemeTimestampsResponse.d.ts +14 -0
  438. package/serialization/resources/tts/types/WebSocketPhonemeTimestampsResponse.js +47 -0
  439. package/serialization/resources/tts/types/WebSocketRawOutputFormat.js +17 -7
  440. package/serialization/resources/tts/types/WebSocketRequest.js +17 -7
  441. package/serialization/resources/tts/types/WebSocketResponse.d.ts +9 -1
  442. package/serialization/resources/tts/types/WebSocketResponse.js +21 -7
  443. package/serialization/resources/tts/types/WebSocketStreamOptions.js +17 -7
  444. package/serialization/resources/tts/types/WebSocketTimestampsResponse.js +17 -7
  445. package/serialization/resources/tts/types/WebSocketTtsOutput.d.ts +5 -0
  446. package/serialization/resources/tts/types/WebSocketTtsOutput.js +22 -7
  447. package/serialization/resources/tts/types/WebSocketTtsRequest.d.ts +1 -0
  448. package/serialization/resources/tts/types/WebSocketTtsRequest.js +18 -7
  449. package/serialization/resources/tts/types/WordTimestamps.js +17 -7
  450. package/serialization/resources/tts/types/index.d.ts +4 -0
  451. package/serialization/resources/tts/types/index.js +4 -0
  452. package/serialization/resources/voiceChanger/types/OutputFormatContainer.js +17 -7
  453. package/serialization/resources/voiceChanger/types/StreamingResponse.js +17 -7
  454. package/serialization/resources/voices/client/index.js +17 -7
  455. package/serialization/resources/voices/client/list.js +17 -7
  456. package/serialization/resources/voices/types/CloneMode.js +17 -7
  457. package/serialization/resources/voices/types/CreateVoiceRequest.d.ts +0 -2
  458. package/serialization/resources/voices/types/CreateVoiceRequest.js +17 -9
  459. package/serialization/resources/voices/types/EmbeddingResponse.js +17 -7
  460. package/serialization/resources/voices/types/EmbeddingSpecifier.js +17 -7
  461. package/serialization/resources/voices/types/Gender.js +17 -7
  462. package/serialization/resources/voices/types/IdSpecifier.js +17 -7
  463. package/serialization/resources/voices/types/LocalizeDialect.d.ts +3 -1
  464. package/serialization/resources/voices/types/LocalizeDialect.js +24 -8
  465. package/serialization/resources/voices/types/LocalizeEnglishDialect.js +17 -7
  466. package/serialization/resources/voices/types/LocalizePortugueseDialect.d.ts +10 -0
  467. package/serialization/resources/voices/types/LocalizePortugueseDialect.js +41 -0
  468. package/serialization/resources/voices/types/LocalizeSpanishDialect.d.ts +10 -0
  469. package/serialization/resources/voices/types/LocalizeSpanishDialect.js +41 -0
  470. package/serialization/resources/voices/types/LocalizeTargetLanguage.js +17 -7
  471. package/serialization/resources/voices/types/LocalizeVoiceRequest.js +17 -7
  472. package/serialization/resources/voices/types/MixVoiceSpecifier.js +17 -7
  473. package/serialization/resources/voices/types/MixVoicesRequest.js +17 -7
  474. package/serialization/resources/voices/types/UpdateVoiceRequest.js +17 -7
  475. package/serialization/resources/voices/types/Voice.d.ts +0 -2
  476. package/serialization/resources/voices/types/Voice.js +17 -9
  477. package/serialization/resources/voices/types/VoiceId.js +17 -7
  478. package/serialization/resources/voices/types/VoiceMetadata.js +17 -7
  479. package/serialization/resources/voices/types/Weight.js +17 -7
  480. package/serialization/resources/voices/types/index.d.ts +2 -0
  481. package/serialization/resources/voices/types/index.js +2 -0
  482. package/version.d.ts +1 -1
  483. package/version.js +1 -1
  484. package/wrapper/WebPlayer.js +1 -1
  485. package/wrapper/Websocket.js +25 -15
  486. package/wrapper/source.js +1 -1
  487. package/wrapper/utils.d.ts +9 -9
  488. package/wrapper/utils.js +10 -10
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isPlainObject = void 0;
3
+ exports.isPlainObject = isPlainObject;
4
4
  // borrowed from https://github.com/lodash/lodash/blob/master/isPlainObject.js
5
5
  function isPlainObject(value) {
6
6
  if (typeof value !== "object" || value === null) {
@@ -15,4 +15,3 @@ function isPlainObject(value) {
15
15
  }
16
16
  return Object.getPrototypeOf(value) === proto;
17
17
  }
18
- exports.isPlainObject = isPlainObject;
@@ -1 +1 @@
1
- export declare function keys<T>(object: T): (keyof T)[];
1
+ export declare function keys<T extends object>(object: T): (keyof T)[];
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.keys = void 0;
3
+ exports.keys = keys;
4
4
  function keys(object) {
5
5
  return Object.keys(object);
6
6
  }
7
- exports.keys = keys;
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.maybeSkipValidation = void 0;
3
+ exports.maybeSkipValidation = maybeSkipValidation;
4
4
  function maybeSkipValidation(schema) {
5
5
  return Object.assign(Object.assign({}, schema), { json: transformAndMaybeSkipValidation(schema.json), parse: transformAndMaybeSkipValidation(schema.parse) });
6
6
  }
7
- exports.maybeSkipValidation = maybeSkipValidation;
8
7
  function transformAndMaybeSkipValidation(transform) {
9
8
  return (value, opts) => {
10
9
  const transformed = transform(value, opts);
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.partition = void 0;
3
+ exports.partition = partition;
4
4
  function partition(items, predicate) {
5
5
  const trueItems = [], falseItems = [];
6
6
  for (const item of items) {
@@ -13,4 +13,3 @@ function partition(items, predicate) {
13
13
  }
14
14
  return [trueItems, falseItems];
15
15
  }
16
- exports.partition = partition;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { Readable } from "stream";
3
2
  export declare namespace Stream {
4
3
  interface Args {
@@ -19,8 +19,9 @@ var __await = (this && this.__await) || function (v) { return this instanceof __
19
19
  var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
20
20
  if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
21
21
  var g = generator.apply(thisArg, _arguments || []), i, q = [];
22
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
23
- function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
22
+ return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
23
+ function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
24
+ function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
24
25
  function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
25
26
  function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
26
27
  function fulfill(value) { resume("next", value); }
@@ -28,7 +29,8 @@ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _ar
28
29
  function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
29
30
  };
30
31
  Object.defineProperty(exports, "__esModule", { value: true });
31
- exports.readableStreamAsyncIterable = exports.Stream = void 0;
32
+ exports.Stream = void 0;
33
+ exports.readableStreamAsyncIterable = readableStreamAsyncIterable;
32
34
  const runtime_1 = require("../runtime");
33
35
  const DATA_PREFIX = "data:";
34
36
  class Stream {
@@ -48,26 +50,24 @@ class Stream {
48
50
  }
49
51
  iterMessages() {
50
52
  return __asyncGenerator(this, arguments, function* iterMessages_1() {
51
- var e_1, _a;
53
+ var _a, e_1, _b, _c;
52
54
  this.controller.signal;
53
55
  const stream = readableStreamAsyncIterable(this.stream);
54
56
  let buf = "";
55
57
  let prefixSeen = false;
56
58
  try {
57
- for (var stream_1 = __asyncValues(stream), stream_1_1; stream_1_1 = yield __await(stream_1.next()), !stream_1_1.done;) {
58
- const chunk = stream_1_1.value;
59
+ for (var _d = true, stream_1 = __asyncValues(stream), stream_1_1; stream_1_1 = yield __await(stream_1.next()), _a = stream_1_1.done, !_a; _d = true) {
60
+ _c = stream_1_1.value;
61
+ _d = false;
62
+ const chunk = _c;
59
63
  buf += this.decodeChunk(chunk);
60
64
  let terminatorIndex;
61
- // Parse the chunk into as many messages as possible
62
65
  while ((terminatorIndex = buf.indexOf(this.messageTerminator)) >= 0) {
63
- // Extract the line from the buffer
64
66
  let line = buf.slice(0, terminatorIndex + 1);
65
- buf = buf.slice(terminatorIndex + 1);
66
- // Skip empty lines
67
- if (line.length === 0) {
67
+ buf = buf.slice(terminatorIndex + this.messageTerminator.length);
68
+ if (!line.trim()) {
68
69
  continue;
69
70
  }
70
- // Skip the chunk until the prefix is found
71
71
  if (!prefixSeen && this.prefix != null) {
72
72
  const prefixIndex = line.indexOf(this.prefix);
73
73
  if (prefixIndex === -1) {
@@ -76,11 +76,9 @@ class Stream {
76
76
  prefixSeen = true;
77
77
  line = line.slice(prefixIndex + this.prefix.length);
78
78
  }
79
- // If the stream terminator is present, return
80
79
  if (this.streamTerminator != null && line.includes(this.streamTerminator)) {
81
80
  return yield __await(void 0);
82
81
  }
83
- // Otherwise, yield message from the prefix to the terminator
84
82
  const message = yield __await(this.parse(JSON.parse(line)));
85
83
  yield yield __await(message);
86
84
  prefixSeen = false;
@@ -90,7 +88,7 @@ class Stream {
90
88
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
91
89
  finally {
92
90
  try {
93
- if (stream_1_1 && !stream_1_1.done && (_a = stream_1.return)) yield __await(_a.call(stream_1));
91
+ if (!_d && !_a && (_b = stream_1.return)) yield __await(_b.call(stream_1));
94
92
  }
95
93
  finally { if (e_1) throw e_1.error; }
96
94
  }
@@ -98,17 +96,19 @@ class Stream {
98
96
  }
99
97
  [Symbol.asyncIterator]() {
100
98
  return __asyncGenerator(this, arguments, function* _a() {
101
- var e_2, _b;
99
+ var _b, e_2, _c, _d;
102
100
  try {
103
- for (var _c = __asyncValues(this.iterMessages()), _d; _d = yield __await(_c.next()), !_d.done;) {
104
- const message = _d.value;
101
+ for (var _e = true, _f = __asyncValues(this.iterMessages()), _g; _g = yield __await(_f.next()), _b = _g.done, !_b; _e = true) {
102
+ _d = _g.value;
103
+ _e = false;
104
+ const message = _d;
105
105
  yield yield __await(message);
106
106
  }
107
107
  }
108
108
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
109
109
  finally {
110
110
  try {
111
- if (_d && !_d.done && (_b = _c.return)) yield __await(_b.call(_c));
111
+ if (!_e && !_b && (_c = _f.return)) yield __await(_c.call(_f));
112
112
  }
113
113
  finally { if (e_2) throw e_2.error; }
114
114
  }
@@ -122,7 +122,7 @@ class Stream {
122
122
  decoded += decoder.decode(chunk);
123
123
  }
124
124
  // Buffer is present in Node.js environment
125
- else if (runtime_1.RUNTIME.type === "node" && typeof chunk != "undefined") {
125
+ else if (runtime_1.RUNTIME.type === "node" && typeof chunk !== "undefined") {
126
126
  decoded += Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
127
127
  }
128
128
  return decoded;
@@ -167,4 +167,3 @@ function readableStreamAsyncIterable(stream) {
167
167
  },
168
168
  };
169
169
  }
170
- exports.readableStreamAsyncIterable = readableStreamAsyncIterable;
@@ -1,8 +1,8 @@
1
1
  import * as Events from "./events";
2
- export declare type Event = Events.Event;
3
- export declare type ErrorEvent = Events.ErrorEvent;
4
- export declare type CloseEvent = Events.CloseEvent;
5
- export declare type Options = {
2
+ export type Event = Events.Event;
3
+ export type ErrorEvent = Events.ErrorEvent;
4
+ export type CloseEvent = Events.CloseEvent;
5
+ export type Options = {
6
6
  WebSocket?: any;
7
7
  maxReconnectionDelay?: number;
8
8
  minReconnectionDelay?: number;
@@ -14,9 +14,9 @@ export declare type Options = {
14
14
  startClosed?: boolean;
15
15
  debug?: boolean;
16
16
  };
17
- export declare type UrlProvider = string | (() => string) | (() => Promise<string>);
18
- export declare type Message = string | ArrayBuffer | Blob | ArrayBufferView;
19
- export declare type ListenersMap = {
17
+ export type UrlProvider = string | (() => string) | (() => Promise<string>);
18
+ export type Message = string | ArrayBuffer | Blob | ArrayBufferView;
19
+ export type ListenersMap = {
20
20
  error: Array<Events.WebSocketEventListenerMap["error"]>;
21
21
  message: Array<Events.WebSocketEventListenerMap["message"]>;
22
22
  open: Array<Events.WebSocketEventListenerMap["open"]>;
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
36
  exports.ReconnectingWebSocket = void 0;
27
37
  const runtime_1 = require("../runtime");
package/dist/Client.d.ts CHANGED
@@ -5,12 +5,15 @@ import * as environments from "./environments";
5
5
  import * as core from "./core";
6
6
  import { ApiStatus } from "./api/resources/apiStatus/client/Client";
7
7
  import { Datasets } from "./api/resources/datasets/client/Client";
8
+ import { Infill } from "./api/resources/infill/client/Client";
8
9
  import { Tts } from "./api/resources/tts/client/Client";
9
10
  import { VoiceChanger } from "./api/resources/voiceChanger/client/Client";
10
11
  import { Voices } from "./api/resources/voices/client/Client";
11
12
  export declare namespace CartesiaClient {
12
13
  interface Options {
13
14
  environment?: core.Supplier<environments.CartesiaEnvironment | string>;
15
+ /** Specify a custom URL to connect the client to. */
16
+ baseUrl?: core.Supplier<string>;
14
17
  apiKey?: core.Supplier<string | undefined>;
15
18
  /** Override the Cartesia-Version header */
16
19
  cartesiaVersion?: "2024-06-10";
@@ -25,19 +28,23 @@ export declare namespace CartesiaClient {
25
28
  abortSignal?: AbortSignal;
26
29
  /** Override the Cartesia-Version header */
27
30
  cartesiaVersion?: "2024-06-10";
31
+ /** Additional headers to include in the request. */
32
+ headers?: Record<string, string>;
28
33
  }
29
34
  }
30
35
  export declare class CartesiaClient {
31
36
  protected readonly _options: CartesiaClient.Options;
32
- constructor(_options?: CartesiaClient.Options);
33
37
  protected _apiStatus: ApiStatus | undefined;
34
- get apiStatus(): ApiStatus;
35
38
  protected _datasets: Datasets | undefined;
36
- get datasets(): Datasets;
39
+ protected _infill: Infill | undefined;
37
40
  protected _tts: Tts | undefined;
38
- get tts(): Tts;
39
41
  protected _voiceChanger: VoiceChanger | undefined;
40
- get voiceChanger(): VoiceChanger;
41
42
  protected _voices: Voices | undefined;
43
+ constructor(_options?: CartesiaClient.Options);
44
+ get apiStatus(): ApiStatus;
45
+ get datasets(): Datasets;
46
+ get infill(): Infill;
47
+ get tts(): Tts;
48
+ get voiceChanger(): VoiceChanger;
42
49
  get voices(): Voices;
43
50
  }
package/dist/Client.js CHANGED
@@ -6,9 +6,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.CartesiaClient = void 0;
7
7
  const Client_1 = require("./api/resources/apiStatus/client/Client");
8
8
  const Client_2 = require("./api/resources/datasets/client/Client");
9
- const Client_3 = require("./api/resources/tts/client/Client");
10
- const Client_4 = require("./api/resources/voiceChanger/client/Client");
11
- const Client_5 = require("./api/resources/voices/client/Client");
9
+ const Client_3 = require("./api/resources/infill/client/Client");
10
+ const Client_4 = require("./api/resources/tts/client/Client");
11
+ const Client_5 = require("./api/resources/voiceChanger/client/Client");
12
+ const Client_6 = require("./api/resources/voices/client/Client");
12
13
  class CartesiaClient {
13
14
  constructor(_options = {}) {
14
15
  this._options = _options;
@@ -21,17 +22,21 @@ class CartesiaClient {
21
22
  var _a;
22
23
  return ((_a = this._datasets) !== null && _a !== void 0 ? _a : (this._datasets = new Client_2.Datasets(this._options)));
23
24
  }
25
+ get infill() {
26
+ var _a;
27
+ return ((_a = this._infill) !== null && _a !== void 0 ? _a : (this._infill = new Client_3.Infill(this._options)));
28
+ }
24
29
  get tts() {
25
30
  var _a;
26
- return ((_a = this._tts) !== null && _a !== void 0 ? _a : (this._tts = new Client_3.Tts(this._options)));
31
+ return ((_a = this._tts) !== null && _a !== void 0 ? _a : (this._tts = new Client_4.Tts(this._options)));
27
32
  }
28
33
  get voiceChanger() {
29
34
  var _a;
30
- return ((_a = this._voiceChanger) !== null && _a !== void 0 ? _a : (this._voiceChanger = new Client_4.VoiceChanger(this._options)));
35
+ return ((_a = this._voiceChanger) !== null && _a !== void 0 ? _a : (this._voiceChanger = new Client_5.VoiceChanger(this._options)));
31
36
  }
32
37
  get voices() {
33
38
  var _a;
34
- return ((_a = this._voices) !== null && _a !== void 0 ? _a : (this._voices = new Client_5.Voices(this._options)));
39
+ return ((_a = this._voices) !== null && _a !== void 0 ? _a : (this._voices = new Client_6.Voices(this._options)));
35
40
  }
36
41
  }
37
42
  exports.CartesiaClient = CartesiaClient;
@@ -7,6 +7,8 @@ import * as Cartesia from "../../../index";
7
7
  export declare namespace ApiStatus {
8
8
  interface Options {
9
9
  environment?: core.Supplier<environments.CartesiaEnvironment | string>;
10
+ /** Specify a custom URL to connect the client to. */
11
+ baseUrl?: core.Supplier<string>;
10
12
  apiKey?: core.Supplier<string | undefined>;
11
13
  /** Override the Cartesia-Version header */
12
14
  cartesiaVersion?: "2024-06-10";
@@ -21,6 +23,8 @@ export declare namespace ApiStatus {
21
23
  abortSignal?: AbortSignal;
22
24
  /** Override the Cartesia-Version header */
23
25
  cartesiaVersion?: "2024-06-10";
26
+ /** Additional headers to include in the request. */
27
+ headers?: Record<string, string>;
24
28
  }
25
29
  }
26
30
  export declare class ApiStatus {
@@ -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) {
@@ -51,12 +61,12 @@ class ApiStatus {
51
61
  * await client.apiStatus.get()
52
62
  */
53
63
  get(requestOptions) {
54
- var _a, _b, _c, _d, _e;
55
64
  return __awaiter(this, void 0, void 0, function* () {
65
+ var _a, _b, _c, _d, _e, _f;
56
66
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
57
- url: (_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CartesiaEnvironment.Production,
67
+ url: (_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,
58
68
  method: "GET",
59
- 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.3", "User-Agent": "@cartesia/cartesia-js/2.1.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
69
+ 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),
60
70
  contentType: "application/json",
61
71
  requestType: "json",
62
72
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -85,7 +95,7 @@ class ApiStatus {
85
95
  body: _response.error.rawBody,
86
96
  });
87
97
  case "timeout":
88
- throw new errors.CartesiaTimeoutError();
98
+ throw new errors.CartesiaTimeoutError("Timeout exceeded when calling GET /.");
89
99
  case "unknown":
90
100
  throw new errors.CartesiaError({
91
101
  message: _response.error.errorMessage,
@@ -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 Datasets {
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 Datasets {
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 Datasets {
@@ -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 Datasets {
55
65
  * await client.datasets.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, "/datasets/"),
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, "/datasets/"),
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.3", "User-Agent": "@cartesia/cartesia-js/2.1.3", "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 Datasets {
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 /datasets/.");
93
103
  case "unknown":
94
104
  throw new errors.CartesiaError({
95
105
  message: _response.error.errorMessage,
@@ -107,12 +117,12 @@ class Datasets {
107
117
  * })
108
118
  */
109
119
  create(request, requestOptions) {
110
- var _a, _b, _c, _d, _e;
111
120
  return __awaiter(this, void 0, void 0, function* () {
121
+ var _a, _b, _c, _d, _e, _f;
112
122
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
113
- url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CartesiaEnvironment.Production, "/datasets/"),
123
+ 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, "/datasets/"),
114
124
  method: "POST",
115
- 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.3", "User-Agent": "@cartesia/cartesia-js/2.1.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
125
+ 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),
116
126
  contentType: "application/json",
117
127
  requestType: "json",
118
128
  body: serializers.CreateDatasetRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -142,7 +152,7 @@ class Datasets {
142
152
  body: _response.error.rawBody,
143
153
  });
144
154
  case "timeout":
145
- throw new errors.CartesiaTimeoutError();
155
+ throw new errors.CartesiaTimeoutError("Timeout exceeded when calling POST /datasets/.");
146
156
  case "unknown":
147
157
  throw new errors.CartesiaError({
148
158
  message: _response.error.errorMessage,
@@ -158,12 +168,12 @@ class Datasets {
158
168
  * await client.datasets.listFiles("string")
159
169
  */
160
170
  listFiles(id, requestOptions) {
161
- var _a, _b, _c, _d, _e;
162
171
  return __awaiter(this, void 0, void 0, function* () {
172
+ var _a, _b, _c, _d, _e, _f;
163
173
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
164
- url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CartesiaEnvironment.Production, `/datasets/${encodeURIComponent(id)}/files`),
174
+ 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, `/datasets/${encodeURIComponent(id)}/files`),
165
175
  method: "GET",
166
- 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.3", "User-Agent": "@cartesia/cartesia-js/2.1.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
176
+ 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),
167
177
  contentType: "application/json",
168
178
  requestType: "json",
169
179
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -192,7 +202,7 @@ class Datasets {
192
202
  body: _response.error.rawBody,
193
203
  });
194
204
  case "timeout":
195
- throw new errors.CartesiaTimeoutError();
205
+ throw new errors.CartesiaTimeoutError("Timeout exceeded when calling GET /datasets/{id}/files.");
196
206
  case "unknown":
197
207
  throw new errors.CartesiaError({
198
208
  message: _response.error.errorMessage,
@@ -210,16 +220,16 @@ class Datasets {
210
220
  * await client.datasets.uploadFile(fs.createReadStream("/path/to/your/file"), "string", {})
211
221
  */
212
222
  uploadFile(file, id, request, requestOptions) {
213
- var _a, _b, _c, _d, _e;
214
223
  return __awaiter(this, void 0, void 0, function* () {
224
+ var _a, _b, _c, _d, _e, _f;
215
225
  const _request = yield core.newFormData();
216
226
  yield _request.appendFile("file", file);
217
- yield _request.append("purpose", request.purpose);
227
+ _request.append("purpose", serializers.FilePurpose.jsonOrThrow(request.purpose, { unrecognizedObjectKeys: "strip" }));
218
228
  const _maybeEncodedRequest = yield _request.getRequest();
219
229
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
220
- url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CartesiaEnvironment.Production, `/datasets/${encodeURIComponent(id)}/files`),
230
+ 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, `/datasets/${encodeURIComponent(id)}/files`),
221
231
  method: "POST",
222
- 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.3", "User-Agent": "@cartesia/cartesia-js/2.1.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), _maybeEncodedRequest.headers),
232
+ 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),
223
233
  requestType: "file",
224
234
  duplex: _maybeEncodedRequest.duplex,
225
235
  body: _maybeEncodedRequest.body,
@@ -243,7 +253,7 @@ class Datasets {
243
253
  body: _response.error.rawBody,
244
254
  });
245
255
  case "timeout":
246
- throw new errors.CartesiaTimeoutError();
256
+ throw new errors.CartesiaTimeoutError("Timeout exceeded when calling POST /datasets/{id}/files.");
247
257
  case "unknown":
248
258
  throw new errors.CartesiaError({
249
259
  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 FilePurpose = "fine_tune";
4
+ export type FilePurpose = "fine_tune";
5
5
  export declare const FilePurpose: {
6
6
  readonly FineTune: "fine_tune";
7
7
  };
@@ -7,4 +7,4 @@
7
7
  * @example
8
8
  * [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
9
9
  */
10
- export declare type Embedding = number[];
10
+ export type Embedding = number[];
@@ -10,6 +10,8 @@ export * as voiceChanger from "./voiceChanger";
10
10
  export * from "./voiceChanger/types";
11
11
  export * as voices from "./voices";
12
12
  export * from "./voices/types";
13
+ export * as infill from "./infill";
13
14
  export * from "./datasets/client/requests";
15
+ export * from "./infill/client/requests";
14
16
  export * from "./voiceChanger/client/requests";
15
17
  export * from "./voices/client/requests";