@zapier/zapier-sdk 0.4.1 → 0.5.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 (374) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/api/auth.d.ts +9 -0
  3. package/dist/api/auth.d.ts.map +1 -0
  4. package/dist/api/auth.js +25 -0
  5. package/dist/api/client.d.ts +9 -0
  6. package/dist/api/client.d.ts.map +1 -0
  7. package/dist/api/client.js +322 -0
  8. package/dist/api/debug.d.ts +13 -0
  9. package/dist/api/debug.d.ts.map +1 -0
  10. package/dist/api/debug.js +55 -0
  11. package/dist/api/index.d.ts +29 -0
  12. package/dist/api/index.d.ts.map +1 -0
  13. package/dist/api/index.js +41 -0
  14. package/dist/api/polling.d.ts +16 -0
  15. package/dist/api/polling.d.ts.map +1 -0
  16. package/dist/api/polling.js +45 -0
  17. package/dist/api/schemas.d.ts +2473 -0
  18. package/dist/api/schemas.d.ts.map +1 -0
  19. package/dist/api/schemas.js +355 -0
  20. package/dist/api/types.d.ts +75 -0
  21. package/dist/api/types.d.ts.map +1 -0
  22. package/dist/api/types.js +11 -0
  23. package/dist/auth.d.ts +34 -0
  24. package/dist/auth.d.ts.map +1 -0
  25. package/dist/auth.js +47 -0
  26. package/dist/constants.d.ts +10 -0
  27. package/dist/constants.d.ts.map +1 -0
  28. package/dist/constants.js +9 -0
  29. package/dist/index.cjs +2108 -1379
  30. package/dist/index.d.mts +2440 -620
  31. package/dist/index.d.ts +17 -892
  32. package/dist/index.d.ts.map +1 -0
  33. package/dist/index.js +20 -0
  34. package/dist/index.mjs +2093 -1362
  35. package/dist/plugins/api/index.d.ts +14 -0
  36. package/dist/plugins/api/index.d.ts.map +1 -0
  37. package/dist/plugins/api/index.js +21 -0
  38. package/dist/plugins/apps/index.d.ts +11 -0
  39. package/dist/plugins/apps/index.d.ts.map +1 -0
  40. package/dist/plugins/apps/index.js +91 -0
  41. package/dist/plugins/apps/types.d.ts +30 -0
  42. package/dist/plugins/apps/types.d.ts.map +1 -0
  43. package/dist/plugins/apps/types.js +2 -0
  44. package/dist/plugins/fetch/index.d.ts +21 -0
  45. package/dist/plugins/fetch/index.d.ts.map +1 -0
  46. package/dist/plugins/fetch/index.js +20 -0
  47. package/dist/plugins/findFirstAuthentication/index.d.ts +20 -0
  48. package/dist/plugins/findFirstAuthentication/index.d.ts.map +1 -0
  49. package/dist/plugins/findFirstAuthentication/index.js +24 -0
  50. package/dist/plugins/findFirstAuthentication/index.test.d.ts +2 -0
  51. package/dist/plugins/findFirstAuthentication/index.test.d.ts.map +1 -0
  52. package/dist/plugins/findFirstAuthentication/index.test.js +171 -0
  53. package/dist/plugins/findFirstAuthentication/schemas.d.ts +29 -0
  54. package/dist/plugins/findFirstAuthentication/schemas.d.ts.map +1 -0
  55. package/dist/plugins/findFirstAuthentication/schemas.js +18 -0
  56. package/dist/plugins/findUniqueAuthentication/index.d.ts +20 -0
  57. package/dist/plugins/findUniqueAuthentication/index.d.ts.map +1 -0
  58. package/dist/plugins/findUniqueAuthentication/index.js +31 -0
  59. package/dist/plugins/findUniqueAuthentication/index.test.d.ts +2 -0
  60. package/dist/plugins/findUniqueAuthentication/index.test.d.ts.map +1 -0
  61. package/dist/plugins/findUniqueAuthentication/index.test.js +152 -0
  62. package/dist/plugins/findUniqueAuthentication/schemas.d.ts +29 -0
  63. package/dist/plugins/findUniqueAuthentication/schemas.d.ts.map +1 -0
  64. package/dist/plugins/findUniqueAuthentication/schemas.js +18 -0
  65. package/dist/plugins/getAction/index.d.ts +23 -0
  66. package/dist/plugins/getAction/index.d.ts.map +1 -0
  67. package/dist/plugins/getAction/index.js +28 -0
  68. package/dist/plugins/getAction/index.test.d.ts +2 -0
  69. package/dist/plugins/getAction/index.test.d.ts.map +1 -0
  70. package/dist/plugins/getAction/index.test.js +186 -0
  71. package/dist/plugins/getAction/schemas.d.ts +23 -0
  72. package/dist/plugins/getAction/schemas.d.ts.map +1 -0
  73. package/dist/plugins/getAction/schemas.js +10 -0
  74. package/dist/plugins/getApp/index.d.ts +22 -0
  75. package/dist/plugins/getApp/index.d.ts.map +1 -0
  76. package/dist/plugins/getApp/index.js +39 -0
  77. package/dist/plugins/getApp/index.test.d.ts +2 -0
  78. package/dist/plugins/getApp/index.test.d.ts.map +1 -0
  79. package/dist/plugins/getApp/index.test.js +100 -0
  80. package/dist/plugins/getApp/schemas.d.ts +18 -0
  81. package/dist/plugins/getApp/schemas.d.ts.map +1 -0
  82. package/dist/plugins/getApp/schemas.js +10 -0
  83. package/dist/plugins/getAuthentication/index.d.ts +22 -0
  84. package/dist/plugins/getAuthentication/index.d.ts.map +1 -0
  85. package/dist/plugins/getAuthentication/index.js +41 -0
  86. package/dist/plugins/getAuthentication/index.test.d.ts +2 -0
  87. package/dist/plugins/getAuthentication/index.test.d.ts.map +1 -0
  88. package/dist/plugins/getAuthentication/index.test.js +205 -0
  89. package/dist/plugins/getAuthentication/schemas.d.ts +17 -0
  90. package/dist/plugins/getAuthentication/schemas.d.ts.map +1 -0
  91. package/dist/plugins/getAuthentication/schemas.js +11 -0
  92. package/dist/plugins/getProfile/index.d.ts +23 -0
  93. package/dist/plugins/getProfile/index.d.ts.map +1 -0
  94. package/dist/plugins/getProfile/index.js +29 -0
  95. package/dist/plugins/getProfile/schemas.d.ts +13 -0
  96. package/dist/plugins/getProfile/schemas.d.ts.map +1 -0
  97. package/dist/plugins/getProfile/schemas.js +5 -0
  98. package/dist/plugins/listActions/index.d.ts +28 -0
  99. package/dist/plugins/listActions/index.d.ts.map +1 -0
  100. package/dist/plugins/listActions/index.js +61 -0
  101. package/dist/plugins/listActions/index.test.d.ts +2 -0
  102. package/dist/plugins/listActions/index.test.d.ts.map +1 -0
  103. package/dist/plugins/listActions/index.test.js +467 -0
  104. package/dist/plugins/listActions/schemas.d.ts +29 -0
  105. package/dist/plugins/listActions/schemas.d.ts.map +1 -0
  106. package/dist/plugins/listActions/schemas.js +21 -0
  107. package/dist/plugins/listApps/index.d.ts +28 -0
  108. package/dist/plugins/listApps/index.d.ts.map +1 -0
  109. package/dist/plugins/listApps/index.js +62 -0
  110. package/dist/plugins/listApps/index.test.d.ts +2 -0
  111. package/dist/plugins/listApps/index.test.d.ts.map +1 -0
  112. package/dist/plugins/listApps/index.test.js +313 -0
  113. package/dist/plugins/listApps/schemas.d.ts +30 -0
  114. package/dist/plugins/listApps/schemas.d.ts.map +1 -0
  115. package/dist/plugins/listApps/schemas.js +23 -0
  116. package/dist/plugins/listAuthentications/index.d.ts +28 -0
  117. package/dist/plugins/listAuthentications/index.d.ts.map +1 -0
  118. package/dist/plugins/listAuthentications/index.js +77 -0
  119. package/dist/plugins/listAuthentications/index.test.d.ts +2 -0
  120. package/dist/plugins/listAuthentications/index.test.d.ts.map +1 -0
  121. package/dist/plugins/listAuthentications/index.test.js +564 -0
  122. package/dist/plugins/listAuthentications/schemas.d.ts +38 -0
  123. package/dist/plugins/listAuthentications/schemas.d.ts.map +1 -0
  124. package/dist/plugins/listAuthentications/schemas.js +28 -0
  125. package/dist/plugins/listInputFields/index.d.ts +28 -0
  126. package/dist/plugins/listInputFields/index.d.ts.map +1 -0
  127. package/dist/plugins/listInputFields/index.js +133 -0
  128. package/dist/plugins/listInputFields/index.test.d.ts +2 -0
  129. package/dist/plugins/listInputFields/index.test.d.ts.map +1 -0
  130. package/dist/plugins/listInputFields/index.test.js +325 -0
  131. package/dist/plugins/listInputFields/schemas.d.ts +38 -0
  132. package/dist/plugins/listInputFields/schemas.d.ts.map +1 -0
  133. package/dist/plugins/listInputFields/schemas.js +22 -0
  134. package/dist/plugins/registry/index.d.ts +11 -0
  135. package/dist/plugins/registry/index.d.ts.map +1 -0
  136. package/dist/plugins/registry/index.js +14 -0
  137. package/dist/plugins/request/index.d.ts +19 -0
  138. package/dist/plugins/request/index.d.ts.map +1 -0
  139. package/dist/plugins/request/index.js +62 -0
  140. package/dist/plugins/request/index.test.d.ts +2 -0
  141. package/dist/plugins/request/index.test.d.ts.map +1 -0
  142. package/dist/plugins/request/index.test.js +256 -0
  143. package/dist/plugins/request/schemas.d.ts +69 -0
  144. package/dist/plugins/request/schemas.d.ts.map +1 -0
  145. package/dist/plugins/request/schemas.js +42 -0
  146. package/dist/plugins/runAction/index.d.ts +28 -0
  147. package/dist/plugins/runAction/index.d.ts.map +1 -0
  148. package/dist/plugins/runAction/index.js +86 -0
  149. package/dist/plugins/runAction/index.test.d.ts +2 -0
  150. package/dist/plugins/runAction/index.test.d.ts.map +1 -0
  151. package/dist/plugins/runAction/index.test.js +320 -0
  152. package/dist/plugins/runAction/schemas.d.ts +37 -0
  153. package/dist/plugins/runAction/schemas.d.ts.map +1 -0
  154. package/dist/plugins/runAction/schemas.js +22 -0
  155. package/dist/resolvers/actionKey.d.ts +9 -0
  156. package/dist/resolvers/actionKey.d.ts.map +1 -0
  157. package/dist/resolvers/actionKey.js +19 -0
  158. package/dist/resolvers/actionType.d.ts +9 -0
  159. package/dist/resolvers/actionType.d.ts.map +1 -0
  160. package/dist/resolvers/actionType.js +22 -0
  161. package/dist/resolvers/appKey.d.ts +7 -0
  162. package/dist/resolvers/appKey.d.ts.map +1 -0
  163. package/dist/resolvers/appKey.js +5 -0
  164. package/dist/resolvers/authenticationId.d.ts +9 -0
  165. package/dist/resolvers/authenticationId.d.ts.map +1 -0
  166. package/dist/resolvers/authenticationId.js +33 -0
  167. package/dist/resolvers/index.d.ts +40 -0
  168. package/dist/resolvers/index.d.ts.map +1 -0
  169. package/dist/resolvers/index.js +91 -0
  170. package/dist/resolvers/inputs.d.ts +8 -0
  171. package/dist/resolvers/inputs.d.ts.map +1 -0
  172. package/dist/resolvers/inputs.js +14 -0
  173. package/dist/schemas/Action.d.ts +243 -0
  174. package/dist/schemas/Action.d.ts.map +1 -0
  175. package/dist/schemas/Action.js +34 -0
  176. package/dist/schemas/App.d.ts +26 -0
  177. package/dist/schemas/App.d.ts.map +1 -0
  178. package/dist/schemas/App.js +22 -0
  179. package/dist/schemas/Auth.d.ts +161 -0
  180. package/dist/schemas/Auth.d.ts.map +1 -0
  181. package/dist/schemas/Auth.js +41 -0
  182. package/dist/schemas/Field.d.ts +144 -0
  183. package/dist/schemas/Field.d.ts.map +1 -0
  184. package/dist/schemas/Field.js +105 -0
  185. package/dist/schemas/UserProfile.d.ts +163 -0
  186. package/dist/schemas/UserProfile.d.ts.map +1 -0
  187. package/dist/schemas/UserProfile.js +29 -0
  188. package/dist/sdk.d.ts +10 -0
  189. package/dist/sdk.d.ts.map +1 -0
  190. package/dist/sdk.js +94 -0
  191. package/dist/sdk.test.d.ts +2 -0
  192. package/dist/sdk.test.d.ts.map +1 -0
  193. package/dist/sdk.test.js +135 -0
  194. package/dist/types/domain.d.ts +36 -0
  195. package/dist/types/domain.d.ts.map +1 -0
  196. package/dist/types/domain.js +1 -0
  197. package/dist/types/domain.test.d.ts +2 -0
  198. package/dist/types/domain.test.d.ts.map +1 -0
  199. package/dist/types/domain.test.js +39 -0
  200. package/dist/types/errors.d.ts +143 -0
  201. package/dist/types/errors.d.ts.map +1 -0
  202. package/dist/types/errors.js +187 -0
  203. package/dist/types/events.d.ts +38 -0
  204. package/dist/types/events.d.ts.map +1 -0
  205. package/dist/types/events.js +7 -0
  206. package/dist/types/functions.d.ts +26 -0
  207. package/dist/types/functions.d.ts.map +1 -0
  208. package/dist/types/functions.js +4 -0
  209. package/dist/types/plugin.d.ts +61 -0
  210. package/dist/types/plugin.d.ts.map +1 -0
  211. package/dist/types/plugin.js +9 -0
  212. package/dist/types/properties.d.ts +22 -0
  213. package/dist/types/properties.d.ts.map +1 -0
  214. package/dist/types/properties.js +50 -0
  215. package/dist/types/sdk.d.ts +43 -0
  216. package/dist/types/sdk.d.ts.map +1 -0
  217. package/dist/types/sdk.js +4 -0
  218. package/dist/utils/array-utils.d.ts +31 -0
  219. package/dist/utils/array-utils.d.ts.map +1 -0
  220. package/dist/utils/array-utils.js +36 -0
  221. package/dist/utils/array-utils.test.d.ts +2 -0
  222. package/dist/utils/array-utils.test.d.ts.map +1 -0
  223. package/dist/utils/array-utils.test.js +107 -0
  224. package/dist/utils/domain-utils.d.ts +78 -0
  225. package/dist/utils/domain-utils.d.ts.map +1 -0
  226. package/dist/utils/domain-utils.js +218 -0
  227. package/dist/utils/domain-utils.test.d.ts +2 -0
  228. package/dist/utils/domain-utils.test.d.ts.map +1 -0
  229. package/dist/utils/domain-utils.test.js +192 -0
  230. package/dist/utils/function-utils.d.ts +45 -0
  231. package/dist/utils/function-utils.d.ts.map +1 -0
  232. package/dist/utils/function-utils.js +158 -0
  233. package/dist/utils/function-utils.test.d.ts +2 -0
  234. package/dist/utils/function-utils.test.d.ts.map +1 -0
  235. package/dist/utils/function-utils.test.js +110 -0
  236. package/dist/utils/pagination-utils.d.ts +37 -0
  237. package/dist/utils/pagination-utils.d.ts.map +1 -0
  238. package/dist/utils/pagination-utils.js +165 -0
  239. package/dist/utils/pagination-utils.test.d.ts +17 -0
  240. package/dist/utils/pagination-utils.test.d.ts.map +1 -0
  241. package/dist/utils/pagination-utils.test.js +461 -0
  242. package/dist/utils/schema-utils.d.ts +45 -0
  243. package/dist/utils/schema-utils.d.ts.map +1 -0
  244. package/dist/utils/schema-utils.js +65 -0
  245. package/dist/utils/validation.d.ts +4 -0
  246. package/dist/utils/validation.d.ts.map +1 -0
  247. package/dist/utils/validation.js +30 -0
  248. package/dist/utils/validation.test.d.ts +2 -0
  249. package/dist/utils/validation.test.d.ts.map +1 -0
  250. package/dist/utils/validation.test.js +43 -0
  251. package/package.json +12 -3
  252. package/src/api/client.ts +394 -171
  253. package/src/api/debug.ts +10 -1
  254. package/src/api/index.ts +0 -2
  255. package/src/api/polling.ts +28 -7
  256. package/src/api/schemas.ts +387 -0
  257. package/src/api/types.ts +72 -136
  258. package/src/constants.ts +10 -0
  259. package/src/index.ts +40 -19
  260. package/src/plugins/api/index.ts +47 -0
  261. package/src/plugins/apps/index.ts +25 -19
  262. package/src/plugins/apps/types.ts +7 -11
  263. package/src/plugins/fetch/index.ts +48 -40
  264. package/src/plugins/findFirstAuthentication/index.test.ts +206 -0
  265. package/src/plugins/findFirstAuthentication/index.ts +55 -0
  266. package/src/plugins/findFirstAuthentication/schemas.ts +41 -0
  267. package/src/plugins/findUniqueAuthentication/index.test.ts +197 -0
  268. package/src/plugins/findUniqueAuthentication/index.ts +72 -0
  269. package/src/plugins/findUniqueAuthentication/schemas.ts +42 -0
  270. package/src/plugins/getAction/index.test.ts +239 -0
  271. package/src/plugins/getAction/index.ts +57 -0
  272. package/src/plugins/getAction/schemas.ts +33 -0
  273. package/src/plugins/getApp/index.test.ts +127 -0
  274. package/src/plugins/getApp/index.ts +66 -0
  275. package/src/plugins/getApp/schemas.ts +38 -0
  276. package/src/plugins/getAuthentication/index.test.ts +284 -0
  277. package/src/plugins/getAuthentication/index.ts +86 -0
  278. package/src/plugins/getAuthentication/schemas.ts +31 -0
  279. package/src/plugins/getProfile/index.ts +55 -0
  280. package/src/plugins/getProfile/schemas.ts +26 -0
  281. package/src/plugins/listActions/index.test.ts +582 -0
  282. package/src/plugins/listActions/index.ts +115 -0
  283. package/src/plugins/listActions/schemas.ts +54 -0
  284. package/src/plugins/listApps/index.test.ts +357 -0
  285. package/src/plugins/listApps/index.ts +121 -0
  286. package/src/plugins/listApps/schemas.ts +49 -0
  287. package/src/plugins/listAuthentications/index.test.ts +709 -0
  288. package/src/plugins/listAuthentications/index.ts +136 -0
  289. package/src/plugins/listAuthentications/schemas.ts +60 -0
  290. package/src/plugins/listInputFields/index.test.ts +408 -0
  291. package/src/plugins/listInputFields/index.ts +204 -0
  292. package/src/plugins/listInputFields/schemas.ts +56 -0
  293. package/src/plugins/registry/index.ts +30 -0
  294. package/src/plugins/request/index.test.ts +329 -0
  295. package/src/plugins/request/index.ts +103 -0
  296. package/src/{functions → plugins}/request/schemas.ts +20 -9
  297. package/src/plugins/runAction/index.test.ts +387 -0
  298. package/src/plugins/runAction/index.ts +176 -0
  299. package/src/plugins/runAction/schemas.ts +53 -0
  300. package/src/resolvers/actionKey.ts +6 -4
  301. package/src/resolvers/actionType.ts +7 -2
  302. package/src/resolvers/appKey.ts +1 -1
  303. package/src/resolvers/authenticationId.ts +12 -3
  304. package/src/resolvers/inputs.ts +3 -1
  305. package/src/schemas/Action.ts +18 -12
  306. package/src/schemas/App.ts +11 -19
  307. package/src/schemas/Auth.ts +18 -13
  308. package/src/schemas/Field.ts +106 -11
  309. package/src/schemas/UserProfile.ts +43 -0
  310. package/src/sdk.test.ts +212 -0
  311. package/src/sdk.ts +132 -102
  312. package/src/types/domain.test.ts +50 -0
  313. package/src/types/domain.ts +43 -75
  314. package/src/types/errors.ts +275 -0
  315. package/src/types/functions.ts +27 -0
  316. package/src/types/optional-zapier-sdk-cli-login.d.ts +37 -0
  317. package/src/types/plugin.ts +105 -0
  318. package/src/types/properties.ts +4 -3
  319. package/src/types/sdk.ts +70 -48
  320. package/src/utils/array-utils.test.ts +131 -0
  321. package/src/utils/array-utils.ts +41 -0
  322. package/src/utils/domain-utils.test.ts +239 -0
  323. package/src/utils/domain-utils.ts +283 -0
  324. package/src/utils/function-utils.test.ts +141 -0
  325. package/src/utils/function-utils.ts +245 -0
  326. package/src/utils/pagination-utils.test.ts +620 -0
  327. package/src/utils/pagination-utils.ts +242 -0
  328. package/src/utils/validation.test.ts +50 -0
  329. package/src/utils/validation.ts +44 -0
  330. package/tsconfig.build.json +16 -2
  331. package/tsconfig.json +3 -1
  332. package/tsconfig.tsbuildinfo +1 -0
  333. package/tsup.config.ts +2 -0
  334. package/src/functions/bundleCode/index.ts +0 -78
  335. package/src/functions/bundleCode/info.ts +0 -9
  336. package/src/functions/bundleCode/schemas.ts +0 -30
  337. package/src/functions/findFirstAuthentication/index.ts +0 -24
  338. package/src/functions/findFirstAuthentication/info.ts +0 -9
  339. package/src/functions/findFirstAuthentication/schemas.ts +0 -50
  340. package/src/functions/findUniqueAuthentication/index.ts +0 -35
  341. package/src/functions/findUniqueAuthentication/info.ts +0 -9
  342. package/src/functions/findUniqueAuthentication/schemas.ts +0 -50
  343. package/src/functions/generateTypes/index.ts +0 -363
  344. package/src/functions/generateTypes/info.ts +0 -9
  345. package/src/functions/generateTypes/schemas.ts +0 -31
  346. package/src/functions/getAction/index.ts +0 -33
  347. package/src/functions/getAction/info.ts +0 -9
  348. package/src/functions/getAction/schemas.ts +0 -25
  349. package/src/functions/getApp/index.ts +0 -41
  350. package/src/functions/getApp/info.ts +0 -9
  351. package/src/functions/getApp/schemas.ts +0 -20
  352. package/src/functions/getAuthentication/index.ts +0 -50
  353. package/src/functions/getAuthentication/info.ts +0 -9
  354. package/src/functions/getAuthentication/schemas.ts +0 -29
  355. package/src/functions/listActions/index.ts +0 -149
  356. package/src/functions/listActions/info.ts +0 -9
  357. package/src/functions/listActions/schemas.ts +0 -30
  358. package/src/functions/listApps/index.ts +0 -60
  359. package/src/functions/listApps/info.ts +0 -9
  360. package/src/functions/listApps/schemas.ts +0 -32
  361. package/src/functions/listAuthentications/index.ts +0 -162
  362. package/src/functions/listAuthentications/info.ts +0 -9
  363. package/src/functions/listAuthentications/schemas.ts +0 -50
  364. package/src/functions/listFields/index.ts +0 -86
  365. package/src/functions/listFields/info.ts +0 -9
  366. package/src/functions/listFields/schemas.ts +0 -36
  367. package/src/functions/request/index.ts +0 -150
  368. package/src/functions/request/info.ts +0 -11
  369. package/src/functions/runAction/index.ts +0 -127
  370. package/src/functions/runAction/info.ts +0 -9
  371. package/src/functions/runAction/schemas.ts +0 -34
  372. package/src/plugins/apps/info.ts +0 -12
  373. package/src/plugins/fetch/types.ts +0 -2
  374. /package/src/{schema-utils.ts → utils/schema-utils.ts} +0 -0
