@schedulin/sdk 0.1.2 → 0.2.0

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 (290) hide show
  1. package/README.md +45 -0
  2. package/cjs/BaseClient.d.ts +12 -0
  3. package/cjs/Client.d.ts +9 -0
  4. package/cjs/Client.js +23 -8
  5. package/cjs/api/errors/InternalServerError.d.ts +1 -0
  6. package/cjs/api/errors/UnauthorizedError.d.ts +1 -0
  7. package/cjs/api/resources/ai/client/Client.d.ts +49 -0
  8. package/cjs/api/resources/ai/client/Client.js +181 -0
  9. package/cjs/api/resources/ai/client/index.d.ts +1 -0
  10. package/cjs/api/resources/ai/client/index.js +17 -0
  11. package/cjs/api/resources/ai/client/requests/GenerateImageAiRequest.d.ts +20 -0
  12. package/cjs/api/resources/ai/client/requests/GenerateImageAiRequest.js +12 -0
  13. package/cjs/api/resources/{posts/client/requests/GetJobStatusPostsRequest.d.ts → ai/client/requests/GetGenerationAiRequest.d.ts} +1 -1
  14. package/cjs/api/resources/ai/client/requests/index.d.ts +2 -0
  15. package/cjs/api/resources/ai/client/requests/index.js +5 -0
  16. package/cjs/api/resources/ai/exports.d.ts +2 -0
  17. package/cjs/api/resources/ai/exports.js +21 -0
  18. package/cjs/api/resources/ai/index.d.ts +1 -0
  19. package/cjs/api/resources/ai/index.js +17 -0
  20. package/cjs/api/resources/index.d.ts +6 -0
  21. package/cjs/api/resources/index.js +7 -1
  22. package/cjs/api/resources/media/client/Client.d.ts +83 -0
  23. package/cjs/api/resources/media/client/Client.js +260 -3
  24. package/cjs/api/resources/media/client/requests/CreateFromUrlMediaRequest.d.ts +12 -0
  25. package/cjs/api/resources/media/client/requests/CreateFromUrlMediaRequest.js +3 -0
  26. package/cjs/api/resources/media/client/requests/CreateUploadLinkMediaRequest.d.ts +7 -0
  27. package/cjs/api/resources/media/client/requests/CreateUploadLinkMediaRequest.js +3 -0
  28. package/{esm/api/resources/posts/client/requests/GetJobStatusPostsRequest.d.mts → cjs/api/resources/media/client/requests/DeleteMediaRequest.d.ts} +1 -1
  29. package/cjs/api/resources/media/client/requests/DeleteMediaRequest.js +3 -0
  30. package/cjs/api/resources/media/client/requests/UploadMediaRequest.d.ts +13 -0
  31. package/cjs/api/resources/media/client/requests/UploadMediaRequest.js +3 -0
  32. package/cjs/api/resources/media/client/requests/index.d.ts +4 -0
  33. package/cjs/api/resources/platforms/client/Client.d.ts +28 -0
  34. package/cjs/api/resources/platforms/client/Client.js +111 -0
  35. package/cjs/api/resources/platforms/client/index.d.ts +1 -0
  36. package/cjs/api/resources/platforms/client/index.js +2 -0
  37. package/cjs/api/resources/platforms/exports.d.ts +2 -0
  38. package/cjs/api/resources/platforms/exports.js +21 -0
  39. package/cjs/api/resources/platforms/index.d.ts +2 -0
  40. package/cjs/api/resources/platforms/index.js +18 -0
  41. package/cjs/api/resources/platforms/types/ListPlatformsResponse.d.ts +56 -0
  42. package/cjs/api/resources/platforms/types/ListPlatformsResponse.js +24 -0
  43. package/cjs/api/resources/platforms/types/index.d.ts +1 -0
  44. package/cjs/api/resources/platforms/types/index.js +17 -0
  45. package/cjs/api/resources/posts/client/Client.d.ts +21 -17
  46. package/cjs/api/resources/posts/client/Client.js +29 -61
  47. package/cjs/api/resources/posts/client/requests/ListPostsRequest.d.ts +1 -0
  48. package/cjs/api/resources/posts/client/requests/PostCreate.d.ts +64 -0
  49. package/cjs/api/resources/posts/client/requests/PostCreate.js +63 -0
  50. package/cjs/api/resources/posts/client/requests/index.d.ts +0 -1
  51. package/cjs/api/resources/posts/types/CreatePostsResponse.d.ts +21 -0
  52. package/cjs/api/resources/posts/types/CreatePostsResponse.js +21 -0
  53. package/cjs/api/resources/posts/types/ListPostsRequestStatusesItem.d.ts +8 -0
  54. package/cjs/api/resources/posts/types/ListPostsRequestStatusesItem.js +11 -0
  55. package/cjs/api/resources/posts/types/index.d.ts +1 -0
  56. package/cjs/api/resources/posts/types/index.js +1 -0
  57. package/cjs/api/resources/socialAccounts/client/Client.d.ts +67 -0
  58. package/cjs/api/resources/socialAccounts/client/Client.js +209 -3
  59. package/cjs/api/resources/socialAccounts/client/requests/ListWhopCompaniesSocialAccountsRequest.d.ts +9 -0
  60. package/cjs/api/resources/socialAccounts/client/requests/ListWhopCompaniesSocialAccountsRequest.js +3 -0
  61. package/cjs/api/resources/socialAccounts/client/requests/ListWhopForumsSocialAccountsRequest.d.ts +11 -0
  62. package/cjs/api/resources/socialAccounts/client/requests/ListWhopForumsSocialAccountsRequest.js +3 -0
  63. package/cjs/api/resources/socialAccounts/client/requests/NextSlotsSocialAccountsRequest.d.ts +11 -0
  64. package/cjs/api/resources/socialAccounts/client/requests/NextSlotsSocialAccountsRequest.js +3 -0
  65. package/cjs/api/resources/socialAccounts/client/requests/index.d.ts +3 -0
  66. package/cjs/api/resources/socialAccounts/types/ListSocialAccountsResponse.d.ts +22 -0
  67. package/cjs/api/resources/socialAccounts/types/ListSocialAccountsResponse.js +21 -0
  68. package/cjs/api/resources/socialAccounts/types/ListWhopCompaniesSocialAccountsResponse.d.ts +12 -0
  69. package/cjs/api/resources/socialAccounts/types/ListWhopCompaniesSocialAccountsResponse.js +3 -0
  70. package/cjs/api/resources/socialAccounts/types/ListWhopForumsSocialAccountsResponse.d.ts +12 -0
  71. package/cjs/api/resources/socialAccounts/types/ListWhopForumsSocialAccountsResponse.js +3 -0
  72. package/cjs/api/resources/socialAccounts/types/NextSlotsSocialAccountsResponse.d.ts +3 -0
  73. package/cjs/api/resources/socialAccounts/types/NextSlotsSocialAccountsResponse.js +3 -0
  74. package/cjs/api/resources/socialAccounts/types/index.d.ts +3 -0
  75. package/cjs/api/resources/socialAccounts/types/index.js +3 -0
  76. package/cjs/api/resources/tags/client/Client.d.ts +8 -0
  77. package/cjs/api/resources/tags/client/Client.js +12 -3
  78. package/cjs/api/resources/webhooks/client/Client.d.ts +155 -0
  79. package/cjs/api/resources/webhooks/client/Client.js +538 -0
  80. package/cjs/api/resources/webhooks/client/index.d.ts +1 -0
  81. package/cjs/api/resources/webhooks/client/index.js +17 -0
  82. package/cjs/api/resources/webhooks/client/requests/CreateWebhooksRequest.d.ts +24 -0
  83. package/cjs/api/resources/webhooks/client/requests/CreateWebhooksRequest.js +16 -0
  84. package/cjs/api/resources/webhooks/client/requests/DeleteWebhooksRequest.d.ts +9 -0
  85. package/cjs/api/resources/webhooks/client/requests/DeleteWebhooksRequest.js +3 -0
  86. package/cjs/api/resources/webhooks/client/requests/ListDeliveriesWebhooksRequest.d.ts +11 -0
  87. package/cjs/api/resources/webhooks/client/requests/ListDeliveriesWebhooksRequest.js +3 -0
  88. package/cjs/api/resources/webhooks/client/requests/RetrieveWebhooksRequest.d.ts +9 -0
  89. package/cjs/api/resources/webhooks/client/requests/RetrieveWebhooksRequest.js +3 -0
  90. package/cjs/api/resources/webhooks/client/requests/RotateSecretWebhooksRequest.d.ts +9 -0
  91. package/cjs/api/resources/webhooks/client/requests/RotateSecretWebhooksRequest.js +3 -0
  92. package/cjs/api/resources/webhooks/client/requests/TestWebhooksRequest.d.ts +9 -0
  93. package/cjs/api/resources/webhooks/client/requests/TestWebhooksRequest.js +3 -0
  94. package/cjs/api/resources/webhooks/client/requests/UpdateWebhooksRequest.d.ts +25 -0
  95. package/cjs/api/resources/webhooks/client/requests/UpdateWebhooksRequest.js +16 -0
  96. package/cjs/api/resources/webhooks/client/requests/index.d.ts +7 -0
  97. package/cjs/api/resources/webhooks/client/requests/index.js +7 -0
  98. package/cjs/api/resources/webhooks/exports.d.ts +2 -0
  99. package/cjs/api/resources/webhooks/exports.js +21 -0
  100. package/cjs/api/resources/webhooks/index.d.ts +1 -0
  101. package/cjs/api/resources/webhooks/index.js +17 -0
  102. package/cjs/api/types/OauthScope.d.ts +12 -0
  103. package/cjs/api/types/OauthScope.js +12 -0
  104. package/cjs/api/types/PostSearch.d.ts +12 -0
  105. package/cjs/api/types/PostSearch.js +10 -0
  106. package/cjs/api/types/PostWithRelations.d.ts +21 -0
  107. package/cjs/api/types/PostWithRelations.js +21 -0
  108. package/cjs/api/types/SocialAccountDisconnectedReason.d.ts +1 -0
  109. package/cjs/api/types/SocialAccountDisconnectedReason.js +1 -0
  110. package/cjs/api/types/SocialPlatform.d.ts +21 -0
  111. package/cjs/api/types/SocialPlatform.js +21 -0
  112. package/cjs/core/exports.d.ts +1 -0
  113. package/cjs/core/exports.js +1 -0
  114. package/cjs/core/fetcher/Fetcher.js +9 -92
  115. package/cjs/core/fetcher/makePassthroughRequest.js +26 -4
  116. package/cjs/core/fetcher/redactUrl.d.ts +2 -0
  117. package/cjs/core/fetcher/redactUrl.js +88 -0
  118. package/cjs/core/file/exports.d.ts +1 -0
  119. package/cjs/core/file/exports.js +2 -0
  120. package/cjs/core/file/file.d.ts +10 -0
  121. package/cjs/core/file/file.js +225 -0
  122. package/cjs/core/file/index.d.ts +2 -0
  123. package/cjs/core/file/index.js +18 -0
  124. package/cjs/core/file/types.d.ts +66 -0
  125. package/cjs/core/file/types.js +2 -0
  126. package/cjs/core/form-data-utils/FormDataWrapper.d.ts +15 -0
  127. package/cjs/core/form-data-utils/FormDataWrapper.js +188 -0
  128. package/cjs/core/form-data-utils/encodeAsFormParameter.d.ts +1 -0
  129. package/cjs/core/form-data-utils/encodeAsFormParameter.js +12 -0
  130. package/cjs/core/form-data-utils/index.d.ts +2 -0
  131. package/cjs/core/form-data-utils/index.js +20 -0
  132. package/cjs/core/index.d.ts +2 -0
  133. package/cjs/core/index.js +3 -1
  134. package/cjs/core/requestBody.d.ts +12 -0
  135. package/cjs/core/requestBody.js +26 -0
  136. package/cjs/core/runtime/index.d.ts +1 -1
  137. package/cjs/core/runtime/index.js +2 -1
  138. package/cjs/core/runtime/runtime.d.ts +19 -0
  139. package/cjs/core/runtime/runtime.js +74 -2
  140. package/cjs/core/url/qs.js +2 -2
  141. package/cjs/errors/SchedulinError.d.ts +1 -0
  142. package/cjs/errors/SchedulinError.js +4 -0
  143. package/cjs/errors/SchedulinTimeoutError.d.ts +2 -2
  144. package/cjs/errors/SchedulinTimeoutError.js +39 -5
  145. package/esm/BaseClient.d.mts +12 -0
  146. package/esm/Client.d.mts +9 -0
  147. package/esm/Client.mjs +15 -0
  148. package/esm/api/errors/InternalServerError.d.mts +1 -0
  149. package/esm/api/errors/UnauthorizedError.d.mts +1 -0
  150. package/esm/api/resources/ai/client/Client.d.mts +49 -0
  151. package/esm/api/resources/ai/client/Client.mjs +144 -0
  152. package/esm/api/resources/ai/client/index.d.mts +1 -0
  153. package/esm/api/resources/ai/client/index.mjs +1 -0
  154. package/esm/api/resources/ai/client/requests/GenerateImageAiRequest.d.mts +20 -0
  155. package/esm/api/resources/ai/client/requests/GenerateImageAiRequest.mjs +9 -0
  156. package/esm/api/resources/ai/client/requests/GetGenerationAiRequest.d.mts +9 -0
  157. package/esm/api/resources/ai/client/requests/index.d.mts +2 -0
  158. package/esm/api/resources/ai/client/requests/index.mjs +1 -0
  159. package/esm/api/resources/ai/exports.d.mts +2 -0
  160. package/esm/api/resources/ai/exports.mjs +3 -0
  161. package/esm/api/resources/ai/index.d.mts +1 -0
  162. package/esm/api/resources/ai/index.mjs +1 -0
  163. package/esm/api/resources/index.d.mts +6 -0
  164. package/esm/api/resources/index.mjs +6 -0
  165. package/esm/api/resources/media/client/Client.d.mts +83 -0
  166. package/esm/api/resources/media/client/Client.mjs +261 -4
  167. package/esm/api/resources/media/client/requests/CreateFromUrlMediaRequest.d.mts +12 -0
  168. package/esm/api/resources/media/client/requests/CreateFromUrlMediaRequest.mjs +2 -0
  169. package/esm/api/resources/media/client/requests/CreateUploadLinkMediaRequest.d.mts +7 -0
  170. package/esm/api/resources/media/client/requests/CreateUploadLinkMediaRequest.mjs +2 -0
  171. package/esm/api/resources/media/client/requests/DeleteMediaRequest.d.mts +9 -0
  172. package/esm/api/resources/media/client/requests/DeleteMediaRequest.mjs +2 -0
  173. package/esm/api/resources/media/client/requests/UploadMediaRequest.d.mts +13 -0
  174. package/esm/api/resources/media/client/requests/UploadMediaRequest.mjs +2 -0
  175. package/esm/api/resources/media/client/requests/index.d.mts +4 -0
  176. package/esm/api/resources/platforms/client/Client.d.mts +28 -0
  177. package/esm/api/resources/platforms/client/Client.mjs +74 -0
  178. package/esm/api/resources/platforms/client/index.d.mts +1 -0
  179. package/esm/api/resources/platforms/client/index.mjs +1 -0
  180. package/esm/api/resources/platforms/exports.d.mts +2 -0
  181. package/esm/api/resources/platforms/exports.mjs +3 -0
  182. package/esm/api/resources/platforms/index.d.mts +2 -0
  183. package/esm/api/resources/platforms/index.mjs +2 -0
  184. package/esm/api/resources/platforms/types/ListPlatformsResponse.d.mts +56 -0
  185. package/esm/api/resources/platforms/types/ListPlatformsResponse.mjs +21 -0
  186. package/esm/api/resources/platforms/types/index.d.mts +1 -0
  187. package/esm/api/resources/platforms/types/index.mjs +1 -0
  188. package/esm/api/resources/posts/client/Client.d.mts +21 -17
  189. package/esm/api/resources/posts/client/Client.mjs +29 -61
  190. package/esm/api/resources/posts/client/requests/ListPostsRequest.d.mts +1 -0
  191. package/esm/api/resources/posts/client/requests/PostCreate.d.mts +64 -0
  192. package/esm/api/resources/posts/client/requests/PostCreate.mjs +63 -0
  193. package/esm/api/resources/posts/client/requests/index.d.mts +0 -1
  194. package/esm/api/resources/posts/types/CreatePostsResponse.d.mts +21 -0
  195. package/esm/api/resources/posts/types/CreatePostsResponse.mjs +21 -0
  196. package/esm/api/resources/posts/types/ListPostsRequestStatusesItem.d.mts +8 -0
  197. package/esm/api/resources/posts/types/ListPostsRequestStatusesItem.mjs +8 -0
  198. package/esm/api/resources/posts/types/index.d.mts +1 -0
  199. package/esm/api/resources/posts/types/index.mjs +1 -0
  200. package/esm/api/resources/socialAccounts/client/Client.d.mts +67 -0
  201. package/esm/api/resources/socialAccounts/client/Client.mjs +209 -3
  202. package/esm/api/resources/socialAccounts/client/requests/ListWhopCompaniesSocialAccountsRequest.d.mts +9 -0
  203. package/esm/api/resources/socialAccounts/client/requests/ListWhopCompaniesSocialAccountsRequest.mjs +2 -0
  204. package/esm/api/resources/socialAccounts/client/requests/ListWhopForumsSocialAccountsRequest.d.mts +11 -0
  205. package/esm/api/resources/socialAccounts/client/requests/ListWhopForumsSocialAccountsRequest.mjs +2 -0
  206. package/esm/api/resources/socialAccounts/client/requests/NextSlotsSocialAccountsRequest.d.mts +11 -0
  207. package/esm/api/resources/socialAccounts/client/requests/NextSlotsSocialAccountsRequest.mjs +2 -0
  208. package/esm/api/resources/socialAccounts/client/requests/index.d.mts +3 -0
  209. package/esm/api/resources/socialAccounts/types/ListSocialAccountsResponse.d.mts +22 -0
  210. package/esm/api/resources/socialAccounts/types/ListSocialAccountsResponse.mjs +21 -0
  211. package/esm/api/resources/socialAccounts/types/ListWhopCompaniesSocialAccountsResponse.d.mts +12 -0
  212. package/esm/api/resources/socialAccounts/types/ListWhopCompaniesSocialAccountsResponse.mjs +2 -0
  213. package/esm/api/resources/socialAccounts/types/ListWhopForumsSocialAccountsResponse.d.mts +12 -0
  214. package/esm/api/resources/socialAccounts/types/ListWhopForumsSocialAccountsResponse.mjs +2 -0
  215. package/esm/api/resources/socialAccounts/types/NextSlotsSocialAccountsResponse.d.mts +3 -0
  216. package/esm/api/resources/socialAccounts/types/NextSlotsSocialAccountsResponse.mjs +2 -0
  217. package/esm/api/resources/socialAccounts/types/index.d.mts +3 -0
  218. package/esm/api/resources/socialAccounts/types/index.mjs +3 -0
  219. package/esm/api/resources/tags/client/Client.d.mts +8 -0
  220. package/esm/api/resources/tags/client/Client.mjs +12 -3
  221. package/esm/api/resources/webhooks/client/Client.d.mts +155 -0
  222. package/esm/api/resources/webhooks/client/Client.mjs +501 -0
  223. package/esm/api/resources/webhooks/client/index.d.mts +1 -0
  224. package/esm/api/resources/webhooks/client/index.mjs +1 -0
  225. package/esm/api/resources/webhooks/client/requests/CreateWebhooksRequest.d.mts +24 -0
  226. package/esm/api/resources/webhooks/client/requests/CreateWebhooksRequest.mjs +13 -0
  227. package/esm/api/resources/webhooks/client/requests/DeleteWebhooksRequest.d.mts +9 -0
  228. package/esm/api/resources/webhooks/client/requests/DeleteWebhooksRequest.mjs +2 -0
  229. package/esm/api/resources/webhooks/client/requests/ListDeliveriesWebhooksRequest.d.mts +11 -0
  230. package/esm/api/resources/webhooks/client/requests/ListDeliveriesWebhooksRequest.mjs +2 -0
  231. package/esm/api/resources/webhooks/client/requests/RetrieveWebhooksRequest.d.mts +9 -0
  232. package/esm/api/resources/webhooks/client/requests/RetrieveWebhooksRequest.mjs +2 -0
  233. package/esm/api/resources/webhooks/client/requests/RotateSecretWebhooksRequest.d.mts +9 -0
  234. package/esm/api/resources/webhooks/client/requests/RotateSecretWebhooksRequest.mjs +2 -0
  235. package/esm/api/resources/webhooks/client/requests/TestWebhooksRequest.d.mts +9 -0
  236. package/esm/api/resources/webhooks/client/requests/TestWebhooksRequest.mjs +2 -0
  237. package/esm/api/resources/webhooks/client/requests/UpdateWebhooksRequest.d.mts +25 -0
  238. package/esm/api/resources/webhooks/client/requests/UpdateWebhooksRequest.mjs +13 -0
  239. package/esm/api/resources/webhooks/client/requests/index.d.mts +7 -0
  240. package/esm/api/resources/webhooks/client/requests/index.mjs +2 -0
  241. package/esm/api/resources/webhooks/exports.d.mts +2 -0
  242. package/esm/api/resources/webhooks/exports.mjs +3 -0
  243. package/esm/api/resources/webhooks/index.d.mts +1 -0
  244. package/esm/api/resources/webhooks/index.mjs +1 -0
  245. package/esm/api/types/OauthScope.d.mts +12 -0
  246. package/esm/api/types/OauthScope.mjs +12 -0
  247. package/esm/api/types/PostSearch.d.mts +12 -0
  248. package/esm/api/types/PostSearch.mjs +10 -0
  249. package/esm/api/types/PostWithRelations.d.mts +21 -0
  250. package/esm/api/types/PostWithRelations.mjs +21 -0
  251. package/esm/api/types/SocialAccountDisconnectedReason.d.mts +1 -0
  252. package/esm/api/types/SocialAccountDisconnectedReason.mjs +1 -0
  253. package/esm/api/types/SocialPlatform.d.mts +21 -0
  254. package/esm/api/types/SocialPlatform.mjs +21 -0
  255. package/esm/core/exports.d.mts +1 -0
  256. package/esm/core/exports.mjs +1 -0
  257. package/esm/core/fetcher/Fetcher.mjs +1 -84
  258. package/esm/core/fetcher/makePassthroughRequest.mjs +26 -4
  259. package/esm/core/fetcher/redactUrl.d.mts +2 -0
  260. package/esm/core/fetcher/redactUrl.mjs +84 -0
  261. package/esm/core/file/exports.d.mts +1 -0
  262. package/esm/core/file/exports.mjs +1 -0
  263. package/esm/core/file/file.d.mts +10 -0
  264. package/esm/core/file/file.mjs +188 -0
  265. package/esm/core/file/index.d.mts +2 -0
  266. package/esm/core/file/index.mjs +2 -0
  267. package/esm/core/file/types.d.mts +66 -0
  268. package/esm/core/file/types.mjs +1 -0
  269. package/esm/core/form-data-utils/FormDataWrapper.d.mts +15 -0
  270. package/esm/core/form-data-utils/FormDataWrapper.mjs +150 -0
  271. package/esm/core/form-data-utils/encodeAsFormParameter.d.mts +1 -0
  272. package/esm/core/form-data-utils/encodeAsFormParameter.mjs +9 -0
  273. package/esm/core/form-data-utils/index.d.mts +2 -0
  274. package/esm/core/form-data-utils/index.mjs +2 -0
  275. package/esm/core/index.d.mts +2 -0
  276. package/esm/core/index.mjs +2 -0
  277. package/esm/core/requestBody.d.mts +12 -0
  278. package/esm/core/requestBody.mjs +23 -0
  279. package/esm/core/runtime/index.d.mts +1 -1
  280. package/esm/core/runtime/index.mjs +1 -1
  281. package/esm/core/runtime/runtime.d.mts +19 -0
  282. package/esm/core/runtime/runtime.mjs +73 -2
  283. package/esm/core/url/qs.mjs +2 -2
  284. package/esm/errors/SchedulinError.d.mts +1 -0
  285. package/esm/errors/SchedulinError.mjs +4 -0
  286. package/esm/errors/SchedulinTimeoutError.d.mts +2 -2
  287. package/esm/errors/SchedulinTimeoutError.mjs +6 -5
  288. package/package.json +1 -1
  289. /package/cjs/api/resources/{posts/client/requests/GetJobStatusPostsRequest.js → ai/client/requests/GetGenerationAiRequest.js} +0 -0
  290. /package/esm/api/resources/{posts/client/requests/GetJobStatusPostsRequest.mjs → ai/client/requests/GetGenerationAiRequest.mjs} +0 -0
