@corti/sdk 1.0.0-alpha → 1.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (399) hide show
  1. package/README.md +126 -44
  2. package/dist/cjs/BaseClient.js +2 -2
  3. package/dist/cjs/api/errors/ForbiddenError.d.ts +1 -2
  4. package/dist/cjs/api/errors/UnprocessableEntityError.d.ts +6 -0
  5. package/dist/cjs/api/errors/UnprocessableEntityError.js +54 -0
  6. package/dist/cjs/api/errors/index.d.ts +1 -0
  7. package/dist/cjs/api/errors/index.js +1 -0
  8. package/dist/cjs/api/resources/agents/client/Client.d.ts +6 -0
  9. package/dist/cjs/api/resources/agents/client/Client.js +42 -0
  10. package/dist/cjs/api/resources/codes/client/Client.d.ts +15 -3
  11. package/dist/cjs/api/resources/codes/client/Client.js +16 -10
  12. package/dist/cjs/api/resources/codes/client/requests/CodesGeneralPredictRequest.d.ts +16 -4
  13. package/dist/cjs/api/resources/documents/client/Client.js +5 -35
  14. package/dist/cjs/api/resources/interactions/client/Client.js +5 -35
  15. package/dist/cjs/api/resources/recordings/client/Client.js +4 -28
  16. package/dist/cjs/api/resources/stream/client/Client.d.ts +2 -2
  17. package/dist/cjs/api/resources/stream/client/Client.js +4 -2
  18. package/dist/cjs/api/resources/stream/client/Socket.d.ts +1 -1
  19. package/dist/cjs/api/resources/transcribe/client/Client.d.ts +2 -2
  20. package/dist/cjs/api/resources/transcribe/client/Client.js +4 -2
  21. package/dist/cjs/api/resources/transcribe/client/Socket.d.ts +1 -1
  22. package/dist/cjs/api/resources/transcripts/client/Client.js +4 -28
  23. package/dist/cjs/api/types/AgentsErrorResponse.d.ts +12 -0
  24. package/dist/cjs/api/types/AgentsErrorResponse.js +3 -0
  25. package/dist/cjs/api/types/AgentsValidationError.d.ts +8 -0
  26. package/dist/cjs/api/types/AgentsValidationError.js +3 -0
  27. package/dist/cjs/api/types/AgentsValidationErrorErrorsItem.d.ts +4 -0
  28. package/dist/cjs/api/types/AgentsValidationErrorErrorsItem.js +3 -0
  29. package/dist/cjs/api/types/AgentsValidationErrorResponse.d.ts +4 -0
  30. package/dist/cjs/api/types/AgentsValidationErrorResponse.js +3 -0
  31. package/dist/cjs/api/types/CodesFilter.d.ts +11 -0
  32. package/dist/cjs/api/types/CodesFilter.js +3 -0
  33. package/dist/cjs/api/types/CodesGeneralReadResponse.d.ts +2 -0
  34. package/dist/cjs/api/types/CodesGeneralReadResponseAlternativesItem.d.ts +9 -0
  35. package/dist/cjs/api/types/CodesGeneralReadResponseAlternativesItem.js +3 -0
  36. package/dist/cjs/api/types/CodesGeneralReadResponseEvidencesItem.d.ts +6 -2
  37. package/dist/cjs/api/types/CodesGeneralResponse.d.ts +2 -2
  38. package/dist/cjs/api/types/CommonCodingSystemEnum.d.ts +2 -1
  39. package/dist/cjs/api/types/CommonCodingSystemEnum.js +2 -1
  40. package/dist/cjs/api/types/StreamConfigMessage.d.ts +1 -1
  41. package/dist/cjs/api/types/StreamEndMessage.d.ts +1 -2
  42. package/dist/cjs/api/types/StreamEndedMessage.d.ts +1 -2
  43. package/dist/cjs/api/types/StreamErrorMessage.d.ts +1 -1
  44. package/dist/cjs/api/types/StreamFactsMessage.d.ts +1 -1
  45. package/dist/cjs/api/types/StreamFlushMessage.d.ts +1 -2
  46. package/dist/cjs/api/types/StreamFlushedMessage.d.ts +1 -2
  47. package/dist/cjs/api/types/StreamTranscriptMessage.d.ts +1 -1
  48. package/dist/cjs/api/types/StreamUsageMessage.d.ts +1 -2
  49. package/dist/cjs/api/types/TranscribeCommandMessage.d.ts +1 -1
  50. package/dist/cjs/api/types/TranscribeCommandVariable.d.ts +1 -2
  51. package/dist/cjs/api/types/TranscribeConfigMessage.d.ts +1 -1
  52. package/dist/cjs/api/types/TranscribeEndMessage.d.ts +1 -2
  53. package/dist/cjs/api/types/TranscribeEndedMessage.d.ts +1 -2
  54. package/dist/cjs/api/types/TranscribeErrorMessage.d.ts +1 -1
  55. package/dist/cjs/api/types/TranscribeFlushMessage.d.ts +1 -2
  56. package/dist/cjs/api/types/TranscribeFlushedMessage.d.ts +1 -2
  57. package/dist/cjs/api/types/TranscribeFormattingDates.d.ts +4 -4
  58. package/dist/cjs/api/types/TranscribeFormattingDates.js +4 -4
  59. package/dist/cjs/api/types/TranscribeFormattingNumbers.d.ts +2 -2
  60. package/dist/cjs/api/types/TranscribeFormattingNumbers.js +2 -2
  61. package/dist/cjs/api/types/TranscribeFormattingNumericRanges.d.ts +1 -1
  62. package/dist/cjs/api/types/TranscribeFormattingNumericRanges.js +1 -1
  63. package/dist/cjs/api/types/TranscribeFormattingOrdinals.d.ts +1 -0
  64. package/dist/cjs/api/types/TranscribeFormattingOrdinals.js +1 -0
  65. package/dist/cjs/api/types/TranscribeFormattingTimes.d.ts +3 -2
  66. package/dist/cjs/api/types/TranscribeFormattingTimes.js +3 -2
  67. package/dist/cjs/api/types/TranscribeTranscriptMessage.d.ts +1 -1
  68. package/dist/cjs/api/types/TranscribeUsageMessage.d.ts +1 -2
  69. package/dist/cjs/api/types/index.d.ts +6 -19
  70. package/dist/cjs/api/types/index.js +6 -19
  71. package/dist/cjs/auth/OAuthAuthProvider.d.ts +1 -99
  72. package/dist/cjs/auth/OAuthAuthProvider.js +4 -276
  73. package/dist/cjs/core/fetcher/index.d.ts +2 -11
  74. package/dist/cjs/core/fetcher/index.js +16 -15
  75. package/dist/cjs/custom/CortiClient.d.ts +15 -4
  76. package/dist/cjs/custom/CortiClient.js +8 -5
  77. package/dist/cjs/custom/CortiWebSocketProxyClient.d.ts +10 -40
  78. package/dist/cjs/custom/CortiWebSocketProxyClient.js +12 -74
  79. package/dist/cjs/custom/OAuthAuthProvider.d.ts +99 -0
  80. package/dist/cjs/custom/OAuthAuthProvider.js +290 -0
  81. package/dist/cjs/custom/auth/CortiAuth.d.ts +129 -0
  82. package/dist/cjs/custom/auth/CortiAuth.js +195 -0
  83. package/dist/cjs/custom/auth/OAuthAuthCodeAuthProvider.d.ts +23 -0
  84. package/dist/cjs/custom/auth/OAuthAuthCodeAuthProvider.js +164 -0
  85. package/dist/cjs/custom/auth/OAuthPkceAuthProvider.d.ts +23 -0
  86. package/dist/cjs/custom/auth/OAuthPkceAuthProvider.js +164 -0
  87. package/dist/cjs/custom/auth/OAuthRopcAuthProvider.d.ts +22 -0
  88. package/dist/cjs/custom/auth/OAuthRopcAuthProvider.js +137 -0
  89. package/dist/cjs/custom/fetcher.d.ts +3 -0
  90. package/dist/cjs/custom/fetcher.js +8 -0
  91. package/dist/cjs/custom/index.d.ts +10 -0
  92. package/dist/cjs/custom/index.js +55 -1
  93. package/dist/cjs/custom/overrides/OAuthAuthProvider.d.ts +99 -0
  94. package/dist/cjs/custom/overrides/OAuthAuthProvider.js +289 -0
  95. package/dist/cjs/custom/overrides/fetcher/index.d.ts +12 -0
  96. package/dist/cjs/custom/overrides/fetcher/index.js +18 -0
  97. package/dist/cjs/custom/overrides/index.d.ts +14 -0
  98. package/dist/cjs/custom/overrides/index.js +61 -0
  99. package/dist/cjs/custom/proxy/CustomProxyStream.d.ts +17 -0
  100. package/dist/cjs/custom/proxy/CustomProxyStream.js +18 -0
  101. package/dist/cjs/custom/proxy/CustomProxyTranscribe.d.ts +17 -0
  102. package/dist/cjs/custom/proxy/CustomProxyTranscribe.js +21 -0
  103. package/dist/cjs/custom/stream/CustomStream.d.ts +39 -0
  104. package/dist/cjs/custom/stream/CustomStream.js +183 -0
  105. package/dist/cjs/custom/stream/CustomStreamSocket.d.ts +7 -0
  106. package/dist/cjs/custom/stream/CustomStreamSocket.js +17 -0
  107. package/dist/cjs/custom/stream/parseStreamResponseType.d.ts +2 -0
  108. package/dist/cjs/custom/stream/parseStreamResponseType.js +49 -0
  109. package/dist/cjs/custom/transcribe/CustomTranscribe.d.ts +38 -0
  110. package/dist/cjs/custom/transcribe/CustomTranscribe.js +181 -0
  111. package/dist/cjs/custom/transcribe/CustomTranscribeSocket.d.ts +7 -0
  112. package/dist/cjs/custom/transcribe/CustomTranscribeSocket.js +17 -0
  113. package/dist/cjs/custom/transcribe/parseTranscribeResponseType.d.ts +2 -0
  114. package/dist/cjs/custom/transcribe/parseTranscribeResponseType.js +49 -0
  115. package/dist/cjs/custom/utils/encodeHeadersAsWsProtocols.d.ts +30 -0
  116. package/dist/cjs/custom/utils/encodeHeadersAsWsProtocols.js +102 -0
  117. package/dist/cjs/custom/utils/index.d.ts +3 -0
  118. package/dist/cjs/custom/utils/index.js +10 -0
  119. package/dist/cjs/custom/utils/localStorageHelpers.js +11 -9
  120. package/dist/cjs/custom/utils/withCredentialsConfig.d.ts +2 -0
  121. package/dist/cjs/custom/utils/withCredentialsConfig.js +15 -0
  122. package/dist/cjs/index.d.ts +1 -16
  123. package/dist/cjs/index.js +1 -47
  124. package/dist/cjs/serialization/resources/codes/client/requests/CodesGeneralPredictRequest.d.ts +2 -1
  125. package/dist/cjs/serialization/resources/codes/client/requests/CodesGeneralPredictRequest.js +2 -1
  126. package/dist/cjs/serialization/resources/stream/client/socket/StreamSocketResponse.d.ts +2 -2
  127. package/dist/cjs/serialization/resources/stream/client/socket/StreamSocketResponse.js +1 -1
  128. package/dist/cjs/serialization/resources/transcribe/client/socket/TranscribeSocketResponse.d.ts +2 -2
  129. package/dist/cjs/serialization/resources/transcribe/client/socket/TranscribeSocketResponse.js +1 -1
  130. package/dist/cjs/serialization/types/AgentsErrorResponse.d.ts +13 -0
  131. package/dist/cjs/serialization/types/AgentsErrorResponse.js +46 -0
  132. package/dist/cjs/serialization/types/AgentsValidationError.d.ts +14 -0
  133. package/dist/cjs/serialization/types/AgentsValidationError.js +46 -0
  134. package/dist/cjs/serialization/types/AgentsValidationErrorErrorsItem.d.ts +10 -0
  135. package/dist/cjs/serialization/types/AgentsValidationErrorErrorsItem.js +42 -0
  136. package/dist/cjs/serialization/types/AgentsValidationErrorResponse.d.ts +10 -0
  137. package/dist/cjs/serialization/types/AgentsValidationErrorResponse.js +45 -0
  138. package/dist/cjs/serialization/types/CodesFilter.d.ts +11 -0
  139. package/dist/cjs/serialization/types/CodesFilter.js +43 -0
  140. package/dist/cjs/serialization/types/CodesGeneralReadResponse.d.ts +2 -0
  141. package/dist/cjs/serialization/types/CodesGeneralReadResponse.js +2 -0
  142. package/dist/cjs/serialization/types/CodesGeneralReadResponseAlternativesItem.d.ts +10 -0
  143. package/dist/cjs/serialization/types/CodesGeneralReadResponseAlternativesItem.js +42 -0
  144. package/dist/cjs/serialization/types/CodesGeneralReadResponseEvidencesItem.d.ts +4 -2
  145. package/dist/cjs/serialization/types/CodesGeneralReadResponseEvidencesItem.js +4 -2
  146. package/dist/cjs/serialization/types/CommonCodingSystemEnum.d.ts +1 -1
  147. package/dist/cjs/serialization/types/CommonCodingSystemEnum.js +1 -1
  148. package/dist/cjs/serialization/types/StreamConfigMessage.d.ts +1 -2
  149. package/dist/cjs/serialization/types/StreamConfigMessage.js +1 -2
  150. package/dist/cjs/serialization/types/StreamEndMessage.d.ts +1 -2
  151. package/dist/cjs/serialization/types/StreamEndMessage.js +1 -2
  152. package/dist/cjs/serialization/types/StreamEndedMessage.d.ts +1 -2
  153. package/dist/cjs/serialization/types/StreamEndedMessage.js +1 -2
  154. package/dist/cjs/serialization/types/StreamErrorMessage.d.ts +1 -2
  155. package/dist/cjs/serialization/types/StreamErrorMessage.js +1 -2
  156. package/dist/cjs/serialization/types/StreamFactsMessage.d.ts +1 -2
  157. package/dist/cjs/serialization/types/StreamFactsMessage.js +1 -2
  158. package/dist/cjs/serialization/types/StreamFlushMessage.d.ts +1 -2
  159. package/dist/cjs/serialization/types/StreamFlushMessage.js +1 -2
  160. package/dist/cjs/serialization/types/StreamFlushedMessage.d.ts +1 -2
  161. package/dist/cjs/serialization/types/StreamFlushedMessage.js +1 -2
  162. package/dist/cjs/serialization/types/StreamTranscriptMessage.d.ts +1 -2
  163. package/dist/cjs/serialization/types/StreamTranscriptMessage.js +1 -2
  164. package/dist/cjs/serialization/types/StreamUsageMessage.d.ts +1 -2
  165. package/dist/cjs/serialization/types/StreamUsageMessage.js +1 -2
  166. package/dist/cjs/serialization/types/TranscribeCommandMessage.d.ts +1 -2
  167. package/dist/cjs/serialization/types/TranscribeCommandMessage.js +1 -2
  168. package/dist/cjs/serialization/types/TranscribeCommandVariable.d.ts +1 -2
  169. package/dist/cjs/serialization/types/TranscribeCommandVariable.js +1 -2
  170. package/dist/cjs/serialization/types/TranscribeConfigMessage.d.ts +1 -2
  171. package/dist/cjs/serialization/types/TranscribeConfigMessage.js +1 -2
  172. package/dist/cjs/serialization/types/TranscribeEndMessage.d.ts +1 -2
  173. package/dist/cjs/serialization/types/TranscribeEndMessage.js +1 -2
  174. package/dist/cjs/serialization/types/TranscribeEndedMessage.d.ts +1 -2
  175. package/dist/cjs/serialization/types/TranscribeEndedMessage.js +1 -2
  176. package/dist/cjs/serialization/types/TranscribeErrorMessage.d.ts +1 -2
  177. package/dist/cjs/serialization/types/TranscribeErrorMessage.js +1 -2
  178. package/dist/cjs/serialization/types/TranscribeFlushMessage.d.ts +1 -2
  179. package/dist/cjs/serialization/types/TranscribeFlushMessage.js +1 -2
  180. package/dist/cjs/serialization/types/TranscribeFlushedMessage.d.ts +1 -2
  181. package/dist/cjs/serialization/types/TranscribeFlushedMessage.js +1 -2
  182. package/dist/cjs/serialization/types/TranscribeFormattingDates.d.ts +1 -1
  183. package/dist/cjs/serialization/types/TranscribeFormattingDates.js +1 -1
  184. package/dist/cjs/serialization/types/TranscribeFormattingNumbers.d.ts +1 -1
  185. package/dist/cjs/serialization/types/TranscribeFormattingNumbers.js +1 -1
  186. package/dist/cjs/serialization/types/TranscribeFormattingNumericRanges.d.ts +1 -1
  187. package/dist/cjs/serialization/types/TranscribeFormattingNumericRanges.js +1 -1
  188. package/dist/cjs/serialization/types/TranscribeFormattingOrdinals.d.ts +1 -1
  189. package/dist/cjs/serialization/types/TranscribeFormattingOrdinals.js +1 -1
  190. package/dist/cjs/serialization/types/TranscribeFormattingTimes.d.ts +1 -1
  191. package/dist/cjs/serialization/types/TranscribeFormattingTimes.js +1 -1
  192. package/dist/cjs/serialization/types/TranscribeTranscriptMessage.d.ts +1 -2
  193. package/dist/cjs/serialization/types/TranscribeTranscriptMessage.js +1 -2
  194. package/dist/cjs/serialization/types/TranscribeUsageMessage.d.ts +1 -2
  195. package/dist/cjs/serialization/types/TranscribeUsageMessage.js +1 -2
  196. package/dist/cjs/serialization/types/index.d.ts +6 -19
  197. package/dist/cjs/serialization/types/index.js +6 -19
  198. package/dist/cjs/version.d.ts +1 -1
  199. package/dist/cjs/version.js +1 -1
  200. package/dist/esm/BaseClient.mjs +2 -2
  201. package/dist/esm/api/errors/ForbiddenError.d.mts +1 -2
  202. package/dist/esm/api/errors/UnprocessableEntityError.d.mts +6 -0
  203. package/dist/esm/api/errors/UnprocessableEntityError.mjs +17 -0
  204. package/dist/esm/api/errors/index.d.mts +1 -0
  205. package/dist/esm/api/errors/index.mjs +1 -0
  206. package/dist/esm/api/resources/agents/client/Client.d.mts +6 -0
  207. package/dist/esm/api/resources/agents/client/Client.mjs +42 -0
  208. package/dist/esm/api/resources/codes/client/Client.d.mts +15 -3
  209. package/dist/esm/api/resources/codes/client/Client.mjs +16 -10
  210. package/dist/esm/api/resources/codes/client/requests/CodesGeneralPredictRequest.d.mts +16 -4
  211. package/dist/esm/api/resources/documents/client/Client.mjs +5 -35
  212. package/dist/esm/api/resources/interactions/client/Client.mjs +5 -35
  213. package/dist/esm/api/resources/recordings/client/Client.mjs +4 -28
  214. package/dist/esm/api/resources/stream/client/Client.d.mts +2 -2
  215. package/dist/esm/api/resources/stream/client/Client.mjs +5 -3
  216. package/dist/esm/api/resources/stream/client/Socket.d.mts +1 -1
  217. package/dist/esm/api/resources/transcribe/client/Client.d.mts +2 -2
  218. package/dist/esm/api/resources/transcribe/client/Client.mjs +5 -3
  219. package/dist/esm/api/resources/transcribe/client/Socket.d.mts +1 -1
  220. package/dist/esm/api/resources/transcripts/client/Client.mjs +4 -28
  221. package/dist/esm/api/types/AgentsErrorResponse.d.mts +12 -0
  222. package/dist/esm/api/types/AgentsErrorResponse.mjs +2 -0
  223. package/dist/esm/api/types/AgentsValidationError.d.mts +8 -0
  224. package/dist/esm/api/types/AgentsValidationError.mjs +2 -0
  225. package/dist/esm/api/types/AgentsValidationErrorErrorsItem.d.mts +4 -0
  226. package/dist/esm/api/types/AgentsValidationErrorErrorsItem.mjs +2 -0
  227. package/dist/esm/api/types/AgentsValidationErrorResponse.d.mts +4 -0
  228. package/dist/esm/api/types/AgentsValidationErrorResponse.mjs +2 -0
  229. package/dist/esm/api/types/CodesFilter.d.mts +11 -0
  230. package/dist/esm/api/types/CodesFilter.mjs +2 -0
  231. package/dist/esm/api/types/CodesGeneralReadResponse.d.mts +2 -0
  232. package/dist/esm/api/types/CodesGeneralReadResponseAlternativesItem.d.mts +9 -0
  233. package/dist/esm/api/types/CodesGeneralReadResponseAlternativesItem.mjs +2 -0
  234. package/dist/esm/api/types/CodesGeneralReadResponseEvidencesItem.d.mts +6 -2
  235. package/dist/esm/api/types/CodesGeneralResponse.d.mts +2 -2
  236. package/dist/esm/api/types/CommonCodingSystemEnum.d.mts +2 -1
  237. package/dist/esm/api/types/CommonCodingSystemEnum.mjs +2 -1
  238. package/dist/esm/api/types/StreamConfigMessage.d.mts +1 -1
  239. package/dist/esm/api/types/StreamEndMessage.d.mts +1 -2
  240. package/dist/esm/api/types/StreamEndedMessage.d.mts +1 -2
  241. package/dist/esm/api/types/StreamErrorMessage.d.mts +1 -1
  242. package/dist/esm/api/types/StreamFactsMessage.d.mts +1 -1
  243. package/dist/esm/api/types/StreamFlushMessage.d.mts +1 -2
  244. package/dist/esm/api/types/StreamFlushedMessage.d.mts +1 -2
  245. package/dist/esm/api/types/StreamTranscriptMessage.d.mts +1 -1
  246. package/dist/esm/api/types/StreamUsageMessage.d.mts +1 -2
  247. package/dist/esm/api/types/TranscribeCommandMessage.d.mts +1 -1
  248. package/dist/esm/api/types/TranscribeCommandVariable.d.mts +1 -2
  249. package/dist/esm/api/types/TranscribeConfigMessage.d.mts +1 -1
  250. package/dist/esm/api/types/TranscribeEndMessage.d.mts +1 -2
  251. package/dist/esm/api/types/TranscribeEndedMessage.d.mts +1 -2
  252. package/dist/esm/api/types/TranscribeErrorMessage.d.mts +1 -1
  253. package/dist/esm/api/types/TranscribeFlushMessage.d.mts +1 -2
  254. package/dist/esm/api/types/TranscribeFlushedMessage.d.mts +1 -2
  255. package/dist/esm/api/types/TranscribeFormattingDates.d.mts +4 -4
  256. package/dist/esm/api/types/TranscribeFormattingDates.mjs +4 -4
  257. package/dist/esm/api/types/TranscribeFormattingNumbers.d.mts +2 -2
  258. package/dist/esm/api/types/TranscribeFormattingNumbers.mjs +2 -2
  259. package/dist/esm/api/types/TranscribeFormattingNumericRanges.d.mts +1 -1
  260. package/dist/esm/api/types/TranscribeFormattingNumericRanges.mjs +1 -1
  261. package/dist/esm/api/types/TranscribeFormattingOrdinals.d.mts +1 -0
  262. package/dist/esm/api/types/TranscribeFormattingOrdinals.mjs +1 -0
  263. package/dist/esm/api/types/TranscribeFormattingTimes.d.mts +3 -2
  264. package/dist/esm/api/types/TranscribeFormattingTimes.mjs +3 -2
  265. package/dist/esm/api/types/TranscribeTranscriptMessage.d.mts +1 -1
  266. package/dist/esm/api/types/TranscribeUsageMessage.d.mts +1 -2
  267. package/dist/esm/api/types/index.d.mts +6 -19
  268. package/dist/esm/api/types/index.mjs +6 -19
  269. package/dist/esm/auth/OAuthAuthProvider.d.mts +1 -99
  270. package/dist/esm/auth/OAuthAuthProvider.mjs +2 -239
  271. package/dist/esm/core/fetcher/index.d.mts +2 -11
  272. package/dist/esm/core/fetcher/index.mjs +2 -6
  273. package/dist/esm/custom/CortiClient.d.mts +15 -4
  274. package/dist/esm/custom/CortiClient.mjs +8 -5
  275. package/dist/esm/custom/CortiWebSocketProxyClient.d.mts +10 -40
  276. package/dist/esm/custom/CortiWebSocketProxyClient.mjs +10 -39
  277. package/dist/esm/custom/OAuthAuthProvider.d.mts +99 -0
  278. package/dist/esm/custom/OAuthAuthProvider.mjs +239 -0
  279. package/dist/esm/custom/auth/CortiAuth.d.mts +129 -0
  280. package/dist/esm/custom/auth/CortiAuth.mjs +158 -0
  281. package/dist/esm/custom/auth/OAuthAuthCodeAuthProvider.d.mts +23 -0
  282. package/dist/esm/custom/auth/OAuthAuthCodeAuthProvider.mjs +127 -0
  283. package/dist/esm/custom/auth/OAuthPkceAuthProvider.d.mts +23 -0
  284. package/dist/esm/custom/auth/OAuthPkceAuthProvider.mjs +127 -0
  285. package/dist/esm/custom/auth/OAuthRopcAuthProvider.d.mts +22 -0
  286. package/dist/esm/custom/auth/OAuthRopcAuthProvider.mjs +100 -0
  287. package/dist/esm/custom/fetcher.d.mts +3 -0
  288. package/dist/esm/custom/fetcher.mjs +4 -0
  289. package/dist/esm/custom/index.d.mts +10 -0
  290. package/dist/esm/custom/index.mjs +10 -0
  291. package/dist/esm/custom/overrides/OAuthAuthProvider.d.mts +99 -0
  292. package/dist/esm/custom/overrides/OAuthAuthProvider.mjs +238 -0
  293. package/dist/esm/custom/overrides/fetcher/index.d.mts +12 -0
  294. package/dist/esm/custom/overrides/fetcher/index.mjs +7 -0
  295. package/dist/esm/custom/overrides/index.d.mts +14 -0
  296. package/dist/esm/custom/overrides/index.mjs +14 -0
  297. package/dist/esm/custom/proxy/CustomProxyStream.d.mts +17 -0
  298. package/dist/esm/custom/proxy/CustomProxyStream.mjs +15 -0
  299. package/dist/esm/custom/proxy/CustomProxyTranscribe.d.mts +17 -0
  300. package/dist/esm/custom/proxy/CustomProxyTranscribe.mjs +18 -0
  301. package/dist/esm/custom/stream/CustomStream.d.mts +39 -0
  302. package/dist/esm/custom/stream/CustomStream.mjs +146 -0
  303. package/dist/esm/custom/stream/CustomStreamSocket.d.mts +7 -0
  304. package/dist/esm/custom/stream/CustomStreamSocket.mjs +13 -0
  305. package/dist/esm/custom/stream/parseStreamResponseType.d.mts +2 -0
  306. package/dist/esm/custom/stream/parseStreamResponseType.mjs +13 -0
  307. package/dist/esm/custom/transcribe/CustomTranscribe.d.mts +38 -0
  308. package/dist/esm/custom/transcribe/CustomTranscribe.mjs +144 -0
  309. package/dist/esm/custom/transcribe/CustomTranscribeSocket.d.mts +7 -0
  310. package/dist/esm/custom/transcribe/CustomTranscribeSocket.mjs +13 -0
  311. package/dist/esm/custom/transcribe/parseTranscribeResponseType.d.mts +2 -0
  312. package/dist/esm/custom/transcribe/parseTranscribeResponseType.mjs +13 -0
  313. package/dist/esm/custom/utils/encodeHeadersAsWsProtocols.d.mts +30 -0
  314. package/dist/esm/custom/utils/encodeHeadersAsWsProtocols.mjs +65 -0
  315. package/dist/esm/custom/utils/index.d.mts +3 -0
  316. package/dist/esm/custom/utils/index.mjs +3 -0
  317. package/dist/esm/custom/utils/localStorageHelpers.mjs +11 -9
  318. package/dist/esm/custom/utils/withCredentialsConfig.d.mts +2 -0
  319. package/dist/esm/custom/utils/withCredentialsConfig.mjs +11 -0
  320. package/dist/esm/index.d.mts +1 -16
  321. package/dist/esm/index.mjs +1 -15
  322. package/dist/esm/serialization/resources/codes/client/requests/CodesGeneralPredictRequest.d.mts +2 -1
  323. package/dist/esm/serialization/resources/codes/client/requests/CodesGeneralPredictRequest.mjs +2 -1
  324. package/dist/esm/serialization/resources/stream/client/socket/StreamSocketResponse.d.mts +2 -2
  325. package/dist/esm/serialization/resources/stream/client/socket/StreamSocketResponse.mjs +1 -1
  326. package/dist/esm/serialization/resources/transcribe/client/socket/TranscribeSocketResponse.d.mts +2 -2
  327. package/dist/esm/serialization/resources/transcribe/client/socket/TranscribeSocketResponse.mjs +1 -1
  328. package/dist/esm/serialization/types/AgentsErrorResponse.d.mts +13 -0
  329. package/dist/esm/serialization/types/AgentsErrorResponse.mjs +10 -0
  330. package/dist/esm/serialization/types/AgentsValidationError.d.mts +14 -0
  331. package/dist/esm/serialization/types/AgentsValidationError.mjs +10 -0
  332. package/dist/esm/serialization/types/AgentsValidationErrorErrorsItem.d.mts +10 -0
  333. package/dist/esm/serialization/types/AgentsValidationErrorErrorsItem.mjs +6 -0
  334. package/dist/esm/serialization/types/AgentsValidationErrorResponse.d.mts +10 -0
  335. package/dist/esm/serialization/types/AgentsValidationErrorResponse.mjs +9 -0
  336. package/dist/esm/serialization/types/CodesFilter.d.mts +11 -0
  337. package/dist/esm/serialization/types/CodesFilter.mjs +7 -0
  338. package/dist/esm/serialization/types/CodesGeneralReadResponse.d.mts +2 -0
  339. package/dist/esm/serialization/types/CodesGeneralReadResponse.mjs +2 -0
  340. package/dist/esm/serialization/types/CodesGeneralReadResponseAlternativesItem.d.mts +10 -0
  341. package/dist/esm/serialization/types/CodesGeneralReadResponseAlternativesItem.mjs +6 -0
  342. package/dist/esm/serialization/types/CodesGeneralReadResponseEvidencesItem.d.mts +4 -2
  343. package/dist/esm/serialization/types/CodesGeneralReadResponseEvidencesItem.mjs +4 -2
  344. package/dist/esm/serialization/types/CommonCodingSystemEnum.d.mts +1 -1
  345. package/dist/esm/serialization/types/CommonCodingSystemEnum.mjs +1 -1
  346. package/dist/esm/serialization/types/StreamConfigMessage.d.mts +1 -2
  347. package/dist/esm/serialization/types/StreamConfigMessage.mjs +1 -2
  348. package/dist/esm/serialization/types/StreamEndMessage.d.mts +1 -2
  349. package/dist/esm/serialization/types/StreamEndMessage.mjs +1 -2
  350. package/dist/esm/serialization/types/StreamEndedMessage.d.mts +1 -2
  351. package/dist/esm/serialization/types/StreamEndedMessage.mjs +1 -2
  352. package/dist/esm/serialization/types/StreamErrorMessage.d.mts +1 -2
  353. package/dist/esm/serialization/types/StreamErrorMessage.mjs +1 -2
  354. package/dist/esm/serialization/types/StreamFactsMessage.d.mts +1 -2
  355. package/dist/esm/serialization/types/StreamFactsMessage.mjs +1 -2
  356. package/dist/esm/serialization/types/StreamFlushMessage.d.mts +1 -2
  357. package/dist/esm/serialization/types/StreamFlushMessage.mjs +1 -2
  358. package/dist/esm/serialization/types/StreamFlushedMessage.d.mts +1 -2
  359. package/dist/esm/serialization/types/StreamFlushedMessage.mjs +1 -2
  360. package/dist/esm/serialization/types/StreamTranscriptMessage.d.mts +1 -2
  361. package/dist/esm/serialization/types/StreamTranscriptMessage.mjs +1 -2
  362. package/dist/esm/serialization/types/StreamUsageMessage.d.mts +1 -2
  363. package/dist/esm/serialization/types/StreamUsageMessage.mjs +1 -2
  364. package/dist/esm/serialization/types/TranscribeCommandMessage.d.mts +1 -2
  365. package/dist/esm/serialization/types/TranscribeCommandMessage.mjs +1 -2
  366. package/dist/esm/serialization/types/TranscribeCommandVariable.d.mts +1 -2
  367. package/dist/esm/serialization/types/TranscribeCommandVariable.mjs +1 -2
  368. package/dist/esm/serialization/types/TranscribeConfigMessage.d.mts +1 -2
  369. package/dist/esm/serialization/types/TranscribeConfigMessage.mjs +1 -2
  370. package/dist/esm/serialization/types/TranscribeEndMessage.d.mts +1 -2
  371. package/dist/esm/serialization/types/TranscribeEndMessage.mjs +1 -2
  372. package/dist/esm/serialization/types/TranscribeEndedMessage.d.mts +1 -2
  373. package/dist/esm/serialization/types/TranscribeEndedMessage.mjs +1 -2
  374. package/dist/esm/serialization/types/TranscribeErrorMessage.d.mts +1 -2
  375. package/dist/esm/serialization/types/TranscribeErrorMessage.mjs +1 -2
  376. package/dist/esm/serialization/types/TranscribeFlushMessage.d.mts +1 -2
  377. package/dist/esm/serialization/types/TranscribeFlushMessage.mjs +1 -2
  378. package/dist/esm/serialization/types/TranscribeFlushedMessage.d.mts +1 -2
  379. package/dist/esm/serialization/types/TranscribeFlushedMessage.mjs +1 -2
  380. package/dist/esm/serialization/types/TranscribeFormattingDates.d.mts +1 -1
  381. package/dist/esm/serialization/types/TranscribeFormattingDates.mjs +1 -1
  382. package/dist/esm/serialization/types/TranscribeFormattingNumbers.d.mts +1 -1
  383. package/dist/esm/serialization/types/TranscribeFormattingNumbers.mjs +1 -1
  384. package/dist/esm/serialization/types/TranscribeFormattingNumericRanges.d.mts +1 -1
  385. package/dist/esm/serialization/types/TranscribeFormattingNumericRanges.mjs +1 -1
  386. package/dist/esm/serialization/types/TranscribeFormattingOrdinals.d.mts +1 -1
  387. package/dist/esm/serialization/types/TranscribeFormattingOrdinals.mjs +1 -1
  388. package/dist/esm/serialization/types/TranscribeFormattingTimes.d.mts +1 -1
  389. package/dist/esm/serialization/types/TranscribeFormattingTimes.mjs +1 -1
  390. package/dist/esm/serialization/types/TranscribeTranscriptMessage.d.mts +1 -2
  391. package/dist/esm/serialization/types/TranscribeTranscriptMessage.mjs +1 -2
  392. package/dist/esm/serialization/types/TranscribeUsageMessage.d.mts +1 -2
  393. package/dist/esm/serialization/types/TranscribeUsageMessage.mjs +1 -2
  394. package/dist/esm/serialization/types/index.d.mts +6 -19
  395. package/dist/esm/serialization/types/index.mjs +6 -19
  396. package/dist/esm/version.d.mts +1 -1
  397. package/dist/esm/version.mjs +1 -1
  398. package/package.json +10 -120
  399. package/reference.md +0 -2748
