@zapier/zapier-sdk 0.18.4 → 0.19.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 (372) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.md +43 -31
  3. package/dist/index.cjs +365 -64
  4. package/dist/index.d.mts +220 -33
  5. package/dist/index.d.ts +2541 -40
  6. package/dist/index.mjs +345 -63
  7. package/package.json +14 -13
  8. package/dist/api/auth.d.ts +0 -19
  9. package/dist/api/auth.d.ts.map +0 -1
  10. package/dist/api/auth.js +0 -70
  11. package/dist/api/auth.test.d.ts +0 -2
  12. package/dist/api/auth.test.d.ts.map +0 -1
  13. package/dist/api/auth.test.js +0 -220
  14. package/dist/api/client.d.ts +0 -9
  15. package/dist/api/client.d.ts.map +0 -1
  16. package/dist/api/client.js +0 -356
  17. package/dist/api/client.test.d.ts +0 -2
  18. package/dist/api/client.test.d.ts.map +0 -1
  19. package/dist/api/client.test.js +0 -96
  20. package/dist/api/debug.d.ts +0 -14
  21. package/dist/api/debug.d.ts.map +0 -1
  22. package/dist/api/debug.js +0 -131
  23. package/dist/api/debug.test.d.ts +0 -2
  24. package/dist/api/debug.test.d.ts.map +0 -1
  25. package/dist/api/debug.test.js +0 -59
  26. package/dist/api/index.d.ts +0 -30
  27. package/dist/api/index.d.ts.map +0 -1
  28. package/dist/api/index.js +0 -43
  29. package/dist/api/polling.d.ts +0 -46
  30. package/dist/api/polling.d.ts.map +0 -1
  31. package/dist/api/polling.js +0 -139
  32. package/dist/api/polling.test.d.ts +0 -2
  33. package/dist/api/polling.test.d.ts.map +0 -1
  34. package/dist/api/polling.test.js +0 -318
  35. package/dist/api/schemas.d.ts +0 -422
  36. package/dist/api/schemas.d.ts.map +0 -1
  37. package/dist/api/schemas.js +0 -322
  38. package/dist/api/types.d.ts +0 -83
  39. package/dist/api/types.d.ts.map +0 -1
  40. package/dist/api/types.js +0 -1
  41. package/dist/auth.d.ts +0 -52
  42. package/dist/auth.d.ts.map +0 -1
  43. package/dist/auth.js +0 -72
  44. package/dist/auth.test.d.ts +0 -2
  45. package/dist/auth.test.d.ts.map +0 -1
  46. package/dist/auth.test.js +0 -102
  47. package/dist/constants.d.ts +0 -14
  48. package/dist/constants.d.ts.map +0 -1
  49. package/dist/constants.js +0 -13
  50. package/dist/index.d.ts.map +0 -1
  51. package/dist/index.js +0 -42
  52. package/dist/plugins/api/index.d.ts +0 -12
  53. package/dist/plugins/api/index.d.ts.map +0 -1
  54. package/dist/plugins/api/index.js +0 -24
  55. package/dist/plugins/apps/index.d.ts +0 -15
  56. package/dist/plugins/apps/index.d.ts.map +0 -1
  57. package/dist/plugins/apps/index.js +0 -112
  58. package/dist/plugins/apps/schemas.d.ts +0 -42
  59. package/dist/plugins/apps/schemas.d.ts.map +0 -1
  60. package/dist/plugins/apps/schemas.js +0 -14
  61. package/dist/plugins/eventEmission/builders.d.ts +0 -14
  62. package/dist/plugins/eventEmission/builders.d.ts.map +0 -1
  63. package/dist/plugins/eventEmission/builders.js +0 -109
  64. package/dist/plugins/eventEmission/index.d.ts +0 -38
  65. package/dist/plugins/eventEmission/index.d.ts.map +0 -1
  66. package/dist/plugins/eventEmission/index.js +0 -336
  67. package/dist/plugins/eventEmission/index.test.d.ts +0 -5
  68. package/dist/plugins/eventEmission/index.test.d.ts.map +0 -1
  69. package/dist/plugins/eventEmission/index.test.js +0 -581
  70. package/dist/plugins/eventEmission/transport.d.ts +0 -27
  71. package/dist/plugins/eventEmission/transport.d.ts.map +0 -1
  72. package/dist/plugins/eventEmission/transport.js +0 -104
  73. package/dist/plugins/eventEmission/transport.test.d.ts +0 -5
  74. package/dist/plugins/eventEmission/transport.test.d.ts.map +0 -1
  75. package/dist/plugins/eventEmission/transport.test.js +0 -164
  76. package/dist/plugins/eventEmission/types.d.ts +0 -63
  77. package/dist/plugins/eventEmission/types.d.ts.map +0 -1
  78. package/dist/plugins/eventEmission/types.js +0 -1
  79. package/dist/plugins/eventEmission/utils.d.ts +0 -45
  80. package/dist/plugins/eventEmission/utils.d.ts.map +0 -1
  81. package/dist/plugins/eventEmission/utils.js +0 -114
  82. package/dist/plugins/fetch/index.d.ts +0 -36
  83. package/dist/plugins/fetch/index.d.ts.map +0 -1
  84. package/dist/plugins/fetch/index.js +0 -62
  85. package/dist/plugins/fetch/schemas.d.ts +0 -19
  86. package/dist/plugins/fetch/schemas.d.ts.map +0 -1
  87. package/dist/plugins/fetch/schemas.js +0 -31
  88. package/dist/plugins/findFirstAuthentication/index.d.ts +0 -21
  89. package/dist/plugins/findFirstAuthentication/index.d.ts.map +0 -1
  90. package/dist/plugins/findFirstAuthentication/index.js +0 -36
  91. package/dist/plugins/findFirstAuthentication/index.test.d.ts +0 -2
  92. package/dist/plugins/findFirstAuthentication/index.test.d.ts.map +0 -1
  93. package/dist/plugins/findFirstAuthentication/index.test.js +0 -177
  94. package/dist/plugins/findFirstAuthentication/schemas.d.ts +0 -20
  95. package/dist/plugins/findFirstAuthentication/schemas.d.ts.map +0 -1
  96. package/dist/plugins/findFirstAuthentication/schemas.js +0 -18
  97. package/dist/plugins/findUniqueAuthentication/index.d.ts +0 -21
  98. package/dist/plugins/findUniqueAuthentication/index.d.ts.map +0 -1
  99. package/dist/plugins/findUniqueAuthentication/index.js +0 -39
  100. package/dist/plugins/findUniqueAuthentication/index.test.d.ts +0 -2
  101. package/dist/plugins/findUniqueAuthentication/index.test.d.ts.map +0 -1
  102. package/dist/plugins/findUniqueAuthentication/index.test.js +0 -159
  103. package/dist/plugins/findUniqueAuthentication/schemas.d.ts +0 -20
  104. package/dist/plugins/findUniqueAuthentication/schemas.d.ts.map +0 -1
  105. package/dist/plugins/findUniqueAuthentication/schemas.js +0 -18
  106. package/dist/plugins/getAction/index.d.ts +0 -25
  107. package/dist/plugins/getAction/index.d.ts.map +0 -1
  108. package/dist/plugins/getAction/index.js +0 -42
  109. package/dist/plugins/getAction/index.test.d.ts +0 -2
  110. package/dist/plugins/getAction/index.test.d.ts.map +0 -1
  111. package/dist/plugins/getAction/index.test.js +0 -211
  112. package/dist/plugins/getAction/schemas.d.ts +0 -30
  113. package/dist/plugins/getAction/schemas.d.ts.map +0 -1
  114. package/dist/plugins/getAction/schemas.js +0 -12
  115. package/dist/plugins/getApp/index.d.ts +0 -21
  116. package/dist/plugins/getApp/index.d.ts.map +0 -1
  117. package/dist/plugins/getApp/index.js +0 -44
  118. package/dist/plugins/getApp/index.test.d.ts +0 -2
  119. package/dist/plugins/getApp/index.test.d.ts.map +0 -1
  120. package/dist/plugins/getApp/index.test.js +0 -157
  121. package/dist/plugins/getApp/schemas.d.ts +0 -16
  122. package/dist/plugins/getApp/schemas.d.ts.map +0 -1
  123. package/dist/plugins/getApp/schemas.js +0 -8
  124. package/dist/plugins/getAuthentication/index.d.ts +0 -21
  125. package/dist/plugins/getAuthentication/index.d.ts.map +0 -1
  126. package/dist/plugins/getAuthentication/index.js +0 -29
  127. package/dist/plugins/getAuthentication/index.test.d.ts +0 -2
  128. package/dist/plugins/getAuthentication/index.test.d.ts.map +0 -1
  129. package/dist/plugins/getAuthentication/index.test.js +0 -106
  130. package/dist/plugins/getAuthentication/schemas.d.ts +0 -7
  131. package/dist/plugins/getAuthentication/schemas.d.ts.map +0 -1
  132. package/dist/plugins/getAuthentication/schemas.js +0 -1
  133. package/dist/plugins/getInputFieldsSchema/index.d.ts +0 -23
  134. package/dist/plugins/getInputFieldsSchema/index.d.ts.map +0 -1
  135. package/dist/plugins/getInputFieldsSchema/index.js +0 -53
  136. package/dist/plugins/getInputFieldsSchema/index.test.d.ts +0 -2
  137. package/dist/plugins/getInputFieldsSchema/index.test.d.ts.map +0 -1
  138. package/dist/plugins/getInputFieldsSchema/index.test.js +0 -291
  139. package/dist/plugins/getInputFieldsSchema/schemas.d.ts +0 -28
  140. package/dist/plugins/getInputFieldsSchema/schemas.d.ts.map +0 -1
  141. package/dist/plugins/getInputFieldsSchema/schemas.js +0 -13
  142. package/dist/plugins/getProfile/index.d.ts +0 -25
  143. package/dist/plugins/getProfile/index.d.ts.map +0 -1
  144. package/dist/plugins/getProfile/index.js +0 -39
  145. package/dist/plugins/getProfile/schemas.d.ts +0 -13
  146. package/dist/plugins/getProfile/schemas.d.ts.map +0 -1
  147. package/dist/plugins/getProfile/schemas.js +0 -6
  148. package/dist/plugins/listActions/index.d.ts +0 -30
  149. package/dist/plugins/listActions/index.d.ts.map +0 -1
  150. package/dist/plugins/listActions/index.js +0 -75
  151. package/dist/plugins/listActions/index.test.d.ts +0 -2
  152. package/dist/plugins/listActions/index.test.d.ts.map +0 -1
  153. package/dist/plugins/listActions/index.test.js +0 -453
  154. package/dist/plugins/listActions/schemas.d.ts +0 -35
  155. package/dist/plugins/listActions/schemas.d.ts.map +0 -1
  156. package/dist/plugins/listActions/schemas.js +0 -22
  157. package/dist/plugins/listApps/index.d.ts +0 -19
  158. package/dist/plugins/listApps/index.d.ts.map +0 -1
  159. package/dist/plugins/listApps/index.js +0 -67
  160. package/dist/plugins/listApps/index.test.d.ts +0 -2
  161. package/dist/plugins/listApps/index.test.d.ts.map +0 -1
  162. package/dist/plugins/listApps/index.test.js +0 -121
  163. package/dist/plugins/listApps/schemas.d.ts +0 -47
  164. package/dist/plugins/listApps/schemas.d.ts.map +0 -1
  165. package/dist/plugins/listApps/schemas.js +0 -49
  166. package/dist/plugins/listAuthentications/index.d.ts +0 -24
  167. package/dist/plugins/listAuthentications/index.d.ts.map +0 -1
  168. package/dist/plugins/listAuthentications/index.js +0 -77
  169. package/dist/plugins/listAuthentications/index.test.d.ts +0 -2
  170. package/dist/plugins/listAuthentications/index.test.d.ts.map +0 -1
  171. package/dist/plugins/listAuthentications/index.test.js +0 -848
  172. package/dist/plugins/listAuthentications/schemas.d.ts +0 -30
  173. package/dist/plugins/listAuthentications/schemas.d.ts.map +0 -1
  174. package/dist/plugins/listAuthentications/schemas.js +0 -32
  175. package/dist/plugins/listInputFieldChoices/index.d.ts +0 -33
  176. package/dist/plugins/listInputFieldChoices/index.d.ts.map +0 -1
  177. package/dist/plugins/listInputFieldChoices/index.js +0 -115
  178. package/dist/plugins/listInputFieldChoices/index.test.d.ts +0 -2
  179. package/dist/plugins/listInputFieldChoices/index.test.d.ts.map +0 -1
  180. package/dist/plugins/listInputFieldChoices/index.test.js +0 -717
  181. package/dist/plugins/listInputFieldChoices/schemas.d.ts +0 -43
  182. package/dist/plugins/listInputFieldChoices/schemas.d.ts.map +0 -1
  183. package/dist/plugins/listInputFieldChoices/schemas.js +0 -65
  184. package/dist/plugins/listInputFields/index.d.ts +0 -34
  185. package/dist/plugins/listInputFields/index.d.ts.map +0 -1
  186. package/dist/plugins/listInputFields/index.js +0 -204
  187. package/dist/plugins/listInputFields/index.test.d.ts +0 -2
  188. package/dist/plugins/listInputFields/index.test.d.ts.map +0 -1
  189. package/dist/plugins/listInputFields/index.test.js +0 -359
  190. package/dist/plugins/listInputFields/schemas.d.ts +0 -35
  191. package/dist/plugins/listInputFields/schemas.d.ts.map +0 -1
  192. package/dist/plugins/listInputFields/schemas.js +0 -23
  193. package/dist/plugins/manifest/index.d.ts +0 -85
  194. package/dist/plugins/manifest/index.d.ts.map +0 -1
  195. package/dist/plugins/manifest/index.js +0 -376
  196. package/dist/plugins/manifest/index.test.d.ts +0 -2
  197. package/dist/plugins/manifest/index.test.d.ts.map +0 -1
  198. package/dist/plugins/manifest/index.test.js +0 -1139
  199. package/dist/plugins/manifest/schemas.d.ts +0 -57
  200. package/dist/plugins/manifest/schemas.d.ts.map +0 -1
  201. package/dist/plugins/manifest/schemas.js +0 -50
  202. package/dist/plugins/registry/index.d.ts +0 -21
  203. package/dist/plugins/registry/index.d.ts.map +0 -1
  204. package/dist/plugins/registry/index.js +0 -117
  205. package/dist/plugins/request/index.d.ts +0 -21
  206. package/dist/plugins/request/index.d.ts.map +0 -1
  207. package/dist/plugins/request/index.js +0 -76
  208. package/dist/plugins/request/index.test.d.ts +0 -2
  209. package/dist/plugins/request/index.test.d.ts.map +0 -1
  210. package/dist/plugins/request/index.test.js +0 -337
  211. package/dist/plugins/request/schemas.d.ts +0 -54
  212. package/dist/plugins/request/schemas.d.ts.map +0 -1
  213. package/dist/plugins/request/schemas.js +0 -41
  214. package/dist/plugins/runAction/index.d.ts +0 -33
  215. package/dist/plugins/runAction/index.d.ts.map +0 -1
  216. package/dist/plugins/runAction/index.js +0 -108
  217. package/dist/plugins/runAction/index.test.d.ts +0 -2
  218. package/dist/plugins/runAction/index.test.d.ts.map +0 -1
  219. package/dist/plugins/runAction/index.test.js +0 -333
  220. package/dist/plugins/runAction/schemas.d.ts +0 -34
  221. package/dist/plugins/runAction/schemas.d.ts.map +0 -1
  222. package/dist/plugins/runAction/schemas.js +0 -23
  223. package/dist/resolvers/actionKey.d.ts +0 -15
  224. package/dist/resolvers/actionKey.d.ts.map +0 -1
  225. package/dist/resolvers/actionKey.js +0 -19
  226. package/dist/resolvers/actionType.d.ts +0 -10
  227. package/dist/resolvers/actionType.d.ts.map +0 -1
  228. package/dist/resolvers/actionType.js +0 -21
  229. package/dist/resolvers/appKey.d.ts +0 -3
  230. package/dist/resolvers/appKey.d.ts.map +0 -1
  231. package/dist/resolvers/appKey.js +0 -5
  232. package/dist/resolvers/authenticationId.d.ts +0 -9
  233. package/dist/resolvers/authenticationId.d.ts.map +0 -1
  234. package/dist/resolvers/authenticationId.js +0 -42
  235. package/dist/resolvers/index.d.ts +0 -8
  236. package/dist/resolvers/index.d.ts.map +0 -1
  237. package/dist/resolvers/index.js +0 -8
  238. package/dist/resolvers/inputFieldKey.d.ts +0 -11
  239. package/dist/resolvers/inputFieldKey.d.ts.map +0 -1
  240. package/dist/resolvers/inputFieldKey.js +0 -47
  241. package/dist/resolvers/inputs.d.ts +0 -17
  242. package/dist/resolvers/inputs.d.ts.map +0 -1
  243. package/dist/resolvers/inputs.js +0 -50
  244. package/dist/schemas/Action.d.ts +0 -24
  245. package/dist/schemas/Action.d.ts.map +0 -1
  246. package/dist/schemas/Action.js +0 -40
  247. package/dist/schemas/App.d.ts +0 -57
  248. package/dist/schemas/App.d.ts.map +0 -1
  249. package/dist/schemas/App.js +0 -26
  250. package/dist/schemas/Auth.d.ts +0 -55
  251. package/dist/schemas/Auth.d.ts.map +0 -1
  252. package/dist/schemas/Auth.js +0 -33
  253. package/dist/schemas/Field.d.ts +0 -61
  254. package/dist/schemas/Field.d.ts.map +0 -1
  255. package/dist/schemas/Field.js +0 -116
  256. package/dist/schemas/Run.d.ts +0 -3
  257. package/dist/schemas/Run.d.ts.map +0 -1
  258. package/dist/schemas/Run.js +0 -31
  259. package/dist/schemas/UserProfile.d.ts +0 -13
  260. package/dist/schemas/UserProfile.d.ts.map +0 -1
  261. package/dist/schemas/UserProfile.js +0 -32
  262. package/dist/sdk.d.ts +0 -146
  263. package/dist/sdk.d.ts.map +0 -1
  264. package/dist/sdk.js +0 -112
  265. package/dist/sdk.test.d.ts +0 -2
  266. package/dist/sdk.test.d.ts.map +0 -1
  267. package/dist/sdk.test.js +0 -258
  268. package/dist/services/implementations.d.ts +0 -63
  269. package/dist/services/implementations.d.ts.map +0 -1
  270. package/dist/services/implementations.js +0 -80
  271. package/dist/types/domain.d.ts +0 -52
  272. package/dist/types/domain.d.ts.map +0 -1
  273. package/dist/types/domain.js +0 -1
  274. package/dist/types/domain.test.d.ts +0 -2
  275. package/dist/types/domain.test.d.ts.map +0 -1
  276. package/dist/types/domain.test.js +0 -39
  277. package/dist/types/errors.d.ts +0 -143
  278. package/dist/types/errors.d.ts.map +0 -1
  279. package/dist/types/errors.js +0 -187
  280. package/dist/types/events.d.ts +0 -38
  281. package/dist/types/events.d.ts.map +0 -1
  282. package/dist/types/events.js +0 -7
  283. package/dist/types/functions.d.ts +0 -27
  284. package/dist/types/functions.d.ts.map +0 -1
  285. package/dist/types/functions.js +0 -1
  286. package/dist/types/plugin.d.ts +0 -75
  287. package/dist/types/plugin.d.ts.map +0 -1
  288. package/dist/types/plugin.js +0 -9
  289. package/dist/types/properties.d.ts +0 -33
  290. package/dist/types/properties.d.ts.map +0 -1
  291. package/dist/types/properties.js +0 -52
  292. package/dist/types/sdk.d.ts +0 -69
  293. package/dist/types/sdk.d.ts.map +0 -1
  294. package/dist/types/sdk.js +0 -4
  295. package/dist/types/telemetry-events.d.ts +0 -105
  296. package/dist/types/telemetry-events.d.ts.map +0 -1
  297. package/dist/types/telemetry-events.js +0 -8
  298. package/dist/utils/array-utils.d.ts +0 -31
  299. package/dist/utils/array-utils.d.ts.map +0 -1
  300. package/dist/utils/array-utils.js +0 -36
  301. package/dist/utils/array-utils.test.d.ts +0 -2
  302. package/dist/utils/array-utils.test.d.ts.map +0 -1
  303. package/dist/utils/array-utils.test.js +0 -107
  304. package/dist/utils/batch-utils.d.ts +0 -72
  305. package/dist/utils/batch-utils.d.ts.map +0 -1
  306. package/dist/utils/batch-utils.js +0 -162
  307. package/dist/utils/batch-utils.test.d.ts +0 -2
  308. package/dist/utils/batch-utils.test.d.ts.map +0 -1
  309. package/dist/utils/batch-utils.test.js +0 -476
  310. package/dist/utils/domain-utils.d.ts +0 -66
  311. package/dist/utils/domain-utils.d.ts.map +0 -1
  312. package/dist/utils/domain-utils.js +0 -164
  313. package/dist/utils/domain-utils.test.d.ts +0 -2
  314. package/dist/utils/domain-utils.test.d.ts.map +0 -1
  315. package/dist/utils/domain-utils.test.js +0 -346
  316. package/dist/utils/file-utils.d.ts +0 -4
  317. package/dist/utils/file-utils.d.ts.map +0 -1
  318. package/dist/utils/file-utils.js +0 -74
  319. package/dist/utils/file-utils.test.d.ts +0 -2
  320. package/dist/utils/file-utils.test.d.ts.map +0 -1
  321. package/dist/utils/file-utils.test.js +0 -51
  322. package/dist/utils/function-utils.d.ts +0 -73
  323. package/dist/utils/function-utils.d.ts.map +0 -1
  324. package/dist/utils/function-utils.js +0 -245
  325. package/dist/utils/function-utils.test.d.ts +0 -2
  326. package/dist/utils/function-utils.test.d.ts.map +0 -1
  327. package/dist/utils/function-utils.test.js +0 -110
  328. package/dist/utils/id-utils.d.ts +0 -13
  329. package/dist/utils/id-utils.d.ts.map +0 -1
  330. package/dist/utils/id-utils.js +0 -22
  331. package/dist/utils/id-utils.test.d.ts +0 -2
  332. package/dist/utils/id-utils.test.d.ts.map +0 -1
  333. package/dist/utils/id-utils.test.js +0 -22
  334. package/dist/utils/pagination-utils.d.ts +0 -37
  335. package/dist/utils/pagination-utils.d.ts.map +0 -1
  336. package/dist/utils/pagination-utils.js +0 -165
  337. package/dist/utils/pagination-utils.test.d.ts +0 -17
  338. package/dist/utils/pagination-utils.test.d.ts.map +0 -1
  339. package/dist/utils/pagination-utils.test.js +0 -461
  340. package/dist/utils/retry-utils.d.ts +0 -45
  341. package/dist/utils/retry-utils.d.ts.map +0 -1
  342. package/dist/utils/retry-utils.js +0 -51
  343. package/dist/utils/retry-utils.test.d.ts +0 -2
  344. package/dist/utils/retry-utils.test.d.ts.map +0 -1
  345. package/dist/utils/retry-utils.test.js +0 -90
  346. package/dist/utils/schema-utils.d.ts +0 -69
  347. package/dist/utils/schema-utils.d.ts.map +0 -1
  348. package/dist/utils/schema-utils.js +0 -72
  349. package/dist/utils/string-utils.d.ts +0 -40
  350. package/dist/utils/string-utils.d.ts.map +0 -1
  351. package/dist/utils/string-utils.js +0 -69
  352. package/dist/utils/string-utils.test.d.ts +0 -2
  353. package/dist/utils/string-utils.test.d.ts.map +0 -1
  354. package/dist/utils/string-utils.test.js +0 -59
  355. package/dist/utils/telemetry-utils.d.ts +0 -44
  356. package/dist/utils/telemetry-utils.d.ts.map +0 -1
  357. package/dist/utils/telemetry-utils.js +0 -55
  358. package/dist/utils/telemetry-utils.test.d.ts +0 -2
  359. package/dist/utils/telemetry-utils.test.d.ts.map +0 -1
  360. package/dist/utils/telemetry-utils.test.js +0 -94
  361. package/dist/utils/url-utils.d.ts +0 -19
  362. package/dist/utils/url-utils.d.ts.map +0 -1
  363. package/dist/utils/url-utils.js +0 -62
  364. package/dist/utils/url-utils.test.d.ts +0 -2
  365. package/dist/utils/url-utils.test.d.ts.map +0 -1
  366. package/dist/utils/url-utils.test.js +0 -103
  367. package/dist/utils/validation.d.ts +0 -4
  368. package/dist/utils/validation.d.ts.map +0 -1
  369. package/dist/utils/validation.js +0 -30
  370. package/dist/utils/validation.test.d.ts +0 -2
  371. package/dist/utils/validation.test.d.ts.map +0 -1
  372. package/dist/utils/validation.test.js +0 -44
