@zapier/zapier-sdk 0.4.1 → 0.5.1

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 (375) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +343 -0
  3. package/dist/api/auth.d.ts +9 -0
  4. package/dist/api/auth.d.ts.map +1 -0
  5. package/dist/api/auth.js +25 -0
  6. package/dist/api/client.d.ts +9 -0
  7. package/dist/api/client.d.ts.map +1 -0
  8. package/dist/api/client.js +322 -0
  9. package/dist/api/debug.d.ts +13 -0
  10. package/dist/api/debug.d.ts.map +1 -0
  11. package/dist/api/debug.js +55 -0
  12. package/dist/api/index.d.ts +29 -0
  13. package/dist/api/index.d.ts.map +1 -0
  14. package/dist/api/index.js +41 -0
  15. package/dist/api/polling.d.ts +16 -0
  16. package/dist/api/polling.d.ts.map +1 -0
  17. package/dist/api/polling.js +45 -0
  18. package/dist/api/schemas.d.ts +2473 -0
  19. package/dist/api/schemas.d.ts.map +1 -0
  20. package/dist/api/schemas.js +355 -0
  21. package/dist/api/types.d.ts +75 -0
  22. package/dist/api/types.d.ts.map +1 -0
  23. package/dist/api/types.js +11 -0
  24. package/dist/auth.d.ts +34 -0
  25. package/dist/auth.d.ts.map +1 -0
  26. package/dist/auth.js +47 -0
  27. package/dist/constants.d.ts +10 -0
  28. package/dist/constants.d.ts.map +1 -0
  29. package/dist/constants.js +9 -0
  30. package/dist/index.cjs +2108 -1379
  31. package/dist/index.d.mts +2440 -620
  32. package/dist/index.d.ts +17 -892
  33. package/dist/index.d.ts.map +1 -0
  34. package/dist/index.js +20 -0
  35. package/dist/index.mjs +2093 -1362
  36. package/dist/plugins/api/index.d.ts +14 -0
  37. package/dist/plugins/api/index.d.ts.map +1 -0
  38. package/dist/plugins/api/index.js +21 -0
  39. package/dist/plugins/apps/index.d.ts +11 -0
  40. package/dist/plugins/apps/index.d.ts.map +1 -0
  41. package/dist/plugins/apps/index.js +91 -0
  42. package/dist/plugins/apps/types.d.ts +30 -0
  43. package/dist/plugins/apps/types.d.ts.map +1 -0
  44. package/dist/plugins/apps/types.js +2 -0
  45. package/dist/plugins/fetch/index.d.ts +21 -0
  46. package/dist/plugins/fetch/index.d.ts.map +1 -0
  47. package/dist/plugins/fetch/index.js +20 -0
  48. package/dist/plugins/findFirstAuthentication/index.d.ts +20 -0
  49. package/dist/plugins/findFirstAuthentication/index.d.ts.map +1 -0
  50. package/dist/plugins/findFirstAuthentication/index.js +24 -0
  51. package/dist/plugins/findFirstAuthentication/index.test.d.ts +2 -0
  52. package/dist/plugins/findFirstAuthentication/index.test.d.ts.map +1 -0
  53. package/dist/plugins/findFirstAuthentication/index.test.js +171 -0
  54. package/dist/plugins/findFirstAuthentication/schemas.d.ts +29 -0
  55. package/dist/plugins/findFirstAuthentication/schemas.d.ts.map +1 -0
  56. package/dist/plugins/findFirstAuthentication/schemas.js +18 -0
  57. package/dist/plugins/findUniqueAuthentication/index.d.ts +20 -0
  58. package/dist/plugins/findUniqueAuthentication/index.d.ts.map +1 -0
  59. package/dist/plugins/findUniqueAuthentication/index.js +31 -0
  60. package/dist/plugins/findUniqueAuthentication/index.test.d.ts +2 -0
  61. package/dist/plugins/findUniqueAuthentication/index.test.d.ts.map +1 -0
  62. package/dist/plugins/findUniqueAuthentication/index.test.js +152 -0
  63. package/dist/plugins/findUniqueAuthentication/schemas.d.ts +29 -0
  64. package/dist/plugins/findUniqueAuthentication/schemas.d.ts.map +1 -0
  65. package/dist/plugins/findUniqueAuthentication/schemas.js +18 -0
  66. package/dist/plugins/getAction/index.d.ts +23 -0
  67. package/dist/plugins/getAction/index.d.ts.map +1 -0
  68. package/dist/plugins/getAction/index.js +28 -0
  69. package/dist/plugins/getAction/index.test.d.ts +2 -0
  70. package/dist/plugins/getAction/index.test.d.ts.map +1 -0
  71. package/dist/plugins/getAction/index.test.js +186 -0
  72. package/dist/plugins/getAction/schemas.d.ts +23 -0
  73. package/dist/plugins/getAction/schemas.d.ts.map +1 -0
  74. package/dist/plugins/getAction/schemas.js +10 -0
  75. package/dist/plugins/getApp/index.d.ts +22 -0
  76. package/dist/plugins/getApp/index.d.ts.map +1 -0
  77. package/dist/plugins/getApp/index.js +39 -0
  78. package/dist/plugins/getApp/index.test.d.ts +2 -0
  79. package/dist/plugins/getApp/index.test.d.ts.map +1 -0
  80. package/dist/plugins/getApp/index.test.js +100 -0
  81. package/dist/plugins/getApp/schemas.d.ts +18 -0
  82. package/dist/plugins/getApp/schemas.d.ts.map +1 -0
  83. package/dist/plugins/getApp/schemas.js +10 -0
  84. package/dist/plugins/getAuthentication/index.d.ts +22 -0
  85. package/dist/plugins/getAuthentication/index.d.ts.map +1 -0
  86. package/dist/plugins/getAuthentication/index.js +41 -0
  87. package/dist/plugins/getAuthentication/index.test.d.ts +2 -0
  88. package/dist/plugins/getAuthentication/index.test.d.ts.map +1 -0
  89. package/dist/plugins/getAuthentication/index.test.js +205 -0
  90. package/dist/plugins/getAuthentication/schemas.d.ts +17 -0
  91. package/dist/plugins/getAuthentication/schemas.d.ts.map +1 -0
  92. package/dist/plugins/getAuthentication/schemas.js +11 -0
  93. package/dist/plugins/getProfile/index.d.ts +23 -0
  94. package/dist/plugins/getProfile/index.d.ts.map +1 -0
  95. package/dist/plugins/getProfile/index.js +29 -0
  96. package/dist/plugins/getProfile/schemas.d.ts +13 -0
  97. package/dist/plugins/getProfile/schemas.d.ts.map +1 -0
  98. package/dist/plugins/getProfile/schemas.js +5 -0
  99. package/dist/plugins/listActions/index.d.ts +28 -0
  100. package/dist/plugins/listActions/index.d.ts.map +1 -0
  101. package/dist/plugins/listActions/index.js +61 -0
  102. package/dist/plugins/listActions/index.test.d.ts +2 -0
  103. package/dist/plugins/listActions/index.test.d.ts.map +1 -0
  104. package/dist/plugins/listActions/index.test.js +467 -0
  105. package/dist/plugins/listActions/schemas.d.ts +29 -0
  106. package/dist/plugins/listActions/schemas.d.ts.map +1 -0
  107. package/dist/plugins/listActions/schemas.js +21 -0
  108. package/dist/plugins/listApps/index.d.ts +28 -0
  109. package/dist/plugins/listApps/index.d.ts.map +1 -0
  110. package/dist/plugins/listApps/index.js +62 -0
  111. package/dist/plugins/listApps/index.test.d.ts +2 -0
  112. package/dist/plugins/listApps/index.test.d.ts.map +1 -0
  113. package/dist/plugins/listApps/index.test.js +313 -0
  114. package/dist/plugins/listApps/schemas.d.ts +30 -0
  115. package/dist/plugins/listApps/schemas.d.ts.map +1 -0
  116. package/dist/plugins/listApps/schemas.js +23 -0
  117. package/dist/plugins/listAuthentications/index.d.ts +28 -0
  118. package/dist/plugins/listAuthentications/index.d.ts.map +1 -0
  119. package/dist/plugins/listAuthentications/index.js +77 -0
  120. package/dist/plugins/listAuthentications/index.test.d.ts +2 -0
  121. package/dist/plugins/listAuthentications/index.test.d.ts.map +1 -0
  122. package/dist/plugins/listAuthentications/index.test.js +564 -0
  123. package/dist/plugins/listAuthentications/schemas.d.ts +38 -0
  124. package/dist/plugins/listAuthentications/schemas.d.ts.map +1 -0
  125. package/dist/plugins/listAuthentications/schemas.js +28 -0
  126. package/dist/plugins/listInputFields/index.d.ts +28 -0
  127. package/dist/plugins/listInputFields/index.d.ts.map +1 -0
  128. package/dist/plugins/listInputFields/index.js +133 -0
  129. package/dist/plugins/listInputFields/index.test.d.ts +2 -0
  130. package/dist/plugins/listInputFields/index.test.d.ts.map +1 -0
  131. package/dist/plugins/listInputFields/index.test.js +325 -0
  132. package/dist/plugins/listInputFields/schemas.d.ts +38 -0
  133. package/dist/plugins/listInputFields/schemas.d.ts.map +1 -0
  134. package/dist/plugins/listInputFields/schemas.js +22 -0
  135. package/dist/plugins/registry/index.d.ts +11 -0
  136. package/dist/plugins/registry/index.d.ts.map +1 -0
  137. package/dist/plugins/registry/index.js +14 -0
  138. package/dist/plugins/request/index.d.ts +19 -0
  139. package/dist/plugins/request/index.d.ts.map +1 -0
  140. package/dist/plugins/request/index.js +62 -0
  141. package/dist/plugins/request/index.test.d.ts +2 -0
  142. package/dist/plugins/request/index.test.d.ts.map +1 -0
  143. package/dist/plugins/request/index.test.js +256 -0
  144. package/dist/plugins/request/schemas.d.ts +69 -0
  145. package/dist/plugins/request/schemas.d.ts.map +1 -0
  146. package/dist/plugins/request/schemas.js +42 -0
  147. package/dist/plugins/runAction/index.d.ts +28 -0
  148. package/dist/plugins/runAction/index.d.ts.map +1 -0
  149. package/dist/plugins/runAction/index.js +86 -0
  150. package/dist/plugins/runAction/index.test.d.ts +2 -0
  151. package/dist/plugins/runAction/index.test.d.ts.map +1 -0
  152. package/dist/plugins/runAction/index.test.js +320 -0
  153. package/dist/plugins/runAction/schemas.d.ts +37 -0
  154. package/dist/plugins/runAction/schemas.d.ts.map +1 -0
  155. package/dist/plugins/runAction/schemas.js +22 -0
  156. package/dist/resolvers/actionKey.d.ts +9 -0
  157. package/dist/resolvers/actionKey.d.ts.map +1 -0
  158. package/dist/resolvers/actionKey.js +19 -0
  159. package/dist/resolvers/actionType.d.ts +9 -0
  160. package/dist/resolvers/actionType.d.ts.map +1 -0
  161. package/dist/resolvers/actionType.js +22 -0
  162. package/dist/resolvers/appKey.d.ts +7 -0
  163. package/dist/resolvers/appKey.d.ts.map +1 -0
  164. package/dist/resolvers/appKey.js +5 -0
  165. package/dist/resolvers/authenticationId.d.ts +9 -0
  166. package/dist/resolvers/authenticationId.d.ts.map +1 -0
  167. package/dist/resolvers/authenticationId.js +33 -0
  168. package/dist/resolvers/index.d.ts +40 -0
  169. package/dist/resolvers/index.d.ts.map +1 -0
  170. package/dist/resolvers/index.js +91 -0
  171. package/dist/resolvers/inputs.d.ts +8 -0
  172. package/dist/resolvers/inputs.d.ts.map +1 -0
  173. package/dist/resolvers/inputs.js +14 -0
  174. package/dist/schemas/Action.d.ts +243 -0
  175. package/dist/schemas/Action.d.ts.map +1 -0
  176. package/dist/schemas/Action.js +34 -0
  177. package/dist/schemas/App.d.ts +26 -0
  178. package/dist/schemas/App.d.ts.map +1 -0
  179. package/dist/schemas/App.js +22 -0
  180. package/dist/schemas/Auth.d.ts +161 -0
  181. package/dist/schemas/Auth.d.ts.map +1 -0
  182. package/dist/schemas/Auth.js +41 -0
  183. package/dist/schemas/Field.d.ts +144 -0
  184. package/dist/schemas/Field.d.ts.map +1 -0
  185. package/dist/schemas/Field.js +105 -0
  186. package/dist/schemas/UserProfile.d.ts +163 -0
  187. package/dist/schemas/UserProfile.d.ts.map +1 -0
  188. package/dist/schemas/UserProfile.js +29 -0
  189. package/dist/sdk.d.ts +10 -0
  190. package/dist/sdk.d.ts.map +1 -0
  191. package/dist/sdk.js +94 -0
  192. package/dist/sdk.test.d.ts +2 -0
  193. package/dist/sdk.test.d.ts.map +1 -0
  194. package/dist/sdk.test.js +135 -0
  195. package/dist/types/domain.d.ts +36 -0
  196. package/dist/types/domain.d.ts.map +1 -0
  197. package/dist/types/domain.js +1 -0
  198. package/dist/types/domain.test.d.ts +2 -0
  199. package/dist/types/domain.test.d.ts.map +1 -0
  200. package/dist/types/domain.test.js +39 -0
  201. package/dist/types/errors.d.ts +143 -0
  202. package/dist/types/errors.d.ts.map +1 -0
  203. package/dist/types/errors.js +187 -0
  204. package/dist/types/events.d.ts +38 -0
  205. package/dist/types/events.d.ts.map +1 -0
  206. package/dist/types/events.js +7 -0
  207. package/dist/types/functions.d.ts +26 -0
  208. package/dist/types/functions.d.ts.map +1 -0
  209. package/dist/types/functions.js +4 -0
  210. package/dist/types/plugin.d.ts +61 -0
  211. package/dist/types/plugin.d.ts.map +1 -0
  212. package/dist/types/plugin.js +9 -0
  213. package/dist/types/properties.d.ts +22 -0
  214. package/dist/types/properties.d.ts.map +1 -0
  215. package/dist/types/properties.js +50 -0
  216. package/dist/types/sdk.d.ts +43 -0
  217. package/dist/types/sdk.d.ts.map +1 -0
  218. package/dist/types/sdk.js +4 -0
  219. package/dist/utils/array-utils.d.ts +31 -0
  220. package/dist/utils/array-utils.d.ts.map +1 -0
  221. package/dist/utils/array-utils.js +36 -0
  222. package/dist/utils/array-utils.test.d.ts +2 -0
  223. package/dist/utils/array-utils.test.d.ts.map +1 -0
  224. package/dist/utils/array-utils.test.js +107 -0
  225. package/dist/utils/domain-utils.d.ts +78 -0
  226. package/dist/utils/domain-utils.d.ts.map +1 -0
  227. package/dist/utils/domain-utils.js +218 -0
  228. package/dist/utils/domain-utils.test.d.ts +2 -0
  229. package/dist/utils/domain-utils.test.d.ts.map +1 -0
  230. package/dist/utils/domain-utils.test.js +192 -0
  231. package/dist/utils/function-utils.d.ts +45 -0
  232. package/dist/utils/function-utils.d.ts.map +1 -0
  233. package/dist/utils/function-utils.js +158 -0
  234. package/dist/utils/function-utils.test.d.ts +2 -0
  235. package/dist/utils/function-utils.test.d.ts.map +1 -0
  236. package/dist/utils/function-utils.test.js +110 -0
  237. package/dist/utils/pagination-utils.d.ts +37 -0
  238. package/dist/utils/pagination-utils.d.ts.map +1 -0
  239. package/dist/utils/pagination-utils.js +165 -0
  240. package/dist/utils/pagination-utils.test.d.ts +17 -0
  241. package/dist/utils/pagination-utils.test.d.ts.map +1 -0
  242. package/dist/utils/pagination-utils.test.js +461 -0
  243. package/dist/utils/schema-utils.d.ts +45 -0
  244. package/dist/utils/schema-utils.d.ts.map +1 -0
  245. package/dist/utils/schema-utils.js +65 -0
  246. package/dist/utils/validation.d.ts +4 -0
  247. package/dist/utils/validation.d.ts.map +1 -0
  248. package/dist/utils/validation.js +30 -0
  249. package/dist/utils/validation.test.d.ts +2 -0
  250. package/dist/utils/validation.test.d.ts.map +1 -0
  251. package/dist/utils/validation.test.js +43 -0
  252. package/package.json +12 -3
  253. package/src/api/client.ts +394 -171
  254. package/src/api/debug.ts +10 -1
  255. package/src/api/index.ts +0 -2
  256. package/src/api/polling.ts +28 -7
  257. package/src/api/schemas.ts +387 -0
  258. package/src/api/types.ts +72 -136
  259. package/src/constants.ts +10 -0
  260. package/src/index.ts +40 -19
  261. package/src/plugins/api/index.ts +47 -0
  262. package/src/plugins/apps/index.ts +25 -19
  263. package/src/plugins/apps/types.ts +7 -11
  264. package/src/plugins/fetch/index.ts +48 -40
  265. package/src/plugins/findFirstAuthentication/index.test.ts +206 -0
  266. package/src/plugins/findFirstAuthentication/index.ts +55 -0
  267. package/src/plugins/findFirstAuthentication/schemas.ts +41 -0
  268. package/src/plugins/findUniqueAuthentication/index.test.ts +197 -0
  269. package/src/plugins/findUniqueAuthentication/index.ts +72 -0
  270. package/src/plugins/findUniqueAuthentication/schemas.ts +42 -0
  271. package/src/plugins/getAction/index.test.ts +239 -0
  272. package/src/plugins/getAction/index.ts +57 -0
  273. package/src/plugins/getAction/schemas.ts +33 -0
  274. package/src/plugins/getApp/index.test.ts +127 -0
  275. package/src/plugins/getApp/index.ts +66 -0
  276. package/src/plugins/getApp/schemas.ts +38 -0
  277. package/src/plugins/getAuthentication/index.test.ts +284 -0
  278. package/src/plugins/getAuthentication/index.ts +86 -0
  279. package/src/plugins/getAuthentication/schemas.ts +31 -0
  280. package/src/plugins/getProfile/index.ts +55 -0
  281. package/src/plugins/getProfile/schemas.ts +26 -0
  282. package/src/plugins/listActions/index.test.ts +582 -0
  283. package/src/plugins/listActions/index.ts +115 -0
  284. package/src/plugins/listActions/schemas.ts +54 -0
  285. package/src/plugins/listApps/index.test.ts +357 -0
  286. package/src/plugins/listApps/index.ts +121 -0
  287. package/src/plugins/listApps/schemas.ts +49 -0
  288. package/src/plugins/listAuthentications/index.test.ts +709 -0
  289. package/src/plugins/listAuthentications/index.ts +136 -0
  290. package/src/plugins/listAuthentications/schemas.ts +60 -0
  291. package/src/plugins/listInputFields/index.test.ts +408 -0
  292. package/src/plugins/listInputFields/index.ts +204 -0
  293. package/src/plugins/listInputFields/schemas.ts +56 -0
  294. package/src/plugins/registry/index.ts +30 -0
  295. package/src/plugins/request/index.test.ts +329 -0
  296. package/src/plugins/request/index.ts +103 -0
  297. package/src/{functions → plugins}/request/schemas.ts +20 -9
  298. package/src/plugins/runAction/index.test.ts +387 -0
  299. package/src/plugins/runAction/index.ts +176 -0
  300. package/src/plugins/runAction/schemas.ts +53 -0
  301. package/src/resolvers/actionKey.ts +6 -4
  302. package/src/resolvers/actionType.ts +7 -2
  303. package/src/resolvers/appKey.ts +1 -1
  304. package/src/resolvers/authenticationId.ts +12 -3
  305. package/src/resolvers/inputs.ts +3 -1
  306. package/src/schemas/Action.ts +18 -12
  307. package/src/schemas/App.ts +11 -19
  308. package/src/schemas/Auth.ts +18 -13
  309. package/src/schemas/Field.ts +106 -11
  310. package/src/schemas/UserProfile.ts +43 -0
  311. package/src/sdk.test.ts +212 -0
  312. package/src/sdk.ts +132 -102
  313. package/src/types/domain.test.ts +50 -0
  314. package/src/types/domain.ts +43 -75
  315. package/src/types/errors.ts +275 -0
  316. package/src/types/functions.ts +27 -0
  317. package/src/types/optional-zapier-sdk-cli-login.d.ts +37 -0
  318. package/src/types/plugin.ts +105 -0
  319. package/src/types/properties.ts +4 -3
  320. package/src/types/sdk.ts +70 -48
  321. package/src/utils/array-utils.test.ts +131 -0
  322. package/src/utils/array-utils.ts +41 -0
  323. package/src/utils/domain-utils.test.ts +239 -0
  324. package/src/utils/domain-utils.ts +283 -0
  325. package/src/utils/function-utils.test.ts +141 -0
  326. package/src/utils/function-utils.ts +245 -0
  327. package/src/utils/pagination-utils.test.ts +620 -0
  328. package/src/utils/pagination-utils.ts +242 -0
  329. package/src/utils/validation.test.ts +50 -0
  330. package/src/utils/validation.ts +44 -0
  331. package/tsconfig.build.json +16 -2
  332. package/tsconfig.json +3 -1
  333. package/tsconfig.tsbuildinfo +1 -0
  334. package/tsup.config.ts +2 -0
  335. package/src/functions/bundleCode/index.ts +0 -78
  336. package/src/functions/bundleCode/info.ts +0 -9
  337. package/src/functions/bundleCode/schemas.ts +0 -30
  338. package/src/functions/findFirstAuthentication/index.ts +0 -24
  339. package/src/functions/findFirstAuthentication/info.ts +0 -9
  340. package/src/functions/findFirstAuthentication/schemas.ts +0 -50
  341. package/src/functions/findUniqueAuthentication/index.ts +0 -35
  342. package/src/functions/findUniqueAuthentication/info.ts +0 -9
  343. package/src/functions/findUniqueAuthentication/schemas.ts +0 -50
  344. package/src/functions/generateTypes/index.ts +0 -363
  345. package/src/functions/generateTypes/info.ts +0 -9
  346. package/src/functions/generateTypes/schemas.ts +0 -31
  347. package/src/functions/getAction/index.ts +0 -33
  348. package/src/functions/getAction/info.ts +0 -9
  349. package/src/functions/getAction/schemas.ts +0 -25
  350. package/src/functions/getApp/index.ts +0 -41
  351. package/src/functions/getApp/info.ts +0 -9
  352. package/src/functions/getApp/schemas.ts +0 -20
  353. package/src/functions/getAuthentication/index.ts +0 -50
  354. package/src/functions/getAuthentication/info.ts +0 -9
  355. package/src/functions/getAuthentication/schemas.ts +0 -29
  356. package/src/functions/listActions/index.ts +0 -149
  357. package/src/functions/listActions/info.ts +0 -9
  358. package/src/functions/listActions/schemas.ts +0 -30
  359. package/src/functions/listApps/index.ts +0 -60
  360. package/src/functions/listApps/info.ts +0 -9
  361. package/src/functions/listApps/schemas.ts +0 -32
  362. package/src/functions/listAuthentications/index.ts +0 -162
  363. package/src/functions/listAuthentications/info.ts +0 -9
  364. package/src/functions/listAuthentications/schemas.ts +0 -50
  365. package/src/functions/listFields/index.ts +0 -86
  366. package/src/functions/listFields/info.ts +0 -9
  367. package/src/functions/listFields/schemas.ts +0 -36
  368. package/src/functions/request/index.ts +0 -150
  369. package/src/functions/request/info.ts +0 -11
  370. package/src/functions/runAction/index.ts +0 -127
  371. package/src/functions/runAction/info.ts +0 -9
  372. package/src/functions/runAction/schemas.ts +0 -34
  373. package/src/plugins/apps/info.ts +0 -12
  374. package/src/plugins/fetch/types.ts +0 -2
  375. /package/src/{schema-utils.ts → utils/schema-utils.ts} +0 -0