@@ -0,0 +1,144 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __rest = (this && this.__rest) || function (s, e) {
11
+ var t = {};
12
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
13
+ t[p] = s[p];
14
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
15
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
16
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
17
+ t[p[i]] = s[p[i]];
18
+ }
19
+ return t;
20
+ };
21
+ import { TranscribeClient } from "../../api/resources/transcribe/client/Client.mjs";
22
+ import { CustomTranscribeSocket } from "./CustomTranscribeSocket.mjs";
23
+ import * as Corti from "../../api/index.mjs";
24
+ import { ErrorEvent } from "../../core/websocket/events.mjs";
25
+ import { parseTranscribeResponseType } from "./parseTranscribeResponseType.mjs";
26
+ import * as core from "../../core/index.mjs";
27
+ import { getWsProtocols } from "../utils/encodeHeadersAsWsProtocols.mjs";
28
+ const TRANSCRIBE_CONFIG_REJECTION_TYPES = [
29
+ Corti.TranscribeConfigStatusMessageType.ConfigDenied,
30
+ Corti.TranscribeConfigStatusMessageType.ConfigTimeout,
31
+ ];
32
+ export class CustomTranscribe extends TranscribeClient {
33
+ constructor(options) {
34
+ super(options);
35
+ this._encodeHeadersAsWsProtocols = options.encodeHeadersAsWsProtocols;
36
+ }
37
+ connect(args) {
38
+ const _super = Object.create(null, {
39
+ connect: { get: () => super.connect }
40
+ });
41
+ return __awaiter(this, void 0, void 0, function* () {
42
+ var _a, _b, _c, _d, _e, _f, _g, _h;
43
+ const _j = args !== null && args !== void 0 ? args : {}, { configuration, awaitConfiguration = true, proxy } = _j, rest = __rest(_j, ["configuration", "awaitConfiguration", "proxy"]);
44
+ const useProxyPath = proxy || this._encodeHeadersAsWsProtocols;
45
+ const protocols = yield getWsProtocols(Object.assign(Object.assign({}, this._options), { encodeHeadersAsWsProtocols: this._encodeHeadersAsWsProtocols }), proxy === null || proxy === void 0 ? void 0 : proxy.protocols);
46
+ const socket = useProxyPath
47
+ ? new core.ReconnectingWebSocket({
48
+ url: (_a = proxy === null || proxy === void 0 ? void 0 : proxy.url) !== null && _a !== void 0 ? _a : core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment)).wss, "/transcribe"),
49
+ protocols,
50
+ queryParameters: (_c = proxy === null || proxy === void 0 ? void 0 : proxy.queryParameters) !== null && _c !== void 0 ? _c : {},
51
+ headers: (_d = rest.headers) !== null && _d !== void 0 ? _d : {},
52
+ options: { debug: (_e = rest.debug) !== null && _e !== void 0 ? _e : false, maxRetries: (_f = rest.reconnectAttempts) !== null && _f !== void 0 ? _f : 30 },
53
+ })
54
+ : (yield _super.connect.call(this, Object.assign(Object.assign({}, rest), { token: ((_h = (yield ((_g = this._options.authProvider) === null || _g === void 0 ? void 0 : _g.getAuthRequest()))) === null || _h === void 0 ? void 0 : _h.headers.Authorization) || "", tenantName: yield core.Supplier.get(this._options.tenantName) }))).socket;
55
+ const ws = new CustomTranscribeSocket({ socket });
56
+ if (!configuration) {
57
+ return ws;
58
+ }
59
+ if (awaitConfiguration) {
60
+ return this._connectWithConfigAck(ws, configuration);
61
+ }
62
+ return this._connectWithConfigListeners(ws, configuration);
63
+ });
64
+ }
65
+ /**
66
+ * Sends configuration on open, then resolves after CONFIG_ACCEPTED.
67
+ * Rejects and closes socket on CONFIG_DENIED / CONFIG_TIMEOUT /
68
+ * connection error / ended.
69
+ */
70
+ _connectWithConfigAck(socket, configuration) {
71
+ return __awaiter(this, void 0, void 0, function* () {
72
+ const configAck = this._buildConfigAckPromise(socket);
73
+ yield socket.waitForOpen();
74
+ socket.sendConfiguration({ type: "config", configuration });
75
+ try {
76
+ yield configAck;
77
+ }
78
+ catch (err) {
79
+ socket.close();
80
+ throw err;
81
+ }
82
+ // Persistent listener re-sends config on each reconnect
83
+ socket.socket.addEventListener("open", () => {
84
+ socket.sendConfiguration({ type: "config", configuration });
85
+ });
86
+ return socket;
87
+ });
88
+ }
89
+ /**
90
+ * Sends configuration on open and returns the socket immediately.
91
+ * Config errors are dispatched as ErrorEvent and the socket is closed.
92
+ */
93
+ _connectWithConfigListeners(socket, configuration) {
94
+ socket.socket.addEventListener("open", () => {
95
+ socket.sendConfiguration({ type: "config", configuration });
96
+ });
97
+ socket.socket.addEventListener("message", (event) => {
98
+ const type = parseTranscribeResponseType(event.data);
99
+ if (type == null || type === Corti.TranscribeConfigStatusMessageType.ConfigAccepted) {
100
+ return;
101
+ }
102
+ if (TRANSCRIBE_CONFIG_REJECTION_TYPES.includes(type) || type === "error") {
103
+ socket.socket.dispatchEvent(new ErrorEvent(new Error(type), socket.socket));
104
+ socket.close();
105
+ }
106
+ else if (type === "ended") {
107
+ socket.close();
108
+ }
109
+ });
110
+ return socket;
111
+ }
112
+ /** Resolves on CONFIG_ACCEPTED; rejects on rejection types, socket error, or ended. */
113
+ _buildConfigAckPromise(socket) {
114
+ return new Promise((resolve, reject) => {
115
+ const cleanup = () => {
116
+ socket.socket.removeEventListener("message", onMessage);
117
+ socket.socket.removeEventListener("error", onError);
118
+ };
119
+ const onError = (event) => {
120
+ cleanup();
121
+ reject(new Error(event.message));
122
+ };
123
+ const onMessage = (event) => {
124
+ const type = parseTranscribeResponseType(event.data);
125
+ if (type == null)
126
+ return;
127
+ if (type === Corti.TranscribeConfigStatusMessageType.ConfigAccepted) {
128
+ cleanup();
129
+ resolve();
130
+ }
131
+ else if (TRANSCRIBE_CONFIG_REJECTION_TYPES.includes(type)) {
132
+ cleanup();
133
+ reject(new Error(type));
134
+ }
135
+ else if (type === "ended") {
136
+ cleanup();
137
+ reject(new Error("Connection ended before config was accepted"));
138
+ }
139
+ };
140
+ socket.socket.addEventListener("message", onMessage);
141
+ socket.socket.addEventListener("error", onError);
142
+ });
143
+ }
144
+ }
@@ -0,0 +1,7 @@
1
+ import { TranscribeSocket } from "../../api/resources/transcribe/client/Socket.mjs";
2
+ export declare class CustomTranscribeSocket extends TranscribeSocket {
3
+ /** Remove the handler for an event. If callback is supplied, only removes if it matches. */
4
+ off<T extends keyof TranscribeSocket.EventHandlers>(event: T, callback?: TranscribeSocket.EventHandlers[T]): void;
5
+ /** Send raw data directly on the underlying WebSocket (e.g. binary audio, custom frames). */
6
+ send(data: string | ArrayBufferLike | Blob | ArrayBufferView): void;
7
+ }
@@ -0,0 +1,13 @@
1
+ import { TranscribeSocket } from "../../api/resources/transcribe/client/Socket.mjs";
2
+ export class CustomTranscribeSocket extends TranscribeSocket {
3
+ /** Remove the handler for an event. If callback is supplied, only removes if it matches. */
4
+ off(event, callback) {
5
+ if (callback === undefined || this.eventHandlers[event] === callback) {
6
+ this.eventHandlers[event] = undefined;
7
+ }
8
+ }
9
+ /** Send raw data directly on the underlying WebSocket (e.g. binary audio, custom frames). */
10
+ send(data) {
11
+ this.socket.send(data);
12
+ }
13
+ }
@@ -0,0 +1,2 @@
1
+ /** Parses a raw WebSocket message and returns its type string, or null on failure. */
2
+ export declare function parseTranscribeResponseType(raw: string): string | null;
@@ -0,0 +1,13 @@
1
+ import { fromJson } from "../../core/json.mjs";
2
+ import * as serializers from "../../serialization/index.mjs";
3
+ /** Parses a raw WebSocket message and returns its type string, or null on failure. */
4
+ export function parseTranscribeResponseType(raw) {
5
+ const parsed = serializers.TranscribeSocketResponse.parse(fromJson(raw), {
6
+ unrecognizedObjectKeys: "passthrough",
7
+ allowUnrecognizedUnionMembers: true,
8
+ allowUnrecognizedEnumValues: true,
9
+ skipValidation: true,
10
+ omitUndefined: true,
11
+ });
12
+ return parsed.ok ? parsed.value.type : null;
13
+ }
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Utilities to encode client headers as WebSocket subprotocols (for proxy scenarios).
3
+ * Format: [headerName1, encodeURIComponent(value1), headerName2, encodeURIComponent(value2), ...]
4
+ */
5
+ import * as core from "../../core/index.mjs";
6
+ export type HeadersRecord = Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
7
+ /**
8
+ * Resolves header values (including suppliers/functions) and returns a flat array
9
+ * of [name, encodeURIComponent(value)] for each header, skipping undefined/empty values.
10
+ * When filterSdkHeaders is true, SDK-added headers are excluded.
11
+ */
12
+ export declare function buildProtocolsFromHeaders(headers: HeadersRecord | undefined, filterSdkHeaders?: boolean): Promise<string[]>;
13
+ /** Options shape for getWsProtocols (encodeHeadersAsWsProtocols + headers). */
14
+ export type WsProtocolsOptions = {
15
+ encodeHeadersAsWsProtocols?: boolean;
16
+ headers?: HeadersRecord;
17
+ };
18
+ /** Proxy protocols as array (pass-through) or object (encoded like headers). */
19
+ export type ProxyProtocolsInput = string[] | HeadersRecord;
20
+ export type ProxyOptions = {
21
+ url: string;
22
+ /** string[] passed as-is; Record → encoded as [name, encodeURIComponent(value), ...] pairs. */
23
+ protocols?: ProxyProtocolsInput;
24
+ queryParameters?: Record<string, string>;
25
+ };
26
+ /**
27
+ * Returns WebSocket protocols array for connect (header-derived + proxy protocols).
28
+ * proxyProtocols: array is passed as-is; object is encoded like headers.
29
+ */
30
+ export declare function getWsProtocols(options: WsProtocolsOptions, proxyProtocols?: ProxyProtocolsInput): Promise<string[]>;
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Utilities to encode client headers as WebSocket subprotocols (for proxy scenarios).
3
+ * Format: [headerName1, encodeURIComponent(value1), headerName2, encodeURIComponent(value2), ...]
4
+ */
5
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
6
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
7
+ return new (P || (P = Promise))(function (resolve, reject) {
8
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
9
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
10
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
11
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
12
+ });
13
+ };
14
+ import * as core from "../../core/index.mjs";
15
+ /** Headers added by the SDK; exclude these when filterSdkHeaders is true (e.g. merged client headers). */
16
+ const SDK_HEADER_NAMES = new Set([
17
+ "Tenant-Name",
18
+ "X-Fern-Language",
19
+ "X-Fern-SDK-Name",
20
+ "X-Fern-SDK-Version",
21
+ "User-Agent",
22
+ "X-Fern-Runtime",
23
+ "X-Fern-Runtime-Version",
24
+ ]);
25
+ /**
26
+ * Resolves header values (including suppliers/functions) and returns a flat array
27
+ * of [name, encodeURIComponent(value)] for each header, skipping undefined/empty values.
28
+ * When filterSdkHeaders is true, SDK-added headers are excluded.
29
+ */
30
+ export function buildProtocolsFromHeaders(headers_1) {
31
+ return __awaiter(this, arguments, void 0, function* (headers, filterSdkHeaders = false) {
32
+ if (!headers || Object.keys(headers).length === 0) {
33
+ return [];
34
+ }
35
+ const protocols = [];
36
+ for (const [name, valueOrSupplier] of Object.entries(headers)) {
37
+ if (filterSdkHeaders && SDK_HEADER_NAMES.has(name)) {
38
+ continue;
39
+ }
40
+ const value = yield core.Supplier.get(valueOrSupplier);
41
+ if (value != null && value !== "") {
42
+ protocols.push(name, encodeURIComponent(value));
43
+ }
44
+ }
45
+ return protocols;
46
+ });
47
+ }
48
+ /**
49
+ * Returns WebSocket protocols array for connect (header-derived + proxy protocols).
50
+ * proxyProtocols: array is passed as-is; object is encoded like headers.
51
+ */
52
+ export function getWsProtocols(options, proxyProtocols) {
53
+ return __awaiter(this, void 0, void 0, function* () {
54
+ const headerProtocols = options.encodeHeadersAsWsProtocols && options.headers
55
+ ? yield buildProtocolsFromHeaders(options.headers, true)
56
+ : [];
57
+ const resolvedProxy = proxyProtocols == null
58
+ ? []
59
+ : Array.isArray(proxyProtocols)
60
+ ? proxyProtocols
61
+ : yield buildProtocolsFromHeaders(proxyProtocols, false);
62
+ const combined = [...headerProtocols, ...resolvedProxy];
63
+ return combined.length > 0 ? combined : [];
64
+ });
65
+ }
@@ -0,0 +1,3 @@
1
+ export { decodeToken, type DecodedToken } from "./decodeToken.mjs";
2
+ export { generateCodeChallenge, generateCodeVerifier } from "./pkceHelpers.mjs";
3
+ export { getEnvironment } from "./environment.mjs";
@@ -0,0 +1,3 @@
1
+ export { decodeToken } from "./decodeToken.mjs";
2
+ export { generateCodeChallenge, generateCodeVerifier } from "./pkceHelpers.mjs";
3
+ export { getEnvironment } from "./environment.mjs";
@@ -1,9 +1,9 @@
1
- import { CortiError } from "../../errors/index.mjs";
1
+ import { CortiSDKError, CortiSDKErrorCodes } from "../CortiSDKError.mjs";
2
2
  export const CODE_VERIFIER_KEY = "corti_pkce_code_verifier";
