@zapier/zapier-sdk 0.18.4 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (372) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.md +43 -31
  3. package/dist/index.cjs +365 -64
  4. package/dist/index.d.mts +220 -33
  5. package/dist/index.d.ts +2541 -40
  6. package/dist/index.mjs +345 -63
  7. package/package.json +14 -13
  8. package/dist/api/auth.d.ts +0 -19
  9. package/dist/api/auth.d.ts.map +0 -1
  10. package/dist/api/auth.js +0 -70
  11. package/dist/api/auth.test.d.ts +0 -2
  12. package/dist/api/auth.test.d.ts.map +0 -1
  13. package/dist/api/auth.test.js +0 -220
  14. package/dist/api/client.d.ts +0 -9
  15. package/dist/api/client.d.ts.map +0 -1
  16. package/dist/api/client.js +0 -356
  17. package/dist/api/client.test.d.ts +0 -2
  18. package/dist/api/client.test.d.ts.map +0 -1
  19. package/dist/api/client.test.js +0 -96
  20. package/dist/api/debug.d.ts +0 -14
  21. package/dist/api/debug.d.ts.map +0 -1
  22. package/dist/api/debug.js +0 -131
  23. package/dist/api/debug.test.d.ts +0 -2
  24. package/dist/api/debug.test.d.ts.map +0 -1
  25. package/dist/api/debug.test.js +0 -59
  26. package/dist/api/index.d.ts +0 -30
  27. package/dist/api/index.d.ts.map +0 -1
  28. package/dist/api/index.js +0 -43
  29. package/dist/api/polling.d.ts +0 -46
  30. package/dist/api/polling.d.ts.map +0 -1
  31. package/dist/api/polling.js +0 -139
  32. package/dist/api/polling.test.d.ts +0 -2
  33. package/dist/api/polling.test.d.ts.map +0 -1
  34. package/dist/api/polling.test.js +0 -318
  35. package/dist/api/schemas.d.ts +0 -422
  36. package/dist/api/schemas.d.ts.map +0 -1
  37. package/dist/api/schemas.js +0 -322
  38. package/dist/api/types.d.ts +0 -83
  39. package/dist/api/types.d.ts.map +0 -1
  40. package/dist/api/types.js +0 -1
  41. package/dist/auth.d.ts +0 -52
  42. package/dist/auth.d.ts.map +0 -1
  43. package/dist/auth.js +0 -72
  44. package/dist/auth.test.d.ts +0 -2
  45. package/dist/auth.test.d.ts.map +0 -1
  46. package/dist/auth.test.js +0 -102
  47. package/dist/constants.d.ts +0 -14
  48. package/dist/constants.d.ts.map +0 -1
  49. package/dist/constants.js +0 -13
  50. package/dist/index.d.ts.map +0 -1
  51. package/dist/index.js +0 -42
  52. package/dist/plugins/api/index.d.ts +0 -12
  53. package/dist/plugins/api/index.d.ts.map +0 -1
  54. package/dist/plugins/api/index.js +0 -24
  55. package/dist/plugins/apps/index.d.ts +0 -15
  56. package/dist/plugins/apps/index.d.ts.map +0 -1
  57. package/dist/plugins/apps/index.js +0 -112
  58. package/dist/plugins/apps/schemas.d.ts +0 -42
  59. package/dist/plugins/apps/schemas.d.ts.map +0 -1
  60. package/dist/plugins/apps/schemas.js +0 -14
  61. package/dist/plugins/eventEmission/builders.d.ts +0 -14
  62. package/dist/plugins/eventEmission/builders.d.ts.map +0 -1
  63. package/dist/plugins/eventEmission/builders.js +0 -109
  64. package/dist/plugins/eventEmission/index.d.ts +0 -38
  65. package/dist/plugins/eventEmission/index.d.ts.map +0 -1
  66. package/dist/plugins/eventEmission/index.js +0 -336
  67. package/dist/plugins/eventEmission/index.test.d.ts +0 -5
  68. package/dist/plugins/eventEmission/index.test.d.ts.map +0 -1
  69. package/dist/plugins/eventEmission/index.test.js +0 -581
  70. package/dist/plugins/eventEmission/transport.d.ts +0 -27
  71. package/dist/plugins/eventEmission/transport.d.ts.map +0 -1
  72. package/dist/plugins/eventEmission/transport.js +0 -104
  73. package/dist/plugins/eventEmission/transport.test.d.ts +0 -5
  74. package/dist/plugins/eventEmission/transport.test.d.ts.map +0 -1
  75. package/dist/plugins/eventEmission/transport.test.js +0 -164
  76. package/dist/plugins/eventEmission/types.d.ts +0 -63
  77. package/dist/plugins/eventEmission/types.d.ts.map +0 -1
  78. package/dist/plugins/eventEmission/types.js +0 -1
  79. package/dist/plugins/eventEmission/utils.d.ts +0 -45
  80. package/dist/plugins/eventEmission/utils.d.ts.map +0 -1
  81. package/dist/plugins/eventEmission/utils.js +0 -114
  82. package/dist/plugins/fetch/index.d.ts +0 -36
  83. package/dist/plugins/fetch/index.d.ts.map +0 -1
  84. package/dist/plugins/fetch/index.js +0 -62
  85. package/dist/plugins/fetch/schemas.d.ts +0 -19
  86. package/dist/plugins/fetch/schemas.d.ts.map +0 -1
  87. package/dist/plugins/fetch/schemas.js +0 -31
  88. package/dist/plugins/findFirstAuthentication/index.d.ts +0 -21
  89. package/dist/plugins/findFirstAuthentication/index.d.ts.map +0 -1
  90. package/dist/plugins/findFirstAuthentication/index.js +0 -36
  91. package/dist/plugins/findFirstAuthentication/index.test.d.ts +0 -2
  92. package/dist/plugins/findFirstAuthentication/index.test.d.ts.map +0 -1
  93. package/dist/plugins/findFirstAuthentication/index.test.js +0 -177
  94. package/dist/plugins/findFirstAuthentication/schemas.d.ts +0 -20
  95. package/dist/plugins/findFirstAuthentication/schemas.d.ts.map +0 -1
  96. package/dist/plugins/findFirstAuthentication/schemas.js +0 -18
  97. package/dist/plugins/findUniqueAuthentication/index.d.ts +0 -21
  98. package/dist/plugins/findUniqueAuthentication/index.d.ts.map +0 -1
  99. package/dist/plugins/findUniqueAuthentication/index.js +0 -39
  100. package/dist/plugins/findUniqueAuthentication/index.test.d.ts +0 -2
  101. package/dist/plugins/findUniqueAuthentication/index.test.d.ts.map +0 -1
  102. package/dist/plugins/findUniqueAuthentication/index.test.js +0 -159
  103. package/dist/plugins/findUniqueAuthentication/schemas.d.ts +0 -20
  104. package/dist/plugins/findUniqueAuthentication/schemas.d.ts.map +0 -1
  105. package/dist/plugins/findUniqueAuthentication/schemas.js +0 -18
  106. package/dist/plugins/getAction/index.d.ts +0 -25
  107. package/dist/plugins/getAction/index.d.ts.map +0 -1
  108. package/dist/plugins/getAction/index.js +0 -42
  109. package/dist/plugins/getAction/index.test.d.ts +0 -2
  110. package/dist/plugins/getAction/index.test.d.ts.map +0 -1
  111. package/dist/plugins/getAction/index.test.js +0 -211
  112. package/dist/plugins/getAction/schemas.d.ts +0 -30
  113. package/dist/plugins/getAction/schemas.d.ts.map +0 -1
  114. package/dist/plugins/getAction/schemas.js +0 -12
  115. package/dist/plugins/getApp/index.d.ts +0 -21
  116. package/dist/plugins/getApp/index.d.ts.map +0 -1
  117. package/dist/plugins/getApp/index.js +0 -44
  118. package/dist/plugins/getApp/index.test.d.ts +0 -2
  119. package/dist/plugins/getApp/index.test.d.ts.map +0 -1
  120. package/dist/plugins/getApp/index.test.js +0 -157
  121. package/dist/plugins/getApp/schemas.d.ts +0 -16
  122. package/dist/plugins/getApp/schemas.d.ts.map +0 -1
  123. package/dist/plugins/getApp/schemas.js +0 -8
  124. package/dist/plugins/getAuthentication/index.d.ts +0 -21
  125. package/dist/plugins/getAuthentication/index.d.ts.map +0 -1
  126. package/dist/plugins/getAuthentication/index.js +0 -29
  127. package/dist/plugins/getAuthentication/index.test.d.ts +0 -2
  128. package/dist/plugins/getAuthentication/index.test.d.ts.map +0 -1
  129. package/dist/plugins/getAuthentication/index.test.js +0 -106
  130. package/dist/plugins/getAuthentication/schemas.d.ts +0 -7
  131. package/dist/plugins/getAuthentication/schemas.d.ts.map +0 -1
  132. package/dist/plugins/getAuthentication/schemas.js +0 -1
  133. package/dist/plugins/getInputFieldsSchema/index.d.ts +0 -23
  134. package/dist/plugins/getInputFieldsSchema/index.d.ts.map +0 -1
  135. package/dist/plugins/getInputFieldsSchema/index.js +0 -53
  136. package/dist/plugins/getInputFieldsSchema/index.test.d.ts +0 -2
  137. package/dist/plugins/getInputFieldsSchema/index.test.d.ts.map +0 -1
  138. package/dist/plugins/getInputFieldsSchema/index.test.js +0 -291
  139. package/dist/plugins/getInputFieldsSchema/schemas.d.ts +0 -28
  140. package/dist/plugins/getInputFieldsSchema/schemas.d.ts.map +0 -1
  141. package/dist/plugins/getInputFieldsSchema/schemas.js +0 -13
  142. package/dist/plugins/getProfile/index.d.ts +0 -25
  143. package/dist/plugins/getProfile/index.d.ts.map +0 -1
  144. package/dist/plugins/getProfile/index.js +0 -39
  145. package/dist/plugins/getProfile/schemas.d.ts +0 -13
  146. package/dist/plugins/getProfile/schemas.d.ts.map +0 -1
  147. package/dist/plugins/getProfile/schemas.js +0 -6
  148. package/dist/plugins/listActions/index.d.ts +0 -30
  149. package/dist/plugins/listActions/index.d.ts.map +0 -1
  150. package/dist/plugins/listActions/index.js +0 -75
  151. package/dist/plugins/listActions/index.test.d.ts +0 -2
  152. package/dist/plugins/listActions/index.test.d.ts.map +0 -1
  153. package/dist/plugins/listActions/index.test.js +0 -453
  154. package/dist/plugins/listActions/schemas.d.ts +0 -35
  155. package/dist/plugins/listActions/schemas.d.ts.map +0 -1
  156. package/dist/plugins/listActions/schemas.js +0 -22
  157. package/dist/plugins/listApps/index.d.ts +0 -19
  158. package/dist/plugins/listApps/index.d.ts.map +0 -1
  159. package/dist/plugins/listApps/index.js +0 -67
  160. package/dist/plugins/listApps/index.test.d.ts +0 -2
  161. package/dist/plugins/listApps/index.test.d.ts.map +0 -1
  162. package/dist/plugins/listApps/index.test.js +0 -121
  163. package/dist/plugins/listApps/schemas.d.ts +0 -47
  164. package/dist/plugins/listApps/schemas.d.ts.map +0 -1
  165. package/dist/plugins/listApps/schemas.js +0 -49
  166. package/dist/plugins/listAuthentications/index.d.ts +0 -24
  167. package/dist/plugins/listAuthentications/index.d.ts.map +0 -1
  168. package/dist/plugins/listAuthentications/index.js +0 -77
  169. package/dist/plugins/listAuthentications/index.test.d.ts +0 -2
  170. package/dist/plugins/listAuthentications/index.test.d.ts.map +0 -1
  171. package/dist/plugins/listAuthentications/index.test.js +0 -848
  172. package/dist/plugins/listAuthentications/schemas.d.ts +0 -30
  173. package/dist/plugins/listAuthentications/schemas.d.ts.map +0 -1
  174. package/dist/plugins/listAuthentications/schemas.js +0 -32
  175. package/dist/plugins/listInputFieldChoices/index.d.ts +0 -33
  176. package/dist/plugins/listInputFieldChoices/index.d.ts.map +0 -1
  177. package/dist/plugins/listInputFieldChoices/index.js +0 -115
  178. package/dist/plugins/listInputFieldChoices/index.test.d.ts +0 -2
  179. package/dist/plugins/listInputFieldChoices/index.test.d.ts.map +0 -1
  180. package/dist/plugins/listInputFieldChoices/index.test.js +0 -717
  181. package/dist/plugins/listInputFieldChoices/schemas.d.ts +0 -43
  182. package/dist/plugins/listInputFieldChoices/schemas.d.ts.map +0 -1
  183. package/dist/plugins/listInputFieldChoices/schemas.js +0 -65
  184. package/dist/plugins/listInputFields/index.d.ts +0 -34
  185. package/dist/plugins/listInputFields/index.d.ts.map +0 -1
  186. package/dist/plugins/listInputFields/index.js +0 -204
  187. package/dist/plugins/listInputFields/index.test.d.ts +0 -2
  188. package/dist/plugins/listInputFields/index.test.d.ts.map +0 -1
  189. package/dist/plugins/listInputFields/index.test.js +0 -359
  190. package/dist/plugins/listInputFields/schemas.d.ts +0 -35
  191. package/dist/plugins/listInputFields/schemas.d.ts.map +0 -1
  192. package/dist/plugins/listInputFields/schemas.js +0 -23
  193. package/dist/plugins/manifest/index.d.ts +0 -85
  194. package/dist/plugins/manifest/index.d.ts.map +0 -1
  195. package/dist/plugins/manifest/index.js +0 -376
  196. package/dist/plugins/manifest/index.test.d.ts +0 -2
  197. package/dist/plugins/manifest/index.test.d.ts.map +0 -1
  198. package/dist/plugins/manifest/index.test.js +0 -1139
  199. package/dist/plugins/manifest/schemas.d.ts +0 -57
  200. package/dist/plugins/manifest/schemas.d.ts.map +0 -1
  201. package/dist/plugins/manifest/schemas.js +0 -50
  202. package/dist/plugins/registry/index.d.ts +0 -21
  203. package/dist/plugins/registry/index.d.ts.map +0 -1
  204. package/dist/plugins/registry/index.js +0 -117
  205. package/dist/plugins/request/index.d.ts +0 -21
  206. package/dist/plugins/request/index.d.ts.map +0 -1
  207. package/dist/plugins/request/index.js +0 -76
  208. package/dist/plugins/request/index.test.d.ts +0 -2
  209. package/dist/plugins/request/index.test.d.ts.map +0 -1
  210. package/dist/plugins/request/index.test.js +0 -337
  211. package/dist/plugins/request/schemas.d.ts +0 -54
  212. package/dist/plugins/request/schemas.d.ts.map +0 -1
  213. package/dist/plugins/request/schemas.js +0 -41
  214. package/dist/plugins/runAction/index.d.ts +0 -33
  215. package/dist/plugins/runAction/index.d.ts.map +0 -1
  216. package/dist/plugins/runAction/index.js +0 -108
  217. package/dist/plugins/runAction/index.test.d.ts +0 -2
  218. package/dist/plugins/runAction/index.test.d.ts.map +0 -1
  219. package/dist/plugins/runAction/index.test.js +0 -333
  220. package/dist/plugins/runAction/schemas.d.ts +0 -34
  221. package/dist/plugins/runAction/schemas.d.ts.map +0 -1
  222. package/dist/plugins/runAction/schemas.js +0 -23
  223. package/dist/resolvers/actionKey.d.ts +0 -15
  224. package/dist/resolvers/actionKey.d.ts.map +0 -1
  225. package/dist/resolvers/actionKey.js +0 -19
  226. package/dist/resolvers/actionType.d.ts +0 -10
  227. package/dist/resolvers/actionType.d.ts.map +0 -1
  228. package/dist/resolvers/actionType.js +0 -21
  229. package/dist/resolvers/appKey.d.ts +0 -3
  230. package/dist/resolvers/appKey.d.ts.map +0 -1
  231. package/dist/resolvers/appKey.js +0 -5
  232. package/dist/resolvers/authenticationId.d.ts +0 -9
  233. package/dist/resolvers/authenticationId.d.ts.map +0 -1
  234. package/dist/resolvers/authenticationId.js +0 -42
  235. package/dist/resolvers/index.d.ts +0 -8
  236. package/dist/resolvers/index.d.ts.map +0 -1
  237. package/dist/resolvers/index.js +0 -8
  238. package/dist/resolvers/inputFieldKey.d.ts +0 -11
  239. package/dist/resolvers/inputFieldKey.d.ts.map +0 -1
  240. package/dist/resolvers/inputFieldKey.js +0 -47
  241. package/dist/resolvers/inputs.d.ts +0 -17
  242. package/dist/resolvers/inputs.d.ts.map +0 -1
  243. package/dist/resolvers/inputs.js +0 -50
  244. package/dist/schemas/Action.d.ts +0 -24
  245. package/dist/schemas/Action.d.ts.map +0 -1
  246. package/dist/schemas/Action.js +0 -40
  247. package/dist/schemas/App.d.ts +0 -57
  248. package/dist/schemas/App.d.ts.map +0 -1
  249. package/dist/schemas/App.js +0 -26
  250. package/dist/schemas/Auth.d.ts +0 -55
  251. package/dist/schemas/Auth.d.ts.map +0 -1
  252. package/dist/schemas/Auth.js +0 -33
  253. package/dist/schemas/Field.d.ts +0 -61
  254. package/dist/schemas/Field.d.ts.map +0 -1
  255. package/dist/schemas/Field.js +0 -116
  256. package/dist/schemas/Run.d.ts +0 -3
  257. package/dist/schemas/Run.d.ts.map +0 -1
  258. package/dist/schemas/Run.js +0 -31
  259. package/dist/schemas/UserProfile.d.ts +0 -13
  260. package/dist/schemas/UserProfile.d.ts.map +0 -1
  261. package/dist/schemas/UserProfile.js +0 -32
  262. package/dist/sdk.d.ts +0 -146
  263. package/dist/sdk.d.ts.map +0 -1
  264. package/dist/sdk.js +0 -112
  265. package/dist/sdk.test.d.ts +0 -2
  266. package/dist/sdk.test.d.ts.map +0 -1
  267. package/dist/sdk.test.js +0 -258
  268. package/dist/services/implementations.d.ts +0 -63
  269. package/dist/services/implementations.d.ts.map +0 -1
  270. package/dist/services/implementations.js +0 -80
  271. package/dist/types/domain.d.ts +0 -52
  272. package/dist/types/domain.d.ts.map +0 -1
  273. package/dist/types/domain.js +0 -1
  274. package/dist/types/domain.test.d.ts +0 -2
  275. package/dist/types/domain.test.d.ts.map +0 -1
  276. package/dist/types/domain.test.js +0 -39
  277. package/dist/types/errors.d.ts +0 -143
  278. package/dist/types/errors.d.ts.map +0 -1
  279. package/dist/types/errors.js +0 -187
  280. package/dist/types/events.d.ts +0 -38
  281. package/dist/types/events.d.ts.map +0 -1
  282. package/dist/types/events.js +0 -7
  283. package/dist/types/functions.d.ts +0 -27
  284. package/dist/types/functions.d.ts.map +0 -1
  285. package/dist/types/functions.js +0 -1
  286. package/dist/types/plugin.d.ts +0 -75
  287. package/dist/types/plugin.d.ts.map +0 -1
  288. package/dist/types/plugin.js +0 -9
  289. package/dist/types/properties.d.ts +0 -33
  290. package/dist/types/properties.d.ts.map +0 -1
  291. package/dist/types/properties.js +0 -52
  292. package/dist/types/sdk.d.ts +0 -69
  293. package/dist/types/sdk.d.ts.map +0 -1
  294. package/dist/types/sdk.js +0 -4
  295. package/dist/types/telemetry-events.d.ts +0 -105
  296. package/dist/types/telemetry-events.d.ts.map +0 -1
  297. package/dist/types/telemetry-events.js +0 -8
  298. package/dist/utils/array-utils.d.ts +0 -31
  299. package/dist/utils/array-utils.d.ts.map +0 -1
  300. package/dist/utils/array-utils.js +0 -36
  301. package/dist/utils/array-utils.test.d.ts +0 -2
  302. package/dist/utils/array-utils.test.d.ts.map +0 -1
  303. package/dist/utils/array-utils.test.js +0 -107
  304. package/dist/utils/batch-utils.d.ts +0 -72
  305. package/dist/utils/batch-utils.d.ts.map +0 -1
  306. package/dist/utils/batch-utils.js +0 -162
  307. package/dist/utils/batch-utils.test.d.ts +0 -2
  308. package/dist/utils/batch-utils.test.d.ts.map +0 -1
  309. package/dist/utils/batch-utils.test.js +0 -476
  310. package/dist/utils/domain-utils.d.ts +0 -66
  311. package/dist/utils/domain-utils.d.ts.map +0 -1
  312. package/dist/utils/domain-utils.js +0 -164
  313. package/dist/utils/domain-utils.test.d.ts +0 -2
  314. package/dist/utils/domain-utils.test.d.ts.map +0 -1
  315. package/dist/utils/domain-utils.test.js +0 -346
  316. package/dist/utils/file-utils.d.ts +0 -4
  317. package/dist/utils/file-utils.d.ts.map +0 -1
  318. package/dist/utils/file-utils.js +0 -74
  319. package/dist/utils/file-utils.test.d.ts +0 -2
  320. package/dist/utils/file-utils.test.d.ts.map +0 -1
  321. package/dist/utils/file-utils.test.js +0 -51
  322. package/dist/utils/function-utils.d.ts +0 -73
  323. package/dist/utils/function-utils.d.ts.map +0 -1
  324. package/dist/utils/function-utils.js +0 -245
  325. package/dist/utils/function-utils.test.d.ts +0 -2
  326. package/dist/utils/function-utils.test.d.ts.map +0 -1
  327. package/dist/utils/function-utils.test.js +0 -110
  328. package/dist/utils/id-utils.d.ts +0 -13
  329. package/dist/utils/id-utils.d.ts.map +0 -1
  330. package/dist/utils/id-utils.js +0 -22
  331. package/dist/utils/id-utils.test.d.ts +0 -2
  332. package/dist/utils/id-utils.test.d.ts.map +0 -1
  333. package/dist/utils/id-utils.test.js +0 -22
  334. package/dist/utils/pagination-utils.d.ts +0 -37
  335. package/dist/utils/pagination-utils.d.ts.map +0 -1
  336. package/dist/utils/pagination-utils.js +0 -165
  337. package/dist/utils/pagination-utils.test.d.ts +0 -17
  338. package/dist/utils/pagination-utils.test.d.ts.map +0 -1
  339. package/dist/utils/pagination-utils.test.js +0 -461
  340. package/dist/utils/retry-utils.d.ts +0 -45
  341. package/dist/utils/retry-utils.d.ts.map +0 -1
  342. package/dist/utils/retry-utils.js +0 -51
  343. package/dist/utils/retry-utils.test.d.ts +0 -2
  344. package/dist/utils/retry-utils.test.d.ts.map +0 -1
  345. package/dist/utils/retry-utils.test.js +0 -90
  346. package/dist/utils/schema-utils.d.ts +0 -69
  347. package/dist/utils/schema-utils.d.ts.map +0 -1
  348. package/dist/utils/schema-utils.js +0 -72
  349. package/dist/utils/string-utils.d.ts +0 -40
  350. package/dist/utils/string-utils.d.ts.map +0 -1
  351. package/dist/utils/string-utils.js +0 -69
  352. package/dist/utils/string-utils.test.d.ts +0 -2
  353. package/dist/utils/string-utils.test.d.ts.map +0 -1
  354. package/dist/utils/string-utils.test.js +0 -59
  355. package/dist/utils/telemetry-utils.d.ts +0 -44
  356. package/dist/utils/telemetry-utils.d.ts.map +0 -1
  357. package/dist/utils/telemetry-utils.js +0 -55
  358. package/dist/utils/telemetry-utils.test.d.ts +0 -2
  359. package/dist/utils/telemetry-utils.test.d.ts.map +0 -1
  360. package/dist/utils/telemetry-utils.test.js +0 -94
  361. package/dist/utils/url-utils.d.ts +0 -19
  362. package/dist/utils/url-utils.d.ts.map +0 -1
  363. package/dist/utils/url-utils.js +0 -62
  364. package/dist/utils/url-utils.test.d.ts +0 -2
  365. package/dist/utils/url-utils.test.d.ts.map +0 -1
  366. package/dist/utils/url-utils.test.js +0 -103
  367. package/dist/utils/validation.d.ts +0 -4
  368. package/dist/utils/validation.d.ts.map +0 -1
  369. package/dist/utils/validation.js +0 -30
  370. package/dist/utils/validation.test.d.ts +0 -2
  371. package/dist/utils/validation.test.d.ts.map +0 -1
  372. package/dist/utils/validation.test.js +0 -44
