@zapier/zapier-sdk 0.65.0 → 0.68.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (491) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/README.md +64 -34
  3. package/dist/api/client.d.ts.map +1 -1
  4. package/dist/api/client.js +2 -0
  5. package/dist/api/debug.d.ts.map +1 -1
  6. package/dist/api/debug.js +6 -4
  7. package/dist/api/polling.d.ts +2 -0
  8. package/dist/api/polling.d.ts.map +1 -1
  9. package/dist/api/polling.js +10 -2
  10. package/dist/auth.d.ts.map +1 -1
  11. package/dist/auth.js +8 -5
  12. package/dist/core-stack.d.ts +24 -0
  13. package/dist/core-stack.d.ts.map +1 -0
  14. package/dist/core-stack.js +32 -0
  15. package/dist/experimental.cjs +1598 -1323
  16. package/dist/experimental.d.mts +3476 -224
  17. package/dist/experimental.d.ts +3508 -256
  18. package/dist/experimental.d.ts.map +1 -1
  19. package/dist/experimental.js +117 -87
  20. package/dist/experimental.mjs +1585 -1322
  21. package/dist/formatters/action.d.ts +4 -0
  22. package/dist/formatters/action.d.ts.map +1 -0
  23. package/dist/formatters/action.js +18 -0
  24. package/dist/formatters/actionResult.d.ts +3 -0
  25. package/dist/formatters/actionResult.d.ts.map +1 -0
  26. package/dist/formatters/actionResult.js +25 -0
  27. package/dist/formatters/app.d.ts +4 -0
  28. package/dist/formatters/app.d.ts.map +1 -0
  29. package/dist/formatters/app.js +10 -0
  30. package/dist/formatters/clientCredentials.d.ts +5 -0
  31. package/dist/formatters/clientCredentials.d.ts.map +1 -0
  32. package/dist/formatters/clientCredentials.js +27 -0
  33. package/dist/formatters/connection.d.ts +4 -0
  34. package/dist/formatters/connection.d.ts.map +1 -0
  35. package/dist/formatters/connection.js +26 -0
  36. package/dist/formatters/field.d.ts +4 -0
  37. package/dist/formatters/field.d.ts.map +1 -0
  38. package/dist/formatters/field.js +51 -0
  39. package/dist/formatters/inputFieldChoice.d.ts +4 -0
  40. package/dist/formatters/inputFieldChoice.d.ts.map +1 -0
  41. package/dist/formatters/inputFieldChoice.js +16 -0
  42. package/dist/formatters/tableField.d.ts +4 -0
  43. package/dist/formatters/tableField.d.ts.map +1 -0
  44. package/dist/formatters/tableField.js +7 -0
  45. package/dist/formatters/tableRecord.d.ts +5 -3
  46. package/dist/formatters/tableRecord.d.ts.map +1 -1
  47. package/dist/formatters/tableRecord.js +4 -3
  48. package/dist/formatters/triggerInbox.d.ts +4 -0
  49. package/dist/formatters/triggerInbox.d.ts.map +1 -0
  50. package/dist/formatters/triggerInbox.js +31 -0
  51. package/dist/formatters/triggerMessage.d.ts +5 -0
  52. package/dist/formatters/triggerMessage.d.ts.map +1 -0
  53. package/dist/formatters/triggerMessage.js +34 -0
  54. package/dist/formatters/userProfile.d.ts +4 -0
  55. package/dist/formatters/userProfile.d.ts.map +1 -0
  56. package/dist/formatters/userProfile.js +19 -0
  57. package/dist/{index-JhNxS_mq.d.mts → index-oRnHsPn5.d.mts} +12906 -7603
  58. package/dist/{index-JhNxS_mq.d.ts → index-oRnHsPn5.d.ts} +12906 -7603
  59. package/dist/index.cjs +1729 -1469
  60. package/dist/index.d.mts +2 -2
  61. package/dist/index.d.ts +12 -9
  62. package/dist/index.d.ts.map +1 -1
  63. package/dist/index.js +21 -7
  64. package/dist/index.mjs +1716 -1468
  65. package/dist/plugins/api/index.d.ts +1 -1
  66. package/dist/plugins/api/index.js +1 -1
  67. package/dist/plugins/apps/index.d.ts +8 -5
  68. package/dist/plugins/apps/index.d.ts.map +1 -1
  69. package/dist/plugins/apps/index.js +1 -1
  70. package/dist/plugins/capabilities/index.d.ts +1 -1
  71. package/dist/plugins/capabilities/index.js +1 -1
  72. package/dist/plugins/codeSubstrate/cancelDurableRun/index.d.ts +32 -2
  73. package/dist/plugins/codeSubstrate/cancelDurableRun/index.d.ts.map +1 -1
  74. package/dist/plugins/codeSubstrate/cancelDurableRun/index.js +1 -1
  75. package/dist/plugins/codeSubstrate/createWorkflow/index.d.ts +2 -2
  76. package/dist/plugins/codeSubstrate/createWorkflow/index.js +1 -1
  77. package/dist/plugins/codeSubstrate/deleteWorkflow/index.d.ts +27 -2
  78. package/dist/plugins/codeSubstrate/deleteWorkflow/index.d.ts.map +1 -1
  79. package/dist/plugins/codeSubstrate/deleteWorkflow/index.js +1 -1
  80. package/dist/plugins/codeSubstrate/disableWorkflow/index.d.ts +27 -2
  81. package/dist/plugins/codeSubstrate/disableWorkflow/index.d.ts.map +1 -1
  82. package/dist/plugins/codeSubstrate/disableWorkflow/index.js +1 -1
  83. package/dist/plugins/codeSubstrate/enableWorkflow/index.d.ts +27 -2
  84. package/dist/plugins/codeSubstrate/enableWorkflow/index.d.ts.map +1 -1
  85. package/dist/plugins/codeSubstrate/enableWorkflow/index.js +1 -1
  86. package/dist/plugins/codeSubstrate/getDurableRun/index.d.ts +32 -2
  87. package/dist/plugins/codeSubstrate/getDurableRun/index.d.ts.map +1 -1
  88. package/dist/plugins/codeSubstrate/getDurableRun/index.js +1 -1
  89. package/dist/plugins/codeSubstrate/getTriggerRun/index.d.ts +2 -2
  90. package/dist/plugins/codeSubstrate/getTriggerRun/index.js +1 -1
  91. package/dist/plugins/codeSubstrate/getWorkflow/index.d.ts +27 -2
  92. package/dist/plugins/codeSubstrate/getWorkflow/index.d.ts.map +1 -1
  93. package/dist/plugins/codeSubstrate/getWorkflow/index.js +1 -1
  94. package/dist/plugins/codeSubstrate/getWorkflowRun/index.d.ts +55 -2
  95. package/dist/plugins/codeSubstrate/getWorkflowRun/index.d.ts.map +1 -1
  96. package/dist/plugins/codeSubstrate/getWorkflowRun/index.js +1 -1
  97. package/dist/plugins/codeSubstrate/getWorkflowVersion/index.d.ts +51 -2
  98. package/dist/plugins/codeSubstrate/getWorkflowVersion/index.d.ts.map +1 -1
  99. package/dist/plugins/codeSubstrate/getWorkflowVersion/index.js +1 -1
  100. package/dist/plugins/codeSubstrate/listDurableRuns/index.d.ts +3 -3
  101. package/dist/plugins/codeSubstrate/listDurableRuns/index.d.ts.map +1 -1
  102. package/dist/plugins/codeSubstrate/listDurableRuns/index.js +1 -1
  103. package/dist/plugins/codeSubstrate/listWorkflowRuns/index.d.ts +28 -3
  104. package/dist/plugins/codeSubstrate/listWorkflowRuns/index.d.ts.map +1 -1
  105. package/dist/plugins/codeSubstrate/listWorkflowRuns/index.js +1 -1
  106. package/dist/plugins/codeSubstrate/listWorkflowVersions/index.d.ts +28 -3
  107. package/dist/plugins/codeSubstrate/listWorkflowVersions/index.d.ts.map +1 -1
  108. package/dist/plugins/codeSubstrate/listWorkflowVersions/index.js +1 -1
  109. package/dist/plugins/codeSubstrate/listWorkflows/index.d.ts +3 -3
  110. package/dist/plugins/codeSubstrate/listWorkflows/index.d.ts.map +1 -1
  111. package/dist/plugins/codeSubstrate/listWorkflows/index.js +2 -3
  112. package/dist/plugins/codeSubstrate/publishWorkflowVersion/index.d.ts +27 -2
  113. package/dist/plugins/codeSubstrate/publishWorkflowVersion/index.d.ts.map +1 -1
  114. package/dist/plugins/codeSubstrate/publishWorkflowVersion/index.js +1 -1
  115. package/dist/plugins/codeSubstrate/runDurable/index.d.ts +2 -2
  116. package/dist/plugins/codeSubstrate/runDurable/index.js +1 -1
  117. package/dist/plugins/codeSubstrate/triggerWorkflow/index.d.ts +73 -0
  118. package/dist/plugins/codeSubstrate/triggerWorkflow/index.d.ts.map +1 -0
  119. package/dist/plugins/codeSubstrate/triggerWorkflow/index.js +52 -0
  120. package/dist/plugins/codeSubstrate/triggerWorkflow/schemas.d.ts +16 -0
  121. package/dist/plugins/codeSubstrate/triggerWorkflow/schemas.d.ts.map +1 -0
  122. package/dist/plugins/codeSubstrate/triggerWorkflow/schemas.js +31 -0
  123. package/dist/plugins/codeSubstrate/updateWorkflow/index.d.ts +27 -2
  124. package/dist/plugins/codeSubstrate/updateWorkflow/index.d.ts.map +1 -1
  125. package/dist/plugins/codeSubstrate/updateWorkflow/index.js +1 -1
  126. package/dist/plugins/connections/index.d.ts +1 -1
  127. package/dist/plugins/connections/index.js +1 -1
  128. package/dist/plugins/createClientCredentials/index.d.ts +2 -2
  129. package/dist/plugins/createClientCredentials/index.d.ts.map +1 -1
  130. package/dist/plugins/createClientCredentials/index.js +4 -2
  131. package/dist/plugins/createClientCredentials/schemas.d.ts +1 -2
  132. package/dist/plugins/createClientCredentials/schemas.d.ts.map +1 -1
  133. package/dist/plugins/deleteClientCredentials/index.d.ts +24 -2
  134. package/dist/plugins/deleteClientCredentials/index.d.ts.map +1 -1
  135. package/dist/plugins/deleteClientCredentials/index.js +2 -2
  136. package/dist/plugins/deleteClientCredentials/schemas.d.ts +1 -2
  137. package/dist/plugins/deleteClientCredentials/schemas.d.ts.map +1 -1
  138. package/dist/plugins/deprecated/authentications.d.ts +144 -16
  139. package/dist/plugins/deprecated/authentications.d.ts.map +1 -1
  140. package/dist/plugins/deprecated/authentications.js +14 -5
  141. package/dist/plugins/deprecated/inputFields.d.ts +58 -23
  142. package/dist/plugins/deprecated/inputFields.d.ts.map +1 -1
  143. package/dist/plugins/deprecated/inputFields.js +15 -7
  144. package/dist/plugins/eventEmission/event-emission-hook.d.ts +10 -0
  145. package/dist/plugins/eventEmission/event-emission-hook.d.ts.map +1 -0
  146. package/dist/plugins/eventEmission/event-emission-hook.js +47 -0
  147. package/dist/plugins/eventEmission/index.d.ts +5 -3
  148. package/dist/plugins/eventEmission/index.d.ts.map +1 -1
  149. package/dist/plugins/eventEmission/index.js +16 -9
  150. package/dist/plugins/eventEmission/method-metadata.d.ts +16 -0
  151. package/dist/plugins/eventEmission/method-metadata.d.ts.map +1 -0
  152. package/dist/plugins/eventEmission/method-metadata.js +20 -0
  153. package/dist/plugins/eventEmission/transport.d.ts.map +1 -1
  154. package/dist/plugins/eventEmission/transport.js +2 -1
  155. package/dist/plugins/eventEmission/types.d.ts +1 -1
  156. package/dist/plugins/eventEmission/types.d.ts.map +1 -1
  157. package/dist/plugins/fetch/index.d.ts +11 -5
  158. package/dist/plugins/fetch/index.d.ts.map +1 -1
  159. package/dist/plugins/fetch/index.js +42 -32
  160. package/dist/plugins/fetch/schemas.d.ts +1 -1
  161. package/dist/plugins/findFirstConnection/index.d.ts +4 -4
  162. package/dist/plugins/findFirstConnection/index.d.ts.map +1 -1
  163. package/dist/plugins/findFirstConnection/index.js +4 -2
  164. package/dist/plugins/findFirstConnection/schemas.d.ts +2 -2
  165. package/dist/plugins/findUniqueConnection/index.d.ts +4 -4
  166. package/dist/plugins/findUniqueConnection/index.d.ts.map +1 -1
  167. package/dist/plugins/findUniqueConnection/index.js +4 -2
  168. package/dist/plugins/findUniqueConnection/schemas.d.ts +2 -2
  169. package/dist/plugins/getAction/index.d.ts +141 -4
  170. package/dist/plugins/getAction/index.d.ts.map +1 -1
  171. package/dist/plugins/getAction/index.js +5 -3
  172. package/dist/plugins/getAction/schemas.d.ts +6 -6
  173. package/dist/plugins/getActionInputFieldsSchema/index.d.ts +232 -3
  174. package/dist/plugins/getActionInputFieldsSchema/index.d.ts.map +1 -1
  175. package/dist/plugins/getActionInputFieldsSchema/index.js +3 -3
  176. package/dist/plugins/getActionInputFieldsSchema/schemas.d.ts +6 -6
  177. package/dist/plugins/getApp/index.d.ts +4 -4
  178. package/dist/plugins/getApp/index.d.ts.map +1 -1
  179. package/dist/plugins/getApp/index.js +3 -1
  180. package/dist/plugins/getApp/schemas.d.ts +4 -4
  181. package/dist/plugins/getConnection/index.d.ts +125 -2
  182. package/dist/plugins/getConnection/index.d.ts.map +1 -1
  183. package/dist/plugins/getConnection/index.js +4 -2
  184. package/dist/plugins/getProfile/index.d.ts +2 -2
  185. package/dist/plugins/getProfile/index.d.ts.map +1 -1
  186. package/dist/plugins/getProfile/index.js +4 -2
  187. package/dist/plugins/getProfile/schemas.d.ts +1 -2
  188. package/dist/plugins/getProfile/schemas.d.ts.map +1 -1
  189. package/dist/plugins/listActionInputFieldChoices/index.d.ts +287 -4
  190. package/dist/plugins/listActionInputFieldChoices/index.d.ts.map +1 -1
  191. package/dist/plugins/listActionInputFieldChoices/index.js +6 -4
  192. package/dist/plugins/listActionInputFieldChoices/schemas.d.ts +8 -8
  193. package/dist/plugins/listActionInputFieldChoices/schemas.d.ts.map +1 -1
  194. package/dist/plugins/listActionInputFieldChoices/schemas.js +1 -22
  195. package/dist/plugins/listActionInputFields/index.d.ts +168 -5
  196. package/dist/plugins/listActionInputFields/index.d.ts.map +1 -1
  197. package/dist/plugins/listActionInputFields/index.js +7 -5
  198. package/dist/plugins/listActionInputFields/schemas.d.ts +6 -6
  199. package/dist/plugins/listActions/index.d.ts +140 -3
  200. package/dist/plugins/listActions/index.d.ts.map +1 -1
  201. package/dist/plugins/listActions/index.js +6 -4
  202. package/dist/plugins/listActions/schemas.d.ts +4 -4
  203. package/dist/plugins/listApps/index.d.ts +3 -3
  204. package/dist/plugins/listApps/index.d.ts.map +1 -1
  205. package/dist/plugins/listApps/index.js +6 -4
  206. package/dist/plugins/listClientCredentials/index.d.ts +3 -3
  207. package/dist/plugins/listClientCredentials/index.d.ts.map +1 -1
  208. package/dist/plugins/listClientCredentials/index.js +6 -4
  209. package/dist/plugins/listConnections/index.d.ts +140 -3
  210. package/dist/plugins/listConnections/index.d.ts.map +1 -1
  211. package/dist/plugins/listConnections/index.js +7 -5
  212. package/dist/plugins/listConnections/schemas.d.ts +2 -2
  213. package/dist/plugins/manifest/index.d.ts +1 -1
  214. package/dist/plugins/manifest/index.d.ts.map +1 -1
  215. package/dist/plugins/manifest/index.js +6 -4
  216. package/dist/plugins/registry/index.d.ts +1 -1
  217. package/dist/plugins/registry/index.js +1 -1
  218. package/dist/plugins/request/index.d.ts +8 -5
  219. package/dist/plugins/request/index.d.ts.map +1 -1
  220. package/dist/plugins/request/index.js +4 -3
  221. package/dist/plugins/request/schemas.d.ts +2 -2
  222. package/dist/plugins/runAction/index.d.ts +168 -5
  223. package/dist/plugins/runAction/index.d.ts.map +1 -1
  224. package/dist/plugins/runAction/index.js +9 -5
  225. package/dist/plugins/runAction/schemas.d.ts +6 -6
  226. package/dist/plugins/tables/createTable/index.d.ts +2 -2
  227. package/dist/plugins/tables/createTable/index.js +2 -2
  228. package/dist/plugins/tables/createTable/schemas.d.ts +1 -2
  229. package/dist/plugins/tables/createTable/schemas.d.ts.map +1 -1
  230. package/dist/plugins/tables/createTableFields/index.d.ts +34 -2
  231. package/dist/plugins/tables/createTableFields/index.d.ts.map +1 -1
  232. package/dist/plugins/tables/createTableFields/index.js +4 -2
  233. package/dist/plugins/tables/createTableFields/schemas.d.ts +3 -4
  234. package/dist/plugins/tables/createTableFields/schemas.d.ts.map +1 -1
  235. package/dist/plugins/tables/createTableRecords/index.d.ts +63 -2
  236. package/dist/plugins/tables/createTableRecords/index.d.ts.map +1 -1
  237. package/dist/plugins/tables/createTableRecords/index.js +2 -2
  238. package/dist/plugins/tables/createTableRecords/schemas.d.ts +3 -4
  239. package/dist/plugins/tables/createTableRecords/schemas.d.ts.map +1 -1
  240. package/dist/plugins/tables/deleteTable/index.d.ts +34 -2
  241. package/dist/plugins/tables/deleteTable/index.d.ts.map +1 -1
  242. package/dist/plugins/tables/deleteTable/index.js +2 -2
  243. package/dist/plugins/tables/deleteTable/schemas.d.ts +3 -4
  244. package/dist/plugins/tables/deleteTable/schemas.d.ts.map +1 -1
  245. package/dist/plugins/tables/deleteTableFields/index.d.ts +63 -2
  246. package/dist/plugins/tables/deleteTableFields/index.d.ts.map +1 -1
  247. package/dist/plugins/tables/deleteTableFields/index.js +2 -2
  248. package/dist/plugins/tables/deleteTableFields/schemas.d.ts +4 -5
  249. package/dist/plugins/tables/deleteTableFields/schemas.d.ts.map +1 -1
  250. package/dist/plugins/tables/deleteTableRecords/index.d.ts +84 -2
  251. package/dist/plugins/tables/deleteTableRecords/index.d.ts.map +1 -1
  252. package/dist/plugins/tables/deleteTableRecords/index.js +2 -2
  253. package/dist/plugins/tables/deleteTableRecords/schemas.d.ts +4 -5
  254. package/dist/plugins/tables/deleteTableRecords/schemas.d.ts.map +1 -1
  255. package/dist/plugins/tables/getTable/index.d.ts +34 -2
  256. package/dist/plugins/tables/getTable/index.d.ts.map +1 -1
  257. package/dist/plugins/tables/getTable/index.js +2 -2
  258. package/dist/plugins/tables/getTable/schemas.d.ts +2 -2
  259. package/dist/plugins/tables/getTableRecord/index.d.ts +84 -2
  260. package/dist/plugins/tables/getTableRecord/index.d.ts.map +1 -1
  261. package/dist/plugins/tables/getTableRecord/index.js +2 -2
  262. package/dist/plugins/tables/getTableRecord/schemas.d.ts +6 -7
  263. package/dist/plugins/tables/getTableRecord/schemas.d.ts.map +1 -1
  264. package/dist/plugins/tables/getTableRecord/schemas.js +1 -10
  265. package/dist/plugins/tables/listTableFields/index.d.ts +34 -2
  266. package/dist/plugins/tables/listTableFields/index.d.ts.map +1 -1
  267. package/dist/plugins/tables/listTableFields/index.js +4 -2
  268. package/dist/plugins/tables/listTableFields/schemas.d.ts +4 -5
  269. package/dist/plugins/tables/listTableFields/schemas.d.ts.map +1 -1
  270. package/dist/plugins/tables/listTableFields/schemas.js +1 -9
  271. package/dist/plugins/tables/listTableRecords/index.d.ts +65 -4
  272. package/dist/plugins/tables/listTableRecords/index.d.ts.map +1 -1
  273. package/dist/plugins/tables/listTableRecords/index.js +3 -3
  274. package/dist/plugins/tables/listTableRecords/schemas.d.ts +2 -2
  275. package/dist/plugins/tables/listTables/index.d.ts +3 -3
  276. package/dist/plugins/tables/listTables/index.d.ts.map +1 -1
  277. package/dist/plugins/tables/listTables/index.js +4 -4
  278. package/dist/plugins/tables/updateTableRecords/index.d.ts +63 -2
  279. package/dist/plugins/tables/updateTableRecords/index.d.ts.map +1 -1
  280. package/dist/plugins/tables/updateTableRecords/index.js +2 -2
  281. package/dist/plugins/tables/updateTableRecords/schemas.d.ts +3 -4
  282. package/dist/plugins/tables/updateTableRecords/schemas.d.ts.map +1 -1
  283. package/dist/plugins/triggers/ackTriggerInboxMessages/index.d.ts +59 -2
  284. package/dist/plugins/triggers/ackTriggerInboxMessages/index.d.ts.map +1 -1
  285. package/dist/plugins/triggers/ackTriggerInboxMessages/index.js +1 -1
  286. package/dist/plugins/triggers/ackTriggerInboxMessages/schemas.d.ts +1 -1
  287. package/dist/plugins/triggers/createTriggerInbox/index.d.ts +231 -2
  288. package/dist/plugins/triggers/createTriggerInbox/index.d.ts.map +1 -1
  289. package/dist/plugins/triggers/createTriggerInbox/index.js +3 -1
  290. package/dist/plugins/triggers/createTriggerInbox/schemas.d.ts +3 -4
  291. package/dist/plugins/triggers/createTriggerInbox/schemas.d.ts.map +1 -1
  292. package/dist/plugins/triggers/deleteTriggerInbox/index.d.ts +33 -2
  293. package/dist/plugins/triggers/deleteTriggerInbox/index.d.ts.map +1 -1
  294. package/dist/plugins/triggers/deleteTriggerInbox/index.js +3 -1
  295. package/dist/plugins/triggers/deleteTriggerInbox/schemas.d.ts +2 -3
  296. package/dist/plugins/triggers/deleteTriggerInbox/schemas.d.ts.map +1 -1
  297. package/dist/plugins/triggers/drainTriggerInbox/index.d.ts +68 -6
  298. package/dist/plugins/triggers/drainTriggerInbox/index.d.ts.map +1 -1
  299. package/dist/plugins/triggers/drainTriggerInbox/index.js +1 -1
  300. package/dist/plugins/triggers/drainTriggerInbox/schemas.d.ts +2 -2
  301. package/dist/plugins/triggers/ensureTriggerInbox/index.d.ts +231 -2
  302. package/dist/plugins/triggers/ensureTriggerInbox/index.d.ts.map +1 -1
  303. package/dist/plugins/triggers/ensureTriggerInbox/index.js +3 -1
  304. package/dist/plugins/triggers/ensureTriggerInbox/schemas.d.ts +3 -4
  305. package/dist/plugins/triggers/ensureTriggerInbox/schemas.d.ts.map +1 -1
  306. package/dist/plugins/triggers/getTriggerInbox/index.d.ts +33 -2
  307. package/dist/plugins/triggers/getTriggerInbox/index.d.ts.map +1 -1
  308. package/dist/plugins/triggers/getTriggerInbox/index.js +3 -1
  309. package/dist/plugins/triggers/getTriggerInbox/schemas.d.ts +2 -3
  310. package/dist/plugins/triggers/getTriggerInbox/schemas.d.ts.map +1 -1
  311. package/dist/plugins/triggers/getTriggerInputFieldsSchema/index.d.ts +232 -3
  312. package/dist/plugins/triggers/getTriggerInputFieldsSchema/index.d.ts.map +1 -1
  313. package/dist/plugins/triggers/getTriggerInputFieldsSchema/index.js +1 -1
  314. package/dist/plugins/triggers/getTriggerInputFieldsSchema/schemas.d.ts +2 -2
  315. package/dist/plugins/triggers/leaseTriggerInboxMessages/index.d.ts +33 -2
  316. package/dist/plugins/triggers/leaseTriggerInboxMessages/index.d.ts.map +1 -1
  317. package/dist/plugins/triggers/leaseTriggerInboxMessages/index.js +1 -1
  318. package/dist/plugins/triggers/leaseTriggerInboxMessages/schemas.d.ts +1 -1
  319. package/dist/plugins/triggers/listTriggerInboxMessages/index.d.ts +34 -3
  320. package/dist/plugins/triggers/listTriggerInboxMessages/index.d.ts.map +1 -1
  321. package/dist/plugins/triggers/listTriggerInboxMessages/index.js +5 -13
  322. package/dist/plugins/triggers/listTriggerInboxMessages/schemas.d.ts +1 -1
  323. package/dist/plugins/triggers/listTriggerInboxes/index.d.ts +3 -3
  324. package/dist/plugins/triggers/listTriggerInboxes/index.d.ts.map +1 -1
  325. package/dist/plugins/triggers/listTriggerInboxes/index.js +5 -14
  326. package/dist/plugins/triggers/listTriggerInputFieldChoices/index.d.ts +288 -5
  327. package/dist/plugins/triggers/listTriggerInputFieldChoices/index.d.ts.map +1 -1
  328. package/dist/plugins/triggers/listTriggerInputFieldChoices/index.js +7 -5
  329. package/dist/plugins/triggers/listTriggerInputFieldChoices/schemas.d.ts +3 -3
  330. package/dist/plugins/triggers/listTriggerInputFields/index.d.ts +234 -5
  331. package/dist/plugins/triggers/listTriggerInputFields/index.d.ts.map +1 -1
  332. package/dist/plugins/triggers/listTriggerInputFields/index.js +6 -5
  333. package/dist/plugins/triggers/listTriggerInputFields/schemas.d.ts +2 -2
  334. package/dist/plugins/triggers/listTriggers/index.d.ts +142 -5
  335. package/dist/plugins/triggers/listTriggers/index.d.ts.map +1 -1
  336. package/dist/plugins/triggers/listTriggers/index.js +6 -5
  337. package/dist/plugins/triggers/listTriggers/schemas.d.ts +1 -1
  338. package/dist/plugins/triggers/pauseTriggerInbox/index.d.ts +33 -2
  339. package/dist/plugins/triggers/pauseTriggerInbox/index.d.ts.map +1 -1
  340. package/dist/plugins/triggers/pauseTriggerInbox/index.js +3 -1
  341. package/dist/plugins/triggers/pauseTriggerInbox/schemas.d.ts +2 -3
  342. package/dist/plugins/triggers/pauseTriggerInbox/schemas.d.ts.map +1 -1
  343. package/dist/plugins/triggers/releaseTriggerInboxMessages/index.d.ts +59 -2
  344. package/dist/plugins/triggers/releaseTriggerInboxMessages/index.d.ts.map +1 -1
  345. package/dist/plugins/triggers/releaseTriggerInboxMessages/index.js +1 -1
  346. package/dist/plugins/triggers/releaseTriggerInboxMessages/schemas.d.ts +1 -1
  347. package/dist/plugins/triggers/resumeTriggerInbox/index.d.ts +33 -2
  348. package/dist/plugins/triggers/resumeTriggerInbox/index.d.ts.map +1 -1
  349. package/dist/plugins/triggers/resumeTriggerInbox/index.js +3 -1
  350. package/dist/plugins/triggers/resumeTriggerInbox/schemas.d.ts +2 -3
  351. package/dist/plugins/triggers/resumeTriggerInbox/schemas.d.ts.map +1 -1
  352. package/dist/plugins/triggers/updateTriggerInbox/index.d.ts +33 -2
  353. package/dist/plugins/triggers/updateTriggerInbox/index.d.ts.map +1 -1
  354. package/dist/plugins/triggers/updateTriggerInbox/index.js +3 -1
  355. package/dist/plugins/triggers/updateTriggerInbox/schemas.d.ts +2 -3
  356. package/dist/plugins/triggers/updateTriggerInbox/schemas.d.ts.map +1 -1
  357. package/dist/plugins/triggers/watchTriggerInbox/index.d.ts +37 -6
  358. package/dist/plugins/triggers/watchTriggerInbox/index.d.ts.map +1 -1
  359. package/dist/plugins/triggers/watchTriggerInbox/index.js +1 -1
  360. package/dist/resolvers/actionKey.d.ts +3 -2
  361. package/dist/resolvers/actionKey.d.ts.map +1 -1
  362. package/dist/resolvers/actionType.d.ts +7 -2
  363. package/dist/resolvers/actionType.d.ts.map +1 -1
  364. package/dist/resolvers/actionType.js +3 -0
  365. package/dist/resolvers/appKey.d.ts +10 -5
  366. package/dist/resolvers/appKey.d.ts.map +1 -1
  367. package/dist/resolvers/appKey.js +3 -0
  368. package/dist/resolvers/clientCredentialsName.d.ts +1 -1
  369. package/dist/resolvers/clientCredentialsName.d.ts.map +1 -1
  370. package/dist/resolvers/clientId.d.ts +3 -2
  371. package/dist/resolvers/clientId.d.ts.map +1 -1
  372. package/dist/resolvers/clientId.js +1 -1
  373. package/dist/resolvers/connectionId.d.ts +5 -2
  374. package/dist/resolvers/connectionId.d.ts.map +1 -1
  375. package/dist/resolvers/connectionId.js +1 -1
  376. package/dist/resolvers/durableRunId.d.ts +3 -2
  377. package/dist/resolvers/durableRunId.d.ts.map +1 -1
  378. package/dist/resolvers/durableRunId.js +3 -2
  379. package/dist/resolvers/inputFieldKey.d.ts +3 -2
  380. package/dist/resolvers/inputFieldKey.d.ts.map +1 -1
  381. package/dist/resolvers/inputFieldKey.js +1 -1
  382. package/dist/resolvers/tableFieldIds.d.ts +3 -2
  383. package/dist/resolvers/tableFieldIds.d.ts.map +1 -1
  384. package/dist/resolvers/tableFields.d.ts +2 -2
  385. package/dist/resolvers/tableFields.d.ts.map +1 -1
  386. package/dist/resolvers/tableFilters.d.ts +3 -2
  387. package/dist/resolvers/tableFilters.d.ts.map +1 -1
  388. package/dist/resolvers/tableId.d.ts +3 -2
  389. package/dist/resolvers/tableId.d.ts.map +1 -1
  390. package/dist/resolvers/tableId.js +1 -1
  391. package/dist/resolvers/tableName.d.ts +1 -1
  392. package/dist/resolvers/tableName.d.ts.map +1 -1
  393. package/dist/resolvers/tableRecordId.d.ts +4 -3
  394. package/dist/resolvers/tableRecordId.d.ts.map +1 -1
  395. package/dist/resolvers/tableRecords.d.ts +4 -3
  396. package/dist/resolvers/tableRecords.d.ts.map +1 -1
  397. package/dist/resolvers/tableSort.d.ts +3 -2
  398. package/dist/resolvers/tableSort.d.ts.map +1 -1
  399. package/dist/resolvers/triggerInbox.d.ts +3 -2
  400. package/dist/resolvers/triggerInbox.d.ts.map +1 -1
  401. package/dist/resolvers/triggerInbox.js +1 -1
  402. package/dist/resolvers/triggerMessages.d.ts +3 -2
  403. package/dist/resolvers/triggerMessages.d.ts.map +1 -1
  404. package/dist/resolvers/triggerMessages.js +2 -4
  405. package/dist/resolvers/workflowId.d.ts +3 -2
  406. package/dist/resolvers/workflowId.d.ts.map +1 -1
  407. package/dist/resolvers/workflowId.js +3 -2
  408. package/dist/resolvers/workflowRunId.d.ts +3 -2
  409. package/dist/resolvers/workflowRunId.d.ts.map +1 -1
  410. package/dist/resolvers/workflowRunId.js +5 -5
  411. package/dist/resolvers/workflowVersionId.d.ts +3 -2
  412. package/dist/resolvers/workflowVersionId.d.ts.map +1 -1
  413. package/dist/resolvers/workflowVersionId.js +7 -7
  414. package/dist/schemas/Action.d.ts.map +1 -1
  415. package/dist/schemas/Action.js +6 -30
  416. package/dist/schemas/App.d.ts +0 -1
  417. package/dist/schemas/App.d.ts.map +1 -1
  418. package/dist/schemas/App.js +2 -14
  419. package/dist/schemas/ClientCredentials.d.ts.map +1 -1
  420. package/dist/schemas/ClientCredentials.js +3 -41
  421. package/dist/schemas/Connection.d.ts.map +1 -1
  422. package/dist/schemas/Connection.js +2 -28
  423. package/dist/schemas/Field.d.ts.map +1 -1
  424. package/dist/schemas/Field.js +3 -70
  425. package/dist/schemas/Run.d.ts.map +1 -1
  426. package/dist/schemas/Run.js +3 -29
  427. package/dist/schemas/TriggerInbox.d.ts.map +1 -1
  428. package/dist/schemas/TriggerInbox.js +1 -33
  429. package/dist/schemas/TriggerMessage.d.ts.map +1 -1
  430. package/dist/schemas/TriggerMessage.js +2 -60
  431. package/dist/schemas/UserProfile.d.ts +0 -1
  432. package/dist/schemas/UserProfile.d.ts.map +1 -1
  433. package/dist/schemas/UserProfile.js +1 -20
  434. package/dist/sdk.d.ts +2761 -441
  435. package/dist/sdk.d.ts.map +1 -1
  436. package/dist/sdk.js +93 -129
  437. package/dist/types/errors.d.ts +44 -42
  438. package/dist/types/errors.d.ts.map +1 -1
  439. package/dist/types/errors.js +79 -33
  440. package/dist/types/functions.d.ts +1 -41
  441. package/dist/types/functions.d.ts.map +1 -1
  442. package/dist/types/properties.d.ts +7 -7
  443. package/dist/types/properties.js +1 -1
  444. package/dist/types/sdk.d.ts +1 -1
  445. package/dist/types/sdk.d.ts.map +1 -1
  446. package/dist/types/telemetry-events.d.ts +1 -1
  447. package/dist/types/telemetry-events.d.ts.map +1 -1
  448. package/dist/utils/domain-utils.js +1 -1
  449. package/dist/utils/logging.d.ts +1 -12
  450. package/dist/utils/logging.d.ts.map +1 -1
  451. package/dist/utils/logging.js +2 -20
  452. package/dist/utils/pagination.d.ts +38 -0
  453. package/dist/utils/pagination.d.ts.map +1 -0
  454. package/dist/utils/pagination.js +53 -0
  455. package/package.json +3 -2
  456. package/dist/registry.d.ts +0 -9
  457. package/dist/registry.d.ts.map +0 -1
  458. package/dist/registry.js +0 -103
  459. package/dist/types/meta.d.ts +0 -9
  460. package/dist/types/meta.d.ts.map +0 -1
  461. package/dist/types/meta.js +0 -3
  462. package/dist/types/plugin.d.ts +0 -84
  463. package/dist/types/plugin.d.ts.map +0 -1
  464. package/dist/types/plugin.js +0 -13
  465. package/dist/types/registry.d.ts +0 -54
  466. package/dist/types/registry.d.ts.map +0 -1
  467. package/dist/types/registry.js +0 -1
  468. package/dist/utils/function-utils.d.ts +0 -59
  469. package/dist/utils/function-utils.d.ts.map +0 -1
  470. package/dist/utils/function-utils.js +0 -245
  471. package/dist/utils/pagination-utils.d.ts +0 -73
  472. package/dist/utils/pagination-utils.d.ts.map +0 -1
  473. package/dist/utils/pagination-utils.js +0 -308
  474. package/dist/utils/plugin-utils.d.ts +0 -245
  475. package/dist/utils/plugin-utils.d.ts.map +0 -1
  476. package/dist/utils/plugin-utils.js +0 -234
  477. package/dist/utils/schema-utils.d.ts +0 -211
  478. package/dist/utils/schema-utils.d.ts.map +0 -1
  479. package/dist/utils/schema-utils.js +0 -72
  480. package/dist/utils/string-utils.d.ts +0 -40
  481. package/dist/utils/string-utils.d.ts.map +0 -1
  482. package/dist/utils/string-utils.js +0 -69
  483. package/dist/utils/telemetry-context.d.ts +0 -15
  484. package/dist/utils/telemetry-context.d.ts.map +0 -1
  485. package/dist/utils/telemetry-context.js +0 -48
  486. package/dist/utils/telemetry-utils.d.ts +0 -44
  487. package/dist/utils/telemetry-utils.d.ts.map +0 -1
  488. package/dist/utils/telemetry-utils.js +0 -60
  489. package/dist/utils/validation.d.ts +0 -4
  490. package/dist/utils/validation.d.ts.map +0 -1
  491. package/dist/utils/validation.js +0 -30