3
3
  export const requireLocalStorage = () => {
4
4
  if (typeof window === "undefined" || !window.localStorage) {
5
- throw new CortiError({
6
- message: "LocalStorage operation failed: storage is not available in this environment.",
5
+ throw new CortiSDKError("LocalStorage operation failed: storage is not available in this environment.", {
6
+ code: CortiSDKErrorCodes.LOCAL_STORAGE_ERROR,
7
7
  });
8
8
  }
9
9
  return window.localStorage;
@@ -13,9 +13,10 @@ export const setLocalStorageItem = (key, value) => {
13
13
  try {
14
14
  storage.setItem(key, value);
15
15
  }
16
- catch (_error) {
17
- throw new CortiError({
18
- message: "LocalStorage set operation failed.",
16
+ catch (error) {
17
+ throw new CortiSDKError("LocalStorage set operation failed.", {
18
+ code: CortiSDKErrorCodes.LOCAL_STORAGE_ERROR,
19
+ cause: error,
19
20
  });
20
21
  }
21
22
  };
@@ -24,9 +25,10 @@ export const getLocalStorageItem = (key) => {
24
25
  try {
25
26
  return storage.getItem(key);
26
27
  }
27
- catch (_error) {
28
- throw new CortiError({
29
- message: "LocalStorage get operation failed.",
28
+ catch (error) {
29
+ throw new CortiSDKError("LocalStorage get operation failed.", {
30
+ code: CortiSDKErrorCodes.LOCAL_STORAGE_ERROR,
31
+ cause: error,
30
32
  });
31
33
  }
32
34
  };
@@ -0,0 +1,2 @@
1
+ export declare function getDefaultWithCredentials(): boolean | undefined;
2
+ export declare function setDefaultWithCredentials(value: boolean | undefined): void;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Global default for fetcher withCredentials. Set by CortiClient when withCredentials
3
+ * is passed in options; the core fetcher reads this when args.withCredentials is undefined.
4
+ */
5
+ let defaultWithCredentials = undefined;
6
+ export function getDefaultWithCredentials() {
7
+ return defaultWithCredentials;
8
+ }
9
+ export function setDefaultWithCredentials(value) {
10
+ defaultWithCredentials = value;
11
+ }
@@ -1,16 +1 @@
1
- export * as Corti from "./api/index.mjs";
2
- export type { BaseClientOptions, BaseRequestOptions } from "./BaseClient.mjs";
3
- /** Patch: Export custom auth client (real token endpoint, optional ctor auth). */
4
- export { CortiAuth } from "./custom/CortiAuth.mjs";
5
- /** Patch: Export custom client (auth object, auth getter returns CortiAuth). */
6
- export { CortiClient } from "./custom/CortiClient.mjs";
7
- /** Patch: Export token decode utility. */
8
- export { decodeToken } from "./custom/utils/decodeToken.mjs";
9
- /** Patch: Export environment utilities. */
10
- export { type CortiInternalEnvironment, type Environment, getEnvironment } from "./custom/utils/environment.mjs";
11
- /** Patch: Export PKCE helpers for browser-side code verifier/challenge generation. */
12
- export { generateCodeChallenge, generateCodeVerifier } from "./custom/utils/pkceHelpers.mjs";
13
- export { CortiEnvironment, type CortiEnvironmentUrls } from "./environments.mjs";
14
- export { CortiError, CortiTimeoutError } from "./errors/index.mjs";
15
- export * from "./exports.mjs";
16
- export * as serialization from "./serialization/index.mjs";
1
+ export * from "./custom/overrides/index.mjs";
@@ -1,15 +1 @@
1
- export * as Corti from "./api/index.mjs";
2
- /** Patch: Export custom auth client (real token endpoint, optional ctor auth). */
3
- export { CortiAuth } from "./custom/CortiAuth.mjs";
4
- /** Patch: Export custom client (auth object, auth getter returns CortiAuth). */
5
- export { CortiClient } from "./custom/CortiClient.mjs";
6
- /** Patch: Export token decode utility. */
7
- export { decodeToken } from "./custom/utils/decodeToken.mjs";
8
- /** Patch: Export environment utilities. */
9
- export { getEnvironment } from "./custom/utils/environment.mjs";
10
- /** Patch: Export PKCE helpers for browser-side code verifier/challenge generation. */
11
- export { generateCodeChallenge, generateCodeVerifier } from "./custom/utils/pkceHelpers.mjs";
12
- export { CortiEnvironment } from "./environments.mjs";
13
- export { CortiError, CortiTimeoutError } from "./errors/index.mjs";
14
- export * from "./exports.mjs";
15
- export * as serialization from "./serialization/index.mjs";
1
+ export * from "./custom/overrides/index.mjs";
@@ -1,6 +1,7 @@
1
1
  import type * as Corti from "../../../../../api/index.mjs";
2
2
  import * as core from "../../../../../core/index.mjs";
3
3
  import type * as serializers from "../../../../index.mjs";
4
+ import { CodesFilter } from "../../../../types/CodesFilter.mjs";
4
5
  import { CommonAiContext } from "../../../../types/CommonAiContext.mjs";
5
6
  import { CommonCodingSystemEnum } from "../../../../types/CommonCodingSystemEnum.mjs";
6
7
  export declare const CodesGeneralPredictRequest: core.serialization.Schema<serializers.CodesGeneralPredictRequest.Raw, Corti.CodesGeneralPredictRequest>;
@@ -8,6 +9,6 @@ export declare namespace CodesGeneralPredictRequest {
8
9
  interface Raw {
9
10
  system: CommonCodingSystemEnum.Raw[];
10
11
  context: CommonAiContext.Raw[];
11
- maxCandidates?: number | null;
12
+ filter?: CodesFilter.Raw | null;
12
13
  }
13
14
  }
@@ -1,9 +1,10 @@
1
1
  // This file was auto-generated by Fern from our API Definition.
2
2
  import * as core from "../../../../../core/index.mjs";
3
+ import { CodesFilter } from "../../../../types/CodesFilter.mjs";
3
4
  import { CommonAiContext } from "../../../../types/CommonAiContext.mjs";
4
5
  import { CommonCodingSystemEnum } from "../../../../types/CommonCodingSystemEnum.mjs";
5
6
  export const CodesGeneralPredictRequest = core.serialization.object({
6
7
  system: core.serialization.list(CommonCodingSystemEnum),
7
8
  context: core.serialization.list(CommonAiContext),
8
- maxCandidates: core.serialization.number().optional(),
9
+ filter: CodesFilter.optional(),
9
10
  });
@@ -8,7 +8,7 @@ import { StreamFactsMessage } from "../../../../types/StreamFactsMessage.mjs";
8
8
  import { StreamFlushedMessage } from "../../../../types/StreamFlushedMessage.mjs";
9
9
  import { StreamTranscriptMessage } from "../../../../types/StreamTranscriptMessage.mjs";
10
10
  import { StreamUsageMessage } from "../../../../types/StreamUsageMessage.mjs";
11
- export declare const StreamSocketResponse: core.serialization.Schema<serializers.StreamSocketResponse.Raw, Corti.StreamConfigStatusMessage | Corti.StreamTranscriptMessage | Corti.StreamFactsMessage | Corti.StreamFlushedMessage | Corti.StreamEndedMessage | Corti.StreamUsageMessage | Corti.StreamErrorMessage>;
11
+ export declare const StreamSocketResponse: core.serialization.Schema<serializers.StreamSocketResponse.Raw, Corti.StreamTranscriptMessage | Corti.StreamFactsMessage | Corti.StreamFlushedMessage | Corti.StreamEndedMessage | Corti.StreamUsageMessage | Corti.StreamErrorMessage | Corti.StreamConfigStatusMessage>;
12
12
  export declare namespace StreamSocketResponse {
13
- type Raw = StreamConfigStatusMessage.Raw | StreamTranscriptMessage.Raw | StreamFactsMessage.Raw | StreamFlushedMessage.Raw | StreamEndedMessage.Raw | StreamUsageMessage.Raw | StreamErrorMessage.Raw;
13
+ type Raw = StreamTranscriptMessage.Raw | StreamFactsMessage.Raw | StreamFlushedMessage.Raw | StreamEndedMessage.Raw | StreamUsageMessage.Raw | StreamErrorMessage.Raw | StreamConfigStatusMessage.Raw;
14
14
  }
@@ -8,11 +8,11 @@ import { StreamFlushedMessage } from "../../../../types/StreamFlushedMessage.mjs
8
8
  import { StreamTranscriptMessage } from "../../../../types/StreamTranscriptMessage.mjs";
9
9
  import { StreamUsageMessage } from "../../../../types/StreamUsageMessage.mjs";
10
10
  export const StreamSocketResponse = core.serialization.undiscriminatedUnion([
11
- StreamConfigStatusMessage,
12
11
  StreamTranscriptMessage,
13
12
  StreamFactsMessage,
14
13
  StreamFlushedMessage,
15
14
  StreamEndedMessage,
16
15
  StreamUsageMessage,
17
16
  StreamErrorMessage,
17
+ StreamConfigStatusMessage,
18
18
  ]);
@@ -8,7 +8,7 @@ import { TranscribeErrorMessage } from "../../../../types/TranscribeErrorMessage
8
8
  import { TranscribeFlushedMessage } from "../../../../types/TranscribeFlushedMessage.mjs";
9
9
  import { TranscribeTranscriptMessage } from "../../../../types/TranscribeTranscriptMessage.mjs";
10
10
  import { TranscribeUsageMessage } from "../../../../types/TranscribeUsageMessage.mjs";
11
- export declare const TranscribeSocketResponse: core.serialization.Schema<serializers.TranscribeSocketResponse.Raw, Corti.TranscribeConfigStatusMessage | Corti.TranscribeUsageMessage | Corti.TranscribeFlushedMessage | Corti.TranscribeEndedMessage | Corti.TranscribeErrorMessage | Corti.TranscribeTranscriptMessage | Corti.TranscribeCommandMessage>;
11
+ export declare const TranscribeSocketResponse: core.serialization.Schema<serializers.TranscribeSocketResponse.Raw, Corti.TranscribeUsageMessage | Corti.TranscribeFlushedMessage | Corti.TranscribeEndedMessage | Corti.TranscribeErrorMessage | Corti.TranscribeTranscriptMessage | Corti.TranscribeCommandMessage | Corti.TranscribeConfigStatusMessage>;
12
12
  export declare namespace TranscribeSocketResponse {
13
- type Raw = TranscribeConfigStatusMessage.Raw | TranscribeUsageMessage.Raw | TranscribeFlushedMessage.Raw | TranscribeEndedMessage.Raw | TranscribeErrorMessage.Raw | TranscribeTranscriptMessage.Raw | TranscribeCommandMessage.Raw;
13
+ type Raw = TranscribeUsageMessage.Raw | TranscribeFlushedMessage.Raw | TranscribeEndedMessage.Raw | TranscribeErrorMessage.Raw | TranscribeTranscriptMessage.Raw | TranscribeCommandMessage.Raw | TranscribeConfigStatusMessage.Raw;
14
14
  }
@@ -8,11 +8,11 @@ import { TranscribeFlushedMessage } from "../../../../types/TranscribeFlushedMes
8
8
  import { TranscribeTranscriptMessage } from "../../../../types/TranscribeTranscriptMessage.mjs";
9
9
  import { TranscribeUsageMessage } from "../../../../types/TranscribeUsageMessage.mjs";
10
10
  export const TranscribeSocketResponse = core.serialization.undiscriminatedUnion([
11
- TranscribeConfigStatusMessage,
12
11
  TranscribeUsageMessage,
13
12
  TranscribeFlushedMessage,
14
13
  TranscribeEndedMessage,
15
14
  TranscribeErrorMessage,
16
15
  TranscribeTranscriptMessage,
17
16
  TranscribeCommandMessage,
17
+ TranscribeConfigStatusMessage,
18
18
  ]);
@@ -0,0 +1,13 @@
1
+ import type * as Corti from "../../api/index.mjs";
2
+ import * as core from "../../core/index.mjs";
3
+ import * as serializers from "../index.mjs";
4
+ export declare const AgentsErrorResponse: core.serialization.ObjectSchema<serializers.AgentsErrorResponse.Raw, Corti.AgentsErrorResponse>;
5
+ export declare namespace AgentsErrorResponse {
6
+ interface Raw {
7
+ code: string;
8
+ description: string;
9
+ howToFix?: string | null;
10
+ details?: Record<string, unknown> | null;
11
+ cause?: serializers.AgentsErrorResponse.Raw | null;
12
+ }
13
+ }
@@ -0,0 +1,10 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ import * as core from "../../core/index.mjs";
3
+ import * as serializers from "../index.mjs";
4
+ export const AgentsErrorResponse = core.serialization.object({
5
+ code: core.serialization.string(),
6
+ description: core.serialization.string(),
7
+ howToFix: core.serialization.string().optional(),
8
+ details: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(),
9
+ cause: core.serialization.lazyObject(() => serializers.AgentsErrorResponse).optional(),
10
+ });
@@ -0,0 +1,14 @@
1
+ import type * as Corti from "../../api/index.mjs";
2
+ import * as core from "../../core/index.mjs";
3
+ import type * as serializers from "../index.mjs";
4
+ import { AgentsValidationErrorErrorsItem } from "./AgentsValidationErrorErrorsItem.mjs";
5
+ export declare const AgentsValidationError: core.serialization.ObjectSchema<serializers.AgentsValidationError.Raw, Corti.AgentsValidationError>;
6
+ export declare namespace AgentsValidationError {
7
+ interface Raw {
8
+ msg: string;
9
+ type: string;
10
+ reason: string;
11
+ howToFix: string;
12
+ errors?: AgentsValidationErrorErrorsItem.Raw[] | null;
13
+ }
14
+ }
@@ -0,0 +1,10 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ import * as core from "../../core/index.mjs";
3
+ import { AgentsValidationErrorErrorsItem } from "./AgentsValidationErrorErrorsItem.mjs";
4
+ export const AgentsValidationError = core.serialization.object({
5
+ msg: core.serialization.string(),
6
+ type: core.serialization.string(),
7
+ reason: core.serialization.string(),
8
+ howToFix: core.serialization.string(),
9
+ errors: core.serialization.list(AgentsValidationErrorErrorsItem).optional(),
10
+ });
@@ -0,0 +1,10 @@
1
+ import type * as Corti from "../../api/index.mjs";
2
+ import * as core from "../../core/index.mjs";
3
+ import type * as serializers from "../index.mjs";
4
+ export declare const AgentsValidationErrorErrorsItem: core.serialization.ObjectSchema<serializers.AgentsValidationErrorErrorsItem.Raw, Corti.AgentsValidationErrorErrorsItem>;
5
+ export declare namespace AgentsValidationErrorErrorsItem {
6
+ interface Raw {
7
+ location?: string | null;
8
+ reason?: string | null;
9
+ }
10
+ }
@@ -0,0 +1,6 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ import * as core from "../../core/index.mjs";
3
+ export const AgentsValidationErrorErrorsItem = core.serialization.object({
4
+ location: core.serialization.string().optional(),
5
+ reason: core.serialization.string().optional(),
6
+ });
@@ -0,0 +1,10 @@
1
+ import type * as Corti from "../../api/index.mjs";
2
+ import * as core from "../../core/index.mjs";
3
+ import * as serializers from "../index.mjs";
4
+ import { AgentsValidationError } from "./AgentsValidationError.mjs";
5
+ export declare const AgentsValidationErrorResponse: core.serialization.ObjectSchema<serializers.AgentsValidationErrorResponse.Raw, Corti.AgentsValidationErrorResponse>;
6
+ export declare namespace AgentsValidationErrorResponse {
7
+ interface Raw extends serializers.AgentsErrorResponse.Raw {
8
+ detail?: AgentsValidationError.Raw[] | null;
9
+ }
10
+ }
@@ -0,0 +1,9 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ import * as core from "../../core/index.mjs";
3
+ import * as serializers from "../index.mjs";
4
+ import { AgentsValidationError } from "./AgentsValidationError.mjs";
5
+ export const AgentsValidationErrorResponse = core.serialization
6
+ .object({
7
+ detail: core.serialization.list(AgentsValidationError).optional(),
8
+ })
9
+ .extend(core.serialization.lazyObject(() => serializers.AgentsErrorResponse));
@@ -0,0 +1,11 @@
1
+ import type * as Corti from "../../api/index.mjs";
2
+ import * as core from "../../core/index.mjs";
3
+ import type * as serializers from "../index.mjs";
4
+ export declare const CodesFilter: core.serialization.ObjectSchema<serializers.CodesFilter.Raw, Corti.CodesFilter>;
5
+ export declare namespace CodesFilter {
6
+ interface Raw {
7
+ include?: string[] | null;
8
+ exclude?: string[] | null;
9
+ expand?: boolean | null;
10
+ }
11
+ }
@@ -0,0 +1,7 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ import * as core from "../../core/index.mjs";
3
+ export const CodesFilter = core.serialization.object({
4
+ include: core.serialization.list(core.serialization.string()).optional(),
5
+ exclude: core.serialization.list(core.serialization.string()).optional(),
6
+ expand: core.serialization.boolean().optional(),
7
+ });
@@ -1,6 +1,7 @@
1
1
  import type * as Corti from "../../api/index.mjs";
2
2
  import * as core from "../../core/index.mjs";
3
3
  import type * as serializers from "../index.mjs";
4
+ import { CodesGeneralReadResponseAlternativesItem } from "./CodesGeneralReadResponseAlternativesItem.mjs";
4
5
  import { CodesGeneralReadResponseEvidencesItem } from "./CodesGeneralReadResponseEvidencesItem.mjs";
5
6
  import { CommonCodingSystemEnum } from "./CommonCodingSystemEnum.mjs";
6
7
  export declare const CodesGeneralReadResponse: core.serialization.ObjectSchema<serializers.CodesGeneralReadResponse.Raw, Corti.CodesGeneralReadResponse>;
@@ -10,5 +11,6 @@ export declare namespace CodesGeneralReadResponse {
10
11
  code: string;
11
12
  display: string;
12
13
  evidences?: CodesGeneralReadResponseEvidencesItem.Raw[] | null;
14
+ alternatives?: CodesGeneralReadResponseAlternativesItem.Raw[] | null;
13
15
  }
14
16
  }
@@ -1,5 +1,6 @@
1
1
  // This file was auto-generated by Fern from our API Definition.
2
2
  import * as core from "../../core/index.mjs";
3
+ import { CodesGeneralReadResponseAlternativesItem } from "./CodesGeneralReadResponseAlternativesItem.mjs";
3
4
  import { CodesGeneralReadResponseEvidencesItem } from "./CodesGeneralReadResponseEvidencesItem.mjs";
4
5
  import { CommonCodingSystemEnum } from "./CommonCodingSystemEnum.mjs";
5
6
  export const CodesGeneralReadResponse = core.serialization.object({
@@ -7,4 +8,5 @@ export const CodesGeneralReadResponse = core.serialization.object({
7
8
  code: core.serialization.string(),
8
9
  display: core.serialization.string(),
9
10
  evidences: core.serialization.list(CodesGeneralReadResponseEvidencesItem).optional(),
11
+ alternatives: core.serialization.list(CodesGeneralReadResponseAlternativesItem).optional(),
10
12
  });
@@ -0,0 +1,10 @@
1
+ import type * as Corti from "../../api/index.mjs";
2
+ import * as core from "../../core/index.mjs";
3
+ import type * as serializers from "../index.mjs";
4
+ export declare const CodesGeneralReadResponseAlternativesItem: core.serialization.ObjectSchema<serializers.CodesGeneralReadResponseAlternativesItem.Raw, Corti.CodesGeneralReadResponseAlternativesItem>;
5
+ export declare namespace CodesGeneralReadResponseAlternativesItem {
6
+ interface Raw {
7
+ code: string;
8
+ display: string;
9
+ }
10
+ }