phonic 0.30.3 → 0.30.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (385) hide show
  1. package/README.md +22 -24
  2. package/package.json +1 -1
  3. package/reference.md +21 -23
  4. package/dist/cjs/Client.d.ts +0 -50
  5. package/dist/cjs/Client.js +0 -84
  6. package/dist/cjs/api/errors/BadRequestError.d.ts +0 -8
  7. package/dist/cjs/api/errors/BadRequestError.js +0 -52
  8. package/dist/cjs/api/errors/ConflictError.d.ts +0 -8
  9. package/dist/cjs/api/errors/ConflictError.js +0 -52
  10. package/dist/cjs/api/errors/ForbiddenError.d.ts +0 -8
  11. package/dist/cjs/api/errors/ForbiddenError.js +0 -52
  12. package/dist/cjs/api/errors/GatewayTimeoutError.d.ts +0 -9
  13. package/dist/cjs/api/errors/GatewayTimeoutError.js +0 -52
  14. package/dist/cjs/api/errors/InternalServerError.d.ts +0 -9
  15. package/dist/cjs/api/errors/InternalServerError.js +0 -52
  16. package/dist/cjs/api/errors/NotFoundError.d.ts +0 -8
  17. package/dist/cjs/api/errors/NotFoundError.js +0 -52
  18. package/dist/cjs/api/errors/UnauthorizedError.d.ts +0 -9
  19. package/dist/cjs/api/errors/UnauthorizedError.js +0 -52
  20. package/dist/cjs/api/errors/index.d.ts +0 -7
  21. package/dist/cjs/api/errors/index.js +0 -23
  22. package/dist/cjs/api/index.d.ts +0 -4
  23. package/dist/cjs/api/index.js +0 -20
  24. package/dist/cjs/api/resources/agents/client/Client.d.ts +0 -208
  25. package/dist/cjs/api/resources/agents/client/Client.js +0 -595
  26. package/dist/cjs/api/resources/agents/client/index.d.ts +0 -2
  27. package/dist/cjs/api/resources/agents/client/index.js +0 -17
  28. package/dist/cjs/api/resources/agents/client/requests/AgentsCreateRequest.d.ts +0 -41
  29. package/dist/cjs/api/resources/agents/client/requests/AgentsCreateRequest.js +0 -5
  30. package/dist/cjs/api/resources/agents/client/requests/AgentsDeleteRequest.d.ts +0 -13
  31. package/dist/cjs/api/resources/agents/client/requests/AgentsDeleteRequest.js +0 -5
  32. package/dist/cjs/api/resources/agents/client/requests/AgentsGetRequest.d.ts +0 -13
  33. package/dist/cjs/api/resources/agents/client/requests/AgentsGetRequest.js +0 -5
  34. package/dist/cjs/api/resources/agents/client/requests/AgentsListRequest.d.ts +0 -11
  35. package/dist/cjs/api/resources/agents/client/requests/AgentsListRequest.js +0 -5
  36. package/dist/cjs/api/resources/agents/client/requests/UpdateAgentRequest.d.ts +0 -102
  37. package/dist/cjs/api/resources/agents/client/requests/UpdateAgentRequest.js +0 -13
  38. package/dist/cjs/api/resources/agents/client/requests/UpsertAgentRequest.d.ts +0 -38
  39. package/dist/cjs/api/resources/agents/client/requests/UpsertAgentRequest.js +0 -5
  40. package/dist/cjs/api/resources/agents/client/requests/index.d.ts +0 -6
  41. package/dist/cjs/api/resources/agents/client/requests/index.js +0 -2
  42. package/dist/cjs/api/resources/agents/index.d.ts +0 -2
  43. package/dist/cjs/api/resources/agents/index.js +0 -18
  44. package/dist/cjs/api/resources/agents/types/AgentsCreateResponse.d.ts +0 -9
  45. package/dist/cjs/api/resources/agents/types/AgentsCreateResponse.js +0 -5
  46. package/dist/cjs/api/resources/agents/types/AgentsDeleteResponse.d.ts +0 -7
  47. package/dist/cjs/api/resources/agents/types/AgentsDeleteResponse.js +0 -5
  48. package/dist/cjs/api/resources/agents/types/AgentsGetResponse.d.ts +0 -7
  49. package/dist/cjs/api/resources/agents/types/AgentsGetResponse.js +0 -5
  50. package/dist/cjs/api/resources/agents/types/AgentsListResponse.d.ts +0 -7
  51. package/dist/cjs/api/resources/agents/types/AgentsListResponse.js +0 -5
  52. package/dist/cjs/api/resources/agents/types/AgentsUpdateResponse.d.ts +0 -7
  53. package/dist/cjs/api/resources/agents/types/AgentsUpdateResponse.js +0 -5
  54. package/dist/cjs/api/resources/agents/types/AgentsUpsertResponse.d.ts +0 -11
  55. package/dist/cjs/api/resources/agents/types/AgentsUpsertResponse.js +0 -5
  56. package/dist/cjs/api/resources/agents/types/index.d.ts +0 -6
  57. package/dist/cjs/api/resources/agents/types/index.js +0 -22
  58. package/dist/cjs/api/resources/conversations/client/Client.d.ts +0 -236
  59. package/dist/cjs/api/resources/conversations/client/Client.js +0 -895
  60. package/dist/cjs/api/resources/conversations/client/Socket.d.ts +0 -64
  61. package/dist/cjs/api/resources/conversations/client/Socket.js +0 -196
  62. package/dist/cjs/api/resources/conversations/client/index.d.ts +0 -2
  63. package/dist/cjs/api/resources/conversations/client/index.js +0 -17
  64. package/dist/cjs/api/resources/conversations/client/requests/ConversationsListRequest.d.ts +0 -30
  65. package/dist/cjs/api/resources/conversations/client/requests/ConversationsListRequest.js +0 -5
  66. package/dist/cjs/api/resources/conversations/client/requests/ConversationsSipOutboundCallRequest.d.ts +0 -29
  67. package/dist/cjs/api/resources/conversations/client/requests/ConversationsSipOutboundCallRequest.js +0 -5
  68. package/dist/cjs/api/resources/conversations/client/requests/EvaluateConversationRequest.d.ts +0 -13
  69. package/dist/cjs/api/resources/conversations/client/requests/EvaluateConversationRequest.js +0 -5
  70. package/dist/cjs/api/resources/conversations/client/requests/ExtractDataRequest.d.ts +0 -13
  71. package/dist/cjs/api/resources/conversations/client/requests/ExtractDataRequest.js +0 -5
  72. package/dist/cjs/api/resources/conversations/client/requests/OutboundCallRequest.d.ts +0 -30
  73. package/dist/cjs/api/resources/conversations/client/requests/OutboundCallRequest.js +0 -5
  74. package/dist/cjs/api/resources/conversations/client/requests/index.d.ts +0 -5
  75. package/dist/cjs/api/resources/conversations/client/requests/index.js +0 -2
  76. package/dist/cjs/api/resources/conversations/index.d.ts +0 -2
  77. package/dist/cjs/api/resources/conversations/index.js +0 -18
  78. package/dist/cjs/api/resources/conversations/types/ConversationsCancelResponse.d.ts +0 -7
  79. package/dist/cjs/api/resources/conversations/types/ConversationsCancelResponse.js +0 -5
  80. package/dist/cjs/api/resources/conversations/types/ConversationsExtractDataResponse.d.ts +0 -7
  81. package/dist/cjs/api/resources/conversations/types/ConversationsExtractDataResponse.js +0 -5
  82. package/dist/cjs/api/resources/conversations/types/ConversationsGetAnalysisResponse.d.ts +0 -7
  83. package/dist/cjs/api/resources/conversations/types/ConversationsGetAnalysisResponse.js +0 -5
  84. package/dist/cjs/api/resources/conversations/types/ConversationsGetResponse.d.ts +0 -7
  85. package/dist/cjs/api/resources/conversations/types/ConversationsGetResponse.js +0 -5
  86. package/dist/cjs/api/resources/conversations/types/ConversationsListEvaluationsResponse.d.ts +0 -7
  87. package/dist/cjs/api/resources/conversations/types/ConversationsListEvaluationsResponse.js +0 -5
  88. package/dist/cjs/api/resources/conversations/types/ConversationsListExtractionsResponse.d.ts +0 -7
  89. package/dist/cjs/api/resources/conversations/types/ConversationsListExtractionsResponse.js +0 -5
  90. package/dist/cjs/api/resources/conversations/types/ConversationsListResponse.d.ts +0 -9
  91. package/dist/cjs/api/resources/conversations/types/ConversationsListResponse.js +0 -5
  92. package/dist/cjs/api/resources/conversations/types/ConversationsOutboundCallResponse.d.ts +0 -7
  93. package/dist/cjs/api/resources/conversations/types/ConversationsOutboundCallResponse.js +0 -5
  94. package/dist/cjs/api/resources/conversations/types/ConversationsSipOutboundCallResponse.d.ts +0 -7
  95. package/dist/cjs/api/resources/conversations/types/ConversationsSipOutboundCallResponse.js +0 -5
  96. package/dist/cjs/api/resources/conversations/types/index.d.ts +0 -9
  97. package/dist/cjs/api/resources/conversations/types/index.js +0 -25
  98. package/dist/cjs/api/resources/extractionSchemas/client/Client.d.ts +0 -142
  99. package/dist/cjs/api/resources/extractionSchemas/client/Client.js +0 -473
  100. package/dist/cjs/api/resources/extractionSchemas/client/index.d.ts +0 -2
  101. package/dist/cjs/api/resources/extractionSchemas/client/index.js +0 -17
  102. package/dist/cjs/api/resources/extractionSchemas/client/requests/CreateExtractionSchemaRequest.d.ts +0 -35
  103. package/dist/cjs/api/resources/extractionSchemas/client/requests/CreateExtractionSchemaRequest.js +0 -5
  104. package/dist/cjs/api/resources/extractionSchemas/client/requests/ExtractionSchemasDeleteRequest.d.ts +0 -13
  105. package/dist/cjs/api/resources/extractionSchemas/client/requests/ExtractionSchemasDeleteRequest.js +0 -5
  106. package/dist/cjs/api/resources/extractionSchemas/client/requests/ExtractionSchemasGetRequest.d.ts +0 -13
  107. package/dist/cjs/api/resources/extractionSchemas/client/requests/ExtractionSchemasGetRequest.js +0 -5
  108. package/dist/cjs/api/resources/extractionSchemas/client/requests/ExtractionSchemasListRequest.d.ts +0 -13
  109. package/dist/cjs/api/resources/extractionSchemas/client/requests/ExtractionSchemasListRequest.js +0 -5
  110. package/dist/cjs/api/resources/extractionSchemas/client/requests/UpdateExtractionSchemaRequest.d.ts +0 -31
  111. package/dist/cjs/api/resources/extractionSchemas/client/requests/UpdateExtractionSchemaRequest.js +0 -5
  112. package/dist/cjs/api/resources/extractionSchemas/client/requests/index.d.ts +0 -5
  113. package/dist/cjs/api/resources/extractionSchemas/client/requests/index.js +0 -2
  114. package/dist/cjs/api/resources/extractionSchemas/index.d.ts +0 -2
  115. package/dist/cjs/api/resources/extractionSchemas/index.js +0 -18
  116. package/dist/cjs/api/resources/extractionSchemas/types/ExtractionSchemasCreateResponse.d.ts +0 -9
  117. package/dist/cjs/api/resources/extractionSchemas/types/ExtractionSchemasCreateResponse.js +0 -5
  118. package/dist/cjs/api/resources/extractionSchemas/types/ExtractionSchemasDeleteResponse.d.ts +0 -7
  119. package/dist/cjs/api/resources/extractionSchemas/types/ExtractionSchemasDeleteResponse.js +0 -5
  120. package/dist/cjs/api/resources/extractionSchemas/types/ExtractionSchemasGetResponse.d.ts +0 -7
  121. package/dist/cjs/api/resources/extractionSchemas/types/ExtractionSchemasGetResponse.js +0 -5
  122. package/dist/cjs/api/resources/extractionSchemas/types/ExtractionSchemasListResponse.d.ts +0 -7
  123. package/dist/cjs/api/resources/extractionSchemas/types/ExtractionSchemasListResponse.js +0 -5
  124. package/dist/cjs/api/resources/extractionSchemas/types/ExtractionSchemasUpdateResponse.d.ts +0 -7
  125. package/dist/cjs/api/resources/extractionSchemas/types/ExtractionSchemasUpdateResponse.js +0 -5
  126. package/dist/cjs/api/resources/extractionSchemas/types/index.d.ts +0 -5
  127. package/dist/cjs/api/resources/extractionSchemas/types/index.js +0 -21
  128. package/dist/cjs/api/resources/index.d.ts +0 -18
  129. package/dist/cjs/api/resources/index.js +0 -57
  130. package/dist/cjs/api/resources/projects/client/Client.d.ts +0 -157
  131. package/dist/cjs/api/resources/projects/client/Client.js +0 -584
  132. package/dist/cjs/api/resources/projects/client/index.d.ts +0 -2
  133. package/dist/cjs/api/resources/projects/client/index.js +0 -17
  134. package/dist/cjs/api/resources/projects/client/requests/CreateConversationEvalPromptRequest.d.ts +0 -16
  135. package/dist/cjs/api/resources/projects/client/requests/CreateConversationEvalPromptRequest.js +0 -5
  136. package/dist/cjs/api/resources/projects/client/requests/CreateProjectRequest.d.ts +0 -13
  137. package/dist/cjs/api/resources/projects/client/requests/CreateProjectRequest.js +0 -5
  138. package/dist/cjs/api/resources/projects/client/requests/UpdateProjectRequest.d.ts +0 -15
  139. package/dist/cjs/api/resources/projects/client/requests/UpdateProjectRequest.js +0 -5
  140. package/dist/cjs/api/resources/projects/client/requests/index.d.ts +0 -3
  141. package/dist/cjs/api/resources/projects/client/requests/index.js +0 -2
  142. package/dist/cjs/api/resources/projects/index.d.ts +0 -2
  143. package/dist/cjs/api/resources/projects/index.js +0 -18
  144. package/dist/cjs/api/resources/projects/types/ProjectsCreateEvalPromptResponse.d.ts +0 -7
  145. package/dist/cjs/api/resources/projects/types/ProjectsCreateEvalPromptResponse.js +0 -5
  146. package/dist/cjs/api/resources/projects/types/ProjectsCreateResponse.d.ts +0 -9
  147. package/dist/cjs/api/resources/projects/types/ProjectsCreateResponse.js +0 -5
  148. package/dist/cjs/api/resources/projects/types/ProjectsDeleteResponse.d.ts +0 -7
  149. package/dist/cjs/api/resources/projects/types/ProjectsDeleteResponse.js +0 -5
  150. package/dist/cjs/api/resources/projects/types/ProjectsGetResponse.d.ts +0 -7
  151. package/dist/cjs/api/resources/projects/types/ProjectsGetResponse.js +0 -5
  152. package/dist/cjs/api/resources/projects/types/ProjectsListEvalPromptsResponse.d.ts +0 -7
  153. package/dist/cjs/api/resources/projects/types/ProjectsListEvalPromptsResponse.js +0 -5
  154. package/dist/cjs/api/resources/projects/types/ProjectsListResponse.d.ts +0 -7
  155. package/dist/cjs/api/resources/projects/types/ProjectsListResponse.js +0 -5
  156. package/dist/cjs/api/resources/projects/types/ProjectsUpdateResponse.d.ts +0 -7
  157. package/dist/cjs/api/resources/projects/types/ProjectsUpdateResponse.js +0 -5
  158. package/dist/cjs/api/resources/projects/types/index.d.ts +0 -7
  159. package/dist/cjs/api/resources/projects/types/index.js +0 -23
  160. package/dist/cjs/api/resources/tools/client/Client.d.ts +0 -170
  161. package/dist/cjs/api/resources/tools/client/Client.js +0 -494
  162. package/dist/cjs/api/resources/tools/client/index.d.ts +0 -2
  163. package/dist/cjs/api/resources/tools/client/index.js +0 -17
  164. package/dist/cjs/api/resources/tools/client/requests/CreateToolRequest.d.ts +0 -103
  165. package/dist/cjs/api/resources/tools/client/requests/CreateToolRequest.js +0 -18
  166. package/dist/cjs/api/resources/tools/client/requests/ToolsDeleteRequest.d.ts +0 -13
  167. package/dist/cjs/api/resources/tools/client/requests/ToolsDeleteRequest.js +0 -5
  168. package/dist/cjs/api/resources/tools/client/requests/ToolsGetRequest.d.ts +0 -23
  169. package/dist/cjs/api/resources/tools/client/requests/ToolsGetRequest.js +0 -5
  170. package/dist/cjs/api/resources/tools/client/requests/ToolsListRequest.d.ts +0 -13
  171. package/dist/cjs/api/resources/tools/client/requests/ToolsListRequest.js +0 -5
  172. package/dist/cjs/api/resources/tools/client/requests/UpdateToolRequest.d.ts +0 -55
  173. package/dist/cjs/api/resources/tools/client/requests/UpdateToolRequest.js +0 -18
  174. package/dist/cjs/api/resources/tools/client/requests/index.d.ts +0 -5
  175. package/dist/cjs/api/resources/tools/client/requests/index.js +0 -2
  176. package/dist/cjs/api/resources/tools/index.d.ts +0 -2
  177. package/dist/cjs/api/resources/tools/index.js +0 -18
  178. package/dist/cjs/api/resources/tools/types/ToolsCreateResponse.d.ts +0 -9
  179. package/dist/cjs/api/resources/tools/types/ToolsCreateResponse.js +0 -5
  180. package/dist/cjs/api/resources/tools/types/ToolsDeleteResponse.d.ts +0 -7
  181. package/dist/cjs/api/resources/tools/types/ToolsDeleteResponse.js +0 -5
  182. package/dist/cjs/api/resources/tools/types/ToolsGetResponse.d.ts +0 -7
  183. package/dist/cjs/api/resources/tools/types/ToolsGetResponse.js +0 -5
  184. package/dist/cjs/api/resources/tools/types/ToolsListResponse.d.ts +0 -7
  185. package/dist/cjs/api/resources/tools/types/ToolsListResponse.js +0 -5
  186. package/dist/cjs/api/resources/tools/types/ToolsUpdateResponse.d.ts +0 -7
  187. package/dist/cjs/api/resources/tools/types/ToolsUpdateResponse.js +0 -5
  188. package/dist/cjs/api/resources/tools/types/index.d.ts +0 -5
  189. package/dist/cjs/api/resources/tools/types/index.js +0 -21
  190. package/dist/cjs/api/resources/voices/client/Client.d.ts +0 -65
  191. package/dist/cjs/api/resources/voices/client/Client.js +0 -205
  192. package/dist/cjs/api/resources/voices/client/index.d.ts +0 -2
  193. package/dist/cjs/api/resources/voices/client/index.js +0 -17
  194. package/dist/cjs/api/resources/voices/client/requests/VoicesListRequest.d.ts +0 -13
  195. package/dist/cjs/api/resources/voices/client/requests/VoicesListRequest.js +0 -5
  196. package/dist/cjs/api/resources/voices/client/requests/index.d.ts +0 -1
  197. package/dist/cjs/api/resources/voices/client/requests/index.js +0 -2
  198. package/dist/cjs/api/resources/voices/index.d.ts +0 -2
  199. package/dist/cjs/api/resources/voices/index.js +0 -18
  200. package/dist/cjs/api/resources/voices/types/VoicesGetResponse.d.ts +0 -7
  201. package/dist/cjs/api/resources/voices/types/VoicesGetResponse.js +0 -5
  202. package/dist/cjs/api/resources/voices/types/VoicesListResponse.d.ts +0 -7
  203. package/dist/cjs/api/resources/voices/types/VoicesListResponse.js +0 -5
  204. package/dist/cjs/api/resources/voices/types/index.d.ts +0 -2
  205. package/dist/cjs/api/resources/voices/types/index.js +0 -18
  206. package/dist/cjs/api/types/Agent.d.ts +0 -80
  207. package/dist/cjs/api/types/Agent.js +0 -13
  208. package/dist/cjs/api/types/AssistantChoseNotToRespondPayload.d.ts +0 -6
  209. package/dist/cjs/api/types/AssistantChoseNotToRespondPayload.js +0 -5
  210. package/dist/cjs/api/types/AssistantEndedConversationPayload.d.ts +0 -6
  211. package/dist/cjs/api/types/AssistantEndedConversationPayload.js +0 -5
  212. package/dist/cjs/api/types/AudioChunkPayload.d.ts +0 -10
  213. package/dist/cjs/api/types/AudioChunkPayload.js +0 -5
  214. package/dist/cjs/api/types/AudioChunkResponsePayload.d.ts +0 -10
  215. package/dist/cjs/api/types/AudioChunkResponsePayload.js +0 -5
  216. package/dist/cjs/api/types/AudioFinishedPayload.d.ts +0 -6
  217. package/dist/cjs/api/types/AudioFinishedPayload.js +0 -5
  218. package/dist/cjs/api/types/BadRequestErrorBody.d.ts +0 -5
  219. package/dist/cjs/api/types/BadRequestErrorBody.js +0 -5
  220. package/dist/cjs/api/types/BasicError.d.ts +0 -14
  221. package/dist/cjs/api/types/BasicError.js +0 -5
  222. package/dist/cjs/api/types/ConfigPayload.d.ts +0 -66
  223. package/dist/cjs/api/types/ConfigPayload.js +0 -17
  224. package/dist/cjs/api/types/Conversation.d.ts +0 -51
  225. package/dist/cjs/api/types/Conversation.js +0 -5
  226. package/dist/cjs/api/types/ConversationAnalysis.d.ts +0 -9
  227. package/dist/cjs/api/types/ConversationAnalysis.js +0 -5
  228. package/dist/cjs/api/types/ConversationCreatedPayload.d.ts +0 -8
  229. package/dist/cjs/api/types/ConversationCreatedPayload.js +0 -5
  230. package/dist/cjs/api/types/ConversationEval.d.ts +0 -4
  231. package/dist/cjs/api/types/ConversationEval.js +0 -5
  232. package/dist/cjs/api/types/ConversationEvalPrompt.d.ts +0 -11
  233. package/dist/cjs/api/types/ConversationEvalPrompt.js +0 -5
  234. package/dist/cjs/api/types/ConversationEvaluation.d.ts +0 -8
  235. package/dist/cjs/api/types/ConversationEvaluation.js +0 -5
  236. package/dist/cjs/api/types/ConversationEvaluationResult.d.ts +0 -32
  237. package/dist/cjs/api/types/ConversationEvaluationResult.js +0 -15
  238. package/dist/cjs/api/types/ConversationExtraction.d.ts +0 -22
  239. package/dist/cjs/api/types/ConversationExtraction.js +0 -5
  240. package/dist/cjs/api/types/ConversationItem.d.ts +0 -31
  241. package/dist/cjs/api/types/ConversationItem.js +0 -13
  242. package/dist/cjs/api/types/CreateAgentRequest.d.ts +0 -70
  243. package/dist/cjs/api/types/CreateAgentRequest.js +0 -13
  244. package/dist/cjs/api/types/DtmfPayload.d.ts +0 -8
  245. package/dist/cjs/api/types/DtmfPayload.js +0 -5
  246. package/dist/cjs/api/types/ErrorPayload.d.ts +0 -17
  247. package/dist/cjs/api/types/ErrorPayload.js +0 -5
  248. package/dist/cjs/api/types/Error_.d.ts +0 -5
  249. package/dist/cjs/api/types/Error_.js +0 -5
  250. package/dist/cjs/api/types/ExtractionField.d.ts +0 -23
  251. package/dist/cjs/api/types/ExtractionField.js +0 -15
  252. package/dist/cjs/api/types/ExtractionSchema.d.ts +0 -14
  253. package/dist/cjs/api/types/ExtractionSchema.js +0 -5
  254. package/dist/cjs/api/types/InputCancelledPayload.d.ts +0 -6
  255. package/dist/cjs/api/types/InputCancelledPayload.js +0 -5
  256. package/dist/cjs/api/types/InputTextPayload.d.ts +0 -8
  257. package/dist/cjs/api/types/InputTextPayload.js +0 -5
  258. package/dist/cjs/api/types/InterruptedResponsePayload.d.ts +0 -8
  259. package/dist/cjs/api/types/InterruptedResponsePayload.js +0 -5
  260. package/dist/cjs/api/types/IsUserSpeakingPayload.d.ts +0 -8
  261. package/dist/cjs/api/types/IsUserSpeakingPayload.js +0 -5
  262. package/dist/cjs/api/types/OutboundCallConfig.d.ts +0 -39
  263. package/dist/cjs/api/types/OutboundCallConfig.js +0 -5
  264. package/dist/cjs/api/types/Project.d.ts +0 -22
  265. package/dist/cjs/api/types/Project.js +0 -5
  266. package/dist/cjs/api/types/ReadyToStartConversationPayload.d.ts +0 -6
  267. package/dist/cjs/api/types/ReadyToStartConversationPayload.js +0 -5
  268. package/dist/cjs/api/types/SetExternalIdPayload.d.ts +0 -8
  269. package/dist/cjs/api/types/SetExternalIdPayload.js +0 -5
  270. package/dist/cjs/api/types/SetTwilioCallSidPayload.d.ts +0 -8
  271. package/dist/cjs/api/types/SetTwilioCallSidPayload.js +0 -5
  272. package/dist/cjs/api/types/Task.d.ts +0 -9
  273. package/dist/cjs/api/types/Task.js +0 -5
  274. package/dist/cjs/api/types/Tool.d.ts +0 -54
  275. package/dist/cjs/api/types/Tool.js +0 -18
  276. package/dist/cjs/api/types/ToolCallInterruptedPayload.d.ts +0 -12
  277. package/dist/cjs/api/types/ToolCallInterruptedPayload.js +0 -5
  278. package/dist/cjs/api/types/ToolCallOutputPayload.d.ts +0 -9
  279. package/dist/cjs/api/types/ToolCallOutputPayload.js +0 -5
  280. package/dist/cjs/api/types/ToolCallOutputProcessedPayload.d.ts +0 -35
  281. package/dist/cjs/api/types/ToolCallOutputProcessedPayload.js +0 -5
  282. package/dist/cjs/api/types/ToolCallPayload.d.ts +0 -12
  283. package/dist/cjs/api/types/ToolCallPayload.js +0 -5
  284. package/dist/cjs/api/types/ToolParameter.d.ts +0 -38
  285. package/dist/cjs/api/types/ToolParameter.js +0 -22
  286. package/dist/cjs/api/types/UpdateSystemPromptPayload.d.ts +0 -8
  287. package/dist/cjs/api/types/UpdateSystemPromptPayload.js +0 -5
  288. package/dist/cjs/api/types/UserFinishedSpeakingPayload.d.ts +0 -6
  289. package/dist/cjs/api/types/UserFinishedSpeakingPayload.js +0 -5
  290. package/dist/cjs/api/types/UserStartedSpeakingPayload.d.ts +0 -6
  291. package/dist/cjs/api/types/UserStartedSpeakingPayload.js +0 -5
  292. package/dist/cjs/api/types/ValidationError.d.ts +0 -14
  293. package/dist/cjs/api/types/ValidationError.js +0 -5
  294. package/dist/cjs/api/types/Voice.d.ts +0 -11
  295. package/dist/cjs/api/types/Voice.js +0 -5
  296. package/dist/cjs/api/types/index.d.ts +0 -45
  297. package/dist/cjs/api/types/index.js +0 -61
  298. package/dist/cjs/api/types/overrides.d.ts +0 -50
  299. package/dist/cjs/api/types/overrides.js +0 -2
  300. package/dist/cjs/core/auth/AuthProvider.d.ts +0 -4
  301. package/dist/cjs/core/auth/AuthProvider.js +0 -2
  302. package/dist/cjs/core/auth/AuthRequest.d.ts +0 -9
  303. package/dist/cjs/core/auth/AuthRequest.js +0 -2
  304. package/dist/cjs/core/auth/BasicAuth.d.ts +0 -8
  305. package/dist/cjs/core/auth/BasicAuth.js +0 -26
  306. package/dist/cjs/core/auth/BearerToken.d.ts +0 -5
  307. package/dist/cjs/core/auth/BearerToken.js +0 -15
  308. package/dist/cjs/core/auth/index.d.ts +0 -4
  309. package/dist/cjs/core/auth/index.js +0 -7
  310. package/dist/cjs/core/base64.d.ts +0 -2
  311. package/dist/cjs/core/base64.js +0 -26
  312. package/dist/cjs/core/fetcher/APIResponse.d.ts +0 -20
  313. package/dist/cjs/core/fetcher/APIResponse.js +0 -2
  314. package/dist/cjs/core/fetcher/BinaryResponse.d.ts +0 -20
  315. package/dist/cjs/core/fetcher/BinaryResponse.js +0 -17
  316. package/dist/cjs/core/fetcher/Fetcher.d.ts +0 -40
  317. package/dist/cjs/core/fetcher/Fetcher.js +0 -120
  318. package/dist/cjs/core/fetcher/Headers.d.ts +0 -2
  319. package/dist/cjs/core/fetcher/Headers.js +0 -84
  320. package/dist/cjs/core/fetcher/HttpResponsePromise.d.ts +0 -58
  321. package/dist/cjs/core/fetcher/HttpResponsePromise.js +0 -103
  322. package/dist/cjs/core/fetcher/RawResponse.d.ts +0 -29
  323. package/dist/cjs/core/fetcher/RawResponse.js +0 -44
  324. package/dist/cjs/core/fetcher/ResponseWithBody.d.ts +0 -4
  325. package/dist/cjs/core/fetcher/ResponseWithBody.js +0 -6
  326. package/dist/cjs/core/fetcher/Supplier.d.ts +0 -4
  327. package/dist/cjs/core/fetcher/Supplier.js +0 -22
  328. package/dist/cjs/core/fetcher/createRequestUrl.d.ts +0 -1
  329. package/dist/cjs/core/fetcher/createRequestUrl.js +0 -8
  330. package/dist/cjs/core/fetcher/getErrorResponseBody.d.ts +0 -1
  331. package/dist/cjs/core/fetcher/getErrorResponseBody.js +0 -44
  332. package/dist/cjs/core/fetcher/getFetchFn.d.ts +0 -1
  333. package/dist/cjs/core/fetcher/getFetchFn.js +0 -17
  334. package/dist/cjs/core/fetcher/getHeader.d.ts +0 -1
  335. package/dist/cjs/core/fetcher/getHeader.js +0 -11
  336. package/dist/cjs/core/fetcher/getRequestBody.d.ts +0 -7
  337. package/dist/cjs/core/fetcher/getRequestBody.js +0 -23
  338. package/dist/cjs/core/fetcher/getResponseBody.d.ts +0 -1
  339. package/dist/cjs/core/fetcher/getResponseBody.js +0 -55
  340. package/dist/cjs/core/fetcher/index.d.ts +0 -9
  341. package/dist/cjs/core/fetcher/index.js +0 -15
  342. package/dist/cjs/core/fetcher/makeRequest.d.ts +0 -1
  343. package/dist/cjs/core/fetcher/makeRequest.js +0 -42
  344. package/dist/cjs/core/fetcher/requestWithRetries.d.ts +0 -1
  345. package/dist/cjs/core/fetcher/requestWithRetries.js +0 -40
  346. package/dist/cjs/core/fetcher/signals.d.ts +0 -11
  347. package/dist/cjs/core/fetcher/signals.js +0 -36
  348. package/dist/cjs/core/headers.d.ts +0 -3
  349. package/dist/cjs/core/headers.js +0 -29
  350. package/dist/cjs/core/index.d.ts +0 -6
  351. package/dist/cjs/core/index.js +0 -45
  352. package/dist/cjs/core/json.d.ts +0 -15
  353. package/dist/cjs/core/json.js +0 -24
  354. package/dist/cjs/core/runtime/index.d.ts +0 -1
  355. package/dist/cjs/core/runtime/index.js +0 -5
  356. package/dist/cjs/core/runtime/runtime.d.ts +0 -9
  357. package/dist/cjs/core/runtime/runtime.js +0 -102
  358. package/dist/cjs/core/url/index.d.ts +0 -2
  359. package/dist/cjs/core/url/index.js +0 -7
  360. package/dist/cjs/core/url/join.d.ts +0 -1
  361. package/dist/cjs/core/url/join.js +0 -69
  362. package/dist/cjs/core/url/qs.d.ts +0 -6
  363. package/dist/cjs/core/url/qs.js +0 -64
  364. package/dist/cjs/core/websocket/events.d.ts +0 -36
  365. package/dist/cjs/core/websocket/events.js +0 -27
  366. package/dist/cjs/core/websocket/index.d.ts +0 -1
  367. package/dist/cjs/core/websocket/index.js +0 -17
  368. package/dist/cjs/core/websocket/ws.d.ts +0 -147
  369. package/dist/cjs/core/websocket/ws.js +0 -460
  370. package/dist/cjs/environments.d.ts +0 -14
  371. package/dist/cjs/environments.js +0 -12
  372. package/dist/cjs/errors/PhonicError.d.ts +0 -15
  373. package/dist/cjs/errors/PhonicError.js +0 -30
  374. package/dist/cjs/errors/PhonicTimeoutError.d.ts +0 -6
  375. package/dist/cjs/errors/PhonicTimeoutError.js +0 -13
  376. package/dist/cjs/errors/index.d.ts +0 -2
  377. package/dist/cjs/errors/index.js +0 -7
  378. package/dist/cjs/index.d.ts +0 -4
  379. package/dist/cjs/index.js +0 -44
  380. package/dist/cjs/version.d.ts +0 -1
  381. package/dist/cjs/version.js +0 -4
  382. package/dist/index.d.mts +0 -640
  383. package/dist/index.d.ts +0 -640
  384. package/dist/index.js +0 -628
  385. package/dist/index.mjs +0 -591