package/dist/index.d.ts CHANGED
@@ -1,892 +1,17 @@
1
- import { z } from 'zod';
2
-
3
- interface Integration {
4
- key: string;
5
- name: string;
6
- description: string;
7
- version: string;
8
- category?: string;
9
- actions: Action[];
10
- triggers: Trigger[];
11
- current_implementation_id?: string;
12
- }
13
- interface Action {
14
- key: string;
15
- name: string;
16
- description: string;
17
- appKey: string;
18
- type: "read" | "read_bulk" | "write" | "run" | "search" | "search_or_write" | "search_and_write" | "filter";
19
- inputFields: Field[];
20
- outputFields: Field[];
21
- }
22
- interface Trigger {
23
- key: string;
24
- name: string;
25
- description: string;
26
- appKey: string;
27
- type: "instant" | "polling" | "webhook";
28
- outputFields: Field[];
29
- }
30
- interface Field {
31
- key: string;
32
- label: string;
33
- type: "string" | "number" | "boolean" | "datetime" | "file" | "object" | "array";
34
- required: boolean;
35
- description?: string;
36
- choices?: Choice[];
37
- }
38
- interface Choice {
39
- value: string | number;
40
- label: string;
41
- }
42
- interface ActionExecutionResult {
43
- success: boolean;
44
- data?: any;
45
- error?: string;
46
- metadata?: {
47
- executionTime?: number;
48
- requestId?: string;
49
- };
50
- }
51
- interface ActionField {
52
- key: string;
53
- label?: string;
54
- required: boolean;
55
- type?: string;
56
- helpText?: string;
57
- helpTextHtml?: string;
58
- choices?: ActionFieldChoice[];
59
- default?: string;
60
- placeholder?: string;
61
- computed?: boolean;
62
- customField?: boolean;
63
- dependsOn?: string[];
64
- format?: string;
65
- inputFormat?: string[];
66
- }
67
- interface ActionFieldChoice {
68
- value: string | number;
69
- label: string;
70
- }
71
- interface NeedsRequest {
72
- selected_api: string;
73
- action: string;
74
- type_of: string;
75
- authentication_id?: number;
76
- params?: Record<string, any>;
77
- }
78
- interface NeedsResponse {
79
- success: boolean;
80
- needs?: ActionField[];
81
- errors?: string[];
82
- }
83
- interface Authentication {
84
- id: number;
85
- date: string;
86
- lastchanged?: string;
87
- account_id: number;
88
- customuser_id?: number;
89
- selected_api: string;
90
- destination_selected_api?: string | null;
91
- is_invite_only: boolean;
92
- is_private: boolean;
93
- shared_with_all: boolean;
94
- is_stale?: string;
95
- is_shared?: string;
96
- marked_stale_at?: string | null;
97
- label?: string | null;
98
- identifier?: string | null;
99
- title?: string | null;
100
- url?: string;
101
- groups?: string;
102
- members?: string;
103
- permissions?: Record<string, boolean>;
104
- }
105
- interface AuthenticationsResponse {
106
- count: number;
107
- next?: string | null;
108
- previous?: string | null;
109
- results: Authentication[];
110
- }
111
-
112
- /**
113
- * SDK Event System
114
- *
115
- * This module provides common event type definitions for the SDK's
116
- * event system, including authentication, API, and loading events.
117
- */
118
- interface SdkEvent {
119
- type: string;
120
- payload?: Record<string, any>;
121
- timestamp?: number;
122
- }
123
- interface AuthEvent extends SdkEvent {
124
- type: "auth_refreshing" | "auth_success" | "auth_error" | "auth_logout";
125
- payload?: {
126
- message?: string;
127
- error?: string;
128
- operation?: string;
129
- };
130
- }
131
- interface ApiEvent extends SdkEvent {
132
- type: "api_request" | "api_response" | "api_error";
133
- payload?: {
134
- url?: string;
135
- method?: string;
136
- status?: number;
137
- duration?: number;
138
- error?: string;
139
- };
140
- }
141
- interface LoadingEvent extends SdkEvent {
142
- type: "loading_start" | "loading_end";
143
- payload?: {
144
- operation?: string;
145
- resource?: string;
146
- };
147
- }
148
- type EventCallback = (event: SdkEvent) => void;
149
-
150
- interface ActionExecutionOptions {
151
- inputs?: Record<string, any>;
152
- authenticationId?: number;
153
- }
154
- interface AuthObject {
155
- id: number;
156
- }
157
- interface BaseSdkOptions {
158
- token?: string;
159
- getToken?: () => Promise<string | undefined>;
160
- onEvent?: EventCallback;
161
- fetch?: typeof fetch;
162
- baseUrl?: string;
163
- debug?: boolean;
164
- }
165
- interface FunctionOptions {
166
- /** Base URL for Zapier API */
167
- baseUrl?: string;
168
- /** Authentication token */
169
- token?: string;
170
- /** Function to dynamically resolve authentication token */
171
- getToken?: () => Promise<string | undefined>;
172
- /** Optional pre-instantiated API client */
173
- api?: any;
174
- /** Enable debug logging */
175
- debug?: boolean;
176
- /** Custom fetch implementation */
177
- fetch?: typeof globalThis.fetch;
178
- }
179
- declare class ZapierSdkError extends Error {
180
- code?: string | undefined;
181
- constructor(message: string, code?: string | undefined);
182
- }
183
- declare class AppNotFoundError extends ZapierSdkError {
184
- appKey: string;
185
- constructor(appKey: string);
186
- }
187
-
188
- declare const AppKeyPropertySchema: z.ZodString;
189
- declare const ActionTypePropertySchema: z.ZodEnum<["read", "read_bulk", "write", "run", "search", "search_or_write", "search_and_write", "filter"]>;
190
- declare const ActionKeyPropertySchema: z.ZodString;
191
- declare const AuthenticationIdPropertySchema: z.ZodNumber;
192
- declare const InputsPropertySchema: z.ZodRecord<z.ZodString, z.ZodAny>;
193
- declare const LimitPropertySchema: z.ZodDefault<z.ZodNumber>;
194
- declare const OffsetPropertySchema: z.ZodDefault<z.ZodNumber>;
195
- declare const OutputPropertySchema: z.ZodString;
196
- declare const DebugPropertySchema: z.ZodDefault<z.ZodBoolean>;
197
- declare const ParamsPropertySchema: z.ZodRecord<z.ZodString, z.ZodAny>;
198
- type AppKeyProperty = z.infer<typeof AppKeyPropertySchema>;
199
- type ActionTypeProperty = z.infer<typeof ActionTypePropertySchema>;
200
- type ActionKeyProperty = z.infer<typeof ActionKeyPropertySchema>;
201
- type AuthenticationIdProperty = z.infer<typeof AuthenticationIdPropertySchema>;
202
- type InputsProperty = z.infer<typeof InputsPropertySchema>;
203
- type LimitProperty = z.infer<typeof LimitPropertySchema>;
204
- type OffsetProperty = z.infer<typeof OffsetPropertySchema>;
205
- type OutputProperty = z.infer<typeof OutputPropertySchema>;
206
- type DebugProperty = z.infer<typeof DebugPropertySchema>;
207
- type ParamsProperty = z.infer<typeof ParamsPropertySchema>;
208
-
209
- interface AppFactoryOptions {
210
- authenticationId: number;
211
- }
212
- interface BaseActionTypeProxy {
213
- [action: string]: (options?: ActionExecutionOptions) => Promise<ActionExecutionResult>;
214
- }
215
- interface FetchActionType {
216
- fetch: (url: string | URL, init?: RequestInit & {
217
- authenticationId?: number;
218
- callbackUrl?: string;
219
- authenticationTemplate?: string;
220
- }) => Promise<Response>;
221
- }
222
- type ActionTypeProxy = BaseActionTypeProxy & Partial<FetchActionType>;
223
- interface AppProxy {
224
- [type: string]: ActionTypeProxy;
225
- }
226
- interface AppFactory {
227
- (options: AppFactoryOptions): AppProxy;
228
- }
229
- type AppProxyWithFactory = AppFactory & AppProxy;
230
- interface ActionProxy {
231
- [app: string]: AppProxyWithFactory;
232
- }
233
- interface AppsPluginSdkExtension {
234
- apps: ActionProxy;
235
- }
236
-
237
- declare const ListActionsSchema: z.ZodObject<{
238
- appKey: z.ZodOptional<z.ZodString>;
239
- type: z.ZodOptional<z.ZodEnum<["read", "read_bulk", "write", "run", "search", "search_or_write", "search_and_write", "filter"]>>;
240
- }, "strip", z.ZodTypeAny, {
241
- type?: "read" | "read_bulk" | "write" | "run" | "search" | "search_or_write" | "search_and_write" | "filter" | undefined;
242
- appKey?: string | undefined;
243
- }, {
244
- type?: "read" | "read_bulk" | "write" | "run" | "search" | "search_or_write" | "search_and_write" | "filter" | undefined;
245
- appKey?: string | undefined;
246
- }>;
247
- type ListActionsOptions = z.infer<typeof ListActionsSchema> & FunctionOptions;
248
- interface ListActionsSdkFunction {
249
- listActions: (options?: Partial<ListActionsOptions>) => Promise<Action[]>;
250
- }
251
-
252
- declare const GetActionSchema: z.ZodObject<{
253
- appKey: z.ZodString;
254
- actionType: z.ZodEnum<["read", "read_bulk", "write", "run", "search", "search_or_write", "search_and_write", "filter"]>;
255
- actionKey: z.ZodString;
256
- }, "strip", z.ZodTypeAny, {
257
- appKey: string;
258
- actionType: "read" | "read_bulk" | "write" | "run" | "search" | "search_or_write" | "search_and_write" | "filter";
259
- actionKey: string;
260
- }, {
261
- appKey: string;
262
- actionType: "read" | "read_bulk" | "write" | "run" | "search" | "search_or_write" | "search_and_write" | "filter";
263
- actionKey: string;
264
- }>;
265
- type GetActionOptions = z.infer<typeof GetActionSchema> & FunctionOptions;
266
- interface GetActionSdkFunction {
267
- getAction: (options: GetActionOptions) => Promise<Action>;
268
- }
269
-
270
- declare const GetAppSchema: z.ZodObject<{
271
- appKey: z.ZodString;
272
- }, "strip", z.ZodTypeAny, {
273
- appKey: string;
274
- }, {
275
- appKey: string;
276
- }>;
277
- type GetAppOptions = z.infer<typeof GetAppSchema> & FunctionOptions;
278
- interface GetAppSdkFunction {
279
- getApp: (options: GetAppOptions) => Promise<Integration>;
280
- }
281
-
282
- declare const RunActionSchema: z.ZodObject<{
283
- appKey: z.ZodString;
284
- actionType: z.ZodEnum<["read", "read_bulk", "write", "run", "search", "search_or_write", "search_and_write", "filter"]>;
285
- actionKey: z.ZodString;
286
- inputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
287
- authenticationId: z.ZodOptional<z.ZodNumber>;
288
- }, "strip", z.ZodTypeAny, {
289
- appKey: string;
290
- actionType: "read" | "read_bulk" | "write" | "run" | "search" | "search_or_write" | "search_and_write" | "filter";
291
- actionKey: string;
292
- inputs?: Record<string, any> | undefined;
293
- authenticationId?: number | undefined;
294
- }, {
295
- appKey: string;
296
- actionType: "read" | "read_bulk" | "write" | "run" | "search" | "search_or_write" | "search_and_write" | "filter";
297
- actionKey: string;
298
- inputs?: Record<string, any> | undefined;
299
- authenticationId?: number | undefined;
300
- }>;
301
- type RunActionOptions = z.infer<typeof RunActionSchema> & FunctionOptions;
302
- interface RunActionSdkFunction {
303
- runAction: (options: RunActionOptions) => Promise<ActionExecutionResult>;
304
- }
305
-
306
- declare const ListFieldsSchema: z.ZodObject<{
307
- appKey: z.ZodString;
308
- actionType: z.ZodEnum<["read", "read_bulk", "write", "run", "search", "search_or_write", "search_and_write", "filter"]>;
309
- actionKey: z.ZodString;
310
- authenticationId: z.ZodOptional<z.ZodNumber>;
311
- params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
312
- }, "strip", z.ZodTypeAny, {
313
- appKey: string;
314
- actionType: "read" | "read_bulk" | "write" | "run" | "search" | "search_or_write" | "search_and_write" | "filter";
315
- actionKey: string;
316
- params?: Record<string, any> | undefined;
317
- authenticationId?: number | undefined;
318
- }, {
319
- appKey: string;
320
- actionType: "read" | "read_bulk" | "write" | "run" | "search" | "search_or_write" | "search_and_write" | "filter";
321
- actionKey: string;
322
- params?: Record<string, any> | undefined;
323
- authenticationId?: number | undefined;
324
- }>;
325
- type ListFieldsOptions = z.infer<typeof ListFieldsSchema> & FunctionOptions;
326
- interface ListFieldsSdkFunction {
327
- listFields: (options: ListFieldsOptions) => Promise<ActionField[]>;
328
- }
329
-
330
- declare const ListAuthenticationsSchema: z.ZodObject<{
331
- appKey: z.ZodOptional<z.ZodString>;
332
- search: z.ZodOptional<z.ZodString>;
333
- title: z.ZodOptional<z.ZodString>;
334
- account_id: z.ZodOptional<z.ZodString>;
335
- owner: z.ZodOptional<z.ZodString>;
336
- limit: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
337
- offset: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
338
- }, "strip", z.ZodTypeAny, {
339
- search?: string | undefined;
340
- appKey?: string | undefined;
341
- title?: string | undefined;
342
- account_id?: string | undefined;
343
- owner?: string | undefined;
344
- limit?: number | undefined;
345
- offset?: number | undefined;
346
- }, {
347
- search?: string | undefined;
348
- appKey?: string | undefined;
349
- title?: string | undefined;
350
- account_id?: string | undefined;
351
- owner?: string | undefined;
352
- limit?: number | undefined;
353
- offset?: number | undefined;
354
- }>;
355
- type ListAuthenticationsOptions = z.infer<typeof ListAuthenticationsSchema> & FunctionOptions;
356
- interface ListAuthenticationsSdkFunction {
357
- listAuthentications: (options?: Partial<ListAuthenticationsOptions>) => Promise<Authentication[]>;
358
- }
359
-
360
- declare const GetAuthenticationSchema: z.ZodObject<{
361
- authenticationId: z.ZodNumber;
362
- }, "strip", z.ZodTypeAny, {
363
- authenticationId: number;
364
- }, {
365
- authenticationId: number;
366
- }>;
367
- type GetAuthenticationOptions = z.infer<typeof GetAuthenticationSchema> & FunctionOptions;
368
- interface GetAuthenticationSdkFunction {
369
- getAuthentication: (options: GetAuthenticationOptions) => Promise<Authentication>;
370
- }
371
-
372
- declare const FindFirstAuthenticationSchema: z.ZodObject<{
373
- appKey: z.ZodOptional<z.ZodString>;
374
- search: z.ZodOptional<z.ZodString>;
375
- title: z.ZodOptional<z.ZodString>;
376
- account_id: z.ZodOptional<z.ZodString>;
377
- owner: z.ZodOptional<z.ZodString>;
378
- limit: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
379
- offset: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
380
- }, "strip", z.ZodTypeAny, {
381
- search?: string | undefined;
382
- appKey?: string | undefined;
383
- title?: string | undefined;
384
- account_id?: string | undefined;
385
- owner?: string | undefined;
386
- limit?: number | undefined;
387
- offset?: number | undefined;
388
- }, {
389
- search?: string | undefined;
390
- appKey?: string | undefined;
391
- title?: string | undefined;
392
- account_id?: string | undefined;
393
- owner?: string | undefined;
394
- limit?: number | undefined;
395
- offset?: number | undefined;
396
- }>;
397
- type FindFirstAuthenticationOptions = z.infer<typeof FindFirstAuthenticationSchema> & FunctionOptions;
398
- interface FindFirstAuthenticationSdkFunction {
399
- findFirstAuthentication: (options?: Partial<FindFirstAuthenticationOptions>) => Promise<Authentication | null>;
400
- }
401
-
402
- declare const FindUniqueAuthenticationSchema: z.ZodObject<{
403
- appKey: z.ZodOptional<z.ZodString>;
404
- search: z.ZodOptional<z.ZodString>;
405
- title: z.ZodOptional<z.ZodString>;
406
- account_id: z.ZodOptional<z.ZodString>;
407
- owner: z.ZodOptional<z.ZodString>;
408
- limit: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
409
- offset: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
410
- }, "strip", z.ZodTypeAny, {
411
- search?: string | undefined;
412
- appKey?: string | undefined;
413
- title?: string | undefined;
414
- account_id?: string | undefined;
415
- owner?: string | undefined;
416
- limit?: number | undefined;
417
- offset?: number | undefined;
418
- }, {
419
- search?: string | undefined;
420
- appKey?: string | undefined;
421
- title?: string | undefined;
422
- account_id?: string | undefined;
423
- owner?: string | undefined;
424
- limit?: number | undefined;
425
- offset?: number | undefined;
426
- }>;
427
- type FindUniqueAuthenticationOptions = z.infer<typeof FindUniqueAuthenticationSchema> & FunctionOptions;
428
- interface FindUniqueAuthenticationSdkFunction {
429
- findUniqueAuthentication: (options?: Partial<FindUniqueAuthenticationOptions>) => Promise<Authentication>;
430
- }
431
-
432
- declare const GenerateTypesSchema: z.ZodObject<{
433
- appKey: z.ZodString;
434
- authenticationId: z.ZodOptional<z.ZodNumber>;
435
- output: z.ZodOptional<z.ZodString>;
436
- debug: z.ZodDefault<z.ZodBoolean>;
437
- }, "strip", z.ZodTypeAny, {
438
- appKey: string;
439
- debug: boolean;
440
- authenticationId?: number | undefined;
441
- output?: string | undefined;
442
- }, {
443
- appKey: string;
444
- authenticationId?: number | undefined;
445
- output?: string | undefined;
446
- debug?: boolean | undefined;
447
- }>;
448
- type GenerateTypesOptions = z.infer<typeof GenerateTypesSchema> & FunctionOptions;
449
- interface GenerateTypesSdkFunction {
450
- generateTypes: (options: GenerateTypesOptions) => Promise<string>;
451
- }
452
-
453
- declare const ListAppsSchema: z.ZodObject<{
454
- category: z.ZodOptional<z.ZodString>;
455
- limit: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
456
- offset: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
457
- }, "strip", z.ZodTypeAny, {
458
- limit?: number | undefined;
459
- offset?: number | undefined;
460
- category?: string | undefined;
461
- }, {
462
- limit?: number | undefined;
463
- offset?: number | undefined;
464
- category?: string | undefined;
465
- }>;
466
- type ListAppsOptions = z.infer<typeof ListAppsSchema> & FunctionOptions;
467
- interface ListAppsSdkFunction {
468
- listApps: (options?: Partial<ListAppsOptions>) => Promise<Integration[]>;
469
- }
470
-
471
- declare const BundleCodeSchema: z.ZodObject<{
472
- input: z.ZodString;
473
- output: z.ZodOptional<z.ZodString>;
474
- string: z.ZodDefault<z.ZodBoolean>;
475
- minify: z.ZodDefault<z.ZodBoolean>;
476
- target: z.ZodDefault<z.ZodString>;
477
- cjs: z.ZodDefault<z.ZodBoolean>;
478
- }, "strip", z.ZodTypeAny, {
479
- string: boolean;
480
- input: string;
481
- minify: boolean;
482
- target: string;
483
- cjs: boolean;
484
- output?: string | undefined;
485
- }, {
486
- input: string;
487
- string?: boolean | undefined;
488
- output?: string | undefined;
489
- minify?: boolean | undefined;
490
- target?: string | undefined;
491
- cjs?: boolean | undefined;
492
- }>;
493
- type BundleCodeOptions = z.infer<typeof BundleCodeSchema>;
494
- interface BundleCodeSdkFunction {
495
- bundleCode: (options: BundleCodeOptions) => Promise<string>;
496
- }
497
-
498
- declare const RelayRequestSchema: z.ZodObject<{
499
- url: z.ZodString;
500
- method: z.ZodOptional<z.ZodEnum<["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"]>>;
501
- body: z.ZodOptional<z.ZodString>;
502
- authenticationId: z.ZodOptional<z.ZodNumber>;
503
- callbackUrl: z.ZodOptional<z.ZodString>;
504
- authenticationTemplate: z.ZodOptional<z.ZodString>;
505
- headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
506
- }, "strip", z.ZodTypeAny, {
507
- url: string;
508
- authenticationId?: number | undefined;
509
- method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | undefined;
510
- body?: string | undefined;
511
- callbackUrl?: string | undefined;
512
- authenticationTemplate?: string | undefined;
513
- headers?: Record<string, string> | undefined;
514
- }, {
515
- url: string;
516
- authenticationId?: number | undefined;
517
- method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | undefined;
518
- body?: string | undefined;
519
- callbackUrl?: string | undefined;
520
- authenticationTemplate?: string | undefined;
521
- headers?: Record<string, string> | undefined;
522
- }>;
523
- type RelayRequestOptions$1 = z.infer<typeof RelayRequestSchema> & FunctionOptions & {
524
- /** Base URL for Relay service */
525
- relayBaseUrl?: string;
526
- };
527
- interface RelayRequestSdkFunction {
528
- request: (options: RelayRequestOptions$1) => Promise<Response>;
529
- }
530
- declare const RelayFetchSchema: z.ZodObject<{
531
- url: z.ZodString;
532
- method: z.ZodOptional<z.ZodEnum<["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"]>>;
533
- body: z.ZodOptional<z.ZodString>;
534
- authenticationId: z.ZodOptional<z.ZodNumber>;
535
- callbackUrl: z.ZodOptional<z.ZodString>;
536
- authenticationTemplate: z.ZodOptional<z.ZodString>;
537
- headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
538
- }, "strip", z.ZodTypeAny, {
539
- url: string;
540
- authenticationId?: number | undefined;
541
- method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | undefined;
542
- body?: string | undefined;
543
- callbackUrl?: string | undefined;
544
- authenticationTemplate?: string | undefined;
545
- headers?: Record<string, string> | undefined;
546
- }, {
547
- url: string;
548
- authenticationId?: number | undefined;
549
- method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | undefined;
550
- body?: string | undefined;
551
- callbackUrl?: string | undefined;
552
- authenticationTemplate?: string | undefined;
553
- headers?: Record<string, string> | undefined;
554
- }>;
555
-
556
- interface FetchPluginOptions {
557
- sdk: ZapierSdk;
558
- }
559
- /**
560
- * Creates a fetch function with standard fetch signature that delegates to sdk.request
561
- */
562
- declare function createFetchPlugin(options: FetchPluginOptions): (url: string | URL, init?: RequestInit & {
563
- authenticationId?: number;
564
- callbackUrl?: string;
565
- authenticationTemplate?: string;
566
- }) => Promise<Response>;
567
- interface FetchPluginSdkExtension {
568
- fetch: (url: string | URL, init?: RequestInit & {
569
- authenticationId?: number;
570
- callbackUrl?: string;
571
- authenticationTemplate?: string;
572
- }) => Promise<Response>;
573
- }
574
-
575
- interface ZapierSdkFunctions extends ListActionsSdkFunction, GetActionSdkFunction, GetAppSdkFunction, RunActionSdkFunction, ListFieldsSdkFunction, ListAuthenticationsSdkFunction, GetAuthenticationSdkFunction, FindFirstAuthenticationSdkFunction, FindUniqueAuthenticationSdkFunction, GenerateTypesSdkFunction, ListAppsSdkFunction, BundleCodeSdkFunction, RelayRequestSdkFunction {
576
- }
577
- interface ZapierSdkPlugins extends AppsPluginSdkExtension, FetchPluginSdkExtension {
578
- }
579
- interface BaseZapierSdk extends ZapierSdkFunctions {
580
- __registry: Array<{
581
- name: string;
582
- inputSchema: any;
583
- implementation: Function;
584
- }>;
585
- }
586
- interface ZapierSdk extends ZapierSdkFunctions, ZapierSdkPlugins {
587
- __registry: Array<{
588
- name: string;
589
- inputSchema: any;
590
- implementation: Function;
591
- }>;
592
- }
593
-
594
- interface AppsPluginOptions {
595
- sdk: ZapierSdk;
596
- }
597
- declare function createAppsPlugin(options: AppsPluginOptions): ActionProxy;
598
-
599
- declare function isPositional(schema: z.ZodType): boolean;
600
-
601
- /**
602
- * SDK Authentication Utilities
603
- *
604
- * This module provides SDK-level authentication utilities focused
605
- * solely on token acquisition. CLI-specific functionality like login/logout
606
- * is handled by the @zapier/zapier-sdk-cli-login package.
607
- */
608
-
609
- interface AuthOptions {
610
- onEvent?: EventCallback;
611
- fetch?: typeof globalThis.fetch;
612
- }
613
- /**
614
- * Gets the ZAPIER_TOKEN from environment variables.
615
- * Returns undefined if not set.
616
- */
617
- declare function getTokenFromEnv(): string | undefined;
618
- /**
619
- * Attempts to get a token by optionally importing from CLI login package.
620
- * This provides a graceful fallback when the CLI login package is not available.
621
- *
622
- * Returns undefined if no valid token is found or CLI package is not available.
623
- */
624
- declare function getTokenFromCliLogin(options?: AuthOptions): Promise<string | undefined>;
625
- /**
626
- * Attempts to get a token with the following precedence:
627
- * 1. ZAPIER_TOKEN environment variable
628
- * 2. CLI login package (if available) with auto-refresh
629
- *
630
- * Returns undefined if no valid token is found.
631
- */
632
- declare function getTokenFromEnvOrConfig(options?: AuthOptions): Promise<string | undefined>;
633
-
634
- interface InputsResolver {
635
- type: "fields";
636
- depends: readonly string[];
637
- fetch: (sdk: ZapierSdk, resolvedParams: Record<string, any>) => Promise<any[]>;
638
- }
639
- declare const inputsResolver: InputsResolver;
640
-
641
- interface AuthenticationIdResolver {
642
- type: "dynamic";
643
- depends: readonly string[];
644
- fetch: (sdk: ZapierSdk, resolvedParams: Record<string, any>) => Promise<any[]>;
645
- prompt: (items: any[], params: Record<string, any>) => any;
646
- }
647
- declare const authenticationIdResolver: AuthenticationIdResolver;
648
-
649
- interface ActionKeyResolver {
650
- type: "dynamic";
651
- depends: readonly string[];
652
- fetch: (sdk: ZapierSdk, resolvedParams: Record<string, any>) => Promise<any[]>;
653
- prompt: (items: any[], params: Record<string, any>) => any;
654
- }
655
- declare const actionKeyResolver: ActionKeyResolver;
656
-
657
- interface ActionTypeResolver {
658
- type: "dynamic";
659
- depends: readonly string[];
660
- fetch: (sdk: ZapierSdk, resolvedParams: Record<string, any>) => Promise<any[]>;
661
- prompt: (items: any[], params: Record<string, any>) => any;
662
- }
663
- declare const actionTypeResolver: ActionTypeResolver;
664
-
665
- interface AppKeyResolver {
666
- type: "static";
667
- inputType?: "text" | "password" | "email";
668
- placeholder?: string;
669
- }
670
- declare const appKeyResolver: AppKeyResolver;
671
-
672
- declare const resolverRegistry: {
673
- readonly appKey: AppKeyResolver;
674
- readonly actionType: ActionTypeResolver;
675
- readonly actionKey: ActionKeyResolver;
676
- readonly authenticationId: AuthenticationIdResolver;
677
- readonly inputs: InputsResolver;
678
- };
679
- type ResolverName = keyof typeof resolverRegistry;
680
- type ResolverType = (typeof resolverRegistry)[ResolverName];
681
- /**
682
- * Get a resolver by name
683
- */
684
- declare function getResolver(name: string): ResolverType | undefined;
685
- /**
686
- * Get all resolvers for a list of missing parameters
687
- */
688
- declare function getResolversForMissingParams(missingParams: string[]): Record<string, ResolverType>;
689
- /**
690
- * Check if a parameter has a resolver
691
- */
692
- declare function hasResolver(paramName: string): boolean;
693
- /**
694
- * Get all parameter names that have resolvers
695
- */
696
- declare function getResolvableParams(): string[];
697
- /**
698
- * Resolve dependency chain for a parameter
699
- * Returns parameters in the order they need to be resolved
700
- */
701
- declare function getResolutionOrder(paramName: string, resolved?: Set<string>): string[];
702
- /**
703
- * Get resolution order for multiple parameters
704
- */
705
- declare function getResolutionOrderForParams(paramNames: string[]): string[];
706
-
707
- /**
708
- * List available authentications with optional filtering
709
- *
710
- * This function can be used standalone without instantiating a full SDK,
711
- * which enables better tree-shaking in applications that only need this functionality.
712
- *
713
- * @param options - Filtering, pagination, and API configuration options
714
- * @returns Promise<Authentication[]> with pagination metadata
715
- */
716
- declare function listAuthentications(options?: Partial<ListAuthenticationsOptions>): Promise<Authentication[]>;
717
-
718
- /**
719
- * Get a specific authentication by ID
720
- *
721
- * This function can be used standalone without instantiating a full SDK,
722
- * which enables better tree-shaking in applications that only need this functionality.
723
- *
724
- * @param options - Authentication ID and API configuration options
725
- * @returns Promise<Authentication> - The authentication details
726
- * @throws Error if authentication not found or access denied
727
- */
728
- declare function getAuthentication(options: GetAuthenticationOptions): Promise<Authentication>;
729
-
730
- /**
731
- * Find the first authentication matching the given criteria
732
- *
733
- * This function can be used standalone without instantiating a full SDK,
734
- * which enables better tree-shaking in applications that only need this functionality.
735
- *
736
- * @param options - Filtering and API configuration options
737
- * @returns Promise<Authentication | null> - First matching authentication or null if not found
738
- */
739
- declare function findFirstAuthentication(options?: Partial<FindFirstAuthenticationOptions>): Promise<Authentication | null>;
740
-
741
- /**
742
- * Find a unique authentication matching the given criteria
743
- *
744
- * This function can be used standalone without instantiating a full SDK,
745
- * which enables better tree-shaking in applications that only need this functionality.
746
- *
747
- * @param options - Filtering and API configuration options
748
- * @returns Promise<Authentication> - The unique matching authentication
749
- * @throws Error if no authentication found or multiple authentications found
750
- */
751
- declare function findUniqueAuthentication(options?: Partial<FindUniqueAuthenticationOptions>): Promise<Authentication>;
752
-
753
- /**
754
- * List available apps with optional filtering
755
- *
756
- * This function can be used standalone without instantiating a full SDK,
757
- * which enables better tree-shaking in applications that only need this functionality.
758
- *
759
- * @param options - Filtering, pagination, and API configuration options
760
- * @returns Promise<Integration[]> with pagination metadata
761
- */
762
- declare function listApps(options?: ListAppsOptions): Promise<Integration[]>;
763
-
764
- /**
765
- * Get a specific app by key
766
- *
767
- * This function can be used standalone without instantiating a full SDK,
768
- * which enables better tree-shaking in applications that only need this functionality.
769
- *
770
- * @param options - App key and API configuration options
771
- * @returns Promise<Integration>
772
- */
773
- declare function getApp(options: GetAppOptions): Promise<Integration>;
774
-
775
- /**
776
- * List available actions with optional filtering
777
- *
778
- * This function can be used standalone without instantiating a full SDK,
779
- * which enables better tree-shaking in applications that only need this functionality.
780
- *
781
- * @param options - Filtering and API configuration options
782
- * @returns Promise<Action[]> with pagination metadata
783
- */
784
- declare function listActions(options?: Partial<ListActionsOptions>): Promise<Action[]>;
785
-
786
- /**
787
- * Get a specific action by app, action key, and type
788
- *
789
- * This function can be used standalone without instantiating a full SDK,
790
- * which enables better tree-shaking in applications that only need this functionality.
791
- *
792
- * @param options - App key, action key, type, and API configuration options
793
- * @returns Promise<Action>
794
- */
795
- declare function getAction(options: GetActionOptions): Promise<Action>;
796
-
797
- /**
798
- * Execute an action
799
- *
800
- * This function can be used standalone without instantiating a full SDK,
801
- * which enables better tree-shaking in applications that only need this functionality.
802
- *
803
- * @param options - Action execution parameters and API configuration options
804
- * @returns Promise<ActionExecutionResult>
805
- */
806
- declare function runAction(options: RunActionOptions): Promise<ActionExecutionResult>;
807
-
808
- /**
809
- * List available fields for an action
810
- *
811
- * This function can be used standalone without instantiating a full SDK,
812
- * which enables better tree-shaking in applications that only need this functionality.
813
- *
814
- * @param options - Action details, authentication ID, params, and API configuration options
815
- * @returns Promise<ActionField[]>
816
- */
817
- declare function listFields(options: ListFieldsOptions): Promise<ActionField[]>;
818
-
819
- /**
820
- * Generate TypeScript types for a specific app
821
- *
822
- * This function can be used standalone without instantiating a full SDK,
823
- * which enables better tree-shaking in applications that only need this functionality.
824
- *
825
- * @param options - App key, authentication ID, output path, and API configuration options
826
- * @returns Promise<string> - Generated TypeScript code
827
- */
828
- declare function generateTypes(options: GenerateTypesOptions): Promise<string>;
829
-
830
- /**
831
- * Bundle TypeScript code into executable JavaScript
832
- *
833
- * This function can be used standalone without instantiating a full SDK,
834
- * which enables better tree-shaking in applications that only need this functionality.
835
- *
836
- * @param options - Bundling configuration options
837
- * @returns Promise<string> - Bundled JavaScript code
838
- */
839
- declare function bundleCode(options: BundleCodeOptions): Promise<string>;
840
-
841
- interface RelayRequestOptions {
842
- /** HTTP method */
843
- method?: string;
844
- /** Request body (can be string, FormData, Blob, etc.) */
845
- body?: BodyInit | null;
846
- /** Request headers */
847
- headers?: HeadersInit;
848
- /** Zapier authentication ID to use for the request */
849
- authenticationId?: number;
850
- /** URL to send async response to (makes request async) */
851
- callbackUrl?: string;
852
- /** Optional JSON string authentication template to bypass Notary lookup */
853
- authenticationTemplate?: string;
854
- }
855
- interface RelayFetchConfig extends FunctionOptions {
856
- /** Event callback function */
857
- onEvent?: (event: any) => void;
858
- }
859
- /**
860
- * Fetch function that can make requests to external APIs through Zapier's Relay service
861
- *
862
- * This function takes full URLs (like https://api.github.com/user) and transforms them
863
- * into the relay format (/relay/api.github.com/user) for the API client to route
864
- * to relay.zapier.com.
865
- *
866
- * @param url - The full URL to fetch
867
- * @param options - Fetch options with additional Relay-specific parameters
868
- * @param config - SDK configuration options
869
- * @returns Promise<Response> - The response from the request
870
- */
871
- /**
872
- * Schema-compatible wrapper function for the request functionality
873
- */
874
- declare function request(options: {
875
- url: string;
876
- method?: string;
877
- body?: BodyInit | null;
878
- headers?: HeadersInit;
879
- authenticationId?: number;
880
- callbackUrl?: string;
881
- authenticationTemplate?: string;
882
- } & FunctionOptions): Promise<Response>;
883
- /**
884
- * Internal fetch implementation
885
- */
886
- declare function relayFetch(url: string | URL, options?: RelayRequestOptions, config?: RelayFetchConfig): Promise<Response>;
887
-
888
- interface ZapierSdkOptions extends BaseSdkOptions {
889
- }
890
- declare function createZapierSdk(options?: ZapierSdkOptions): ZapierSdk;
891
-
892
- export { type Action, type ActionExecutionOptions, type ActionExecutionResult, type ActionField, type ActionFieldChoice, type ActionKeyProperty, ActionKeyPropertySchema, type ActionProxy, type ActionTypeProperty, ActionTypePropertySchema, type ApiEvent, type AppKeyProperty, AppKeyPropertySchema, AppNotFoundError, type AppsPluginOptions, type AppsPluginSdkExtension, type AuthEvent, type AuthObject, type AuthOptions, type Authentication, type AuthenticationIdProperty, AuthenticationIdPropertySchema, type AuthenticationsResponse, type BaseSdkOptions, type BaseZapierSdk, type Choice, type DebugProperty, DebugPropertySchema, type EventCallback, type FetchPluginOptions, type FetchPluginSdkExtension, type Field, type FunctionOptions, type InputsProperty, InputsPropertySchema, type Integration, type LimitProperty, LimitPropertySchema, type LoadingEvent, type NeedsRequest, type NeedsResponse, type OffsetProperty, OffsetPropertySchema, type OutputProperty, OutputPropertySchema, type ParamsProperty, ParamsPropertySchema, RelayFetchSchema, RelayRequestSchema, type ResolverName, type ResolverType, type SdkEvent, type Trigger, type ZapierSdk, ZapierSdkError, type ZapierSdkOptions, actionKeyResolver, actionTypeResolver, appKeyResolver, authenticationIdResolver, bundleCode, createAppsPlugin, createFetchPlugin, createZapierSdk, findFirstAuthentication, findUniqueAuthentication, generateTypes, getAction, getApp, getAuthentication, getResolutionOrder, getResolutionOrderForParams, getResolvableParams, getResolver, getResolversForMissingParams, getTokenFromCliLogin, getTokenFromEnv, getTokenFromEnvOrConfig, hasResolver, inputsResolver, isPositional, listActions, listApps, listAuthentications, listFields, relayFetch, request, resolverRegistry, runAction };
1
+ export * from "./types/domain";
2
+ export * from "./types/functions";
3
+ export * from "./types/properties";
4
+ export * from "./types/errors";
5
+ export * from "./plugins/apps";
6
+ export * from "./plugins/fetch";
7
+ export type { Action, App, Need, Field, Choice, ActionExecutionResult, ActionField, ActionFieldChoice, NeedsRequest, NeedsResponse, Authentication, AuthenticationsResponse, UserProfile, } from "./api/types";
8
+ export { isPositional } from "./utils/schema-utils";
9
+ export { hasResolver } from "./resolvers";
10
+ export * from "./auth";
11
+ export * from "./resolvers";
12
+ export { RelayRequestSchema, RelayFetchSchema, } from "./plugins/request/schemas";
13
+ export { createZapierSdk, createSdk, ZapierSdkOptions } from "./sdk";
14
+ export type { FunctionRegistryEntry } from "./types/sdk";
15
+ export type { Plugin, PluginProvides, PluginDependencies, PluginOptions, GetSdkType, Sdk, } from "./types/plugin";
16
+ export type { ZapierSdk } from "./types/sdk";
17
+ //# sourceMappingURL=index.d.ts.map