@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
@@ -1,5 +1,4 @@
1
1
  "use strict";
2
- // This file was auto-generated by Fern from our API Definition.
3
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
3
  if (k2 === undefined) k2 = k;
5
4
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -11,280 +10,9 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
11
10
  if (k2 === undefined) k2 = k;
12
11
  o[k2] = m[k];
13
12
  }));
14
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
- Object.defineProperty(o, "default", { enumerable: true, value: v });
16
- }) : function(o, v) {
17
- o["default"] = v;
18
- });
19
- var __importStar = (this && this.__importStar) || (function () {
20
- var ownKeys = function(o) {
21
- ownKeys = Object.getOwnPropertyNames || function (o) {
22
- var ar = [];
23
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
- return ar;
25
- };
26
- return ownKeys(o);
27
- };
28
- return function (mod) {
29
- if (mod && mod.__esModule) return mod;
30
- var result = {};
31
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
- __setModuleDefault(result, mod);
33
- return result;
34
- };
35
- })();
36
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
37
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
38
- return new (P || (P = Promise))(function (resolve, reject) {
39
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
40
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
41
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
42
- step((generator = generator.apply(thisArg, _arguments || [])).next());
43
- });
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
44
15
  };
45
16
  Object.defineProperty(exports, "__esModule", { value: true });
