@composio/client 0.1.0-alpha.9 → 2.0.0-rc.10

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 (826) hide show
  1. package/README.md +99 -315
  2. package/dist/api-key-revocation-CMby8GRJ.mjs +25 -0
  3. package/dist/auth-Cogku2no.mjs +17 -0
  4. package/dist/auth-configs-Dgujwvul.mjs +55 -0
  5. package/dist/clanker-Ddf6to-5.mjs +24 -0
  6. package/dist/cli-Bx3dRctN.mjs +45 -0
  7. package/dist/config-BLBbhLe1.mjs +10 -0
  8. package/dist/config-DnyMhILW.d.mts +9 -0
  9. package/dist/connected-accounts-DNOWcz-A.mjs +83 -0
  10. package/dist/consumer-B_ccSE7b.mjs +34 -0
  11. package/dist/custom-CEy4IB_M.mjs +88 -0
  12. package/dist/custom-JHvAPJnl.mjs +24 -0
  13. package/dist/error-DLB1uKM3.mjs +109 -0
  14. package/dist/files-C74URe8c.mjs +31 -0
  15. package/dist/files-CxbSR_Qf.mjs +49 -0
  16. package/dist/generate-Cfcp7BDV.mjs +24 -0
  17. package/dist/generated-operations-DpYfIPgx.mjs +2312 -0
  18. package/dist/index.d.mts +5 -0
  19. package/dist/index.mjs +576 -0
  20. package/dist/keyring-DPTbHLph.mjs +17 -0
  21. package/dist/link-HtoYUvao.mjs +23 -0
  22. package/dist/logs-B1kxIBDI.mjs +38 -0
  23. package/dist/manage-Cv_zl1Pa.mjs +28 -0
  24. package/dist/mcp-DPHzA1Gg.mjs +91 -0
  25. package/dist/migration-CBhnoN-Y.mjs +10 -0
  26. package/dist/migration-CKGKuRO3.d.mts +9 -0
  27. package/dist/org-DfPJHXZ4.mjs +45 -0
  28. package/dist/owner-BOJ0ppd_.mjs +17 -0
  29. package/dist/pagination.d.mts +56 -0
  30. package/dist/pagination.mjs +50 -0
  31. package/dist/project-CBh3olOE.mjs +29 -0
  32. package/dist/project-Cyn5wfjX.mjs +25 -0
  33. package/dist/project-DgHmeDvz.mjs +47 -0
  34. package/dist/project-z2RqqvAR.mjs +22 -0
  35. package/dist/realtime-AhDHHK8s.mjs +28 -0
  36. package/dist/resources/api-key-revocation.d.mts +2 -0
  37. package/dist/resources/api-key-revocation.mjs +3 -0
  38. package/dist/resources/auth/auth.d.mts +2 -0
  39. package/dist/resources/auth/auth.mjs +3 -0
  40. package/dist/resources/auth/index.d.mts +2 -0
  41. package/dist/resources/auth/index.mjs +4 -0
  42. package/dist/resources/auth/session.d.mts +2 -0
  43. package/dist/resources/auth/session.mjs +3 -0
  44. package/dist/resources/auth-configs.d.mts +2 -0
  45. package/dist/resources/auth-configs.mjs +3 -0
  46. package/dist/resources/auth.d.mts +2 -0
  47. package/dist/resources/auth.mjs +5 -0
  48. package/dist/resources/cli/cli.d.mts +2 -0
  49. package/dist/resources/cli/cli.mjs +3 -0
  50. package/dist/resources/cli/index.d.mts +2 -0
  51. package/dist/resources/cli/index.mjs +4 -0
  52. package/dist/resources/cli/realtime.d.mts +2 -0
  53. package/dist/resources/cli/realtime.mjs +3 -0
  54. package/dist/resources/cli.d.mts +2 -0
  55. package/dist/resources/cli.mjs +5 -0
  56. package/dist/resources/connected-accounts.d.mts +2 -0
  57. package/dist/resources/connected-accounts.mjs +3 -0
  58. package/dist/resources/custom.d.mts +2 -0
  59. package/dist/resources/custom.mjs +3 -0
  60. package/dist/resources/files.d.mts +2 -0
  61. package/dist/resources/files.mjs +3 -0
  62. package/dist/resources/index.d.mts +3 -0
  63. package/dist/resources/index.mjs +16 -0
  64. package/dist/resources/keyring.d.mts +2 -0
  65. package/dist/resources/keyring.mjs +3 -0
  66. package/dist/resources/link.d.mts +2 -0
  67. package/dist/resources/link.mjs +3 -0
  68. package/dist/resources/logs/index.d.mts +2 -0
  69. package/dist/resources/logs/index.mjs +5 -0
  70. package/dist/resources/logs/logs.d.mts +2 -0
  71. package/dist/resources/logs/logs.mjs +3 -0
  72. package/dist/resources/logs/tools.d.mts +2 -0
  73. package/dist/resources/logs/tools.mjs +3 -0
  74. package/dist/resources/logs/triggers.d.mts +2 -0
  75. package/dist/resources/logs/triggers.mjs +3 -0
  76. package/dist/resources/logs.d.mts +2 -0
  77. package/dist/resources/logs.mjs +6 -0
  78. package/dist/resources/mcp/custom.d.mts +2 -0
  79. package/dist/resources/mcp/custom.mjs +3 -0
  80. package/dist/resources/mcp/generate.d.mts +2 -0
  81. package/dist/resources/mcp/generate.mjs +3 -0
  82. package/dist/resources/mcp/index.d.mts +2 -0
  83. package/dist/resources/mcp/index.mjs +5 -0
  84. package/dist/resources/mcp/mcp.d.mts +2 -0
  85. package/dist/resources/mcp/mcp.mjs +3 -0
  86. package/dist/resources/mcp.d.mts +2 -0
  87. package/dist/resources/mcp.mjs +6 -0
  88. package/dist/resources/migration.d.mts +2 -0
  89. package/dist/resources/migration.mjs +3 -0
  90. package/dist/resources/org/clanker.d.mts +2 -0
  91. package/dist/resources/org/clanker.mjs +3 -0
  92. package/dist/resources/org/consumer/consumer.d.mts +2 -0
  93. package/dist/resources/org/consumer/consumer.mjs +3 -0
  94. package/dist/resources/org/consumer/index.d.mts +2 -0
  95. package/dist/resources/org/consumer/index.mjs +4 -0
  96. package/dist/resources/org/consumer/project.d.mts +2 -0
  97. package/dist/resources/org/consumer/project.mjs +3 -0
  98. package/dist/resources/org/consumer.d.mts +2 -0
  99. package/dist/resources/org/consumer.mjs +5 -0
  100. package/dist/resources/org/index.d.mts +2 -0
  101. package/dist/resources/org/index.mjs +8 -0
  102. package/dist/resources/org/org.d.mts +2 -0
  103. package/dist/resources/org/org.mjs +3 -0
  104. package/dist/resources/org/owner/index.d.mts +2 -0
  105. package/dist/resources/org/owner/index.mjs +4 -0
  106. package/dist/resources/org/owner/owner.d.mts +2 -0
  107. package/dist/resources/org/owner/owner.mjs +3 -0
  108. package/dist/resources/org/owner/project.d.mts +2 -0
  109. package/dist/resources/org/owner/project.mjs +3 -0
  110. package/dist/resources/org/owner.d.mts +2 -0
  111. package/dist/resources/org/owner.mjs +5 -0
  112. package/dist/resources/org/project.d.mts +2 -0
  113. package/dist/resources/org/project.mjs +3 -0
  114. package/dist/resources/org/usage.d.mts +2 -0
  115. package/dist/resources/org/usage.mjs +3 -0
  116. package/dist/resources/org.d.mts +2 -0
  117. package/dist/resources/org.mjs +9 -0
  118. package/dist/resources/project/config.d.mts +2 -0
  119. package/dist/resources/project/config.mjs +3 -0
  120. package/dist/resources/project/index.d.mts +3 -0
  121. package/dist/resources/project/index.mjs +4 -0
  122. package/dist/resources/project/project.d.mts +2 -0
  123. package/dist/resources/project/project.mjs +3 -0
  124. package/dist/resources/project/usage.d.mts +2 -0
  125. package/dist/resources/project/usage.mjs +3 -0
  126. package/dist/resources/project.d.mts +3 -0
  127. package/dist/resources/project.mjs +5 -0
  128. package/dist/resources/session-configs.d.mts +2 -0
  129. package/dist/resources/session-configs.mjs +24 -0
  130. package/dist/resources/tool-router/index.d.mts +2 -0
  131. package/dist/resources/tool-router/index.mjs +4 -0
  132. package/dist/resources/tool-router/session/files.d.mts +2 -0
  133. package/dist/resources/tool-router/session/files.mjs +3 -0
  134. package/dist/resources/tool-router/session/index.d.mts +2 -0
  135. package/dist/resources/tool-router/session/index.mjs +4 -0
  136. package/dist/resources/tool-router/session/session.d.mts +2 -0
  137. package/dist/resources/tool-router/session/session.mjs +3 -0
  138. package/dist/resources/tool-router/session.d.mts +2 -0
  139. package/dist/resources/tool-router/session.mjs +5 -0
  140. package/dist/resources/tool-router/tool-router.d.mts +2 -0
  141. package/dist/resources/tool-router/tool-router.mjs +3 -0
  142. package/dist/resources/tool-router.d.mts +2 -0
  143. package/dist/resources/tool-router.mjs +5 -0
  144. package/dist/resources/toolkits.d.mts +2 -0
  145. package/dist/resources/toolkits.mjs +3 -0
  146. package/dist/resources/tools.d.mts +2 -0
  147. package/dist/resources/tools.mjs +3 -0
  148. package/dist/resources/trigger-instances/index.d.mts +2 -0
  149. package/dist/resources/trigger-instances/index.mjs +4 -0
  150. package/dist/resources/trigger-instances/manage.d.mts +2 -0
  151. package/dist/resources/trigger-instances/manage.mjs +3 -0
  152. package/dist/resources/trigger-instances/trigger-instances.d.mts +2 -0
  153. package/dist/resources/trigger-instances/trigger-instances.mjs +3 -0
  154. package/dist/resources/trigger-instances.d.mts +2 -0
  155. package/dist/resources/trigger-instances.mjs +5 -0
  156. package/dist/resources/triggers-types.d.mts +2 -0
  157. package/dist/resources/triggers-types.mjs +3 -0
  158. package/dist/resources/webhook-endpoints.d.mts +2 -0
  159. package/dist/resources/webhook-endpoints.mjs +3 -0
  160. package/dist/resources/webhook-subscriptions.d.mts +2 -0
  161. package/dist/resources/webhook-subscriptions.mjs +3 -0
  162. package/dist/session-DN52ZBZa.mjs +22 -0
  163. package/dist/session-ZjgXXTor.mjs +110 -0
  164. package/dist/session-configs-DBYUrVm-.d.mts +27180 -0
  165. package/dist/tool-router-oEa6XLps.mjs +14 -0
  166. package/dist/toolkits-gnhAqP-a.mjs +62 -0
  167. package/dist/tools-B6EBv0kQ.mjs +33 -0
  168. package/dist/tools-CplwSMIX.mjs +69 -0
  169. package/dist/trigger-instances-BZyLCvgX.mjs +35 -0
  170. package/dist/triggers-tFRN45MV.mjs +28 -0
  171. package/dist/triggers-types-BOXTcipZ.mjs +34 -0
  172. package/dist/usage-DsWhJVDd.mjs +31 -0
  173. package/dist/usage-qjodPLQq.mjs +31 -0
  174. package/dist/webhook-endpoints-Cv2sK6HF.mjs +51 -0
  175. package/dist/webhook-subscriptions-BxPEYH5X.mjs +55 -0
  176. package/package.json +85 -126
  177. package/CHANGELOG.md +0 -96
  178. package/LICENSE +0 -201
  179. package/api-promise.d.mts +0 -2
  180. package/api-promise.d.mts.map +0 -1
  181. package/api-promise.d.ts +0 -2
  182. package/api-promise.d.ts.map +0 -1
  183. package/api-promise.js +0 -19
  184. package/api-promise.js.map +0 -1
  185. package/api-promise.mjs +0 -2
  186. package/api-promise.mjs.map +0 -1
  187. package/client.d.mts +0 -224
  188. package/client.d.mts.map +0 -1
  189. package/client.d.ts +0 -224
  190. package/client.d.ts.map +0 -1
  191. package/client.js +0 -502
  192. package/client.js.map +0 -1
  193. package/client.mjs +0 -475
  194. package/client.mjs.map +0 -1
  195. package/core/api-promise.d.mts +0 -47
  196. package/core/api-promise.d.mts.map +0 -1
  197. package/core/api-promise.d.ts +0 -47
  198. package/core/api-promise.d.ts.map +0 -1
  199. package/core/api-promise.js +0 -84
  200. package/core/api-promise.js.map +0 -1
  201. package/core/api-promise.mjs +0 -80
  202. package/core/api-promise.mjs.map +0 -1
  203. package/core/error.d.mts +0 -47
  204. package/core/error.d.mts.map +0 -1
  205. package/core/error.d.ts +0 -47
  206. package/core/error.d.ts.map +0 -1
  207. package/core/error.js +0 -113
  208. package/core/error.js.map +0 -1
  209. package/core/error.mjs +0 -97
  210. package/core/error.mjs.map +0 -1
  211. package/core/resource.d.mts +0 -6
  212. package/core/resource.d.mts.map +0 -1
  213. package/core/resource.d.ts +0 -6
  214. package/core/resource.d.ts.map +0 -1
  215. package/core/resource.js +0 -11
  216. package/core/resource.js.map +0 -1
  217. package/core/resource.mjs +0 -7
  218. package/core/resource.mjs.map +0 -1
  219. package/core/uploads.d.mts +0 -3
  220. package/core/uploads.d.mts.map +0 -1
  221. package/core/uploads.d.ts +0 -3
  222. package/core/uploads.d.ts.map +0 -1
  223. package/core/uploads.js +0 -6
  224. package/core/uploads.js.map +0 -1
  225. package/core/uploads.mjs +0 -2
  226. package/core/uploads.mjs.map +0 -1
  227. package/error.d.mts +0 -2
  228. package/error.d.mts.map +0 -1
  229. package/error.d.ts +0 -2
  230. package/error.d.ts.map +0 -1
  231. package/error.js +0 -19
  232. package/error.js.map +0 -1
  233. package/error.mjs +0 -2
  234. package/error.mjs.map +0 -1
  235. package/index.d.mts +0 -6
  236. package/index.d.mts.map +0 -1
  237. package/index.d.ts +0 -6
  238. package/index.d.ts.map +0 -1
  239. package/index.js +0 -30
  240. package/index.js.map +0 -1
  241. package/index.mjs +0 -7
  242. package/index.mjs.map +0 -1
  243. package/internal/builtin-types.d.mts +0 -75
  244. package/internal/builtin-types.d.mts.map +0 -1
  245. package/internal/builtin-types.d.ts +0 -75
  246. package/internal/builtin-types.d.ts.map +0 -1
  247. package/internal/builtin-types.js +0 -4
  248. package/internal/builtin-types.js.map +0 -1
  249. package/internal/builtin-types.mjs +0 -3
  250. package/internal/builtin-types.mjs.map +0 -1
  251. package/internal/detect-platform.d.mts +0 -15
  252. package/internal/detect-platform.d.mts.map +0 -1
  253. package/internal/detect-platform.d.ts +0 -15
  254. package/internal/detect-platform.d.ts.map +0 -1
  255. package/internal/detect-platform.js +0 -162
  256. package/internal/detect-platform.js.map +0 -1
  257. package/internal/detect-platform.mjs +0 -157
  258. package/internal/detect-platform.mjs.map +0 -1
  259. package/internal/errors.d.mts +0 -3
  260. package/internal/errors.d.mts.map +0 -1
  261. package/internal/errors.d.ts +0 -3
  262. package/internal/errors.d.ts.map +0 -1
  263. package/internal/errors.js +0 -41
  264. package/internal/errors.js.map +0 -1
  265. package/internal/errors.mjs +0 -36
  266. package/internal/errors.mjs.map +0 -1
  267. package/internal/headers.d.mts +0 -21
  268. package/internal/headers.d.mts.map +0 -1
  269. package/internal/headers.d.ts +0 -21
  270. package/internal/headers.d.ts.map +0 -1
  271. package/internal/headers.js +0 -77
  272. package/internal/headers.js.map +0 -1
  273. package/internal/headers.mjs +0 -72
  274. package/internal/headers.mjs.map +0 -1
  275. package/internal/parse.d.mts +0 -13
  276. package/internal/parse.d.mts.map +0 -1
  277. package/internal/parse.d.ts +0 -13
  278. package/internal/parse.d.ts.map +0 -1
  279. package/internal/parse.js +0 -36
  280. package/internal/parse.js.map +0 -1
  281. package/internal/parse.mjs +0 -32
  282. package/internal/parse.mjs.map +0 -1
  283. package/internal/qs/formats.d.mts +0 -6
  284. package/internal/qs/formats.d.mts.map +0 -1
  285. package/internal/qs/formats.d.ts +0 -6
  286. package/internal/qs/formats.d.ts.map +0 -1
  287. package/internal/qs/formats.js +0 -11
  288. package/internal/qs/formats.js.map +0 -1
  289. package/internal/qs/formats.mjs +0 -8
  290. package/internal/qs/formats.mjs.map +0 -1
  291. package/internal/qs/index.d.mts +0 -10
  292. package/internal/qs/index.d.mts.map +0 -1
  293. package/internal/qs/index.d.ts +0 -10
  294. package/internal/qs/index.d.ts.map +0 -1
  295. package/internal/qs/index.js +0 -14
  296. package/internal/qs/index.js.map +0 -1
  297. package/internal/qs/index.mjs +0 -10
  298. package/internal/qs/index.mjs.map +0 -1
  299. package/internal/qs/stringify.d.mts +0 -3
  300. package/internal/qs/stringify.d.mts.map +0 -1
  301. package/internal/qs/stringify.d.ts +0 -3
  302. package/internal/qs/stringify.d.ts.map +0 -1
  303. package/internal/qs/stringify.js +0 -280
  304. package/internal/qs/stringify.js.map +0 -1
  305. package/internal/qs/stringify.mjs +0 -276
  306. package/internal/qs/stringify.mjs.map +0 -1
  307. package/internal/qs/types.d.mts +0 -57
  308. package/internal/qs/types.d.mts.map +0 -1
  309. package/internal/qs/types.d.ts +0 -57
  310. package/internal/qs/types.d.ts.map +0 -1
  311. package/internal/qs/types.js +0 -3
  312. package/internal/qs/types.js.map +0 -1
  313. package/internal/qs/types.mjs +0 -2
  314. package/internal/qs/types.mjs.map +0 -1
  315. package/internal/qs/utils.d.mts +0 -14
  316. package/internal/qs/utils.d.mts.map +0 -1
  317. package/internal/qs/utils.d.ts +0 -14
  318. package/internal/qs/utils.d.ts.map +0 -1
  319. package/internal/qs/utils.js +0 -229
  320. package/internal/qs/utils.js.map +0 -1
  321. package/internal/qs/utils.mjs +0 -217
  322. package/internal/qs/utils.mjs.map +0 -1
  323. package/internal/request-options.d.mts +0 -33
  324. package/internal/request-options.d.mts.map +0 -1
  325. package/internal/request-options.d.ts +0 -33
  326. package/internal/request-options.d.ts.map +0 -1
  327. package/internal/request-options.js +0 -14
  328. package/internal/request-options.js.map +0 -1
  329. package/internal/request-options.mjs +0 -10
  330. package/internal/request-options.mjs.map +0 -1
  331. package/internal/shim-types.d.mts +0 -28
  332. package/internal/shim-types.d.ts +0 -28
  333. package/internal/shims/crypto.d.mts +0 -13
  334. package/internal/shims/crypto.d.mts.map +0 -1
  335. package/internal/shims/crypto.d.ts +0 -13
  336. package/internal/shims/crypto.d.ts.map +0 -1
  337. package/internal/shims/crypto.js +0 -13
  338. package/internal/shims/crypto.js.map +0 -1
  339. package/internal/shims/crypto.mjs +0 -9
  340. package/internal/shims/crypto.mjs.map +0 -1
  341. package/internal/shims/file.d.mts +0 -23
  342. package/internal/shims/file.d.mts.map +0 -1
  343. package/internal/shims/file.d.ts +0 -23
  344. package/internal/shims/file.d.ts.map +0 -1
  345. package/internal/shims/file.js +0 -16
  346. package/internal/shims/file.js.map +0 -1
  347. package/internal/shims/file.mjs +0 -12
  348. package/internal/shims/file.mjs.map +0 -1
  349. package/internal/shims/getBuiltinModule.d.mts +0 -11
  350. package/internal/shims/getBuiltinModule.d.mts.map +0 -1
  351. package/internal/shims/getBuiltinModule.d.ts +0 -11
  352. package/internal/shims/getBuiltinModule.d.ts.map +0 -1
  353. package/internal/shims/getBuiltinModule.js +0 -71
  354. package/internal/shims/getBuiltinModule.js.map +0 -1
  355. package/internal/shims/getBuiltinModule.mjs +0 -67
  356. package/internal/shims/getBuiltinModule.mjs.map +0 -1
  357. package/internal/shims/nullGetBuiltinModule.d.mts +0 -2
  358. package/internal/shims/nullGetBuiltinModule.d.mts.map +0 -1
  359. package/internal/shims/nullGetBuiltinModule.d.ts +0 -2
  360. package/internal/shims/nullGetBuiltinModule.d.ts.map +0 -1
  361. package/internal/shims/nullGetBuiltinModule.js +0 -5
  362. package/internal/shims/nullGetBuiltinModule.js.map +0 -1
  363. package/internal/shims/nullGetBuiltinModule.mjs +0 -2
  364. package/internal/shims/nullGetBuiltinModule.mjs.map +0 -1
  365. package/internal/shims.d.mts +0 -20
  366. package/internal/shims.d.mts.map +0 -1
  367. package/internal/shims.d.ts +0 -20
  368. package/internal/shims.d.ts.map +0 -1
  369. package/internal/shims.js +0 -93
  370. package/internal/shims.js.map +0 -1
  371. package/internal/shims.mjs +0 -85
  372. package/internal/shims.mjs.map +0 -1
  373. package/internal/to-file.d.mts +0 -46
  374. package/internal/to-file.d.mts.map +0 -1
  375. package/internal/to-file.d.ts +0 -46
  376. package/internal/to-file.d.ts.map +0 -1
  377. package/internal/to-file.js +0 -91
  378. package/internal/to-file.js.map +0 -1
  379. package/internal/to-file.mjs +0 -87
  380. package/internal/to-file.mjs.map +0 -1
  381. package/internal/types.d.mts +0 -68
  382. package/internal/types.d.mts.map +0 -1
  383. package/internal/types.d.ts +0 -68
  384. package/internal/types.d.ts.map +0 -1
  385. package/internal/types.js +0 -4
  386. package/internal/types.js.map +0 -1
  387. package/internal/types.mjs +0 -3
  388. package/internal/types.mjs.map +0 -1
  389. package/internal/uploads.d.mts +0 -44
  390. package/internal/uploads.d.mts.map +0 -1
  391. package/internal/uploads.d.ts +0 -44
  392. package/internal/uploads.d.ts.map +0 -1
  393. package/internal/uploads.js +0 -131
  394. package/internal/uploads.js.map +0 -1
  395. package/internal/uploads.mjs +0 -122
  396. package/internal/uploads.mjs.map +0 -1
  397. package/internal/utils/base64.d.mts +0 -3
  398. package/internal/utils/base64.d.mts.map +0 -1
  399. package/internal/utils/base64.d.ts +0 -3
  400. package/internal/utils/base64.d.ts.map +0 -1
  401. package/internal/utils/base64.js +0 -37
  402. package/internal/utils/base64.js.map +0 -1
  403. package/internal/utils/base64.mjs +0 -32
  404. package/internal/utils/base64.mjs.map +0 -1
  405. package/internal/utils/env.d.mts +0 -9
  406. package/internal/utils/env.d.mts.map +0 -1
  407. package/internal/utils/env.d.ts +0 -9
  408. package/internal/utils/env.d.ts.map +0 -1
  409. package/internal/utils/env.js +0 -22
  410. package/internal/utils/env.js.map +0 -1
  411. package/internal/utils/env.mjs +0 -18
  412. package/internal/utils/env.mjs.map +0 -1
  413. package/internal/utils/log.d.mts +0 -38
  414. package/internal/utils/log.d.mts.map +0 -1
  415. package/internal/utils/log.d.ts +0 -38
  416. package/internal/utils/log.d.ts.map +0 -1
  417. package/internal/utils/log.js +0 -86
  418. package/internal/utils/log.js.map +0 -1
  419. package/internal/utils/log.mjs +0 -80
  420. package/internal/utils/log.mjs.map +0 -1
  421. package/internal/utils/path.d.mts +0 -15
  422. package/internal/utils/path.d.mts.map +0 -1
  423. package/internal/utils/path.d.ts +0 -15
  424. package/internal/utils/path.d.ts.map +0 -1
  425. package/internal/utils/path.js +0 -58
  426. package/internal/utils/path.js.map +0 -1
  427. package/internal/utils/path.mjs +0 -53
  428. package/internal/utils/path.mjs.map +0 -1
  429. package/internal/utils/sleep.d.mts +0 -2
  430. package/internal/utils/sleep.d.mts.map +0 -1
  431. package/internal/utils/sleep.d.ts +0 -2
  432. package/internal/utils/sleep.d.ts.map +0 -1
  433. package/internal/utils/sleep.js +0 -7
  434. package/internal/utils/sleep.js.map +0 -1
  435. package/internal/utils/sleep.mjs +0 -3
  436. package/internal/utils/sleep.mjs.map +0 -1
  437. package/internal/utils/uuid.d.mts +0 -5
  438. package/internal/utils/uuid.d.mts.map +0 -1
  439. package/internal/utils/uuid.d.ts +0 -5
  440. package/internal/utils/uuid.d.ts.map +0 -1
  441. package/internal/utils/uuid.js +0 -20
  442. package/internal/utils/uuid.js.map +0 -1
  443. package/internal/utils/uuid.mjs +0 -16
  444. package/internal/utils/uuid.mjs.map +0 -1
  445. package/internal/utils/values.d.mts +0 -16
  446. package/internal/utils/values.d.mts.map +0 -1
  447. package/internal/utils/values.d.ts +0 -16
  448. package/internal/utils/values.d.ts.map +0 -1
  449. package/internal/utils/values.js +0 -109
  450. package/internal/utils/values.js.map +0 -1
  451. package/internal/utils/values.mjs +0 -92
  452. package/internal/utils/values.mjs.map +0 -1
  453. package/internal/utils.d.mts +0 -7
  454. package/internal/utils.d.mts.map +0 -1
  455. package/internal/utils.d.ts +0 -7
  456. package/internal/utils.d.ts.map +0 -1
  457. package/internal/utils.js +0 -24
  458. package/internal/utils.js.map +0 -1
  459. package/internal/utils.mjs +0 -8
  460. package/internal/utils.mjs.map +0 -1
  461. package/resource.d.mts +0 -2
  462. package/resource.d.mts.map +0 -1
  463. package/resource.d.ts +0 -2
  464. package/resource.d.ts.map +0 -1
  465. package/resource.js +0 -19
  466. package/resource.js.map +0 -1
  467. package/resource.mjs +0 -2
  468. package/resource.mjs.map +0 -1
  469. package/resources/action-execution.d.mts +0 -155
  470. package/resources/action-execution.d.mts.map +0 -1
  471. package/resources/action-execution.d.ts +0 -155
  472. package/resources/action-execution.d.ts.map +0 -1
  473. package/resources/action-execution.js +0 -19
  474. package/resources/action-execution.js.map +0 -1
  475. package/resources/action-execution.mjs +0 -15
  476. package/resources/action-execution.mjs.map +0 -1
  477. package/resources/auth/auth.d.mts +0 -10
  478. package/resources/auth/auth.d.mts.map +0 -1
  479. package/resources/auth/auth.d.ts +0 -10
  480. package/resources/auth/auth.d.ts.map +0 -1
  481. package/resources/auth/auth.js +0 -39
  482. package/resources/auth/auth.js.map +0 -1
  483. package/resources/auth/auth.mjs +0 -12
  484. package/resources/auth/auth.mjs.map +0 -1
  485. package/resources/auth/index.d.mts +0 -3
  486. package/resources/auth/index.d.mts.map +0 -1
  487. package/resources/auth/index.d.ts +0 -3
  488. package/resources/auth/index.d.ts.map +0 -1
  489. package/resources/auth/index.js +0 -9
  490. package/resources/auth/index.js.map +0 -1
  491. package/resources/auth/index.mjs +0 -4
  492. package/resources/auth/index.mjs.map +0 -1
  493. package/resources/auth/session.d.mts +0 -75
  494. package/resources/auth/session.d.mts.map +0 -1
  495. package/resources/auth/session.d.ts +0 -75
  496. package/resources/auth/session.d.ts.map +0 -1
  497. package/resources/auth/session.js +0 -12
  498. package/resources/auth/session.js.map +0 -1
  499. package/resources/auth/session.mjs +0 -8
  500. package/resources/auth/session.mjs.map +0 -1
  501. package/resources/auth-configs.d.mts +0 -217
  502. package/resources/auth-configs.d.mts.map +0 -1
  503. package/resources/auth-configs.d.ts +0 -217
  504. package/resources/auth-configs.d.ts.map +0 -1
  505. package/resources/auth-configs.js +0 -29
  506. package/resources/auth-configs.js.map +0 -1
  507. package/resources/auth-configs.mjs +0 -25
  508. package/resources/auth-configs.mjs.map +0 -1
  509. package/resources/auth.d.mts +0 -2
  510. package/resources/auth.d.mts.map +0 -1
  511. package/resources/auth.d.ts +0 -2
  512. package/resources/auth.d.ts.map +0 -1
  513. package/resources/auth.js +0 -19
  514. package/resources/auth.js.map +0 -1
  515. package/resources/auth.mjs +0 -3
  516. package/resources/auth.mjs.map +0 -1
  517. package/resources/cli.d.mts +0 -124
  518. package/resources/cli.d.mts.map +0 -1
  519. package/resources/cli.d.ts +0 -124
  520. package/resources/cli.d.ts.map +0 -1
  521. package/resources/cli.js +0 -18
  522. package/resources/cli.js.map +0 -1
  523. package/resources/cli.mjs +0 -14
  524. package/resources/cli.mjs.map +0 -1
  525. package/resources/connected-accounts.d.mts +0 -449
  526. package/resources/connected-accounts.d.mts.map +0 -1
  527. package/resources/connected-accounts.d.ts +0 -449
  528. package/resources/connected-accounts.d.ts.map +0 -1
  529. package/resources/connected-accounts.js +0 -28
  530. package/resources/connected-accounts.js.map +0 -1
  531. package/resources/connected-accounts.mjs +0 -24
  532. package/resources/connected-accounts.mjs.map +0 -1
  533. package/resources/index.d.mts +0 -14
  534. package/resources/index.d.mts.map +0 -1
  535. package/resources/index.d.ts +0 -14
  536. package/resources/index.d.ts.map +0 -1
  537. package/resources/index.js +0 -31
  538. package/resources/index.js.map +0 -1
  539. package/resources/index.mjs +0 -15
  540. package/resources/index.mjs.map +0 -1
  541. package/resources/mcp/command.d.mts +0 -34
  542. package/resources/mcp/command.d.mts.map +0 -1
  543. package/resources/mcp/command.d.ts +0 -34
  544. package/resources/mcp/command.d.ts.map +0 -1
  545. package/resources/mcp/command.js +0 -12
  546. package/resources/mcp/command.js.map +0 -1
  547. package/resources/mcp/command.mjs +0 -8
  548. package/resources/mcp/command.mjs.map +0 -1
  549. package/resources/mcp/index.d.mts +0 -3
  550. package/resources/mcp/index.d.mts.map +0 -1
  551. package/resources/mcp/index.d.ts +0 -3
  552. package/resources/mcp/index.d.ts.map +0 -1
  553. package/resources/mcp/index.js +0 -9
  554. package/resources/mcp/index.js.map +0 -1
  555. package/resources/mcp/index.mjs +0 -4
  556. package/resources/mcp/index.mjs.map +0 -1
  557. package/resources/mcp/mcp.d.mts +0 -378
  558. package/resources/mcp/mcp.d.mts.map +0 -1
  559. package/resources/mcp/mcp.d.ts +0 -378
  560. package/resources/mcp/mcp.d.ts.map +0 -1
  561. package/resources/mcp/mcp.js +0 -66
  562. package/resources/mcp/mcp.js.map +0 -1
  563. package/resources/mcp/mcp.mjs +0 -39
  564. package/resources/mcp/mcp.mjs.map +0 -1
  565. package/resources/mcp.d.mts +0 -2
  566. package/resources/mcp.d.mts.map +0 -1
  567. package/resources/mcp.d.ts +0 -2
  568. package/resources/mcp.d.ts.map +0 -1
  569. package/resources/mcp.js +0 -19
  570. package/resources/mcp.js.map +0 -1
  571. package/resources/mcp.mjs +0 -3
  572. package/resources/mcp.mjs.map +0 -1
  573. package/resources/org/api-key.d.mts +0 -17
  574. package/resources/org/api-key.d.mts.map +0 -1
  575. package/resources/org/api-key.d.ts +0 -17
  576. package/resources/org/api-key.d.ts.map +0 -1
  577. package/resources/org/api-key.js +0 -15
  578. package/resources/org/api-key.js.map +0 -1
  579. package/resources/org/api-key.mjs +0 -11
  580. package/resources/org/api-key.mjs.map +0 -1
  581. package/resources/org/index.d.mts +0 -4
  582. package/resources/org/index.d.mts.map +0 -1
  583. package/resources/org/index.d.ts +0 -4
  584. package/resources/org/index.d.ts.map +0 -1
  585. package/resources/org/index.js +0 -11
  586. package/resources/org/index.js.map +0 -1
  587. package/resources/org/index.mjs +0 -5
  588. package/resources/org/index.mjs.map +0 -1
  589. package/resources/org/org.d.mts +0 -14
  590. package/resources/org/org.d.mts.map +0 -1
  591. package/resources/org/org.d.ts +0 -14
  592. package/resources/org/org.d.ts.map +0 -1
  593. package/resources/org/org.js +0 -43
  594. package/resources/org/org.js.map +0 -1
  595. package/resources/org/org.mjs +0 -16
  596. package/resources/org/org.mjs.map +0 -1
  597. package/resources/org/project/api-keys.d.mts +0 -109
  598. package/resources/org/project/api-keys.d.mts.map +0 -1
  599. package/resources/org/project/api-keys.d.ts +0 -109
  600. package/resources/org/project/api-keys.d.ts.map +0 -1
  601. package/resources/org/project/api-keys.js +0 -23
  602. package/resources/org/project/api-keys.js.map +0 -1
  603. package/resources/org/project/api-keys.mjs +0 -19
  604. package/resources/org/project/api-keys.mjs.map +0 -1
  605. package/resources/org/project/index.d.mts +0 -5
  606. package/resources/org/project/index.d.mts.map +0 -1
  607. package/resources/org/project/index.d.ts +0 -5
  608. package/resources/org/project/index.d.ts.map +0 -1
  609. package/resources/org/project/index.js +0 -13
  610. package/resources/org/project/index.js.map +0 -1
  611. package/resources/org/project/index.mjs +0 -6
  612. package/resources/org/project/index.mjs.map +0 -1
  613. package/resources/org/project/project.d.mts +0 -90
  614. package/resources/org/project/project.d.mts.map +0 -1
  615. package/resources/org/project/project.d.ts +0 -90
  616. package/resources/org/project/project.d.ts.map +0 -1
  617. package/resources/org/project/project.js +0 -60
  618. package/resources/org/project/project.js.map +0 -1
  619. package/resources/org/project/project.mjs +0 -33
  620. package/resources/org/project/project.mjs.map +0 -1
  621. package/resources/org/project/trigger.d.mts +0 -51
  622. package/resources/org/project/trigger.d.mts.map +0 -1
  623. package/resources/org/project/trigger.d.ts +0 -51
  624. package/resources/org/project/trigger.d.ts.map +0 -1
  625. package/resources/org/project/trigger.js +0 -16
  626. package/resources/org/project/trigger.js.map +0 -1
  627. package/resources/org/project/trigger.mjs +0 -12
  628. package/resources/org/project/trigger.mjs.map +0 -1
  629. package/resources/org/project/webhook.d.mts +0 -92
  630. package/resources/org/project/webhook.d.mts.map +0 -1
  631. package/resources/org/project/webhook.d.ts +0 -92
  632. package/resources/org/project/webhook.d.ts.map +0 -1
  633. package/resources/org/project/webhook.js +0 -24
  634. package/resources/org/project/webhook.js.map +0 -1
  635. package/resources/org/project/webhook.mjs +0 -20
  636. package/resources/org/project/webhook.mjs.map +0 -1
  637. package/resources/org/project.d.mts +0 -2
  638. package/resources/org/project.d.mts.map +0 -1
  639. package/resources/org/project.d.ts +0 -2
  640. package/resources/org/project.d.ts.map +0 -1
  641. package/resources/org/project.js +0 -19
  642. package/resources/org/project.js.map +0 -1
  643. package/resources/org/project.mjs +0 -3
  644. package/resources/org/project.mjs.map +0 -1
  645. package/resources/org.d.mts +0 -2
  646. package/resources/org.d.mts.map +0 -1
  647. package/resources/org.d.ts +0 -2
  648. package/resources/org.d.ts.map +0 -1
  649. package/resources/org.js +0 -19
  650. package/resources/org.js.map +0 -1
  651. package/resources/org.mjs +0 -3
  652. package/resources/org.mjs.map +0 -1
  653. package/resources/team-members.d.mts +0 -57
  654. package/resources/team-members.d.mts.map +0 -1
  655. package/resources/team-members.d.ts +0 -57
  656. package/resources/team-members.d.ts.map +0 -1
  657. package/resources/team-members.js +0 -22
  658. package/resources/team-members.js.map +0 -1
  659. package/resources/team-members.mjs +0 -18
  660. package/resources/team-members.mjs.map +0 -1
  661. package/resources/toolkits.d.mts +0 -141
  662. package/resources/toolkits.d.mts.map +0 -1
  663. package/resources/toolkits.d.ts +0 -141
  664. package/resources/toolkits.d.ts.map +0 -1
  665. package/resources/toolkits.js +0 -19
  666. package/resources/toolkits.js.map +0 -1
  667. package/resources/toolkits.mjs +0 -15
  668. package/resources/toolkits.mjs.map +0 -1
  669. package/resources/tools.d.mts +0 -210
  670. package/resources/tools.d.mts.map +0 -1
  671. package/resources/tools.d.ts +0 -210
  672. package/resources/tools.d.ts.map +0 -1
  673. package/resources/tools.js +0 -28
  674. package/resources/tools.js.map +0 -1
  675. package/resources/tools.mjs +0 -24
  676. package/resources/tools.mjs.map +0 -1
  677. package/resources/trigger-instances/handle.d.mts +0 -25
  678. package/resources/trigger-instances/handle.d.mts.map +0 -1
  679. package/resources/trigger-instances/handle.d.ts +0 -25
  680. package/resources/trigger-instances/handle.d.ts.map +0 -1
  681. package/resources/trigger-instances/handle.js +0 -18
  682. package/resources/trigger-instances/handle.js.map +0 -1
  683. package/resources/trigger-instances/handle.mjs +0 -14
  684. package/resources/trigger-instances/handle.mjs.map +0 -1
  685. package/resources/trigger-instances/index.d.mts +0 -3
  686. package/resources/trigger-instances/index.d.mts.map +0 -1
  687. package/resources/trigger-instances/index.d.ts +0 -3
  688. package/resources/trigger-instances/index.d.ts.map +0 -1
  689. package/resources/trigger-instances/index.js +0 -9
  690. package/resources/trigger-instances/index.js.map +0 -1
  691. package/resources/trigger-instances/index.mjs +0 -4
  692. package/resources/trigger-instances/index.mjs.map +0 -1
  693. package/resources/trigger-instances/trigger-instances.d.mts +0 -126
  694. package/resources/trigger-instances/trigger-instances.d.mts.map +0 -1
  695. package/resources/trigger-instances/trigger-instances.d.ts +0 -126
  696. package/resources/trigger-instances/trigger-instances.d.ts.map +0 -1
  697. package/resources/trigger-instances/trigger-instances.js +0 -53
  698. package/resources/trigger-instances/trigger-instances.js.map +0 -1
  699. package/resources/trigger-instances/trigger-instances.mjs +0 -26
  700. package/resources/trigger-instances/trigger-instances.mjs.map +0 -1
  701. package/resources/trigger-instances.d.mts +0 -2
  702. package/resources/trigger-instances.d.mts.map +0 -1
  703. package/resources/trigger-instances.d.ts +0 -2
  704. package/resources/trigger-instances.d.ts.map +0 -1
  705. package/resources/trigger-instances.js +0 -19
  706. package/resources/trigger-instances.js.map +0 -1
  707. package/resources/trigger-instances.mjs +0 -3
  708. package/resources/trigger-instances.mjs.map +0 -1
  709. package/resources/trigger.d.mts +0 -73
  710. package/resources/trigger.d.mts.map +0 -1
  711. package/resources/trigger.d.ts +0 -73
  712. package/resources/trigger.d.ts.map +0 -1
  713. package/resources/trigger.js +0 -12
  714. package/resources/trigger.js.map +0 -1
  715. package/resources/trigger.mjs +0 -8
  716. package/resources/trigger.mjs.map +0 -1
  717. package/resources/triggers-types.d.mts +0 -59
  718. package/resources/triggers-types.d.mts.map +0 -1
  719. package/resources/triggers-types.d.ts +0 -59
  720. package/resources/triggers-types.d.ts.map +0 -1
  721. package/resources/triggers-types.js +0 -19
  722. package/resources/triggers-types.js.map +0 -1
  723. package/resources/triggers-types.mjs +0 -15
  724. package/resources/triggers-types.mjs.map +0 -1
  725. package/resources.d.mts +0 -2
  726. package/resources.d.mts.map +0 -1
  727. package/resources.d.ts +0 -2
  728. package/resources.d.ts.map +0 -1
  729. package/resources.js +0 -18
  730. package/resources.js.map +0 -1
  731. package/resources.mjs +0 -2
  732. package/resources.mjs.map +0 -1
  733. package/src/api-promise.ts +0 -2
  734. package/src/client.ts +0 -938
  735. package/src/core/README.md +0 -3
  736. package/src/core/api-promise.ts +0 -92
  737. package/src/core/error.ts +0 -130
  738. package/src/core/resource.ts +0 -11
  739. package/src/core/uploads.ts +0 -2
  740. package/src/error.ts +0 -2
  741. package/src/index.ts +0 -22
  742. package/src/internal/README.md +0 -3
  743. package/src/internal/builtin-types.ts +0 -93
  744. package/src/internal/detect-platform.ts +0 -196
  745. package/src/internal/errors.ts +0 -33
  746. package/src/internal/headers.ts +0 -96
  747. package/src/internal/parse.ts +0 -50
  748. package/src/internal/qs/LICENSE.md +0 -13
  749. package/src/internal/qs/README.md +0 -3
  750. package/src/internal/qs/formats.ts +0 -9
  751. package/src/internal/qs/index.ts +0 -13
  752. package/src/internal/qs/stringify.ts +0 -388
  753. package/src/internal/qs/types.ts +0 -71
  754. package/src/internal/qs/utils.ts +0 -265
  755. package/src/internal/request-options.ts +0 -37
  756. package/src/internal/shim-types.d.ts +0 -28
  757. package/src/internal/shims/crypto.ts +0 -18
  758. package/src/internal/shims/file.ts +0 -32
  759. package/src/internal/shims/getBuiltinModule.ts +0 -66
  760. package/src/internal/shims/nullGetBuiltinModule.ts +0 -1
  761. package/src/internal/shims.ts +0 -107
  762. package/src/internal/to-file.ts +0 -152
  763. package/src/internal/types.ts +0 -92
  764. package/src/internal/uploads.ts +0 -175
  765. package/src/internal/utils/base64.ts +0 -39
  766. package/src/internal/utils/env.ts +0 -18
  767. package/src/internal/utils/log.ts +0 -127
  768. package/src/internal/utils/path.ts +0 -63
  769. package/src/internal/utils/sleep.ts +0 -3
  770. package/src/internal/utils/uuid.ts +0 -19
  771. package/src/internal/utils/values.ts +0 -102
  772. package/src/internal/utils.ts +0 -8
  773. package/src/lib/.keep +0 -4
  774. package/src/resource.ts +0 -2
  775. package/src/resources/action-execution.ts +0 -244
  776. package/src/resources/auth/auth.ts +0 -15
  777. package/src/resources/auth/index.ts +0 -4
  778. package/src/resources/auth/session.ts +0 -127
  779. package/src/resources/auth-configs.ts +0 -362
  780. package/src/resources/auth.ts +0 -3
  781. package/src/resources/cli.ts +0 -166
  782. package/src/resources/connected-accounts.ts +0 -661
  783. package/src/resources/index.ts +0 -105
  784. package/src/resources/mcp/command.ts +0 -47
  785. package/src/resources/mcp/index.ts +0 -17
  786. package/src/resources/mcp/mcp.ts +0 -519
  787. package/src/resources/mcp.ts +0 -3
  788. package/src/resources/org/api-key.ts +0 -30
  789. package/src/resources/org/index.ts +0 -12
  790. package/src/resources/org/org.ts +0 -39
  791. package/src/resources/org/project/api-keys.ts +0 -156
  792. package/src/resources/org/project/index.ts +0 -35
  793. package/src/resources/org/project/project.ts +0 -206
  794. package/src/resources/org/project/trigger.ts +0 -95
  795. package/src/resources/org/project/webhook.ts +0 -131
  796. package/src/resources/org/project.ts +0 -3
  797. package/src/resources/org.ts +0 -3
  798. package/src/resources/team-members.ts +0 -111
  799. package/src/resources/toolkits.ts +0 -232
  800. package/src/resources/tools.ts +0 -319
  801. package/src/resources/trigger-instances/handle.ts +0 -45
  802. package/src/resources/trigger-instances/index.ts +0 -19
  803. package/src/resources/trigger-instances/trigger-instances.ts +0 -202
  804. package/src/resources/trigger-instances.ts +0 -3
  805. package/src/resources/trigger.ts +0 -108
  806. package/src/resources/triggers-types.ts +0 -105
  807. package/src/resources.ts +0 -1
  808. package/src/tsconfig.json +0 -11
  809. package/src/uploads.ts +0 -2
  810. package/src/version.ts +0 -1
  811. package/uploads.d.mts +0 -2
  812. package/uploads.d.mts.map +0 -1
  813. package/uploads.d.ts +0 -2
  814. package/uploads.d.ts.map +0 -1
  815. package/uploads.js +0 -19
  816. package/uploads.js.map +0 -1
  817. package/uploads.mjs +0 -2
  818. package/uploads.mjs.map +0 -1
  819. package/version.d.mts +0 -2
  820. package/version.d.mts.map +0 -1
  821. package/version.d.ts +0 -2
  822. package/version.d.ts.map +0 -1
  823. package/version.js +0 -5
  824. package/version.js.map +0 -1
  825. package/version.mjs +0 -2
  826. package/version.mjs.map +0 -1