@@ -0,0 +1,84 @@
1
+ export const SENSITIVE_QUERY_PARAMS = new Set([
2
+ "api_key",
3
+ "api-key",
4
+ "apikey",
5
+ "token",
6
+ "access_token",
7
+ "access-token",
8
+ "auth_token",
9
+ "auth-token",
10
+ "password",
11
+ "passwd",
12
+ "secret",
13
+ "api_secret",
14
+ "api-secret",
15
+ "apisecret",
16
+ "key",
17
+ "session",
18
+ "session_id",
19
+ "session-id",
20
+ ]);
21
+ export function redactUrl(url) {
22
+ const protocolIndex = url.indexOf("://");
23
+ if (protocolIndex === -1)
24
+ return url;
25
+ const afterProtocol = protocolIndex + 3;
26
+ // Find the first delimiter that marks the end of the authority section
27
+ const pathStart = url.indexOf("/", afterProtocol);
28
+ let queryStart = url.indexOf("?", afterProtocol);
29
+ let fragmentStart = url.indexOf("#", afterProtocol);
30
+ const firstDelimiter = Math.min(pathStart === -1 ? url.length : pathStart, queryStart === -1 ? url.length : queryStart, fragmentStart === -1 ? url.length : fragmentStart);
31
+ // Find the LAST @ before the delimiter (handles multiple @ in credentials)
32
+ let atIndex = -1;
33
+ for (let i = afterProtocol; i < firstDelimiter; i++) {
34
+ if (url[i] === "@") {
35
+ atIndex = i;
36
+ }
37
+ }
38
+ if (atIndex !== -1) {
39
+ url = `${url.slice(0, afterProtocol)}[REDACTED]@${url.slice(atIndex + 1)}`;
40
+ }
41
+ // Recalculate queryStart since url might have changed
42
+ queryStart = url.indexOf("?");
43
+ if (queryStart === -1)
44
+ return url;
45
+ fragmentStart = url.indexOf("#", queryStart);
46
+ const queryEnd = fragmentStart !== -1 ? fragmentStart : url.length;
47
+ const queryString = url.slice(queryStart + 1, queryEnd);
48
+ if (queryString.length === 0)
49
+ return url;
50
+ // FAST PATH: Quick check if any sensitive keywords present
51
+ // Using indexOf is faster than regex for simple substring matching
52
+ const lower = queryString.toLowerCase();
53
+ const hasSensitive = lower.includes("token") ||
54
+ lower.includes("key") ||
55
+ lower.includes("password") ||
56
+ lower.includes("passwd") ||
57
+ lower.includes("secret") ||
58
+ lower.includes("session") ||
59
+ lower.includes("auth");
60
+ if (!hasSensitive) {
61
+ return url;
62
+ }
63
+ // SLOW PATH: Parse and redact
64
+ const redactedParams = [];
65
+ const params = queryString.split("&");
66
+ for (const param of params) {
67
+ const equalIndex = param.indexOf("=");
68
+ if (equalIndex === -1) {
69
+ redactedParams.push(param);
70
+ continue;
71
+ }
72
+ const key = param.slice(0, equalIndex);
73
+ let shouldRedact = SENSITIVE_QUERY_PARAMS.has(key.toLowerCase());
74
+ if (!shouldRedact && key.includes("%")) {
75
+ try {
76
+ const decodedKey = decodeURIComponent(key);
77
+ shouldRedact = SENSITIVE_QUERY_PARAMS.has(decodedKey.toLowerCase());
78
+ }
79
+ catch (_a) { }
80
+ }
81
+ redactedParams.push(shouldRedact ? `${key}=[REDACTED]` : param);
82
+ }
83
+ return url.slice(0, queryStart + 1) + redactedParams.join("&") + url.slice(queryEnd);
84
+ }
@@ -0,0 +1 @@
1
+ export type { Uploadable } from "./types.mjs";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ import type { Uploadable } from "./types.mjs";
2
+ export declare function toBinaryUploadRequest(file: Uploadable): Promise<{
3
+ body: Uploadable.FileLike;
4
+ headers?: Record<string, string>;
5
+ }>;
6
+ export declare function toMultipartDataPart(file: Uploadable): Promise<{
7
+ data: Uploadable.FileLike;
8
+ filename?: string;
9
+ contentType?: string;
10
+ }>;
@@ -0,0 +1,188 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ export function toBinaryUploadRequest(file) {
11
+ return __awaiter(this, void 0, void 0, function* () {
12
+ const { data, filename, contentLength, contentType } = yield getFileWithMetadata(file);
13
+ const request = {
14
+ body: data,
15
+ headers: {},
16
+ };
17
+ if (filename) {
18
+ request.headers["Content-Disposition"] = `attachment; filename="${filename}"`;
19
+ }
20
+ if (contentType) {
21
+ request.headers["Content-Type"] = contentType;
22
+ }
23
+ if (contentLength != null) {
24
+ request.headers["Content-Length"] = contentLength.toString();
25
+ }
26
+ return request;
27
+ });
28
+ }
29
+ export function toMultipartDataPart(file) {
30
+ return __awaiter(this, void 0, void 0, function* () {
31
+ const { data, filename, contentType } = yield getFileWithMetadata(file, {
32
+ noSniffFileSize: true,
33
+ });
34
+ return {
35
+ data,
36
+ filename,
37
+ contentType,
38
+ };
39
+ });
40
+ }
41
+ function getFileWithMetadata(file_1) {
42
+ return __awaiter(this, arguments, void 0, function* (file, { noSniffFileSize } = {}) {
43
+ var _a, _b, _c, _d, _e;
44
+ if (file == null) {
45
+ throw new Error(`Expected file to be a Blob, Buffer, ReadableStream, or an object with a "path" or "data" property, but received ${file === null ? "null" : "undefined"}.`);
46
+ }
47
+ if (isFileLike(file)) {
48
+ return getFileWithMetadata({
49
+ data: file,
50
+ }, { noSniffFileSize });
51
+ }
52
+ if ("path" in file) {
53
+ const fs = yield import("fs");
54
+ if (!(fs === null || fs === void 0 ? void 0 : fs.createReadStream)) {
55
+ throw new Error("File path uploads are not supported in this environment.");
56
+ }
57
+ const data = fs.createReadStream(file.path);
58
+ const contentLength = (_a = file.contentLength) !== null && _a !== void 0 ? _a : (noSniffFileSize === true ? undefined : yield tryGetFileSizeFromPath(file.path));
59
+ const filename = (_b = file.filename) !== null && _b !== void 0 ? _b : getNameFromPath(file.path);
60
+ return {
61
+ data,
62
+ filename,
63
+ contentType: file.contentType,
64
+ contentLength,
65
+ };
66
+ }
67
+ if ("data" in file) {
68
+ const data = file.data;
69
+ const contentLength = (_c = file.contentLength) !== null && _c !== void 0 ? _c : (yield tryGetContentLengthFromFileLike(data, {
70
+ noSniffFileSize,
71
+ }));
72
+ const filename = (_d = file.filename) !== null && _d !== void 0 ? _d : tryGetNameFromFileLike(data);
73
+ return {
74
+ data,
75
+ filename,
76
+ contentType: (_e = file.contentType) !== null && _e !== void 0 ? _e : tryGetContentTypeFromFileLike(data),
77
+ contentLength,
78
+ };
79
+ }
80
+ throw new Error(`Invalid FileUpload of type ${typeof file}: ${JSON.stringify(file)}`);
81
+ });
82
+ }
83
+ function isFileLike(value) {
84
+ return (isBuffer(value) ||
85
+ isArrayBufferView(value) ||
86
+ isArrayBuffer(value) ||
87
+ isUint8Array(value) ||
88
+ isBlob(value) ||
89
+ isFile(value) ||
90
+ isStreamLike(value) ||
91
+ isReadableStream(value));
92
+ }
93
+ function tryGetFileSizeFromPath(path) {
94
+ return __awaiter(this, void 0, void 0, function* () {
95
+ var _a;
96
+ try {
97
+ const fs = yield import("fs");
98
+ if (!((_a = fs === null || fs === void 0 ? void 0 : fs.promises) === null || _a === void 0 ? void 0 : _a.stat)) {
99
+ return undefined;
100
+ }
101
+ const fileStat = yield fs.promises.stat(path);
102
+ return fileStat.size;
103
+ }
104
+ catch (_fallbackError) {
105
+ return undefined;
106
+ }
107
+ });
108
+ }
109
+ function tryGetNameFromFileLike(data) {
110
+ if (isNamedValue(data)) {
111
+ return data.name;
112
+ }
113
+ if (isPathedValue(data)) {
114
+ return getNameFromPath(data.path.toString());
115
+ }
116
+ return undefined;
117
+ }
118
+ function tryGetContentLengthFromFileLike(data_1) {
119
+ return __awaiter(this, arguments, void 0, function* (data, { noSniffFileSize } = {}) {
120
+ if (isBuffer(data)) {
121
+ return data.length;
122
+ }
123
+ if (isArrayBufferView(data)) {
124
+ return data.byteLength;
125
+ }
126
+ if (isArrayBuffer(data)) {
127
+ return data.byteLength;
128
+ }
129
+ if (isBlob(data)) {
130
+ return data.size;
131
+ }
132
+ if (isFile(data)) {
133
+ return data.size;
134
+ }
135
+ if (noSniffFileSize === true) {
136
+ return undefined;
137
+ }
138
+ if (isPathedValue(data)) {
139
+ return yield tryGetFileSizeFromPath(data.path.toString());
140
+ }
141
+ return undefined;
142
+ });
143
+ }
144
+ function tryGetContentTypeFromFileLike(data) {
145
+ if (isBlob(data)) {
146
+ return data.type;
147
+ }
148
+ if (isFile(data)) {
149
+ return data.type;
150
+ }
151
+ return undefined;
152
+ }
153
+ function getNameFromPath(path) {
154
+ const lastForwardSlash = path.lastIndexOf("/");
155
+ const lastBackSlash = path.lastIndexOf("\\");
156
+ const lastSlashIndex = Math.max(lastForwardSlash, lastBackSlash);
157
+ return lastSlashIndex >= 0 ? path.substring(lastSlashIndex + 1) : path;
158
+ }
159
+ function isNamedValue(value) {
160
+ return typeof value === "object" && value != null && "name" in value;
161
+ }
162
+ function isPathedValue(value) {
163
+ return typeof value === "object" && value != null && "path" in value;
164
+ }
165
+ function isStreamLike(value) {
166
+ return typeof value === "object" && value != null && ("read" in value || "pipe" in value);
167
+ }
168
+ function isReadableStream(value) {
169
+ return typeof value === "object" && value != null && "getReader" in value;
170
+ }
171
+ function isBuffer(value) {
172
+ return typeof Buffer !== "undefined" && Buffer.isBuffer && Buffer.isBuffer(value);
173
+ }
174
+ function isArrayBufferView(value) {
175
+ return typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView(value);
176
+ }
177
+ function isArrayBuffer(value) {
178
+ return typeof ArrayBuffer !== "undefined" && value instanceof ArrayBuffer;
179
+ }
180
+ function isUint8Array(value) {
181
+ return typeof Uint8Array !== "undefined" && value instanceof Uint8Array;
182
+ }
183
+ function isBlob(value) {
184
+ return typeof Blob !== "undefined" && value instanceof Blob;
185
+ }
186
+ function isFile(value) {
187
+ return typeof File !== "undefined" && value instanceof File;
188
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./file.mjs";
2
+ export * from "./types.mjs";
@@ -0,0 +1,2 @@
1
+ export * from "./file.mjs";
2
+ export * from "./types.mjs";
@@ -0,0 +1,66 @@
1
+ /**
2
+ * A file that can be uploaded. Can be a file-like object (stream, buffer, blob, etc.),
3
+ * a path to a file, or an object with a file-like object and metadata.
4
+ */
5
+ export type Uploadable = Uploadable.FileLike | Uploadable.FromPath | Uploadable.WithMetadata;
6
+ export declare namespace Uploadable {
7
+ /**
8
+ * Various file-like objects that can be used to upload a file.
9
+ */
10
+ type FileLike = ArrayBuffer | ArrayBufferLike | ArrayBufferView | Uint8Array | import("buffer").Buffer | import("buffer").Blob | import("buffer").File | import("stream").Readable | import("stream/web").ReadableStream | globalThis.Blob | globalThis.File | ReadableStream;
11
+ /**
12
+ * A file path with optional metadata, used for uploading a file from the file system.
13
+ */
14
+ type FromPath = {
15
+ /** The path to the file to upload */
16
+ path: string;
17
+ /**
18
+ * Optional override for the file name (defaults to basename of path).
19
+ * This is used to set the `Content-Disposition` header in upload requests.
20
+ */
21
+ filename?: string;
22
+ /**
23
+ * Optional MIME type of the file (e.g., 'image/jpeg', 'text/plain').
24
+ * This is used to set the `Content-Type` header in upload requests.
25
+ */
26
+ contentType?: string;
27
+ /**
28
+ * Optional file size in bytes.
29
+ * If not provided, the file size will be determined from the file system.
30
+ * The content length is used to set the `Content-Length` header in upload requests.
31
+ */
32
+ contentLength?: number;
33
+ };
34
+ /**
35
+ * A file-like object with metadata, used for uploading files.
36
+ */
37
+ type WithMetadata = {
38
+ /** The file data */
39
+ data: FileLike;
40
+ /**
41
+ * Optional override for the file name (defaults to basename of path).
42
+ * This is used to set the `Content-Disposition` header in upload requests.
43
+ */
44
+ filename?: string;
45
+ /**
46
+ * Optional MIME type of the file (e.g., 'image/jpeg', 'text/plain').
47
+ * This is used to set the `Content-Type` header in upload requests.
48
+ *
49
+ * If not provided, the content type may be determined from the data itself.
50
+ * * If the data is a `File`, `Blob`, or similar, the content type will be determined from the file itself, if the type is set.
51
+ * * Any other data type will not have a content type set, and the upload request will use `Content-Type: application/octet-stream` instead.
52
+ */
53
+ contentType?: string;
54
+ /**
55
+ * Optional file size in bytes.
56
+ * The content length is used to set the `Content-Length` header in upload requests.
57
+ * If the content length is not provided and cannot be determined, the upload request will not include the `Content-Length` header, but will use `Transfer-Encoding: chunked` instead.
58
+ *
59
+ * If not provided, the file size will be determined depending on the data type.
60
+ * * If the data is of type `fs.ReadStream` (`createReadStream`), the size will be determined from the file system.
61
+ * * If the data is a `Buffer`, `ArrayBuffer`, `Uint8Array`, `Blob`, `File`, or similar, the size will be determined from the data itself.
62
+ * * If the data is a `Readable` or `ReadableStream`, the size will not be determined.
63
+ */
64
+ contentLength?: number;
65
+ };
66
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,15 @@
1
+ import { type Uploadable } from "../../core/file/index.mjs";
2
+ interface FormDataRequest<Body> {
3
+ body: Body;
4
+ headers: Record<string, string>;
5
+ duplex?: "half";
6
+ }
7
+ export declare function newFormData(): Promise<FormDataWrapper>;
8
+ export declare class FormDataWrapper {
9
+ private fd;
10
+ setup(): Promise<void>;
11
+ append(key: string, value: unknown): void;
12
+ appendFile(key: string, value: Uploadable): Promise<void>;
13
+ getRequest(): FormDataRequest<FormData>;
14
+ }
15
+ export {};
@@ -0,0 +1,150 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __asyncValues = (this && this.__asyncValues) || function (o) {
11
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
12
+ var m = o[Symbol.asyncIterator], i;
13
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
14
+ function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
15
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
16
+ };
17
+ import { toMultipartDataPart } from "../../core/file/index.mjs";
18
+ import { toJson } from "../../core/json.mjs";
19
+ import { RUNTIME } from "../runtime/index.mjs";
20
+ export function newFormData() {
21
+ return __awaiter(this, void 0, void 0, function* () {
22
+ return new FormDataWrapper();
23
+ });
24
+ }
25
+ export class FormDataWrapper {
26
+ constructor() {
27
+ this.fd = new FormData();
28
+ }
29
+ setup() {
30
+ return __awaiter(this, void 0, void 0, function* () {
31
+ // noop
32
+ });
33
+ }
34
+ append(key, value) {
35
+ this.fd.append(key, String(value));
36
+ }
37
+ appendFile(key, value) {
38
+ return __awaiter(this, void 0, void 0, function* () {
39
+ if (value == null) {
40
+ throw new Error(`File upload for "${key}" received ${value === null ? "null" : "undefined"}. The generated code should not call appendFile with null/undefined — check that optional file fields are guarded before this call.`);
41
+ }
42
+ const { data, filename, contentType } = yield toMultipartDataPart(value);
43
+ const blob = yield convertToBlob(data, contentType);
44
+ if (filename) {
45
+ this.fd.append(key, blob, filename);
46
+ }
47
+ else {
48
+ this.fd.append(key, blob);
49
+ }
50
+ });
51
+ }
52
+ getRequest() {
53
+ return {
54
+ body: this.fd,
55
+ headers: {},
56
+ duplex: "half",
57
+ };
58
+ }
59
+ }
60
+ function isStreamLike(value) {
61
+ return typeof value === "object" && value != null && ("read" in value || "pipe" in value);
62
+ }
63
+ function isReadableStream(value) {
64
+ return typeof value === "object" && value != null && "getReader" in value;
65
+ }
66
+ function isBuffer(value) {
67
+ return typeof Buffer !== "undefined" && Buffer.isBuffer && Buffer.isBuffer(value);
68
+ }
69
+ function isArrayBufferView(value) {
70
+ return ArrayBuffer.isView(value);
71
+ }
72
+ function streamToBuffer(stream) {
73
+ return __awaiter(this, void 0, void 0, function* () {
74
+ var _a, stream_1, stream_1_1;
75
+ var _b, e_1, _c, _d;
76
+ if (RUNTIME.type === "node") {
77
+ const { Readable } = yield import("stream");
78
+ if (stream instanceof Readable) {
79
+ const chunks = [];
80
+ try {
81
+ for (_a = true, stream_1 = __asyncValues(stream); stream_1_1 = yield stream_1.next(), _b = stream_1_1.done, !_b; _a = true) {
82
+ _d = stream_1_1.value;
83
+ _a = false;
84
+ const chunk = _d;
85
+ chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
86
+ }
87
+ }
88
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
89
+ finally {
90
+ try {
91
+ if (!_a && !_b && (_c = stream_1.return)) yield _c.call(stream_1);
92
+ }
93
+ finally { if (e_1) throw e_1.error; }
94
+ }
95
+ return Buffer.concat(chunks);
96
+ }
97
+ }
98
+ if (isReadableStream(stream)) {
99
+ const reader = stream.getReader();
100
+ const chunks = [];
101
+ try {
102
+ while (true) {
103
+ const { done, value } = yield reader.read();
104
+ if (done)
105
+ break;
106
+ chunks.push(value);
107
+ }
108
+ }
109
+ finally {
110
+ reader.releaseLock();
111
+ }
112
+ const totalLength = chunks.reduce((sum, chunk) => sum + chunk.length, 0);
113
+ const result = new Uint8Array(totalLength);
114
+ let offset = 0;
115
+ for (const chunk of chunks) {
116
+ result.set(chunk, offset);
117
+ offset += chunk.length;
118
+ }
119
+ return Buffer.from(result);
120
+ }
121
+ throw new Error(`Unsupported stream type: ${typeof stream}. Expected Node.js Readable stream or Web ReadableStream.`);
122
+ });
123
+ }
124
+ function convertToBlob(value, contentType) {
125
+ return __awaiter(this, void 0, void 0, function* () {
126
+ if (isStreamLike(value) || isReadableStream(value)) {
127
+ const buffer = yield streamToBuffer(value);
128
+ return new Blob([buffer], { type: contentType });
129
+ }
130
+ if (value instanceof Blob) {
131
+ return value;
132
+ }
133
+ if (isBuffer(value)) {
134
+ return new Blob([value], { type: contentType });
135
+ }
136
+ if (value instanceof ArrayBuffer) {
137
+ return new Blob([value], { type: contentType });
138
+ }
139
+ if (isArrayBufferView(value)) {
140
+ return new Blob([value], { type: contentType });
141
+ }
142
+ if (typeof value === "string") {
143
+ return new Blob([value], { type: contentType });
144
+ }
145
+ if (typeof value === "object" && value !== null) {
146
+ return new Blob([toJson(value)], { type: contentType !== null && contentType !== void 0 ? contentType : "application/json" });
147
+ }
148
+ return new Blob([String(value)], { type: contentType });
149
+ });
150
+ }
@@ -0,0 +1 @@
1
+ export declare function encodeAsFormParameter(value: unknown): Record<string, string>;
@@ -0,0 +1,9 @@
1
+ import { toQueryString } from "../url/qs.mjs";
2
+ export function encodeAsFormParameter(value) {
3
+ const stringified = toQueryString(value, { encode: false });
4
+ const keyValuePairs = stringified.split("&").map((pair) => {
5
+ const [key, value] = pair.split("=");
6
+ return [key, value];
7
+ });
8
+ return Object.fromEntries(keyValuePairs);
9
+ }
@@ -0,0 +1,2 @@
1
+ export { encodeAsFormParameter } from "./encodeAsFormParameter.mjs";
2
+ export * from "./FormDataWrapper.mjs";
@@ -0,0 +1,2 @@
1
+ export { encodeAsFormParameter } from "./encodeAsFormParameter.mjs";
2
+ export * from "./FormDataWrapper.mjs";
@@ -1,6 +1,8 @@
1
1
  export * from "./auth/index.mjs";
2
2
  export * from "./base64.mjs";
3
3
  export * from "./fetcher/index.mjs";
4
+ export * as file from "./file/index.mjs";
5
+ export * from "./form-data-utils/index.mjs";
4
6
  export * as logging from "./logging/index.mjs";
5
7
  export * from "./runtime/index.mjs";
6
8
  export * as url from "./url/index.mjs";
@@ -1,6 +1,8 @@
1
1
  export * from "./auth/index.mjs";
2
2
  export * from "./base64.mjs";
3
3
  export * from "./fetcher/index.mjs";
4
+ export * as file from "./file/index.mjs";
5
+ export * from "./form-data-utils/index.mjs";
4
6
  export * as logging from "./logging/index.mjs";
5
7
  export * from "./runtime/index.mjs";
6
8
  export * as url from "./url/index.mjs";
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Spreads caller-supplied `additionalBodyParameters` (from `requestOptions.additionalBodyParameters`)
3
+ * on top of the request body. Caller-supplied properties win over the endpoint body. When no
4
+ * additional body parameters are provided, the original body is returned unchanged so serialization
5
+ * is unaffected.
6
+ *
7
+ * The merge only applies to plain-object (JSON object) bodies. When the body is `null`/`undefined`
8
+ * the additional parameters become the body; when the body is an array or a primitive JSON value it
9
+ * is returned unchanged, since object properties cannot be spread into it. This mirrors the Python
10
+ * SDK, which only merges additional body parameters into mapping bodies.
11
+ */
12
+ export declare function mergeAdditionalBodyParameters(body: unknown, additionalBodyParameters: Record<string, unknown> | undefined): unknown;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Spreads caller-supplied `additionalBodyParameters` (from `requestOptions.additionalBodyParameters`)
3
+ * on top of the request body. Caller-supplied properties win over the endpoint body. When no
4
+ * additional body parameters are provided, the original body is returned unchanged so serialization
5
+ * is unaffected.
6
+ *
7
+ * The merge only applies to plain-object (JSON object) bodies. When the body is `null`/`undefined`
8
+ * the additional parameters become the body; when the body is an array or a primitive JSON value it
9
+ * is returned unchanged, since object properties cannot be spread into it. This mirrors the Python
10
+ * SDK, which only merges additional body parameters into mapping bodies.
11
+ */
12
+ export function mergeAdditionalBodyParameters(body, additionalBodyParameters) {
13
+ if (additionalBodyParameters == null) {
14
+ return body;
15
+ }
16
+ if (body == null) {
17
+ return Object.assign({}, additionalBodyParameters);
18
+ }
19
+ if (typeof body === "object" && !Array.isArray(body)) {
20
+ return Object.assign(Object.assign({}, body), additionalBodyParameters);
21
+ }
22
+ return body;
23
+ }
@@ -1 +1 @@
1
- export { RUNTIME } from "./runtime.mjs";
1
+ export { getUserAgent, RUNTIME } from "./runtime.mjs";
@@ -1 +1 @@
1
- export { RUNTIME } from "./runtime.mjs";
1
+ export { getUserAgent, RUNTIME } from "./runtime.mjs";
@@ -6,4 +6,23 @@ export interface Runtime {
6
6
  type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd" | "edge-runtime";
7
7
  version?: string;
8
8
  parsedVersion?: number;
9
+ /**
10
+ * The operating system the SDK is running on, when it can be determined
11
+ * (e.g. "linux", "darwin", "win32" on server runtimes). Undefined in
12
+ * environments where the OS is not observable (e.g. browsers).
13
+ */
14
+ os?: string;
15
+ /**
16
+ * The CPU architecture the SDK is running on, when it can be determined
17
+ * (e.g. "x64", "arm64" on server runtimes). Undefined in environments where
18
+ * the architecture is not observable (e.g. browsers).
19
+ */
20
+ arch?: string;
9
21
  }
22
+ /**
23
+ * Builds a structured User-Agent string of the form
24
+ * `{sdkName}/{sdkVersion} ({os}; {arch}) {runtime}/{runtimeVersion}`
25
+ * where the platform group and runtime segment are omitted gracefully when the
26
+ * underlying values cannot be determined (e.g. in a browser).
27
+ */
28
+ export declare function getUserAgent(sdkName: string, sdkVersion: string): string;