46
- exports.OAuthTokenOverrideAuthProvider = exports.OAuthAuthProvider = exports.USERNAME_REQUIRED_ERROR_MESSAGE = exports.USERNAME_PARAM = exports.REDIRECT_URI_PARAM = exports.PASSWORD_REQUIRED_ERROR_MESSAGE = exports.PASSWORD_PARAM = exports.getExpiresAt = exports.CODE_VERIFIER_PARAM = exports.CODE_PARAM = exports.CLIENT_SECRET_REQUIRED_ERROR_MESSAGE = exports.CLIENT_SECRET_PARAM = exports.CLIENT_ID_REQUIRED_ERROR_MESSAGE = exports.CLIENT_ID_PARAM = exports.BUFFER_IN_MINUTES = void 0;
47
- const core = __importStar(require("../core/index.js"));
48
- const CortiAuth_js_1 = require("../custom/CortiAuth.js");
49
- const OAuthAuthCodeAuthProvider_js_1 = require("../custom/OAuthAuthCodeAuthProvider.js");
50
- const OAuthPkceAuthProvider_js_1 = require("../custom/OAuthPkceAuthProvider.js");
51
- const OAuthRopcAuthProvider_js_1 = require("../custom/OAuthRopcAuthProvider.js");
52
- const oauthAuthHelpers_js_1 = require("../custom/utils/oauthAuthHelpers.js");
53
- const errors = __importStar(require("../errors/index.js"));
54
- /** Patch: Re-export for consumers; implementation shared with OAuthRopcAuthProvider, OAuthAuthCodeAuthProvider and OAuthPkceAuthProvider. */
55
- var oauthAuthHelpers_js_2 = require("../custom/utils/oauthAuthHelpers.js");
56
- Object.defineProperty(exports, "BUFFER_IN_MINUTES", { enumerable: true, get: function () { return oauthAuthHelpers_js_2.BUFFER_IN_MINUTES; } });
57
- Object.defineProperty(exports, "CLIENT_ID_PARAM", { enumerable: true, get: function () { return oauthAuthHelpers_js_2.CLIENT_ID_PARAM; } });
58
- Object.defineProperty(exports, "CLIENT_ID_REQUIRED_ERROR_MESSAGE", { enumerable: true, get: function () { return oauthAuthHelpers_js_2.CLIENT_ID_REQUIRED_ERROR_MESSAGE; } });
59
- Object.defineProperty(exports, "CLIENT_SECRET_PARAM", { enumerable: true, get: function () { return oauthAuthHelpers_js_2.CLIENT_SECRET_PARAM; } });
60
- Object.defineProperty(exports, "CLIENT_SECRET_REQUIRED_ERROR_MESSAGE", { enumerable: true, get: function () { return oauthAuthHelpers_js_2.CLIENT_SECRET_REQUIRED_ERROR_MESSAGE; } });
61
- Object.defineProperty(exports, "CODE_PARAM", { enumerable: true, get: function () { return oauthAuthHelpers_js_2.CODE_PARAM; } });
62
- Object.defineProperty(exports, "CODE_VERIFIER_PARAM", { enumerable: true, get: function () { return oauthAuthHelpers_js_2.CODE_VERIFIER_PARAM; } });
63
- Object.defineProperty(exports, "getExpiresAt", { enumerable: true, get: function () { return oauthAuthHelpers_js_2.getExpiresAt; } });
64
- Object.defineProperty(exports, "PASSWORD_PARAM", { enumerable: true, get: function () { return oauthAuthHelpers_js_2.PASSWORD_PARAM; } });
65
- Object.defineProperty(exports, "PASSWORD_REQUIRED_ERROR_MESSAGE", { enumerable: true, get: function () { return oauthAuthHelpers_js_2.PASSWORD_REQUIRED_ERROR_MESSAGE; } });
66
- Object.defineProperty(exports, "REDIRECT_URI_PARAM", { enumerable: true, get: function () { return oauthAuthHelpers_js_2.REDIRECT_URI_PARAM; } });
67
- Object.defineProperty(exports, "USERNAME_PARAM", { enumerable: true, get: function () { return oauthAuthHelpers_js_2.USERNAME_PARAM; } });
68
- Object.defineProperty(exports, "USERNAME_REQUIRED_ERROR_MESSAGE", { enumerable: true, get: function () { return oauthAuthHelpers_js_2.USERNAME_REQUIRED_ERROR_MESSAGE; } });
69
- const TOKEN_PARAM = "token";
70
- const TOKEN_PARAM_REQUIRED_ERROR_MESSAGE = `${TOKEN_PARAM} is required. Please provide it in options.`;
71
- class OAuthAuthProvider {
72
- constructor(options) {
73
- this.options = options;
74
- /**
75
- * Patch: Use CortiAuth (real token endpoint) instead of AuthClient (fake-token).
76
- */
77
- this.authClient = new CortiAuth_js_1.CortiAuth(options);
78
- this.expiresAt = new Date();
79
- }
80
- static canCreate(options) {
81
- return (options === null || options === void 0 ? void 0 : options[oauthAuthHelpers_js_1.CLIENT_ID_PARAM]) != null && (options === null || options === void 0 ? void 0 : options[oauthAuthHelpers_js_1.CLIENT_SECRET_PARAM]) != null;
82
- }
83
- clientIdSupplier() {
84
- return __awaiter(this, arguments, void 0, function* ({ endpointMetadata, } = {}) {
85
- const supplier = this.options[oauthAuthHelpers_js_1.CLIENT_ID_PARAM];
86
- if (supplier == null) {
87
- throw new errors.CortiError({
88
- message: oauthAuthHelpers_js_1.CLIENT_ID_REQUIRED_ERROR_MESSAGE,
89
- });
90
- }
91
- return core.EndpointSupplier.get(supplier, { endpointMetadata });
92
- });
93
- }
94
- clientSecretSupplier() {
95
- return __awaiter(this, arguments, void 0, function* ({ endpointMetadata, } = {}) {
96
- const supplier = this.options[oauthAuthHelpers_js_1.CLIENT_SECRET_PARAM];
97
- if (supplier == null) {
98
- throw new errors.CortiError({
99
- message: oauthAuthHelpers_js_1.CLIENT_SECRET_REQUIRED_ERROR_MESSAGE,
100
- });
101
- }
102
- return core.EndpointSupplier.get(supplier, { endpointMetadata });
103
- });
104
- }
105
- getAuthRequest() {
106
- return __awaiter(this, arguments, void 0, function* ({ endpointMetadata, } = {}) {
107
- const token = yield this.getToken({ endpointMetadata });
108
- return {
109
- headers: {
110
- Authorization: `Bearer ${token}`,
111
- },
112
- };
113
- });
114
- }
115
- getToken() {
116
- return __awaiter(this, arguments, void 0, function* ({ endpointMetadata } = {}) {
117
- if (this.accessToken && this.expiresAt > new Date()) {
118
- return this.accessToken;
119
- }
120
- // If a refresh is already in progress, return the existing promise
121
- if (this.refreshPromise != null) {
122
- return this.refreshPromise;
123
- }
124
- return this.refresh({ endpointMetadata });
125
- });
126
- }
127
- refresh() {
128
- return __awaiter(this, arguments, void 0, function* ({ endpointMetadata } = {}) {
129
- this.refreshPromise = (() => __awaiter(this, void 0, void 0, function* () {
130
- try {
131
- const clientId = yield this.clientIdSupplier({ endpointMetadata });
132
- const clientSecret = yield this.clientSecretSupplier({ endpointMetadata });
133
- const tokenResponse = clientId && this.storedRefreshToken && this.refreshExpiresAt && this.refreshExpiresAt > new Date()
134
- ? yield this.authClient.refreshToken({
135
- clientId,
136
- refreshToken: this.storedRefreshToken,
137
- })
138
- : yield this.authClient.getToken({ clientId, clientSecret });
139
- this.accessToken = tokenResponse.accessToken;
140
- this.expiresAt = (0, oauthAuthHelpers_js_1.getExpiresAt)(tokenResponse.expiresIn, oauthAuthHelpers_js_1.BUFFER_IN_MINUTES);
141
- if (tokenResponse.refreshToken) {
142
- this.storedRefreshToken = tokenResponse.refreshToken;
143
- this.refreshExpiresAt = tokenResponse.refreshExpiresIn
144
- ? (0, oauthAuthHelpers_js_1.getExpiresAt)(tokenResponse.refreshExpiresIn, oauthAuthHelpers_js_1.BUFFER_IN_MINUTES)
145
- : undefined;
146
- }
147
- return this.accessToken;
148
- }
149
- finally {
150
- this.refreshPromise = undefined;
151
- }
152
- }))();
153
- return this.refreshPromise;
154
- });
155
- }
156
- }
157
- exports.OAuthAuthProvider = OAuthAuthProvider;
158
- class OAuthTokenOverrideAuthProvider {
159
- constructor(options) {
160
- this._tokenSupplier = options[TOKEN_PARAM];
161
- this._clientIdSupplier = options.clientId;
162
- // Patch: store custom refresh callback
163
- this._refreshAccessToken = options.refreshAccessToken;
164
- this.expiresAt = options.expiresIn ? (0, oauthAuthHelpers_js_1.getExpiresAt)(options.expiresIn, oauthAuthHelpers_js_1.BUFFER_IN_MINUTES) : undefined;
165
- this.storedRefreshToken = options.refreshToken;
166
- this.refreshExpiresAt = options.refreshExpiresIn
167
- ? (0, oauthAuthHelpers_js_1.getExpiresAt)(options.refreshExpiresIn, oauthAuthHelpers_js_1.BUFFER_IN_MINUTES)
168
- : undefined;
169
- if (options.clientId && options.refreshToken) {
170
- this.authClient = new CortiAuth_js_1.CortiAuth(options);
171
- }
172
- // Patch: pre-seed token from discovery promise so getAuthRequest doesn't call refreshAccessToken again
173
- if (options.initialTokenResponse) {
174
- this._seedPromise = options.initialTokenResponse
175
- .then((resp) => {
176
- this.accessToken = resp.accessToken;
177
- this.expiresAt = resp.expiresIn ? (0, oauthAuthHelpers_js_1.getExpiresAt)(resp.expiresIn, oauthAuthHelpers_js_1.BUFFER_IN_MINUTES) : undefined;
178
- if (resp.refreshToken) {
179
- this.storedRefreshToken = resp.refreshToken;
180
- this.refreshExpiresAt = resp.refreshExpiresIn
181
- ? (0, oauthAuthHelpers_js_1.getExpiresAt)(resp.refreshExpiresIn, oauthAuthHelpers_js_1.BUFFER_IN_MINUTES)
182
- : undefined;
183
- }
184
- })
185
- .finally(() => {
186
- this._seedPromise = undefined;
187
- });
188
- }
189
- }
190
- static canCreate(options) {
191
- // Patch: either token or refreshAccessToken is sufficient
192
- return (options === null || options === void 0 ? void 0 : options[TOKEN_PARAM]) != null || (options === null || options === void 0 ? void 0 : options.refreshAccessToken) != null;
193
- }
194
- getAuthRequest() {
195
- return __awaiter(this, arguments, void 0, function* ({ endpointMetadata, } = {}) {
196
- // Patch: await seed promise so the initial token from resolveClientOptions is set before checking expiry
197
- if (this._seedPromise) {
198
- yield this._seedPromise;
199
- }
200
- const isExpiredOrAbsent = !this.accessToken || (this.expiresAt != null && this.expiresAt <= new Date());
201
- // Patch: custom refreshAccessToken takes priority — call it when token is absent or expired
202
- if (this._refreshAccessToken && isExpiredOrAbsent) {
203
- const result = yield this._refreshAccessToken(this.storedRefreshToken);
204
- this.accessToken = result.accessToken;
205
- this.expiresAt = result.expiresIn ? (0, oauthAuthHelpers_js_1.getExpiresAt)(result.expiresIn, oauthAuthHelpers_js_1.BUFFER_IN_MINUTES) : undefined;
206
- if (result.refreshToken) {
207
- this.storedRefreshToken = result.refreshToken;
208
- this.refreshExpiresAt = result.refreshExpiresIn
209
- ? (0, oauthAuthHelpers_js_1.getExpiresAt)(result.refreshExpiresIn, oauthAuthHelpers_js_1.BUFFER_IN_MINUTES)
210
- : undefined;
211
- }
212
- return { headers: { Authorization: `Bearer ${this.accessToken}` } };
213
- }
214
- // Built-in: if access token is expired and we have a valid SDK refresh token, use it
215
- if (this.expiresAt != null &&
216
- this.expiresAt <= new Date() &&
217
- this._clientIdSupplier &&
218
- this.storedRefreshToken &&
219
- this.refreshExpiresAt &&
220
- this.refreshExpiresAt > new Date() &&
221
- this.authClient) {
222
- const clientId = yield core.EndpointSupplier.get(this._clientIdSupplier, { endpointMetadata });
223
- const tokenResponse = yield this.authClient.refreshToken({
224
- clientId,
225
- refreshToken: this.storedRefreshToken,
226
- });
227
- this.accessToken = tokenResponse.accessToken;
228
- this.expiresAt = (0, oauthAuthHelpers_js_1.getExpiresAt)(tokenResponse.expiresIn, oauthAuthHelpers_js_1.BUFFER_IN_MINUTES);
229
- if (tokenResponse.refreshToken) {
230
- this.storedRefreshToken = tokenResponse.refreshToken;
231
- this.refreshExpiresAt = tokenResponse.refreshExpiresIn
232
- ? (0, oauthAuthHelpers_js_1.getExpiresAt)(tokenResponse.refreshExpiresIn, oauthAuthHelpers_js_1.BUFFER_IN_MINUTES)
233
- : undefined;
234
- }
235
- return { headers: { Authorization: `Bearer ${this.accessToken}` } };
236
- }
237
- // Token not yet acquired — resolve from supplier (static token / initial value)
238
- if (!this.accessToken) {
239
- if (this._tokenSupplier == null) {
240
- throw new errors.CortiError({ message: TOKEN_PARAM_REQUIRED_ERROR_MESSAGE });
241
- }
242
- this.accessToken = yield core.EndpointSupplier.get(this._tokenSupplier, { endpointMetadata });
243
- }
244
- if (!this.accessToken) {
245
- throw new errors.CortiError({ message: TOKEN_PARAM_REQUIRED_ERROR_MESSAGE });
246
- }
247
- return { headers: { Authorization: `Bearer ${this.accessToken}` } };
248
- });
249
- }
250
- }
251
- exports.OAuthTokenOverrideAuthProvider = OAuthTokenOverrideAuthProvider;
252
- (function (OAuthAuthProvider) {
253
- OAuthAuthProvider.AUTH_SCHEME = "OAuth";
254
- /** Patch: Message extended to mention ROPC (clientId, username, password). */
255
- OAuthAuthProvider.AUTH_CONFIG_ERROR_MESSAGE = `Insufficient options to create OAuthAuthProvider. Please provide '${oauthAuthHelpers_js_1.CLIENT_ID_PARAM}' and '${oauthAuthHelpers_js_1.CLIENT_SECRET_PARAM}', or ${TOKEN_PARAM}, or ROPC (${oauthAuthHelpers_js_1.CLIENT_ID_PARAM}, username, password).`;
256
- function createInstance(options) {
257
- if (OAuthTokenOverrideAuthProvider.canCreate(options)) {
258
- return new OAuthTokenOverrideAuthProvider(options);
259
- }
260
- /** Patch: ROPC provider before client credentials so ROPC auth is used when username+password provided. */
261
- if (OAuthRopcAuthProvider_js_1.OAuthRopcAuthProvider.canCreate(options)) {
262
- return new OAuthRopcAuthProvider_js_1.OAuthRopcAuthProvider(options);
263
- }
264
- /** Patch: PKCE provider before auth code — both have clientId+code+redirectUri, but PKCE has no clientSecret. */
265
- if (OAuthPkceAuthProvider_js_1.OAuthPkceAuthProvider.canCreate(options)) {
266
- return new OAuthPkceAuthProvider_js_1.OAuthPkceAuthProvider(options);
267
- }
268
- /** Patch: Auth code provider before client credentials — both have clientId+clientSecret, code+redirectUri distinguishes auth code. */
269
- if (OAuthAuthCodeAuthProvider_js_1.OAuthAuthCodeAuthProvider.canCreate(options)) {
270
- return new OAuthAuthCodeAuthProvider_js_1.OAuthAuthCodeAuthProvider(options);
271
- }
272
- if (OAuthAuthProvider.canCreate(options)) {
273
- return new OAuthAuthProvider(options);
274
- }
275
- /** Patch: No credentials provided — proxy/passthrough mode; requests are sent without an Authorization header. */
276
- const partialOptions = options;
277
- const hasNoCredentials = partialOptions[oauthAuthHelpers_js_1.CLIENT_ID_PARAM] == null &&
278
- partialOptions[oauthAuthHelpers_js_1.CLIENT_SECRET_PARAM] == null &&
279
- partialOptions[TOKEN_PARAM] == null &&
280
- partialOptions.refreshAccessToken == null &&
281
- partialOptions[oauthAuthHelpers_js_1.USERNAME_PARAM] == null;
282
- if (hasNoCredentials) {
283
- return new core.NoOpAuthProvider();
284
- }
285
- throw new errors.CortiError({
286
- message: OAuthAuthProvider.AUTH_CONFIG_ERROR_MESSAGE,
287
- });
288
- }
289
- OAuthAuthProvider.createInstance = createInstance;
290
- })(OAuthAuthProvider || (exports.OAuthAuthProvider = OAuthAuthProvider = {}));
17
+ // Custom implementation lives in src/custom/overrides/OAuthAuthProvider.ts
18
+ __exportStar(require("../custom/overrides/OAuthAuthProvider.js"), exports);
@@ -1,11 +1,2 @@
1
- export type { APIResponse } from "./APIResponse.js";
2
- export type { BinaryResponse } from "./BinaryResponse.js";
3
- export type { EndpointMetadata } from "./EndpointMetadata.js";
4
- export { EndpointSupplier } from "./EndpointSupplier.js";
5
- export type { Fetcher, FetchFunction } from "./Fetcher.js";
6
- export { fetcher } from "./Fetcher.js";
7
- export { getHeader } from "./getHeader.js";
8
- export { HttpResponsePromise } from "./HttpResponsePromise.js";
9
- export type { RawResponse, WithRawResponse } from "./RawResponse.js";
10
- export { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.js";
11
- export { Supplier } from "./Supplier.js";
1
+ /** Patch: withCredentials - re-export from custom barrel; fetcher uses global withCredentials default */
2
+ export * from "../../custom/overrides/fetcher/index.js";
@@ -1,17 +1,18 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
2
16
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Supplier = exports.unknownRawResponse = exports.toRawResponse = exports.abortRawResponse = exports.HttpResponsePromise = exports.getHeader = exports.fetcher = exports.EndpointSupplier = void 0;
4
- var EndpointSupplier_js_1 = require("./EndpointSupplier.js");
5
- Object.defineProperty(exports, "EndpointSupplier", { enumerable: true, get: function () { return EndpointSupplier_js_1.EndpointSupplier; } });
6
- var Fetcher_js_1 = require("./Fetcher.js");
7
- Object.defineProperty(exports, "fetcher", { enumerable: true, get: function () { return Fetcher_js_1.fetcher; } });
8
- var getHeader_js_1 = require("./getHeader.js");
9
- Object.defineProperty(exports, "getHeader", { enumerable: true, get: function () { return getHeader_js_1.getHeader; } });
10
- var HttpResponsePromise_js_1 = require("./HttpResponsePromise.js");
11
- Object.defineProperty(exports, "HttpResponsePromise", { enumerable: true, get: function () { return HttpResponsePromise_js_1.HttpResponsePromise; } });
12
- var RawResponse_js_1 = require("./RawResponse.js");
13
- Object.defineProperty(exports, "abortRawResponse", { enumerable: true, get: function () { return RawResponse_js_1.abortRawResponse; } });
14
- Object.defineProperty(exports, "toRawResponse", { enumerable: true, get: function () { return RawResponse_js_1.toRawResponse; } });
15
- Object.defineProperty(exports, "unknownRawResponse", { enumerable: true, get: function () { return RawResponse_js_1.unknownRawResponse; } });
16
- var Supplier_js_1 = require("./Supplier.js");
17
- Object.defineProperty(exports, "Supplier", { enumerable: true, get: function () { return Supplier_js_1.Supplier; } });
17
+ /** Patch: withCredentials - re-export from custom barrel; fetcher uses global withCredentials default */
18
+ __exportStar(require("../../custom/overrides/fetcher/index.js"), exports);
@@ -1,9 +1,9 @@
1
1
  import type { OAuthAuthProvider } from "../auth/OAuthAuthProvider.js";
2
2
  import { CortiClient as BaseCortiClient } from "../Client.js";
3
3
  import type * as environments from "../environments.js";
4
- import { CortiAuth } from "./CortiAuth.js";
5
- import { CustomStream } from "./CustomStream.js";
6
- import { CustomTranscribe } from "./CustomTranscribe.js";
4
+ import { CortiAuth } from "./auth/CortiAuth.js";
5
+ import { CustomStream } from "./stream/CustomStream.js";
6
+ import { CustomTranscribe } from "./transcribe/CustomTranscribe.js";
7
7
  import { type Environment } from "./utils/environment.js";
8
8
  type TokenDerivableAuth = {
9
9
  accessToken: string;
@@ -20,7 +20,15 @@ type TokenDerivableAuth = {
20
20
  refreshExpiresIn?: number;
21
21
  clientId?: string;
22
22
  };
23
- type OptionsBase = Omit<BaseCortiClient.Options, "clientId" | "clientSecret" | "token" | "environment" | "tenantName" | "baseUrl">;
23
+ type OptionsBase = Omit<BaseCortiClient.Options, "clientId" | "clientSecret" | "token" | "environment" | "tenantName" | "baseUrl"> & {
24
+ withCredentials?: boolean;
25
+ /**
26
+ * When true, encodes the client's auth headers as WebSocket subprotocol pairs instead of
27
+ * HTTP headers on every WebSocket connection. Useful when connecting through a gateway
28
+ * that strips HTTP headers but passes WS protocols through.
29
+ */
30
+ encodeHeadersAsWsProtocols?: boolean;
31
+ };
24
32
  export declare namespace CortiClient {
25
33
  type Auth = {
26
34
  clientId: string;
@@ -94,6 +102,9 @@ export declare namespace CortiClient {
94
102
  }
95
103
  export declare class CortiClient extends BaseCortiClient {
96
104
  protected _auth: CortiAuth | undefined;
105
+ protected _stream: CustomStream | undefined;
106
+ protected _transcribe: CustomTranscribe | undefined;
107
+ private readonly _encodeHeadersAsWsProtocols;
97
108
  constructor(options: CortiClient.Options);
98
109
  get auth(): CortiAuth;
99
110
  get stream(): CustomStream;
@@ -2,10 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CortiClient = void 0;
4
4
  const Client_js_1 = require("../Client.js");
5
- const CortiAuth_js_1 = require("./CortiAuth.js");
6
- const CustomStream_js_1 = require("./CustomStream.js");
7
- const CustomTranscribe_js_1 = require("./CustomTranscribe.js");
5
+ const CortiAuth_js_1 = require("./auth/CortiAuth.js");
6
+ const CustomStream_js_1 = require("./stream/CustomStream.js");
7
+ const CustomTranscribe_js_1 = require("./transcribe/CustomTranscribe.js");
8
8
  const authToBaseOptions_js_1 = require("./utils/authToBaseOptions.js");
9
+ const withCredentialsConfig_js_1 = require("./utils/withCredentialsConfig.js");
9
10
  const environment_js_1 = require("./utils/environment.js");
10
11
  const resolveClientOptions_js_1 = require("./utils/resolveClientOptions.js");
11
12
  class CortiClient extends Client_js_1.CortiClient {
@@ -14,6 +15,8 @@ class CortiClient extends Client_js_1.CortiClient {
14
15
  const ctx = (0, resolveClientOptions_js_1.resolveClientOptions)(options);
15
16
  const restOptions = Object.assign(Object.assign(Object.assign({}, opts), { tenantName: ctx.tenantName, environment: (0, environment_js_1.getEnvironment)(ctx.environment) }), (ctx.initialTokenResponse != null ? { initialTokenResponse: ctx.initialTokenResponse } : {}));
16
17
  super((0, authToBaseOptions_js_1.authToBaseOptions)(opts.auth, restOptions));
18
+ (0, withCredentialsConfig_js_1.setDefaultWithCredentials)(options.withCredentials);
19
+ this._encodeHeadersAsWsProtocols = options.encodeHeadersAsWsProtocols;
17
20
  }
18
21
  get auth() {
19
22
  var _a;
@@ -21,11 +24,11 @@ class CortiClient extends Client_js_1.CortiClient {
21
24
  }
22
25
  get stream() {
23
26
  var _a;
24
- return ((_a = this._stream) !== null && _a !== void 0 ? _a : (this._stream = new CustomStream_js_1.CustomStream(this._options)));
27
+ return ((_a = this._stream) !== null && _a !== void 0 ? _a : (this._stream = new CustomStream_js_1.CustomStream(Object.assign(Object.assign({}, this._options), { encodeHeadersAsWsProtocols: this._encodeHeadersAsWsProtocols }))));
25
28
  }
26
29
  get transcribe() {
27
30
  var _a;
28
- return ((_a = this._transcribe) !== null && _a !== void 0 ? _a : (this._transcribe = new CustomTranscribe_js_1.CustomTranscribe(this._options)));
31
+ return ((_a = this._transcribe) !== null && _a !== void 0 ? _a : (this._transcribe = new CustomTranscribe_js_1.CustomTranscribe(Object.assign(Object.assign({}, this._options), { encodeHeadersAsWsProtocols: this._encodeHeadersAsWsProtocols }))));
29
32
  }
30
33
  }
31
34
  exports.CortiClient = CortiClient;
@@ -1,45 +1,15 @@
1
+ import { CustomProxyStream } from "./proxy/CustomProxyStream.js";
2
+ import { CustomProxyTranscribe } from "./proxy/CustomProxyTranscribe.js";
1
3
  /**
2
- * Lightweight proxy client with only WebSocket resources (stream and transcribe).
3
- * Use this when you need direct WebSocket connections through your own proxy backend.
4
+ * Lightweight WebSocket-only client for proxy scenarios.
5
+ * No environment, tenantName, or auth required supply the proxy URL at connect() time.
4
6
  *
5
- * No environment or tenantName required - proxy is required in connect().
7
+ * @example
8
+ * const socket = await CortiWebSocketProxyClient.stream.connect({
9
+ * proxy: { url: "wss://my-proxy/stream" },
10
+ * });
6
11
  */
7
- import * as api from "../api/index.js";
8
- import { StreamSocket } from "./CustomStreamSocket.js";
9
- import { TranscribeSocket } from "./CustomTranscribeSocket.js";
10
- type ProxyOptions = {
11
- url: string;
12
- protocols?: string[];
13
- queryParameters?: Record<string, string>;
14
- };
15
- /** Stream with proxy required */
16
- declare class ProxyStream {
17
- private _stream;
18
- constructor();
19
- connect(args: {
20
- proxy: ProxyOptions;
21
- configuration?: api.StreamConfig;
22
- headers?: Record<string, string>;
23
- debug?: boolean;
24
- reconnectAttempts?: number;
25
- }): Promise<StreamSocket>;
26
- }
27
- /** Transcribe with proxy required */
28
- declare class ProxyTranscribe {
29
- private _transcribe;
30
- constructor();
31
- connect(args: {
32
- proxy: ProxyOptions;
33
- configuration?: api.TranscribeConfig;
34
- headers?: Record<string, string>;
35
- debug?: boolean;
36
- reconnectAttempts?: number;
37
- }): Promise<TranscribeSocket>;
38
- }
39
12
  export declare class CortiWebSocketProxyClient {
40
- private static _stream;
41
- private static _transcribe;
42
- static get stream(): ProxyStream;
43
- static get transcribe(): ProxyTranscribe;
13
+ static readonly stream: CustomProxyStream;
14
+ static readonly transcribe: CustomProxyTranscribe;
44
15
  }
45
- export {};
@@ -1,81 +1,19 @@
1
1
  "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CortiWebSocketProxyClient = void 0;
4
+ const CustomProxyStream_js_1 = require("./proxy/CustomProxyStream.js");
5
+ const CustomProxyTranscribe_js_1 = require("./proxy/CustomProxyTranscribe.js");
2
6
  /**
3
- * Lightweight proxy client with only WebSocket resources (stream and transcribe).
4
- * Use this when you need direct WebSocket connections through your own proxy backend.
7
+ * Lightweight WebSocket-only client for proxy scenarios.
8
+ * No environment, tenantName, or auth required supply the proxy URL at connect() time.
5
9
  *
6
- * No environment or tenantName required - proxy is required in connect().
10
+ * @example
11
+ * const socket = await CortiWebSocketProxyClient.stream.connect({
12
+ * proxy: { url: "wss://my-proxy/stream" },
13
+ * });
7
14
  */
8
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
- if (k2 === undefined) k2 = k;
10
- var desc = Object.getOwnPropertyDescriptor(m, k);
11
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
- desc = { enumerable: true, get: function() { return m[k]; } };
13
- }
14
- Object.defineProperty(o, k2, desc);
15
- }) : (function(o, m, k, k2) {
16
- if (k2 === undefined) k2 = k;
17
- o[k2] = m[k];
18
- }));
19
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
20
- Object.defineProperty(o, "default", { enumerable: true, value: v });
21
- }) : function(o, v) {
22
- o["default"] = v;
23
- });
24
- var __importStar = (this && this.__importStar) || (function () {
25
- var ownKeys = function(o) {
26
- ownKeys = Object.getOwnPropertyNames || function (o) {
27
- var ar = [];
28
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
29
- return ar;
30
- };
31
- return ownKeys(o);
32
- };
33
- return function (mod) {
34
- if (mod && mod.__esModule) return mod;
35
- var result = {};
36
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
37
- __setModuleDefault(result, mod);
38
- return result;
39
- };
40
- })();
41
- Object.defineProperty(exports, "__esModule", { value: true });
42
- exports.CortiWebSocketProxyClient = void 0;
43
- const environments = __importStar(require("../environments.js"));
44
- const CustomStream_js_1 = require("./CustomStream.js");
45
- const CustomTranscribe_js_1 = require("./CustomTranscribe.js");
46
- /** Stream with proxy required */
47
- class ProxyStream {
48
- constructor() {
49
- this._stream = new CustomStream_js_1.Stream({
50
- environment: environments.CortiEnvironment.Eu,
51
- tenantName: "",
52
- });
53
- }
54
- connect(args) {
55
- // id is not used in proxy mode, but required by the underlying type
56
- return this._stream.connect(Object.assign(Object.assign({}, args), { id: "" }));
57
- }
58
- }
59
- /** Transcribe with proxy required */
60
- class ProxyTranscribe {
61
- constructor() {
62
- this._transcribe = new CustomTranscribe_js_1.Transcribe({
63
- environment: environments.CortiEnvironment.Eu,
64
- tenantName: "",
65
- });
66
- }
67
- connect(args) {
68
- return this._transcribe.connect(args);
69
- }
70
- }
71
15
  class CortiWebSocketProxyClient {
72
- static get stream() {
73
- var _a;
74
- return ((_a = this._stream) !== null && _a !== void 0 ? _a : (this._stream = new ProxyStream()));
75
- }
76
- static get transcribe() {
77
- var _a;
78
- return ((_a = this._transcribe) !== null && _a !== void 0 ? _a : (this._transcribe = new ProxyTranscribe()));
79
- }
80
16
  }
81
17
  exports.CortiWebSocketProxyClient = CortiWebSocketProxyClient;
18
+ CortiWebSocketProxyClient.stream = new CustomProxyStream_js_1.CustomProxyStream();
19
+ CortiWebSocketProxyClient.transcribe = new CustomProxyTranscribe_js_1.CustomProxyTranscribe();