@@ -0,0 +1,2312 @@
1
+ import { i as APIUserAbortError, n as APIConnectionTimeoutError, s as ComposioError, t as APIConnectionError } from "./error-DLB1uKM3.mjs";
2
+
3
+ //#region src/compat/headers.ts
4
+ const hasEntries = (value) => typeof value === "object" && value !== null && "append" in value && typeof value.append === "function" && "delete" in value && typeof value.delete === "function" && "entries" in value && typeof value.entries === "function" && "get" in value && typeof value.get === "function";
5
+ const isHeaders = (value) => value instanceof Headers || hasEntries(value);
6
+ const isNullableHeadersLike = (headers) => {
7
+ if (!("values" in headers) || !isHeaders(headers.values) || !("nulls" in headers)) return false;
8
+ const nulls = headers.nulls;
9
+ return typeof nulls === "object" && nulls !== null && Symbol.iterator in nulls;
10
+ };
11
+ /**
12
+ * Iterates every supported input while preserving explicit deletions. Plain
13
+ * objects replace an older value for a key; tuple inputs append duplicate
14
+ * values, matching the published client.
15
+ */
16
+ function* iterateHeaders(headers) {
17
+ if (!headers) return;
18
+ if (isNullableHeadersLike(headers)) {
19
+ yield* headers.values.entries();
20
+ for (const name of headers.nulls) yield [name, null];
21
+ return;
22
+ }
23
+ const shouldReplace = !isHeaders(headers) && !Array.isArray(headers);
24
+ const entries = isHeaders(headers) ? headers.entries() : Array.isArray(headers) ? headers : Object.entries(headers);
25
+ for (const entry of entries) {
26
+ const name = entry[0];
27
+ if (typeof name !== "string") throw new TypeError("expected header name to be a string");
28
+ const rawValue = entry[1];
29
+ const values = Array.isArray(rawValue) ? rawValue : [rawValue];
30
+ let replaced = false;
31
+ for (const value of values) {
32
+ if (value === void 0) continue;
33
+ if (shouldReplace && !replaced) {
34
+ replaced = true;
35
+ yield [name, null];
36
+ }
37
+ yield [name, value];
38
+ }
39
+ }
40
+ }
41
+ /** Merge sources while retaining names explicitly deleted by the last source. */
42
+ const mergeHeaders = (sources) => {
43
+ const values = new Headers();
44
+ const nulls = /* @__PURE__ */ new Set();
45
+ for (const source of sources) {
46
+ if (!source) continue;
47
+ const seen = /* @__PURE__ */ new Set();
48
+ for (const [name, value] of iterateHeaders(source)) {
49
+ const lowerName = name.toLowerCase();
50
+ if (!seen.has(lowerName)) {
51
+ values.delete(name);
52
+ seen.add(lowerName);
53
+ }
54
+ if (value === null) {
55
+ values.delete(name);
56
+ nulls.add(lowerName);
57
+ } else {
58
+ values.append(name, value);
59
+ nulls.delete(lowerName);
60
+ }
61
+ }
62
+ }
63
+ return {
64
+ values,
65
+ nulls
66
+ };
67
+ };
68
+ /** Merge sources into the native header collection sent to fetch. */
69
+ const buildHeaders = (sources) => mergeHeaders(sources).values;
70
+
71
+ //#endregion
72
+ //#region src/compat/credentials.ts
73
+ /**
74
+ * The credential transport boundary.
75
+ *
76
+ * The design record makes authentication part of the runtime contract in both
77
+ * languages, with four rules. Three of them are enforced here and in
78
+ * `request.ts`; the fourth is a property of what this client's messages are
79
+ * built from, and is pinned by test rather than by code:
80
+ *
81
+ * 0. **A request carries exactly one credential header**, chosen from the
82
+ * operation's declared security schemes. Not a record rule — it is a
83
+ * measured property of the API (two credential headers on one request is a
84
+ * 401, even where either alone is a 200), so the four rules below are all
85
+ * stated about *the* credential a request carries, and {@link selectScheme}
86
+ * decides which one that is. See wayfinder ticket 48 and §4 of
87
+ * `docs/research/drop-in-contract.md`.
88
+ * 1. **A credentialed API origin must use HTTPS.** Plain `http:` is permitted
89
+ * only for loopback development endpoints, or for the exact origin a
90
+ * caller opts into with `allowInsecureHTTP` or
91
+ * `COMPOSIO_ALLOW_INSECURE_HTTP=1`.
92
+ * Enforced by {@link assertCredentialTransport} at construction and again
93
+ * by {@link credentialForRequest} at dispatch, because `apiKey` and
94
+ * `baseURL` are both public mutable fields on the client.
95
+ * 2. **The credential is attached only to requests whose origin matches the
96
+ * configured API origin.** {@link credentialForRequest} returns `null`
97
+ * off-origin, and the header is simply not sent.
98
+ * 3. **Credentials are never forwarded across an origin-changing redirect.**
99
+ * The kernel follows redirects itself (`request.ts`) rather than delegating
100
+ * to `fetch`, and every hop re-enters the header build — so the credential
101
+ * decision is re-derived from *that hop's* URL and rule 3 mostly falls out
102
+ * of rule 2. What does not fall out is the caller's own credential headers,
103
+ * which rule 2 deliberately leaves alone: {@link withdrawCredentials}
104
+ * removes those once a chain has changed origin.
105
+ * 4. **Credential-bearing values are redacted from logs and error messages.**
106
+ * Nothing here to do: no message this client constructs ever reads a
107
+ * request header or a request URL. `APIError.makeMessage` is built from the
108
+ * status and the response *body*; the deprecation notice is built from the
109
+ * operation template and parsed public response-header values. Pinned in
110
+ * `test/unit/credential-boundary.test.ts` so it stays true.
111
+ *
112
+ * ### Failure modes, and why they differ
113
+ *
114
+ * Rule 1 **throws**. A plaintext credentialed origin is a configuration
115
+ * mistake with no safe interpretation: dropping the key instead would turn it
116
+ * into a stream of confusing 401s that never names the real cause, and sending
117
+ * it is the thing being prevented. Throwing at construction puts the error on
118
+ * the line that made the mistake.
119
+ *
120
+ * Rule 2 **drops the credential and continues**. The record states it as an
121
+ * attachment rule, not an error, and the runtime genuinely cannot tell an
122
+ * attack from a legitimate off-origin fetch — this API mints presigned upload
123
+ * and download URLs (`files.createPresignedURL`,
124
+ * `session.files.createDownloadURL`) that live on a storage origin, and a
125
+ * caller reaching one through the escape hatch is doing something reasonable.
126
+ * Dropping makes that safe; throwing would make it impossible.
127
+ *
128
+ * Rule 3 **follows the hop without the credential** rather than refusing to
129
+ * hop. Refusing was the first spelling, and it was overruled on a parity
130
+ * argument worth recording: Stainless followed redirects, no differential
131
+ * fixture redirects, so a green suite would have been evidence that the
132
+ * *tests* do not redirect — not that production does not. The rule itself is
133
+ * unchanged; only the remedy is.
134
+ *
135
+ * ### Divergence from Stainless
136
+ *
137
+ * Deliberate, and sanctioned by the design record: the published Stainless
138
+ * client enforces none of this. Redirect *following* is no longer part of the
139
+ * divergence — both clients follow — but what rides along on the hop is. See
140
+ * §4 of `docs/research/drop-in-contract.md` and wayfinder ticket 40.
141
+ */
142
+ /**
143
+ * The three credential classes this API accepts, and the header each one puts
144
+ * on the wire.
145
+ *
146
+ * These are the `apiKey`-in-header schemes `spec/openapi.json` declares under
147
+ * `components.securitySchemes`. The fourth declared one, `CookieAuth`, is
148
+ * referenced by no operation and is not a thing a client library places.
149
+ */
150
+ const SCHEME_HEADERS = {
151
+ ApiKeyAuth: "x-api-key",
152
+ UserApiKeyAuth: "x-user-api-key",
153
+ OrgApiKeyAuth: "x-org-api-key"
154
+ };
155
+ /** The scheme a request authenticates with when its operation names none. */
156
+ const DEFAULT_SCHEME = "ApiKeyAuth";
157
+ const valueFor = (scheme, credentials) => scheme === "ApiKeyAuth" ? credentials.apiKey : scheme === "UserApiKeyAuth" ? credentials.userApiKey : credentials.orgApiKey;
158
+ /**
159
+ * Whether anything beyond the project key is configured — the condition that
160
+ * makes per-operation selection able to change an outcome at all.
161
+ *
162
+ * Load-bearing rather than an optimization. With only `apiKey` set, every
163
+ * branch of {@link selectScheme} lands on `ApiKeyAuth`: it wins wherever it is
164
+ * an accepted alternative, and where it is not, the alternative is unconfigured
165
+ * and the fallback is `ApiKeyAuth` again. So the client that every existing
166
+ * caller constructs never consults the operation table, and "an `apiKey`-only
167
+ * client emits byte-identical requests on all 104 operations" is a property of
168
+ * the code shape rather than a claim tests have to keep re-establishing.
169
+ */
170
+ const hasAlternateCredential = (credentials) => credentials.userApiKey !== null || credentials.orgApiKey !== null;
171
+ /**
172
+ * Which credential a request declaring `schemes` should carry.
173
+ *
174
+ * **Exactly one, always** — and the API says so itself. Measured against
175
+ * production on 2026-08-06, `GET /toolkits` answers 200 for `x-api-key` alone
176
+ * and 200 for `x-user-api-key` alone, and answers both together with
177
+ * `401 HTTP_Unauthorized`:
178
+ *
179
+ * > Multiple authentication modes were provided. Provide exactly one
180
+ * > authentication mode per request. Provided: ApiKeyAuth via x-api-key,
181
+ * > UserApiKeyAuth via x-user-api-key.
182
+ *
183
+ * The platform names the schemes by their OpenAPI names, so this is the same
184
+ * vocabulary `security` is written in rather than a coincidence of headers. It
185
+ * holds for `x-api-key` + `x-org-api-key` too, and on an operation that accepts
186
+ * only one of them. There is therefore no additive "send the user key as well"
187
+ * model available, and the choice has to be made per request rather than
188
+ * accumulated.
189
+ *
190
+ * The precedence exists to make the change free where it must be free:
191
+ *
192
+ * 1. **`ApiKeyAuth` wins wherever the operation accepts it** and an `apiKey` is
193
+ * configured — 85 of the 104 operations, every wire byte preserved.
194
+ * 2. Otherwise the first scheme the operation names that this client both
195
+ * recognizes *and* holds a credential for. That is what makes the 16
196
+ * `UserApiKeyAuth`-only and `OrgApiKeyAuth`-only operations reachable.
197
+ * 3. Otherwise `ApiKeyAuth`, which is what this client did before any of this
198
+ * existed. A `UserApiKeyAuth`-only operation called by a client with no user
199
+ * key still sends `x-api-key` and still fails the same way — which is what
200
+ * keeps `cli.realtime.auth` and `cli.realtime.credentials` pinned against
201
+ * the Stainless oracle in `test/unit/differential-wire.test.ts`.
202
+ *
203
+ * Rule 3 is also where a scheme name this client does not know lands. Three of
204
+ * them exist: `security` references `no_auth` (3 operations) and
205
+ * `workbench_access_key` (1) and `components.securitySchemes` declares neither.
206
+ * Those four operations receive `x-api-key` today and are differentially
207
+ * pinned doing so, so resolving an unknown name to "no credential" would be a
208
+ * wire change made on the strength of a spec defect. A later generator pass
209
+ * must not "fix" that.
210
+ */
211
+ const selectScheme = (schemes, credentials) => {
212
+ if (schemes === void 0 || schemes.length === 0) return DEFAULT_SCHEME;
213
+ if (schemes.includes(DEFAULT_SCHEME) && credentials.apiKey !== null) return DEFAULT_SCHEME;
214
+ for (const scheme of schemes) {
215
+ if (!Object.hasOwn(SCHEME_HEADERS, scheme)) continue;
216
+ const known = scheme;
217
+ if (valueFor(known, credentials) !== null) return known;
218
+ }
219
+ return DEFAULT_SCHEME;
220
+ };
221
+ /**
222
+ * What counts as loopback, pinned rather than assumed. `localhost` is not the
223
+ * whole set:
224
+ *
225
+ * - `localhost`, and any name under it (`api.localhost`). RFC 6761 §6.3
226
+ * reserves the whole `.localhost` TLD to resolve to the loopback interface,
227
+ * and container-era dev setups do use subdomains of it.
228
+ * - The entire IPv4 loopback block `127.0.0.0/8`, not just `127.0.0.1`.
229
+ * - The IPv6 loopback `::1`. `URL` hands hostnames back bracketed and in
230
+ * canonical compressed form, so `http://[0:0:0:0:0:0:0:1]/` arrives here as
231
+ * `[::1]`.
232
+ *
233
+ * Everything else is not loopback, deliberately. `0.0.0.0` in particular is the
234
+ * unspecified address, not a loopback one; it happens to reach the local host
235
+ * on some platforms and fails on others, and a rule that depends on the
236
+ * platform is not a rule. The IPv4-mapped spelling `::ffff:127.0.0.1` is
237
+ * refused for the same reason — Python's `ipaddress` answers it differently
238
+ * across interpreter versions, and nobody configures a development endpoint
239
+ * that way. The error message names the accepted set so a developer who typed
240
+ * `0.0.0.0` sees the fix immediately.
241
+ */
242
+ const LOOPBACK_IPV4 = /^127(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}$/;
243
+ const isLoopbackHostname = (hostname) => {
244
+ const host = hostname.trim().toLowerCase().replace(/^\[|\]$/g, "");
245
+ if (host === "localhost" || host.endsWith(".localhost")) return true;
246
+ if (host === "::1") return true;
247
+ return LOOPBACK_IPV4.test(host);
248
+ };
249
+ /** The URL, parsed, when it is absolute and http(s); `null` otherwise. */
250
+ const parseHTTPURL = (value) => {
251
+ try {
252
+ const url = new URL(value);
253
+ return url.protocol === "http:" || url.protocol === "https:" ? url : null;
254
+ } catch {
255
+ return null;
256
+ }
257
+ };
258
+ /**
259
+ * The URL `target` names, resolved against `base`, when it lands on http(s);
260
+ * `null` when it cannot be parsed or names a scheme this client does not
261
+ * speak. The one spelling of "resolve against a base, http(s) only" — the
262
+ * redirect follower and the deprecation link resolver both need exactly this.
263
+ */
264
+ const resolveHTTPURL = (target, base) => {
265
+ try {
266
+ return parseHTTPURL(new URL(target, base).href);
267
+ } catch {
268
+ return null;
269
+ }
270
+ };
271
+ /** Whether a credential may be sent to this origin at all. */
272
+ const isCredentialSafeOrigin = (url, allowedHTTPOrigin = null) => url.protocol === "https:" || url.protocol === "http:" && (isLoopbackHostname(url.hostname) || allowedHTTPOrigin !== null && url.origin === allowedHTTPOrigin);
273
+ const LOOPBACK_DESCRIPTION = "localhost, *.localhost, 127.0.0.0/8, [::1]";
274
+ const insecureOriginMessage = (baseURL) => `Refusing to send a Composio API credential to ${baseURL}: a credentialed API origin must use HTTPS. By default, plain http:// is permitted only for loopback development endpoints (${LOOPBACK_DESCRIPTION}). Pass an https:// baseURL, use environment: 'local', set allowInsecureHTTP: true (or COMPOSIO_ALLOW_INSECURE_HTTP=1) for the configured development origin, or construct the client without credentials.`;
275
+ /** Whether the client holds anything at all that rule 1 has to protect. */
276
+ const anyCredential = (credentials) => credentials.apiKey !== null || hasAlternateCredential(credentials);
277
+ /**
278
+ * Rule 1 at construction time: a client that holds a credential must be
279
+ * pointed at an origin that can carry one. Knowable before any request is
280
+ * made, so it fails on the constructor call rather than on the first dispatch.
281
+ *
282
+ * A `baseURL` that is not an absolute http(s) URL fails the same way — a
283
+ * credential cannot be sent over a scheme this client does not speak, and the
284
+ * alternative is a `TypeError` from `new URL()` one layer down.
285
+ *
286
+ * Every configured credential counts, not just `apiKey`: which one a given
287
+ * request carries is decided per operation, so a client holding *any* of them
288
+ * is a client that can put one on the wire.
289
+ */
290
+ const assertCredentialTransport = (baseURL, credentials, allowedHTTPOrigin = null) => {
291
+ if (!anyCredential(credentials)) return;
292
+ const url = parseHTTPURL(baseURL);
293
+ if (url === null || !isCredentialSafeOrigin(url, allowedHTTPOrigin)) throw new ComposioError(insecureOriginMessage(baseURL));
294
+ };
295
+ /**
296
+ * The credential this request may carry, or `null` for none.
297
+ *
298
+ * Rules 1 and 2 at dispatch time. Both re-checks are load-bearing rather than
299
+ * belt-and-braces: `apiKey` and `baseURL` are public mutable fields, so the
300
+ * construction-time check can be invalidated by an assignment, and the request
301
+ * URL is *not* guaranteed to sit on the configured origin. `buildURL`
302
+ * concatenates `baseURL + path` and the escape hatch (`client.get(path)`)
303
+ * takes an arbitrary path, so a path that does not begin with `/` extends the
304
+ * *authority* rather than the path: `client.get('.evil.example/x')` against
305
+ * `https://backend.composio.dev` resolves to
306
+ * `https://backend.composio.dev.evil.example/x`, and `client.get(':8443/x')`
307
+ * changes the port. Both were carrying `x-api-key` before this boundary
308
+ * existed. (The userinfo spelling — `client.get('@evil.example/x')` — reaches
309
+ * a third origin too, but `fetch` refuses to construct a `Request` from a URL
310
+ * with credentials, so that one dies at the transport instead. httpx has no
311
+ * such objection, which is why the Python port checks the same thing.)
312
+ */
313
+ const credentialForRequest = (baseURL, scheme, credentials, requestURL, allowedHTTPOrigin = null) => {
314
+ const value = valueFor(scheme, credentials);
315
+ if (value === null) return null;
316
+ const base = parseHTTPURL(baseURL);
317
+ const target = parseHTTPURL(requestURL);
318
+ if (base === null || target === null) return null;
319
+ if (base.origin !== target.origin) return null;
320
+ if (!isCredentialSafeOrigin(target, allowedHTTPOrigin)) throw new ComposioError(insecureOriginMessage(baseURL));
321
+ return {
322
+ name: SCHEME_HEADERS[scheme],
323
+ value
324
+ };
325
+ };
326
+ /**
327
+ * Whether two absolute http(s) URLs share an origin, by the same test
328
+ * {@link credentialForRequest} applies. An unparseable side is never the same
329
+ * origin as anything. Python's `same_origin` is the twin.
330
+ */
331
+ const sameOrigin = (a, b) => {
332
+ const origin = parseHTTPURL(a)?.origin;
333
+ return origin !== void 0 && origin === parseHTTPURL(b)?.origin;
334
+ };
335
+ /**
336
+ * The credential headers a *caller* can place that are not the one this client
337
+ * attaches — `x-api-key` is excluded because a caller setting it is overriding
338
+ * the client's own value in the same slot, which is pinned Stainless behaviour,
339
+ * not a second credential.
340
+ */
341
+ const FOREIGN_CREDENTIAL_HEADERS = ["x-user-api-key", "x-org-api-key"];
342
+ /**
343
+ * Whether the caller has placed a credential of their own, in which case the
344
+ * client must not add one beside it.
345
+ *
346
+ * Not a courtesy: this API answers a request carrying two credential headers
347
+ * with `401 HTTP_Unauthorized`, so attaching `x-api-key` next to a caller's
348
+ * `x-user-api-key` does not weaken the call, it *breaks* it. Three released
349
+ * methods make that reachable without any `defaultHeaders` at all —
350
+ * `cli.createCodactFailure`, `org.consumer.project.resolve` and
351
+ * `org.consumer.listConnectedToolkits` declare `x-user-api-key` as a `required`
352
+ * header parameter, which the generator folds into their params object. Calling
353
+ * them the way their signature asks for returned 401 until this rule existed.
354
+ *
355
+ * Header merging is replayed rather than approximated, because a later source
356
+ * may carry `null` to delete what an earlier one set (`buildHeaders`).
357
+ */
358
+ const callerPlacedCredential = (sources) => {
359
+ if (!sources.some(Boolean)) return false;
360
+ const headers = buildHeaders(sources);
361
+ return FOREIGN_CREDENTIAL_HEADERS.some((name) => headers.has(name));
362
+ };
363
+ /**
364
+ * Header names that carry a credential and must not survive an origin change.
365
+ *
366
+ * The first three are what `fetch` itself would have stripped had it been
367
+ * following the redirect (Fetch §4.4 "HTTP-redirect fetch" deletes
368
+ * `Authorization` cross-origin; `Cookie` and `Proxy-Authorization` are
369
+ * forbidden header names a page cannot set and a server-side fetch does not
370
+ * carry across origins). Following redirects by hand means taking that job on.
371
+ * `x-api-key` joins them because it is *this* API's credential, and because the
372
+ * Fetch spec would not have stripped it — a custom header rides along a
373
+ * cross-origin redirect, which is the hole this whole module exists to close.
374
+ *
375
+ * `x-user-api-key` and `x-org-api-key` are the spec's other two credential
376
+ * schemes (`UserApiKeyAuth`, `OrgApiKeyAuth`), and they belong here for the same
377
+ * reason `x-api-key` does — the kernel attaches all three (wayfinder ticket 48)
378
+ * and a caller can place the latter two directly besides. They were listed here
379
+ * one ticket *before* the attachment work, because omitting them cost more than
380
+ * a missed withdrawal: {@link carriesCredentials} answered `false` for a request
381
+ * carrying only one of them, so `request.ts` classified it as credential-free
382
+ * and handed the whole chain to `fetch` at `redirect: 'follow'` — the exact leak
383
+ * rule 3 exists to close, arriving through a different header name.
384
+ *
385
+ * This list is the repo's answer to "which header names carry a credential",
386
+ * and the live parity harness needs the same answer: it redacts these values
387
+ * where it renders a captured request into a summary someone reads on a
388
+ * terminal. It cannot import them — the harness runs under `node
389
+ * --experimental-transform-types`, which does not resolve this module's `.js`
390
+ * specifiers — so `packages/parity/src/core/compare.ts` mirrors the list and a
391
+ * test there reads this file to hold the two in step, the same arrangement the
392
+ * Python driver's protocol version already uses.
393
+ */
394
+ const CREDENTIAL_HEADERS = [
395
+ "authorization",
396
+ "cookie",
397
+ "proxy-authorization",
398
+ "x-api-key",
399
+ "x-user-api-key",
400
+ "x-org-api-key"
401
+ ];
402
+ /**
403
+ * Rule 3 for headers the caller placed, applied when a redirect chain changes
404
+ * origin.
405
+ *
406
+ * Rule 2 deliberately leaves a caller's own `defaultHeaders` / per-request
407
+ * headers alone on the *initial* request, even off-origin: the caller chose
408
+ * that URL, and an escape-hatch call to a presigned storage URL carrying its
409
+ * own `Authorization` is a legitimate thing to do. A redirect target is chosen
410
+ * by the *server*, not the caller, so the same consent does not extend to it.
411
+ *
412
+ * Withdrawal is **sticky** for the rest of the chain: once a hop has left the
413
+ * origin it started on, no later hop re-attaches a credential, not even one
414
+ * that lands back on the configured API origin. A real API does not bounce a
415
+ * caller off-site and back, and "no credential after the chain leaves" is one
416
+ * sentence rather than a case analysis.
417
+ */
418
+ const withdrawCredentials = (headers) => {
419
+ for (const name of CREDENTIAL_HEADERS) headers.delete(name);
420
+ };
421
+ /**
422
+ * Whether these headers carry anything that must not cross an origin change —
423
+ * the exact complement of {@link withdrawCredentials}, sharing its list so the
424
+ * two cannot drift apart.
425
+ *
426
+ * `request.ts` asks this before the *first* dispatch of a chain. A request
427
+ * carrying nothing credential-bearing has nothing to protect, so following it
428
+ * by hand buys nothing the platform's own following does not already give:
429
+ * `fetch` strips exactly these header names across a cross-origin hop, applies
430
+ * the same method rewrite, and enforces the same 20-hop budget. Delegating is
431
+ * therefore provably equivalent there — and it is the only way a *browser* can
432
+ * follow a redirect at all.
433
+ */
434
+ const carriesCredentials = (headers) => CREDENTIAL_HEADERS.some((name) => headers.has(name));
435
+
436
+ //#endregion
437
+ //#region src/compat/deprecation.ts
438
+ /**
439
+ * Runtime deprecation notices, read off the response.
440
+ *
441
+ * The server announces a deprecated operation with three standard fields:
442
+ *
443
+ * - `Deprecation` (RFC 9745) — an Item Structured Field whose value is a Date
444
+ * (RFC 9651 §3.3.7): an `@` followed by integer seconds since the Unix
445
+ * epoch, e.g. `Deprecation: @1688169599`.
446
+ * - `Sunset` (RFC 8594) — an HTTP-date, e.g. `Sunset: Sat, 31 Dec 2018
447
+ * 23:59:59 GMT`, naming the date the operation stops being served.
448
+ * - `Link` (RFC 8288) — `rel="deprecation"` points at human-readable notes
449
+ * (RFC 9745 registers that relation); `rel="successor-version"` (RFC 5829)
450
+ * points at the replacement resource, which this module maps back to a
451
+ * public client chain when it can.
452
+ *
453
+ * The authoring-time half of the same contract already exists: an operation
454
+ * the input schema marks `deprecated: true` reaches the generated method as a
455
+ * `@deprecated` annotation. This is the runtime half, and the two are
456
+ * independent — a notice fires because the *server* said so, never because the
457
+ * committed snapshot did, so it stays correct between spec syncs.
458
+ *
459
+ * Everything here is defensive by construction. A deprecation notice is
460
+ * advisory; it must never break a live call, so a field that is oversized,
461
+ * carries control characters, or simply does not parse is dropped rather than
462
+ * raised.
463
+ */
464
+ /**
465
+ * Field-size ceiling. A deprecation notice is decoration on a response that
466
+ * has already been paid for, so an oversized field is dropped rather than
467
+ * parsed — there is no message worth building out of 2 KiB of `Link`.
468
+ */
469
+ const MAX_FIELD_LENGTH = 2048;
470
+ /** No message this client emits may smuggle control characters into a log. */
471
+ const CONTROL_CHARACTERS = /[\u0000-\u001f\u007f]/;
472
+ /**
473
+ * How many distinct (operation, notice) pairs one client instance will ever
474
+ * warn about. Generated methods draw from a fixed table of ~100 and a server
475
+ * revises a notice rarely, so the bound is unreachable in practice; it exists
476
+ * because both halves of the key are ultimately server- or caller-controlled —
477
+ * an escape-hatch caller (`client.get('/api/v3.1/…/{id}')`) keys on the
478
+ * substituted path, and a server rotating `Sunset` or `Link` on every response
479
+ * mints a fresh pair each time. Past the ceiling the client stops warning
480
+ * rather than growing a set forever.
481
+ */
482
+ const MAX_TRACKED_NOTICES = 1024;
483
+ const readField = (headers, name) => {
484
+ const value = headers.get(name);
485
+ if (value === null) return null;
486
+ if (value.length > MAX_FIELD_LENGTH || CONTROL_CHARACTERS.test(value)) return null;
487
+ return value;
488
+ };
489
+ /**
490
+ * RFC 9651 §3.3.7 sf-date: `@` then integer seconds since the epoch, possibly
491
+ * negative. Anything else — including the pre-RFC `true` and bare HTTP-date
492
+ * spellings the draft years produced — yields no date; the notice still fires,
493
+ * because the server sending the field at all is the signal.
494
+ */
495
+ const parseStructuredDate = (value) => {
496
+ const match = /^@(-?\d{1,15})$/.exec(value.trim());
497
+ if (match === null) return null;
498
+ const date = /* @__PURE__ */ new Date(Number(match[1]) * 1e3);
499
+ return Number.isNaN(date.getTime()) ? null : date;
500
+ };
501
+ const MONTHS = [
502
+ "Jan",
503
+ "Feb",
504
+ "Mar",
505
+ "Apr",
506
+ "May",
507
+ "Jun",
508
+ "Jul",
509
+ "Aug",
510
+ "Sep",
511
+ "Oct",
512
+ "Nov",
513
+ "Dec"
514
+ ];
515
+ const DAY = "(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun)";
516
+ const DAY_LONG = "(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday)";
517
+ const MONTH = `(${MONTHS.join("|")})`;
518
+ const TIME = "(\\d{2}):(\\d{2}):(\\d{2})";
519
+ /** `day-name "," SP 2DIGIT SP month SP 4DIGIT SP time-of-day SP GMT` */
520
+ const IMF_FIXDATE = new RegExp(`^${DAY}, (\\d{2}) ${MONTH} (\\d{4}) ${TIME} GMT$`);
521
+ /** `day-name-l "," SP 2DIGIT "-" month "-" 2DIGIT SP time-of-day SP GMT` */
522
+ const RFC850_DATE = new RegExp(`^${DAY_LONG}, (\\d{2})-${MONTH}-(\\d{2}) ${TIME} GMT$`);
523
+ /** `day-name SP month SP ( 2DIGIT / ( SP 1DIGIT ) ) SP time-of-day SP 4DIGIT` */
524
+ const ASCTIME_DATE = new RegExp(`^${DAY} ${MONTH} (\\d{2}| \\d) ${TIME} (\\d{4})$`);
525
+ const isLeapYear = (year) => year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;
526
+ const daysInMonth = (year, month) => month === 2 ? isLeapYear(year) ? 29 : 28 : month === 4 || month === 6 || month === 9 || month === 11 ? 30 : 31;
527
+ /**
528
+ * RFC 8594 `Sunset`: an HTTP-date, which RFC 7231 §7.1.1.1 defines as exactly
529
+ * three forms — IMF-fixdate (the only one a sender may generate), and the
530
+ * obsolete rfc850-date and asctime-date a recipient must still accept. All
531
+ * three denote UTC; only IMF-fixdate and rfc850-date spell the `GMT` literal,
532
+ * and asctime-date carries no zone because it never means anything else.
533
+ *
534
+ * Written out by hand rather than delegated to `Date.parse`, which is not a
535
+ * conformance bug but three:
536
+ *
537
+ * - It **fabricates dates.** `Sat, 31 Feb 2018 23:59:59 GMT` parsed as
538
+ * 2018-03-03 — the client would have told a caller its endpoint disappears
539
+ * on a date the server never sent. The calendar is checked here instead of
540
+ * normalized, so an impossible day yields no date at all.
541
+ * - It is **host-dependent.** For any input outside the ISO-8601 grammar,
542
+ * `Date.parse` is implementation-defined, and V8 falls back to a lenient
543
+ * reader that applies the *local* offset when a value carries no zone. Both
544
+ * `December 31, 2018` and a zone-less `Sat, 31 Dec 2018 23:59:59` therefore
545
+ * produced a different instant on a developer's laptop than in CI — a
546
+ * parsed field with no stable value.
547
+ * - It **disagreed with the Python client**, whose RFC-5322 reader rejected
548
+ * every one of those inputs. The two clients are held to identical parses;
549
+ * `test/fixtures/http-date-vectors.json` is the table both suites read.
550
+ *
551
+ * Rejection is not a silencer: an unparseable `Sunset` leaves the removal date
552
+ * out of the warning, and the notice still fires on the field's presence — the
553
+ * same stance `parseStructuredDate` takes on `Deprecation`.
554
+ */
555
+ const parseHttpDate = (value) => {
556
+ const trimmed = value.trim();
557
+ let fields = null;
558
+ const imf = IMF_FIXDATE.exec(trimmed);
559
+ if (imf !== null) fields = [
560
+ Number(imf[3]),
561
+ imf[2],
562
+ imf[1],
563
+ imf.slice(4, 7)
564
+ ];
565
+ else {
566
+ const rfc850 = RFC850_DATE.exec(trimmed);
567
+ if (rfc850 !== null) {
568
+ const short = Number(rfc850[3]);
569
+ fields = [
570
+ short < 70 ? 2e3 + short : 1900 + short,
571
+ rfc850[2],
572
+ rfc850[1],
573
+ rfc850.slice(4, 7)
574
+ ];
575
+ } else {
576
+ const asctime = ASCTIME_DATE.exec(trimmed);
577
+ if (asctime !== null) fields = [
578
+ Number(asctime[6]),
579
+ asctime[1],
580
+ asctime[2].trim(),
581
+ asctime.slice(3, 6)
582
+ ];
583
+ }
584
+ }
585
+ if (fields === null) return null;
586
+ const [year, month, day, time] = fields;
587
+ const monthIndex = MONTHS.indexOf(month);
588
+ const dayNumber = Number(day);
589
+ const [hour, minute, second] = time.map(Number);
590
+ if (year < 1) return null;
591
+ if (dayNumber < 1 || dayNumber > daysInMonth(year, monthIndex + 1)) return null;
592
+ if (hour > 23 || minute > 59 || second > 59) return null;
593
+ const date = new Date(Date.UTC(year, monthIndex, dayNumber, hour, minute, second));
594
+ if (year < 100) date.setUTCFullYear(year);
595
+ return date;
596
+ };
597
+ /**
598
+ * RFC 8288 `Link`, enough of it: a comma-separated list of `<target>` followed
599
+ * by `;`-separated parameters, where a parameter value may be quoted (and may
600
+ * therefore contain commas and semicolons). Only `rel` and the presence of
601
+ * `anchor` are retained. Malformed input truncates the list instead of failing
602
+ * — whatever parsed before the damage is still usable.
603
+ *
604
+ * Per RFC 8288 §3.3 only the *first* `rel` on a link counts; later occurrences
605
+ * are ignored. Accumulating them instead would let `rel=alternate;
606
+ * rel=deprecation` smuggle an arbitrary target into the relation this client
607
+ * acts on.
608
+ */
609
+ const parseLinkField = (value) => {
610
+ const links = [];
611
+ let index = 0;
612
+ const isSpace = (char) => char === " " || char === " ";
613
+ while (index < value.length) {
614
+ while (index < value.length && (value[index] === "," || isSpace(value[index]))) index++;
615
+ if (value[index] !== "<") break;
616
+ const close = value.indexOf(">", index);
617
+ if (close < 0) break;
618
+ const target = value.slice(index + 1, close).trim();
619
+ index = close + 1;
620
+ const rels = [];
621
+ let seenRel = false;
622
+ let anchored = false;
623
+ while (index < value.length) {
624
+ while (index < value.length && isSpace(value[index])) index++;
625
+ if (value[index] === ",") {
626
+ index++;
627
+ break;
628
+ }
629
+ if (value[index] !== ";") {
630
+ index++;
631
+ continue;
632
+ }
633
+ index++;
634
+ const nameStart = index;
635
+ while (index < value.length && !"=;,".includes(value[index] ?? "")) index++;
636
+ const name = value.slice(nameStart, index).trim().toLowerCase();
637
+ let parameter = "";
638
+ if (value[index] === "=") {
639
+ index++;
640
+ while (index < value.length && isSpace(value[index])) index++;
641
+ if (value[index] === "\"") {
642
+ index++;
643
+ while (index < value.length && value[index] !== "\"") {
644
+ if (value[index] === "\\" && index + 1 < value.length) {
645
+ parameter += value[index + 1];
646
+ index += 2;
647
+ continue;
648
+ }
649
+ parameter += value[index];
650
+ index++;
651
+ }
652
+ index++;
653
+ } else {
654
+ const start = index;
655
+ while (index < value.length && value[index] !== ";" && value[index] !== ",") index++;
656
+ parameter = value.slice(start, index).trim();
657
+ }
658
+ }
659
+ if (name === "rel" && !seenRel) {
660
+ seenRel = true;
661
+ for (const rel of parameter.split(/\s+/)) if (rel !== "") rels.push(rel.toLowerCase());
662
+ }
663
+ if (name === "anchor") anchored = true;
664
+ }
665
+ links.push({
666
+ target,
667
+ rels,
668
+ anchored
669
+ });
670
+ }
671
+ return links;
672
+ };
673
+ const httpURL = (target, baseURL) => resolveHTTPURL(target, baseURL);
674
+ /**
675
+ * A successor is only followed as far as *naming* it, and only when it lands
676
+ * on the API this client is configured against.
677
+ *
678
+ * Two different URLs are in play and conflating them is a real exposure. The
679
+ * *context* is the URL the response actually came from, which is what RFC 8288
680
+ * §3.1 resolves a relative target against — and after a redirect that is not
681
+ * the URL we asked for. The *origin allowlist* is the client's configured
682
+ * `baseURL`, and it stays the allowlist precisely because a redirected
683
+ * response must not be able to nominate itself: resolving against the context
684
+ * but validating against `baseURL` is what stops a cross-origin hop from
685
+ * emitting a relative link that lands back on our origin and passes the check.
686
+ */
687
+ const sameOriginURL = (target, contextURL, baseURL) => {
688
+ const url = httpURL(target, contextURL);
689
+ if (url === null) return null;
690
+ const base = httpURL(baseURL, baseURL);
691
+ return base !== null && url.origin === base.origin ? url : null;
692
+ };
693
+ /**
694
+ * The notice a response carries, or `null` when it carries none. The
695
+ * `Deprecation` field's *presence* is what marks the operation deprecated;
696
+ * `Sunset` and `Link` only enrich the message.
697
+ *
698
+ * `contextURL` is the response's own URL (post-redirect), the context RFC 8288
699
+ * resolves relative link targets against; `baseURL` is the configured API
700
+ * origin a successor must land on.
701
+ */
702
+ const parseDeprecation = (headers, contextURL, baseURL) => {
703
+ const deprecation = readField(headers, "deprecation");
704
+ if (deprecation === null) return null;
705
+ const sunset = readField(headers, "sunset");
706
+ const link = readField(headers, "link");
707
+ const links = link === null ? [] : parseLinkField(link);
708
+ const targetFor = (rel) => links.find((candidate) => !candidate.anchored && candidate.rels.includes(rel))?.target ?? null;
709
+ const documentation = targetFor("deprecation");
710
+ const successor = targetFor("successor-version");
711
+ return {
712
+ deprecatedAt: parseStructuredDate(deprecation),
713
+ sunsetAt: sunset === null ? null : parseHttpDate(sunset),
714
+ documentation: documentation === null ? null : httpURL(documentation, contextURL)?.href ?? null,
715
+ successor: successor === null ? null : sameOriginURL(successor, contextURL, baseURL)
716
+ };
717
+ };
718
+ const pathSegments = (path) => (path.split(/[?#]/, 1)[0] ?? "").split("/").filter((segment) => segment !== "");
719
+ /**
720
+ * Template segments, keyed by descriptor so the cache holds only entries the
721
+ * operations table (or a test's stand-in for it) is still keeping alive. The
722
+ * table is module-level and immutable, so every logical call re-split the same
723
+ * 104 templates for nothing once the match became unconditional.
724
+ */
725
+ const templateSegments = /* @__PURE__ */ new WeakMap();
726
+ const segmentsOf = (operation) => {
727
+ const cached = templateSegments.get(operation);
728
+ if (cached !== void 0) return cached;
729
+ const segments = pathSegments(operation.path);
730
+ templateSegments.set(operation, segments);
731
+ return segments;
732
+ };
733
+ const isTemplateParam = (segment) => segment.startsWith("{") && segment.endsWith("}");
734
+ /**
735
+ * The operation a dispatched request belongs to, recovered from the path it
736
+ * went out on. Path parameters are percent-encoded on the way out
737
+ * (`encodeURIPath`), which encodes `/` and leaves the unreserved characters
738
+ * every literal template segment is made of — so a substituted path has the
739
+ * same segment count as its template and its literal segments compare byte for
740
+ * byte.
741
+ *
742
+ * Where a parameterized template and a literal one overlap
743
+ * (`/toolkits/{slug}` against `/toolkits/categories`) the literal wins, which
744
+ * is the same most-specific-first rule the server routes by.
745
+ *
746
+ * **Known limit of recovering identity from the path**, and who still pays
747
+ * it. Two accessors can emit byte-identical requests —
748
+ * `client.toolkits.retrieve('categories')` and
749
+ * `client.toolkits.retrieveCategories()` both dispatch
750
+ * `GET /api/v3.1/toolkits/categories` — so nothing observable distinguishes
751
+ * them here and the literal sibling is always the one named. That is inherent
752
+ * to reverse-matching, not a bug in the matcher.
753
+ *
754
+ * Generated calls no longer reach this function at all: each one carries its
755
+ * own descriptor through dispatch (`withOperation` in `request.ts`), so
756
+ * `toolkits.retrieve('categories')` is now named as itself. What is left here
757
+ * is the escape hatch — `client.get('/api/v3.1/toolkits/categories')` — whose
758
+ * identity genuinely is not knowable before runtime, and for which naming the
759
+ * literal sibling remains the honest answer.
760
+ */
761
+ const matchOperation = (method, path, operations) => {
762
+ const segments = pathSegments(path);
763
+ let best = null;
764
+ let bestLiterals = -1;
765
+ for (const operation of operations) {
766
+ if (operation.method !== method) continue;
767
+ const template = segmentsOf(operation);
768
+ if (template.length !== segments.length) continue;
769
+ let literals = 0;
770
+ let matched = true;
771
+ for (const [index, part] of template.entries()) {
772
+ if (isTemplateParam(part)) continue;
773
+ if (part !== segments[index]) {
774
+ matched = false;
775
+ break;
776
+ }
777
+ literals++;
778
+ }
779
+ if (matched && literals > bestLiterals) {
780
+ best = operation;
781
+ bestLiterals = literals;
782
+ }
783
+ }
784
+ return best;
785
+ };
786
+ /**
787
+ * The client chain a successor URL names, under the *same* HTTP method.
788
+ *
789
+ * RFC 5829's `successor-version` points at a resource, and an earlier revision
790
+ * of this code fell back to any unambiguous match under a different method
791
+ * when the same one missed. That was wrong in a way that matters: it could
792
+ * answer a deprecated `GET` with "use `client.<resource>.create` instead", telling the
793
+ * caller to replace a read with a write. A successor named under a different
794
+ * method is not a successor for *this* operation, so it is left unnamed and
795
+ * the raw URL is printed instead — accurate and unhelpful beats confident and
796
+ * wrong.
797
+ */
798
+ const matchSuccessorChain = (method, successor, operations) => matchOperation(method, successor.pathname, operations)?.chain ?? null;
799
+ const chainLabel = (chain) => `\`client.${chain.join(".")}\``;
800
+ const formatDeprecationWarning = (subject, notice, successorChain) => {
801
+ const parts = [`Composio: ${subject} is deprecated.`];
802
+ if (notice.deprecatedAt !== null) parts.push(`Announced ${notice.deprecatedAt.toISOString()}.`);
803
+ if (notice.sunsetAt !== null) parts.push(`Scheduled for removal on ${notice.sunsetAt.toISOString()}.`);
804
+ if (successorChain !== null) parts.push(`Use ${chainLabel(successorChain)} instead.`);
805
+ else if (notice.successor !== null) parts.push(`Successor: ${notice.successor.href}.`);
806
+ if (notice.documentation !== null) parts.push(`See ${notice.documentation}`);
807
+ return parts.join(" ");
808
+ };
809
+ /**
810
+ * NUL joins the halves of a warn-once key. Neither a client chain nor a URL
811
+ * the WHATWG parser produced can carry one, so no pair of distinct components
812
+ * can collide by concatenation.
813
+ */
814
+ const KEY_SEPARATOR = "\0";
815
+ /**
816
+ * What makes one notice *distinct* from another, for the warn-once record.
817
+ *
818
+ * Derived from the parsed fields rather than the raw header bytes on purpose:
819
+ * a requoted `Link` or a stray space around `Deprecation` reads as the same
820
+ * notice and must not warn a second time. The three fields here are the ones a
821
+ * caller acts on — when the deprecation was announced, when the operation
822
+ * stops being served, and what replaces it. `documentation` is deliberately
823
+ * excluded: it points at prose *about* this notice, so the platform moving its
824
+ * developer notes to another URL is not news worth repeating a warning for.
825
+ */
826
+ const noticeKey = (notice) => [
827
+ notice.deprecatedAt?.getTime() ?? "",
828
+ notice.sunsetAt?.getTime() ?? "",
829
+ notice.successor?.href ?? ""
830
+ ].join(KEY_SEPARATOR);
831
+ /**
832
+ * The interceptor itself: at most one warning per distinct notice per
833
+ * deprecated operation per client instance.
834
+ *
835
+ * It sits at the single response exit in `makeRequest`, after the retry
836
+ * decision has settled, so a response that is about to be discarded and
837
+ * retried never warns and a logical call warns at most once however the caller
838
+ * consumes it — `APIPromise` awaits one `makeRequest` per call and hands the
839
+ * same `Response` to `asResponse()`, `withResponse()` and the parsed path
840
+ * alike.
841
+ */
842
+ const inspectDeprecation = ({ response, method, path, operation: known, baseURL, operations, seen, warn }) => {
843
+ const notice = parseDeprecation(response.headers, response.url || baseURL, baseURL);
844
+ if (notice === null) return;
845
+ const operation = known ?? matchOperation(method, path, operations);
846
+ const key = `${operation === null ? `${method} ${pathSegments(path).join("/")}` : operation.chain.join(".")}${KEY_SEPARATOR}${noticeKey(notice)}`;
847
+ if (seen.has(key)) return;
848
+ if (seen.size >= MAX_TRACKED_NOTICES) return;
849
+ seen.add(key);
850
+ const successorChain = notice.successor === null ? null : matchSuccessorChain(method, notice.successor, operations);
851
+ const subject = operation === null ? `${method.toUpperCase()} ${path}` : chainLabel(operation.chain);
852
+ warn(formatDeprecationWarning(subject, notice, successorChain));
853
+ };
854
+ /**
855
+ * The keys a value map will actually carry on the wire. Both serializers drop
856
+ * an entry whose value is `undefined` outright — `JSON.stringify` for a body
857
+ * property, `stringifyQuery` for a query entry — while `null` is sent (JSON
858
+ * `null`, or `key=`), so only `undefined` reads as "not sent". `bodyKeys`
859
+ * relies on the same rule for its half of the surface.
860
+ */
861
+ const presentKeys = (values) => new Set(Object.entries(values).filter(([, value]) => value !== void 0).map(([key]) => key));
862
+ /**
863
+ * The keys `body` will actually carry on the wire, at its top level, when it
864
+ * is a plain object — `presentKeys` over it, narrowed to objects: a resource
865
+ * method always passes an object (even an omitted optional body arrives as
866
+ * `{}`), so this covers every real call; a non-object `body` (the raw escape
867
+ * hatch dispatching something else entirely) has no top-level keys to check.
868
+ */
869
+ const bodyKeys = (body) => typeof body === "object" && body !== null && !Array.isArray(body) ? presentKeys(body) : /* @__PURE__ */ new Set();
870
+ /**
871
+ * The static parameter-level warning: fires when the client sends an input
872
+ * the committed spec marks `deprecated: true`, decided entirely from the
873
+ * request the caller is about to send. Unlike `inspectDeprecation`, this
874
+ * needs no response — it runs before dispatch, so a connection failure never
875
+ * swallows it.
876
+ *
877
+ * One notice per (operation, sorted set of deprecated wire names present) per
878
+ * client instance, but every input in that set is named in its own `warn`
879
+ * call — the once-only key only suppresses an exact-repeat call, it does not
880
+ * collapse several inputs on one call into a single message.
881
+ */
882
+ const inspectDeprecatedInputs = ({ operation, query, body, headers, table, seen, warn }) => {
883
+ if (operation === null) return;
884
+ const declared = table.get(operation.chain.join("."));
885
+ if (declared === void 0 || declared.length === 0) return;
886
+ const queryKeys = presentKeys(query);
887
+ const bodyKeySet = bodyKeys(body);
888
+ const present = declared.filter((input) => {
889
+ if (input.in === "query") return queryKeys.has(input.wire);
890
+ if (input.in === "body") return bodyKeySet.has(input.wire);
891
+ return headers.has(input.wire);
892
+ });
893
+ if (present.length === 0) return;
894
+ const wireSet = [...new Set(present.map((input) => input.wire))].sort();
895
+ const key = `param${KEY_SEPARATOR}${operation.chain.join(".")}${KEY_SEPARATOR}${wireSet.join(",")}`;
896
+ if (seen.has(key)) return;
897
+ if (seen.size >= MAX_TRACKED_NOTICES) return;
898
+ seen.add(key);
899
+ const subject = chainLabel(operation.chain);
900
+ for (const input of present) {
901
+ const clause = input.replacementWire === null ? "" : ` Use \`${input.replacementWire}\` instead.`;
902
+ warn(`Composio: the \`${input.wire}\` parameter of ${subject} is deprecated.${clause}`);
903
+ }
904
+ };
905
+
906
+ //#endregion
907
+ //#region src/version.ts
908
+ const VERSION = "2.0.0-rc.10";
909
+
910
+ //#endregion
911
+ //#region src/compat/telemetry.ts
912
+ /**
913
+ * The runtime label and version, first match wins. Workers and Vercel Edge are
914
+ * checked before Node because `nodejs_compat` and edge polyfills can expose
915
+ * `process.versions.node`; neither reports a version, so a polyfilled Node
916
+ * version is never sent as theirs.
917
+ */
918
+ const detectRuntime = () => {
919
+ const g = globalThis;
920
+ if (g.Bun !== void 0) return ["bun", g.Bun.version];
921
+ if (g.Deno !== void 0) return ["deno", g.Deno.version?.deno];
922
+ if (g.navigator?.userAgent === "Cloudflare-Workers" || g.caches !== void 0 && g.WebSocketPair !== void 0) return ["cloudflare", void 0];
923
+ if (g.EdgeRuntime !== void 0) return ["vercel_edge", void 0];
924
+ if (typeof process !== "undefined" && process.versions?.node) return ["nodejs", process.versions.node];
925
+ if (typeof g.ServiceWorkerGlobalScope === "function" && globalThis instanceof g.ServiceWorkerGlobalScope) return ["service_worker", void 0];
926
+ if (g.WorkerGlobalScope !== void 0 && typeof g.importScripts === "function") return ["web_worker", void 0];
927
+ if (g.navigator?.product === "ReactNative") return ["react_native", void 0];
928
+ if (g.window !== void 0 && g.document !== void 0) return ["browser", void 0];
929
+ return ["unknown", void 0];
930
+ };
931
+ /** Caller headers override these defaults, including the calling SDK's identity. */
932
+ const clientTelemetryHeaders = () => {
933
+ const [runtime, version] = detectRuntime();
934
+ const headers = {
935
+ "x-client-provenance": "@composio/client",
936
+ "x-client-version": VERSION,
937
+ "x-client-library": "@composio/client",
938
+ "x-client-library-version": VERSION,
939
+ "x-client-language": "typescript",
940
+ "x-client-runtime": runtime,
941
+ "x-runtime": runtime
942
+ };
943
+ if (version) headers["x-runtime-version"] = version;
944
+ return headers;
945
+ };
946
+
947
+ //#endregion
948
+ //#region src/compat/request.ts
949
+ /**
950
+ * Where a generated call records *which operation it is*.
951
+ *
952
+ * A resource method knows its own identity at code-generation time, and until
953
+ * now threw it away: dispatch carried only a method and a substituted path, so
954
+ * the kernel recovered the operation by matching that path back against all
955
+ * 104 templates on every single request (`matchOperation`). Recovery is still
956
+ * the right answer for an escape-hatch `client.get('/api/v3.1/…')`, whose
957
+ * identity genuinely is not knowable until runtime — but for a generated call
958
+ * it re-derives a fact the call site already had.
959
+ *
960
+ * The channel is a module-private symbol rather than a `RequestOptions`
961
+ * property, because `RequestOptions` is the Stainless options bag and its
962
+ * shape is the product (`test/types/*.test-d.ts` pins it structurally). A
963
+ * symbol key is invisible to that pinning, to `Object.keys`, to
964
+ * `JSON.stringify`, and to every serializer in this file — the descriptor
965
+ * reaches the kernel without becoming part of any public type or any byte on
966
+ * the wire.
967
+ *
968
+ * It is deliberately *enumerable*: `client.get()` re-spreads the options bag
969
+ * into `request()`, and object spread copies enumerable own symbols. A
970
+ * non-enumerable definition would silently drop the descriptor there and
971
+ * degrade every generated call back to matching, which is exactly the kind of
972
+ * regression that measures fine and reports nothing.
973
+ */
974
+ const OPERATION = Symbol("composio.operation");
975
+ /**
976
+ * Attach a generated call's operation to the options bag it dispatches with.
977
+ *
978
+ * Called with the freshly built literal — never with the caller's own object —
979
+ * and *after* the caller's options have been spread into it, so a caller
980
+ * cannot pre-empt the descriptor: the write happens last, and the key it
981
+ * writes to is not one a caller can name.
982
+ */
983
+ const withOperation = (operation, options) => {
984
+ options[OPERATION] = operation;
985
+ return options;
986
+ };
987
+ /** The operation a generated call recorded, or `undefined` for a raw one. */
988
+ const readOperation = (options) => options[OPERATION];
989
+ /** A request label safe to print: dynamic path values and URL secrets are excluded. */
990
+ const printableURL = (url, operation) => `${new URL(url).origin}${operation?.path ?? "/<custom>"}`;
991
+ const emitLog = (config, level, message, metadata) => {
992
+ try {
993
+ config.onLog?.(level, message, metadata);
994
+ } catch {}
995
+ };
996
+ const monotonicMillis = () => globalThis.performance?.now?.() ?? Date.now();
997
+ const elapsedMillis = (startedAt) => Math.max(0, monotonicMillis() - startedAt);
998
+ /**
999
+ * Settle a dispatch when its signal aborts even if a custom transport ignores
1000
+ * the signal. The transport promise keeps a rejection handler after abort so
1001
+ * a late failure cannot become an unhandled rejection.
1002
+ */
1003
+ const settleOnAbort = (promise, signal) => new Promise((resolve, reject) => {
1004
+ let settled = false;
1005
+ const cleanup = () => signal.removeEventListener("abort", onAbort);
1006
+ const finish = (settle, value) => {
1007
+ if (settled) return;
1008
+ settled = true;
1009
+ cleanup();
1010
+ settle(value);
1011
+ };
1012
+ const fail = (reason) => {
1013
+ if (settled) return;
1014
+ settled = true;
1015
+ cleanup();
1016
+ reject(reason);
1017
+ };
1018
+ const onAbort = () => fail(/* @__PURE__ */ new Error("Request aborted"));
1019
+ promise.then((value) => finish(resolve, value), fail);
1020
+ signal.addEventListener("abort", onAbort, { once: true });
1021
+ if (signal.aborted) onAbort();
1022
+ });
1023
+ /**
1024
+ * Percent-encode everything that isn't a RFC-3986 pchar, leaving safe chars
1025
+ * (unreserved / sub-delims / ":" / "@") readable.
1026
+ */
1027
+ const encodeURIPath = (str) => str.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g, encodeURIComponent);
1028
+ /**
1029
+ * Template tag interpolating path params percent-encoded, rejecting values
1030
+ * that would introduce `.` / `..` (or percent-encoded variants) path segments.
1031
+ */
1032
+ const path = (statics, ...params) => {
1033
+ let result = statics[0] ?? "";
1034
+ params.forEach((param, index) => {
1035
+ result += encodeURIPath(String(param)) + (statics[index + 1] ?? "");
1036
+ });
1037
+ const pathOnly = result.split(/[?#]/, 1)[0] ?? "";
1038
+ if (/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/i.test(pathOnly)) throw new ComposioError(`Path parameters result in path with invalid segments: ${result}`);
1039
+ return result;
1040
+ };
1041
+ /**
1042
+ * Stainless-flavored query serialization: `arrayFormat: 'comma'` (arrays become
1043
+ * one comma-joined param), `undefined` entries dropped, `null` entries kept as
1044
+ * empty values, and plain-object values expanded qs-style into bracket
1045
+ * notation (`toolkit_versions[github]=v1`, the whole key percent-encoded) —
1046
+ * pinned differentially against Stainless via `tools.retrieve`'s object
1047
+ * `toolkit_versions` param (wayfinder ticket 23).
1048
+ */
1049
+ const stringifyQuery = (query) => {
1050
+ const parts = [];
1051
+ const append = (key, value) => {
1052
+ if (value === void 0) return;
1053
+ if (value === null) {
1054
+ parts.push(`${encodeURIComponent(key)}=`);
1055
+ return;
1056
+ }
1057
+ if (Array.isArray(value)) {
1058
+ parts.push(`${encodeURIComponent(key)}=${encodeURIComponent(value.join(","))}`);
1059
+ return;
1060
+ }
1061
+ if (typeof value === "object") {
1062
+ for (const [subKey, subValue] of Object.entries(value)) append(`${key}[${subKey}]`, subValue);
1063
+ return;
1064
+ }
1065
+ parts.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
1066
+ };
1067
+ for (const [key, value] of Object.entries(query)) append(key, value);
1068
+ return parts.join("&");
1069
+ };
1070
+ const buildURL = (config, options) => {
1071
+ const base = config.baseURL;
1072
+ const joined = base.endsWith("/") && options.path.startsWith("/") ? options.path.slice(1) : options.path;
1073
+ const url = new URL(base + joined);
1074
+ const query = {
1075
+ ...Object.fromEntries(url.searchParams),
1076
+ ...config.defaultQuery,
1077
+ ...options.query
1078
+ };
1079
+ const search = stringifyQuery(query);
1080
+ if (search) url.search = search;
1081
+ return {
1082
+ url: url.toString(),
1083
+ query
1084
+ };
1085
+ };
1086
+ /**
1087
+ * JSON body encoding. A resource method always passes the `body` key when its
1088
+ * operation defines a request body — even an omitted optional body arrives as
1089
+ * `{}` — so `Content-Type: application/json` is kept for those; operations
1090
+ * with no body at all (GET/DELETE) send neither body nor content-type.
1091
+ */
1092
+ const buildBody = (options) => {
1093
+ if (!("body" in options) || options.body === void 0) return {
1094
+ body: void 0,
1095
+ bodyHeaders: void 0
1096
+ };
1097
+ return {
1098
+ body: JSON.stringify(options.body),
1099
+ bodyHeaders: { "content-type": "application/json" }
1100
+ };
1101
+ };
1102
+ const safeJSON = (text) => {
1103
+ try {
1104
+ return JSON.parse(text);
1105
+ } catch {
1106
+ return;
1107
+ }
1108
+ };
1109
+ const castToError = (err) => {
1110
+ if (err instanceof Error) return err;
1111
+ if (typeof err === "object" && err !== null) try {
1112
+ return new Error(JSON.stringify(err));
1113
+ } catch {}
1114
+ return new Error(String(err));
1115
+ };
1116
+ const validatePositiveInteger = (name, value) => {
1117
+ if (!Number.isInteger(value)) throw new ComposioError(`${name} must be an integer`);
1118
+ if (value < 0) throw new ComposioError(`${name} must be a positive integer`);
1119
+ };
1120
+ const RETRYABLE_STATUSES = /* @__PURE__ */ new Set([
1121
+ 408,
1122
+ 409,
1123
+ 429
1124
+ ]);
1125
+ const shouldRetryResponse = (response) => {
1126
+ const explicit = response.headers.get("x-should-retry");
1127
+ if (explicit === "true") return true;
1128
+ if (explicit === "false") return false;
1129
+ return RETRYABLE_STATUSES.has(response.status) || response.status >= 500;
1130
+ };
1131
+ /**
1132
+ * Ceiling for server-supplied retry delays. A `retry-after(-ms)` value is
1133
+ * honored only when `0 <= ms < 60_000`; anything negative, non-finite, or a
1134
+ * minute and beyond falls back to exponential backoff instead of collapsing
1135
+ * the backoff to zero or stalling the caller for the server's whim.
1136
+ */
1137
+ const MAX_RETRY_AFTER_MILLIS = 6e4;
1138
+ /**
1139
+ * How long to wait before retry number `numRetries + 1`: `retry-after-ms`
1140
+ * (milliseconds), then `retry-after` (seconds or HTTP date), then exponential
1141
+ * backoff `min(0.5s · 2^n, 8s)` with up to 25% downward jitter. A
1142
+ * header-derived delay is used only when it is finite and within
1143
+ * `[0, MAX_RETRY_AFTER_MILLIS)`; out-of-range values fall through to the
1144
+ * backoff.
1145
+ */
1146
+ const retryDelayMillis = (numRetries, headers) => {
1147
+ let headerDelayMillis;
1148
+ const retryAfterMs = parseFloat(headers?.get("retry-after-ms") ?? "");
1149
+ if (!Number.isNaN(retryAfterMs)) headerDelayMillis = retryAfterMs;
1150
+ else {
1151
+ const retryAfter = headers?.get("retry-after");
1152
+ if (retryAfter) {
1153
+ const seconds = parseFloat(retryAfter);
1154
+ if (!Number.isNaN(seconds)) headerDelayMillis = seconds * 1e3;
1155
+ else {
1156
+ const untilDate = Date.parse(retryAfter) - Date.now();
1157
+ if (!Number.isNaN(untilDate)) headerDelayMillis = untilDate;
1158
+ }
1159
+ }
1160
+ }
1161
+ if (headerDelayMillis !== void 0 && headerDelayMillis >= 0 && headerDelayMillis < MAX_RETRY_AFTER_MILLIS) return headerDelayMillis;
1162
+ return Math.min(.5 * 2 ** numRetries, 8) * (1 - Math.random() * .25) * 1e3;
1163
+ };
1164
+ const REDIRECT_STATUSES = /* @__PURE__ */ new Set([
1165
+ 301,
1166
+ 302,
1167
+ 303,
1168
+ 307,
1169
+ 308
1170
+ ]);
1171
+ /**
1172
+ * How many hops one attempt will follow before giving up. Twenty is what the
1173
+ * Fetch spec budgets and what undici and every browser enforce, so a chain this
1174
+ * kernel refuses is one the platform would have refused too.
1175
+ */
1176
+ const MAX_REDIRECTS = 20;
1177
+ const TOO_MANY_REDIRECTS = `The API redirected more than ${MAX_REDIRECTS} times; the chain was abandoned.`;
1178
+ /**
1179
+ * The one environment-dependent behavior in the kernel, stated rather than
1180
+ * degraded into — and narrowed to the case where safety cannot be proved.
1181
+ *
1182
+ * Following redirects by hand requires reading the `Location` off a 3xx, and
1183
+ * only a runtime that hands back the real response can offer that — Node,
1184
+ * Deno and Bun do. A **browser** answers `redirect: 'manual'` with a *filtered*
1185
+ * response (`type: 'opaqueredirect'`, status 0, no headers), so there is
1186
+ * nothing to read and manual following is not implementable there.
1187
+ *
1188
+ * Dispatching at `redirect: 'follow'` instead is exactly what this module
1189
+ * exists to prevent *when a credential is attached*: the Fetch spec deletes
1190
+ * only `Authorization` across a cross-origin redirect, so a custom `x-api-key`
1191
+ * rides along, and an attacker-controlled origin that answers the preflight
1192
+ * with a permissive `Access-Control-Allow-Headers` harvests it. (CORS bounds
1193
+ * that — any request carrying `x-api-key` is preflighted, so the third party
1194
+ * has to cooperate — but bounded is not prevented.)
1195
+ *
1196
+ * When *nothing* credential-bearing is going out that reasoning has no
1197
+ * premise, so the first dispatch of such a chain is delegated (see
1198
+ * `carriesCredentials`) and a browser follows it normally. That is where
1199
+ * real-world redirects on this API actually live: an escape-hatch fetch of a
1200
+ * presigned storage URL, which rule 2 has already stripped our key from, and
1201
+ * which S3 and GCS commonly answer with a 302.
1202
+ *
1203
+ * What is left is a *credentialed* request that redirects in a browser. It
1204
+ * gets a named error rather than a silent leak — and on this API that is very
1205
+ * nearly unreachable: the only redirects the platform serves are same-origin
1206
+ * edge normalizations (wayfinder ticket 40 records the recon), and `buildURL`
1207
+ * cannot construct a URL that triggers one.
1208
+ */
1209
+ const OPAQUE_REDIRECT = "The API responded with a redirect that this runtime will not let the client read (an opaque redirect, in a browser). Redirects are followed only where the response can be inspected, because a credential must never cross an origin change.";
1210
+ const isOpaqueRedirect = (response) => response.type === "opaqueredirect";
1211
+ /**
1212
+ * The `Location` a hop points at, resolved against the URL it arrived on, or
1213
+ * `null` when there is nothing followable there — unparseable, or a scheme
1214
+ * this client does not speak (`data:`, `file:`, an app link). `null` hands the
1215
+ * 3xx back as the response it is, which is what `fetch` does with a `Location`
1216
+ * it cannot use.
1217
+ */
1218
+ const resolveLocation = (location, from) => resolveHTTPURL(location, from);
1219
+ /**
1220
+ * Fetch's own method rewrite (§4.4 "HTTP-redirect fetch", step 13): a 303
1221
+ * turns any non-GET into a GET, and a 301/302 does the same to a POST — both
1222
+ * dropping the body. 307 and 308 preserve the method and the body, which is
1223
+ * what they exist for. Following by hand means reproducing this, or a caller's
1224
+ * POST silently becomes a POST to somewhere it was never sent before.
1225
+ */
1226
+ const rewriteForRedirect = (status, method) => status === 303 && method !== "GET" && method !== "HEAD" || (status === 301 || status === 302) && method === "POST";
1227
+ const sleep = (ms, signal) => {
1228
+ if (signal?.aborted) return Promise.reject(new APIUserAbortError());
1229
+ return new Promise((resolve, reject) => {
1230
+ const onAbort = () => {
1231
+ clearTimeout(timer);
1232
+ reject(new APIUserAbortError());
1233
+ };
1234
+ const timer = setTimeout(() => {
1235
+ signal?.removeEventListener("abort", onAbort);
1236
+ resolve();
1237
+ }, ms);
1238
+ signal?.addEventListener("abort", onAbort, { once: true });
1239
+ });
1240
+ };
1241
+ /**
1242
+ * Indirection over `sleep` so kernel tests can capture retry delays instead
1243
+ * of waiting them out on the wall clock. Internal seam only — deliberately
1244
+ * not re-exported from `compat/index.ts`, so the public package surface is
1245
+ * unchanged.
1246
+ */
1247
+ const kernelInternals = { sleep };
1248
+ /**
1249
+ * The headers for one hop, built fresh from the URL that hop is going to.
1250
+ *
1251
+ * This is where rule 3 mostly stops needing machinery of its own: the
1252
+ * credential is re-derived per hop from the *request* URL rather than carried
1253
+ * along from the last one, so a hop that leaves the configured API origin
1254
+ * simply does not get a key. `withdrawn` covers what that cannot — the
1255
+ * caller's own credential headers, which are legitimate on the URL the caller
1256
+ * chose and are dropped once the *server* has chosen one.
1257
+ *
1258
+ * The client's identity headers follow the same per-hop rule: they describe
1259
+ * this client to its own API, so a hop off the configured origin (a presigned
1260
+ * storage URL, a redirect target) goes without them.
1261
+ */
1262
+ const buildRequestHeaders = (config, options, requestURL, bodyHeaders, withdrawn, scheme, callerPlaced) => {
1263
+ const credential = withdrawn || callerPlaced ? null : credentialForRequest(config.baseURL, scheme, config.credentials, requestURL, config.allowedHTTPOrigin);
1264
+ const identity = sameOrigin(config.baseURL, requestURL) ? clientTelemetryHeaders() : void 0;
1265
+ if (!withdrawn && bodyHeaders === void 0 && !config.defaultHeaders && !options.headers && options.idempotencyKey === void 0) {
1266
+ const direct = new Headers({
1267
+ ...identity,
1268
+ accept: "application/json",
1269
+ "user-agent": config.userAgent
1270
+ });
1271
+ if (credential !== null) direct.set(credential.name, credential.value);
1272
+ return direct;
1273
+ }
1274
+ const headers = buildHeaders([
1275
+ { "idempotency-key": options.idempotencyKey },
1276
+ {
1277
+ ...identity,
1278
+ accept: "application/json",
1279
+ "user-agent": config.userAgent
1280
+ },
1281
+ credential === null ? void 0 : { [credential.name]: credential.value },
1282
+ config.defaultHeaders,
1283
+ bodyHeaders,
1284
+ options.headers
1285
+ ]);
1286
+ if (withdrawn) withdrawCredentials(headers);
1287
+ return headers;
1288
+ };
1289
+ /**
1290
+ * The credential class this logical request authenticates with, decided once
1291
+ * from the operation the *caller* invoked.
1292
+ *
1293
+ * Deliberately not re-derived per redirect hop. A hop's URL was chosen by the
1294
+ * server, so matching it back to a template would let the server's choice
1295
+ * change which of the caller's credentials goes out; the operation the caller
1296
+ * asked for is the honest answer for the whole chain, and rule 3 already
1297
+ * withdraws everything once a hop leaves the origin.
1298
+ *
1299
+ * `operation` is the match `makeRequest` already computed for the static
1300
+ * deprecated-input check, threaded in rather than re-derived: the two
1301
+ * features need the same fact, so `matchOperation` runs once per logical call
1302
+ * regardless of which of them a given client configuration actually uses.
1303
+ * With only `apiKey` set the scheme answer is still `ApiKeyAuth` down every
1304
+ * branch of {@link selectScheme}, so an existing caller's requests stay
1305
+ * byte-identical by construction; what changed is that the match itself is no
1306
+ * longer skippable, because the deprecated-input warning needs it too.
1307
+ */
1308
+ const schemeForRequest = (config, operation) => {
1309
+ if (!hasAlternateCredential(config.credentials)) return "ApiKeyAuth";
1310
+ return selectScheme(operation?.schemes, config.credentials);
1311
+ };
1312
+ /**
1313
+ * One attempt: the request, plus however many redirects it takes to land on a
1314
+ * non-3xx response.
1315
+ *
1316
+ * The whole chain sits **inside one attempt** — one entry in the retry budget,
1317
+ * one per-attempt timeout covering every hop. Both follow from what a redirect
1318
+ * is: the caller made one logical request, so a chain must not consume
1319
+ * `maxRetries` (a 3xx is not a failure to retry) and must not be able to
1320
+ * multiply the caller's time budget by the hop limit. A retry re-issues the
1321
+ * *original* request, chain and all.
1322
+ *
1323
+ * Everything the server chose is re-derived rather than carried: the headers
1324
+ * (see `buildRequestHeaders`), the method and body (fetch's own 301/302/303
1325
+ * rewrite), and the query, which is left to the `Location` URL because the
1326
+ * server picked it. `config.defaultQuery` is applied to the URL the caller
1327
+ * asked for, not to the one it was sent to.
1328
+ */
1329
+ const dispatchWithRedirects = async (config, options, initialURL, initialBody, initialBodyHeaders, signal, scheme) => {
1330
+ let url = initialURL;
1331
+ let method = options.method.toUpperCase();
1332
+ let body = initialBody;
1333
+ let bodyHeaders = initialBodyHeaders;
1334
+ let withdrawn = false;
1335
+ const callerPlaced = callerPlacedCredential([config.defaultHeaders, options.headers]);
1336
+ for (let hop = 0;; hop++) {
1337
+ const headers = buildRequestHeaders(config, options, url, bodyHeaders, withdrawn, scheme, callerPlaced);
1338
+ const delegated = hop === 0 && !carriesCredentials(headers);
1339
+ const init = {
1340
+ method,
1341
+ headers,
1342
+ ...body !== void 0 ? { body } : {},
1343
+ ...config.fetchOptions,
1344
+ ...options.fetchOptions,
1345
+ redirect: delegated ? "follow" : "manual",
1346
+ signal
1347
+ };
1348
+ const response = config.transport === void 0 ? await config.fetch.call(void 0, url, init) : await settleOnAbort(config.transport.send(new Request(url, init)), signal);
1349
+ if (delegated) return response;
1350
+ if (isOpaqueRedirect(response)) throw new APIConnectionError({ message: OPAQUE_REDIRECT });
1351
+ if (!REDIRECT_STATUSES.has(response.status)) return response;
1352
+ const location = response.headers.get("location");
1353
+ if (location === null) return response;
1354
+ const target = resolveLocation(location, url);
1355
+ if (target === null) return response;
1356
+ if (hop >= MAX_REDIRECTS) throw new APIConnectionError({ message: TOO_MANY_REDIRECTS });
1357
+ response.body?.cancel().catch(() => void 0);
1358
+ if (target.origin !== new URL(url).origin) withdrawn = true;
1359
+ if (rewriteForRedirect(response.status, method)) {
1360
+ method = "GET";
1361
+ body = void 0;
1362
+ bodyHeaders = void 0;
1363
+ }
1364
+ url = target.href;
1365
+ }
1366
+ };
1367
+ /**
1368
+ * The dispatch kernel: one attempt loop with Stainless runtime semantics —
1369
+ * per-attempt timeouts (timeouts and connection errors are retried, like
1370
+ * HTTP-level 408/409/429/5xx and `x-should-retry`), `retry-after(-ms)`
1371
+ * honored, abort → `APIUserAbortError`. Resolves with the raw un-consumed
1372
+ * `Response` regardless of HTTP status; body parsing and error mapping are
1373
+ * strictly deferred to `APIPromise`.
1374
+ *
1375
+ * Redirects are followed inside an attempt by `dispatchWithRedirects`, so the
1376
+ * single response exit below still fires `onResponse` **once per logical
1377
+ * call** rather than once per hop — the once-per-call guarantee ticket 34
1378
+ * built the deprecation interceptor on. The `Response` handed back is the
1379
+ * final hop's, so `response.url` is still "the URL this response came from",
1380
+ * which is what `deprecation.ts` resolves relative `Link` targets against.
1381
+ */
1382
+ async function makeRequest(config, options) {
1383
+ if (options.timeout !== void 0) validatePositiveInteger("timeout", options.timeout);
1384
+ const maxRetries = options.maxRetries ?? config.maxRetries;
1385
+ validatePositiveInteger("maxRetries", maxRetries);
1386
+ const timeout = options.timeout ?? config.timeout;
1387
+ const { url, query } = buildURL(config, options);
1388
+ const { body, bodyHeaders } = buildBody(options);
1389
+ const userSignal = options.signal ?? void 0;
1390
+ const method = options.method.toUpperCase();
1391
+ const threaded = readOperation(options);
1392
+ const operation = threaded ?? matchOperation(options.method, options.path, config.operations ?? []);
1393
+ const requestLog = config.onLog === void 0 ? void 0 : {
1394
+ method,
1395
+ url: printableURL(url, operation),
1396
+ maxAttempts: maxRetries + 1
1397
+ };
1398
+ const scheme = schemeForRequest(config, operation);
1399
+ if (config.onRequest !== void 0 && (threaded === void 0 || threaded.hasDeprecatedInputs === true)) config.onRequest(operation, query, options.body, buildHeaders([config.defaultHeaders, options.headers]));
1400
+ for (let numRetries = 0;; numRetries++) {
1401
+ if (userSignal?.aborted) throw new APIUserAbortError();
1402
+ const attempt = numRetries + 1;
1403
+ const retriesRemaining = maxRetries - numRetries;
1404
+ const startedAt = requestLog === void 0 ? 0 : monotonicMillis();
1405
+ const attemptLog = requestLog === void 0 ? void 0 : {
1406
+ ...requestLog,
1407
+ attempt
1408
+ };
1409
+ if (attemptLog !== void 0) emitLog(config, "debug", "Sending request", attemptLog);
1410
+ const controller = new AbortController();
1411
+ const abort = () => controller.abort();
1412
+ userSignal?.addEventListener("abort", abort, { once: true });
1413
+ const timer = setTimeout(abort, timeout);
1414
+ let result;
1415
+ try {
1416
+ result = await dispatchWithRedirects(config, options, url, body, bodyHeaders, controller.signal, scheme);
1417
+ } catch (cause) {
1418
+ if (cause instanceof ComposioError) {
1419
+ if (attemptLog !== void 0) emitLog(config, "info", "Request failed", {
1420
+ ...attemptLog,
1421
+ durationMs: elapsedMillis(startedAt),
1422
+ errorType: cause.constructor.name
1423
+ });
1424
+ throw cause;
1425
+ }
1426
+ result = castToError(cause);
1427
+ } finally {
1428
+ clearTimeout(timer);
1429
+ userSignal?.removeEventListener("abort", abort);
1430
+ }
1431
+ if (result instanceof Error) {
1432
+ if (userSignal?.aborted) {
1433
+ if (attemptLog !== void 0) emitLog(config, "info", "Request failed", {
1434
+ ...attemptLog,
1435
+ durationMs: elapsedMillis(startedAt),
1436
+ errorType: APIUserAbortError.name
1437
+ });
1438
+ throw new APIUserAbortError();
1439
+ }
1440
+ const isTimeout = controller.signal.aborted || /timed? ?out/i.test(String(result) + ("cause" in result ? String(result.cause) : ""));
1441
+ const errorType = isTimeout ? APIConnectionTimeoutError.name : APIConnectionError.name;
1442
+ if (attemptLog !== void 0) emitLog(config, "info", "Request failed", {
1443
+ ...attemptLog,
1444
+ durationMs: elapsedMillis(startedAt),
1445
+ errorType
1446
+ });
1447
+ if (retriesRemaining > 0) {
1448
+ const delayMs = retryDelayMillis(numRetries);
1449
+ if (attemptLog !== void 0) emitLog(config, "info", "Retrying request", {
1450
+ ...attemptLog,
1451
+ nextAttempt: attempt + 1,
1452
+ retriesRemaining,
1453
+ delayMs,
1454
+ reason: isTimeout ? "timeout" : "transport"
1455
+ });
1456
+ await kernelInternals.sleep(delayMs, userSignal);
1457
+ continue;
1458
+ }
1459
+ if (isTimeout) throw new APIConnectionTimeoutError();
1460
+ throw new APIConnectionError({ cause: result });
1461
+ }
1462
+ if (attemptLog !== void 0) emitLog(config, "info", "Received response", {
1463
+ ...attemptLog,
1464
+ status: result.status,
1465
+ outcome: result.ok ? "success" : "http_error",
1466
+ durationMs: elapsedMillis(startedAt)
1467
+ });
1468
+ if (!result.ok && retriesRemaining > 0 && shouldRetryResponse(result)) {
1469
+ result.body?.cancel().catch(() => void 0);
1470
+ const delayMs = retryDelayMillis(numRetries, result.headers);
1471
+ if (attemptLog !== void 0) emitLog(config, "info", "Retrying request", {
1472
+ ...attemptLog,
1473
+ nextAttempt: attempt + 1,
1474
+ retriesRemaining,
1475
+ delayMs,
1476
+ reason: "response",
1477
+ status: result.status
1478
+ });
1479
+ await kernelInternals.sleep(delayMs, userSignal);
1480
+ continue;
1481
+ }
1482
+ if (config.onResponse !== void 0) try {
1483
+ config.onResponse(result, options);
1484
+ } catch {}
1485
+ return result;
1486
+ }
1487
+ }
1488
+
1489
+ //#endregion
1490
+ //#region src/compat/generated-operations.ts
1491
+ const GENERATED_OPERATIONS = [
1492
+ {
1493
+ method: "delete",
1494
+ path: "/api/v3.1/auth_configs/{nanoid}",
1495
+ chain: ["authConfigs", "delete"],
1496
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
1497
+ },
1498
+ {
1499
+ method: "delete",
1500
+ path: "/api/v3.1/connected_accounts/{nanoid}",
1501
+ chain: ["connectedAccounts", "delete"],
1502
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
1503
+ },
1504
+ {
1505
+ method: "delete",
1506
+ path: "/api/v3.1/custom/toolkits/{slug}",
1507
+ chain: ["custom", "deleteToolkit"],
1508
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
1509
+ },
1510
+ {
1511
+ method: "delete",
1512
+ path: "/api/v3.1/mcp/servers/{serverId}/instances/{instanceId}",
1513
+ chain: ["mcp", "deleteInstance"]
1514
+ },
1515
+ {
1516
+ method: "delete",
1517
+ path: "/api/v3.1/mcp/{id}",
1518
+ chain: ["mcp", "delete"]
1519
+ },
1520
+ {
1521
+ method: "delete",
1522
+ path: "/api/v3.1/org/owner/project/{nano_id}",
1523
+ chain: [
1524
+ "org",
1525
+ "owner",
1526
+ "project",
1527
+ "delete"
1528
+ ],
1529
+ schemes: ["OrgApiKeyAuth"]
1530
+ },
1531
+ {
1532
+ method: "delete",
1533
+ path: "/api/v3.1/tool_router/session/{session_id}",
1534
+ chain: [
1535
+ "toolRouter",
1536
+ "session",
1537
+ "delete"
1538
+ ]
1539
+ },
1540
+ {
1541
+ method: "delete",
1542
+ path: "/api/v3.1/trigger_instances/manage/{triggerId}",
1543
+ chain: [
1544
+ "triggerInstances",
1545
+ "manage",
1546
+ "delete"
1547
+ ],
1548
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
1549
+ },
1550
+ {
1551
+ method: "delete",
1552
+ path: "/api/v3.1/webhook_subscriptions/{id}",
1553
+ chain: ["webhookSubscriptions", "delete"]
1554
+ },
1555
+ {
1556
+ method: "get",
1557
+ path: "/api/v3.1/auth/session/info",
1558
+ chain: [
1559
+ "auth",
1560
+ "session",
1561
+ "retrieveInfo"
1562
+ ],
1563
+ schemes: ["UserApiKeyAuth"]
1564
+ },
1565
+ {
1566
+ method: "get",
1567
+ path: "/api/v3.1/auth_configs",
1568
+ chain: ["authConfigs", "list"],
1569
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"],
1570
+ hasDeprecatedInputs: true
1571
+ },
1572
+ {
1573
+ method: "get",
1574
+ path: "/api/v3.1/auth_configs/{nanoid}",
1575
+ chain: ["authConfigs", "retrieve"],
1576
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
1577
+ },
1578
+ {
1579
+ method: "get",
1580
+ path: "/api/v3.1/cli/get-session",
1581
+ chain: ["cli", "getSession"],
1582
+ schemes: ["no_auth"]
1583
+ },
1584
+ {
1585
+ method: "get",
1586
+ path: "/api/v3.1/cli/realtime/credentials",
1587
+ chain: [
1588
+ "cli",
1589
+ "realtime",
1590
+ "credentials"
1591
+ ],
1592
+ schemes: ["UserApiKeyAuth"]
1593
+ },
1594
+ {
1595
+ method: "get",
1596
+ path: "/api/v3.1/connected_accounts",
1597
+ chain: ["connectedAccounts", "list"],
1598
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
1599
+ },
1600
+ {
1601
+ method: "get",
1602
+ path: "/api/v3.1/connected_accounts/{nanoid}",
1603
+ chain: ["connectedAccounts", "retrieve"],
1604
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
1605
+ },
1606
+ {
1607
+ method: "get",
1608
+ path: "/api/v3.1/files/list",
1609
+ chain: ["files", "list"]
1610
+ },
1611
+ {
1612
+ method: "get",
1613
+ path: "/api/v3.1/internal/action_execution/fields",
1614
+ chain: [
1615
+ "logs",
1616
+ "tools",
1617
+ "listFields"
1618
+ ]
1619
+ },
1620
+ {
1621
+ method: "get",
1622
+ path: "/api/v3.1/internal/action_execution/log/{id}",
1623
+ chain: [
1624
+ "logs",
1625
+ "tools",
1626
+ "retrieve"
1627
+ ]
1628
+ },
1629
+ {
1630
+ method: "get",
1631
+ path: "/api/v3.1/internal/trigger/log/{id}",
1632
+ chain: [
1633
+ "logs",
1634
+ "triggers",
1635
+ "retrieve"
1636
+ ]
1637
+ },
1638
+ {
1639
+ method: "get",
1640
+ path: "/api/v3.1/keyring/transfer_keys",
1641
+ chain: ["keyring", "listTransferKeys"]
1642
+ },
1643
+ {
1644
+ method: "get",
1645
+ path: "/api/v3.1/logs/tool_execution/{id}",
1646
+ chain: ["logs", "retrieveToolExecution"]
1647
+ },
1648
+ {
1649
+ method: "get",
1650
+ path: "/api/v3.1/mcp/app/{appKey}",
1651
+ chain: ["mcp", "retrieveApp"]
1652
+ },
1653
+ {
1654
+ method: "get",
1655
+ path: "/api/v3.1/mcp/servers",
1656
+ chain: ["mcp", "list"]
1657
+ },
1658
+ {
1659
+ method: "get",
1660
+ path: "/api/v3.1/mcp/servers/{serverId}/instances",
1661
+ chain: ["mcp", "listInstances"]
1662
+ },
1663
+ {
1664
+ method: "get",
1665
+ path: "/api/v3.1/mcp/{id}",
1666
+ chain: ["mcp", "retrieve"]
1667
+ },
1668
+ {
1669
+ method: "get",
1670
+ path: "/api/v3.1/org/consumer/connected_toolkits",
1671
+ chain: [
1672
+ "org",
1673
+ "consumer",
1674
+ "listConnectedToolkits"
1675
+ ],
1676
+ schemes: ["UserApiKeyAuth"]
1677
+ },
1678
+ {
1679
+ method: "get",
1680
+ path: "/api/v3.1/org/list",
1681
+ chain: ["org", "list"],
1682
+ schemes: ["UserApiKeyAuth"]
1683
+ },
1684
+ {
1685
+ method: "get",
1686
+ path: "/api/v3.1/org/owner/project/list",
1687
+ chain: [
1688
+ "org",
1689
+ "owner",
1690
+ "project",
1691
+ "list"
1692
+ ],
1693
+ schemes: ["OrgApiKeyAuth"]
1694
+ },
1695
+ {
1696
+ method: "get",
1697
+ path: "/api/v3.1/org/owner/project/{nano_id}",
1698
+ chain: [
1699
+ "org",
1700
+ "owner",
1701
+ "project",
1702
+ "retrieve"
1703
+ ],
1704
+ schemes: ["OrgApiKeyAuth"]
1705
+ },
1706
+ {
1707
+ method: "get",
1708
+ path: "/api/v3.1/org/project/list",
1709
+ chain: [
1710
+ "org",
1711
+ "project",
1712
+ "list"
1713
+ ],
1714
+ schemes: ["UserApiKeyAuth"]
1715
+ },
1716
+ {
1717
+ method: "get",
1718
+ path: "/api/v3.1/session_configs",
1719
+ chain: ["sessionConfigs", "list"]
1720
+ },
1721
+ {
1722
+ method: "get",
1723
+ path: "/api/v3.1/session_configs/{session_config_id}",
1724
+ chain: ["sessionConfigs", "retrieve"]
1725
+ },
1726
+ {
1727
+ method: "get",
1728
+ path: "/api/v3.1/tool_router/session/{session_id}",
1729
+ chain: [
1730
+ "toolRouter",
1731
+ "session",
1732
+ "retrieve"
1733
+ ]
1734
+ },
1735
+ {
1736
+ method: "get",
1737
+ path: "/api/v3.1/tool_router/session/{session_id}/config_history",
1738
+ chain: [
1739
+ "toolRouter",
1740
+ "session",
1741
+ "configHistory"
1742
+ ]
1743
+ },
1744
+ {
1745
+ method: "get",
1746
+ path: "/api/v3.1/tool_router/session/{session_id}/mounts/{mount_id}/items",
1747
+ chain: [
1748
+ "toolRouter",
1749
+ "session",
1750
+ "files",
1751
+ "list"
1752
+ ]
1753
+ },
1754
+ {
1755
+ method: "get",
1756
+ path: "/api/v3.1/tool_router/session/{session_id}/toolkits",
1757
+ chain: [
1758
+ "toolRouter",
1759
+ "session",
1760
+ "toolkits"
1761
+ ]
1762
+ },
1763
+ {
1764
+ method: "get",
1765
+ path: "/api/v3.1/tool_router/session/{session_id}/tools",
1766
+ chain: [
1767
+ "toolRouter",
1768
+ "session",
1769
+ "tools"
1770
+ ]
1771
+ },
1772
+ {
1773
+ method: "get",
1774
+ path: "/api/v3.1/toolkits",
1775
+ chain: ["toolkits", "list"],
1776
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"],
1777
+ hasDeprecatedInputs: true
1778
+ },
1779
+ {
1780
+ method: "get",
1781
+ path: "/api/v3.1/toolkits/categories",
1782
+ chain: ["toolkits", "retrieveCategories"]
1783
+ },
1784
+ {
1785
+ method: "get",
1786
+ path: "/api/v3.1/toolkits/changelog",
1787
+ chain: ["toolkits", "retrieveChangelog"]
1788
+ },
1789
+ {
1790
+ method: "get",
1791
+ path: "/api/v3.1/toolkits/{slug}",
1792
+ chain: ["toolkits", "retrieve"],
1793
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
1794
+ },
1795
+ {
1796
+ method: "get",
1797
+ path: "/api/v3.1/toolkits/{toolkit_slug}/scopes/grant_context",
1798
+ chain: ["toolkits", "retrieveScopesGrantContext"]
1799
+ },
1800
+ {
1801
+ method: "get",
1802
+ path: "/api/v3.1/tools",
1803
+ chain: ["tools", "list"],
1804
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"],
1805
+ hasDeprecatedInputs: true
1806
+ },
1807
+ {
1808
+ method: "get",
1809
+ path: "/api/v3.1/tools/enum",
1810
+ chain: ["tools", "retrieveEnum"],
1811
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
1812
+ },
1813
+ {
1814
+ method: "get",
1815
+ path: "/api/v3.1/tools/{tool_slug}",
1816
+ chain: ["tools", "retrieve"],
1817
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
1818
+ },
1819
+ {
1820
+ method: "get",
1821
+ path: "/api/v3.1/trigger_instances/active",
1822
+ chain: ["triggerInstances", "listActive"],
1823
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"],
1824
+ hasDeprecatedInputs: true
1825
+ },
1826
+ {
1827
+ method: "get",
1828
+ path: "/api/v3.1/triggers_types",
1829
+ chain: ["triggersTypes", "list"],
1830
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
1831
+ },
1832
+ {
1833
+ method: "get",
1834
+ path: "/api/v3.1/triggers_types/list/enum",
1835
+ chain: ["triggersTypes", "retrieveEnum"],
1836
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
1837
+ },
1838
+ {
1839
+ method: "get",
1840
+ path: "/api/v3.1/triggers_types/{slug}",
1841
+ chain: ["triggersTypes", "retrieve"],
1842
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
1843
+ },
1844
+ {
1845
+ method: "get",
1846
+ path: "/api/v3.1/webhook_endpoints",
1847
+ chain: ["webhookEndpoints", "list"]
1848
+ },
1849
+ {
1850
+ method: "get",
1851
+ path: "/api/v3.1/webhook_endpoints/{nano_id}",
1852
+ chain: ["webhookEndpoints", "retrieve"]
1853
+ },
1854
+ {
1855
+ method: "get",
1856
+ path: "/api/v3.1/webhook_subscriptions",
1857
+ chain: ["webhookSubscriptions", "list"]
1858
+ },
1859
+ {
1860
+ method: "get",
1861
+ path: "/api/v3.1/webhook_subscriptions/event_types",
1862
+ chain: ["webhookSubscriptions", "listEventTypes"]
1863
+ },
1864
+ {
1865
+ method: "get",
1866
+ path: "/api/v3.1/webhook_subscriptions/{id}",
1867
+ chain: ["webhookSubscriptions", "retrieve"]
1868
+ },
1869
+ {
1870
+ method: "patch",
1871
+ path: "/api/v3.1/auth_configs/{nanoid}",
1872
+ chain: ["authConfigs", "update"],
1873
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"],
1874
+ hasDeprecatedInputs: true
1875
+ },
1876
+ {
1877
+ method: "patch",
1878
+ path: "/api/v3.1/auth_configs/{nanoid}/{status}",
1879
+ chain: ["authConfigs", "updateStatus"]
1880
+ },
1881
+ {
1882
+ method: "patch",
1883
+ path: "/api/v3.1/connected_accounts/{nanoId}/status",
1884
+ chain: ["connectedAccounts", "updateStatus"]
1885
+ },
1886
+ {
1887
+ method: "patch",
1888
+ path: "/api/v3.1/connected_accounts/{nanoid}",
1889
+ chain: ["connectedAccounts", "patch"]
1890
+ },
1891
+ {
1892
+ method: "patch",
1893
+ path: "/api/v3.1/mcp/{id}",
1894
+ chain: ["mcp", "update"]
1895
+ },
1896
+ {
1897
+ method: "patch",
1898
+ path: "/api/v3.1/tool_router/session/{session_id}",
1899
+ chain: [
1900
+ "toolRouter",
1901
+ "session",
1902
+ "patch"
1903
+ ]
1904
+ },
1905
+ {
1906
+ method: "patch",
1907
+ path: "/api/v3.1/trigger_instances/manage/{triggerId}",
1908
+ chain: [
1909
+ "triggerInstances",
1910
+ "manage",
1911
+ "update"
1912
+ ],
1913
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
1914
+ },
1915
+ {
1916
+ method: "patch",
1917
+ path: "/api/v3.1/webhook_endpoints/{nano_id}",
1918
+ chain: ["webhookEndpoints", "update"]
1919
+ },
1920
+ {
1921
+ method: "patch",
1922
+ path: "/api/v3.1/webhook_subscriptions/{id}",
1923
+ chain: ["webhookSubscriptions", "update"]
1924
+ },
1925
+ {
1926
+ method: "post",
1927
+ path: "/api/v3.1/api_key_revocation",
1928
+ chain: ["apiKeyRevocation", "create"],
1929
+ schemes: ["no_auth"]
1930
+ },
1931
+ {
1932
+ method: "post",
1933
+ path: "/api/v3.1/auth_configs",
1934
+ chain: ["authConfigs", "create"],
1935
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
1936
+ },
1937
+ {
1938
+ method: "post",
1939
+ path: "/api/v3.1/cli/codact_failures",
1940
+ chain: ["cli", "createCodactFailure"],
1941
+ schemes: ["UserApiKeyAuth"]
1942
+ },
1943
+ {
1944
+ method: "post",
1945
+ path: "/api/v3.1/cli/create-session",
1946
+ chain: ["cli", "createSession"],
1947
+ schemes: ["no_auth"]
1948
+ },
1949
+ {
1950
+ method: "post",
1951
+ path: "/api/v3.1/cli/realtime/auth",
1952
+ chain: [
1953
+ "cli",
1954
+ "realtime",
1955
+ "auth"
1956
+ ],
1957
+ schemes: ["UserApiKeyAuth"]
1958
+ },
1959
+ {
1960
+ method: "post",
1961
+ path: "/api/v3.1/connected_accounts",
1962
+ chain: ["connectedAccounts", "create"]
1963
+ },
1964
+ {
1965
+ method: "post",
1966
+ path: "/api/v3.1/connected_accounts/complete_auth",
1967
+ chain: ["connectedAccounts", "completeAuth"]
1968
+ },
1969
+ {
1970
+ method: "post",
1971
+ path: "/api/v3.1/connected_accounts/link",
1972
+ chain: ["link", "create"],
1973
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
1974
+ },
1975
+ {
1976
+ method: "post",
1977
+ path: "/api/v3.1/connected_accounts/{nanoid}/refresh",
1978
+ chain: ["connectedAccounts", "refresh"]
1979
+ },
1980
+ {
1981
+ method: "post",
1982
+ path: "/api/v3.1/connected_accounts/{nanoid}/revoke",
1983
+ chain: ["connectedAccounts", "revoke"]
1984
+ },
1985
+ {
1986
+ method: "post",
1987
+ path: "/api/v3.1/custom/toolkits/sync",
1988
+ chain: ["custom", "sync"],
1989
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
1990
+ },
1991
+ {
1992
+ method: "post",
1993
+ path: "/api/v3.1/custom/toolkits/upsert",
1994
+ chain: ["custom", "upsert"],
1995
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
1996
+ },
1997
+ {
1998
+ method: "post",
1999
+ path: "/api/v3.1/files/upload/request",
2000
+ chain: ["files", "createPresignedURL"]
2001
+ },
2002
+ {
2003
+ method: "post",
2004
+ path: "/api/v3.1/internal/action_execution/logs",
2005
+ chain: [
2006
+ "logs",
2007
+ "tools",
2008
+ "list"
2009
+ ]
2010
+ },
2011
+ {
2012
+ method: "post",
2013
+ path: "/api/v3.1/internal/trigger/logs",
2014
+ chain: [
2015
+ "logs",
2016
+ "triggers",
2017
+ "list"
2018
+ ]
2019
+ },
2020
+ {
2021
+ method: "post",
2022
+ path: "/api/v3.1/logs/tool_execution",
2023
+ chain: ["logs", "createToolExecution"]
2024
+ },
2025
+ {
2026
+ method: "post",
2027
+ path: "/api/v3.1/mcp/servers",
2028
+ chain: ["mcp", "create"]
2029
+ },
2030
+ {
2031
+ method: "post",
2032
+ path: "/api/v3.1/mcp/servers/custom",
2033
+ chain: [
2034
+ "mcp",
2035
+ "custom",
2036
+ "create"
2037
+ ]
2038
+ },
2039
+ {
2040
+ method: "post",
2041
+ path: "/api/v3.1/mcp/servers/generate",
2042
+ chain: [
2043
+ "mcp",
2044
+ "generate",
2045
+ "url"
2046
+ ]
2047
+ },
2048
+ {
2049
+ method: "post",
2050
+ path: "/api/v3.1/mcp/servers/{serverId}/instances",
2051
+ chain: ["mcp", "createInstance"]
2052
+ },
2053
+ {
2054
+ method: "post",
2055
+ path: "/api/v3.1/org/clanker/create_claim",
2056
+ chain: [
2057
+ "org",
2058
+ "clanker",
2059
+ "createClaim"
2060
+ ],
2061
+ schemes: ["OrgApiKeyAuth"]
2062
+ },
2063
+ {
2064
+ method: "post",
2065
+ path: "/api/v3.1/org/consumer/project/resolve",
2066
+ chain: [
2067
+ "org",
2068
+ "consumer",
2069
+ "project",
2070
+ "resolve"
2071
+ ],
2072
+ schemes: ["UserApiKeyAuth"]
2073
+ },
2074
+ {
2075
+ method: "post",
2076
+ path: "/api/v3.1/org/owner/project/new",
2077
+ chain: [
2078
+ "org",
2079
+ "owner",
2080
+ "project",
2081
+ "create"
2082
+ ],
2083
+ schemes: ["OrgApiKeyAuth"]
2084
+ },
2085
+ {
2086
+ method: "post",
2087
+ path: "/api/v3.1/org/owner/project/{nano_id}/regenerate_api_key",
2088
+ chain: [
2089
+ "org",
2090
+ "owner",
2091
+ "project",
2092
+ "regenerateAPIKey"
2093
+ ],
2094
+ schemes: ["OrgApiKeyAuth"]
2095
+ },
2096
+ {
2097
+ method: "post",
2098
+ path: "/api/v3.1/org/usage/summary",
2099
+ chain: [
2100
+ "org",
2101
+ "usage",
2102
+ "retrieveSummary"
2103
+ ],
2104
+ schemes: ["OrgApiKeyAuth"]
2105
+ },
2106
+ {
2107
+ method: "post",
2108
+ path: "/api/v3.1/org/usage/{entity_type}",
2109
+ chain: [
2110
+ "org",
2111
+ "usage",
2112
+ "retrieve"
2113
+ ],
2114
+ schemes: ["OrgApiKeyAuth"]
2115
+ },
2116
+ {
2117
+ method: "post",
2118
+ path: "/api/v3.1/project/usage/summary",
2119
+ chain: [
2120
+ "project",
2121
+ "usage",
2122
+ "retrieveSummary"
2123
+ ]
2124
+ },
2125
+ {
2126
+ method: "post",
2127
+ path: "/api/v3.1/project/usage/{entity_type}",
2128
+ chain: [
2129
+ "project",
2130
+ "usage",
2131
+ "retrieve"
2132
+ ]
2133
+ },
2134
+ {
2135
+ method: "post",
2136
+ path: "/api/v3.1/tool_router/session",
2137
+ chain: [
2138
+ "toolRouter",
2139
+ "session",
2140
+ "create"
2141
+ ]
2142
+ },
2143
+ {
2144
+ method: "post",
2145
+ path: "/api/v3.1/tool_router/session/{session_id}/attach",
2146
+ chain: [
2147
+ "toolRouter",
2148
+ "session",
2149
+ "attach"
2150
+ ]
2151
+ },
2152
+ {
2153
+ method: "post",
2154
+ path: "/api/v3.1/tool_router/session/{session_id}/execute",
2155
+ chain: [
2156
+ "toolRouter",
2157
+ "session",
2158
+ "execute"
2159
+ ],
2160
+ schemes: ["ApiKeyAuth", "workbench_access_key"]
2161
+ },
2162
+ {
2163
+ method: "post",
2164
+ path: "/api/v3.1/tool_router/session/{session_id}/execute_meta",
2165
+ chain: [
2166
+ "toolRouter",
2167
+ "session",
2168
+ "executeMeta"
2169
+ ]
2170
+ },
2171
+ {
2172
+ method: "post",
2173
+ path: "/api/v3.1/tool_router/session/{session_id}/link",
2174
+ chain: [
2175
+ "toolRouter",
2176
+ "session",
2177
+ "link"
2178
+ ]
2179
+ },
2180
+ {
2181
+ method: "post",
2182
+ path: "/api/v3.1/tool_router/session/{session_id}/mounts/{mount_id}/delete",
2183
+ chain: [
2184
+ "toolRouter",
2185
+ "session",
2186
+ "files",
2187
+ "delete"
2188
+ ]
2189
+ },
2190
+ {
2191
+ method: "post",
2192
+ path: "/api/v3.1/tool_router/session/{session_id}/mounts/{mount_id}/download_url",
2193
+ chain: [
2194
+ "toolRouter",
2195
+ "session",
2196
+ "files",
2197
+ "createDownloadURL"
2198
+ ]
2199
+ },
2200
+ {
2201
+ method: "post",
2202
+ path: "/api/v3.1/tool_router/session/{session_id}/mounts/{mount_id}/upload_url",
2203
+ chain: [
2204
+ "toolRouter",
2205
+ "session",
2206
+ "files",
2207
+ "createUploadURL"
2208
+ ]
2209
+ },
2210
+ {
2211
+ method: "post",
2212
+ path: "/api/v3.1/tool_router/session/{session_id}/proxy_execute",
2213
+ chain: [
2214
+ "toolRouter",
2215
+ "session",
2216
+ "proxyExecute"
2217
+ ],
2218
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"],
2219
+ hasDeprecatedInputs: true
2220
+ },
2221
+ {
2222
+ method: "post",
2223
+ path: "/api/v3.1/tool_router/session/{session_id}/search",
2224
+ chain: [
2225
+ "toolRouter",
2226
+ "session",
2227
+ "search"
2228
+ ]
2229
+ },
2230
+ {
2231
+ method: "post",
2232
+ path: "/api/v3.1/toolkits/multi",
2233
+ chain: ["toolkits", "retrieveMulti"]
2234
+ },
2235
+ {
2236
+ method: "post",
2237
+ path: "/api/v3.1/toolkits/{toolkit_slug}/scopes/recommended",
2238
+ chain: ["toolkits", "recommendScopes"]
2239
+ },
2240
+ {
2241
+ method: "post",
2242
+ path: "/api/v3.1/tools/execute/proxy",
2243
+ chain: ["tools", "proxy"],
2244
+ hasDeprecatedInputs: true
2245
+ },
2246
+ {
2247
+ method: "post",
2248
+ path: "/api/v3.1/tools/execute/{tool_slug}",
2249
+ chain: ["tools", "execute"],
2250
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"],
2251
+ hasDeprecatedInputs: true
2252
+ },
2253
+ {
2254
+ method: "post",
2255
+ path: "/api/v3.1/tools/execute/{tool_slug}/input",
2256
+ chain: ["tools", "getInput"]
2257
+ },
2258
+ {
2259
+ method: "post",
2260
+ path: "/api/v3.1/tools/scopes/required",
2261
+ chain: ["tools", "retrieveRequiredScopes"]
2262
+ },
2263
+ {
2264
+ method: "post",
2265
+ path: "/api/v3.1/trigger_instances/{slug}/upsert",
2266
+ chain: ["triggerInstances", "upsert"],
2267
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"],
2268
+ hasDeprecatedInputs: true
2269
+ },
2270
+ {
2271
+ method: "post",
2272
+ path: "/api/v3.1/webhook_endpoints",
2273
+ chain: ["webhookEndpoints", "create"]
2274
+ },
2275
+ {
2276
+ method: "post",
2277
+ path: "/api/v3.1/webhook_endpoints/{nano_id}",
2278
+ chain: ["webhookEndpoints", "replace"]
2279
+ },
2280
+ {
2281
+ method: "post",
2282
+ path: "/api/v3.1/webhook_subscriptions",
2283
+ chain: ["webhookSubscriptions", "create"]
2284
+ },
2285
+ {
2286
+ method: "post",
2287
+ path: "/api/v3.1/webhook_subscriptions/{id}/rotate_secret",
2288
+ chain: ["webhookSubscriptions", "rotateSecret"]
2289
+ }
2290
+ ];
2291
+ /**
2292
+ * The same descriptors, indexed by public chain — what a generated resource
2293
+ * resolves its own operation from at module load, so the kernel reads
2294
+ * identity off the call instead of recovering it from the URL.
2295
+ *
2296
+ * Built from the array rather than emitted a second time, so the two indexes
2297
+ * hold the *same objects* and cannot drift apart.
2298
+ */
2299
+ const GENERATED_OPERATIONS_BY_KEY = new Map(GENERATED_OPERATIONS.map((operation) => [operation.chain.join("."), operation]));
2300
+ /**
2301
+ * The descriptor a generated method dispatches with. A miss is a generator
2302
+ * defect, not a runtime condition, so it fails at import time rather than
2303
+ * silently degrading that method back to path matching.
2304
+ */
2305
+ const generatedOperation = (chainKey) => {
2306
+ const operation = GENERATED_OPERATIONS_BY_KEY.get(chainKey);
2307
+ if (operation === void 0) throw new Error(`generated-operations: no operation for chain '${chainKey}'`);
2308
+ return operation;
2309
+ };
2310
+
2311
+ //#endregion
2312
+ export { path as a, withOperation as c, inspectDeprecation as d, assertCredentialTransport as f, makeRequest as i, VERSION as l, mergeHeaders as m, generatedOperation as n, readOperation as o, parseHTTPURL as p, castToError as r, safeJSON as s, GENERATED_OPERATIONS as t, inspectDeprecatedInputs as u };