@@ -1,337 +0,0 @@
1
- import { describe, it, expect, vi, beforeEach } from "vitest";
2
- import { ZapierValidationError } from "../../types/errors";
3
- import { requestPlugin } from "./index";
4
- import { createSdk } from "../../sdk";
5
- import { eventEmissionPlugin } from "../eventEmission";
6
- describe("request plugin", () => {
7
- let mockApiClient;
8
- let mockFetch;
9
- beforeEach(() => {
10
- vi.clearAllMocks();
11
- mockFetch = vi.fn().mockResolvedValue(new Response('{"success": true}', {
12
- status: 200,
13
- headers: { "Content-Type": "application/json" },
14
- }));
15
- mockApiClient = {
16
- fetch: mockFetch,
17
- };
18
- });
19
- const apiPlugin = () => ({
20
- context: {
21
- api: mockApiClient,
22
- },
23
- });
24
- function createTestSdk() {
25
- return createSdk()
26
- .addPlugin(() => ({
27
- context: {
28
- options: {},
29
- },
30
- }))
31
- .addPlugin(apiPlugin)
32
- .addPlugin(eventEmissionPlugin)
33
- .addPlugin(requestPlugin);
34
- }
35
- describe("schema validation", () => {
36
- it("should throw validation error for missing url", async () => {
37
- const sdk = createTestSdk();
38
- await expect(sdk.request({})).rejects.toThrow(ZapierValidationError);
39
- });
40
- it("should throw validation error for invalid url", async () => {
41
- const sdk = createTestSdk();
42
- await expect(sdk.request({ url: "not-a-url" })).rejects.toThrow(ZapierValidationError);
43
- });
44
- it("should throw validation error for invalid method", async () => {
45
- const sdk = createTestSdk();
46
- await expect(sdk.request({
47
- url: "https://api.example.com/data",
48
- method: "INVALID",
49
- })).rejects.toThrow(ZapierValidationError);
50
- });
51
- it("should throw validation error for invalid authenticationId type", async () => {
52
- const sdk = createTestSdk();
53
- await expect(sdk.request({
54
- url: "https://api.example.com/data",
55
- authenticationId: "not-a-number",
56
- })).rejects.toThrow(ZapierValidationError);
57
- });
58
- it("should throw validation error for invalid callbackUrl", async () => {
59
- const sdk = createTestSdk();
60
- await expect(sdk.request({
61
- url: "https://api.example.com/data",
62
- callbackUrl: "not-a-url",
63
- })).rejects.toThrow(ZapierValidationError);
64
- });
65
- it("should pass validation with valid minimal options", async () => {
66
- const sdk = createTestSdk();
67
- await sdk.request({ url: "https://api.example.com/data" });
68
- expect(mockFetch).toHaveBeenCalled();
69
- });
70
- it("should pass validation with all valid options", async () => {
71
- const sdk = createTestSdk();
72
- await sdk.request({
73
- url: "https://api.example.com/data",
74
- method: "POST",
75
- body: '{"test": true}',
76
- headers: { "Content-Type": "application/json" },
77
- authenticationId: 123,
78
- callbackUrl: "https://webhook.example.com/callback",
79
- authenticationTemplate: '{"token": "{{auth.token}}"}',
80
- });
81
- expect(mockFetch).toHaveBeenCalled();
82
- });
83
- });
84
- describe("URL transformation", () => {
85
- it("should transform full URLs to relay path format", async () => {
86
- const sdk = createTestSdk();
87
- await sdk.request({
88
- url: "https://api.github.com/user",
89
- method: "GET",
90
- });
91
- expect(mockFetch).toHaveBeenCalledWith("/relay/api.github.com/user", expect.any(Object));
92
- });
93
- it("should preserve query parameters and fragments", async () => {
94
- const sdk = createTestSdk();
95
- await sdk.request({
96
- url: "https://api.example.com/search?q=test&limit=10#section",
97
- method: "GET",
98
- });
99
- expect(mockFetch).toHaveBeenCalledWith("/relay/api.example.com/search?q=test&limit=10#section", expect.any(Object));
100
- });
101
- it("should handle URLs with ports", async () => {
102
- const sdk = createTestSdk();
103
- await sdk.request({
104
- url: "https://api.example.com:8443/data",
105
- method: "GET",
106
- });
107
- expect(mockFetch).toHaveBeenCalledWith("/relay/api.example.com:8443/data", expect.any(Object));
108
- });
109
- });
110
- describe("headers handling", () => {
111
- it("should pass through regular headers", async () => {
112
- const sdk = createTestSdk();
113
- const headers = {
114
- "Content-Type": "application/json",
115
- "X-Custom-Header": "test-value",
116
- };
117
- await sdk.request({
118
- url: "https://api.example.com/data",
119
- method: "POST",
120
- headers,
121
- });
122
- expect(mockFetch).toHaveBeenCalledWith("/relay/api.example.com/data", {
123
- method: "POST",
124
- body: undefined,
125
- headers: {
126
- "Content-Type": "application/json",
127
- "X-Custom-Header": "test-value",
128
- },
129
- });
130
- });
131
- it("should add relay-specific headers when provided", async () => {
132
- const sdk = createTestSdk();
133
- await sdk.request({
134
- url: "https://api.example.com/data",
135
- method: "POST",
136
- authenticationId: 123,
137
- callbackUrl: "https://webhook.example.com/callback",
138
- authenticationTemplate: '{"token": "{{auth.token}}"}',
139
- });
140
- expect(mockFetch).toHaveBeenCalledWith("/relay/api.example.com/data", {
141
- method: "POST",
142
- body: undefined,
143
- headers: {
144
- "X-Relay-Authentication-Id": "123",
145
- "X-Relay-Callback-Url": "https://webhook.example.com/callback",
146
- "X-Authentication-Template": '{"token": "{{auth.token}}"}',
147
- },
148
- });
149
- });
150
- it("should handle Headers object", async () => {
151
- const sdk = createTestSdk();
152
- const headers = new Headers();
153
- headers.set("Content-Type", "application/json");
154
- headers.set("Authorization", "Bearer token");
155
- await sdk.request({
156
- url: "https://api.example.com/data",
157
- headers,
158
- });
159
- expect(mockFetch).toHaveBeenCalledWith("/relay/api.example.com/data", {
160
- method: "GET",
161
- body: undefined,
162
- headers: {
163
- "content-type": "application/json", // Headers constructor lowercases names
164
- authorization: "Bearer token", // Headers constructor lowercases names
165
- },
166
- });
167
- });
168
- it("should handle headers as array of tuples", async () => {
169
- const sdk = createTestSdk();
170
- const headers = [
171
- ["Content-Type", "application/json"],
172
- ["X-Api-Key", "secret"],
173
- ];
174
- await sdk.request({
175
- url: "https://api.example.com/data",
176
- headers,
177
- });
178
- expect(mockFetch).toHaveBeenCalledWith("/relay/api.example.com/data", {
179
- method: "GET",
180
- body: undefined,
181
- headers: {
182
- "Content-Type": "application/json",
183
- "X-Api-Key": "secret",
184
- },
185
- });
186
- });
187
- });
188
- describe("HTTP methods", () => {
189
- const methods = [
190
- "GET",
191
- "POST",
192
- "PUT",
193
- "DELETE",
194
- "PATCH",
195
- "HEAD",
196
- "OPTIONS",
197
- ];
198
- methods.forEach((method) => {
199
- it(`should support ${method} method`, async () => {
200
- const sdk = createTestSdk();
201
- await sdk.request({
202
- url: "https://api.example.com/data",
203
- method,
204
- });
205
- expect(mockFetch).toHaveBeenCalledWith("/relay/api.example.com/data", {
206
- method,
207
- body: undefined,
208
- headers: {},
209
- });
210
- });
211
- });
212
- it("should default to GET method", async () => {
213
- const sdk = createTestSdk();
214
- await sdk.request({
215
- url: "https://api.example.com/data",
216
- });
217
- expect(mockFetch).toHaveBeenCalledWith("/relay/api.example.com/data", {
218
- method: "GET",
219
- body: undefined,
220
- headers: {},
221
- });
222
- });
223
- });
224
- describe("request body", () => {
225
- it("should pass through request body", async () => {
226
- const sdk = createTestSdk();
227
- const body = '{"name": "test", "value": 42}';
228
- await sdk.request({
229
- url: "https://api.example.com/data",
230
- method: "POST",
231
- body,
232
- });
233
- expect(mockFetch).toHaveBeenCalledWith("/relay/api.example.com/data", {
234
- method: "POST",
235
- body,
236
- headers: {
237
- "Content-Type": "application/json; charset=utf-8",
238
- },
239
- });
240
- });
241
- it("should auto-set Content-Type for JSON object bodies", async () => {
242
- const sdk = createTestSdk();
243
- const body = '{"key": "value"}';
244
- await sdk.request({
245
- url: "https://api.example.com/data",
246
- method: "POST",
247
- body,
248
- });
249
- expect(mockFetch).toHaveBeenCalledWith("/relay/api.example.com/data", {
250
- method: "POST",
251
- body,
252
- headers: {
253
- "Content-Type": "application/json; charset=utf-8",
254
- },
255
- });
256
- });
257
- it("should auto-set Content-Type for JSON array bodies", async () => {
258
- const sdk = createTestSdk();
259
- const body = '[{"id": 1}, {"id": 2}]';
260
- await sdk.request({
261
- url: "https://api.example.com/data",
262
- method: "POST",
263
- body,
264
- });
265
- expect(mockFetch).toHaveBeenCalledWith("/relay/api.example.com/data", {
266
- method: "POST",
267
- body,
268
- headers: {
269
- "Content-Type": "application/json; charset=utf-8",
270
- },
271
- });
272
- });
273
- it("should not override explicit Content-Type header", async () => {
274
- const sdk = createTestSdk();
275
- const body = '{"key": "value"}';
276
- await sdk.request({
277
- url: "https://api.example.com/data",
278
- method: "POST",
279
- body,
280
- headers: {
281
- "Content-Type": "text/plain",
282
- },
283
- });
284
- expect(mockFetch).toHaveBeenCalledWith("/relay/api.example.com/data", {
285
- method: "POST",
286
- body,
287
- headers: {
288
- "Content-Type": "text/plain",
289
- },
290
- });
291
- });
292
- it("should not set Content-Type for non-JSON bodies", async () => {
293
- const sdk = createTestSdk();
294
- const body = "plain text body";
295
- await sdk.request({
296
- url: "https://api.example.com/data",
297
- method: "POST",
298
- body,
299
- });
300
- expect(mockFetch).toHaveBeenCalledWith("/relay/api.example.com/data", {
301
- method: "POST",
302
- body,
303
- headers: {},
304
- });
305
- });
306
- });
307
- describe("response handling", () => {
308
- it("should return the response from api.fetch", async () => {
309
- const mockResponse = new Response('{"result": "success"}', {
310
- status: 200,
311
- statusText: "OK",
312
- headers: { "Content-Type": "application/json" },
313
- });
314
- mockFetch.mockResolvedValue(mockResponse);
315
- const sdk = createTestSdk();
316
- const response = await sdk.request({
317
- url: "https://api.example.com/data",
318
- });
319
- expect(response).toBe(mockResponse);
320
- expect(response.status).toBe(200);
321
- });
322
- it("should handle API errors", async () => {
323
- const error = new Error("Network error");
324
- mockFetch.mockRejectedValue(error);
325
- const sdk = createTestSdk();
326
- await expect(sdk.request({ url: "https://api.example.com/data" })).rejects.toThrow("Network error");
327
- });
328
- });
329
- describe("context and metadata", () => {
330
- it("should provide context with meta information", () => {
331
- const sdk = createTestSdk();
332
- const context = sdk.getContext();
333
- expect(context.meta.request).toBeDefined();
334
- expect(context.meta.request.inputSchema).toBeDefined();
335
- });
336
- });
337
- });
@@ -1,54 +0,0 @@
1
- import { z } from "zod";
2
- import type { ZapierApiError, ZapierValidationError, ZapierUnknownError } from "../../types/errors";
3
- export declare const RelayRequestSchema: z.ZodObject<{
4
- url: z.ZodString;
5
- method: z.ZodOptional<z.ZodEnum<{
6
- POST: "POST";
7
- GET: "GET";
8
- PUT: "PUT";
9
- DELETE: "DELETE";
10
- PATCH: "PATCH";
11
- HEAD: "HEAD";
12
- OPTIONS: "OPTIONS";
13
- }>>;
14
- body: z.ZodOptional<z.ZodAny>;
15
- authenticationId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
16
- callbackUrl: z.ZodOptional<z.ZodString>;
17
- authenticationTemplate: z.ZodOptional<z.ZodString>;
18
- headers: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodString>, z.ZodCustom<Headers, Headers>, z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodString], null>>]>>;
19
- relayBaseUrl: z.ZodOptional<z.ZodString>;
20
- _telemetry: z.ZodOptional<z.ZodObject<{
21
- isNested: z.ZodOptional<z.ZodBoolean>;
22
- }, z.core.$strip>>;
23
- }, z.core.$strip>;
24
- export type RelayRequestOptions = z.infer<typeof RelayRequestSchema>;
25
- export type RelayRequestError = ZapierApiError | ZapierValidationError | ZapierUnknownError;
26
- export interface RelayRequestSdkFunction {
27
- request: (options: RelayRequestOptions) => Promise<Response>;
28
- }
29
- export declare const RelayFetchSchema: z.ZodObject<{
30
- url: z.ZodString;
31
- method: z.ZodOptional<z.ZodEnum<{
32
- POST: "POST";
33
- GET: "GET";
34
- PUT: "PUT";
35
- DELETE: "DELETE";
36
- PATCH: "PATCH";
37
- HEAD: "HEAD";
38
- OPTIONS: "OPTIONS";
39
- }>>;
40
- body: z.ZodOptional<z.ZodAny>;
41
- authenticationId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
42
- callbackUrl: z.ZodOptional<z.ZodString>;
43
- authenticationTemplate: z.ZodOptional<z.ZodString>;
44
- headers: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodString>, z.ZodCustom<Headers, Headers>, z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodString], null>>]>>;
45
- relayBaseUrl: z.ZodOptional<z.ZodString>;
46
- _telemetry: z.ZodOptional<z.ZodObject<{
47
- isNested: z.ZodOptional<z.ZodBoolean>;
48
- }, z.core.$strip>>;
49
- }, z.core.$strip>;
50
- export type RelayFetchOptions = RelayRequestOptions;
51
- export interface RelayFetchSdkFunction {
52
- fetch: (options: RelayFetchOptions) => Promise<Response>;
53
- }
54
- //# sourceMappingURL=schemas.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/request/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EACV,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAK5B,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;iBAoC+C,CAAC;AAG/E,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAGrE,MAAM,MAAM,iBAAiB,GACzB,cAAc,GACd,qBAAqB,GACrB,kBAAkB,CAAC;AAGvB,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;CAC9D;AAGD,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;iBAAqB,CAAC;AACnD,MAAM,MAAM,iBAAiB,GAAG,mBAAmB,CAAC;AACpD,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;CAC1D"}
@@ -1,41 +0,0 @@
1
- import { z } from "zod";
2
- import { TelemetryMarkerSchema } from "../../utils/function-utils";
3
- import { AuthenticationIdPropertySchema } from "../../types/properties";
4
- // Pure Zod schema for the request function
5
- export const RelayRequestSchema = z
6
- .object({
7
- url: z
8
- .string()
9
- .url()
10
- .describe("The URL to request (will be proxied through Relay)"),
11
- method: z
12
- .enum(["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"])
13
- .optional()
14
- .describe("HTTP method"),
15
- body: z.any().optional().describe("Request body as a string"),
16
- authenticationId: AuthenticationIdPropertySchema.optional(),
17
- callbackUrl: z
18
- .string()
19
- .url()
20
- .optional()
21
- .describe("URL to send async response to (makes request async)"),
22
- authenticationTemplate: z
23
- .string()
24
- .optional()
25
- .describe("Optional JSON string authentication template to bypass Notary lookup"),
26
- headers: z
27
- .union([
28
- z.record(z.string(), z.string()),
29
- z.instanceof(Headers),
30
- z.array(z.tuple([z.string(), z.string()])),
31
- ])
32
- .optional()
33
- .describe("Request headers"),
34
- })
35
- .extend({
36
- relayBaseUrl: z.string().optional().describe("Base URL for Relay service"),
37
- })
38
- .merge(TelemetryMarkerSchema)
39
- .describe("Make authenticated HTTP requests through Zapier's Relay service");
40
- // Legacy exports for compatibility
41
- export const RelayFetchSchema = RelayRequestSchema;
@@ -1,33 +0,0 @@
1
- import type { Plugin, GetSdkType } from "../../types/plugin";
2
- import type { ApiClient } from "../../api";
3
- import { RunActionSchema, type RunActionOptions } from "./schemas";
4
- import type { GetActionPluginProvides } from "../getAction";
5
- import type { GetAppPluginProvides } from "../getApp";
6
- import type { GetVersionedImplementationId } from "../manifest/schemas";
7
- import type { EventEmissionContext } from "../eventEmission";
8
- export interface RunActionPluginProvides {
9
- runAction: (options?: RunActionOptions) => Promise<{
10
- data: any[];
11
- nextCursor?: string;
12
- }> & AsyncIterable<{
13
- data: any[];
14
- nextCursor?: string;
15
- }> & {
16
- items(): AsyncIterable<any>;
17
- };
18
- context: {
19
- meta: {
20
- runAction: {
21
- inputSchema: typeof RunActionSchema;
22
- };
23
- };
24
- };
25
- }
26
- export declare const runActionPlugin: Plugin<GetSdkType<GetActionPluginProvides & GetAppPluginProvides>, // requires getAction and getApp in SDK
27
- // requires getAction and getApp in SDK
28
- {
29
- api: ApiClient;
30
- getVersionedImplementationId: GetVersionedImplementationId;
31
- } & EventEmissionContext, // requires api and eventEmission in context
32
- RunActionPluginProvides>;
33
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/runAction/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EACL,eAAe,EACf,KAAK,gBAAgB,EAEtB,MAAM,WAAW,CAAC;AAQnB,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAQtD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAExE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAG7D,MAAM,WAAW,uBAAuB;IACtC,SAAS,EAAE,CAAC,OAAO,CAAC,EAAE,gBAAgB,KAAK,OAAO,CAAC;QACjD,IAAI,EAAE,GAAG,EAAE,CAAC;QACZ,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC,GACA,aAAa,CAAC;QAAE,IAAI,EAAE,GAAG,EAAE,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG;QACpD,KAAK,IAAI,aAAa,CAAC,GAAG,CAAC,CAAC;KAC7B,CAAC;IACJ,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,SAAS,EAAE;gBACT,WAAW,EAAE,OAAO,eAAe,CAAC;aACrC,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAgFD,eAAO,MAAM,eAAe,EAAE,MAAM,CAClC,UAAU,CAAC,uBAAuB,GAAG,oBAAoB,CAAC,EAAE,uCAAuC;AACnG,AAD4D,uCAAuC;AACnG;IACE,GAAG,EAAE,SAAS,CAAC;IACf,4BAA4B,EAAE,4BAA4B,CAAC;CAC5D,GAAG,oBAAoB,EAAE,4CAA4C;AACtE,uBAAuB,CAkGxB,CAAC"}
@@ -1,108 +0,0 @@
1
- import { RunActionSchema, } from "./schemas";
2
- import { ActionResultItemSchema } from "../../schemas/Run";
3
- import { ZapierValidationError, ZapierConfigurationError, ZapierActionError, } from "../../types/errors";
4
- import { createPaginatedFunction } from "../../utils/function-utils";
5
- import { appKeyResolver, actionTypeResolver, actionKeyResolver, authenticationIdResolver, inputsResolver, } from "../../resolvers";
6
- import { createTelemetryCallback } from "../../utils/telemetry-utils";
7
- import { stripPageSuffix } from "../../utils/string-utils";
8
- async function executeAction(actionOptions) {
9
- const { api, context, appKey, actionId, actionKey, actionType, executionOptions, authenticationId, } = actionOptions;
10
- // Use the manifest plugin to get the current implementation ID
11
- const selectedApi = await context.getVersionedImplementationId(appKey);
12
- if (!selectedApi) {
13
- throw new ZapierConfigurationError("No current_implementation_id found for app", { configType: "current_implementation_id" });
14
- }
15
- // Step 1: POST to /actions/v1/runs to start execution
16
- const runRequestData = {
17
- selected_api: selectedApi,
18
- action_id: actionId,
19
- action_key: actionKey,
20
- action_type: actionType,
21
- inputs: executionOptions.inputs || {},
22
- };
23
- // Only include authentication_id if it's provided
24
- if (authenticationId !== null && authenticationId !== undefined) {
25
- runRequestData.authentication_id = authenticationId;
26
- }
27
- const runRequest = {
28
- data: runRequestData,
29
- };
30
- const runData = await api.post("/zapier/api/actions/v1/runs", runRequest);
31
- const runId = runData.data.id;
32
- // Step 2: Poll GET /actions/v1/runs/{run_id} for results
33
- return await api.poll(`/zapier/api/actions/v1/runs/${runId}`, {
34
- successStatus: 200,
35
- pendingStatus: 202,
36
- resultExtractor: (result) => result.data,
37
- });
38
- }
39
- export const runActionPlugin = ({ sdk, context }) => {
40
- async function runActionPage(options) {
41
- const { api } = context;
42
- const { appKey, actionKey, actionType, authenticationId, inputs = {}, } = options;
43
- // Validate that the action exists using the getAction plugin
44
- const actionData = await sdk.getAction({
45
- appKey: appKey,
46
- actionKey: actionKey,
47
- actionType: actionType,
48
- _telemetry: { isNested: true },
49
- });
50
- // Validate action type matches
51
- if (actionData.data.action_type !== actionType) {
52
- throw new ZapierValidationError(`Action type mismatch: expected ${actionType}, got ${actionData.data.action_type}`);
53
- }
54
- const actionId = actionData.data.id;
55
- // Execute the action using the Actions API (supports all action types)
56
- const result = await executeAction({
57
- api,
58
- context,
59
- appKey,
60
- // Some actions require the action ID to run them, but technically the ID is not guaranteed to be available when
61
- // we retrieve actions (probably legacy reasons), so we just pass along all the things!
62
- actionId,
63
- actionKey,
64
- actionType,
65
- executionOptions: { inputs },
66
- authenticationId,
67
- options,
68
- });
69
- // Check for errors in the result and throw if present
70
- if (result.errors && result.errors.length > 0) {
71
- const errorMessage = result.errors
72
- .map((error) => error.detail || error.title || "Unknown error")
73
- .join("; ");
74
- throw new ZapierActionError(`Action execution failed: ${errorMessage}`, {
75
- appKey,
76
- actionKey,
77
- });
78
- }
79
- // Return the results array wrapped in data with empty nextCursor (no pagination for action execution)
80
- return {
81
- data: result.results || [],
82
- nextCursor: undefined, // No pagination implemented yet
83
- };
84
- }
85
- const methodName = stripPageSuffix(runActionPage.name);
86
- const runActionDefinition = createPaginatedFunction(runActionPage, RunActionSchema, createTelemetryCallback(context.eventEmission.emitMethodCalled, methodName), methodName);
87
- return {
88
- runAction: runActionDefinition,
89
- context: {
90
- meta: {
91
- runAction: {
92
- categories: ["action"],
93
- type: "list",
94
- itemType: "ActionResult",
95
- inputSchema: RunActionSchema,
96
- outputSchema: ActionResultItemSchema,
97
- resolvers: {
98
- appKey: appKeyResolver,
99
- actionType: actionTypeResolver,
100
- actionKey: actionKeyResolver,
101
- authenticationId: authenticationIdResolver,
102
- inputs: inputsResolver,
103
- },
104
- },
105
- },
106
- },
107
- };
108
- };
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=index.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../../src/plugins/runAction/index.test.ts"],"names":[],"mappings":""}