package/dist/index.mjs CHANGED
@@ -11,547 +11,271 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
11
11
  if (typeof require !== "undefined") return require.apply(this, arguments);
12
12
  throw Error('Dynamic require of "' + x + '" is not supported');
13
13
  });
14
- function withFormatter(schema, formatMeta) {
15
- Object.assign(schema._zod.def, {
16
- formatMeta
17
- });
18
- return schema;
19
- }
20
- function withPositional(schema) {
21
- Object.assign(schema._zod.def, {
22
- positionalMeta: { positional: true }
23
- });
24
- return schema;
25
- }
26
- function schemaHasPositionalMeta(schema) {
27
- return "positionalMeta" in schema._zod.def;
14
+ function toTitleCase(input) {
15
+ return input.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[_\-]+/g, " ").replace(/\s+/g, " ").trim().split(" ").map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(" ");
28
16
  }
29
- function isPositional(schema) {
30
- if (schemaHasPositionalMeta(schema) && schema._zod.def.positionalMeta?.positional) {
31
- return true;
32
- }
33
- if (schema instanceof z.ZodOptional) {
34
- return isPositional(schema._zod.def.innerType);
17
+ function toSnakeCase(input) {
18
+ let result = input.replace(/([a-z0-9])([A-Z])/g, "$1_$2").replace(/[\s\-]+/g, "_").replace(/_+/g, "_").replace(/^_|_$/g, "").toLowerCase();
19
+ if (/^[0-9]/.test(result)) {
20
+ result = "_" + result;
35
21
  }
36
- if (schema instanceof z.ZodDefault) {
37
- return isPositional(schema._zod.def.innerType);
22
+ return result;
23
+ }
24
+ function pluralize(word) {
25
+ if (/s$/i.test(word)) return word;
26
+ if (/[bcdfghjklmnpqrstvwxz]y$/i.test(word)) {
27
+ return word.slice(0, -1) + "ies";
38
28
  }
39
- return false;
29
+ return word + "s";
40
30
  }
41
-
42
- // src/constants.ts
43
- var ZAPIER_BASE_URL = globalThis.process?.env?.ZAPIER_BASE_URL || "https://zapier.com";
44
- function getZapierSdkService() {
45
- return globalThis.process?.env?.ZAPIER_SDK_SERVICE;
31
+ function pluralizeLastWord(title) {
32
+ const words = title.split(" ");
33
+ return [...words.slice(0, -1), pluralize(words[words.length - 1])].join(" ");
46
34
  }
47
- var MAX_PAGE_LIMIT = 1e4;
48
- var DEFAULT_PAGE_SIZE = 100;
49
- var DEFAULT_ACTION_TIMEOUT_MS = 18e4;
50
- function parseIntEnvVar(name) {
51
- const value = globalThis.process?.env?.[name];
52
- if (value === void 0) return void 0;
53
- const parsed = parseInt(value, 10);
54
- if (isNaN(parsed)) {
55
- console.warn(
56
- `[zapier-sdk] Invalid value for ${name}: "${value}" (expected integer)`
57
- );
58
- return void 0;
35
+ function resolveCategoryDefinition(ref) {
36
+ const def = typeof ref === "string" ? { key: ref } : ref;
37
+ const title = def.title ?? toTitleCase(def.key);
38
+ return {
39
+ key: def.key,
40
+ title,
41
+ titlePlural: def.titlePlural ?? pluralizeLastWord(title)
42
+ };
43
+ }
44
+ function canonicalInputSchema(schema) {
45
+ if (schema instanceof z.ZodUnion) {
46
+ return schema.options[0];
59
47
  }
60
- return parsed;
48
+ return schema;
61
49
  }
62
- var ZAPIER_MAX_NETWORK_RETRIES = parseIntEnvVar("ZAPIER_MAX_NETWORK_RETRIES") ?? 3;
63
- var ZAPIER_MAX_NETWORK_RETRY_DELAY_MS = parseIntEnvVar("ZAPIER_MAX_NETWORK_RETRY_DELAY_MS") ?? 6e4;
64
- var MAX_CONCURRENCY_LIMIT = 1e4;
65
- function parseConcurrencyEnvVar(name) {
66
- const value = globalThis.process?.env?.[name];
67
- if (!value) return void 0;
68
- if (value === "Infinity") return Infinity;
69
- if (/^[1-9]\d*$/.test(value)) {
70
- const parsed = parseInt(value, 10);
71
- if (parsed <= MAX_CONCURRENCY_LIMIT) return parsed;
50
+ function buildRegistry({
51
+ sdk,
52
+ meta,
53
+ packageFilter
54
+ }) {
55
+ const definitionsByKey = /* @__PURE__ */ new Map();
56
+ const objectDeclaredKeys = /* @__PURE__ */ new Set();
57
+ for (const m of Object.values(meta)) {
58
+ for (const ref of m.categories ?? []) {
59
+ const key = typeof ref === "string" ? ref : ref.key;
60
+ if (typeof ref === "object") {
61
+ objectDeclaredKeys.add(key);
62
+ definitionsByKey.set(key, resolveCategoryDefinition(ref));
63
+ } else if (!objectDeclaredKeys.has(key)) {
64
+ definitionsByKey.set(key, resolveCategoryDefinition(ref));
65
+ }
66
+ }
72
67
  }
73
- console.warn(
74
- `[zapier-sdk] Invalid value for ${name}: "${value}" (expected positive integer 1-${MAX_CONCURRENCY_LIMIT} or "Infinity")`
75
- );
76
- return void 0;
68
+ if (!definitionsByKey.has("other")) {
69
+ definitionsByKey.set("other", resolveCategoryDefinition("other"));
70
+ }
71
+ const knownCategories = Array.from(definitionsByKey.keys());
72
+ const functions = Object.keys(meta).filter((key) => {
73
+ const property = sdk[key];
74
+ if (typeof property === "function") return true;
75
+ const [rootKey] = key.split(".");
76
+ const rootProperty = sdk[rootKey];
77
+ return typeof rootProperty === "object" && rootProperty !== null;
78
+ }).map((key) => {
79
+ const m = meta[key];
80
+ return {
81
+ name: key,
82
+ description: m.description,
83
+ type: m.type,
84
+ itemType: m.itemType,
85
+ returnType: m.returnType,
86
+ inputSchema: canonicalInputSchema(m.inputSchema),
87
+ inputParameters: m.inputParameters,
88
+ outputSchema: m.outputSchema,
89
+ categories: (m.categories ?? []).map(
90
+ (c) => typeof c === "string" ? c : c.key
91
+ ),
92
+ resolvers: m.resolvers,
93
+ formatter: m.formatter,
94
+ experimental: m.experimental,
95
+ packages: m.packages,
96
+ confirm: m.confirm ?? (m.type === "delete" ? "delete" : void 0),
97
+ deprecation: m.deprecation,
98
+ aliases: m.aliases,
99
+ supportsJsonOutput: m.supportsJsonOutput ?? true
100
+ };
101
+ }).sort((a, b) => a.name.localeCompare(b.name));
102
+ const filteredFunctions = packageFilter ? functions.filter((f) => !f.packages || f.packages.includes(packageFilter)) : functions;
103
+ const filteredCategories = knownCategories.slice().sort((a, b) => {
104
+ if (a === "other") return 1;
105
+ if (b === "other") return -1;
106
+ return definitionsByKey.get(a).title.localeCompare(definitionsByKey.get(b).title);
107
+ }).map((categoryKey) => {
108
+ const categoryFunctions = filteredFunctions.filter(
109
+ (f) => f.categories.includes(categoryKey) || categoryKey === "other" && !f.categories.some((c) => knownCategories.includes(c))
110
+ ).map((f) => f.name).sort();
111
+ const def = definitionsByKey.get(categoryKey);
112
+ return {
113
+ key: categoryKey,
114
+ title: def.title,
115
+ titlePlural: def.titlePlural,
116
+ functions: categoryFunctions
117
+ };
118
+ }).filter((category) => category.functions.length > 0);
119
+ return { functions: filteredFunctions, categories: filteredCategories };
77
120
  }
78
- var ZAPIER_MAX_CONCURRENT_REQUESTS = parseConcurrencyEnvVar("ZAPIER_MAX_CONCURRENT_REQUESTS") ?? 200;
79
- function getZapierApprovalMode() {
80
- const value = globalThis.process?.env?.ZAPIER_APPROVAL_MODE;
81
- if (value === "disabled" || value === "poll" || value === "throw")
82
- return value;
83
- return void 0;
121
+ function composeVoid(existing, added) {
122
+ if (!existing) return added;
123
+ if (!added) return existing;
124
+ return (ctx) => {
125
+ existing(ctx);
126
+ added(ctx);
127
+ };
84
128
  }
85
- function getZapierDefaultApprovalMode() {
86
- const isInteractive = !!globalThis.process?.stdin?.isTTY && !!globalThis.process?.stdout?.isTTY;
87
- return isInteractive ? "poll" : "throw";
129
+ function buildHooks(existing, added) {
130
+ const result = {};
131
+ const start = composeVoid(existing.onMethodStart, added.onMethodStart);
132
+ if (start) result.onMethodStart = start;
133
+ const end = composeVoid(existing.onMethodEnd, added.onMethodEnd);
134
+ if (end) result.onMethodEnd = end;
135
+ return result;
88
136
  }
89
- var DEFAULT_APPROVAL_TIMEOUT_MS = 10 * 60 * 1e3;
90
- var DEFAULT_MAX_APPROVAL_RETRIES = 2;
91
-
92
- // src/types/properties.ts
93
- var AppKeyPropertySchema = withPositional(
94
- z.string().min(1).describe("App key (e.g., 'SlackCLIAPI' or slug like 'github')")
95
- );
96
- var AppPropertySchema = withPositional(
97
- z.string().min(1).describe(
98
- "App slug (e.g., 'github'), implementation name (e.g., 'SlackCLIAPI'), or versioned ID (e.g., 'github@1.2.3')"
99
- )
100
- );
101
- var ActionTypePropertySchema = z.enum([
102
- "read",
103
- "read_bulk",
104
- "write",
105
- "run",
106
- "search",
107
- "search_or_write",
108
- "search_and_write",
109
- "filter"
110
- ]).describe("Action type that matches the action's defined type");
111
- var ActionKeyPropertySchema = z.string().min(1).describe("Action key to execute");
112
- var ActionPropertySchema = withPositional(
113
- z.string().min(1).describe("Action key (e.g., 'send_message' or 'find_row')")
114
- );
115
- var InputFieldPropertySchema = withPositional(
116
- z.string().min(1).describe("Input field key to get choices for")
117
- );
118
- var ConnectionIdPropertySchema = z.union([z.string(), z.number().int().positive()]).describe("Connection ID to use for this action");
119
- var AuthenticationIdPropertySchema = ConnectionIdPropertySchema.meta({
120
- deprecated: true
121
- });
122
- var ConnectionPropertySchema = z.union([z.string(), z.number().int().positive()]).describe(
123
- "Connection alias or connection ID (UUID or positive integer). Strings that match a key in the connections map are resolved against it; otherwise the value is used as a connection ID directly."
124
- );
125
- var InputsPropertySchema = z.record(z.string(), z.unknown()).describe("Input parameters for the action");
126
- var LimitPropertySchema = z.number().int().min(1).max(MAX_PAGE_LIMIT).default(50).describe("Maximum number of items to return");
127
- var OffsetPropertySchema = z.number().int().min(0).default(0).describe("Number of items to skip for pagination");
128
- var OutputPropertySchema = z.string().describe("Output file path");
129
- var DebugPropertySchema = z.boolean().default(false).describe("Enable debug logging");
130
- var ParamsPropertySchema = z.record(z.string(), z.unknown()).describe("Additional parameters");
131
- var ActionTimeoutMsPropertySchema = z.number().min(1e3).optional().describe(
132
- `Maximum time to wait for action completion in milliseconds (default: ${DEFAULT_ACTION_TIMEOUT_MS})`
133
- );
134
- var TablePropertySchema = withPositional(
135
- z.string().regex(/^[A-Z0-9]{26}$/, "Table ID must be a valid ULID").describe("The unique identifier of the table")
136
- );
137
- var RecordPropertySchema = withPositional(
138
- z.string().regex(/^[A-Z0-9]{26}$/, "Record ID must be a valid ULID").describe("The unique identifier of the record")
139
- );
140
- var RecordsPropertySchema = z.array(z.string().regex(/^[A-Z0-9]{26}$/, "Record ID must be a valid ULID")).min(1).max(100).describe("Record IDs to operate on");
141
- var FieldsPropertySchema = z.array(z.union([z.string(), z.number()])).describe(
142
- 'Fields to operate on. Accepts field names (e.g., "Email") or IDs (e.g., "f6", "6", or 6).'
143
- );
144
- var AppsPropertySchema = z.array(z.string()).describe("Filter by app keys (e.g., 'SlackCLIAPI' or slug like 'github')");
145
- var TablesPropertySchema = z.array(z.string()).describe("Filter by specific table IDs");
146
- var ConnectionsPropertySchema = z.array(z.string()).describe("List of connection IDs to filter by");
147
- var TriggerInboxPropertySchema = withPositional(
148
- z.string().min(1).describe(
149
- "Trigger inbox identifier \u2014 UUID or name. Non-UUID values are resolved by name via the inbox list endpoint."
150
- )
151
- );
152
- var TriggerInboxNamePropertySchema = z.string().min(1).max(100).describe(
153
- "Inbox name; unique per (user, account). Enables get-or-create on createTriggerInbox."
154
- );
155
- var LeasePropertySchema = z.string().min(1).describe("Lease ID returned from leaseTriggerInboxMessages");
156
- var LeaseSecondsPropertySchema = z.number().int().min(1).max(3600).describe(
157
- "Seconds until the lease expires; messages return to available if not acked. API default is 300 (5 minutes)."
158
- );
159
- var LeaseLimitPropertySchema = z.number().int().min(1).max(100).describe("Maximum messages to lease in a single batch (1-100)");
160
-
161
- // src/types/errors.ts
162
- var ZapierError = class extends Error {
137
+ function createDeprecationLogger(tag) {
138
+ const loggedDeprecations = /* @__PURE__ */ new Set();
139
+ return {
140
+ logDeprecation(message) {
141
+ if (loggedDeprecations.has(message)) return;
142
+ loggedDeprecations.add(message);
143
+ console.warn(`[${tag}] Deprecation: ${message}`);
144
+ },
145
+ resetDeprecationWarnings() {
146
+ loggedDeprecations.clear();
147
+ }
148
+ };
149
+ }
150
+ var { logDeprecation} = createDeprecationLogger("core");
151
+ var CORE_ERROR_SYMBOL = Symbol.for("kitcore.error");
152
+ var CoreErrorCode = {
153
+ Validation: "VALIDATION_ERROR",
154
+ Unknown: "UNKNOWN_ERROR"
155
+ };
156
+ var CoreError = class extends Error {
163
157
  constructor(message, options = {}) {
164
158
  super(message);
165
- this.statusCode = options.statusCode;
166
- this.errors = options.errors;
167
- this.cause = options.cause;
168
- this.response = options.response;
159
+ this.name = "CoreError";
160
+ if (options.statusCode !== void 0) this.statusCode = options.statusCode;
161
+ if (options.errors !== void 0) this.errors = options.errors;
162
+ if (options.cause !== void 0) this.cause = options.cause;
163
+ if (options.response !== void 0) this.response = options.response;
169
164
  Object.setPrototypeOf(this, new.target.prototype);
170
165
  }
171
166
  };
172
- var ZapierApiError = class extends ZapierError {
173
- constructor(message, options = {}) {
174
- super(message, options);
175
- this.name = "ZapierApiError";
176
- this.code = "ZAPIER_API_ERROR";
177
- }
178
- };
179
- var ZapierAppNotFoundError = class extends ZapierError {
180
- constructor(message, options = {}) {
181
- super(message, options);
182
- this.name = "ZapierAppNotFoundError";
183
- this.code = "ZAPIER_APP_NOT_FOUND_ERROR";
184
- this.appKey = options.appKey;
185
- }
186
- };
187
- var ZapierValidationError = class extends ZapierError {
188
- constructor(message, options = {}) {
189
- super(message, options);
190
- this.name = "ZapierValidationError";
191
- this.code = "ZAPIER_VALIDATION_ERROR";
192
- this.details = options.details;
193
- }
194
- };
195
- var ZapierUnknownError = class extends ZapierError {
196
- constructor(message, options = {}) {
197
- super(message, options);
198
- this.name = "ZapierUnknownError";
199
- this.code = "ZAPIER_UNKNOWN_ERROR";
200
- }
167
+ function createCoreError(options, adaptError) {
168
+ const error = adaptError?.(options) ?? new CoreError(options.message, { cause: options.cause });
169
+ Object.defineProperty(error, CORE_ERROR_SYMBOL, {
170
+ value: true,
171
+ enumerable: false,
172
+ configurable: true,
173
+ writable: false
174
+ });
175
+ Object.defineProperty(error, "coreCode", {
176
+ value: options.code,
177
+ enumerable: false,
178
+ configurable: true,
179
+ writable: false
180
+ });
181
+ return error;
182
+ }
183
+ function isCoreError(value) {
184
+ return Boolean(
185
+ value && typeof value === "object" && value[CORE_ERROR_SYMBOL] === true
186
+ );
187
+ }
188
+ function getCoreErrorCode(value) {
189
+ if (!isCoreError(value)) return void 0;
190
+ return value.coreCode;
191
+ }
192
+ function getCoreErrorCause(value) {
193
+ if (!isCoreError(value)) return void 0;
194
+ return value.cause;
195
+ }
196
+ var CURSOR_VERSION = 1;
197
+ var CURSOR_SOURCE = {
198
+ API: "api",
199
+ SDK: "sdk"
201
200
  };
202
- var ZapierAuthenticationError = class extends ZapierError {
203
- constructor(message, options = {}) {
204
- super(message, options);
205
- this.name = "ZapierAuthenticationError";
206
- this.code = "ZAPIER_AUTHENTICATION_ERROR";
207
- }
208
- };
209
- var ZapierNotFoundError = class extends ZapierError {
210
- constructor(message, options = {}) {
211
- super(message, options);
212
- this.name = "ZapierNotFoundError";
213
- this.code = "ZAPIER_NOT_FOUND_ERROR";
214
- }
215
- };
216
- var ZapierResourceNotFoundError = class extends ZapierNotFoundError {
217
- constructor(message, options = {}) {
218
- super(message, options);
219
- this.name = "ZapierResourceNotFoundError";
220
- this.code = "ZAPIER_RESOURCE_NOT_FOUND_ERROR";
221
- this.resourceType = options.resourceType;
222
- this.resourceId = options.resourceId;
223
- }
224
- };
225
- var ZapierConfigurationError = class extends ZapierError {
226
- constructor(message, options = {}) {
227
- super(message, options);
228
- this.name = "ZapierConfigurationError";
229
- this.code = "ZAPIER_CONFIGURATION_ERROR";
230
- this.configType = options.configType;
231
- }
232
- };
233
- var ZapierBundleError = class extends ZapierError {
234
- constructor(message, options = {}) {
235
- super(message, options);
236
- this.name = "ZapierBundleError";
237
- this.code = "ZAPIER_BUNDLE_ERROR";
238
- this.buildErrors = options.buildErrors;
239
- }
240
- };
241
- var ZapierTimeoutError = class extends ZapierError {
242
- constructor(message, options = {}) {
243
- super(message, options);
244
- this.name = "ZapierTimeoutError";
245
- this.code = "ZAPIER_TIMEOUT_ERROR";
246
- this.attempts = options.attempts;
247
- this.maxAttempts = options.maxAttempts;
248
- }
249
- };
250
- var ZapierActionError = class extends ZapierError {
251
- constructor(message, options = {}) {
252
- super(message, options);
253
- this.name = "ZapierActionError";
254
- this.code = "ZAPIER_ACTION_ERROR";
255
- this.appKey = options.appKey;
256
- this.actionKey = options.actionKey;
257
- }
258
- // Legacy accessor for backward compatibility
259
- get actionErrors() {
260
- return this.errors;
261
- }
262
- };
263
- var ZapierConflictError = class extends ZapierError {
264
- constructor(message, options = {}) {
265
- super(message, options);
266
- this.name = "ZapierConflictError";
267
- this.code = "ZAPIER_CONFLICT_ERROR";
268
- this.resourceType = options.resourceType;
269
- }
270
- };
271
- var ZapierRateLimitError = class extends ZapierError {
272
- constructor(message, options = {}) {
273
- super(message, options);
274
- this.name = "ZapierRateLimitError";
275
- this.code = "ZAPIER_RATE_LIMIT_ERROR";
276
- this.rateLimit = options.rateLimit ?? {};
277
- this.retries = options.retries ?? 0;
278
- }
279
- };
280
- var ZapierApprovalError = class extends ZapierError {
281
- constructor(message, options = {}) {
282
- super(message, options);
283
- this.name = "ZapierApprovalError";
284
- this.code = "ZAPIER_APPROVAL_ERROR";
285
- this.approvalId = options.approvalId;
286
- this.approvalStatus = options.status;
287
- this.approvalUrl = options.approvalUrl;
288
- this.pollUrl = options.pollUrl;
289
- }
290
- };
291
- var ZapierRelayError = class extends ZapierError {
292
- constructor(message, options = {}) {
293
- super(message, options);
294
- this.name = "ZapierRelayError";
295
- this.code = "ZAPIER_RELAY_ERROR";
296
- }
297
- };
298
- function formatErrorMessage(error) {
299
- let message = error.message;
300
- if (error.errors && error.errors.length > 0) {
301
- const additionalErrors = error.errors.slice(1);
302
- if (additionalErrors.length > 0) {
303
- const errorDetails = additionalErrors.map((err) => ` \u2022 ${err.detail || err.title || err.code}`).join("\n");
304
- message += "\n\nAdditional errors:\n" + errorDetails;
305
- }
306
- }
307
- if (error instanceof ZapierAppNotFoundError && error.appKey) {
308
- message += `
309
- App key: ${error.appKey}`;
310
- }
311
- if (error instanceof ZapierActionError && (error.appKey || error.actionKey)) {
312
- const context = [];
313
- if (error.appKey) context.push(`App: ${error.appKey}`);
314
- if (error.actionKey) context.push(`Action: ${error.actionKey}`);
315
- message += `
316
- ${context.join(", ")}`;
317
- }
318
- if (error instanceof ZapierResourceNotFoundError && (error.resourceType || error.resourceId)) {
319
- const context = [];
320
- if (error.resourceType) context.push(`Type: ${error.resourceType}`);
321
- if (error.resourceId) context.push(`ID: ${error.resourceId}`);
322
- message += `
323
- ${context.join(", ")}`;
324
- }
325
- if (error instanceof ZapierConflictError && error.resourceType) {
326
- message += `
327
- Type: ${error.resourceType}`;
328
- }
329
- if (error instanceof ZapierTimeoutError && (error.attempts || error.maxAttempts)) {
330
- const context = [];
331
- if (error.attempts) context.push(`Attempts: ${error.attempts}`);
332
- if (error.maxAttempts) context.push(`Max attempts: ${error.maxAttempts}`);
333
- message += `
334
- ${context.join(", ")}`;
335
- }
336
- if (error instanceof ZapierBundleError && error.buildErrors && error.buildErrors.length > 0) {
337
- message += "\n\nBuild errors:\n" + error.buildErrors.map((err) => ` \u2022 ${err}`).join("\n");
338
- }
339
- if (error instanceof ZapierApprovalError && error.approvalUrl) {
340
- message += `
341
- Approval URL: ${error.approvalUrl}`;
201
+ function encodeBase64(str) {
202
+ return btoa(
203
+ Array.from(
204
+ new TextEncoder().encode(str),
205
+ (b) => String.fromCharCode(b)
206
+ ).join("")
207
+ );
208
+ }
209
+ function decodeBase64(str) {
210
+ return new TextDecoder().decode(
211
+ Uint8Array.from(atob(str), (c) => c.charCodeAt(0))
212
+ );
213
+ }
214
+ function encodeApiCursor(cursor) {
215
+ const envelope = {
216
+ v: CURSOR_VERSION,
217
+ source: CURSOR_SOURCE.API,
218
+ cursor
219
+ };
220
+ return encodeBase64(JSON.stringify(envelope));
221
+ }
222
+ function encodeSdkCursor(offset, cursor) {
223
+ const envelope = {
224
+ v: CURSOR_VERSION,
225
+ source: CURSOR_SOURCE.SDK,
226
+ cursor,
227
+ offset
228
+ };
229
+ return encodeBase64(JSON.stringify(envelope));
230
+ }
231
+ function decodeIncomingCursor(incoming) {
232
+ if (!incoming) {
233
+ return { offset: 0, cursor: void 0 };
342
234
  }
343
- if (error instanceof ZapierRateLimitError) {
344
- const { limit, remaining, retryAfterMs } = error.rateLimit;
345
- const parts = [];
346
- if (limit !== void 0) {
347
- const used = remaining !== void 0 ? limit - remaining : limit;
348
- parts.push(`${used}/${limit} used`);
349
- }
350
- if (retryAfterMs !== void 0 && retryAfterMs > 0) {
351
- parts.push(`retry in ${formatDuration(retryAfterMs)}`);
235
+ try {
236
+ const decoded = decodeBase64(incoming);
237
+ const envelope = JSON.parse(decoded);
238
+ if (envelope.v !== CURSOR_VERSION) {
239
+ return { offset: 0, cursor: incoming };
352
240
  }
353
- if (error.retries > 0) {
354
- parts.push(
355
- `after ${error.retries} retr${error.retries === 1 ? "y" : "ies"}`
356
- );
241
+ if (envelope.source === CURSOR_SOURCE.SDK) {
242
+ return { offset: envelope.offset ?? 0, cursor: envelope.cursor };
357
243
  }
358
- if (parts.length > 0) {
359
- message += `
360
- ${parts.join(", ")}`;
244
+ if (envelope.source === CURSOR_SOURCE.API) {
245
+ return { offset: 0, cursor: envelope.cursor };
361
246
  }
247
+ return { offset: 0, cursor: incoming };
248
+ } catch {
249
+ return { offset: 0, cursor: incoming };
362
250
  }
363
- if (error.statusCode && !message.includes(`${error.statusCode}`)) {
364
- message += `
365
- HTTP Status: ${error.statusCode}`;
366
- }
367
- return message;
368
251
  }
369
- function formatDuration(ms) {
370
- const seconds = Math.round(ms / 1e3);
371
- if (seconds < 60) return `${seconds}s`;
372
- const minutes = Math.round(seconds / 60);
373
- if (minutes < 60) return `${minutes}m`;
374
- const hours = Math.round(minutes / 60);
375
- if (hours < 24) return `${hours}h`;
376
- const days = Math.round(hours / 24);
377
- return `${days}d`;
378
- }
379
-
380
- // src/types/signals.ts
381
- var ZapierSignal = class extends Error {
382
- constructor(message) {
383
- super(message);
384
- Object.setPrototypeOf(this, new.target.prototype);
385
- }
386
- };
387
- var ZapierReleaseTriggerMessageSignal = class extends ZapierSignal {
388
- constructor() {
389
- super(...arguments);
390
- this.name = "ZapierReleaseTriggerMessageSignal";
391
- this.code = "ZAPIER_RELEASE_TRIGGER_MESSAGE_SIGNAL";
392
- }
393
- };
394
- var ZapierAbortDrainSignal = class extends ZapierSignal {
395
- constructor() {
396
- super(...arguments);
397
- this.name = "ZapierAbortDrainSignal";
398
- this.code = "ZAPIER_ABORT_DRAIN_SIGNAL";
399
- }
400
- };
401
- var TriggerInboxCommandBaseSchema = z.object({
402
- inbox: TriggerInboxPropertySchema,
403
- onMessage: z.function().optional().meta({ exampleRequired: true }).describe(
404
- "Per-message handler. Resolves to ack; rejects to release-or-leave per `releaseOnError`. Throw `ZapierReleaseTriggerMessageSignal` to release explicitly, or `ZapierAbortDrainSignal` to stop after the current batch."
405
- ),
406
- concurrency: z.number().int().min(1).optional().describe(
407
- "Per-message handler workers running in parallel. Defaults to `leaseLimit`, or 1 if neither is set."
408
- ),
409
- leaseLimit: z.number().int().min(1).max(100).optional().describe(
410
- "Per-lease HTTP batch size. Defaults to `concurrency`, or 1 if neither is set."
411
- ),
412
- leaseSeconds: LeaseSecondsPropertySchema.optional(),
413
- releaseOnError: z.boolean().optional().describe(
414
- "If true, errors release the message when the drain finishes. If false (default), errors leave it leased until the lease timeout. `ZapierReleaseTriggerMessageSignal` always releases regardless."
415
- ),
416
- continueOnError: z.boolean().optional().describe(
417
- "If false (default, fail-fast), the first handler error rejects and stops the drain. If true, handler errors are observed via `onError` and the drain continues. SDK-level errors (lease / ack / release) reject regardless."
418
- ),
419
- onError: z.function().optional().describe(
420
- "Per-message error observer for `continueOnError: true`. Called with the failure and the message; control-flow signals are filtered out. Throws from `onError` are swallowed."
421
- ),
422
- signal: z.custom((v) => v instanceof AbortSignal).optional().describe(
423
- "Abort signal. Aborting cancels in-flight HTTP, releases unprocessed messages, and resolves cleanly. Errors during shutdown still reject."
424
- )
425
- });
426
- TriggerInboxCommandBaseSchema.extend({
427
- maxMessages: z.number().int().min(1).optional().describe(
428
- "Cap total messages drained. Defaults to draining the inbox until empty."
429
- )
430
- }).describe(
431
- "Drain an existing trigger inbox: lease currently-available messages and process them via onMessage. Returns when the inbox is empty, maxMessages is reached, the abort signal fires, or a fatal error rejects."
432
- );
433
- TriggerInboxCommandBaseSchema.extend({
434
- maxDrainIntervalSeconds: z.number().int().min(1).optional().describe(
435
- "Maximum seconds between empty-inbox poll attempts (default: 60). Caps the back-off cadence."
436
- )
437
- }).describe(
438
- "Continuously consume a trigger inbox: drain currently-available messages, then poll with backoff for new arrivals, until aborted. Stop via the `signal` AbortSignal or by throwing `ZapierAbortDrainSignal` from a handler. Resolves cleanly on abort; rejects on a fatal error or a fail-fast handler error."
439
- );
440
- var ActionExecutionInputSchema = z.object({
441
- inputs: z.record(z.string(), z.unknown()).optional(),
442
- /** @deprecated Use `connection` instead. */
443
- connectionId: ConnectionIdPropertySchema.optional().meta({
444
- deprecated: true
445
- }),
446
- connection: ConnectionPropertySchema.optional(),
447
- /** @deprecated Use connection instead */
448
- authenticationId: AuthenticationIdPropertySchema.optional().meta({
449
- deprecated: true
450
- }),
451
- timeoutMs: ActionTimeoutMsPropertySchema
452
- }).describe(
453
- "Execute an action with the given inputs for the bound app, as an alternative to runAction"
454
- ).meta({
455
- aliases: { connectionId: "connection", authenticationId: "connection" }
456
- });
457
- var AppFactoryInputSchema = z.object({
458
- /** @deprecated Use `connection` instead. */
459
- connectionId: ConnectionIdPropertySchema.optional().meta({
460
- deprecated: true
461
- }),
462
- connection: ConnectionPropertySchema.optional(),
463
- /** @deprecated Use connection instead */
464
- authenticationId: AuthenticationIdPropertySchema.optional().meta({
465
- deprecated: true
466
- })
467
- }).describe("Bind a connection alias or numeric connectionId to an app").meta({
468
- aliases: { connectionId: "connection", authenticationId: "connection" }
469
- });
470
-
471
- // src/utils/pagination-utils.ts
472
- var CURSOR_VERSION = 1;
473
- var CURSOR_SOURCE = {
474
- API: "api",
475
- SDK: "sdk"
476
- };
477
- function encodeBase64(str) {
478
- return btoa(
479
- Array.from(
480
- new TextEncoder().encode(str),
481
- (b) => String.fromCharCode(b)
482
- ).join("")
483
- );
484
- }
485
- function decodeBase64(str) {
486
- return new TextDecoder().decode(
487
- Uint8Array.from(atob(str), (c) => c.charCodeAt(0))
488
- );
489
- }
490
- function encodeApiCursor(cursor) {
491
- const envelope = {
492
- v: CURSOR_VERSION,
493
- source: CURSOR_SOURCE.API,
494
- cursor
495
- };
496
- return encodeBase64(JSON.stringify(envelope));
497
- }
498
- function encodeSdkCursor(offset, cursor) {
499
- const envelope = {
500
- v: CURSOR_VERSION,
501
- source: CURSOR_SOURCE.SDK,
502
- cursor,
503
- offset
504
- };
505
- return encodeBase64(JSON.stringify(envelope));
506
- }
507
- function decodeIncomingCursor(incoming) {
508
- if (!incoming) {
509
- return { offset: 0, cursor: void 0 };
510
- }
511
- try {
512
- const decoded = decodeBase64(incoming);
513
- const envelope = JSON.parse(decoded);
514
- if (envelope.v !== CURSOR_VERSION) {
515
- return { offset: 0, cursor: incoming };
516
- }
517
- if (envelope.source === CURSOR_SOURCE.SDK) {
518
- return { offset: envelope.offset ?? 0, cursor: envelope.cursor };
519
- }
520
- if (envelope.source === CURSOR_SOURCE.API) {
521
- return { offset: 0, cursor: envelope.cursor };
522
- }
523
- return { offset: 0, cursor: incoming };
524
- } catch {
525
- return { offset: 0, cursor: incoming };
526
- }
527
- }
528
- async function* paginateMaxItemsWithUnencodedCursor(pageFunction, pageOptions) {
529
- let cursor = pageOptions?.cursor;
530
- let totalItemsYielded = 0;
531
- const maxItems = pageOptions?.maxItems;
532
- const pageSize = pageOptions?.pageSize;
533
- do {
534
- const options = {
535
- ...pageOptions || {},
536
- cursor,
537
- pageSize: maxItems !== void 0 && pageSize !== void 0 ? Math.min(pageSize, maxItems) : pageSize
538
- };
539
- const page = await pageFunction(options);
540
- if (maxItems !== void 0) {
541
- const remainingItems = maxItems - totalItemsYielded;
542
- if (page.data.length >= remainingItems) {
543
- yield {
544
- ...page,
545
- data: page.data.slice(0, remainingItems),
546
- nextCursor: void 0
547
- };
548
- break;
549
- }
550
- }
551
- yield page;
552
- totalItemsYielded += page.data.length;
553
- cursor = page.nextCursor;
554
- } while (cursor);
252
+ async function* paginateMaxItemsWithUnencodedCursor(pageFunction, pageOptions) {
253
+ let cursor = pageOptions?.cursor;
254
+ let totalItemsYielded = 0;
255
+ const maxItems = pageOptions?.maxItems;
256
+ const pageSize = pageOptions?.pageSize;
257
+ do {
258
+ const options = {
259
+ ...pageOptions || {},
260
+ cursor,
261
+ pageSize: maxItems !== void 0 && pageSize !== void 0 ? Math.min(pageSize, maxItems) : pageSize
262
+ };
263
+ const page = await pageFunction(options);
264
+ if (maxItems !== void 0) {
265
+ const remainingItems = maxItems - totalItemsYielded;
266
+ if (page.data.length >= remainingItems) {
267
+ yield {
268
+ ...page,
269
+ data: page.data.slice(0, remainingItems),
270
+ nextCursor: void 0
271
+ };
272
+ break;
273
+ }
274
+ }
275
+ yield page;
276
+ totalItemsYielded += page.data.length;
277
+ cursor = page.nextCursor;
278
+ } while (cursor);
555
279
  }
556
280
  async function* paginateBuffered(pageFunction, pageOptions) {
557
281
  const pageSize = pageOptions?.pageSize;
@@ -721,438 +445,1025 @@ function concatPaginated({
721
445
  function toIterable(source) {
722
446
  return { [Symbol.asyncIterator]: () => source[Symbol.asyncIterator]() };
723
447
  }
724
-
725
- // src/utils/validation.ts
726
- var validate = (schema, input) => {
448
+ var parseOrThrow = (schema, input, { adaptError } = {}) => {
727
449
  const result = schema.safeParse(input);
728
450
  if (!result.success) {
729
- const errorMessages = result.error.issues.map((error) => {
730
- const path = error.path.length > 0 ? error.path.join(".") : "input";
731
- return `${path}: ${error.message}`;
451
+ const errorMessages = result.error.issues.map((issue) => {
452
+ const path = issue.path.length > 0 ? issue.path.join(".") : "input";
453
+ return `${path}: ${issue.message}`;
732
454
  });
733
- const message = `Validation failed:
734
- ${errorMessages.join("\n ")}`;
735
- throw new ZapierValidationError(message, {
736
- details: {
737
- zodErrors: result.error.issues,
738
- input
455
+ throw createCoreError(
456
+ {
457
+ code: CoreErrorCode.Validation,
458
+ message: `Validation failed:
459
+ ${errorMessages.join("\n ")}`,
460
+ details: {
461
+ zodErrors: result.error.issues,
462
+ input
463
+ }
464
+ },
465
+ adaptError
466
+ );
467
+ }
468
+ return result.data;
469
+ };
470
+ function createValidator(schema, { adaptError } = {}) {
471
+ return function validateFn(input) {
472
+ return parseOrThrow(schema, input, { adaptError });
473
+ };
474
+ }
475
+ var validateOptions = (schema, options, { adaptError } = {}) => parseOrThrow(schema, options, { adaptError });
476
+ var scopeStore = null;
477
+ try {
478
+ scopeStore = new AsyncLocalStorage();
479
+ } catch {
480
+ }
481
+ function getCurrentScope() {
482
+ if (!scopeStore) return void 0;
483
+ return scopeStore.getStore();
484
+ }
485
+ function getCurrentDepth() {
486
+ return getCurrentScope()?.depth ?? 0;
487
+ }
488
+ function runInMethodScope(fn) {
489
+ if (!scopeStore) return fn();
490
+ const currentDepth = scopeStore.getStore()?.depth ?? -1;
491
+ return scopeStore.run({ depth: currentDepth + 1 }, fn);
492
+ }
493
+ var runWithTelemetryContext = runInMethodScope;
494
+ function normalizeError(error, adaptError) {
495
+ if (error instanceof Error) return error;
496
+ const message = typeof error === "object" && error !== null && "message" in error && typeof error.message === "string" ? error.message : String(error);
497
+ return createCoreError(
498
+ {
499
+ code: CoreErrorCode.Unknown,
500
+ message,
501
+ cause: error
502
+ },
503
+ adaptError
504
+ );
505
+ }
506
+ function createFunction(coreFn, options) {
507
+ const { sdk, schema } = options;
508
+ const functionName = coreFn.name;
509
+ const namedFunctions = {
510
+ [functionName]: async function(callOptions) {
511
+ return runInMethodScope(async () => {
512
+ const startTime = Date.now();
513
+ const normalizedOptions = callOptions ?? {};
514
+ const args = [normalizedOptions];
515
+ const depth = getCurrentDepth();
516
+ const hooks = sdk.context.hooks;
517
+ const adaptError = sdk.context.core?.adaptError;
518
+ hooks?.onMethodStart?.({
519
+ methodName: functionName,
520
+ args,
521
+ isPaginated: false,
522
+ depth
523
+ });
524
+ try {
525
+ let result;
526
+ if (schema) {
527
+ const validatedOptions = validateOptions(
528
+ schema,
529
+ normalizedOptions,
530
+ {
531
+ adaptError
532
+ }
533
+ );
534
+ result = await coreFn({
535
+ ...normalizedOptions,
536
+ ...validatedOptions
537
+ });
538
+ } else {
539
+ result = await coreFn(normalizedOptions);
540
+ }
541
+ hooks?.onMethodEnd?.({
542
+ methodName: functionName,
543
+ args,
544
+ isPaginated: false,
545
+ depth,
546
+ durationMs: Date.now() - startTime
547
+ });
548
+ return result;
549
+ } catch (error) {
550
+ const normalizedError = normalizeError(error, adaptError);
551
+ hooks?.onMethodEnd?.({
552
+ methodName: functionName,
553
+ args,
554
+ isPaginated: false,
555
+ depth,
556
+ durationMs: Date.now() - startTime,
557
+ error: normalizedError
558
+ });
559
+ throw normalizedError;
560
+ }
561
+ });
562
+ }
563
+ };
564
+ return namedFunctions[functionName];
565
+ }
566
+ function isSdkPage(value) {
567
+ if (typeof value !== "object" || value === null) return false;
568
+ const page = value;
569
+ if (!Array.isArray(page.data)) return false;
570
+ if (page.nextCursor !== void 0 && typeof page.nextCursor !== "string") {
571
+ return false;
572
+ }
573
+ return Object.keys(page).every((k) => k === "data" || k === "nextCursor");
574
+ }
575
+ function createPageFunction(coreFn, {
576
+ sdk,
577
+ adaptPage
578
+ }) {
579
+ const functionName = coreFn.name + "Page";
580
+ const namedFunctions = {
581
+ [functionName]: async function(options) {
582
+ try {
583
+ const response = await coreFn(options);
584
+ const page = adaptPage ? adaptPage(response) : response;
585
+ if (!isSdkPage(page)) {
586
+ throw new Error(
587
+ `${functionName}: paginated result must be exactly { data: TItem[], nextCursor? } (produced by the handler or its \`adaptPage\`); got keys [${page && typeof page === "object" ? Object.keys(page).join(", ") : typeof page}]. If the handler returns a raw shape, set \`adaptPage\` to translate it; if \`adaptPage\` already runs, it must return only \`data\`/\`nextCursor\`.`
588
+ );
589
+ }
590
+ return page;
591
+ } catch (error) {
592
+ throw normalizeError(
593
+ error,
594
+ sdk.context.core?.adaptError
595
+ );
739
596
  }
740
- });
597
+ }
598
+ };
599
+ return namedFunctions[functionName];
600
+ }
601
+ function createPaginatedFunction(coreFn, options) {
602
+ const { sdk, schema, name, defaultPageSize, adaptPage } = options;
603
+ const pageFunction = createPageFunction(coreFn, { sdk, adaptPage });
604
+ const functionName = name || coreFn.name;
605
+ const namedFunctions = {
606
+ [functionName]: function(callOptions) {
607
+ return runInMethodScope(() => {
608
+ const startTime = Date.now();
609
+ const normalizedOptions = callOptions ?? {};
610
+ const args = [normalizedOptions];
611
+ const depth = getCurrentDepth();
612
+ const hooks = sdk.context.hooks;
613
+ const adaptError = sdk.context.core?.adaptError;
614
+ hooks?.onMethodStart?.({
615
+ methodName: functionName,
616
+ args,
617
+ isPaginated: true,
618
+ depth
619
+ });
620
+ const validatedOptions = {
621
+ ...normalizedOptions,
622
+ ...schema ? createValidator(schema, { adaptError })(normalizedOptions) : normalizedOptions
623
+ };
624
+ const pageSize = validatedOptions.pageSize ?? defaultPageSize;
625
+ const optimizedOptions = {
626
+ ...validatedOptions,
627
+ pageSize
628
+ };
629
+ const iterator = paginate(pageFunction, optimizedOptions);
630
+ const firstPagePromise = iterator.next().then((result) => {
631
+ if (result.done) {
632
+ throw new Error("Paginate should always iterate at least once");
633
+ }
634
+ return result.value;
635
+ });
636
+ if (hooks?.onMethodEnd) {
637
+ firstPagePromise.then(() => {
638
+ hooks.onMethodEnd({
639
+ methodName: functionName,
640
+ args,
641
+ isPaginated: true,
642
+ depth,
643
+ durationMs: Date.now() - startTime
644
+ });
645
+ }).catch((error) => {
646
+ hooks.onMethodEnd({
647
+ methodName: functionName,
648
+ args,
649
+ isPaginated: true,
650
+ depth,
651
+ durationMs: Date.now() - startTime,
652
+ error: error instanceof Error ? error : new Error(String(error))
653
+ });
654
+ });
655
+ }
656
+ return Object.assign(firstPagePromise, {
657
+ [Symbol.asyncIterator]: async function* () {
658
+ yield await firstPagePromise;
659
+ for await (const page of iterator) {
660
+ yield page;
661
+ }
662
+ },
663
+ items: function() {
664
+ return {
665
+ [Symbol.asyncIterator]: async function* () {
666
+ const firstPage = await firstPagePromise;
667
+ for (const item of firstPage.data) {
668
+ yield item;
669
+ }
670
+ for await (const page of iterator) {
671
+ for (const item of page.data) {
672
+ yield item;
673
+ }
674
+ }
675
+ }
676
+ };
677
+ }
678
+ });
679
+ });
680
+ }
681
+ };
682
+ return namedFunctions[functionName];
683
+ }
684
+ function definePlugin(fn) {
685
+ return fn;
686
+ }
687
+ function createPluginMethod(sdk, config) {
688
+ const { name, inputSchema, handler, ...metaFields } = config;
689
+ const namedHandlers = {
690
+ [name]: async function(options) {
691
+ return handler({ sdk, options });
692
+ }
693
+ };
694
+ const wrappedFn = createFunction(namedHandlers[name], {
695
+ sdk,
696
+ schema: inputSchema
697
+ });
698
+ return {
699
+ [name]: wrappedFn,
700
+ context: {
701
+ meta: {
702
+ [name]: {
703
+ ...metaFields,
704
+ ...inputSchema ? { inputSchema } : {}
705
+ }
706
+ }
707
+ }
708
+ };
709
+ }
710
+ function createPaginatedPluginMethod(sdk, config) {
711
+ const {
712
+ name,
713
+ inputSchema,
714
+ handler,
715
+ adaptPage,
716
+ defaultPageSize,
717
+ ...metaFields
718
+ } = config;
719
+ const namedHandlers = {
720
+ [name]: function(options) {
721
+ return handler({ sdk, options });
722
+ }
723
+ };
724
+ const wrappedFn = createPaginatedFunction(namedHandlers[name], {
725
+ sdk,
726
+ schema: inputSchema,
727
+ name,
728
+ defaultPageSize,
729
+ adaptPage
730
+ });
731
+ return {
732
+ [name]: wrappedFn,
733
+ context: {
734
+ meta: {
735
+ [name]: {
736
+ ...metaFields,
737
+ ...inputSchema ? { inputSchema } : {}
738
+ }
739
+ }
740
+ }
741
+ };
742
+ }
743
+ function splitPluginContribution(result) {
744
+ const { context, ...rootKeys } = result;
745
+ const { meta, hooks, ...contextRest } = context ?? {};
746
+ return {
747
+ rootKeys,
748
+ meta: meta ?? {},
749
+ hooks: hooks ?? {},
750
+ contextRest
751
+ };
752
+ }
753
+ var RESERVED_ROOT_KEYS = /* @__PURE__ */ new Set([
754
+ "context",
755
+ "getRegistry",
756
+ "addPlugin"
757
+ ]);
758
+ function hasOwn(obj, key) {
759
+ return Object.prototype.hasOwnProperty.call(obj, key);
760
+ }
761
+ function setOwn(target, key, value) {
762
+ Object.defineProperty(target, key, {
763
+ value,
764
+ enumerable: true,
765
+ configurable: true,
766
+ writable: true
767
+ });
768
+ }
769
+ function checkCollisions(target, source, kind, callerLabel, override) {
770
+ for (const key of Object.keys(source)) {
771
+ if (kind === "root key" && RESERVED_ROOT_KEYS.has(key)) {
772
+ throw new Error(
773
+ `${callerLabel}: plugin attempted to register reserved root key "${key}". The SDK uses this key for its own accessor; rename the plugin's method.`
774
+ );
775
+ }
776
+ if (!override && hasOwn(target, key)) {
777
+ throw new Error(
778
+ `${callerLabel}: duplicate ${kind} "${key}". If the override is intentional, pass { override: true } in the options.`
779
+ );
780
+ }
781
+ }
782
+ }
783
+ function applyOwnProperties(target, source) {
784
+ for (const key of Object.keys(source)) {
785
+ setOwn(target, key, source[key]);
786
+ }
787
+ }
788
+ function createPluginAccumulator(initialProperties = {}, initialContext = {}) {
789
+ const initialMeta = initialContext.meta ?? {};
790
+ const initialHooks = initialContext.hooks ?? {};
791
+ const context = {
792
+ ...initialContext,
793
+ meta: { ...initialMeta },
794
+ hooks: { ...initialHooks }
795
+ };
796
+ const view = { ...initialProperties, context };
797
+ return { view, context };
798
+ }
799
+ function mergeContribution(propertiesTarget, contextTarget, contribution, options) {
800
+ checkCollisions(
801
+ propertiesTarget,
802
+ contribution.rootKeys,
803
+ "root key",
804
+ options.callerLabel,
805
+ options.override
806
+ );
807
+ checkCollisions(
808
+ contextTarget.meta,
809
+ contribution.meta,
810
+ "context.meta key",
811
+ options.callerLabel,
812
+ options.override
813
+ );
814
+ checkCollisions(
815
+ contextTarget,
816
+ contribution.contextRest,
817
+ "context key",
818
+ options.callerLabel,
819
+ options.override
820
+ );
821
+ applyOwnProperties(propertiesTarget, contribution.rootKeys);
822
+ applyOwnProperties(contextTarget.meta, contribution.meta);
823
+ applyOwnProperties(contextTarget, contribution.contextRest);
824
+ contextTarget.hooks = buildHooks(contextTarget.hooks, contribution.hooks);
825
+ }
826
+ function applyPluginContribution(acc, contribution, options) {
827
+ mergeContribution(acc.view, acc.context, contribution, options);
828
+ }
829
+ function wrapAsSdk(properties, context, opts) {
830
+ const sdk = {
831
+ ...properties,
832
+ context,
833
+ getRegistry(qopts) {
834
+ return buildRegistry({
835
+ sdk,
836
+ meta: context.meta,
837
+ packageFilter: qopts?.package
838
+ });
839
+ }
840
+ };
841
+ if (opts?.addPlugin !== void 0) {
842
+ sdk.addPlugin = opts.addPlugin;
843
+ }
844
+ return sdk;
845
+ }
846
+ function wrapAccumulatorAsSdk(acc) {
847
+ const { context: _ctx, ...rootKeys } = acc.view;
848
+ return wrapAsSdk(
849
+ rootKeys,
850
+ acc.context
851
+ );
852
+ }
853
+ function applyPluginToSdk(sdk, plugin, options) {
854
+ const context = sdk.context;
855
+ const contribution = splitPluginContribution(
856
+ plugin(sdk)
857
+ );
858
+ mergeContribution(sdk, context, contribution, {
859
+ callerLabel: "addPlugin",
860
+ override: options.override === true
861
+ });
862
+ }
863
+ function buildStackAccumulator(head, callerLabel) {
864
+ const ordered = [];
865
+ let node = head;
866
+ while (node) {
867
+ ordered.unshift(node);
868
+ node = node.prev;
869
+ }
870
+ const acc = createPluginAccumulator();
871
+ for (const { plugin, override } of ordered) {
872
+ const contribution = splitPluginContribution(
873
+ plugin(acc.view)
874
+ );
875
+ applyPluginContribution(acc, contribution, { callerLabel, override });
876
+ }
877
+ return acc;
878
+ }
879
+ function addPlugin(sdk, plugin, options) {
880
+ applyPluginToSdk(
881
+ sdk,
882
+ plugin,
883
+ options ?? {}
884
+ );
885
+ }
886
+ function buildSdk(properties, context) {
887
+ const addPlugin2 = (plugin, options) => {
888
+ logDeprecation(
889
+ "sdk.addPlugin(plugin) (the chain-style extension) is deprecated. Build the SDK in one pass with createPluginStack().use(...).toSdk() instead \u2014 each .toSdk() produces fresh plugin closures and avoids the closure-sharing semantics that caused this to be deprecated."
890
+ );
891
+ const contribution = splitPluginContribution(
892
+ plugin({ ...properties, context })
893
+ );
894
+ const mergedProperties = { ...properties };
895
+ const mergedContext = {
896
+ ...context,
897
+ meta: { ...context.meta },
898
+ hooks: { ...context.hooks }
899
+ };
900
+ mergeContribution(mergedProperties, mergedContext, contribution, {
901
+ callerLabel: "addPlugin",
902
+ override: options?.override === true
903
+ });
904
+ return buildSdk(
905
+ mergedProperties,
906
+ mergedContext
907
+ );
908
+ };
909
+ return wrapAsSdk(properties, context, { addPlugin: addPlugin2 });
910
+ }
911
+ function withDeprecatedAddPlugin(sdk) {
912
+ const initialProperties = {};
913
+ for (const key of Object.keys(sdk)) {
914
+ if (key === "context" || key === "getRegistry" || key === "addPlugin") {
915
+ continue;
916
+ }
917
+ initialProperties[key] = sdk[key];
918
+ }
919
+ const initialContext = sdk.context;
920
+ return buildSdk(
921
+ initialProperties,
922
+ initialContext
923
+ );
924
+ }
925
+ function composePlugins(...plugins) {
926
+ logDeprecation(
927
+ "composePlugins(...) is deprecated. Use createPluginStack().use(a).use(b).use(c).toPlugin() instead. The stack carries the same collision-detection and hook-composition behavior, supports per-step { override: true } for intentional duplicates, and progressively narrows types so dependency mistakes surface at the specific .use call."
928
+ );
929
+ let stack = buildPluginStack(
930
+ null,
931
+ "composePlugins"
932
+ );
933
+ for (const plugin of plugins) {
934
+ stack = stack.use(plugin);
935
+ }
936
+ return stack.toPlugin();
937
+ }
938
+ function createPluginStack() {
939
+ return buildPluginStack(null, "createPluginStack");
940
+ }
941
+ function buildPluginStack(head, callerLabel) {
942
+ return {
943
+ use(plugin, options) {
944
+ const next = {
945
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
946
+ plugin,
947
+ override: options?.override === true,
948
+ prev: head
949
+ };
950
+ return buildPluginStack(next, callerLabel);
951
+ },
952
+ toPlugin() {
953
+ const ordered = [];
954
+ let node = head;
955
+ while (node) {
956
+ ordered.unshift(node);
957
+ node = node.prev;
958
+ }
959
+ return (outerSdk) => {
960
+ const { context: outerContext, ...outerProperties } = outerSdk ?? {};
961
+ const viewAcc = createPluginAccumulator(outerProperties, outerContext);
962
+ const contribsAcc = createPluginAccumulator();
963
+ for (const { plugin: subPlugin, override } of ordered) {
964
+ const contribution = splitPluginContribution(
965
+ subPlugin(viewAcc.view)
966
+ );
967
+ applyPluginContribution(viewAcc, contribution, {
968
+ callerLabel,
969
+ override
970
+ });
971
+ applyPluginContribution(contribsAcc, contribution, {
972
+ callerLabel,
973
+ override
974
+ });
975
+ }
976
+ const { context: _ignored, ...contributedRoot } = contribsAcc.view;
977
+ return {
978
+ ...contributedRoot,
979
+ context: contribsAcc.context
980
+ };
981
+ };
982
+ },
983
+ toSdk() {
984
+ return wrapAccumulatorAsSdk(
985
+ buildStackAccumulator(head, callerLabel)
986
+ );
987
+ }
988
+ };
989
+ }
990
+ function createCorePlugin(options) {
991
+ return () => ({
992
+ context: {
993
+ core: options
994
+ }
995
+ });
996
+ }
997
+ function withPositional(schema) {
998
+ Object.assign(schema._zod.def, {
999
+ positionalMeta: { positional: true }
1000
+ });
1001
+ return schema;
1002
+ }
1003
+ function schemaHasPositionalMeta(schema) {
1004
+ return "positionalMeta" in schema._zod.def;
1005
+ }
1006
+ function isPositional(schema) {
1007
+ if (schemaHasPositionalMeta(schema) && schema._zod.def.positionalMeta?.positional) {
1008
+ return true;
1009
+ }
1010
+ if (schema instanceof z.ZodOptional) {
1011
+ return isPositional(schema._zod.def.innerType);
1012
+ }
1013
+ if (schema instanceof z.ZodDefault) {
1014
+ return isPositional(schema._zod.def.innerType);
1015
+ }
1016
+ return false;
1017
+ }
1018
+
1019
+ // src/constants.ts
1020
+ var ZAPIER_BASE_URL = globalThis.process?.env?.ZAPIER_BASE_URL || "https://zapier.com";
1021
+ function getZapierSdkService() {
1022
+ return globalThis.process?.env?.ZAPIER_SDK_SERVICE;
1023
+ }
1024
+ var MAX_PAGE_LIMIT = 1e4;
1025
+ var DEFAULT_PAGE_SIZE = 100;
1026
+ var DEFAULT_ACTION_TIMEOUT_MS = 18e4;
1027
+ function parseIntEnvVar(name) {
1028
+ const value = globalThis.process?.env?.[name];
1029
+ if (value === void 0) return void 0;
1030
+ const parsed = parseInt(value, 10);
1031
+ if (isNaN(parsed)) {
1032
+ console.warn(
1033
+ `[zapier-sdk] Invalid value for ${name}: "${value}" (expected integer)`
1034
+ );
1035
+ return void 0;
1036
+ }
1037
+ return parsed;
1038
+ }
1039
+ var ZAPIER_MAX_NETWORK_RETRIES = parseIntEnvVar("ZAPIER_MAX_NETWORK_RETRIES") ?? 3;
1040
+ var ZAPIER_MAX_NETWORK_RETRY_DELAY_MS = parseIntEnvVar("ZAPIER_MAX_NETWORK_RETRY_DELAY_MS") ?? 6e4;
1041
+ var MAX_CONCURRENCY_LIMIT = 1e4;
1042
+ function parseConcurrencyEnvVar(name) {
1043
+ const value = globalThis.process?.env?.[name];
1044
+ if (!value) return void 0;
1045
+ if (value === "Infinity") return Infinity;
1046
+ if (/^[1-9]\d*$/.test(value)) {
1047
+ const parsed = parseInt(value, 10);
1048
+ if (parsed <= MAX_CONCURRENCY_LIMIT) return parsed;
1049
+ }
1050
+ console.warn(
1051
+ `[zapier-sdk] Invalid value for ${name}: "${value}" (expected positive integer 1-${MAX_CONCURRENCY_LIMIT} or "Infinity")`
1052
+ );
1053
+ return void 0;
1054
+ }
1055
+ var ZAPIER_MAX_CONCURRENT_REQUESTS = parseConcurrencyEnvVar("ZAPIER_MAX_CONCURRENT_REQUESTS") ?? 200;
1056
+ function getZapierApprovalMode() {
1057
+ const value = globalThis.process?.env?.ZAPIER_APPROVAL_MODE;
1058
+ if (value === "disabled" || value === "poll" || value === "throw")
1059
+ return value;
1060
+ return void 0;
1061
+ }
1062
+ function getZapierDefaultApprovalMode() {
1063
+ const isInteractive = !!globalThis.process?.stdin?.isTTY && !!globalThis.process?.stdout?.isTTY;
1064
+ return isInteractive ? "poll" : "throw";
1065
+ }
1066
+ var DEFAULT_APPROVAL_TIMEOUT_MS = 10 * 60 * 1e3;
1067
+ var DEFAULT_MAX_APPROVAL_RETRIES = 2;
1068
+
1069
+ // src/types/properties.ts
1070
+ var AppKeyPropertySchema = withPositional(
1071
+ z.string().min(1).describe("App key (e.g., 'SlackCLIAPI' or slug like 'github')")
1072
+ );
1073
+ var AppPropertySchema = withPositional(
1074
+ z.string().min(1).describe(
1075
+ "App slug (e.g., 'github'), implementation name (e.g., 'SlackCLIAPI'), or versioned ID (e.g., 'github@1.2.3')"
1076
+ )
1077
+ );
1078
+ var ActionTypePropertySchema = z.enum([
1079
+ "read",
1080
+ "read_bulk",
1081
+ "write",
1082
+ "run",
1083
+ "search",
1084
+ "search_or_write",
1085
+ "search_and_write",
1086
+ "filter"
1087
+ ]).describe("Action type that matches the action's defined type");
1088
+ var ActionKeyPropertySchema = z.string().min(1).describe("Action key to execute");
1089
+ var ActionPropertySchema = withPositional(
1090
+ z.string().min(1).describe("Action key (e.g., 'send_message' or 'find_row')")
1091
+ );
1092
+ var InputFieldPropertySchema = withPositional(
1093
+ z.string().min(1).describe("Input field key to get choices for")
1094
+ );
1095
+ var ConnectionIdPropertySchema = z.union([z.string(), z.number().int().positive()]).describe("Connection ID to use for this action");
1096
+ var AuthenticationIdPropertySchema = ConnectionIdPropertySchema.meta({
1097
+ deprecated: true
1098
+ });
1099
+ var ConnectionPropertySchema = z.union([z.string(), z.number().int().positive()]).describe(
1100
+ "Connection alias or connection ID (UUID or positive integer). Strings that match a key in the connections map are resolved against it; otherwise the value is used as a connection ID directly."
1101
+ );
1102
+ var InputsPropertySchema = z.record(z.string(), z.unknown()).describe("Input parameters for the action");
1103
+ var LimitPropertySchema = z.number().int().min(1).max(MAX_PAGE_LIMIT).default(50).describe("Maximum number of items to return");
1104
+ var OffsetPropertySchema = z.number().int().min(0).default(0).describe("Number of items to skip for pagination");
1105
+ var OutputPropertySchema = z.string().describe("Output file path");
1106
+ var DebugPropertySchema = z.boolean().default(false).describe("Enable debug logging");
1107
+ var ParamsPropertySchema = z.record(z.string(), z.unknown()).describe("Additional parameters");
1108
+ var ActionTimeoutMsPropertySchema = z.number().min(1e3).optional().describe(
1109
+ `Maximum time to wait for action completion in milliseconds (default: ${DEFAULT_ACTION_TIMEOUT_MS})`
1110
+ );
1111
+ var TablePropertySchema = withPositional(
1112
+ z.string().regex(/^[A-Z0-9]{26}$/, "Table ID must be a valid ULID").describe("The unique identifier of the table")
1113
+ );
1114
+ var RecordPropertySchema = withPositional(
1115
+ z.string().regex(/^[A-Z0-9]{26}$/, "Record ID must be a valid ULID").describe("The unique identifier of the record")
1116
+ );
1117
+ var RecordsPropertySchema = z.array(z.string().regex(/^[A-Z0-9]{26}$/, "Record ID must be a valid ULID")).min(1).max(100).describe("Record IDs to operate on");
1118
+ var FieldsPropertySchema = z.array(z.union([z.string(), z.number()])).describe(
1119
+ 'Fields to operate on. Accepts field names (e.g., "Email") or IDs (e.g., "f6", "6", or 6).'
1120
+ );
1121
+ var AppsPropertySchema = z.array(z.string()).describe("Filter by app keys (e.g., 'SlackCLIAPI' or slug like 'github')");
1122
+ var TablesPropertySchema = z.array(z.string()).describe("Filter by specific table IDs");
1123
+ var ConnectionsPropertySchema = z.array(z.string()).describe("List of connection IDs to filter by");
1124
+ var TriggerInboxPropertySchema = withPositional(
1125
+ z.string().min(1).describe(
1126
+ "Trigger inbox identifier \u2014 UUID or name. Non-UUID values are resolved by name via the inbox list endpoint."
1127
+ )
1128
+ );
1129
+ var TriggerInboxNamePropertySchema = z.string().min(1).max(100).describe(
1130
+ "Inbox name; unique per (user, account). Enables get-or-create on createTriggerInbox."
1131
+ );
1132
+ var LeasePropertySchema = z.string().min(1).describe("Lease ID returned from leaseTriggerInboxMessages");
1133
+ var LeaseSecondsPropertySchema = z.number().int().min(1).max(3600).describe(
1134
+ "Seconds until the lease expires; messages return to available if not acked. API default is 300 (5 minutes)."
1135
+ );
1136
+ var LeaseLimitPropertySchema = z.number().int().min(1).max(100).describe("Maximum messages to lease in a single batch (1-100)");
1137
+
1138
+ // src/types/errors.ts
1139
+ var _a, _b;
1140
+ var ZapierError = class extends (_b = Error, _a = CORE_ERROR_SYMBOL, _b) {
1141
+ constructor(message, options = {}) {
1142
+ super(message);
1143
+ this[_a] = true;
1144
+ this.name = "ZapierError";
1145
+ this.code = "ZAPIER_ERROR";
1146
+ if (options.statusCode !== void 0) this.statusCode = options.statusCode;
1147
+ if (options.errors !== void 0) this.errors = options.errors;
1148
+ if (options.cause !== void 0) this.cause = options.cause;
1149
+ if (options.response !== void 0) this.response = options.response;
1150
+ Object.setPrototypeOf(this, new.target.prototype);
1151
+ }
1152
+ };
1153
+ var ZapierValidationError = class extends ZapierError {
1154
+ constructor(message, options = {}) {
1155
+ super(message, options);
1156
+ this.name = "ZapierValidationError";
1157
+ this.code = "ZAPIER_VALIDATION_ERROR";
1158
+ this.details = options.details;
1159
+ }
1160
+ };
1161
+ var ZapierUnknownError = class extends ZapierError {
1162
+ constructor() {
1163
+ super(...arguments);
1164
+ this.name = "ZapierUnknownError";
1165
+ this.code = "ZAPIER_UNKNOWN_ERROR";
1166
+ }
1167
+ };
1168
+ var ZapierAuthenticationError = class extends ZapierError {
1169
+ constructor() {
1170
+ super(...arguments);
1171
+ this.name = "ZapierAuthenticationError";
1172
+ this.code = "ZAPIER_AUTHENTICATION_ERROR";
1173
+ }
1174
+ };
1175
+ var zapierAdaptError = (options) => {
1176
+ switch (options.code) {
1177
+ case CoreErrorCode.Validation:
1178
+ return new ZapierValidationError(options.message, {
1179
+ cause: options.cause,
1180
+ details: options.details
1181
+ });
1182
+ case CoreErrorCode.Unknown:
1183
+ return new ZapierUnknownError(options.message, {
1184
+ cause: options.cause
1185
+ });
1186
+ default:
1187
+ return new ZapierError(options.message, { cause: options.cause });
1188
+ }
1189
+ };
1190
+ var ZapierApiError = class extends ZapierError {
1191
+ constructor(message, options = {}) {
1192
+ super(message, options);
1193
+ this.name = "ZapierApiError";
1194
+ this.code = "ZAPIER_API_ERROR";
1195
+ }
1196
+ };
1197
+ var ZapierAppNotFoundError = class extends ZapierError {
1198
+ constructor(message, options = {}) {
1199
+ super(message, options);
1200
+ this.name = "ZapierAppNotFoundError";
1201
+ this.code = "ZAPIER_APP_NOT_FOUND_ERROR";
1202
+ this.appKey = options.appKey;
1203
+ }
1204
+ };
1205
+ var ZapierNotFoundError = class extends ZapierError {
1206
+ constructor(message, options = {}) {
1207
+ super(message, options);
1208
+ this.name = "ZapierNotFoundError";
1209
+ this.code = "ZAPIER_NOT_FOUND_ERROR";
1210
+ }
1211
+ };
1212
+ var ZapierResourceNotFoundError = class extends ZapierNotFoundError {
1213
+ constructor(message, options = {}) {
1214
+ super(message, options);
1215
+ this.name = "ZapierResourceNotFoundError";
1216
+ this.code = "ZAPIER_RESOURCE_NOT_FOUND_ERROR";
1217
+ this.resourceType = options.resourceType;
1218
+ this.resourceId = options.resourceId;
1219
+ }
1220
+ };
1221
+ var ZapierConfigurationError = class extends ZapierError {
1222
+ constructor(message, options = {}) {
1223
+ super(message, options);
1224
+ this.name = "ZapierConfigurationError";
1225
+ this.code = "ZAPIER_CONFIGURATION_ERROR";
1226
+ this.configType = options.configType;
1227
+ }
1228
+ };
1229
+ var ZapierBundleError = class extends ZapierError {
1230
+ constructor(message, options = {}) {
1231
+ super(message, options);
1232
+ this.name = "ZapierBundleError";
1233
+ this.code = "ZAPIER_BUNDLE_ERROR";
1234
+ this.buildErrors = options.buildErrors;
1235
+ }
1236
+ };
1237
+ var ZapierTimeoutError = class extends ZapierError {
1238
+ constructor(message, options = {}) {
1239
+ super(message, options);
1240
+ this.name = "ZapierTimeoutError";
1241
+ this.code = "ZAPIER_TIMEOUT_ERROR";
1242
+ this.attempts = options.attempts;
1243
+ this.maxAttempts = options.maxAttempts;
1244
+ }
1245
+ };
1246
+ var ZapierActionError = class extends ZapierError {
1247
+ constructor(message, options = {}) {
1248
+ super(message, options);
1249
+ this.name = "ZapierActionError";
1250
+ this.code = "ZAPIER_ACTION_ERROR";
1251
+ this.appKey = options.appKey;
1252
+ this.actionKey = options.actionKey;
1253
+ }
1254
+ // Legacy accessor for backward compatibility
1255
+ get actionErrors() {
1256
+ return this.errors;
1257
+ }
1258
+ };
1259
+ var ZapierConflictError = class extends ZapierError {
1260
+ constructor(message, options = {}) {
1261
+ super(message, options);
1262
+ this.name = "ZapierConflictError";
1263
+ this.code = "ZAPIER_CONFLICT_ERROR";
1264
+ this.resourceType = options.resourceType;
1265
+ }
1266
+ };
1267
+ var ZapierRateLimitError = class extends ZapierError {
1268
+ constructor(message, options = {}) {
1269
+ super(message, options);
1270
+ this.name = "ZapierRateLimitError";
1271
+ this.code = "ZAPIER_RATE_LIMIT_ERROR";
1272
+ this.rateLimit = options.rateLimit ?? {};
1273
+ this.retries = options.retries ?? 0;
741
1274
  }
742
- return result.data;
743
1275
  };
744
- function createValidator(schema) {
745
- return function validateFn(input) {
746
- return validate(schema, input);
747
- };
748
- }
749
- var validateOptions = (schema, options) => {
750
- return validate(schema, options);
1276
+ var ZapierApprovalError = class extends ZapierError {
1277
+ constructor(message, options = {}) {
1278
+ super(message, options);
1279
+ this.name = "ZapierApprovalError";
1280
+ this.code = "ZAPIER_APPROVAL_ERROR";
1281
+ this.approvalId = options.approvalId;
1282
+ this.approvalStatus = options.status;
1283
+ this.approvalUrl = options.approvalUrl;
1284
+ this.pollUrl = options.pollUrl;
1285
+ }
751
1286
  };
752
- var telemetryStore = null;
753
- try {
754
- telemetryStore = new AsyncLocalStorage();
755
- } catch {
756
- }
757
- function isTelemetryNested() {
758
- if (!telemetryStore) return true;
759
- const store = telemetryStore.getStore();
760
- return store !== void 0 && store.depth > 0;
761
- }
762
- function runWithTelemetryContext(fn) {
763
- if (!telemetryStore) return fn();
764
- const currentDepth = telemetryStore.getStore()?.depth ?? -1;
765
- return telemetryStore.run({ depth: currentDepth + 1 }, fn);
766
- }
767
- function setMethodMetadata(metadata) {
768
- if (!telemetryStore) return;
769
- const store = telemetryStore.getStore();
770
- if (!store) return;
771
- store.methodMetadata = { ...store.methodMetadata, ...metadata };
772
- }
773
- function getMethodMetadata() {
774
- if (!telemetryStore) return void 0;
775
- return telemetryStore.getStore()?.methodMetadata;
776
- }
777
-
778
- // src/utils/function-utils.ts
779
- function extractCursor(data) {
780
- if (!data?.next) {
781
- return void 0;
1287
+ var ZapierRelayError = class extends ZapierError {
1288
+ constructor(message, options = {}) {
1289
+ super(message, options);
1290
+ this.name = "ZapierRelayError";
1291
+ this.code = "ZAPIER_RELAY_ERROR";
782
1292
  }
783
- try {
784
- const urlObj = new URL(data.next);
785
- const offset = urlObj.searchParams.get("offset");
786
- return offset || void 0;
787
- } catch {
788
- return void 0;
1293
+ };
1294
+ function formatErrorMessage(error) {
1295
+ let message = error.message;
1296
+ if (error.errors && error.errors.length > 0) {
1297
+ const additionalErrors = error.errors.slice(1);
1298
+ if (additionalErrors.length > 0) {
1299
+ const errorDetails = additionalErrors.map((err) => ` \u2022 ${err.detail || err.title || err.code}`).join("\n");
1300
+ message += "\n\nAdditional errors:\n" + errorDetails;
1301
+ }
789
1302
  }
790
- }
791
- function normalizeError(error) {
792
- if (error instanceof ZapierError) {
793
- return error;
1303
+ if (error instanceof ZapierAppNotFoundError && error.appKey) {
1304
+ message += `
1305
+ App key: ${error.appKey}`;
794
1306
  }
795
- const message = error instanceof Error ? error.message : String(error);
796
- const cause = error instanceof Error ? error : void 0;
797
- if (error instanceof Error) {
798
- if (error.name === "ZapierAuthenticationError") {
799
- return new ZapierAuthenticationError(message, { cause });
800
- }
1307
+ if (error instanceof ZapierActionError && (error.appKey || error.actionKey)) {
1308
+ const context = [];
1309
+ if (error.appKey) context.push(`App: ${error.appKey}`);
1310
+ if (error.actionKey) context.push(`Action: ${error.actionKey}`);
1311
+ message += `
1312
+ ${context.join(", ")}`;
801
1313
  }
802
- return new ZapierUnknownError(message, { cause });
803
- }
804
- function createFunction(coreFn, schema, telemetry) {
805
- const functionName = coreFn.name;
806
- const namedFunctions = {
807
- [functionName]: async function(options) {
808
- return runWithTelemetryContext(async () => {
809
- const startTime = Date.now();
810
- const normalizedOptions = options ?? {};
811
- const isNested = isTelemetryNested();
812
- try {
813
- if (schema) {
814
- const validatedOptions = validateOptions(schema, normalizedOptions);
815
- const result2 = await coreFn({
816
- ...normalizedOptions,
817
- ...validatedOptions
818
- });
819
- if (!isNested && telemetry?.onMethodCalled) {
820
- const argumentCount = Object.keys(
821
- normalizedOptions
822
- ).length;
823
- telemetry.onMethodCalled({
824
- methodName: functionName,
825
- durationMs: Date.now() - startTime,
826
- success: true,
827
- argumentCount,
828
- isPaginated: false
829
- });
830
- }
831
- return result2;
832
- }
833
- const result = await coreFn(normalizedOptions);
834
- if (!isNested && telemetry?.onMethodCalled) {
835
- const argumentCount = Object.keys(
836
- normalizedOptions
837
- ).length;
838
- telemetry.onMethodCalled({
839
- methodName: functionName,
840
- durationMs: Date.now() - startTime,
841
- success: true,
842
- argumentCount,
843
- isPaginated: false
844
- });
845
- }
846
- return result;
847
- } catch (error) {
848
- const normalizedError = normalizeError(error);
849
- if (!isNested && telemetry?.onMethodCalled) {
850
- const argumentCount = Object.keys(
851
- normalizedOptions
852
- ).length;
853
- telemetry.onMethodCalled({
854
- methodName: functionName,
855
- durationMs: Date.now() - startTime,
856
- success: false,
857
- error: normalizedError,
858
- argumentCount,
859
- isPaginated: false
860
- });
861
- }
862
- throw normalizedError;
863
- }
864
- });
865
- }
866
- };
867
- return namedFunctions[functionName];
868
- }
869
- function createPageFunction(coreFn) {
870
- const functionName = coreFn.name + "Page";
871
- const namedFunctions = {
872
- [functionName]: async function(options) {
873
- try {
874
- const result = await coreFn(options);
875
- if (result && typeof result === "object" && "data" in result) {
876
- const paginatedResult = result;
877
- let nextCursor;
878
- if (paginatedResult.nextCursor) {
879
- nextCursor = paginatedResult.nextCursor;
880
- } else if (paginatedResult.links?.next) {
881
- nextCursor = extractCursor({ next: paginatedResult.links.next });
882
- }
883
- return {
884
- data: Array.isArray(paginatedResult.data) ? paginatedResult.data : [paginatedResult.data],
885
- nextCursor
886
- };
887
- }
888
- if (Array.isArray(result)) {
889
- return { data: result };
890
- }
891
- return { data: [result] };
892
- } catch (error) {
893
- throw normalizeError(error);
894
- }
895
- }
896
- };
897
- return namedFunctions[functionName];
898
- }
899
- function createPaginatedFunction(coreFn, schema, telemetry, explicitFunctionName, defaultPageSize) {
900
- const pageFunction = createPageFunction(coreFn);
901
- const functionName = explicitFunctionName || coreFn.name;
902
- const validator = schema ? createValidator(schema) : null;
903
- const namedFunctions = {
904
- [functionName]: function(options) {
905
- return runWithTelemetryContext(() => {
906
- const startTime = Date.now();
907
- const normalizedOptions = options ?? {};
908
- const isNested = isTelemetryNested();
909
- const validatedOptions = {
910
- ...normalizedOptions,
911
- ...validator ? validator(normalizedOptions) : normalizedOptions
912
- };
913
- const pageSize = validatedOptions.pageSize ?? defaultPageSize;
914
- const optimizedOptions = {
915
- ...validatedOptions,
916
- pageSize
917
- };
918
- const iterator = paginate(pageFunction, optimizedOptions);
919
- const firstPagePromise = iterator.next().then((result) => {
920
- if (result.done) {
921
- throw new Error("Paginate should always iterate at least once");
922
- }
923
- return result.value;
924
- });
925
- if (!isNested && telemetry?.onMethodCalled) {
926
- firstPagePromise.then(() => {
927
- const argumentCount = Object.keys(
928
- normalizedOptions
929
- ).length;
930
- telemetry.onMethodCalled({
931
- methodName: functionName,
932
- durationMs: Date.now() - startTime,
933
- success: true,
934
- argumentCount,
935
- isPaginated: true
936
- });
937
- }).catch((error) => {
938
- const argumentCount = Object.keys(
939
- normalizedOptions
940
- ).length;
941
- telemetry.onMethodCalled({
942
- methodName: functionName,
943
- durationMs: Date.now() - startTime,
944
- success: false,
945
- error: error instanceof Error ? error : new Error(String(error)),
946
- argumentCount,
947
- isPaginated: true
948
- });
949
- });
950
- }
951
- return Object.assign(firstPagePromise, {
952
- [Symbol.asyncIterator]: async function* () {
953
- yield await firstPagePromise;
954
- for await (const page of iterator) {
955
- yield page;
956
- }
957
- },
958
- items: function() {
959
- return {
960
- [Symbol.asyncIterator]: async function* () {
961
- const firstPage = await firstPagePromise;
962
- for (const item of firstPage.data) {
963
- yield item;
964
- }
965
- for await (const page of iterator) {
966
- for (const item of page.data) {
967
- yield item;
968
- }
969
- }
970
- }
971
- };
972
- }
973
- });
974
- });
975
- }
976
- };
977
- return namedFunctions[functionName];
978
- }
979
-
980
- // src/utils/telemetry-utils.ts
981
- function createTelemetryCallback(emitMethodCalled, methodName) {
982
- return {
983
- onMethodCalled: (data) => {
984
- const metadata = getMethodMetadata();
985
- emitMethodCalled({
986
- method_name: methodName,
987
- execution_duration_ms: data.durationMs,
988
- success_flag: data.success,
989
- error_message: data.error?.message ?? null,
990
- error_type: data.error?.constructor.name ?? null,
991
- argument_count: data.argumentCount,
992
- is_paginated: data.isPaginated,
993
- selected_api: metadata?.selectedApi ?? null,
994
- operation_type: metadata?.operationType ?? null,
995
- operation_key: metadata?.operationKey ?? null
996
- });
997
- }
998
- };
999
- }
1000
-
1001
- // src/utils/plugin-utils.ts
1002
- function definePlugin(fn) {
1003
- return fn;
1004
- }
1005
- function maybeTelemetry(sdk, name) {
1006
- const ctx = sdk.context;
1007
- if (!ctx.eventEmission) return void 0;
1008
- return createTelemetryCallback(ctx.eventEmission.emitMethodCalled, name);
1009
- }
1010
- function createPluginMethod(sdk, config) {
1011
- const { name, inputSchema, handler, ...metaFields } = config;
1012
- const namedHandlers = {
1013
- [name]: async function(options) {
1014
- return handler({ sdk, options });
1015
- }
1016
- };
1017
- const wrappedFn = createFunction(
1018
- namedHandlers[name],
1019
- inputSchema,
1020
- maybeTelemetry(sdk, name)
1021
- );
1022
- return {
1023
- [name]: wrappedFn,
1024
- context: {
1025
- meta: {
1026
- [name]: {
1027
- ...metaFields,
1028
- ...inputSchema ? { inputSchema } : {}
1029
- }
1030
- }
1031
- }
1032
- };
1033
- }
1034
- function createPaginatedPluginMethod(sdk, config) {
1035
- const {
1036
- name,
1037
- inputSchema,
1038
- handler,
1039
- extractCursor: extractCursorFn,
1040
- defaultPageSize,
1041
- ...metaFields
1042
- } = config;
1043
- const namedPageHandlers = {
1044
- [name]: async function(options) {
1045
- const response = await handler({ sdk, options });
1046
- if (extractCursorFn) {
1047
- const extracted = extractCursorFn(response);
1048
- if (extracted !== void 0) {
1049
- return { data: response.data, nextCursor: extracted };
1050
- }
1051
- }
1052
- return response;
1053
- }
1054
- };
1055
- const wrappedFn = createPaginatedFunction(
1056
- namedPageHandlers[name],
1057
- inputSchema,
1058
- maybeTelemetry(sdk, name),
1059
- name,
1060
- defaultPageSize
1061
- );
1062
- return {
1063
- [name]: wrappedFn,
1064
- context: {
1065
- meta: {
1066
- [name]: {
1067
- ...metaFields,
1068
- ...inputSchema ? { inputSchema } : {}
1069
- }
1070
- }
1314
+ if (error instanceof ZapierResourceNotFoundError && (error.resourceType || error.resourceId)) {
1315
+ const context = [];
1316
+ if (error.resourceType) context.push(`Type: ${error.resourceType}`);
1317
+ if (error.resourceId) context.push(`ID: ${error.resourceId}`);
1318
+ message += `
1319
+ ${context.join(", ")}`;
1320
+ }
1321
+ if (error instanceof ZapierConflictError && error.resourceType) {
1322
+ message += `
1323
+ Type: ${error.resourceType}`;
1324
+ }
1325
+ if (error instanceof ZapierTimeoutError && (error.attempts || error.maxAttempts)) {
1326
+ const context = [];
1327
+ if (error.attempts) context.push(`Attempts: ${error.attempts}`);
1328
+ if (error.maxAttempts) context.push(`Max attempts: ${error.maxAttempts}`);
1329
+ message += `
1330
+ ${context.join(", ")}`;
1331
+ }
1332
+ if (error instanceof ZapierBundleError && error.buildErrors && error.buildErrors.length > 0) {
1333
+ message += "\n\nBuild errors:\n" + error.buildErrors.map((err) => ` \u2022 ${err}`).join("\n");
1334
+ }
1335
+ if (error instanceof ZapierApprovalError && error.approvalUrl) {
1336
+ message += `
1337
+ Approval URL: ${error.approvalUrl}`;
1338
+ }
1339
+ if (error instanceof ZapierRateLimitError) {
1340
+ const { limit, remaining, retryAfterMs } = error.rateLimit;
1341
+ const parts = [];
1342
+ if (limit !== void 0) {
1343
+ const used = remaining !== void 0 ? limit - remaining : limit;
1344
+ parts.push(`${used}/${limit} used`);
1071
1345
  }
1072
- };
1073
- }
1074
- function mergeRootKeysWithCollisionCheck(target, source, seen) {
1075
- for (const key of Object.keys(source)) {
1076
- if (seen.has(key)) {
1077
- throw new Error(
1078
- `composePlugins: duplicate root key "${key}". Plugins composed in the same call must register distinct method names.`
1079
- );
1346
+ if (retryAfterMs !== void 0 && retryAfterMs > 0) {
1347
+ parts.push(`retry in ${formatDuration(retryAfterMs)}`);
1080
1348
  }
1081
- seen.add(key);
1082
- target[key] = source[key];
1083
- }
1084
- }
1085
- function mergeMetaKeysWithCollisionCheck(target, source, seen) {
1086
- for (const key of Object.keys(source)) {
1087
- if (seen.has(key)) {
1088
- throw new Error(
1089
- `composePlugins: duplicate context.meta key "${key}". Two sub-plugins registered metadata for the same name.`
1349
+ if (error.retries > 0) {
1350
+ parts.push(
1351
+ `after ${error.retries} retr${error.retries === 1 ? "y" : "ies"}`
1090
1352
  );
1091
1353
  }
1092
- seen.add(key);
1093
- target[key] = source[key];
1094
- }
1095
- }
1096
- function mergeContextKeysWithCollisionCheck(target, source, seen) {
1097
- for (const key of Object.keys(source)) {
1098
- if (seen.has(key)) {
1099
- throw new Error(
1100
- `composePlugins: duplicate context key "${key}". Two sub-plugins contributed the same context.${key} field.`
1101
- );
1354
+ if (parts.length > 0) {
1355
+ message += `
1356
+ ${parts.join(", ")}`;
1102
1357
  }
1103
- seen.add(key);
1104
- target[key] = source[key];
1105
1358
  }
1106
- }
1107
- function composePlugins(...plugins) {
1108
- return (sdk) => {
1109
- const merged = { context: { meta: {} } };
1110
- const seenRoot = /* @__PURE__ */ new Set();
1111
- const seenMeta = /* @__PURE__ */ new Set();
1112
- const seenContext = /* @__PURE__ */ new Set();
1113
- for (const plugin of plugins) {
1114
- const { context, ...rootKeys } = plugin(sdk);
1115
- mergeRootKeysWithCollisionCheck(merged, rootKeys, seenRoot);
1116
- if (context) {
1117
- const { meta, ...nonMetaContext } = context;
1118
- if (meta) {
1119
- mergeMetaKeysWithCollisionCheck(merged.context.meta, meta, seenMeta);
1120
- }
1121
- mergeContextKeysWithCollisionCheck(
1122
- merged.context,
1123
- nonMetaContext,
1124
- seenContext
1125
- );
1126
- }
1127
- }
1128
- return merged;
1129
- };
1130
- }
1131
- function getStringProperty(obj, key) {
1132
- if (typeof obj === "object" && obj !== null && key in obj) {
1133
- const value = obj[key];
1134
- return typeof value === "string" ? value : void 0;
1359
+ if (error.statusCode && !message.includes(`${error.statusCode}`)) {
1360
+ message += `
1361
+ HTTP Status: ${error.statusCode}`;
1135
1362
  }
1136
- return void 0;
1363
+ return message;
1137
1364
  }
1138
- function formatActionResult(item) {
1139
- const obj = typeof item === "object" && item !== null ? item : {};
1140
- const title = getStringProperty(obj, "title") || getStringProperty(obj, "name") || getStringProperty(obj, "label") || getStringProperty(obj, "subject") || "Action Result";
1141
- return {
1142
- title,
1143
- id: getStringProperty(obj, "id"),
1144
- key: getStringProperty(obj, "key"),
1145
- description: getStringProperty(obj, "description"),
1146
- data: item,
1147
- // Let formatJsonOutput handle the JSON rendering
1148
- details: []
1149
- // Not used when data is provided
1150
- };
1365
+ function formatDuration(ms) {
1366
+ const seconds = Math.round(ms / 1e3);
1367
+ if (seconds < 60) return `${seconds}s`;
1368
+ const minutes = Math.round(seconds / 60);
1369
+ if (minutes < 60) return `${minutes}m`;
1370
+ const hours = Math.round(minutes / 60);
1371
+ if (hours < 24) return `${hours}h`;
1372
+ const days = Math.round(hours / 24);
1373
+ return `${days}d`;
1151
1374
  }
1152
- var ActionResultItemSchema = withFormatter(
1153
- z.unknown().describe("Action execution result"),
1154
- { format: formatActionResult }
1375
+
1376
+ // src/types/signals.ts
1377
+ var ZapierSignal = class extends Error {
1378
+ constructor(message) {
1379
+ super(message);
1380
+ Object.setPrototypeOf(this, new.target.prototype);
1381
+ }
1382
+ };
1383
+ var ZapierReleaseTriggerMessageSignal = class extends ZapierSignal {
1384
+ constructor() {
1385
+ super(...arguments);
1386
+ this.name = "ZapierReleaseTriggerMessageSignal";
1387
+ this.code = "ZAPIER_RELEASE_TRIGGER_MESSAGE_SIGNAL";
1388
+ }
1389
+ };
1390
+ var ZapierAbortDrainSignal = class extends ZapierSignal {
1391
+ constructor() {
1392
+ super(...arguments);
1393
+ this.name = "ZapierAbortDrainSignal";
1394
+ this.code = "ZAPIER_ABORT_DRAIN_SIGNAL";
1395
+ }
1396
+ };
1397
+ var TriggerInboxCommandBaseSchema = z.object({
1398
+ inbox: TriggerInboxPropertySchema,
1399
+ onMessage: z.function().optional().meta({ exampleRequired: true }).describe(
1400
+ "Per-message handler. Resolves to ack; rejects to release-or-leave per `releaseOnError`. Throw `ZapierReleaseTriggerMessageSignal` to release explicitly, or `ZapierAbortDrainSignal` to stop after the current batch."
1401
+ ),
1402
+ concurrency: z.number().int().min(1).optional().describe(
1403
+ "Per-message handler workers running in parallel. Defaults to `leaseLimit`, or 1 if neither is set."
1404
+ ),
1405
+ leaseLimit: z.number().int().min(1).max(100).optional().describe(
1406
+ "Per-lease HTTP batch size. Defaults to `concurrency`, or 1 if neither is set."
1407
+ ),
1408
+ leaseSeconds: LeaseSecondsPropertySchema.optional(),
1409
+ releaseOnError: z.boolean().optional().describe(
1410
+ "If true, errors release the message when the drain finishes. If false (default), errors leave it leased until the lease timeout. `ZapierReleaseTriggerMessageSignal` always releases regardless."
1411
+ ),
1412
+ continueOnError: z.boolean().optional().describe(
1413
+ "If false (default, fail-fast), the first handler error rejects and stops the drain. If true, handler errors are observed via `onError` and the drain continues. SDK-level errors (lease / ack / release) reject regardless."
1414
+ ),
1415
+ onError: z.function().optional().describe(
1416
+ "Per-message error observer for `continueOnError: true`. Called with the failure and the message; control-flow signals are filtered out. Throws from `onError` are swallowed."
1417
+ ),
1418
+ signal: z.custom((v) => v instanceof AbortSignal).optional().describe(
1419
+ "Abort signal. Aborting cancels in-flight HTTP, releases unprocessed messages, and resolves cleanly. Errors during shutdown still reject."
1420
+ )
1421
+ });
1422
+ TriggerInboxCommandBaseSchema.extend({
1423
+ maxMessages: z.number().int().min(1).optional().describe(
1424
+ "Cap total messages drained. Defaults to draining the inbox until empty."
1425
+ )
1426
+ }).describe(
1427
+ "Drain an existing trigger inbox: lease currently-available messages and process them via onMessage. Returns when the inbox is empty, maxMessages is reached, the abort signal fires, or a fatal error rejects."
1428
+ );
1429
+ TriggerInboxCommandBaseSchema.extend({
1430
+ maxDrainIntervalSeconds: z.number().int().min(1).optional().describe(
1431
+ "Maximum seconds between empty-inbox poll attempts (default: 60). Caps the back-off cadence."
1432
+ )
1433
+ }).describe(
1434
+ "Continuously consume a trigger inbox: drain currently-available messages, then poll with backoff for new arrivals, until aborted. Stop via the `signal` AbortSignal or by throwing `ZapierAbortDrainSignal` from a handler. Resolves cleanly on abort; rejects on a fatal error or a fail-fast handler error."
1155
1435
  );
1436
+ var ActionExecutionInputSchema = z.object({
1437
+ inputs: z.record(z.string(), z.unknown()).optional(),
1438
+ /** @deprecated Use `connection` instead. */
1439
+ connectionId: ConnectionIdPropertySchema.optional().meta({
1440
+ deprecated: true
1441
+ }),
1442
+ connection: ConnectionPropertySchema.optional(),
1443
+ /** @deprecated Use connection instead */
1444
+ authenticationId: AuthenticationIdPropertySchema.optional().meta({
1445
+ deprecated: true
1446
+ }),
1447
+ timeoutMs: ActionTimeoutMsPropertySchema
1448
+ }).describe(
1449
+ "Execute an action with the given inputs for the bound app, as an alternative to runAction"
1450
+ ).meta({
1451
+ aliases: { connectionId: "connection", authenticationId: "connection" }
1452
+ });
1453
+ var AppFactoryInputSchema = z.object({
1454
+ /** @deprecated Use `connection` instead. */
1455
+ connectionId: ConnectionIdPropertySchema.optional().meta({
1456
+ deprecated: true
1457
+ }),
1458
+ connection: ConnectionPropertySchema.optional(),
1459
+ /** @deprecated Use connection instead */
1460
+ authenticationId: AuthenticationIdPropertySchema.optional().meta({
1461
+ deprecated: true
1462
+ })
1463
+ }).describe("Bind a connection alias or numeric connectionId to an app").meta({
1464
+ aliases: { connectionId: "connection", authenticationId: "connection" }
1465
+ });
1466
+ var ActionResultItemSchema = z.unknown().describe("Action execution result");
1156
1467
 
1157
1468
  // src/plugins/apps/index.ts
1158
1469
  function resolveProxyConnection({
@@ -1373,18 +1684,6 @@ var FetchInitSchema = z.object({
1373
1684
  aliases: { connectionId: "connection", authenticationId: "connection" }
1374
1685
  });
1375
1686
 
1376
- // src/utils/string-utils.ts
1377
- function toTitleCase(input) {
1378
- return input.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[_\-]+/g, " ").replace(/\s+/g, " ").trim().split(" ").map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(" ");
1379
- }
1380
- function toSnakeCase(input) {
1381
- let result = input.replace(/([a-z0-9])([A-Z])/g, "$1_$2").replace(/[\s\-]+/g, "_").replace(/_+/g, "_").replace(/^_|_$/g, "").toLowerCase();
1382
- if (/^[0-9]/.test(result)) {
1383
- result = "_" + result;
1384
- }
1385
- return result;
1386
- }
1387
-
1388
1687
  // src/utils/domain-utils.ts
1389
1688
  function isConnectionId(value) {
1390
1689
  return /^\d+$/.test(value) || isUuid(value);
@@ -1687,15 +1986,25 @@ function buildAbortHandle({
1687
1986
  return combineAbortSignals({ handles });
1688
1987
  }
1689
1988
  var FetchInitSdkValidationSchema = z.looseObject(FetchInitZapierFieldsSchema.shape).optional();
1690
- var validateFetchInit = createValidator(FetchInitSdkValidationSchema);
1691
1989
  var fetchPlugin = definePlugin(
1692
1990
  (sdk) => {
1991
+ const validateFetchInit = createValidator(FetchInitSdkValidationSchema, {
1992
+ adaptError: sdk.context.core?.adaptError
1993
+ });
1693
1994
  return {
1694
1995
  fetch: async function fetch2(url, init) {
1695
- return runWithTelemetryContext(async () => {
1996
+ return runInMethodScope(async () => {
1696
1997
  const { api } = sdk.context;
1998
+ const { onMethodStart, onMethodEnd } = sdk.context.hooks;
1697
1999
  const startTime = Date.now();
1698
- const isNested = isTelemetryNested();
2000
+ const depth = getCurrentDepth();
2001
+ const args = init === void 0 ? [url] : [url, init];
2002
+ onMethodStart?.({
2003
+ methodName: "fetch",
2004
+ args,
2005
+ isPaginated: false,
2006
+ depth
2007
+ });
1699
2008
  try {
1700
2009
  if (init) {
1701
2010
  validateFetchInit(init);
@@ -1767,17 +2076,13 @@ var fetchPlugin = definePlugin(
1767
2076
  statusCode: result.status
1768
2077
  });
1769
2078
  }
1770
- if (!isNested) {
1771
- sdk.context.eventEmission.emitMethodCalled({
1772
- method_name: "fetch",
1773
- execution_duration_ms: Date.now() - startTime,
1774
- success_flag: true,
1775
- error_message: null,
1776
- error_type: null,
1777
- argument_count: init ? 2 : 1,
1778
- is_paginated: false
1779
- });
1780
- }
2079
+ onMethodEnd?.({
2080
+ methodName: "fetch",
2081
+ args,
2082
+ isPaginated: false,
2083
+ depth,
2084
+ durationMs: Date.now() - startTime
2085
+ });
1781
2086
  return result;
1782
2087
  } catch (error) {
1783
2088
  throw rewrapIfMaxTimeTimeout({
@@ -1789,17 +2094,14 @@ var fetchPlugin = definePlugin(
1789
2094
  abortHandle?.dispose();
1790
2095
  }
1791
2096
  } catch (error) {
1792
- if (!isNested) {
1793
- sdk.context.eventEmission.emitMethodCalled({
1794
- method_name: "fetch",
1795
- execution_duration_ms: Date.now() - startTime,
1796
- success_flag: false,
1797
- error_message: error instanceof Error ? error.message : String(error),
1798
- error_type: error instanceof Error ? error.constructor.name : "Unknown",
1799
- argument_count: init ? 2 : 1,
1800
- is_paginated: false
1801
- });
1802
- }
2097
+ onMethodEnd?.({
2098
+ methodName: "fetch",
2099
+ args,
2100
+ isPaginated: false,
2101
+ depth,
2102
+ durationMs: Date.now() - startTime,
2103
+ error: error instanceof Error ? error : new Error(String(error))
2104
+ });
1803
2105
  throw error;
1804
2106
  }
1805
2107
  });
@@ -1809,7 +2111,11 @@ var fetchPlugin = definePlugin(
1809
2111
  fetch: {
1810
2112
  description: "Make authenticated HTTP requests to any API through Zapier. Pass a connectionId to automatically inject the user's stored credentials (OAuth tokens, API keys, etc.) into the outgoing request. Mirrors the native fetch(url, init?) signature with additional Zapier-specific options.",
1811
2113
  packages: ["sdk", "cli", "mcp"],
1812
- categories: ["http"],
2114
+ // Auto-derive would produce "Http"/"Https" from the key alone;
2115
+ // declare the title explicitly here so the registry renders
2116
+ // "HTTP Request". Other plugins in this category use the bare
2117
+ // string "http"; the object form wins regardless of order.
2118
+ categories: [{ key: "http", title: "HTTP Request" }],
1813
2119
  returnType: "Response",
1814
2120
  inputParameters: [
1815
2121
  { name: "url", schema: FetchUrlSchema },
@@ -1821,6 +2127,29 @@ var fetchPlugin = definePlugin(
1821
2127
  };
1822
2128
  }
1823
2129
  );
2130
+
2131
+ // src/utils/pagination.ts
2132
+ function extractCursorFromUrl(url) {
2133
+ try {
2134
+ const params = new URL(url).searchParams;
2135
+ return params.get("offset") ?? params.get("cursor") ?? void 0;
2136
+ } catch {
2137
+ return void 0;
2138
+ }
2139
+ }
2140
+ function adaptZapierPage(response) {
2141
+ const r = response ?? {};
2142
+ const data = r.data;
2143
+ const linksNext = r.links?.next;
2144
+ if (typeof linksNext === "string") {
2145
+ return { data, nextCursor: extractCursorFromUrl(linksNext) };
2146
+ }
2147
+ if (typeof r.next === "string") {
2148
+ return { data, nextCursor: extractCursorFromUrl(r.next) };
2149
+ }
2150
+ return { data };
2151
+ }
2152
+ var zapierPagination = { adaptPage: adaptZapierPage };
1824
2153
  var ListAppsSchema = ListAppsQuerySchema.omit({
1825
2154
  offset: true,
1826
2155
  app_keys: true,
@@ -1842,27 +2171,30 @@ var ListAppsSchema = ListAppsQuerySchema.omit({
1842
2171
  // SDK specific property for pagination/iterable helpers
1843
2172
  cursor: z.string().optional().describe("Cursor to start from")
1844
2173
  }).describe("List all available apps with optional filtering");
1845
- var AppItemSchema = withFormatter(AppItemSchema$1, {
1846
- format: (item) => {
1847
- return {
1848
- title: item.title,
1849
- key: item.key,
1850
- keys: getAppKeyList(item),
1851
- description: item.description,
1852
- details: []
1853
- };
1854
- }
1855
- });
2174
+ var AppItemSchema = AppItemSchema$1;
2175
+
2176
+ // src/formatters/app.ts
2177
+ var appItemFormatter = {
2178
+ format: (item) => ({
2179
+ title: item.title,
2180
+ key: item.key,
2181
+ keys: getAppKeyList(item),
2182
+ description: item.description,
2183
+ details: []
2184
+ })
2185
+ };
1856
2186
 
1857
2187
  // src/plugins/listApps/index.ts
1858
2188
  var listAppsPlugin = definePlugin(
1859
2189
  (sdk) => createPaginatedPluginMethod(sdk, {
2190
+ ...zapierPagination,
1860
2191
  name: "listApps",
1861
2192
  categories: ["app"],
1862
2193
  type: "list",
1863
2194
  itemType: "App",
1864
2195
  inputSchema: ListAppsSchema,
1865
2196
  outputSchema: AppItemSchema,
2197
+ formatter: appItemFormatter,
1866
2198
  defaultPageSize: DEFAULT_PAGE_SIZE,
1867
2199
  handler: async ({ sdk: sdk2, options }) => {
1868
2200
  const { api, resolveAppKeys: resolveAppKeys2 } = sdk2.context;
@@ -1902,8 +2234,7 @@ var listAppsPlugin = definePlugin(
1902
2234
  ...options.cursor && { offset: options.cursor }
1903
2235
  }
1904
2236
  });
1905
- },
1906
- extractCursor: (response) => extractCursor(response.links)
2237
+ }
1907
2238
  })
1908
2239
  );
1909
2240
  var ListActionsDescription = "List all actions for a specific app";
@@ -2228,48 +2559,42 @@ z.object({
2228
2559
  });
2229
2560
 
2230
2561
  // src/schemas/Action.ts
2231
- var ActionItemSchema = withFormatter(
2232
- ActionSchema.omit({ type: true, name: true, selected_api: true }).extend({
2233
- app_key: z.string(),
2234
- // App key without version (extracted from selected_api)
2235
- app_version: z.string().optional(),
2236
- // Version extracted from selected_api
2237
- action_type: ActionSchema.shape.type,
2238
- // Mapped from original 'type' field
2239
- title: z.string(),
2240
- // Mapped from original 'name' field
2241
- type: z.literal("action")
2242
- // Fixed type identifier
2243
- }),
2244
- {
2245
- format: (item) => {
2246
- const details = [];
2247
- details.push({
2248
- text: `Type: ${item.action_type}`,
2249
- style: "accent"
2250
- });
2251
- if (item.app_key) {
2252
- details.push({
2253
- text: `App: ${item.app_key}`,
2254
- style: "normal"
2255
- });
2256
- }
2257
- if (item.description) {
2258
- details.push({
2259
- text: item.description,
2260
- style: "dim"
2261
- });
2262
- }
2263
- return {
2264
- title: item.title || item.key,
2265
- id: item.id,
2266
- key: item.key,
2267
- description: item.description,
2268
- details
2269
- };
2562
+ var ActionItemSchema = ActionSchema.omit({
2563
+ type: true,
2564
+ name: true,
2565
+ selected_api: true
2566
+ }).extend({
2567
+ app_key: z.string(),
2568
+ // App key without version (extracted from selected_api)
2569
+ app_version: z.string().optional(),
2570
+ // Version extracted from selected_api
2571
+ action_type: ActionSchema.shape.type,
2572
+ // Mapped from original 'type' field
2573
+ title: z.string(),
2574
+ // Mapped from original 'name' field
2575
+ type: z.literal("action")
2576
+ // Fixed type identifier
2577
+ });
2578
+
2579
+ // src/formatters/action.ts
2580
+ var actionItemFormatter = {
2581
+ format: (item) => {
2582
+ const details = [{ text: `Type: ${item.action_type}`, style: "accent" }];
2583
+ if (item.app_key) {
2584
+ details.push({ text: `App: ${item.app_key}`, style: "normal" });
2270
2585
  }
2586
+ if (item.description) {
2587
+ details.push({ text: item.description, style: "dim" });
2588
+ }
2589
+ return {
2590
+ title: item.title || item.key,
2591
+ id: item.id,
2592
+ key: item.key,
2593
+ description: item.description,
2594
+ details
2595
+ };
2271
2596
  }
2272
- );
2597
+ };
2273
2598
 
2274
2599
  // src/resolvers/appKey.ts
2275
2600
  var appKeyResolver = {
@@ -2476,7 +2801,7 @@ var inputFieldKeyResolver = {
2476
2801
  type: "dynamic",
2477
2802
  depends: ["app", "action", "actionType", "connection"],
2478
2803
  fetch: async (sdk, resolvedParams) => {
2479
- const fieldsResponse = await sdk.listInputFields({
2804
+ const fieldsResponse = await sdk.listActionInputFields({
2480
2805
  app: resolvedParams.app,
2481
2806
  action: resolvedParams.action,
2482
2807
  actionType: resolvedParams.actionType,
@@ -2582,7 +2907,8 @@ var workflowIdResolver = {
2582
2907
  name: "workflow",
2583
2908
  message: "Select a workflow:",
2584
2909
  choices: workflows.map((workflow) => ({
2585
- name: workflow.enabled ? workflow.name : `${workflow.name} (disabled)`,
2910
+ name: workflow.name,
2911
+ hint: workflow.enabled ? void 0 : [workflow.id, "disabled"],
2586
2912
  value: workflow.id
2587
2913
  }))
2588
2914
  })
@@ -2597,7 +2923,8 @@ var durableRunIdResolver = {
2597
2923
  name: "run",
2598
2924
  message: "Select a run:",
2599
2925
  choices: runs.map((run) => ({
2600
- name: `${run.id} \u2014 ${run.status}`,
2926
+ name: run.id,
2927
+ hint: run.status,
2601
2928
  value: run.id
2602
2929
  }))
2603
2930
  })
@@ -2607,11 +2934,7 @@ var durableRunIdResolver = {
2607
2934
  var workflowVersionIdResolver = {
2608
2935
  type: "dynamic",
2609
2936
  depends: ["workflow"],
2610
- fetch: async (sdk, params) => toIterable(
2611
- sdk.listWorkflowVersions({
2612
- workflow: params.workflow
2613
- })
2614
- ),
2937
+ fetch: async (sdk, params) => toIterable(sdk.listWorkflowVersions({ workflow: params.workflow })),
2615
2938
  prompt: (versions) => ({
2616
2939
  type: "list",
2617
2940
  name: "version",
@@ -2627,11 +2950,7 @@ var workflowVersionIdResolver = {
2627
2950
  var workflowRunIdResolver = {
2628
2951
  type: "dynamic",
2629
2952
  depends: ["workflow"],
2630
- fetch: async (sdk, params) => toIterable(
2631
- sdk.listWorkflowRuns({
2632
- workflow: params.workflow
2633
- })
2634
- ),
2953
+ fetch: async (sdk, params) => toIterable(sdk.listWorkflowRuns({ workflow: params.workflow })),
2635
2954
  prompt: (runs) => ({
2636
2955
  type: "list",
2637
2956
  name: "run",
@@ -2647,11 +2966,7 @@ var workflowRunIdResolver = {
2647
2966
  var triggerMessagesResolver = {
2648
2967
  type: "dynamic",
2649
2968
  depends: ["inbox"],
2650
- fetch: async (sdk, params) => toIterable(
2651
- sdk.listTriggerInboxMessages({
2652
- inbox: params.inbox
2653
- })
2654
- ),
2969
+ fetch: async (sdk, params) => toIterable(sdk.listTriggerInboxMessages({ inbox: params.inbox })),
2655
2970
  prompt: (messages) => ({
2656
2971
  type: "checkbox",
2657
2972
  name: "messages",
@@ -3025,7 +3340,7 @@ var FieldApiItemSchema = z.object({
3025
3340
  var ListTableFieldsApiResponseSchema = z.object({
3026
3341
  data: z.array(FieldApiItemSchema)
3027
3342
  });
3028
- var FieldItemSchemaBase = z.object({
3343
+ var FieldItemSchema = z.object({
3029
3344
  id: z.string(),
3030
3345
  type: FieldTypeSchema,
3031
3346
  name: z.string(),
@@ -3035,13 +3350,6 @@ var FieldItemSchemaBase = z.object({
3035
3350
  config: z.record(z.string(), z.unknown()).optional(),
3036
3351
  deleted_at: z.string().nullable().optional()
3037
3352
  });
3038
- var FieldItemSchema = withFormatter(FieldItemSchemaBase, {
3039
- format: (item) => ({
3040
- title: item.name,
3041
- id: item.id,
3042
- details: [{ text: `Type: ${item.type}`, style: "dim" }]
3043
- })
3044
- });
3045
3353
  var ListTableFieldsDescription = "List fields for a table";
3046
3354
  var ListTableFieldsOptionsBaseSchema = z.object({
3047
3355
  fields: FieldsPropertySchema.optional(),
@@ -3288,6 +3596,18 @@ var tableSortResolver = {
3288
3596
  }
3289
3597
  };
3290
3598
 
3599
+ // src/plugins/eventEmission/method-metadata.ts
3600
+ var SCOPE_KEY = "methodMetadata";
3601
+ function setMethodMetadata(metadata) {
3602
+ const scope = getCurrentScope();
3603
+ if (!scope) return;
3604
+ const existing = scope[SCOPE_KEY];
3605
+ scope[SCOPE_KEY] = { ...existing, ...metadata };
3606
+ }
3607
+ function getMethodMetadata() {
3608
+ return getCurrentScope()?.[SCOPE_KEY];
3609
+ }
3610
+
3291
3611
  // src/plugins/listActions/index.ts
3292
3612
  var listActionsPlugin = definePlugin(
3293
3613
  (sdk) => createPaginatedPluginMethod(sdk, {
@@ -3297,12 +3617,10 @@ var listActionsPlugin = definePlugin(
3297
3617
  itemType: "Action",
3298
3618
  inputSchema: ListActionsInputSchema,
3299
3619
  outputSchema: ActionItemSchema,
3620
+ formatter: actionItemFormatter,
3300
3621
  defaultPageSize: DEFAULT_PAGE_SIZE,
3301
3622
  resolvers: { app: appKeyResolver, actionType: actionTypeResolver },
3302
- handler: async ({
3303
- sdk: sdk2,
3304
- options
3305
- }) => {
3623
+ handler: async ({ sdk: sdk2, options }) => {
3306
3624
  const { api, getVersionedImplementationId } = sdk2.context;
3307
3625
  const appKey = "app" in options ? options.app : options.appKey;
3308
3626
  const selectedApi = await getVersionedImplementationId(appKey);
@@ -3389,99 +3707,36 @@ var BaseFieldItemSchema = z.object({
3389
3707
  key: z.string()
3390
3708
  // From need.key
3391
3709
  });
3392
- var InputFieldItemSchema = withFormatter(
3393
- BaseFieldItemSchema.extend({
3394
- type: z.literal("input_field"),
3395
- default_value: z.string(),
3396
- // Mapped from 'default' with fallback to ""
3397
- depends_on: z.array(z.string()),
3398
- // Mapped from 'depends_on' with fallback to []
3399
- description: z.string(),
3400
- // Mapped from 'help_text' with fallback to ""
3401
- invalidates_input_fields: z.boolean(),
3402
- // Mapped from 'alters_custom_fields' with fallback to false
3403
- is_required: z.boolean(),
3404
- // Mapped from 'required' with fallback to false
3405
- placeholder: z.string(),
3406
- // Mapped from 'placeholder' with fallback to ""
3407
- title: z.string(),
3408
- // Mapped from 'label' with fallback to ""
3409
- value_type: z.string(),
3410
- // Computed from InputFieldType enum
3411
- format: z.string().optional(),
3412
- // Computed from InputFieldFormat enum (optional)
3413
- items: z.object({ type: z.string() }).optional()
3414
- // Computed from ItemsType enum (optional, only for arrays)
3415
- }),
3416
- {
3417
- format: (item) => {
3418
- const details = [];
3419
- const typeInfo = [
3420
- item.value_type && `Type: ${item.value_type}`,
3421
- `Required: ${item.is_required ? "Yes" : "No"}`
3422
- ].filter(Boolean).join(" | ");
3423
- if (typeInfo) {
3424
- details.push({ text: typeInfo, style: "dim" });
3425
- }
3426
- if (item.description) {
3427
- details.push({
3428
- text: item.description,
3429
- style: "normal"
3430
- });
3431
- }
3432
- if (item.default_value) {
3433
- details.push({
3434
- text: `Default: ${item.default_value}`,
3435
- style: "accent"
3436
- });
3437
- }
3438
- if (item.placeholder) {
3439
- details.push({
3440
- text: `Placeholder: ${item.placeholder}`,
3441
- style: "dim"
3442
- });
3443
- }
3444
- if (item.depends_on && item.depends_on.length > 0) {
3445
- details.push({
3446
- text: `Depends on: ${item.depends_on.join(", ")}`,
3447
- style: "warning"
3448
- });
3449
- }
3450
- if (item.format) {
3451
- details.push({ text: `Format: ${item.format}`, style: "dim" });
3452
- }
3453
- if (item.items) {
3454
- details.push({
3455
- text: `Items type: ${item.items.type}`,
3456
- style: "dim"
3457
- });
3458
- }
3459
- return {
3460
- title: item.title || item.key,
3461
- key: item.key,
3462
- description: item.description,
3463
- details
3464
- };
3465
- }
3466
- }
3467
- );
3468
- var InfoFieldItemSchema = withFormatter(
3469
- BaseFieldItemSchema.extend({
3470
- type: z.literal("info_field"),
3471
- description: z.string(),
3472
- // From need.help_text
3473
- title: z.string().optional()
3474
- // Optional title
3475
- }),
3476
- {
3477
- format: (item) => ({
3478
- title: item.title || "Info",
3479
- key: item.key,
3480
- description: item.description,
3481
- details: [{ text: item.description, style: "normal" }]
3482
- })
3483
- }
3484
- );
3710
+ var InputFieldItemSchema = BaseFieldItemSchema.extend({
3711
+ type: z.literal("input_field"),
3712
+ default_value: z.string(),
3713
+ // Mapped from 'default' with fallback to ""
3714
+ depends_on: z.array(z.string()),
3715
+ // Mapped from 'depends_on' with fallback to []
3716
+ description: z.string(),
3717
+ // Mapped from 'help_text' with fallback to ""
3718
+ invalidates_input_fields: z.boolean(),
3719
+ // Mapped from 'alters_custom_fields' with fallback to false
3720
+ is_required: z.boolean(),
3721
+ // Mapped from 'required' with fallback to false
3722
+ placeholder: z.string(),
3723
+ // Mapped from 'placeholder' with fallback to ""
3724
+ title: z.string(),
3725
+ // Mapped from 'label' with fallback to ""
3726
+ value_type: z.string(),
3727
+ // Computed from InputFieldType enum
3728
+ format: z.string().optional(),
3729
+ // Computed from InputFieldFormat enum (optional)
3730
+ items: z.object({ type: z.string() }).optional()
3731
+ // Computed from ItemsType enum (optional, only for arrays)
3732
+ });
3733
+ var InfoFieldItemSchema = BaseFieldItemSchema.extend({
3734
+ type: z.literal("info_field"),
3735
+ description: z.string(),
3736
+ // From need.help_text
3737
+ title: z.string().optional()
3738
+ // Optional title
3739
+ });
3485
3740
  var FieldsetItemSchema = BaseFieldItemSchema.extend({
3486
3741
  type: z.literal("fieldset"),
3487
3742
  title: z.string(),
@@ -3501,6 +3756,53 @@ var RootFieldItemSchema = z.union([
3501
3756
  FieldsetItemSchema
3502
3757
  ]);
3503
3758
 
3759
+ // src/formatters/field.ts
3760
+ function formatInputField(item) {
3761
+ const details = [];
3762
+ const typeInfo = [
3763
+ item.value_type && `Type: ${item.value_type}`,
3764
+ `Required: ${item.is_required ? "Yes" : "No"}`
3765
+ ].filter(Boolean).join(" | ");
3766
+ if (typeInfo) details.push({ text: typeInfo, style: "dim" });
3767
+ if (item.description)
3768
+ details.push({ text: item.description, style: "normal" });
3769
+ if (item.default_value)
3770
+ details.push({ text: `Default: ${item.default_value}`, style: "accent" });
3771
+ if (item.placeholder)
3772
+ details.push({ text: `Placeholder: ${item.placeholder}`, style: "dim" });
3773
+ if (item.depends_on && item.depends_on.length > 0) {
3774
+ details.push({
3775
+ text: `Depends on: ${item.depends_on.join(", ")}`,
3776
+ style: "warning"
3777
+ });
3778
+ }
3779
+ if (item.format)
3780
+ details.push({ text: `Format: ${item.format}`, style: "dim" });
3781
+ if (item.items)
3782
+ details.push({ text: `Items type: ${item.items.type}`, style: "dim" });
3783
+ return {
3784
+ title: item.title || item.key,
3785
+ key: item.key,
3786
+ description: item.description,
3787
+ details
3788
+ };
3789
+ }
3790
+ function formatInfoField(item) {
3791
+ return {
3792
+ title: item.title || "Info",
3793
+ key: item.key,
3794
+ description: item.description,
3795
+ details: [{ text: item.description, style: "normal" }]
3796
+ };
3797
+ }
3798
+ var rootFieldItemFormatter = {
3799
+ format: (item) => {
3800
+ if (item.type === "input_field") return formatInputField(item);
3801
+ if (item.type === "info_field") return formatInfoField(item);
3802
+ return { title: item.title || item.key, key: item.key, details: [] };
3803
+ }
3804
+ };
3805
+
3504
3806
  // src/services/implementations.ts
3505
3807
  async function fetchImplementationNeeds({
3506
3808
  api,
@@ -3666,6 +3968,7 @@ var listActionInputFieldsPlugin = definePlugin(
3666
3968
  itemType: "RootField",
3667
3969
  inputSchema: ListActionInputFieldsInputSchema,
3668
3970
  outputSchema: RootFieldItemSchema,
3971
+ formatter: rootFieldItemFormatter,
3669
3972
  defaultPageSize: DEFAULT_PAGE_SIZE,
3670
3973
  resolvers: {
3671
3974
  app: appKeyResolver,
@@ -3674,10 +3977,7 @@ var listActionInputFieldsPlugin = definePlugin(
3674
3977
  connection: connectionIdResolver,
3675
3978
  inputs: inputsAllOptionalResolver
3676
3979
  },
3677
- handler: async ({
3678
- sdk: sdk2,
3679
- options
3680
- }) => {
3980
+ handler: async ({ sdk: sdk2, options }) => {
3681
3981
  const { api, getVersionedImplementationId } = sdk2.context;
3682
3982
  const appKey = "app" in options ? options.app : options.appKey;
3683
3983
  const actionKey = "action" in options ? options.action : options.actionKey;
@@ -3725,26 +4025,7 @@ var listActionInputFieldsPlugin = definePlugin(
3725
4025
  }
3726
4026
  })
3727
4027
  );
3728
- var InputFieldChoiceItemSchema = withFormatter(NeedChoicesSchema, {
3729
- format: (item) => {
3730
- const title = item.label || item.key || "Choice";
3731
- const details = [];
3732
- if (item.label && item.key && item.label !== item.key) {
3733
- details.push({ text: `Key: ${item.key}`, style: "dim" });
3734
- }
3735
- if (item.sample && item.sample !== item.key) {
3736
- details.push({ text: `Sample: ${item.sample}`, style: "dim" });
3737
- }
3738
- if (item.value && item.value !== item.key) {
3739
- details.push({ text: `Value: ${item.value}`, style: "normal" });
3740
- }
3741
- return {
3742
- title,
3743
- key: item.key,
3744
- details
3745
- };
3746
- }
3747
- });
4028
+ var InputFieldChoiceItemSchema = NeedChoicesSchema;
3748
4029
  var ListActionInputFieldChoicesDescription = "Get the available choices for a dynamic dropdown input field";
3749
4030
  var ListActionInputFieldChoicesBaseSchema = z.object({
3750
4031
  connection: ConnectionPropertySchema.optional().describe(
@@ -3788,6 +4069,24 @@ var ListActionInputFieldChoicesInputSchema = z.union([
3788
4069
  ListActionInputFieldChoicesSchemaDeprecated
3789
4070
  ]).describe(ListActionInputFieldChoicesDescription);
3790
4071
 
4072
+ // src/formatters/inputFieldChoice.ts
4073
+ var inputFieldChoiceItemFormatter = {
4074
+ format: (item) => {
4075
+ const title = item.label || item.key || "Choice";
4076
+ const details = [];
4077
+ if (item.label && item.key && item.label !== item.key) {
4078
+ details.push({ text: `Key: ${item.key}`, style: "dim" });
4079
+ }
4080
+ if (item.sample && item.sample !== item.key) {
4081
+ details.push({ text: `Sample: ${item.sample}`, style: "dim" });
4082
+ }
4083
+ if (item.value && item.value !== item.key) {
4084
+ details.push({ text: `Value: ${item.value}`, style: "normal" });
4085
+ }
4086
+ return { title, key: item.key, details };
4087
+ }
4088
+ };
4089
+
3791
4090
  // src/plugins/listActionInputFieldChoices/index.ts
3792
4091
  function transformNeedChoicesToInputFieldChoiceItem(choice) {
3793
4092
  return {
@@ -3805,6 +4104,7 @@ var listActionInputFieldChoicesPlugin = definePlugin(
3805
4104
  itemType: "InputFieldChoice",
3806
4105
  inputSchema: ListActionInputFieldChoicesInputSchema,
3807
4106
  outputSchema: InputFieldChoiceItemSchema,
4107
+ formatter: inputFieldChoiceItemFormatter,
3808
4108
  defaultPageSize: DEFAULT_PAGE_SIZE,
3809
4109
  resolvers: {
3810
4110
  app: appKeyResolver,
@@ -3814,10 +4114,7 @@ var listActionInputFieldChoicesPlugin = definePlugin(
3814
4114
  inputField: inputFieldKeyResolver,
3815
4115
  inputs: inputsAllOptionalResolver
3816
4116
  },
3817
- handler: async ({
3818
- sdk: sdk2,
3819
- options
3820
- }) => {
4117
+ handler: async ({ sdk: sdk2, options }) => {
3821
4118
  const { api, getVersionedImplementationId } = sdk2.context;
3822
4119
  const appKey = "app" in options ? options.app : options.appKey;
3823
4120
  const actionKey = "action" in options ? options.action : options.actionKey;
@@ -4069,7 +4366,10 @@ var ListConnectionsQuerySchema = ListConnectionsQuerySchema$1.omit({
4069
4366
  // SDK specific property for pagination/iterable helpers
4070
4367
  cursor: z.string().optional().describe("Cursor to start from")
4071
4368
  }).describe("List available connections with optional filtering");
4072
- var ConnectionItemSchema = withFormatter(ConnectionItemSchema$1, {
4369
+ var ConnectionItemSchema = ConnectionItemSchema$1;
4370
+
4371
+ // src/formatters/connection.ts
4372
+ var connectionItemFormatter = {
4073
4373
  format: (item) => {
4074
4374
  const details = [];
4075
4375
  if (item.identifier) {
@@ -4094,17 +4394,19 @@ var ConnectionItemSchema = withFormatter(ConnectionItemSchema$1, {
4094
4394
  details
4095
4395
  };
4096
4396
  }
4097
- });
4397
+ };
4098
4398
 
4099
4399
  // src/plugins/listConnections/index.ts
4100
4400
  var listConnectionsPlugin = definePlugin(
4101
4401
  (sdk) => createPaginatedPluginMethod(sdk, {
4402
+ ...zapierPagination,
4102
4403
  name: "listConnections",
4103
4404
  categories: ["connection"],
4104
4405
  type: "list",
4105
4406
  itemType: "Connection",
4106
4407
  inputSchema: ListConnectionsQuerySchema,
4107
4408
  outputSchema: ConnectionItemSchema,
4409
+ formatter: connectionItemFormatter,
4108
4410
  defaultPageSize: DEFAULT_PAGE_SIZE,
4109
4411
  resolvers: { app: appKeyResolver },
4110
4412
  handler: async ({ sdk: sdk2, options }) => {
@@ -4177,8 +4479,7 @@ var listConnectionsPlugin = definePlugin(
4177
4479
  ...response,
4178
4480
  data: response.data.map(transformConnectionItem)
4179
4481
  };
4180
- },
4181
- extractCursor: (response) => extractCursor(response.links)
4482
+ }
4182
4483
  })
4183
4484
  );
4184
4485
  var ListClientCredentialsQuerySchema = ListClientCredentialsQuerySchema$1.omit({
@@ -4192,58 +4493,49 @@ var ListClientCredentialsQuerySchema = ListClientCredentialsQuerySchema$1.omit({
4192
4493
  // SDK specific property for pagination/iterable helpers
4193
4494
  cursor: z.string().optional().describe("Cursor to start from")
4194
4495
  }).describe("List client credentials for the authenticated user");
4195
- var ClientCredentialsItemSchema = withFormatter(
4196
- ClientCredentialsItemSchema$1,
4197
- {
4198
- format: (item) => {
4199
- const details = [];
4200
- if (item.allowed_scopes && item.allowed_scopes.length > 0) {
4201
- details.push({
4202
- text: `Scopes: ${item.allowed_scopes.join(", ")}`,
4203
- style: "accent"
4204
- });
4205
- }
4206
- if (item.created_at) {
4207
- details.push({
4208
- text: `Created: ${new Date(item.created_at).toLocaleDateString()}`,
4209
- style: "dim"
4210
- });
4211
- }
4212
- return {
4213
- title: item.name,
4214
- id: item.client_id,
4215
- details
4216
- };
4496
+ var ClientCredentialsItemSchema = ClientCredentialsItemSchema$1;
4497
+ var ClientCredentialsCreatedItemSchema = ClientCredentialsCreatedItemSchema$1;
4498
+
4499
+ // src/formatters/clientCredentials.ts
4500
+ var clientCredentialsItemFormatter = {
4501
+ format: (item) => {
4502
+ const details = [];
4503
+ if (item.allowed_scopes && item.allowed_scopes.length > 0) {
4504
+ details.push({
4505
+ text: `Scopes: ${item.allowed_scopes.join(", ")}`,
4506
+ style: "accent"
4507
+ });
4217
4508
  }
4218
- }
4219
- );
4220
- var ClientCredentialsCreatedItemSchema = withFormatter(
4221
- ClientCredentialsCreatedItemSchema$1,
4222
- {
4223
- format: (item) => {
4224
- return {
4225
- title: item.name,
4226
- id: item.client_id,
4227
- details: [
4228
- {
4229
- text: `Client Secret: ${item.client_secret}`,
4230
- style: "accent"
4231
- }
4232
- ]
4233
- };
4509
+ if (item.created_at) {
4510
+ details.push({
4511
+ text: `Created: ${new Date(item.created_at).toLocaleDateString()}`,
4512
+ style: "dim"
4513
+ });
4234
4514
  }
4515
+ return { title: item.name, id: item.client_id, details };
4235
4516
  }
4236
- );
4517
+ };
4518
+ var clientCredentialsCreatedItemFormatter = {
4519
+ format: (item) => ({
4520
+ title: item.name,
4521
+ id: item.client_id,
4522
+ details: [
4523
+ { text: `Client Secret: ${item.client_secret}`, style: "accent" }
4524
+ ]
4525
+ })
4526
+ };
4237
4527
 
4238
4528
  // src/plugins/listClientCredentials/index.ts
4239
4529
  var listClientCredentialsPlugin = definePlugin(
4240
4530
  (sdk) => createPaginatedPluginMethod(sdk, {
4531
+ ...zapierPagination,
4241
4532
  name: "listClientCredentials",
4242
4533
  categories: ["client-credentials"],
4243
4534
  type: "list",
4244
4535
  itemType: "ClientCredentials",
4245
4536
  inputSchema: ListClientCredentialsQuerySchema,
4246
4537
  outputSchema: ClientCredentialsItemSchema,
4538
+ formatter: clientCredentialsItemFormatter,
4247
4539
  defaultPageSize: DEFAULT_PAGE_SIZE,
4248
4540
  handler: async ({
4249
4541
  sdk: sdk2,
@@ -4264,8 +4556,7 @@ var listClientCredentialsPlugin = definePlugin(
4264
4556
  requiredScopes: ["credentials"]
4265
4557
  }
4266
4558
  );
4267
- },
4268
- extractCursor: (response) => extractCursor(response.links)
4559
+ }
4269
4560
  })
4270
4561
  );
4271
4562
  var CreateClientCredentialsSchema = CreateClientCredentialsRequestSchema.omit({ allowed_scopes: true }).extend({
@@ -4283,6 +4574,7 @@ var createClientCredentialsPlugin = definePlugin(
4283
4574
  itemType: "ClientCredentials",
4284
4575
  inputSchema: CreateClientCredentialsSchema,
4285
4576
  outputSchema: ClientCredentialsCreatedItemSchema,
4577
+ formatter: clientCredentialsCreatedItemFormatter,
4286
4578
  confirm: "create-secret",
4287
4579
  resolvers: { name: clientCredentialsNameResolver },
4288
4580
  handler: async ({ sdk: sdk2, options }) => {
@@ -4349,6 +4641,7 @@ var getAppPlugin = definePlugin(
4349
4641
  itemType: "App",
4350
4642
  inputSchema: GetAppInputSchema,
4351
4643
  outputSchema: AppItemSchema,
4644
+ formatter: appItemFormatter,
4352
4645
  resolvers: { app: appKeyResolver },
4353
4646
  handler: async ({ sdk: sdk2, options }) => {
4354
4647
  const appKey = "app" in options ? options.app : options.appKey;
@@ -4382,6 +4675,7 @@ var getActionPlugin = definePlugin(
4382
4675
  itemType: "Action",
4383
4676
  inputSchema: GetActionInputSchema,
4384
4677
  outputSchema: ActionItemSchema,
4678
+ formatter: actionItemFormatter,
4385
4679
  resolvers: {
4386
4680
  app: appKeyResolver,
4387
4681
  actionType: actionTypeResolver,
@@ -4428,6 +4722,7 @@ var getConnectionPlugin = definePlugin(
4428
4722
  itemType: "Connection",
4429
4723
  inputSchema: GetConnectionParamSchema,
4430
4724
  outputSchema: ConnectionItemSchema,
4725
+ formatter: connectionItemFormatter,
4431
4726
  resolvers: { connection: connectionIdGenericResolver },
4432
4727
  handler: async ({ sdk: sdk2, options }) => {
4433
4728
  const { api } = sdk2.context;
@@ -4468,6 +4763,7 @@ var findFirstConnectionPlugin = definePlugin(
4468
4763
  itemType: "Connection",
4469
4764
  inputSchema: FindFirstConnectionSchema,
4470
4765
  outputSchema: ConnectionItemSchema,
4766
+ formatter: connectionItemFormatter,
4471
4767
  handler: async ({ sdk: sdk2, options = {} }) => {
4472
4768
  const connectionsResponse = await sdk2.listConnections({
4473
4769
  ...options,
@@ -4503,6 +4799,7 @@ var findUniqueConnectionPlugin = definePlugin(
4503
4799
  itemType: "Connection",
4504
4800
  inputSchema: FindUniqueConnectionSchema,
4505
4801
  outputSchema: ConnectionItemSchema,
4802
+ formatter: connectionItemFormatter,
4506
4803
  handler: async ({ sdk: sdk2, options = {} }) => {
4507
4804
  const connectionsResponse = await sdk2.listConnections({
4508
4805
  ...options,
@@ -4560,6 +4857,29 @@ var RunActionSchemaDeprecated = z.object({
4560
4857
  actionKey: ActionKeyPropertySchema
4561
4858
  }).merge(RunActionBaseSchema);
4562
4859
  var RunActionInputSchema = z.union([RunActionSchema, RunActionSchemaDeprecated]).describe(RunActionDescription);
4860
+
4861
+ // src/formatters/actionResult.ts
4862
+ function getStringProperty(obj, key) {
4863
+ if (typeof obj === "object" && obj !== null && key in obj) {
4864
+ const value = obj[key];
4865
+ return typeof value === "string" ? value : void 0;
4866
+ }
4867
+ return void 0;
4868
+ }
4869
+ var actionResultItemFormatter = {
4870
+ format: (item) => {
4871
+ const obj = typeof item === "object" && item !== null ? item : {};
4872
+ const title = getStringProperty(obj, "title") || getStringProperty(obj, "name") || getStringProperty(obj, "label") || getStringProperty(obj, "subject") || "Action Result";
4873
+ return {
4874
+ title,
4875
+ id: getStringProperty(obj, "id"),
4876
+ key: getStringProperty(obj, "key"),
4877
+ description: getStringProperty(obj, "description"),
4878
+ data: item,
4879
+ details: []
4880
+ };
4881
+ }
4882
+ };
4563
4883
  async function executeAction(actionOptions) {
4564
4884
  const {
4565
4885
  api,
@@ -4689,6 +5009,7 @@ var runActionPlugin = definePlugin(
4689
5009
  itemType: "ActionResult",
4690
5010
  inputSchema: RunActionInputSchema,
4691
5011
  outputSchema: ActionResultItemSchema,
5012
+ formatter: actionResultItemFormatter,
4692
5013
  resolvers: {
4693
5014
  app: appKeyResolver,
4694
5015
  actionType: actionTypeResolver,
@@ -4696,10 +5017,7 @@ var runActionPlugin = definePlugin(
4696
5017
  connection: connectionIdResolver,
4697
5018
  inputs: inputsResolver
4698
5019
  },
4699
- handler: async ({
4700
- sdk: sdk2,
4701
- options
4702
- }) => {
5020
+ handler: async ({ sdk: sdk2, options }) => {
4703
5021
  const { api } = sdk2.context;
4704
5022
  const appKey = "app" in options ? options.app : options.appKey;
4705
5023
  const actionKey = "action" in options ? options.action : options.actionKey;
@@ -4752,7 +5070,9 @@ var runActionPlugin = definePlugin(
4752
5070
  }
4753
5071
  return {
4754
5072
  data: result.results || [],
4755
- nextCursor: result.next_page
5073
+ // Coerce to a string: the API returns a numeric page index, but
5074
+ // `SdkPage.nextCursor` is a string (and the page guard enforces it).
5075
+ nextCursor: result.next_page != null ? String(result.next_page) : void 0
4756
5076
  };
4757
5077
  }
4758
5078
  });
@@ -4782,26 +5102,19 @@ var RelayRequestSchema = z.object({
4782
5102
  var RelayFetchSchema = RelayRequestSchema;
4783
5103
 
4784
5104
  // src/utils/logging.ts
4785
- var loggedDeprecations = /* @__PURE__ */ new Set();
4786
- function logDeprecation(message) {
4787
- if (loggedDeprecations.has(message)) return;
4788
- loggedDeprecations.add(message);
4789
- console.warn(`[zapier-sdk] Deprecation: ${message}`);
4790
- }
4791
- function resetDeprecationWarnings() {
4792
- loggedDeprecations.clear();
4793
- }
5105
+ var { logDeprecation: logDeprecation2, resetDeprecationWarnings: resetDeprecationWarnings2 } = createDeprecationLogger("zapier-sdk");
4794
5106
 
4795
5107
  // src/plugins/request/index.ts
4796
5108
  var requestPlugin = definePlugin(
4797
5109
  (sdk) => createPluginMethod(sdk, {
4798
5110
  name: "request",
4799
5111
  packages: ["cli", "mcp"],
4800
- categories: ["http", "deprecated"],
5112
+ categories: ["http"],
5113
+ deprecation: { message: "Use fetch() instead." },
4801
5114
  returnType: "Response",
4802
5115
  inputSchema: RelayRequestSchema,
4803
5116
  handler: async ({ sdk: sdk2, options }) => {
4804
- logDeprecation("request() is deprecated. Use fetch() instead.");
5117
+ logDeprecation2("request() is deprecated. Use fetch() instead.");
4805
5118
  const {
4806
5119
  url,
4807
5120
  method,
@@ -5021,7 +5334,7 @@ async function listAppsForSlugsPage({
5021
5334
  data: implementationsEnvelope.results.map(
5022
5335
  normalizeImplementationMetaToAppItem
5023
5336
  ),
5024
- nextCursor: extractCursor(implementationsEnvelope)
5337
+ nextCursor: implementationsEnvelope.next ? extractCursorFromUrl(implementationsEnvelope.next) : void 0
5025
5338
  };
5026
5339
  }
5027
5340
  function findManifestEntry({
@@ -5299,36 +5612,36 @@ var manifestPlugin = definePlugin(
5299
5612
  }
5300
5613
  );
5301
5614
  var GetProfileSchema = z.object({}).optional().describe("Get current user's profile information");
5302
- var UserProfileItemSchema = withFormatter(
5303
- z.object({
5304
- id: z.string(),
5305
- first_name: z.string(),
5306
- last_name: z.string(),
5307
- full_name: z.string(),
5308
- email: z.string(),
5309
- email_confirmed: z.boolean(),
5310
- timezone: z.string()
5311
- }),
5312
- {
5313
- format: (item) => {
5314
- const details = [];
5315
- if ("email" in item) {
5316
- details.push({ text: item.email, style: "dim" });
5317
- }
5318
- if ("timezone" in item && item.timezone) {
5319
- details.push({
5320
- text: `Timezone: ${item.timezone}`,
5321
- style: "accent"
5322
- });
5323
- }
5324
- return {
5325
- title: item.full_name,
5326
- id: item.id,
5327
- details
5328
- };
5615
+ var UserProfileItemSchema = z.object({
5616
+ id: z.string(),
5617
+ first_name: z.string(),
5618
+ last_name: z.string(),
5619
+ full_name: z.string(),
5620
+ email: z.string(),
5621
+ email_confirmed: z.boolean(),
5622
+ timezone: z.string()
5623
+ });
5624
+
5625
+ // src/formatters/userProfile.ts
5626
+ var userProfileItemFormatter = {
5627
+ format: (item) => {
5628
+ const details = [];
5629
+ if (item.email) {
5630
+ details.push({ text: item.email, style: "dim" });
5631
+ }
5632
+ if (item.timezone) {
5633
+ details.push({
5634
+ text: `Timezone: ${item.timezone}`,
5635
+ style: "accent"
5636
+ });
5329
5637
  }
5638
+ return {
5639
+ title: item.full_name,
5640
+ id: item.id,
5641
+ details
5642
+ };
5330
5643
  }
5331
- );
5644
+ };
5332
5645
 
5333
5646
  // src/plugins/getProfile/index.ts
5334
5647
  var getProfilePlugin = definePlugin(
@@ -5339,6 +5652,7 @@ var getProfilePlugin = definePlugin(
5339
5652
  itemType: "Profile",
5340
5653
  inputSchema: GetProfileSchema,
5341
5654
  outputSchema: UserProfileItemSchema,
5655
+ formatter: userProfileItemFormatter,
5342
5656
  handler: async ({ sdk: sdk2 }) => {
5343
5657
  const profile = await sdk2.context.api.get(
5344
5658
  "/zapier/api/v4/profile/",
@@ -5435,7 +5749,7 @@ function createDebugLogger(enabled) {
5435
5749
  }
5436
5750
  return (message, data) => {
5437
5751
  if (data === void 0 || data === "") {
5438
- console.log(`[Zapier SDK] ${message}`);
5752
+ console.error(`[Zapier SDK] ${message}`);
5439
5753
  return;
5440
5754
  }
5441
5755
  if (utilModule) {
@@ -5444,9 +5758,9 @@ function createDebugLogger(enabled) {
5444
5758
  depth: null,
5445
5759
  breakLength: 80
5446
5760
  });
5447
- console.log(`[Zapier SDK] ${message}`, formatted);
5761
+ console.error(`[Zapier SDK] ${message}`, formatted);
5448
5762
  } else {
5449
- console.log(`[Zapier SDK] ${message}`, data);
5763
+ console.error(`[Zapier SDK] ${message}`, data);
5450
5764
  }
5451
5765
  };
5452
5766
  }
@@ -5645,7 +5959,8 @@ async function pollUntilComplete(options) {
5645
5959
  pendingStatus = DEFAULT_PENDING_STATUS,
5646
5960
  isPending,
5647
5961
  resultExtractor = (response) => response,
5648
- signal
5962
+ signal,
5963
+ maxPollingIntervalMs
5649
5964
  } = options;
5650
5965
  if (timeoutMs <= 0) {
5651
5966
  throw new ZapierValidationError("Timeout must be greater than 0", {
@@ -5657,6 +5972,14 @@ async function pollUntilComplete(options) {
5657
5972
  details: { initialDelay }
5658
5973
  });
5659
5974
  }
5975
+ if (maxPollingIntervalMs !== void 0 && maxPollingIntervalMs <= 0) {
5976
+ throw new ZapierValidationError(
5977
+ "Max polling interval must be greater than 0",
5978
+ {
5979
+ details: { maxPollingIntervalMs }
5980
+ }
5981
+ );
5982
+ }
5660
5983
  if (signal?.aborted) throw makeAbortError();
5661
5984
  const startTime = Date.now();
5662
5985
  let attempts = 0;
@@ -5679,7 +6002,8 @@ async function pollUntilComplete(options) {
5679
6002
  if (attempts > 0) {
5680
6003
  const interval = getPollingInterval(elapsedTime);
5681
6004
  const waitTime = calculateErrorBackoffMs(interval, errorCount);
5682
- await sleep(waitTime, signal);
6005
+ const cappedWaitTime = maxPollingIntervalMs === void 0 ? waitTime : Math.min(waitTime, maxPollingIntervalMs);
6006
+ await sleep(cappedWaitTime, signal);
5683
6007
  if (signal?.aborted) throw makeAbortError();
5684
6008
  }
5685
6009
  attempts++;
@@ -5962,17 +6286,17 @@ function resolveCredentialsFromEnv(sdkBaseUrl) {
5962
6286
  }
5963
6287
  }
5964
6288
  if (globalThis.process?.env?.ZAPIER_TOKEN) {
5965
- logDeprecation(
6289
+ logDeprecation2(
5966
6290
  "ZAPIER_TOKEN is deprecated. Use ZAPIER_CREDENTIALS instead."
5967
6291
  );
5968
6292
  return globalThis.process?.env?.ZAPIER_TOKEN;
5969
6293
  }
5970
6294
  if (globalThis.process?.env?.ZAPIER_AUTH_CLIENT_ID) {
5971
- logDeprecation(
6295
+ logDeprecation2(
5972
6296
  "ZAPIER_AUTH_CLIENT_ID is deprecated. Use ZAPIER_CREDENTIALS_CLIENT_ID instead."
5973
6297
  );
5974
6298
  if (globalThis.process?.env?.ZAPIER_AUTH_BASE_URL) {
5975
- logDeprecation(
6299
+ logDeprecation2(
5976
6300
  "ZAPIER_AUTH_BASE_URL is deprecated. Use ZAPIER_CREDENTIALS_BASE_URL instead."
5977
6301
  );
5978
6302
  }
@@ -6006,7 +6330,7 @@ async function resolveCredentials(options = {}) {
6006
6330
  return options.credentials;
6007
6331
  }
6008
6332
  if (options.token !== void 0) {
6009
- logDeprecation(
6333
+ logDeprecation2(
6010
6334
  "The `token` option is deprecated. Use `credentials` instead."
6011
6335
  );
6012
6336
  return options.token;
@@ -6248,7 +6572,7 @@ async function tryStoredClientCredentialToken(options) {
6248
6572
  const cached = await readCachedToken(cacheKey, cache);
6249
6573
  if (cached !== void 0) {
6250
6574
  if (options.debug)
6251
- console.log(
6575
+ console.error(
6252
6576
  `[auth] Using cached token (clientId: ${activeCredential.clientId})`
6253
6577
  );
6254
6578
  emitAuthResolved(options.onEvent, "client_credentials");
@@ -6267,7 +6591,7 @@ async function tryStoredClientCredentialToken(options) {
6267
6591
  );
6268
6592
  }
6269
6593
  if (options.debug)
6270
- console.log(
6594
+ console.error(
6271
6595
  `[auth] Using stored client credential (clientId: ${storedCredential.clientId})`
6272
6596
  );
6273
6597
  const token = await resolveAuthTokenFromCredentials(
@@ -6289,7 +6613,7 @@ async function resolveAuthToken(options = {}) {
6289
6613
  const storedToken = await tryStoredClientCredentialToken(options);
6290
6614
  if (storedToken !== void 0) return storedToken;
6291
6615
  if (options.debug) {
6292
- console.log("[auth] Using JWT (no stored client credential found)");
6616
+ console.error("[auth] Using JWT (no stored client credential found)");
6293
6617
  }
6294
6618
  const jwtToken = await getTokenFromCliLogin({
6295
6619
  onEvent: options.onEvent,
@@ -6319,7 +6643,7 @@ async function resolveAuthTokenFromCredentials(credentials, options) {
6319
6643
  const cached = await readCachedToken(cacheKey, cache);
6320
6644
  if (cached !== void 0) {
6321
6645
  if (options.debug) {
6322
- console.log(`[auth] Using cached token (clientId: ${clientId})`);
6646
+ console.error(`[auth] Using cached token (clientId: ${clientId})`);
6323
6647
  }
6324
6648
  return cached;
6325
6649
  }
@@ -6329,7 +6653,7 @@ async function resolveAuthTokenFromCredentials(credentials, options) {
6329
6653
  const recheck = await readCachedToken(cacheKey, cache);
6330
6654
  if (recheck !== void 0) {
6331
6655
  if (options.debug) {
6332
- console.log(
6656
+ console.error(
6333
6657
  `[auth] Using cached token (clientId: ${clientId}, locked recheck)`
6334
6658
  );
6335
6659
  }
@@ -6392,7 +6716,7 @@ async function invalidateCredentialsToken(options) {
6392
6716
  }
6393
6717
 
6394
6718
  // src/sdk-version.ts
6395
- var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.65.0" : void 0) || "unknown";
6719
+ var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.68.0" : void 0) || "unknown";
6396
6720
 
6397
6721
  // src/utils/open-url.ts
6398
6722
  var nodePrefix = "node:";
@@ -6477,6 +6801,7 @@ var PollApprovalResponseSchema = z.object({
6477
6801
  status: ApprovalStatusSchema,
6478
6802
  approval_id: z.string()
6479
6803
  });
6804
+ var APPROVAL_MAX_POLLING_INTERVAL_MS = 5e3;
6480
6805
  function parseRateLimitHeaders(response) {
6481
6806
  const info = {};
6482
6807
  const retryAfter = response.headers.get("retry-after");
@@ -7185,6 +7510,7 @@ var ZapierApiClient = class {
7185
7510
  })
7186
7511
  ),
7187
7512
  timeoutMs,
7513
+ maxPollingIntervalMs: APPROVAL_MAX_POLLING_INTERVAL_MS,
7188
7514
  isPending: (body2) => {
7189
7515
  const parsed = PollApprovalResponseSchema.safeParse(body2);
7190
7516
  return parsed.success && parsed.data.status === "pending_approval";
@@ -7552,6 +7878,7 @@ var tablesDefaults = {
7552
7878
  var listTablesPlugin = definePlugin(
7553
7879
  (sdk) => createPaginatedPluginMethod(sdk, {
7554
7880
  ...tablesDefaults,
7881
+ ...zapierPagination,
7555
7882
  name: "listTables",
7556
7883
  type: "list",
7557
7884
  itemType: "Table",
@@ -7607,8 +7934,7 @@ var listTablesPlugin = definePlugin(
7607
7934
  data: response.data.map(transformTableItem),
7608
7935
  links: response.links
7609
7936
  };
7610
- },
7611
- extractCursor: (response) => extractCursor(response.links)
7937
+ }
7612
7938
  })
7613
7939
  );
7614
7940
  var GetTableApiResponseSchema = z.object({
@@ -7711,6 +8037,15 @@ var deleteTablePlugin = definePlugin(
7711
8037
  })
7712
8038
  );
7713
8039
 
8040
+ // src/formatters/tableField.ts
8041
+ var tableFieldItemFormatter = {
8042
+ format: (item) => ({
8043
+ title: item.name,
8044
+ id: item.id,
8045
+ details: [{ text: `Type: ${item.type}`, style: "dim" }]
8046
+ })
8047
+ };
8048
+
7714
8049
  // src/plugins/tables/listTableFields/index.ts
7715
8050
  var listTableFieldsPlugin = definePlugin(
7716
8051
  (sdk) => createPluginMethod(sdk, {
@@ -7720,6 +8055,7 @@ var listTableFieldsPlugin = definePlugin(
7720
8055
  itemType: "Field",
7721
8056
  inputSchema: ListTableFieldsOptionsInputSchema,
7722
8057
  outputSchema: FieldItemSchema,
8058
+ formatter: tableFieldItemFormatter,
7723
8059
  resolvers: { table: tableIdResolver },
7724
8060
  handler: async ({ sdk: sdk2, options }) => {
7725
8061
  const { api } = sdk2.context;
@@ -7792,6 +8128,7 @@ var createTableFieldsPlugin = definePlugin(
7792
8128
  returnType: "FieldItem[]",
7793
8129
  inputSchema: CreateTableFieldsOptionsInputSchema,
7794
8130
  outputSchema: FieldItemSchema,
8131
+ formatter: tableFieldItemFormatter,
7795
8132
  resolvers: { table: tableIdResolver, fields: tableFieldsResolver },
7796
8133
  handler: async ({ sdk: sdk2, options }) => {
7797
8134
  const tableId = "table" in options ? options.table : options.tableId;
@@ -7870,21 +8207,13 @@ var RecordApiItemSchema = z.object({
7870
8207
  is_source_record: z.boolean().nullable().optional(),
7871
8208
  deleted_at: z.string().nullable().optional()
7872
8209
  });
7873
- var RecordItemSchemaBase = z.object({
8210
+ var RecordItemSchema = z.object({
7874
8211
  id: z.string(),
7875
8212
  data: z.record(z.string(), z.unknown()),
7876
8213
  created_at: z.string(),
7877
8214
  edited_at: z.string(),
7878
8215
  deleted_at: z.string().nullable().optional()
7879
8216
  });
7880
- var RecordItemSchema = withFormatter(RecordItemSchemaBase, {
7881
- format: (item) => ({
7882
- title: `Record ${item.id}`,
7883
- id: item.id,
7884
- data: item.data,
7885
- details: []
7886
- })
7887
- });
7888
8217
  var GetTableRecordApiResponseSchema = z.object({
7889
8218
  data: RecordApiItemSchema
7890
8219
  });
@@ -7908,9 +8237,9 @@ var tableRecordFormatter = {
7908
8237
  if (context) return context;
7909
8238
  const hasFieldIds = Object.keys(item.data).some(isFieldId);
7910
8239
  if (!hasFieldIds) return {};
7911
- const { data: fields } = await sdk.listTableFields({
7912
- table: params.tableId
7913
- });
8240
+ const table = params.table ?? params.tableId;
8241
+ if (!table) return {};
8242
+ const { data: fields } = await sdk.listTableFields({ table });
7914
8243
  return Object.fromEntries(fields.map((f) => [f.id, f.name]));
7915
8244
  },
7916
8245
  format: (item, fieldLabels) => ({
@@ -8035,10 +8364,7 @@ var listTableRecordsPlugin = definePlugin(
8035
8364
  sort: tableSortResolver
8036
8365
  },
8037
8366
  formatter: tableRecordFormatter,
8038
- handler: async ({
8039
- sdk: sdk2,
8040
- options
8041
- }) => {
8367
+ handler: async ({ sdk: sdk2, options }) => {
8042
8368
  const { api } = sdk2.context;
8043
8369
  const tableId = "table" in options ? options.table : options.tableId;
8044
8370
  const translator = await createFieldKeyTranslator({
@@ -8288,85 +8614,13 @@ var updateTableRecordsPlugin = definePlugin(
8288
8614
  }
8289
8615
  })
8290
8616
  );
8291
- function canonicalInputSchema(schema) {
8292
- if (schema instanceof z.ZodUnion) {
8293
- return schema.options[0];
8294
- }
8295
- return schema;
8296
- }
8297
- var categoryDefinitions = {
8298
- account: { title: "Account" },
8299
- app: { title: "App", titlePlural: "Apps" },
8300
- connection: { title: "Connection" },
8301
- action: { title: "Action" },
8302
- "client-credentials": {
8303
- title: "Client Credentials",
8304
- titlePlural: "Client Credentials"
8305
- },
8306
- table: { title: "Table" },
8307
- trigger: { title: "Trigger" },
8308
- "code-workflow": {
8309
- title: "Code Workflow",
8310
- titlePlural: "Code Workflows"
8311
- },
8312
- http: { title: "HTTP Request" },
8313
- utility: { title: "Utility", titlePlural: "Utilities" },
8314
- other: { title: "Other" }
8315
- };
8316
- var knownCategories = Object.keys(categoryDefinitions);
8317
- function buildRegistry({
8318
- sdk,
8319
- meta,
8320
- packageFilter
8321
- }) {
8322
- const functions = Object.keys(meta).filter((key) => {
8323
- const property = sdk[key];
8324
- if (typeof property === "function") return true;
8325
- const [rootKey] = key.split(".");
8326
- const rootProperty = sdk[rootKey];
8327
- return typeof rootProperty === "object" && rootProperty !== null;
8328
- }).map((key) => {
8329
- const m = meta[key];
8330
- return {
8331
- name: key,
8332
- description: m.description,
8333
- type: m.type,
8334
- itemType: m.itemType,
8335
- returnType: m.returnType,
8336
- inputSchema: canonicalInputSchema(m.inputSchema),
8337
- inputParameters: m.inputParameters,
8338
- outputSchema: m.outputSchema,
8339
- categories: m.categories || [],
8340
- resolvers: m.resolvers,
8341
- formatter: m.formatter,
8342
- experimental: m.experimental,
8343
- packages: m.packages,
8344
- confirm: m.confirm ?? (m.type === "delete" ? "delete" : void 0),
8345
- deprecation: m.deprecation,
8346
- aliases: m.aliases,
8347
- supportsJsonOutput: m.supportsJsonOutput ?? true
8348
- };
8349
- }).sort((a, b) => a.name.localeCompare(b.name));
8350
- const filteredFunctions = packageFilter ? functions.filter((f) => !f.packages || f.packages.includes(packageFilter)) : functions;
8351
- const filteredCategories = knownCategories.slice().sort((a, b) => {
8352
- if (a === "other") return 1;
8353
- if (b === "other") return -1;
8354
- return categoryDefinitions[a].title.localeCompare(
8355
- categoryDefinitions[b].title
8356
- );
8357
- }).map((categoryKey) => {
8358
- const categoryFunctions = filteredFunctions.filter(
8359
- (f) => f.categories.includes(categoryKey) || categoryKey === "other" && !f.categories.some((c) => knownCategories.includes(c))
8360
- ).map((f) => f.name).sort();
8361
- const definition = categoryDefinitions[categoryKey];
8362
- return {
8363
- key: categoryKey,
8364
- title: definition.title,
8365
- titlePlural: definition.titlePlural ?? `${definition.title}s`,
8366
- functions: categoryFunctions
8367
- };
8368
- }).filter((category) => category.functions.length > 0);
8369
- return { functions: filteredFunctions, categories: filteredCategories };
8617
+
8618
+ // src/core-stack.ts
8619
+ var zapierCorePlugin = createCorePlugin({
8620
+ adaptError: zapierAdaptError
8621
+ });
8622
+ function createZapierCoreStack() {
8623
+ return createPluginStack().use(zapierCorePlugin);
8370
8624
  }
8371
8625
 
8372
8626
  // src/plugins/deprecated/authentications.ts
@@ -8377,11 +8631,13 @@ var listAuthenticationsPlugin = definePlugin(
8377
8631
  meta: {
8378
8632
  listAuthentications: {
8379
8633
  packages: ["cli", "mcp"],
8380
- categories: ["connection", "deprecated"],
8634
+ categories: ["connection"],
8635
+ deprecation: { message: "Use listConnections instead." },
8381
8636
  type: "list",
8382
8637
  itemType: "Connection",
8383
8638
  inputSchema: ListConnectionsQuerySchema,
8384
- outputSchema: ConnectionItemSchema
8639
+ outputSchema: ConnectionItemSchema,
8640
+ formatter: connectionItemFormatter
8385
8641
  }
8386
8642
  }
8387
8643
  }
@@ -8394,11 +8650,13 @@ var getAuthenticationPlugin = definePlugin(
8394
8650
  meta: {
8395
8651
  getAuthentication: {
8396
8652
  packages: ["cli", "mcp"],
8397
- categories: ["connection", "deprecated"],
8653
+ categories: ["connection"],
8654
+ deprecation: { message: "Use getConnection instead." },
8398
8655
  type: "item",
8399
8656
  itemType: "Connection",
8400
8657
  inputSchema: GetConnectionParamSchema,
8401
- outputSchema: ConnectionItemSchema
8658
+ outputSchema: ConnectionItemSchema,
8659
+ formatter: connectionItemFormatter
8402
8660
  }
8403
8661
  }
8404
8662
  }
@@ -8411,11 +8669,13 @@ var findFirstAuthenticationPlugin = definePlugin(
8411
8669
  meta: {
8412
8670
  findFirstAuthentication: {
8413
8671
  packages: ["cli", "mcp"],
8414
- categories: ["connection", "deprecated"],
8672
+ categories: ["connection"],
8673
+ deprecation: { message: "Use findFirstConnection instead." },
8415
8674
  type: "item",
8416
8675
  itemType: "Connection",
8417
8676
  inputSchema: FindFirstConnectionSchema,
8418
- outputSchema: ConnectionItemSchema
8677
+ outputSchema: ConnectionItemSchema,
8678
+ formatter: connectionItemFormatter
8419
8679
  }
8420
8680
  }
8421
8681
  }
@@ -8428,11 +8688,13 @@ var findUniqueAuthenticationPlugin = definePlugin(
8428
8688
  meta: {
8429
8689
  findUniqueAuthentication: {
8430
8690
  packages: ["cli", "mcp"],
8431
- categories: ["connection", "deprecated"],
8691
+ categories: ["connection"],
8692
+ deprecation: { message: "Use findUniqueConnection instead." },
8432
8693
  type: "item",
8433
8694
  itemType: "Connection",
8434
8695
  inputSchema: FindUniqueConnectionSchema,
8435
- outputSchema: ConnectionItemSchema
8696
+ outputSchema: ConnectionItemSchema,
8697
+ formatter: connectionItemFormatter
8436
8698
  }
8437
8699
  }
8438
8700
  }
@@ -8446,11 +8708,13 @@ var listInputFieldsDeprecatedPlugin = definePlugin(
8446
8708
  context: {
8447
8709
  meta: {
8448
8710
  listInputFields: {
8449
- categories: ["action", "deprecated"],
8711
+ categories: ["action"],
8712
+ deprecation: { message: "Use listActionInputFields instead." },
8450
8713
  type: "list",
8451
8714
  itemType: "RootField",
8452
8715
  inputSchema: ListActionInputFieldsInputSchema,
8453
8716
  outputSchema: RootFieldItemSchema,
8717
+ formatter: rootFieldItemFormatter,
8454
8718
  defaultPageSize: DEFAULT_PAGE_SIZE
8455
8719
  }
8456
8720
  }
@@ -8463,11 +8727,15 @@ var listInputFieldChoicesDeprecatedPlugin = definePlugin(
8463
8727
  context: {
8464
8728
  meta: {
8465
8729
  listInputFieldChoices: {
8466
- categories: ["action", "deprecated"],
8730
+ categories: ["action"],
8731
+ deprecation: {
8732
+ message: "Use listActionInputFieldChoices instead."
8733
+ },
8467
8734
  type: "list",
8468
8735
  itemType: "InputFieldChoiceItem",
8469
8736
  inputSchema: ListActionInputFieldChoicesInputSchema,
8470
8737
  outputSchema: InputFieldChoiceItemSchema,
8738
+ formatter: inputFieldChoiceItemFormatter,
8471
8739
  defaultPageSize: DEFAULT_PAGE_SIZE
8472
8740
  }
8473
8741
  }
@@ -8480,7 +8748,8 @@ var getInputFieldsSchemaDeprecatedPlugin = definePlugin(
8480
8748
  context: {
8481
8749
  meta: {
8482
8750
  getInputFieldsSchema: {
8483
- categories: ["action", "deprecated"],
8751
+ categories: ["action"],
8752
+ deprecation: { message: "Use getActionInputFieldsSchema instead." },
8484
8753
  type: "function",
8485
8754
  inputSchema: GetActionInputFieldsSchemaInputSchema
8486
8755
  }
@@ -8544,7 +8813,7 @@ function createConsoleTransport() {
8544
8813
  return {
8545
8814
  async emit(subject, event) {
8546
8815
  try {
8547
- console.log(
8816
+ console.error(
8548
8817
  "[SDK Telemetry]",
8549
8818
  JSON.stringify({ subject, properties: event }, null, 2)
8550
8819
  );
@@ -8753,6 +9022,35 @@ function buildMethodCalledEvent(data, context = {}) {
8753
9022
  };
8754
9023
  }
8755
9024
 
9025
+ // src/plugins/eventEmission/event-emission-hook.ts
9026
+ function computeArgumentCount(args) {
9027
+ if (args.length === 1) {
9028
+ const arg0 = args[0];
9029
+ if (arg0 !== null && typeof arg0 === "object" && !Array.isArray(arg0) && Object.getPrototypeOf(arg0) === Object.prototype) {
9030
+ return Object.keys(arg0).length;
9031
+ }
9032
+ }
9033
+ return args.filter((a) => a !== void 0).length;
9034
+ }
9035
+ function makeMethodEndHook(emitMethodCalled) {
9036
+ return ({ methodName, args, isPaginated, depth, durationMs, error }) => {
9037
+ if (depth > 0) return;
9038
+ const metadata = getMethodMetadata();
9039
+ emitMethodCalled({
9040
+ method_name: methodName,
9041
+ execution_duration_ms: durationMs,
9042
+ success_flag: !error,
9043
+ error_message: error?.message ?? null,
9044
+ error_type: error?.constructor.name ?? null,
9045
+ argument_count: computeArgumentCount(args),
9046
+ is_paginated: isPaginated,
9047
+ selected_api: metadata?.selectedApi ?? null,
9048
+ operation_type: metadata?.operationType ?? null,
9049
+ operation_key: metadata?.operationKey ?? null
9050
+ });
9051
+ };
9052
+ }
9053
+
8756
9054
  // src/plugins/eventEmission/index.ts
8757
9055
  var TELEMETRY_EMIT_TIMEOUT_MS = 300;
8758
9056
  var registeredListeners = {};
@@ -8883,6 +9181,8 @@ var eventEmissionPlugin = definePlugin(
8883
9181
  }
8884
9182
  }
8885
9183
  if (!config.enabled) {
9184
+ const noopEmitMethodCalled = () => {
9185
+ };
8886
9186
  return {
8887
9187
  context: {
8888
9188
  eventEmission: {
@@ -8900,12 +9200,13 @@ var eventEmissionPlugin = definePlugin(
8900
9200
  visitor_id: null,
8901
9201
  correlation_id: null
8902
9202
  }),
8903
- emitMethodCalled: () => {
8904
- },
8905
9203
  flush: async () => {
8906
9204
  },
8907
9205
  close: async () => {
8908
9206
  }
9207
+ },
9208
+ hooks: {
9209
+ onMethodEnd: makeMethodEndHook(noopEmitMethodCalled)
8909
9210
  }
8910
9211
  }
8911
9212
  };
@@ -9076,6 +9377,20 @@ var eventEmissionPlugin = definePlugin(
9076
9377
  );
9077
9378
  removeExistingListeners();
9078
9379
  };
9380
+ const emitMethodCalled = (data) => {
9381
+ const event = {
9382
+ ...buildMethodCalledEvent(data),
9383
+ call_context: config.callContext ?? "sdk"
9384
+ };
9385
+ trackEmission(
9386
+ silentEmit(
9387
+ transport,
9388
+ METHOD_CALLED_EVENT_SUBJECT,
9389
+ event,
9390
+ getUserContext
9391
+ )
9392
+ );
9393
+ };
9079
9394
  return {
9080
9395
  context: {
9081
9396
  eventEmission: {
@@ -9087,22 +9402,11 @@ var eventEmissionPlugin = definePlugin(
9087
9402
  );
9088
9403
  },
9089
9404
  createBaseEvent: createBaseEventHelper,
9090
- emitMethodCalled: (data) => {
9091
- const event = {
9092
- ...buildMethodCalledEvent(data),
9093
- call_context: config.callContext ?? "sdk"
9094
- };
9095
- trackEmission(
9096
- silentEmit(
9097
- transport,
9098
- METHOD_CALLED_EVENT_SUBJECT,
9099
- event,
9100
- getUserContext
9101
- )
9102
- );
9103
- },
9104
9405
  flush,
9105
9406
  close
9407
+ },
9408
+ hooks: {
9409
+ onMethodEnd: makeMethodEndHook(emitMethodCalled)
9106
9410
  }
9107
9411
  }
9108
9412
  };
@@ -9114,78 +9418,22 @@ function createOptionsPlugin(options) {
9114
9418
  return () => ({ context: { options } });
9115
9419
  }
9116
9420
  function createSdk() {
9117
- return buildSdk({}, { meta: {} });
9118
- }
9119
- function buildSdk(properties, context) {
9120
- const frozenContext = Object.freeze(context);
9121
- const registryCache = /* @__PURE__ */ new Map();
9122
- const sdk = {
9123
- ...properties,
9124
- get context() {
9125
- return frozenContext;
9126
- },
9127
- getContext: () => frozenContext,
9128
- // runtime compat shim, not in types
9129
- getRegistry(options) {
9130
- const cacheKey = options?.package ?? "__all__";
9131
- if (!registryCache.has(cacheKey)) {
9132
- registryCache.set(
9133
- cacheKey,
9134
- buildRegistry({
9135
- sdk,
9136
- meta: frozenContext.meta,
9137
- packageFilter: options?.package
9138
- })
9139
- );
9140
- }
9141
- return registryCache.get(cacheKey);
9142
- },
9143
- addPlugin(plugin, options) {
9144
- const pluginResult = plugin({
9145
- ...properties,
9146
- context: frozenContext
9147
- });
9148
- const { context: pluginContext, ...pluginProperties } = pluginResult;
9149
- const { meta: pluginMeta, ...pluginContextRest } = pluginContext ?? {};
9150
- const existingProperties = properties;
9151
- const existingContext = context;
9152
- const existingMeta = context.meta ?? {};
9153
- const collisions = [];
9154
- for (const key of Object.keys(pluginProperties)) {
9155
- if (key in existingProperties) collisions.push(`method "${key}"`);
9156
- }
9157
- for (const key of Object.keys(pluginContextRest)) {
9158
- if (key in existingContext) collisions.push(`context.${key}`);
9159
- }
9160
- if (collisions.length > 0 && !options?.override) {
9161
- const name = plugin.name || "anonymous plugin";
9162
- console.warn(
9163
- `[zapier-sdk] Skipping "${name}" \u2014 duplicate registration of: ${collisions.join(", ")}. If the duplicate is intentional, pass { override: true } to addPlugin or wrap with composePlugins(...). Otherwise rename the method or remove the duplicate.`
9164
- );
9165
- return buildSdk(properties, context);
9166
- }
9167
- const mergedProperties = { ...properties, ...pluginProperties };
9168
- const mergedContext = {
9169
- ...context,
9170
- ...pluginContextRest,
9171
- meta: { ...existingMeta, ...pluginMeta ?? {} }
9172
- };
9173
- return buildSdk(
9174
- mergedProperties,
9175
- mergedContext
9176
- );
9177
- }
9178
- };
9179
- return sdk;
9421
+ logDeprecation2(
9422
+ "createSdk() is deprecated. Build SDKs with createPluginStack().use(...).toSdk() instead. The chain pattern shares plugin closures (and their state) across derived SDKs in ways that are rarely what callers expect; stacks produce fresh closures per .toSdk() call."
9423
+ );
9424
+ return withDeprecatedAddPlugin(createZapierCoreStack().toSdk());
9180
9425
  }
9181
9426
  function createZapierSdkWithoutRegistry(options = {}) {
9182
- logDeprecation(
9427
+ logDeprecation2(
9183
9428
  "createZapierSdkWithoutRegistry is deprecated; use createZapierSdk instead. getRegistry is now available on every sdk."
9184
9429
  );
9185
9430
  return createZapierSdk(options);
9186
9431
  }
9432
+ function createZapierSdkStack(options = {}) {
9433
+ return createZapierCoreStack().use(createOptionsPlugin(options)).use(eventEmissionPlugin).use(apiPlugin).use(manifestPlugin).use(capabilitiesPlugin).use(connectionsPlugin).use(listAppsPlugin).use(getAppPlugin).use(listConnectionsPlugin).use(getConnectionPlugin).use(findFirstConnectionPlugin).use(findUniqueConnectionPlugin).use(listActionsPlugin).use(getActionPlugin).use(listActionInputFieldsPlugin).use(getActionInputFieldsSchemaPlugin).use(listActionInputFieldChoicesPlugin).use(listInputFieldsDeprecatedPlugin).use(getInputFieldsSchemaDeprecatedPlugin).use(listInputFieldChoicesDeprecatedPlugin).use(runActionPlugin).use(listAuthenticationsPlugin).use(getAuthenticationPlugin).use(findFirstAuthenticationPlugin).use(findUniqueAuthenticationPlugin).use(listClientCredentialsPlugin).use(createClientCredentialsPlugin).use(deleteClientCredentialsPlugin).use(fetchPlugin).use(requestPlugin).use(listTablesPlugin).use(getTablePlugin).use(deleteTablePlugin).use(createTablePlugin).use(listTableFieldsPlugin).use(createTableFieldsPlugin).use(deleteTableFieldsPlugin).use(listTableRecordsPlugin).use(getTableRecordPlugin).use(createTableRecordsPlugin).use(deleteTableRecordsPlugin).use(updateTableRecordsPlugin).use(appsPlugin).use(getProfilePlugin);
9434
+ }
9187
9435
  function createZapierSdk(options = {}) {
9188
- return createSdk().addPlugin(createOptionsPlugin(options)).addPlugin(eventEmissionPlugin).addPlugin(apiPlugin).addPlugin(manifestPlugin).addPlugin(capabilitiesPlugin).addPlugin(connectionsPlugin).addPlugin(listAppsPlugin).addPlugin(getAppPlugin).addPlugin(listActionsPlugin).addPlugin(getActionPlugin).addPlugin(listActionInputFieldsPlugin).addPlugin(getActionInputFieldsSchemaPlugin).addPlugin(listActionInputFieldChoicesPlugin).addPlugin(listInputFieldsDeprecatedPlugin).addPlugin(getInputFieldsSchemaDeprecatedPlugin).addPlugin(listInputFieldChoicesDeprecatedPlugin).addPlugin(runActionPlugin).addPlugin(listConnectionsPlugin).addPlugin(getConnectionPlugin).addPlugin(findFirstConnectionPlugin).addPlugin(findUniqueConnectionPlugin).addPlugin(listAuthenticationsPlugin).addPlugin(getAuthenticationPlugin).addPlugin(findFirstAuthenticationPlugin).addPlugin(findUniqueAuthenticationPlugin).addPlugin(listClientCredentialsPlugin).addPlugin(createClientCredentialsPlugin).addPlugin(deleteClientCredentialsPlugin).addPlugin(fetchPlugin).addPlugin(requestPlugin).addPlugin(listTablesPlugin).addPlugin(getTablePlugin).addPlugin(deleteTablePlugin).addPlugin(createTablePlugin).addPlugin(listTableFieldsPlugin).addPlugin(createTableFieldsPlugin).addPlugin(deleteTableFieldsPlugin).addPlugin(getTableRecordPlugin).addPlugin(listTableRecordsPlugin).addPlugin(createTableRecordsPlugin).addPlugin(deleteTableRecordsPlugin).addPlugin(updateTableRecordsPlugin).addPlugin(appsPlugin).addPlugin(getProfilePlugin);
9436
+ return withDeprecatedAddPlugin(createZapierSdkStack(options).toSdk());
9189
9437
  }
9190
9438
  var BaseSdkOptionsSchema = z.object({
9191
9439
  credentials: CredentialsSchema.optional().describe(
@@ -9248,10 +9496,10 @@ var BaseSdkOptionsSchema = z.object({
9248
9496
 
9249
9497
  // src/plugins/registry/index.ts
9250
9498
  var registryPlugin = definePlugin((_sdk) => {
9251
- logDeprecation(
9499
+ logDeprecation2(
9252
9500
  "registryPlugin is deprecated and a no-op; getRegistry is now built into every sdk. Remove .addPlugin(registryPlugin)."
9253
9501
  );
9254
9502
  return {};
9255
9503
  });
9256
9504
 
9257
- export { ActionKeyPropertySchema, ActionPropertySchema, ActionTimeoutMsPropertySchema, ActionTypePropertySchema, AppKeyPropertySchema, AppPropertySchema, AppsPropertySchema, AuthenticationIdPropertySchema, BaseSdkOptionsSchema, CONTEXT_CACHE_MAX_SIZE, CONTEXT_CACHE_TTL_MS, ClientCredentialsObjectSchema, ConnectionEntrySchema, ConnectionIdPropertySchema, ConnectionPropertySchema, ConnectionsMapSchema, ConnectionsPropertySchema, CredentialsFunctionSchema, CredentialsObjectSchema, CredentialsSchema, DEFAULT_ACTION_TIMEOUT_MS, DEFAULT_APPROVAL_TIMEOUT_MS, DEFAULT_CONFIG_PATH, DEFAULT_MAX_APPROVAL_RETRIES, DEFAULT_PAGE_SIZE, DebugPropertySchema, FieldsPropertySchema, InputFieldPropertySchema, InputsPropertySchema, LeaseLimitPropertySchema, LeasePropertySchema, LeaseSecondsPropertySchema, LimitPropertySchema, MAX_CONCURRENCY_LIMIT, MAX_PAGE_LIMIT, OffsetPropertySchema, OutputPropertySchema, ParamsPropertySchema, PkceCredentialsObjectSchema, RecordPropertySchema, RecordsPropertySchema, RelayFetchSchema, RelayRequestSchema, ResolvedCredentialsSchema, TablePropertySchema, TablesPropertySchema, TriggerInboxNamePropertySchema, TriggerInboxPropertySchema, ZAPIER_BASE_URL, ZAPIER_MAX_CONCURRENT_REQUESTS, ZAPIER_MAX_NETWORK_RETRIES, ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, ZapierAbortDrainSignal, ZapierActionError, ZapierApiError, ZapierAppNotFoundError, ZapierApprovalError, ZapierAuthenticationError, ZapierBundleError, ZapierConfigurationError, ZapierConflictError, ZapierError, ZapierNotFoundError, ZapierRateLimitError, ZapierRelayError, ZapierReleaseTriggerMessageSignal, ZapierResourceNotFoundError, ZapierSignal, ZapierTimeoutError, ZapierUnknownError, ZapierValidationError, actionKeyResolver, actionTypeResolver, apiPlugin, appKeyResolver, appsPlugin, connectionIdGenericResolver as authenticationIdGenericResolver, connectionIdResolver as authenticationIdResolver, batch, buildApplicationLifecycleEvent, buildCapabilityMessage, buildErrorEvent, buildErrorEventWithContext, buildMethodCalledEvent, cleanupEventListeners, clearTokenCache, clientCredentialsNameResolver, clientIdResolver, composePlugins, connectionIdGenericResolver, connectionIdResolver, connectionsPlugin, createBaseEvent, createClientCredentialsPlugin, createFunction, createMemoryCache, createOptionsPlugin, createPaginatedPluginMethod, createPluginMethod, createSdk, createTableFieldsPlugin, createTablePlugin, createTableRecordsPlugin, createZapierApi, createZapierSdk, createZapierSdkWithoutRegistry, definePlugin, deleteClientCredentialsPlugin, deleteTableFieldsPlugin, deleteTablePlugin, deleteTableRecordsPlugin, durableRunIdResolver, eventEmissionPlugin, fetchPlugin, findFirstConnectionPlugin, findManifestEntry, findUniqueConnectionPlugin, formatErrorMessage, generateEventId, getActionInputFieldsSchemaPlugin, getActionPlugin, getAppPlugin, getBaseUrlFromCredentials, getCiPlatform, getClientIdFromCredentials, getConnectionPlugin, getCpuTime, getCurrentTimestamp, getMemoryUsage, getOrCreateApiClient, getOsInfo, getPlatformVersions, getPreferredManifestEntryKey, getProfilePlugin, getReleaseId, getTablePlugin, getTableRecordPlugin, getTokenFromCliLogin, getZapierApprovalMode, getZapierDefaultApprovalMode, getZapierSdkService, injectCliLogin, inputFieldKeyResolver, inputsAllOptionalResolver, inputsResolver, invalidateCachedToken, invalidateCredentialsToken, isCi, isCliLoginAvailable, isClientCredentials, isCredentialsFunction, isCredentialsObject, isPkceCredentials, isPositional, listActionInputFieldChoicesPlugin, listActionInputFieldsPlugin, listActionsPlugin, listAppsPlugin, listClientCredentialsPlugin, listConnectionsPlugin, listTableFieldsPlugin, listTableRecordsPlugin, listTablesPlugin, logDeprecation, manifestPlugin, parseConcurrencyEnvVar, readManifestFromFile, registryPlugin, requestPlugin, resetDeprecationWarnings, resolveAuthToken, resolveCredentials, resolveCredentialsFromEnv, runActionPlugin, runWithTelemetryContext, tableFieldIdsResolver, tableFieldsResolver, tableFiltersResolver, tableIdResolver, tableNameResolver, tableRecordIdResolver, tableRecordIdsResolver, tableRecordsResolver, tableSortResolver, tableUpdateRecordsResolver, toSnakeCase, toTitleCase, triggerInboxResolver, triggerMessagesResolver, updateTableRecordsPlugin, workflowIdResolver, workflowRunIdResolver, workflowVersionIdResolver };
9505
+ export { ActionKeyPropertySchema, ActionPropertySchema, ActionTimeoutMsPropertySchema, ActionTypePropertySchema, AppKeyPropertySchema, AppPropertySchema, AppsPropertySchema, AuthenticationIdPropertySchema, BaseSdkOptionsSchema, CONTEXT_CACHE_MAX_SIZE, CONTEXT_CACHE_TTL_MS, CORE_ERROR_SYMBOL, ClientCredentialsObjectSchema, ConnectionEntrySchema, ConnectionIdPropertySchema, ConnectionPropertySchema, ConnectionsMapSchema, ConnectionsPropertySchema, CoreErrorCode, CredentialsFunctionSchema, CredentialsObjectSchema, CredentialsSchema, DEFAULT_ACTION_TIMEOUT_MS, DEFAULT_APPROVAL_TIMEOUT_MS, DEFAULT_CONFIG_PATH, DEFAULT_MAX_APPROVAL_RETRIES, DEFAULT_PAGE_SIZE, DebugPropertySchema, FieldsPropertySchema, InputFieldPropertySchema, InputsPropertySchema, LeaseLimitPropertySchema, LeasePropertySchema, LeaseSecondsPropertySchema, LimitPropertySchema, MAX_CONCURRENCY_LIMIT, MAX_PAGE_LIMIT, OffsetPropertySchema, OutputPropertySchema, ParamsPropertySchema, PkceCredentialsObjectSchema, RecordPropertySchema, RecordsPropertySchema, RelayFetchSchema, RelayRequestSchema, ResolvedCredentialsSchema, TablePropertySchema, TablesPropertySchema, TriggerInboxNamePropertySchema, TriggerInboxPropertySchema, ZAPIER_BASE_URL, ZAPIER_MAX_CONCURRENT_REQUESTS, ZAPIER_MAX_NETWORK_RETRIES, ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, ZapierAbortDrainSignal, ZapierActionError, ZapierApiError, ZapierAppNotFoundError, ZapierApprovalError, ZapierAuthenticationError, ZapierBundleError, ZapierConfigurationError, ZapierConflictError, ZapierError, ZapierNotFoundError, ZapierRateLimitError, ZapierRelayError, ZapierReleaseTriggerMessageSignal, ZapierResourceNotFoundError, ZapierSignal, ZapierTimeoutError, ZapierUnknownError, ZapierValidationError, actionKeyResolver, actionTypeResolver, addPlugin, apiPlugin, appKeyResolver, appsPlugin, connectionIdGenericResolver as authenticationIdGenericResolver, connectionIdResolver as authenticationIdResolver, batch, buildApplicationLifecycleEvent, buildCapabilityMessage, buildErrorEvent, buildErrorEventWithContext, buildMethodCalledEvent, cleanupEventListeners, clearTokenCache, clientCredentialsNameResolver, clientIdResolver, composePlugins, connectionIdGenericResolver, connectionIdResolver, connectionsPlugin, createBaseEvent, createClientCredentialsPlugin, createCorePlugin, createFunction, createMemoryCache, createOptionsPlugin, createPaginatedPluginMethod, createPluginMethod, createPluginStack, createSdk, createTableFieldsPlugin, createTablePlugin, createTableRecordsPlugin, createZapierApi, createZapierCoreStack, createZapierSdk, createZapierSdkStack, createZapierSdkWithoutRegistry, definePlugin, deleteClientCredentialsPlugin, deleteTableFieldsPlugin, deleteTablePlugin, deleteTableRecordsPlugin, durableRunIdResolver, eventEmissionPlugin, fetchPlugin, findFirstConnectionPlugin, findManifestEntry, findUniqueConnectionPlugin, formatErrorMessage, generateEventId, getActionInputFieldsSchemaPlugin, getActionPlugin, getAppPlugin, getBaseUrlFromCredentials, getCiPlatform, getClientIdFromCredentials, getConnectionPlugin, getCoreErrorCause, getCoreErrorCode, getCpuTime, getCurrentTimestamp, getMemoryUsage, getOrCreateApiClient, getOsInfo, getPlatformVersions, getPreferredManifestEntryKey, getProfilePlugin, getReleaseId, getTablePlugin, getTableRecordPlugin, getTokenFromCliLogin, getZapierApprovalMode, getZapierDefaultApprovalMode, getZapierSdkService, injectCliLogin, inputFieldKeyResolver, inputsAllOptionalResolver, inputsResolver, invalidateCachedToken, invalidateCredentialsToken, isCi, isCliLoginAvailable, isClientCredentials, isCoreError, isCredentialsFunction, isCredentialsObject, isPkceCredentials, isPositional, listActionInputFieldChoicesPlugin, listActionInputFieldsPlugin, listActionsPlugin, listAppsPlugin, listClientCredentialsPlugin, listConnectionsPlugin, listTableFieldsPlugin, listTableRecordsPlugin, listTablesPlugin, logDeprecation2 as logDeprecation, manifestPlugin, parseConcurrencyEnvVar, readManifestFromFile, registryPlugin, requestPlugin, resetDeprecationWarnings2 as resetDeprecationWarnings, resolveAuthToken, resolveCredentials, resolveCredentialsFromEnv, runActionPlugin, runInMethodScope, runWithTelemetryContext, tableFieldIdsResolver, tableFieldsResolver, tableFiltersResolver, tableIdResolver, tableNameResolver, tableRecordIdResolver, tableRecordIdsResolver, tableRecordsResolver, tableSortResolver, tableUpdateRecordsResolver, toSnakeCase, toTitleCase, triggerInboxResolver, triggerMessagesResolver, updateTableRecordsPlugin, workflowIdResolver, workflowRunIdResolver, workflowVersionIdResolver, zapierAdaptError };