@@ -1,40 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.requestWithRetries = requestWithRetries;
13
- const INITIAL_RETRY_DELAY = 1000; // in milliseconds
14
- const MAX_RETRY_DELAY = 60000; // in milliseconds
15
- const DEFAULT_MAX_RETRIES = 2;
16
- const JITTER_FACTOR = 0.2; // 20% random jitter
17
- function addJitter(delay) {
18
- // Generate a random value between -JITTER_FACTOR and +JITTER_FACTOR
19
- const jitterMultiplier = 1 + (Math.random() * 2 - 1) * JITTER_FACTOR;
20
- return delay * jitterMultiplier;
21
- }
22
- function requestWithRetries(requestFn_1) {
23
- return __awaiter(this, arguments, void 0, function* (requestFn, maxRetries = DEFAULT_MAX_RETRIES) {
24
- let response = yield requestFn();
25
- for (let i = 0; i < maxRetries; ++i) {
26
- if ([408, 429].includes(response.status) || response.status >= 500) {
27
- // Calculate base delay using exponential backoff (in milliseconds)
28
- const baseDelay = Math.min(INITIAL_RETRY_DELAY * Math.pow(2, i), MAX_RETRY_DELAY);
29
- // Add jitter to the delay
30
- const delayWithJitter = addJitter(baseDelay);
31
- yield new Promise((resolve) => setTimeout(resolve, delayWithJitter));
32
- response = yield requestFn();
33
- }
34
- else {
35
- break;
36
- }
37
- }
38
- return response;
39
- });
40
- }
@@ -1,11 +0,0 @@
1
- export declare function getTimeoutSignal(timeoutMs: number): {
2
- signal: AbortSignal;
3
- abortId: NodeJS.Timeout;
4
- };
5
- /**
6
- * Returns an abort signal that is getting aborted when
7
- * at least one of the specified abort signals is aborted.
8
- *
9
- * Requires at least node.js 18.
10
- */
11
- export declare function anySignal(...args: AbortSignal[] | [AbortSignal[]]): AbortSignal;
@@ -1,36 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getTimeoutSignal = getTimeoutSignal;
4
- exports.anySignal = anySignal;
5
- const TIMEOUT = "timeout";
6
- function getTimeoutSignal(timeoutMs) {
7
- const controller = new AbortController();
8
- const abortId = setTimeout(() => controller.abort(TIMEOUT), timeoutMs);
9
- return { signal: controller.signal, abortId };
10
- }
11
- /**
12
- * Returns an abort signal that is getting aborted when
13
- * at least one of the specified abort signals is aborted.
14
- *
15
- * Requires at least node.js 18.
16
- */
17
- function anySignal(...args) {
18
- // Allowing signals to be passed either as array
19
- // of signals or as multiple arguments.
20
- const signals = (args.length === 1 && Array.isArray(args[0]) ? args[0] : args);
21
- const controller = new AbortController();
22
- for (const signal of signals) {
23
- if (signal.aborted) {
24
- // Exiting early if one of the signals
25
- // is already aborted.
26
- controller.abort(signal === null || signal === void 0 ? void 0 : signal.reason);
27
- break;
28
- }
29
- // Listening for signals and removing the listeners
30
- // when at least one symbol is aborted.
31
- signal.addEventListener("abort", () => controller.abort(signal === null || signal === void 0 ? void 0 : signal.reason), {
32
- signal: controller.signal,
33
- });
34
- }
35
- return controller.signal;
36
- }
@@ -1,3 +0,0 @@
1
- import * as core from "./index.js";
2
- export declare function mergeHeaders(...headersArray: (Record<string, string | core.Supplier<string | undefined> | undefined> | undefined)[]): Record<string, string | core.Supplier<string | undefined>>;
3
- export declare function mergeOnlyDefinedHeaders(...headersArray: (Record<string, string | core.Supplier<string | undefined> | undefined> | undefined)[]): Record<string, string | core.Supplier<string | undefined>>;
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mergeHeaders = mergeHeaders;
4
- exports.mergeOnlyDefinedHeaders = mergeOnlyDefinedHeaders;
5
- function mergeHeaders(...headersArray) {
6
- const result = {};
7
- for (const [key, value] of headersArray
8
- .filter((headers) => headers != null)
9
- .flatMap((headers) => Object.entries(headers))) {
10
- if (value != null) {
11
- result[key] = value;
12
- }
13
- else if (key in result) {
14
- delete result[key];
15
- }
16
- }
17
- return result;
18
- }
19
- function mergeOnlyDefinedHeaders(...headersArray) {
20
- const result = {};
21
- for (const [key, value] of headersArray
22
- .filter((headers) => headers != null)
23
- .flatMap((headers) => Object.entries(headers))) {
24
- if (value != null) {
25
- result[key] = value;
26
- }
27
- }
28
- return result;
29
- }
@@ -1,6 +0,0 @@
1
- export * from "./fetcher/index.js";
2
- export * from "./runtime/index.js";
3
- export * as url from "./url/index.js";
4
- export * from "./websocket/index.js";
5
- export * from "./auth/index.js";
6
- export * from "./base64.js";
@@ -1,45 +0,0 @@
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
19
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
20
- };
21
- var __importStar = (this && this.__importStar) || (function () {
22
- var ownKeys = function(o) {
23
- ownKeys = Object.getOwnPropertyNames || function (o) {
24
- var ar = [];
25
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
- return ar;
27
- };
28
- return ownKeys(o);
29
- };
30
- return function (mod) {
31
- if (mod && mod.__esModule) return mod;
32
- var result = {};
33
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
- __setModuleDefault(result, mod);
35
- return result;
36
- };
37
- })();
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.url = void 0;
40
- __exportStar(require("./fetcher/index.js"), exports);
41
- __exportStar(require("./runtime/index.js"), exports);
42
- exports.url = __importStar(require("./url/index.js"));
43
- __exportStar(require("./websocket/index.js"), exports);
44
- __exportStar(require("./auth/index.js"), exports);
45
- __exportStar(require("./base64.js"), exports);
@@ -1,15 +0,0 @@
1
- /**
2
- * Serialize a value to JSON
3
- * @param value A JavaScript value, usually an object or array, to be converted.
4
- * @param replacer A function that transforms the results.
5
- * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.
6
- * @returns JSON string
7
- */
8
- export declare const toJson: (value: unknown, replacer?: (this: unknown, key: string, value: unknown) => unknown, space?: string | number) => string;
9
- /**
10
- * Parse JSON string to object, array, or other type
11
- * @param text A valid JSON string.
12
- * @param reviver A function that transforms the results. This function is called for each member of the object. If a member contains nested objects, the nested objects are transformed before the parent object is.
13
- * @returns Parsed object, array, or other type
14
- */
15
- export declare function fromJson<T = unknown>(text: string, reviver?: (this: unknown, key: string, value: unknown) => unknown): T;
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toJson = void 0;
4
- exports.fromJson = fromJson;
5
- /**
6
- * Serialize a value to JSON
7
- * @param value A JavaScript value, usually an object or array, to be converted.
8
- * @param replacer A function that transforms the results.
9
- * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.
10
- * @returns JSON string
11
- */
12
- const toJson = (value, replacer, space) => {
13
- return JSON.stringify(value, replacer, space);
14
- };
15
- exports.toJson = toJson;
16
- /**
17
- * Parse JSON string to object, array, or other type
18
- * @param text A valid JSON string.
19
- * @param reviver A function that transforms the results. This function is called for each member of the object. If a member contains nested objects, the nested objects are transformed before the parent object is.
20
- * @returns Parsed object, array, or other type
21
- */
22
- function fromJson(text, reviver) {
23
- return JSON.parse(text, reviver);
24
- }
@@ -1 +0,0 @@
1
- export { RUNTIME } from "./runtime.js";
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RUNTIME = void 0;
4
- var runtime_js_1 = require("./runtime.js");
5
- Object.defineProperty(exports, "RUNTIME", { enumerable: true, get: function () { return runtime_js_1.RUNTIME; } });
@@ -1,9 +0,0 @@
1
- /**
2
- * A constant that indicates which environment and version the SDK is running in.
3
- */
4
- export declare const RUNTIME: Runtime;
5
- export interface Runtime {
6
- type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd" | "edge-runtime";
7
- version?: string;
8
- parsedVersion?: number;
9
- }
@@ -1,102 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RUNTIME = void 0;
4
- /**
5
- * A constant that indicates which environment and version the SDK is running in.
6
- */
7
- exports.RUNTIME = evaluateRuntime();
8
- function evaluateRuntime() {
9
- var _a, _b, _c, _d, _e;
10
- /**
11
- * A constant that indicates whether the environment the code is running is a Web Browser.
12
- */
13
- const isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined";
14
- if (isBrowser) {
15
- return {
16
- type: "browser",
17
- version: window.navigator.userAgent,
18
- };
19
- }
20
- /**
21
- * A constant that indicates whether the environment the code is running is Cloudflare.
22
- * https://developers.cloudflare.com/workers/runtime-apis/web-standards/#navigatoruseragent
23
- */
24
- const isCloudflare = typeof globalThis !== "undefined" && ((_a = globalThis === null || globalThis === void 0 ? void 0 : globalThis.navigator) === null || _a === void 0 ? void 0 : _a.userAgent) === "Cloudflare-Workers";
25
- if (isCloudflare) {
26
- return {
27
- type: "workerd",
28
- };
29
- }
30
- /**
31
- * A constant that indicates whether the environment the code is running is Edge Runtime.
32
- * https://vercel.com/docs/functions/runtimes/edge-runtime#check-if-you're-running-on-the-edge-runtime
33
- */
34
- const isEdgeRuntime = typeof EdgeRuntime === "string";
35
- if (isEdgeRuntime) {
36
- return {
37
- type: "edge-runtime",
38
- };
39
- }
40
- /**
41
- * A constant that indicates whether the environment the code is running is a Web Worker.
42
- */
43
- const isWebWorker = typeof self === "object" &&
44
- typeof (self === null || self === void 0 ? void 0 : self.importScripts) === "function" &&
45
- (((_b = self.constructor) === null || _b === void 0 ? void 0 : _b.name) === "DedicatedWorkerGlobalScope" ||
46
- ((_c = self.constructor) === null || _c === void 0 ? void 0 : _c.name) === "ServiceWorkerGlobalScope" ||
47
- ((_d = self.constructor) === null || _d === void 0 ? void 0 : _d.name) === "SharedWorkerGlobalScope");
48
- if (isWebWorker) {
49
- return {
50
- type: "web-worker",
51
- };
52
- }
53
- /**
54
- * A constant that indicates whether the environment the code is running is Deno.
55
- * FYI Deno spoofs process.versions.node, see https://deno.land/std@0.177.0/node/process.ts?s=versions
56
- */
57
- const isDeno = typeof Deno !== "undefined" && typeof Deno.version !== "undefined" && typeof Deno.version.deno !== "undefined";
58
- if (isDeno) {
59
- return {
60
- type: "deno",
61
- version: Deno.version.deno,
62
- };
63
- }
64
- /**
65
- * A constant that indicates whether the environment the code is running is Bun.sh.
66
- */
67
- const isBun = typeof Bun !== "undefined" && typeof Bun.version !== "undefined";
68
- if (isBun) {
69
- return {
70
- type: "bun",
71
- version: Bun.version,
72
- };
73
- }
74
- /**
75
- * A constant that indicates whether the environment the code is running is Node.JS.
76
- */
77
- const isNode = typeof process !== "undefined" &&
78
- "version" in process &&
79
- !!process.version &&
80
- "versions" in process &&
81
- !!((_e = process.versions) === null || _e === void 0 ? void 0 : _e.node);
82
- if (isNode) {
83
- return {
84
- type: "node",
85
- version: process.versions.node,
86
- parsedVersion: Number(process.versions.node.split(".")[0]),
87
- };
88
- }
89
- /**
90
- * A constant that indicates whether the environment the code is running is in React-Native.
91
- * https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Core/setUpNavigator.js
92
- */
93
- const isReactNative = typeof navigator !== "undefined" && (navigator === null || navigator === void 0 ? void 0 : navigator.product) === "ReactNative";
94
- if (isReactNative) {
95
- return {
96
- type: "react-native",
97
- };
98
- }
99
- return {
100
- type: "unknown",
101
- };
102
- }
@@ -1,2 +0,0 @@
1
- export { join } from "./join.js";
2
- export { toQueryString } from "./qs.js";
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toQueryString = exports.join = void 0;
4
- var join_js_1 = require("./join.js");
5
- Object.defineProperty(exports, "join", { enumerable: true, get: function () { return join_js_1.join; } });
6
- var qs_js_1 = require("./qs.js");
7
- Object.defineProperty(exports, "toQueryString", { enumerable: true, get: function () { return qs_js_1.toQueryString; } });
@@ -1 +0,0 @@
1
- export declare function join(base: string, ...segments: string[]): string;
@@ -1,69 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.join = join;
4
- function join(base, ...segments) {
5
- if (!base) {
6
- return "";
7
- }
8
- if (segments.length === 0) {
9
- return base;
10
- }
11
- if (base.includes("://")) {
12
- let url;
13
- try {
14
- url = new URL(base);
15
- }
16
- catch (_a) {
17
- // Fallback to path joining if URL is malformed
18
- return joinPath(base, ...segments);
19
- }
20
- const lastSegment = segments[segments.length - 1];
21
- const shouldPreserveTrailingSlash = lastSegment && lastSegment.endsWith("/");
22
- for (const segment of segments) {
23
- const cleanSegment = trimSlashes(segment);
24
- if (cleanSegment) {
25
- url.pathname = joinPathSegments(url.pathname, cleanSegment);
26
- }
27
- }
28
- if (shouldPreserveTrailingSlash && !url.pathname.endsWith("/")) {
29
- url.pathname += "/";
30
- }
31
- return url.toString();
32
- }
33
- return joinPath(base, ...segments);
34
- }
35
- function joinPath(base, ...segments) {
36
- if (segments.length === 0) {
37
- return base;
38
- }
39
- let result = base;
40
- const lastSegment = segments[segments.length - 1];
41
- const shouldPreserveTrailingSlash = lastSegment && lastSegment.endsWith("/");
42
- for (const segment of segments) {
43
- const cleanSegment = trimSlashes(segment);
44
- if (cleanSegment) {
45
- result = joinPathSegments(result, cleanSegment);
46
- }
47
- }
48
- if (shouldPreserveTrailingSlash && !result.endsWith("/")) {
49
- result += "/";
50
- }
51
- return result;
52
- }
53
- function joinPathSegments(left, right) {
54
- if (left.endsWith("/")) {
55
- return left + right;
56
- }
57
- return left + "/" + right;
58
- }
59
- function trimSlashes(str) {
60
- if (!str)
61
- return str;
62
- let start = 0;
63
- let end = str.length;
64
- if (str.startsWith("/"))
65
- start = 1;
66
- if (str.endsWith("/"))
67
- end = str.length - 1;
68
- return start === 0 && end === str.length ? str : str.slice(start, end);
69
- }
@@ -1,6 +0,0 @@
1
- interface QueryStringOptions {
2
- arrayFormat?: "indices" | "repeat";
3
- encode?: boolean;
4
- }
5
- export declare function toQueryString(obj: unknown, options?: QueryStringOptions): string;
6
- export {};
@@ -1,64 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toQueryString = toQueryString;
4
- const defaultQsOptions = {
5
- arrayFormat: "indices",
6
- encode: true,
7
- };
8
- function encodeValue(value, shouldEncode) {
9
- if (value === undefined) {
10
- return "";
11
- }
12
- if (value === null) {
13
- return "";
14
- }
15
- const stringValue = String(value);
16
- return shouldEncode ? encodeURIComponent(stringValue) : stringValue;
17
- }
18
- function stringifyObject(obj, prefix = "", options) {
19
- const parts = [];
20
- for (const [key, value] of Object.entries(obj)) {
21
- const fullKey = prefix ? `${prefix}[${key}]` : key;
22
- if (value === undefined) {
23
- continue;
24
- }
25
- if (Array.isArray(value)) {
26
- if (value.length === 0) {
27
- continue;
28
- }
29
- for (let i = 0; i < value.length; i++) {
30
- const item = value[i];
31
- if (item === undefined) {
32
- continue;
33
- }
34
- if (typeof item === "object" && !Array.isArray(item) && item !== null) {
35
- const arrayKey = options.arrayFormat === "indices" ? `${fullKey}[${i}]` : fullKey;
36
- parts.push(...stringifyObject(item, arrayKey, options));
37
- }
38
- else {
39
- const arrayKey = options.arrayFormat === "indices" ? `${fullKey}[${i}]` : fullKey;
40
- const encodedKey = options.encode ? encodeURIComponent(arrayKey) : arrayKey;
41
- parts.push(`${encodedKey}=${encodeValue(item, options.encode)}`);
42
- }
43
- }
44
- }
45
- else if (typeof value === "object" && value !== null) {
46
- if (Object.keys(value).length === 0) {
47
- continue;
48
- }
49
- parts.push(...stringifyObject(value, fullKey, options));
50
- }
51
- else {
52
- const encodedKey = options.encode ? encodeURIComponent(fullKey) : fullKey;
53
- parts.push(`${encodedKey}=${encodeValue(value, options.encode)}`);
54
- }
55
- }
56
- return parts;
57
- }
58
- function toQueryString(obj, options) {
59
- if (obj == null || typeof obj !== "object") {
60
- return "";
61
- }
62
- const parts = stringifyObject(obj, "", Object.assign(Object.assign({}, defaultQsOptions), options));
63
- return parts.join("&");
64
- }
@@ -1,36 +0,0 @@
1
- export declare class Event {
2
- target: any;
3
- type: string;
4
- constructor(type: string, target: any);
5
- }
6
- export declare class ErrorEvent extends Event {
7
- message: string;
8
- error: Error;
9
- constructor(error: Error, target: any);
10
- }
11
- export declare class CloseEvent extends Event {
12
- code: number;
13
- reason: string;
14
- wasClean: boolean;
15
- constructor(code: number | undefined, reason: string | undefined, target: any);
16
- }
17
- export interface WebSocketEventMap {
18
- close: CloseEvent;
19
- error: ErrorEvent;
20
- message: MessageEvent;
21
- open: Event;
22
- }
23
- export interface WebSocketEventListenerMap {
24
- close: (event: CloseEvent) => void | {
25
- handleEvent: (event: CloseEvent) => void;
26
- };
27
- error: (event: ErrorEvent) => void | {
28
- handleEvent: (event: ErrorEvent) => void;
29
- };
30
- message: (event: MessageEvent) => void | {
31
- handleEvent: (event: MessageEvent) => void;
32
- };
33
- open: (event: Event) => void | {
34
- handleEvent: (event: Event) => void;
35
- };
36
- }
@@ -1,27 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CloseEvent = exports.ErrorEvent = exports.Event = void 0;
4
- class Event {
5
- constructor(type, target) {
6
- this.target = target;
7
- this.type = type;
8
- }
9
- }
10
- exports.Event = Event;
11
- class ErrorEvent extends Event {
12
- constructor(error, target) {
13
- super("error", target);
14
- this.message = error.message;
15
- this.error = error;
16
- }
17
- }
18
- exports.ErrorEvent = ErrorEvent;
19
- class CloseEvent extends Event {
20
- constructor(code = 1000, reason = "", target) {
21
- super("close", target);
22
- this.wasClean = true;
23
- this.code = code;
24
- this.reason = reason;
25
- }
26
- }
27
- exports.CloseEvent = CloseEvent;
@@ -1 +0,0 @@
1
- export * from "./ws.js";
@@ -1,17 +0,0 @@
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
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./ws.js"), exports);