@@ -0,0 +1,152 @@
1
+ import { describe, it, expect, vi, beforeEach } from "vitest";
2
+ import { ZapierValidationError, ZapierResourceNotFoundError, } from "../../types/errors";
3
+ import { findUniqueAuthenticationPlugin } from "./index";
4
+ import { createSdk } from "../../sdk";
5
+ import { ListAuthenticationsSchema } from "../listAuthentications/schemas";
6
+ const mockAuthentication = {
7
+ id: 123,
8
+ title: "My Slack",
9
+ date: "2021-01-01",
10
+ account_id: 123,
11
+ implementation_id: "api_123",
12
+ is_expired: "false",
13
+ expired_at: null,
14
+ is_invite_only: false,
15
+ is_private: false,
16
+ shared_with_all: false,
17
+ };
18
+ const mockAuthentications = [
19
+ mockAuthentication,
20
+ {
21
+ id: 456,
22
+ title: "Slack Workspace 2",
23
+ is_expired: "false",
24
+ expired_at: null,
25
+ date: "2021-01-01",
26
+ account_id: 123,
27
+ implementation_id: "api_123",
28
+ is_invite_only: false,
29
+ is_private: false,
30
+ shared_with_all: false,
31
+ },
32
+ ];
33
+ describe("findUniqueAuthentication plugin", () => {
34
+ let mockListAuthentications;
35
+ beforeEach(() => {
36
+ vi.clearAllMocks();
37
+ mockListAuthentications = vi.fn().mockResolvedValue({
38
+ data: [mockAuthentication],
39
+ });
40
+ });
41
+ function createTestSdk() {
42
+ // Create a proper plugin chain: first add a mock listAuthentications plugin, then add findUniqueAuthentication
43
+ const mockListAuthenticationsPlugin = () => ({
44
+ listAuthentications: mockListAuthentications,
45
+ context: {
46
+ meta: {
47
+ listAuthentications: {
48
+ inputSchema: ListAuthenticationsSchema,
49
+ },
50
+ },
51
+ },
52
+ });
53
+ // Build SDK with proper plugin composition
54
+ return createSdk()
55
+ .addPlugin(mockListAuthenticationsPlugin)
56
+ .addPlugin(findUniqueAuthenticationPlugin);
57
+ }
58
+ describe("schema validation", () => {
59
+ it("should pass validation with empty options", async () => {
60
+ const sdk = createTestSdk();
61
+ const result = await sdk.findUniqueAuthentication({});
62
+ expect(result.data).toBeDefined();
63
+ });
64
+ it("should throw validation error for invalid appKey type", async () => {
65
+ const sdk = createTestSdk();
66
+ await expect(sdk.findUniqueAuthentication({
67
+ appKey: 123,
68
+ })).rejects.toThrow(ZapierValidationError);
69
+ });
70
+ it("should throw validation error for invalid parameter types", async () => {
71
+ const sdk = createTestSdk();
72
+ await expect(sdk.findUniqueAuthentication({
73
+ search: 123,
74
+ title: 456,
75
+ account_id: 789,
76
+ owner: false,
77
+ })).rejects.toThrow(ZapierValidationError);
78
+ });
79
+ it("should pass validation with all valid fields", async () => {
80
+ const sdk = createTestSdk();
81
+ const result = await sdk.findUniqueAuthentication({
82
+ appKey: "slack",
83
+ search: "Workspace",
84
+ title: "My Slack",
85
+ account_id: "acc_123",
86
+ owner: "me",
87
+ });
88
+ expect(result.data).toBeDefined();
89
+ });
90
+ });
91
+ describe("business logic", () => {
92
+ it("should return the first authentication when exactly one is found", async () => {
93
+ mockListAuthentications.mockResolvedValue({
94
+ data: [mockAuthentication],
95
+ });
96
+ const sdk = createTestSdk();
97
+ const result = await sdk.findUniqueAuthentication({
98
+ appKey: "slack",
99
+ });
100
+ expect(result.data).toEqual(mockAuthentication);
101
+ });
102
+ it("should throw ZapierResourceNotFoundError when no authentications found", async () => {
103
+ mockListAuthentications.mockResolvedValue({
104
+ data: [],
105
+ });
106
+ const sdk = createTestSdk();
107
+ await expect(sdk.findUniqueAuthentication({
108
+ appKey: "nonexistent",
109
+ })).rejects.toThrow(ZapierResourceNotFoundError);
110
+ await expect(sdk.findUniqueAuthentication({
111
+ appKey: "nonexistent",
112
+ })).rejects.toThrow("No authentication found matching the specified criteria");
113
+ });
114
+ it("should throw ZapierValidationError when multiple authentications found", async () => {
115
+ mockListAuthentications.mockResolvedValue({
116
+ data: mockAuthentications, // Two authentications
117
+ });
118
+ const sdk = createTestSdk();
119
+ await expect(sdk.findUniqueAuthentication({
120
+ search: "Workspace",
121
+ })).rejects.toThrow(ZapierValidationError);
122
+ await expect(sdk.findUniqueAuthentication({
123
+ search: "Workspace",
124
+ })).rejects.toThrow("Multiple authentications found matching the specified criteria. Expected exactly one.");
125
+ });
126
+ });
127
+ describe("options forwarding", () => {
128
+ it("should forward all options to listAuthentications with maxItems=2", async () => {
129
+ const sdk = createTestSdk();
130
+ const options = {
131
+ appKey: "slack",
132
+ search: "workspace",
133
+ title: "My Slack Workspace",
134
+ account_id: "acc_123",
135
+ owner: "me",
136
+ };
137
+ await sdk.findUniqueAuthentication(options);
138
+ expect(mockListAuthentications).toHaveBeenCalledWith({
139
+ ...options,
140
+ maxItems: 2,
141
+ });
142
+ });
143
+ });
144
+ describe("context and metadata", () => {
145
+ it("should provide context with meta information", () => {
146
+ const sdk = createTestSdk();
147
+ const context = sdk.getContext();
148
+ expect(context.meta.findUniqueAuthentication).toBeDefined();
149
+ expect(context.meta.findUniqueAuthentication.inputSchema).toBeDefined();
150
+ });
151
+ });
152
+ });
@@ -0,0 +1,29 @@
1
+ import { z } from "zod";
2
+ import type { AuthenticationItem } from "../../types/domain";
3
+ export declare const FindUniqueAuthenticationSchema: z.ZodObject<{
4
+ appKey: z.ZodOptional<z.ZodString>;
5
+ search: z.ZodOptional<z.ZodString>;
6
+ title: z.ZodOptional<z.ZodString>;
7
+ account_id: z.ZodOptional<z.ZodString>;
8
+ owner: z.ZodOptional<z.ZodString>;
9
+ }, "strip", z.ZodTypeAny, {
10
+ title?: string | undefined;
11
+ search?: string | undefined;
12
+ account_id?: string | undefined;
13
+ appKey?: string | undefined;
14
+ owner?: string | undefined;
15
+ }, {
16
+ title?: string | undefined;
17
+ search?: string | undefined;
18
+ account_id?: string | undefined;
19
+ appKey?: string | undefined;
20
+ owner?: string | undefined;
21
+ }>;
22
+ export type FindUniqueAuthenticationOptions = z.infer<typeof FindUniqueAuthenticationSchema>;
23
+ export type FindUniqueAuthenticationError = import("../../types/errors").ZapierAuthenticationError | import("../../types/errors").ZapierApiError | import("../../types/errors").ZapierResourceNotFoundError | import("../../types/errors").ZapierValidationError | import("../../types/errors").ZapierUnknownError;
24
+ export interface FindUniqueAuthenticationSdkFunction {
25
+ findUniqueAuthentication: (options?: FindUniqueAuthenticationOptions) => Promise<{
26
+ data: AuthenticationItem;
27
+ }>;
28
+ }
29
+ //# sourceMappingURL=schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/findUniqueAuthentication/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAG7D,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;EAgBsB,CAAC;AAGlE,MAAM,MAAM,+BAA+B,GAAG,CAAC,CAAC,KAAK,CACnD,OAAO,8BAA8B,CACtC,CAAC;AAGF,MAAM,MAAM,6BAA6B,GACrC,OAAO,oBAAoB,EAAE,yBAAyB,GACtD,OAAO,oBAAoB,EAAE,cAAc,GAC3C,OAAO,oBAAoB,EAAE,2BAA2B,GACxD,OAAO,oBAAoB,EAAE,qBAAqB,GAClD,OAAO,oBAAoB,EAAE,kBAAkB,CAAC;AAGpD,MAAM,WAAW,mCAAmC;IAClD,wBAAwB,EAAE,CACxB,OAAO,CAAC,EAAE,+BAA+B,KACtC,OAAO,CAAC;QAAE,IAAI,EAAE,kBAAkB,CAAA;KAAE,CAAC,CAAC;CAC5C"}
@@ -0,0 +1,18 @@
1
+ import { z } from "zod";
2
+ import { AppKeyPropertySchema } from "../../types/properties";
3
+ // Pure Zod schema - no resolver metadata!
4
+ export const FindUniqueAuthenticationSchema = z
5
+ .object({
6
+ appKey: AppKeyPropertySchema.optional().describe("App key of authentication to find (e.g., 'SlackCLIAPI')"),
7
+ search: z
8
+ .string()
9
+ .optional()
10
+ .describe("Search term to filter authentications by title"),
11
+ title: z
12
+ .string()
13
+ .optional()
14
+ .describe("Filter authentications by exact title match"),
15
+ account_id: z.string().optional().describe("Filter by account ID"),
16
+ owner: z.string().optional().describe("Filter by owner"),
17
+ })
18
+ .describe("Find a unique authentication matching the criteria");
@@ -0,0 +1,23 @@
1
+ import type { Plugin, GetSdkType } from "../../types/plugin";
2
+ import type { ApiClient } from "../../api";
3
+ import type { ActionItem } from "../../types/domain";
4
+ import { GetActionSchema, type GetActionOptions } from "./schemas";
5
+ import type { ListActionsPluginProvides } from "../listActions";
6
+ export interface GetActionPluginProvides {
7
+ getAction: (options: GetActionOptions) => Promise<{
8
+ data: ActionItem;
9
+ }>;
10
+ context: {
11
+ meta: {
12
+ getAction: {
13
+ inputSchema: typeof GetActionSchema;
14
+ };
15
+ };
16
+ };
17
+ }
18
+ export declare const getActionPlugin: Plugin<GetSdkType<ListActionsPluginProvides>, // requires listActions in SDK
19
+ {
20
+ api: ApiClient;
21
+ }, // requires api in context
22
+ GetActionPluginProvides>;
23
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/getAction/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,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,KAAK,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAGnE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAEhE,MAAM,WAAW,uBAAuB;IACtC,SAAS,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,OAAO,CAAC;QAAE,IAAI,EAAE,UAAU,CAAA;KAAE,CAAC,CAAC;IACxE,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,SAAS,EAAE;gBACT,WAAW,EAAE,OAAO,eAAe,CAAC;aACrC,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,eAAe,EAAE,MAAM,CAClC,UAAU,CAAC,yBAAyB,CAAC,EAAE,8BAA8B;AACrE;IAAE,GAAG,EAAE,SAAS,CAAA;CAAE,EAAE,0BAA0B;AAC9C,uBAAuB,CAkCxB,CAAC"}
@@ -0,0 +1,28 @@
1
+ import { GetActionSchema } from "./schemas";
2
+ import { ZapierResourceNotFoundError } from "../../types/errors";
3
+ import { createFunction } from "../../utils/function-utils";
4
+ export const getActionPlugin = ({ sdk }) => {
5
+ const getAction = createFunction(async function getAction(options) {
6
+ const { actionKey, actionType, appKey } = options;
7
+ // Use the listActions function from the SDK to search for the specific action
8
+ const actionsResult = await sdk.listActions({ appKey });
9
+ // Search through all actions to find the matching one
10
+ for (const action of actionsResult.data) {
11
+ if (action.key === actionKey && action.action_type === actionType) {
12
+ return { data: action };
13
+ }
14
+ }
15
+ // If we get here, action was not found
16
+ throw new ZapierResourceNotFoundError(`Action not found: ${actionKey} with type ${actionType}`, { resourceType: "Action", resourceId: `${actionKey} (${actionType})` });
17
+ }, GetActionSchema);
18
+ return {
19
+ getAction,
20
+ context: {
21
+ meta: {
22
+ getAction: {
23
+ inputSchema: GetActionSchema,
24
+ },
25
+ },
26
+ },
27
+ };
28
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../../src/plugins/getAction/index.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,186 @@
1
+ import { describe, it, expect, vi, beforeEach } from "vitest";
2
+ import { ZapierValidationError, ZapierResourceNotFoundError, } from "../../types/errors";
3
+ import { getActionPlugin } from "./index";
4
+ import { createSdk } from "../../sdk";
5
+ import { ListActionsSchema } from "../listActions/schemas";
6
+ const mockActions = [
7
+ {
8
+ type: "action",
9
+ key: "user_by_email",
10
+ title: "Search User by Email",
11
+ description: "Find a user by email address",
12
+ app_key: "slack",
13
+ action_type: "search",
14
+ },
15
+ {
16
+ type: "action",
17
+ key: "search_messages",
18
+ title: "Search Messages",
19
+ description: "Search for messages in channels",
20
+ app_key: "slack",
21
+ action_type: "search",
22
+ },
23
+ {
24
+ type: "action",
25
+ key: "user_by_email",
26
+ title: "Search User by Email",
27
+ description: "Find a user by email address",
28
+ app_key: "slack",
29
+ action_type: "write", // Different action type for testing mismatch
30
+ },
31
+ ];
32
+ describe("getAction plugin", () => {
33
+ let mockListActions;
34
+ let mockApiClient;
35
+ beforeEach(() => {
36
+ vi.clearAllMocks();
37
+ mockListActions = vi.fn().mockResolvedValue({
38
+ data: mockActions,
39
+ });
40
+ mockApiClient = {};
41
+ });
42
+ function createTestSdk() {
43
+ // Create a proper plugin chain with context dependencies
44
+ const mockListActionsPlugin = () => ({
45
+ listActions: mockListActions,
46
+ context: {
47
+ meta: {
48
+ listActions: {
49
+ inputSchema: ListActionsSchema,
50
+ },
51
+ },
52
+ },
53
+ });
54
+ // Build SDK with proper plugin composition, providing API in initial context
55
+ return createSdk({}, { api: mockApiClient, meta: {} })
56
+ .addPlugin(mockListActionsPlugin)
57
+ .addPlugin(getActionPlugin);
58
+ }
59
+ describe("schema validation", () => {
60
+ it("should throw validation error for missing appKey", async () => {
61
+ const sdk = createTestSdk();
62
+ await expect(sdk.getAction({
63
+ actionType: "search",
64
+ actionKey: "user_by_email",
65
+ })).rejects.toThrow(ZapierValidationError);
66
+ });
67
+ it("should throw validation error for missing actionType", async () => {
68
+ const sdk = createTestSdk();
69
+ await expect(sdk.getAction({
70
+ appKey: "slack",
71
+ actionKey: "user_by_email",
72
+ })).rejects.toThrow(ZapierValidationError);
73
+ });
74
+ it("should throw validation error for missing actionKey", async () => {
75
+ const sdk = createTestSdk();
76
+ await expect(sdk.getAction({
77
+ appKey: "slack",
78
+ actionType: "search",
79
+ })).rejects.toThrow(ZapierValidationError);
80
+ });
81
+ it("should throw validation error for invalid appKey type", async () => {
82
+ const sdk = createTestSdk();
83
+ await expect(sdk.getAction({
84
+ appKey: 123,
85
+ actionType: "search",
86
+ actionKey: "user_by_email",
87
+ })).rejects.toThrow(ZapierValidationError);
88
+ });
89
+ it("should throw validation error for invalid actionType", async () => {
90
+ const sdk = createTestSdk();
91
+ await expect(sdk.getAction({
92
+ appKey: "slack",
93
+ actionType: "invalid-type",
94
+ actionKey: "user_by_email",
95
+ })).rejects.toThrow(ZapierValidationError);
96
+ });
97
+ it("should throw validation error for invalid actionKey type", async () => {
98
+ const sdk = createTestSdk();
99
+ await expect(sdk.getAction({
100
+ appKey: "slack",
101
+ actionType: "search",
102
+ actionKey: 123,
103
+ })).rejects.toThrow(ZapierValidationError);
104
+ });
105
+ it("should throw validation error for empty appKey", async () => {
106
+ const sdk = createTestSdk();
107
+ await expect(sdk.getAction({
108
+ appKey: "",
109
+ actionType: "search",
110
+ actionKey: "user_by_email",
111
+ })).rejects.toThrow(ZapierValidationError);
112
+ });
113
+ it("should throw validation error for empty actionKey", async () => {
114
+ const sdk = createTestSdk();
115
+ await expect(sdk.getAction({
116
+ appKey: "slack",
117
+ actionType: "search",
118
+ actionKey: "",
119
+ })).rejects.toThrow(ZapierValidationError);
120
+ });
121
+ it("should pass validation with all required fields", async () => {
122
+ const sdk = createTestSdk();
123
+ const result = await sdk.getAction({
124
+ appKey: "slack",
125
+ actionType: "search",
126
+ actionKey: "user_by_email",
127
+ });
128
+ expect(result.data).toEqual(mockActions[0]);
129
+ });
130
+ });
131
+ describe("action lookup", () => {
132
+ it("should call listActions with correct parameters", async () => {
133
+ const sdk = createTestSdk();
134
+ await sdk.getAction({
135
+ appKey: "slack",
136
+ actionType: "search",
137
+ actionKey: "user_by_email",
138
+ });
139
+ expect(mockListActions).toHaveBeenCalledWith({
140
+ appKey: "slack",
141
+ });
142
+ });
143
+ it("should return the correct action when found", async () => {
144
+ const sdk = createTestSdk();
145
+ const result = await sdk.getAction({
146
+ appKey: "slack",
147
+ actionType: "search",
148
+ actionKey: "user_by_email",
149
+ });
150
+ expect(result.data).toEqual(mockActions[0]);
151
+ });
152
+ it("should throw error when action key not found", async () => {
153
+ const sdk = createTestSdk();
154
+ await expect(sdk.getAction({
155
+ appKey: "slack",
156
+ actionType: "search",
157
+ actionKey: "nonexistent_action",
158
+ })).rejects.toThrow(ZapierResourceNotFoundError);
159
+ });
160
+ it("should throw error when action type doesn't match", async () => {
161
+ const sdk = createTestSdk();
162
+ await expect(sdk.getAction({
163
+ appKey: "slack",
164
+ actionType: "write",
165
+ actionKey: "search_messages", // This action is type "search" in mock
166
+ })).rejects.toThrow(ZapierResourceNotFoundError);
167
+ });
168
+ it("should handle listActions errors", async () => {
169
+ mockListActions.mockRejectedValue(new Error("API Error"));
170
+ const sdk = createTestSdk();
171
+ await expect(sdk.getAction({
172
+ appKey: "slack",
173
+ actionType: "search",
174
+ actionKey: "user_by_email",
175
+ })).rejects.toThrow("API Error");
176
+ });
177
+ });
178
+ describe("plugin integration", () => {
179
+ it("should provide metadata in context", () => {
180
+ const sdk = createTestSdk();
181
+ const context = sdk.getContext();
182
+ expect(context.meta.getAction).toBeDefined();
183
+ expect(context.meta.getAction.inputSchema).toBeDefined();
184
+ });
185
+ });
186
+ });
@@ -0,0 +1,23 @@
1
+ import { z } from "zod";
2
+ import type { ActionItem } from "../../types/domain";
3
+ export declare const GetActionSchema: z.ZodObject<{
4
+ appKey: z.ZodString;
5
+ actionType: z.ZodEnum<["read", "read_bulk", "write", "run", "search", "search_or_write", "search_and_write", "filter"]>;
6
+ actionKey: z.ZodString;
7
+ }, "strip", z.ZodTypeAny, {
8
+ appKey: string;
9
+ actionType: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write";
10
+ actionKey: string;
11
+ }, {
12
+ appKey: string;
13
+ actionType: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write";
14
+ actionKey: string;
15
+ }>;
16
+ export type GetActionOptions = z.infer<typeof GetActionSchema>;
17
+ export type GetActionError = import("../../types/errors").ZapierAuthenticationError | import("../../types/errors").ZapierApiError | import("../../types/errors").ZapierAppNotFoundError | import("../../types/errors").ZapierValidationError | import("../../types/errors").ZapierResourceNotFoundError | import("../../types/errors").ZapierUnknownError;
18
+ export interface GetActionSdkFunction {
19
+ getAction: (options: GetActionOptions) => Promise<{
20
+ data: ActionItem;
21
+ }>;
22
+ }
23
+ //# sourceMappingURL=schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/getAction/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGrD,eAAO,MAAM,eAAe;;;;;;;;;;;;EAMmC,CAAC;AAGhE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAG/D,MAAM,MAAM,cAAc,GACtB,OAAO,oBAAoB,EAAE,yBAAyB,GACtD,OAAO,oBAAoB,EAAE,cAAc,GAC3C,OAAO,oBAAoB,EAAE,sBAAsB,GACnD,OAAO,oBAAoB,EAAE,qBAAqB,GAClD,OAAO,oBAAoB,EAAE,2BAA2B,GACxD,OAAO,oBAAoB,EAAE,kBAAkB,CAAC;AAGpD,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,OAAO,CAAC;QAAE,IAAI,EAAE,UAAU,CAAA;KAAE,CAAC,CAAC;CACzE"}
@@ -0,0 +1,10 @@
1
+ import { z } from "zod";
2
+ import { AppKeyPropertySchema, ActionTypePropertySchema, ActionKeyPropertySchema, } from "../../types/properties";
3
+ // Pure Zod schema - no resolver metadata!
4
+ export const GetActionSchema = z
5
+ .object({
6
+ appKey: AppKeyPropertySchema,
7
+ actionType: ActionTypePropertySchema,
8
+ actionKey: ActionKeyPropertySchema,
9
+ })
10
+ .describe("Get detailed information about a specific action");
@@ -0,0 +1,22 @@
1
+ import type { Plugin } from "../../types/plugin";
2
+ import { GetAppSchema } from "./schemas";
3
+ import type { GetAppOptions } from "./schemas";
4
+ import type { AppItem } from "../../types/domain";
5
+ import type { ListAppsPluginProvides } from "../listApps";
6
+ import type { GetSdkType } from "../../types/plugin";
7
+ export interface GetAppPluginProvides {
8
+ getApp: (options: GetAppOptions) => Promise<{
9
+ data: AppItem;
10
+ }>;
11
+ context: {
12
+ meta: {
13
+ getApp: {
14
+ inputSchema: typeof GetAppSchema;
15
+ };
16
+ };
17
+ };
18
+ }
19
+ export declare const getAppPlugin: Plugin<GetSdkType<ListAppsPluginProvides>, // depends on listApps
20
+ {}, // no additional context dependencies
21
+ GetAppPluginProvides>;
22
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/getApp/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGrD,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,OAAO,CAAC;QAAE,IAAI,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IAC/D,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,WAAW,EAAE,OAAO,YAAY,CAAC;aAClC,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAGD,eAAO,MAAM,YAAY,EAAE,MAAM,CAC/B,UAAU,CAAC,sBAAsB,CAAC,EAAE,sBAAsB;AAC1D,EAAE,EAAE,qCAAqC;AACzC,oBAAoB,CAwCrB,CAAC"}
@@ -0,0 +1,39 @@
1
+ import { createFunction } from "../../utils/function-utils";
2
+ import { GetAppSchema } from "./schemas";
3
+ import { ZapierAppNotFoundError } from "../../types/errors";
4
+ // GetApp plugin depends on listApps SDK function
5
+ export const getAppPlugin = ({ sdk }) => {
6
+ const getApp = createFunction(async function getApp(options) {
7
+ const { appKey } = options;
8
+ // Use listApps to get the app by key
9
+ const appsIterator = sdk
10
+ .listApps({
11
+ ...options,
12
+ appKeys: [appKey],
13
+ })
14
+ .items();
15
+ // Get the first (and should be only) result
16
+ const apps = [];
17
+ for await (const app of appsIterator) {
18
+ apps.push(app);
19
+ break; // Only need the first result
20
+ }
21
+ if (apps.length === 0) {
22
+ throw new ZapierAppNotFoundError(appKey);
23
+ }
24
+ return {
25
+ data: apps[0],
26
+ };
27
+ }, GetAppSchema);
28
+ // Return flat structure - getApp goes directly to SDK
29
+ return {
30
+ getApp,
31
+ context: {
32
+ meta: {
33
+ getApp: {
34
+ inputSchema: GetAppSchema,
35
+ },
36
+ },
37
+ },
38
+ };
39
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../../src/plugins/getApp/index.test.ts"],"names":[],"mappings":""}