@@ -1 +0,0 @@
1
- {"version":3,"file":"retry-utils.d.ts","sourceRoot":"","sources":["../../src/utils/retry-utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,eAAO,MAAM,sBAAsB,IAAI,CAAC;AAExC;;;GAGG;AACH,eAAO,MAAM,qBAAqB,OAAQ,CAAC;AAE3C;;;;GAIG;AACH,eAAO,MAAM,aAAa,MAAM,CAAC;AAEjC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,iBAAiB,CAC/B,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,GACjB,MAAM,CAYR"}
@@ -1,51 +0,0 @@
1
- /**
2
- * Retry and Backoff Utilities
3
- *
4
- * Shared utilities for implementing resilient retry logic with exponential backoff
5
- * and jitter. Used by both polling and batch operations.
6
- */
7
- /**
8
- * Maximum number of consecutive errors before giving up
9
- * Prevents infinite retry loops when the API is consistently failing
10
- */
11
- export const MAX_CONSECUTIVE_ERRORS = 3;
12
- /**
13
- * Base delay for error backoff in milliseconds
14
- * Each error adds this amount (with scaling) to the wait time
15
- */
16
- export const BASE_ERROR_BACKOFF_MS = 1000;
17
- /**
18
- * Jitter factor (0.0 to 1.0) for randomizing wait times
19
- * Prevents thundering herd problem when many clients retry simultaneously
20
- * A factor of 0.5 means we add 0-50% random variance to the base interval
21
- */
22
- export const JITTER_FACTOR = 0.5;
23
- /**
24
- * Calculate wait time with jitter and error backoff
25
- *
26
- * This implements two key reliability patterns:
27
- * 1. Jitter - Adds randomness to prevent synchronized retries across clients
28
- * 2. Error backoff - Increases wait time when errors occur, giving the API time to recover
29
- *
30
- * @param baseInterval - The base wait time in milliseconds
31
- * @param errorCount - Number of consecutive errors (0 if no errors)
32
- * @returns Wait time in milliseconds with jitter and error backoff applied
33
- *
34
- * @example
35
- * // No errors: returns 1000-1500ms (1000 + 0-500ms jitter)
36
- * calculateWaitTime(1000, 0);
37
- *
38
- * // 2 errors: returns 1000-1500ms base + up to 1000ms error backoff = 1000-2500ms
39
- * calculateWaitTime(1000, 2);
40
- *
41
- * // 6 errors: returns 1000-1500ms base + 2000ms capped backoff = 3000-3500ms
42
- * calculateWaitTime(1000, 6);
43
- */
44
- export function calculateWaitTime(baseInterval, errorCount) {
45
- // Jitter to avoid thundering herd (multiple clients retrying at exact same time)
46
- const jitter = Math.random() * JITTER_FACTOR * baseInterval;
47
- // Exponential backoff scaled by error count, but capped at 2x base interval
48
- // This prevents wait times from growing unboundedly
49
- const errorBackoff = Math.min(BASE_ERROR_BACKOFF_MS * (errorCount / 2), baseInterval * 2);
50
- return Math.floor(baseInterval + jitter + errorBackoff);
51
- }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=retry-utils.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"retry-utils.test.d.ts","sourceRoot":"","sources":["../../src/utils/retry-utils.test.ts"],"names":[],"mappings":""}
@@ -1,90 +0,0 @@
1
- import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
2
- import { calculateWaitTime, MAX_CONSECUTIVE_ERRORS, BASE_ERROR_BACKOFF_MS, JITTER_FACTOR, } from "./retry-utils";
3
- describe("retry-utils", () => {
4
- describe("calculateWaitTime", () => {
5
- beforeEach(() => {
6
- // Seed random for consistent testing
7
- vi.spyOn(Math, "random");
8
- });
9
- afterEach(() => {
10
- vi.restoreAllMocks();
11
- });
12
- it("should return base interval with jitter when no errors", () => {
13
- vi.spyOn(Math, "random").mockReturnValue(0.5); // Middle of jitter range
14
- const baseInterval = 1000;
15
- const waitTime = calculateWaitTime(baseInterval, 0);
16
- // With 0.5 random and JITTER_FACTOR 0.5:
17
- // jitter = 0.5 * 0.5 * 1000 = 250ms
18
- // errorBackoff = 0 (no errors)
19
- // total = 1000 + 250 + 0 = 1250ms
20
- expect(waitTime).toBe(1250);
21
- });
22
- it("should add error backoff for consecutive errors", () => {
23
- vi.spyOn(Math, "random").mockReturnValue(0); // No jitter for simpler math
24
- const baseInterval = 1000;
25
- const errorCount = 2;
26
- const waitTime = calculateWaitTime(baseInterval, errorCount);
27
- // jitter = 0 (random is 0)
28
- // errorBackoff = BASE_ERROR_BACKOFF_MS * (errorCount / 2) = 1000 * (2/2) = 1000ms
29
- // total = 1000 + 0 + 1000 = 2000ms
30
- expect(waitTime).toBe(2000);
31
- });
32
- it("should cap error backoff at 2x base interval", () => {
33
- vi.spyOn(Math, "random").mockReturnValue(0); // No jitter
34
- const baseInterval = 1000;
35
- const errorCount = 10; // Large error count
36
- const waitTime = calculateWaitTime(baseInterval, errorCount);
37
- // errorBackoff would be 1000 * (10/2) = 5000ms
38
- // but it's capped at 2x base = 2000ms
39
- // total = 1000 + 0 + 2000 = 3000ms
40
- expect(waitTime).toBe(3000);
41
- });
42
- it("should add random jitter to prevent thundering herd", () => {
43
- const baseInterval = 1000;
44
- const results = new Set();
45
- // Run multiple times with real random to ensure jitter varies
46
- vi.spyOn(Math, "random").mockRestore(); // Use real random
47
- for (let i = 0; i < 10; i++) {
48
- const waitTime = calculateWaitTime(baseInterval, 0);
49
- results.add(waitTime);
50
- }
51
- // Should have multiple different values due to jitter
52
- expect(results.size).toBeGreaterThan(1);
53
- // All values should be in expected range
54
- // baseInterval (1000) + jitter (0 to JITTER_FACTOR * baseInterval)
55
- // = 1000 to 1500ms
56
- for (const result of results) {
57
- expect(result).toBeGreaterThanOrEqual(1000);
58
- expect(result).toBeLessThanOrEqual(1500);
59
- }
60
- });
61
- it("should combine jitter and error backoff", () => {
62
- vi.spyOn(Math, "random").mockReturnValue(0.5);
63
- const baseInterval = 1000;
64
- const errorCount = 2;
65
- const waitTime = calculateWaitTime(baseInterval, errorCount);
66
- // jitter = 0.5 * 0.5 * 1000 = 250ms
67
- // errorBackoff = 1000 * (2/2) = 1000ms
68
- // total = 1000 + 250 + 1000 = 2250ms
69
- expect(waitTime).toBe(2250);
70
- });
71
- it("should return integer wait time", () => {
72
- vi.spyOn(Math, "random").mockReturnValue(0.333);
73
- const baseInterval = 1000;
74
- const waitTime = calculateWaitTime(baseInterval, 1);
75
- // Result should be floored integer
76
- expect(Number.isInteger(waitTime)).toBe(true);
77
- });
78
- });
79
- describe("constants", () => {
80
- it("should export MAX_CONSECUTIVE_ERRORS", () => {
81
- expect(MAX_CONSECUTIVE_ERRORS).toBe(3);
82
- });
83
- it("should export BASE_ERROR_BACKOFF_MS", () => {
84
- expect(BASE_ERROR_BACKOFF_MS).toBe(1000);
85
- });
86
- it("should export JITTER_FACTOR", () => {
87
- expect(JITTER_FACTOR).toBe(0.5);
88
- });
89
- });
90
- });
@@ -1,69 +0,0 @@
1
- import { z } from "zod";
2
- import type { ZapierSdk } from "../types/sdk";
3
- import type { InputFieldItem } from "../schemas/Field";
4
- export interface FormattedItem {
5
- title: string;
6
- id?: string;
7
- key?: string;
8
- keys?: string[];
9
- description?: string;
10
- data?: unknown;
11
- details: Array<{
12
- text: string;
13
- style: "normal" | "dim" | "accent" | "warning" | "success";
14
- }>;
15
- }
16
- export interface FormatMetadata<TItem = unknown> {
17
- format: (item: TItem) => FormattedItem;
18
- }
19
- export declare function withFormatter<T extends z.ZodType>(schema: T, formatMeta: FormatMetadata<z.infer<T>>): T;
20
- export declare function getOutputSchema(inputSchema: z.ZodType): z.ZodType | undefined;
21
- export declare function withOutputSchema<T extends z.ZodType>(inputSchema: T, outputSchema: z.ZodType): T & {
22
- _def: T["_def"] & {
23
- outputSchema: z.ZodType;
24
- };
25
- };
26
- export interface PromptConfig {
27
- type: "list";
28
- name: string;
29
- message: string;
30
- choices: Array<{
31
- name: string;
32
- value: unknown;
33
- }>;
34
- }
35
- export interface Resolver {
36
- type: string;
37
- depends?: readonly string[] | string[];
38
- }
39
- export interface StaticResolver extends Resolver {
40
- type: "static";
41
- inputType?: "text" | "password" | "email";
42
- placeholder?: string;
43
- }
44
- export interface DynamicResolver<TItem = unknown, TParams = Record<string, unknown>> extends Resolver {
45
- type: "dynamic";
46
- fetch: (sdk: ZapierSdk, resolvedParams: TParams) => Promise<TItem[]>;
47
- prompt: (items: TItem[], params: TParams) => PromptConfig;
48
- }
49
- export interface FieldsResolver<TParams = Record<string, unknown>> extends Resolver {
50
- type: "fields";
51
- fetch: (sdk: ZapierSdk, resolvedParams: TParams) => Promise<InputFieldItem[]>;
52
- }
53
- export type ResolverMetadata<TItem = unknown, TParams = Record<string, unknown>> = StaticResolver | DynamicResolver<TItem, TParams> | FieldsResolver<TParams>;
54
- export interface ResolverConfig<TItem = unknown, TParams = Record<string, unknown>> {
55
- resolver: ResolverMetadata<TItem, TParams>;
56
- }
57
- export declare function withResolver<T extends z.ZodType, TItem = unknown, TParams = Record<string, unknown>>(schema: T, config: ResolverConfig<TItem, TParams>): T;
58
- export declare function getSchemaDescription(schema: z.ZodSchema): string | undefined;
59
- export declare function getFieldDescriptions(schema: z.ZodObject<z.ZodRawShape>): Record<string, string>;
60
- export interface PositionalMetadata {
61
- positionalMeta: {
62
- positional: true;
63
- };
64
- }
65
- export declare function withPositional<T extends z.ZodType>(schema: T): T & {
66
- _def: T["_def"] & PositionalMetadata;
67
- };
68
- export declare function isPositional(schema: z.ZodType): boolean;
69
- //# sourceMappingURL=schema-utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema-utils.d.ts","sourceRoot":"","sources":["../../src/utils/schema-utils.ts"],"names":[],"mappings":"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"}
@@ -1,72 +0,0 @@
1
- import { z } from "zod";
2
- // Helper function to add format metadata to schemas
3
- export function withFormatter(schema, formatMeta) {
4
- // Store format metadata on the schema definition
5
- Object.assign(schema._zod.def, {
6
- formatMeta: formatMeta,
7
- });
8
- return schema;
9
- }
10
- // Helper function to get output schema from an input schema
11
- export function getOutputSchema(inputSchema) {
12
- return inputSchema._zod.def.outputSchema;
13
- }
14
- // Helper function to link input schemas to output schemas
15
- export function withOutputSchema(inputSchema, outputSchema) {
16
- // Store output schema reference on the input schema
17
- Object.assign(inputSchema._zod.def, {
18
- outputSchema,
19
- });
20
- return inputSchema;
21
- }
22
- // Helper function to add resolver metadata to schemas
23
- export function withResolver(schema, config) {
24
- // Store resolver metadata on the schema definition
25
- schema._zod.def.resolverMeta = config;
26
- return schema;
27
- }
28
- // ============================================================================
29
- // Schema Description Utilities
30
- // ============================================================================
31
- export function getSchemaDescription(schema) {
32
- return schema.description;
33
- }
34
- export function getFieldDescriptions(schema) {
35
- const descriptions = {};
36
- const shape = schema.shape;
37
- for (const [key, fieldSchema] of Object.entries(shape)) {
38
- if (fieldSchema instanceof z.ZodType && fieldSchema.description) {
39
- descriptions[key] = fieldSchema.description;
40
- }
41
- }
42
- return descriptions;
43
- }
44
- // Helper function to mark a parameter as positional for CLI
45
- export function withPositional(schema) {
46
- // Store positional metadata on the schema definition
47
- Object.assign(schema._zod.def, {
48
- positionalMeta: { positional: true },
49
- });
50
- return schema;
51
- }
52
- function schemaHasPositionalMeta(schema) {
53
- return "positionalMeta" in schema._zod.def;
54
- }
55
- // Helper function to check if a parameter should be positional
56
- export function isPositional(schema) {
57
- // Check the current schema first
58
- if (schemaHasPositionalMeta(schema) &&
59
- schema._zod.def
60
- .positionalMeta?.positional) {
61
- return true;
62
- }
63
- // If this is a ZodOptional, check the inner type
64
- if (schema instanceof z.ZodOptional) {
65
- return isPositional(schema._zod.def.innerType);
66
- }
67
- // If this is a ZodDefault, check the inner type
68
- if (schema instanceof z.ZodDefault) {
69
- return isPositional(schema._zod.def.innerType);
70
- }
71
- return false;
72
- }
@@ -1,40 +0,0 @@
1
- /**
2
- * String utility functions for the Zapier SDK
3
- */
4
- /**
5
- * Converts a string to title case, handling various input formats:
6
- * - camelCase: "firstName" → "First Name"
7
- * - snake_case: "first_name" → "First Name"
8
- * - kebab-case: "first-name" → "First Name"
9
- * - mixed formats: "first_name-value" → "First Name Value"
10
- */
11
- export declare function toTitleCase(input: string): string;
12
- /**
13
- * Converts a string to snake_case, handling various input formats:
14
- * - camelCase: "firstName" → "first_name"
15
- * - kebab-case: "first-name" → "first_name"
16
- * - title case: "First Name" → "first_name"
17
- * - mixed formats: "first-Name Value" → "first_name_value"
18
- * - starts with number: "123abc" → "_123abc"
19
- */
20
- export declare function toSnakeCase(input: string): string;
21
- /**
22
- * Strips the "Page" suffix from a function name, used for deriving method names
23
- * from paginated function implementations.
24
- *
25
- * This is commonly used with `createPaginatedFunction` where the internal function
26
- * has a "Page" suffix (e.g., "listAppsPage") but the public method name should not
27
- * (e.g., "listApps").
28
- *
29
- * @param functionName - The function name, typically from `function.name`
30
- * @returns The function name with "Page" suffix removed, or original if no suffix
31
- *
32
- * @example
33
- * ```typescript
34
- * stripPageSuffix("listAppsPage") // "listApps"
35
- * stripPageSuffix("listApps") // "listApps" (no change)
36
- * stripPageSuffix("myPageFunction") // "myPageFunction" (only strips from end)
37
- * ```
38
- */
39
- export declare function stripPageSuffix(functionName: string): string;
40
- //# sourceMappingURL=string-utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"string-utils.d.ts","sourceRoot":"","sources":["../../src/utils/string-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAcjD;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAkBjD;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAE5D"}
@@ -1,69 +0,0 @@
1
- /**
2
- * String utility functions for the Zapier SDK
3
- */
4
- /**
5
- * Converts a string to title case, handling various input formats:
6
- * - camelCase: "firstName" → "First Name"
7
- * - snake_case: "first_name" → "First Name"
8
- * - kebab-case: "first-name" → "First Name"
9
- * - mixed formats: "first_name-value" → "First Name Value"
10
- */
11
- export function toTitleCase(input) {
12
- return (input
13
- // insert a space before capital letters (handles camelCase)
14
- .replace(/([a-z0-9])([A-Z])/g, "$1 $2")
15
- // replace delimiters (underscore, dash, multiple spaces) with single space
16
- .replace(/[_\-]+/g, " ")
17
- .replace(/\s+/g, " ")
18
- .trim()
19
- // split and capitalize each word
20
- .split(" ")
21
- .map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
22
- .join(" "));
23
- }
24
- /**
25
- * Converts a string to snake_case, handling various input formats:
26
- * - camelCase: "firstName" → "first_name"
27
- * - kebab-case: "first-name" → "first_name"
28
- * - title case: "First Name" → "first_name"
29
- * - mixed formats: "first-Name Value" → "first_name_value"
30
- * - starts with number: "123abc" → "_123abc"
31
- */
32
- export function toSnakeCase(input) {
33
- let result = input
34
- // insert underscore before capital letters (handles camelCase)
35
- .replace(/([a-z0-9])([A-Z])/g, "$1_$2")
36
- // replace spaces and dashes with underscores
37
- .replace(/[\s\-]+/g, "_")
38
- // replace multiple underscores with single underscore
39
- .replace(/_+/g, "_")
40
- // remove leading/trailing underscores and convert to lowercase
41
- .replace(/^_|_$/g, "")
42
- .toLowerCase();
43
- // If the result starts with a number, prefix with underscore
44
- if (/^[0-9]/.test(result)) {
45
- result = "_" + result;
46
- }
47
- return result;
48
- }
49
- /**
50
- * Strips the "Page" suffix from a function name, used for deriving method names
51
- * from paginated function implementations.
52
- *
53
- * This is commonly used with `createPaginatedFunction` where the internal function
54
- * has a "Page" suffix (e.g., "listAppsPage") but the public method name should not
55
- * (e.g., "listApps").
56
- *
57
- * @param functionName - The function name, typically from `function.name`
58
- * @returns The function name with "Page" suffix removed, or original if no suffix
59
- *
60
- * @example
61
- * ```typescript
62
- * stripPageSuffix("listAppsPage") // "listApps"
63
- * stripPageSuffix("listApps") // "listApps" (no change)
64
- * stripPageSuffix("myPageFunction") // "myPageFunction" (only strips from end)
65
- * ```
66
- */
67
- export function stripPageSuffix(functionName) {
68
- return functionName.replace(/Page$/, "");
69
- }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=string-utils.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"string-utils.test.d.ts","sourceRoot":"","sources":["../../src/utils/string-utils.test.ts"],"names":[],"mappings":""}
@@ -1,59 +0,0 @@
1
- import { describe, it, expect } from "vitest";
2
- import { toTitleCase, stripPageSuffix } from "./string-utils";
3
- describe("toTitleCase", () => {
4
- it("converts snake_case to title case", () => {
5
- expect(toTitleCase("first_name")).toBe("First Name");
6
- expect(toTitleCase("sender_settings")).toBe("Sender Settings");
7
- expect(toTitleCase("api_key_config")).toBe("Api Key Config");
8
- });
9
- it("converts camelCase to title case", () => {
10
- expect(toTitleCase("firstName")).toBe("First Name");
11
- expect(toTitleCase("senderSettings")).toBe("Sender Settings");
12
- expect(toTitleCase("apiKeyConfig")).toBe("Api Key Config");
13
- });
14
- it("converts kebab-case to title case", () => {
15
- expect(toTitleCase("first-name")).toBe("First Name");
16
- expect(toTitleCase("sender-settings")).toBe("Sender Settings");
17
- expect(toTitleCase("api-key-config")).toBe("Api Key Config");
18
- });
19
- it("handles mixed formats", () => {
20
- expect(toTitleCase("first_name-value")).toBe("First Name Value");
21
- expect(toTitleCase("sender_settings-config")).toBe("Sender Settings Config");
22
- });
23
- it("handles single words", () => {
24
- expect(toTitleCase("name")).toBe("Name");
25
- expect(toTitleCase("settings")).toBe("Settings");
26
- });
27
- it("handles multiple spaces and trims", () => {
28
- expect(toTitleCase(" first name ")).toBe("First Name");
29
- expect(toTitleCase("sender__settings")).toBe("Sender Settings");
30
- });
31
- it("handles empty and edge cases", () => {
32
- expect(toTitleCase("")).toBe("");
33
- expect(toTitleCase("a")).toBe("A");
34
- expect(toTitleCase("_")).toBe("");
35
- });
36
- });
37
- describe("stripPageSuffix", () => {
38
- it("strips Page suffix from function names", () => {
39
- expect(stripPageSuffix("listAppsPage")).toBe("listApps");
40
- expect(stripPageSuffix("listActionsPage")).toBe("listActions");
41
- expect(stripPageSuffix("runActionPage")).toBe("runAction");
42
- expect(stripPageSuffix("listAuthenticationsPage")).toBe("listAuthentications");
43
- });
44
- it("leaves names without Page suffix unchanged", () => {
45
- expect(stripPageSuffix("listApps")).toBe("listApps");
46
- expect(stripPageSuffix("getProfile")).toBe("getProfile");
47
- expect(stripPageSuffix("request")).toBe("request");
48
- });
49
- it("only strips Page from the end", () => {
50
- expect(stripPageSuffix("myPageFunction")).toBe("myPageFunction");
51
- expect(stripPageSuffix("PageList")).toBe("PageList");
52
- expect(stripPageSuffix("getPageData")).toBe("getPageData");
53
- });
54
- it("handles edge cases", () => {
55
- expect(stripPageSuffix("Page")).toBe("");
56
- expect(stripPageSuffix("")).toBe("");
57
- expect(stripPageSuffix("p")).toBe("p");
58
- });
59
- });
@@ -1,44 +0,0 @@
1
- import type { TelemetryCallbacks } from "./function-utils";
2
- import type { EventEmissionContext } from "../plugins/eventEmission";
3
- /**
4
- * Creates a standardized telemetry callback for SDK method invocations.
5
- *
6
- * This factory eliminates boilerplate by providing a consistent implementation
7
- * of the onMethodCalled callback used by createFunction and createPaginatedFunction.
8
- *
9
- * @param emitMethodCalled - The event emission function from EventEmissionContext
10
- * @param methodName - The method name to report in telemetry. Use `function.name` to derive
11
- * this automatically from the function declaration, ensuring DRY principles and making
12
- * refactoring easier. Function names are preserved through bundling.
13
- * @returns TelemetryCallbacks object with standardized onMethodCalled implementation
14
- *
15
- * @example
16
- * Basic usage with createFunction:
17
- * ```typescript
18
- * async function listApps(options: ListAppsOptions) { ... }
19
- *
20
- * const listAppsDefinition = createFunction(
21
- * listApps,
22
- * ListAppsSchema,
23
- * createTelemetryCallback(context.eventEmission.emitMethodCalled, listApps.name),
24
- * );
25
- * ```
26
- *
27
- * @example
28
- * For paginated functions, use stripPageSuffix to remove the "Page" suffix:
29
- * ```typescript
30
- * import { stripPageSuffix } from "./string-utils";
31
- *
32
- * async function listAppsPage(options: ListAppsOptions & { pageSize: number }) { ... }
33
- *
34
- * const methodName = stripPageSuffix(listAppsPage.name);
35
- * const listAppsDefinition = createPaginatedFunction(
36
- * listAppsPage,
37
- * ListAppsSchema,
38
- * createTelemetryCallback(context.eventEmission.emitMethodCalled, methodName),
39
- * methodName,
40
- * );
41
- * ```
42
- */
43
- export declare function createTelemetryCallback(emitMethodCalled: EventEmissionContext["eventEmission"]["emitMethodCalled"], methodName: string): TelemetryCallbacks;
44
- //# sourceMappingURL=telemetry-utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"telemetry-utils.d.ts","sourceRoot":"","sources":["../../src/utils/telemetry-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAErE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,wBAAgB,uBAAuB,CACrC,gBAAgB,EAAE,oBAAoB,CAAC,eAAe,CAAC,CAAC,kBAAkB,CAAC,EAC3E,UAAU,EAAE,MAAM,GACjB,kBAAkB,CAcpB"}
@@ -1,55 +0,0 @@
1
- /**
2
- * Creates a standardized telemetry callback for SDK method invocations.
3
- *
4
- * This factory eliminates boilerplate by providing a consistent implementation
5
- * of the onMethodCalled callback used by createFunction and createPaginatedFunction.
6
- *
7
- * @param emitMethodCalled - The event emission function from EventEmissionContext
8
- * @param methodName - The method name to report in telemetry. Use `function.name` to derive
9
- * this automatically from the function declaration, ensuring DRY principles and making
10
- * refactoring easier. Function names are preserved through bundling.
11
- * @returns TelemetryCallbacks object with standardized onMethodCalled implementation
12
- *
13
- * @example
14
- * Basic usage with createFunction:
15
- * ```typescript
16
- * async function listApps(options: ListAppsOptions) { ... }
17
- *
18
- * const listAppsDefinition = createFunction(
19
- * listApps,
20
- * ListAppsSchema,
21
- * createTelemetryCallback(context.eventEmission.emitMethodCalled, listApps.name),
22
- * );
23
- * ```
24
- *
25
- * @example
26
- * For paginated functions, use stripPageSuffix to remove the "Page" suffix:
27
- * ```typescript
28
- * import { stripPageSuffix } from "./string-utils";
29
- *
30
- * async function listAppsPage(options: ListAppsOptions & { pageSize: number }) { ... }
31
- *
32
- * const methodName = stripPageSuffix(listAppsPage.name);
33
- * const listAppsDefinition = createPaginatedFunction(
34
- * listAppsPage,
35
- * ListAppsSchema,
36
- * createTelemetryCallback(context.eventEmission.emitMethodCalled, methodName),
37
- * methodName,
38
- * );
39
- * ```
40
- */
41
- export function createTelemetryCallback(emitMethodCalled, methodName) {
42
- return {
43
- onMethodCalled: (data) => {
44
- emitMethodCalled({
45
- method_name: methodName,
46
- execution_duration_ms: data.durationMs,
47
- success_flag: data.success,
48
- error_message: data.error?.message ?? null,
49
- error_type: data.error?.constructor.name ?? null,
50
- argument_count: data.argumentCount,
51
- is_paginated: data.isPaginated,
52
- });
53
- },
54
- };
55
- }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=telemetry-utils.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"telemetry-utils.test.d.ts","sourceRoot":"","sources":["../../src/utils/telemetry-utils.test.ts"],"names":[],"mappings":""}