runline 0.33.0 → 0.34.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 (515) hide show
  1. package/dist/auth/oauth2.d.ts +7 -1
  2. package/dist/auth/oauth2.js +10 -0
  3. package/dist/auth/token.d.ts +1 -0
  4. package/dist/auth/token.js +19 -1
  5. package/dist/auth/types.d.ts +22 -1
  6. package/dist/core/engine.d.ts +7 -0
  7. package/dist/core/engine.js +9 -0
  8. package/dist/credentials/policy.d.ts +53 -1
  9. package/dist/credentials/policy.js +146 -6
  10. package/dist/credentials/registry.d.ts +9 -0
  11. package/dist/credentials/registry.js +179 -22
  12. package/dist/credentials/transport.d.ts +48 -2
  13. package/dist/credentials/transport.js +248 -70
  14. package/dist/credentials/types.d.ts +167 -10
  15. package/dist/index.d.ts +5 -5
  16. package/dist/index.js +2 -2
  17. package/dist/plugin/api.d.ts +7 -0
  18. package/dist/plugin/api.js +7 -0
  19. package/dist/plugin/types.d.ts +12 -0
  20. package/dist/plugins/_shared/credentialAdapter.js +79 -15
  21. package/dist/plugins/_shared/credentials.js +389 -0
  22. package/dist/plugins/_shared/googleAuth.js +9 -40
  23. package/dist/plugins/_shared/googleCredentials.js +28 -7
  24. package/dist/plugins/_shared/microsoftAuth.js +13 -44
  25. package/dist/plugins/_shared/microsoftCredentials.js +30 -8
  26. package/dist/plugins/_shared/provider.js +2 -14
  27. package/dist/plugins/_shared/shiftCloud.js +19 -55
  28. package/dist/plugins/_shared/shiftCredentials.js +83 -0
  29. package/dist/plugins/actionNetwork/src/credentials.js +14 -0
  30. package/dist/plugins/actionNetwork/src/index.js +39 -50
  31. package/dist/plugins/activeCampaign/src/credentials.js +22 -0
  32. package/dist/plugins/activeCampaign/src/index.js +61 -132
  33. package/dist/plugins/adalo/src/credentials.js +16 -0
  34. package/dist/plugins/adalo/src/index.js +19 -43
  35. package/dist/plugins/affinity/src/credentials.js +19 -0
  36. package/dist/plugins/affinity/src/index.js +29 -54
  37. package/dist/plugins/agileCrm/src/credentials.js +16 -0
  38. package/dist/plugins/agileCrm/src/index.js +46 -112
  39. package/dist/plugins/airtable/src/credentials.js +19 -0
  40. package/dist/plugins/airtable/src/index.js +37 -50
  41. package/dist/plugins/airtop/src/credentials.js +20 -0
  42. package/dist/plugins/airtop/src/index.js +51 -75
  43. package/dist/plugins/apiTemplateIo/src/credentials.js +19 -0
  44. package/dist/plugins/apiTemplateIo/src/index.js +14 -31
  45. package/dist/plugins/asana/src/credentials.js +19 -0
  46. package/dist/plugins/asana/src/index.js +51 -72
  47. package/dist/plugins/autopilot/src/credentials.js +19 -0
  48. package/dist/plugins/autopilot/src/index.js +38 -45
  49. package/dist/plugins/bambooHr/src/credentials.js +16 -0
  50. package/dist/plugins/bambooHr/src/index.js +41 -67
  51. package/dist/plugins/bannerbear/src/credentials.js +19 -0
  52. package/dist/plugins/bannerbear/src/index.js +15 -27
  53. package/dist/plugins/baserow/src/credentials.js +17 -0
  54. package/dist/plugins/baserow/src/index.js +23 -49
  55. package/dist/plugins/beeminder/src/credentials.js +19 -0
  56. package/dist/plugins/beeminder/src/index.js +32 -54
  57. package/dist/plugins/bitly/src/credentials.js +19 -0
  58. package/dist/plugins/bitly/src/index.js +12 -26
  59. package/dist/plugins/bitwarden/src/credentials.js +62 -0
  60. package/dist/plugins/bitwarden/src/index.js +34 -80
  61. package/dist/plugins/box/src/credentials.js +19 -0
  62. package/dist/plugins/box/src/index.js +24 -49
  63. package/dist/plugins/brandfetch/src/credentials.js +13 -0
  64. package/dist/plugins/brandfetch/src/index.js +12 -17
  65. package/dist/plugins/brevo/src/credentials.js +19 -0
  66. package/dist/plugins/brevo/src/index.js +30 -51
  67. package/dist/plugins/bubble/src/credentials.js +28 -0
  68. package/dist/plugins/bubble/src/index.js +29 -65
  69. package/dist/plugins/chargebee/src/credentials.js +16 -0
  70. package/dist/plugins/chargebee/src/index.js +15 -45
  71. package/dist/plugins/circleci/src/credentials.js +19 -0
  72. package/dist/plugins/circleci/src/index.js +19 -39
  73. package/dist/plugins/ciscoWebex/src/credentials.js +19 -0
  74. package/dist/plugins/ciscoWebex/src/index.js +43 -61
  75. package/dist/plugins/clearbit/src/credentials.js +22 -0
  76. package/dist/plugins/clearbit/src/index.js +11 -21
  77. package/dist/plugins/clickup/src/credentials.js +19 -0
  78. package/dist/plugins/clickup/src/index.js +85 -117
  79. package/dist/plugins/clockify/src/credentials.js +19 -0
  80. package/dist/plugins/clockify/src/index.js +46 -61
  81. package/dist/plugins/cloudflare/src/credentials.js +19 -0
  82. package/dist/plugins/cloudflare/src/index.js +19 -34
  83. package/dist/plugins/cockpit/src/credentials.js +17 -0
  84. package/dist/plugins/cockpit/src/index.js +18 -31
  85. package/dist/plugins/coda/src/credentials.js +19 -0
  86. package/dist/plugins/coda/src/index.js +33 -50
  87. package/dist/plugins/coingecko/src/credentials.js +20 -0
  88. package/dist/plugins/coingecko/src/index.js +24 -34
  89. package/dist/plugins/contentful/src/credentials.js +26 -0
  90. package/dist/plugins/contentful/src/index.js +19 -40
  91. package/dist/plugins/convertkit/src/credentials.js +26 -0
  92. package/dist/plugins/convertkit/src/index.js +27 -45
  93. package/dist/plugins/copper/src/credentials.js +17 -0
  94. package/dist/plugins/copper/src/index.js +25 -47
  95. package/dist/plugins/cortex/src/credentials.js +28 -0
  96. package/dist/plugins/cortex/src/index.js +26 -49
  97. package/dist/plugins/currents/src/credentials.js +19 -0
  98. package/dist/plugins/currents/src/index.js +46 -59
  99. package/dist/plugins/customerIo/src/credentials.js +52 -0
  100. package/dist/plugins/customerIo/src/index.js +30 -58
  101. package/dist/plugins/databricks/src/credentials.js +13 -0
  102. package/dist/plugins/databricks/src/index.js +51 -103
  103. package/dist/plugins/deepl/src/credentials.js +19 -0
  104. package/dist/plugins/deepl/src/index.js +13 -39
  105. package/dist/plugins/demio/src/credentials.js +26 -0
  106. package/dist/plugins/demio/src/index.js +17 -41
  107. package/dist/plugins/dhl/src/credentials.js +13 -0
  108. package/dist/plugins/dhl/src/index.js +8 -19
  109. package/dist/plugins/discord/src/credentials.js +19 -0
  110. package/dist/plugins/discord/src/index.js +30 -58
  111. package/dist/plugins/discourse/src/credentials.js +18 -0
  112. package/dist/plugins/discourse/src/index.js +36 -53
  113. package/dist/plugins/disqus/src/credentials.js +13 -0
  114. package/dist/plugins/disqus/src/index.js +14 -32
  115. package/dist/plugins/drift/src/credentials.js +13 -0
  116. package/dist/plugins/drift/src/index.js +16 -26
  117. package/dist/plugins/dropbox/src/credentials.js +13 -0
  118. package/dist/plugins/dropbox/src/index.js +23 -30
  119. package/dist/plugins/dropcontact/src/credentials.js +13 -0
  120. package/dist/plugins/dropcontact/src/index.js +13 -18
  121. package/dist/plugins/egoi/src/credentials.js +19 -0
  122. package/dist/plugins/egoi/src/index.js +23 -38
  123. package/dist/plugins/elasticsearch/src/credentials.js +18 -0
  124. package/dist/plugins/elasticsearch/src/index.js +27 -48
  125. package/dist/plugins/elevenlabs/src/credentials.js +30 -0
  126. package/dist/plugins/elevenlabs/src/index.js +4 -1
  127. package/dist/plugins/elevenlabs/src/schemas.js +2 -1
  128. package/dist/plugins/elevenlabs/src/shared.js +74 -35
  129. package/dist/plugins/elevenlabs/src/workflows.js +2 -2
  130. package/dist/plugins/emelia/src/credentials.js +14 -0
  131. package/dist/plugins/emelia/src/index.js +19 -23
  132. package/dist/plugins/erpnext/src/credentials.js +27 -0
  133. package/dist/plugins/erpnext/src/index.js +21 -42
  134. package/dist/plugins/facebookGraph/src/credentials.js +20 -0
  135. package/dist/plugins/facebookGraph/src/index.js +39 -37
  136. package/dist/plugins/fal/src/credentials.js +14 -0
  137. package/dist/plugins/fal/src/index.js +4 -2
  138. package/dist/plugins/fal/src/shared.js +58 -63
  139. package/dist/plugins/freshdesk/src/credentials.js +20 -0
  140. package/dist/plugins/freshdesk/src/index.js +25 -46
  141. package/dist/plugins/freshservice/src/credentials.js +16 -0
  142. package/dist/plugins/freshservice/src/index.js +37 -58
  143. package/dist/plugins/freshworksCrm/src/credentials.js +16 -0
  144. package/dist/plugins/freshworksCrm/src/index.js +20 -39
  145. package/dist/plugins/getresponse/src/credentials.js +22 -0
  146. package/dist/plugins/getresponse/src/index.js +20 -32
  147. package/dist/plugins/gett/src/credentials.js +64 -0
  148. package/dist/plugins/gett/src/index.js +11 -6
  149. package/dist/plugins/gett/src/login.js +24 -0
  150. package/dist/plugins/gett/src/session.js +15 -38
  151. package/dist/plugins/gett/src/shared.js +41 -84
  152. package/dist/plugins/ghost/src/credentials.js +36 -0
  153. package/dist/plugins/ghost/src/index.js +18 -59
  154. package/dist/plugins/github/src/credentials.js +18 -0
  155. package/dist/plugins/github/src/index.js +55 -78
  156. package/dist/plugins/gitlab/src/credentials.js +24 -0
  157. package/dist/plugins/gitlab/src/index.js +29 -48
  158. package/dist/plugins/gmail/src/index.js +26 -24
  159. package/dist/plugins/gong/src/credentials.js +16 -0
  160. package/dist/plugins/gong/src/index.js +16 -32
  161. package/dist/plugins/googleAppsScript/src/index.js +108 -42
  162. package/dist/plugins/googleCalendar/src/index.js +15 -13
  163. package/dist/plugins/googleContacts/src/index.js +12 -9
  164. package/dist/plugins/googleDocs/src/index.js +2 -0
  165. package/dist/plugins/googleDocs/src/shared.js +2 -1
  166. package/dist/plugins/googleDrive/src/index.js +50 -53
  167. package/dist/plugins/googleImage/src/credentials.js +14 -0
  168. package/dist/plugins/googleImage/src/index.js +14 -25
  169. package/dist/plugins/googleSheets/src/index.js +26 -27
  170. package/dist/plugins/googleSlides/src/index.js +6 -4
  171. package/dist/plugins/googleTasks/src/index.js +13 -11
  172. package/dist/plugins/gotify/src/credentials.js +32 -0
  173. package/dist/plugins/gotify/src/index.js +14 -36
  174. package/dist/plugins/gotowebinar/src/credentials.js +13 -0
  175. package/dist/plugins/gotowebinar/src/index.js +52 -69
  176. package/dist/plugins/grafana/src/credentials.js +16 -0
  177. package/dist/plugins/grafana/src/index.js +34 -53
  178. package/dist/plugins/graphql/src/credentials.js +42 -0
  179. package/dist/plugins/graphql/src/index.js +21 -46
  180. package/dist/plugins/grist/src/credentials.js +30 -0
  181. package/dist/plugins/grist/src/index.js +14 -43
  182. package/dist/plugins/halopsa/src/credentials.js +56 -0
  183. package/dist/plugins/halopsa/src/index.js +20 -47
  184. package/dist/plugins/harvest/src/credentials.js +20 -0
  185. package/dist/plugins/harvest/src/index.js +24 -43
  186. package/dist/plugins/helpscout/src/credentials.js +13 -0
  187. package/dist/plugins/helpscout/src/index.js +26 -38
  188. package/dist/plugins/highlevel/src/credentials.js +19 -0
  189. package/dist/plugins/highlevel/src/index.js +34 -63
  190. package/dist/plugins/homeAssistant/src/credentials.js +27 -0
  191. package/dist/plugins/homeAssistant/src/index.js +34 -52
  192. package/dist/plugins/hubspot/src/credentials.js +16 -0
  193. package/dist/plugins/hubspot/src/index.js +29 -41
  194. package/dist/plugins/humanticAi/src/credentials.js +13 -0
  195. package/dist/plugins/humanticAi/src/index.js +15 -22
  196. package/dist/plugins/hunter/src/credentials.js +13 -0
  197. package/dist/plugins/hunter/src/index.js +18 -17
  198. package/dist/plugins/intercom/src/credentials.js +19 -0
  199. package/dist/plugins/intercom/src/index.js +25 -38
  200. package/dist/plugins/iterable/src/credentials.js +17 -0
  201. package/dist/plugins/iterable/src/index.js +26 -40
  202. package/dist/plugins/jenkins/src/credentials.js +16 -0
  203. package/dist/plugins/jenkins/src/index.js +22 -36
  204. package/dist/plugins/jira/src/credentials.js +16 -0
  205. package/dist/plugins/jira/src/index.js +35 -61
  206. package/dist/plugins/keap/src/credentials.js +19 -0
  207. package/dist/plugins/keap/src/index.js +43 -71
  208. package/dist/plugins/kobotoolbox/src/credentials.js +13 -0
  209. package/dist/plugins/kobotoolbox/src/index.js +46 -84
  210. package/dist/plugins/lemlist/src/credentials.js +19 -0
  211. package/dist/plugins/lemlist/src/index.js +35 -47
  212. package/dist/plugins/linear/src/attachments.js +7 -7
  213. package/dist/plugins/linear/src/comments.js +7 -7
  214. package/dist/plugins/linear/src/credentials.js +17 -0
  215. package/dist/plugins/linear/src/cycles.js +5 -5
  216. package/dist/plugins/linear/src/index.js +2 -0
  217. package/dist/plugins/linear/src/initiatives.js +6 -6
  218. package/dist/plugins/linear/src/issues.js +14 -14
  219. package/dist/plugins/linear/src/labels.js +6 -6
  220. package/dist/plugins/linear/src/organization.js +2 -2
  221. package/dist/plugins/linear/src/projects.js +12 -12
  222. package/dist/plugins/linear/src/shared.js +34 -32
  223. package/dist/plugins/linear/src/states.js +3 -3
  224. package/dist/plugins/linear/src/teams.js +4 -4
  225. package/dist/plugins/linear/src/users.js +3 -3
  226. package/dist/plugins/linear/src/views.js +5 -5
  227. package/dist/plugins/linear/src/webhooks.js +5 -5
  228. package/dist/plugins/lingvanex/src/credentials.js +13 -0
  229. package/dist/plugins/lingvanex/src/index.js +7 -9
  230. package/dist/plugins/linkedin/src/credentials.js +17 -0
  231. package/dist/plugins/linkedin/src/index.js +13 -17
  232. package/dist/plugins/lonescale/src/credentials.js +13 -0
  233. package/dist/plugins/lonescale/src/index.js +16 -26
  234. package/dist/plugins/magento/src/credentials.js +16 -0
  235. package/dist/plugins/magento/src/index.js +67 -84
  236. package/dist/plugins/mailcheck/src/credentials.js +17 -0
  237. package/dist/plugins/mailcheck/src/index.js +7 -9
  238. package/dist/plugins/mailchimp/src/credentials.js +32 -0
  239. package/dist/plugins/mailchimp/src/index.js +36 -44
  240. package/dist/plugins/mailerlite/src/credentials.js +13 -0
  241. package/dist/plugins/mailerlite/src/index.js +19 -32
  242. package/dist/plugins/mailgun/src/credentials.js +21 -0
  243. package/dist/plugins/mailgun/src/index.js +15 -21
  244. package/dist/plugins/mailjet/src/credentials.js +38 -0
  245. package/dist/plugins/mailjet/src/index.js +60 -115
  246. package/dist/plugins/mandrill/src/credentials.js +17 -0
  247. package/dist/plugins/mandrill/src/index.js +11 -12
  248. package/dist/plugins/marketstack/src/credentials.js +16 -0
  249. package/dist/plugins/marketstack/src/index.js +18 -28
  250. package/dist/plugins/matrix/src/credentials.js +19 -0
  251. package/dist/plugins/matrix/src/index.js +23 -52
  252. package/dist/plugins/mattermost/src/credentials.js +19 -0
  253. package/dist/plugins/mattermost/src/index.js +41 -73
  254. package/dist/plugins/mautic/src/credentials.js +16 -0
  255. package/dist/plugins/mautic/src/index.js +46 -62
  256. package/dist/plugins/medium/src/credentials.js +20 -0
  257. package/dist/plugins/medium/src/index.js +18 -23
  258. package/dist/plugins/messagebird/src/credentials.js +22 -0
  259. package/dist/plugins/messagebird/src/index.js +13 -18
  260. package/dist/plugins/metabase/src/credentials.js +19 -0
  261. package/dist/plugins/metabase/src/index.js +24 -40
  262. package/dist/plugins/microsoftCalendar/src/index.js +48 -12
  263. package/dist/plugins/microsoftFiles/src/index.js +90 -25
  264. package/dist/plugins/microsoftMail/src/index.js +62 -15
  265. package/dist/plugins/misp/src/credentials.js +16 -0
  266. package/dist/plugins/misp/src/index.js +60 -71
  267. package/dist/plugins/mocean/src/credentials.js +17 -0
  268. package/dist/plugins/mocean/src/index.js +11 -23
  269. package/dist/plugins/monday/src/credentials.js +14 -0
  270. package/dist/plugins/monday/src/index.js +31 -44
  271. package/dist/plugins/monicaCrm/src/credentials.js +19 -0
  272. package/dist/plugins/monicaCrm/src/index.js +25 -42
  273. package/dist/plugins/msg91/src/credentials.js +10 -0
  274. package/dist/plugins/msg91/src/index.js +15 -11
  275. package/dist/plugins/nasa/src/credentials.js +22 -0
  276. package/dist/plugins/nasa/src/index.js +24 -28
  277. package/dist/plugins/netlify/src/credentials.js +19 -0
  278. package/dist/plugins/netlify/src/index.js +27 -51
  279. package/dist/plugins/netscalerAdc/src/credentials.js +18 -0
  280. package/dist/plugins/netscalerAdc/src/index.js +16 -31
  281. package/dist/plugins/nextcloud/src/credentials.js +27 -0
  282. package/dist/plugins/nextcloud/src/index.js +55 -109
  283. package/dist/plugins/nocodb/src/credentials.js +16 -0
  284. package/dist/plugins/nocodb/src/index.js +19 -37
  285. package/dist/plugins/notion/src/credentials.js +21 -0
  286. package/dist/plugins/notion/src/index.js +25 -38
  287. package/dist/plugins/npm/src/credentials.js +19 -0
  288. package/dist/plugins/npm/src/index.js +22 -32
  289. package/dist/plugins/odoo/src/credentials.js +21 -0
  290. package/dist/plugins/odoo/src/index.js +53 -69
  291. package/dist/plugins/okta/src/credentials.js +23 -0
  292. package/dist/plugins/okta/src/index.js +30 -35
  293. package/dist/plugins/oneSimpleApi/src/credentials.js +16 -0
  294. package/dist/plugins/oneSimpleApi/src/index.js +19 -24
  295. package/dist/plugins/onfleet/src/credentials.js +23 -0
  296. package/dist/plugins/onfleet/src/index.js +42 -53
  297. package/dist/plugins/openai/src/credentials.js +13 -0
  298. package/dist/plugins/openai/src/index.js +15 -23
  299. package/dist/plugins/openweathermap/src/credentials.js +16 -0
  300. package/dist/plugins/openweathermap/src/index.js +22 -22
  301. package/dist/plugins/oura/src/credentials.js +19 -0
  302. package/dist/plugins/oura/src/index.js +13 -18
  303. package/dist/plugins/paddle/src/credentials.js +27 -0
  304. package/dist/plugins/paddle/src/index.js +20 -36
  305. package/dist/plugins/pagerduty/src/credentials.js +24 -0
  306. package/dist/plugins/pagerduty/src/index.js +30 -39
  307. package/dist/plugins/parallel/src/credentials.js +18 -0
  308. package/dist/plugins/parallel/src/index.js +16 -22
  309. package/dist/plugins/paypal/src/credentials.js +44 -0
  310. package/dist/plugins/paypal/src/index.js +14 -40
  311. package/dist/plugins/peekalink/src/credentials.js +16 -0
  312. package/dist/plugins/peekalink/src/index.js +10 -11
  313. package/dist/plugins/phantombuster/src/credentials.js +19 -0
  314. package/dist/plugins/phantombuster/src/index.js +19 -32
  315. package/dist/plugins/philipsHue/src/credentials.js +17 -0
  316. package/dist/plugins/philipsHue/src/index.js +15 -27
  317. package/dist/plugins/pipedrive/src/credentials.js +26 -0
  318. package/dist/plugins/pipedrive/src/index.js +43 -73
  319. package/dist/plugins/plaud/src/index.js +2 -1
  320. package/dist/plugins/plaud/src/shared.js +23 -19
  321. package/dist/plugins/plivo/src/credentials.js +20 -0
  322. package/dist/plugins/plivo/src/index.js +13 -19
  323. package/dist/plugins/posthog/src/credentials.js +18 -0
  324. package/dist/plugins/posthog/src/index.js +14 -20
  325. package/dist/plugins/profitwell/src/credentials.js +22 -0
  326. package/dist/plugins/profitwell/src/index.js +10 -17
  327. package/dist/plugins/pushbullet/src/credentials.js +19 -0
  328. package/dist/plugins/pushbullet/src/index.js +19 -27
  329. package/dist/plugins/pushcut/src/credentials.js +19 -0
  330. package/dist/plugins/pushcut/src/index.js +7 -8
  331. package/dist/plugins/pushover/src/credentials.js +14 -0
  332. package/dist/plugins/pushover/src/index.js +7 -12
  333. package/dist/plugins/quickbase/src/credentials.js +15 -0
  334. package/dist/plugins/quickbase/src/index.js +24 -34
  335. package/dist/plugins/quickbooks/src/credentials.js +22 -0
  336. package/dist/plugins/quickbooks/src/index.js +17 -46
  337. package/dist/plugins/raindrop/src/credentials.js +19 -0
  338. package/dist/plugins/raindrop/src/index.js +30 -32
  339. package/dist/plugins/recraft/src/credentials.js +13 -0
  340. package/dist/plugins/recraft/src/index.js +38 -27
  341. package/dist/plugins/reddit/src/credentials.js +26 -0
  342. package/dist/plugins/reddit/src/index.js +30 -34
  343. package/dist/plugins/replicate/src/credentials.js +23 -0
  344. package/dist/plugins/replicate/src/index.js +17 -27
  345. package/dist/plugins/rocketchat/src/credentials.js +17 -0
  346. package/dist/plugins/rocketchat/src/index.js +8 -19
  347. package/dist/plugins/rundeck/src/credentials.js +16 -0
  348. package/dist/plugins/rundeck/src/index.js +12 -28
  349. package/dist/plugins/salesforce/src/credentials.js +73 -0
  350. package/dist/plugins/salesforce/src/index.js +6 -0
  351. package/dist/plugins/salesforce/src/metadata.js +3 -16
  352. package/dist/plugins/salesforce/src/shared.js +25 -100
  353. package/dist/plugins/salesforce/src/sobjects.js +10 -9
  354. package/dist/plugins/salesmate/src/credentials.js +17 -0
  355. package/dist/plugins/salesmate/src/index.js +20 -37
  356. package/dist/plugins/securityScorecard/src/credentials.js +22 -0
  357. package/dist/plugins/securityScorecard/src/index.js +24 -37
  358. package/dist/plugins/segment/src/credentials.js +16 -0
  359. package/dist/plugins/segment/src/index.js +12 -16
  360. package/dist/plugins/sendgrid/src/credentials.js +13 -0
  361. package/dist/plugins/sendgrid/src/index.js +31 -35
  362. package/dist/plugins/sendy/src/credentials.js +18 -0
  363. package/dist/plugins/sendy/src/index.js +18 -24
  364. package/dist/plugins/sentry/src/credentials.js +16 -0
  365. package/dist/plugins/sentry/src/index.js +30 -98
  366. package/dist/plugins/servicenow/src/credentials.js +13 -0
  367. package/dist/plugins/servicenow/src/index.js +22 -41
  368. package/dist/plugins/shiftAtlas/src/graph.js +2 -2
  369. package/dist/plugins/shiftAtlas/src/index.js +2 -0
  370. package/dist/plugins/shiftAtlas/src/shared.js +3 -1
  371. package/dist/plugins/shiftBwm/src/index.js +4 -2
  372. package/dist/plugins/shiftBwm/src/shared.js +41 -16
  373. package/dist/plugins/shiftCrm/src/access.js +2 -2
  374. package/dist/plugins/shiftCrm/src/accounts.js +3 -3
  375. package/dist/plugins/shiftCrm/src/activities.js +3 -3
  376. package/dist/plugins/shiftCrm/src/credentials.js +6 -0
  377. package/dist/plugins/shiftCrm/src/index.js +2 -0
  378. package/dist/plugins/shiftCrm/src/opportunities.js +3 -3
  379. package/dist/plugins/shiftCrm/src/people.js +3 -3
  380. package/dist/plugins/shiftCrm/src/records.js +2 -2
  381. package/dist/plugins/shiftCrm/src/shared.js +2 -1
  382. package/dist/plugins/shiftCrm/src/tasks.js +3 -3
  383. package/dist/plugins/shiftObjects/src/credentials.js +2 -0
  384. package/dist/plugins/shiftObjects/src/index.js +2 -0
  385. package/dist/plugins/shiftObjects/src/objects.js +3 -2
  386. package/dist/plugins/shiftOcr/src/credentials.js +8 -0
  387. package/dist/plugins/shiftOcr/src/index.js +6 -5
  388. package/dist/plugins/shiftPages/src/index.js +2 -0
  389. package/dist/plugins/shiftPages/src/pages.js +5 -3
  390. package/dist/plugins/shiftPages/src/shared.js +3 -1
  391. package/dist/plugins/shiftTranscription/src/index.js +2 -0
  392. package/dist/plugins/shiftTranscription/src/shared.js +11 -1
  393. package/dist/plugins/shiftTranscription/src/transcription.js +4 -4
  394. package/dist/plugins/shiftWork/src/index.js +2 -0
  395. package/dist/plugins/shiftWork/src/issue-views.js +5 -5
  396. package/dist/plugins/shiftWork/src/issues.js +11 -7
  397. package/dist/plugins/shiftWork/src/projects.js +3 -3
  398. package/dist/plugins/shiftWork/src/shared.js +3 -1
  399. package/dist/plugins/shopify/src/credentials.js +16 -0
  400. package/dist/plugins/shopify/src/index.js +32 -59
  401. package/dist/plugins/signl4/src/credentials.js +17 -0
  402. package/dist/plugins/signl4/src/index.js +28 -29
  403. package/dist/plugins/slack/src/credentials.js +19 -0
  404. package/dist/plugins/slack/src/index.js +51 -60
  405. package/dist/plugins/sms77/src/credentials.js +17 -0
  406. package/dist/plugins/sms77/src/index.js +11 -16
  407. package/dist/plugins/splunk/src/credentials.js +19 -0
  408. package/dist/plugins/splunk/src/index.js +32 -74
  409. package/dist/plugins/spotify/src/credentials.js +19 -0
  410. package/dist/plugins/spotify/src/index.js +40 -55
  411. package/dist/plugins/stackby/src/credentials.js +13 -0
  412. package/dist/plugins/stackby/src/index.js +14 -23
  413. package/dist/plugins/steel/src/auth.js +27 -0
  414. package/dist/plugins/steel/src/browser.js +4 -3
  415. package/dist/plugins/steel/src/captchas.js +4 -3
  416. package/dist/plugins/steel/src/extensions.js +3 -2
  417. package/dist/plugins/steel/src/files.js +9 -10
  418. package/dist/plugins/steel/src/index.js +2 -0
  419. package/dist/plugins/steel/src/page/tools.js +3 -3
  420. package/dist/plugins/steel/src/profiles.js +4 -3
  421. package/dist/plugins/steel/src/sessions.js +13 -13
  422. package/dist/plugins/steel/src/shared.js +21 -51
  423. package/dist/plugins/storyblok/src/credentials.js +37 -0
  424. package/dist/plugins/storyblok/src/index.js +22 -66
  425. package/dist/plugins/strapi/src/credentials.js +71 -0
  426. package/dist/plugins/strapi/src/index.js +36 -70
  427. package/dist/plugins/strava/src/credentials.js +19 -0
  428. package/dist/plugins/strava/src/index.js +16 -33
  429. package/dist/plugins/stripe/src/credentials.js +19 -0
  430. package/dist/plugins/stripe/src/index.js +44 -58
  431. package/dist/plugins/supabase/src/credentials.js +30 -0
  432. package/dist/plugins/supabase/src/index.js +18 -40
  433. package/dist/plugins/syncromsp/src/credentials.js +16 -0
  434. package/dist/plugins/syncromsp/src/index.js +37 -70
  435. package/dist/plugins/tapfiliate/src/credentials.js +13 -0
  436. package/dist/plugins/tapfiliate/src/index.js +21 -31
  437. package/dist/plugins/telegram/src/credentials.js +20 -0
  438. package/dist/plugins/telegram/src/index.js +31 -39
  439. package/dist/plugins/thehive/src/credentials.js +14 -0
  440. package/dist/plugins/thehive/src/index.js +33 -50
  441. package/dist/plugins/thehiveProject/src/credentials.js +16 -0
  442. package/dist/plugins/thehiveProject/src/index.js +53 -122
  443. package/dist/plugins/todoist/src/credentials.js +26 -0
  444. package/dist/plugins/todoist/src/index.js +49 -79
  445. package/dist/plugins/together/src/credentials.js +16 -0
  446. package/dist/plugins/together/src/index.js +30 -32
  447. package/dist/plugins/travisci/src/credentials.js +24 -0
  448. package/dist/plugins/travisci/src/index.js +16 -30
  449. package/dist/plugins/trello/src/credentials.js +29 -0
  450. package/dist/plugins/trello/src/index.js +49 -64
  451. package/dist/plugins/twake/src/credentials.js +16 -0
  452. package/dist/plugins/twake/src/index.js +8 -10
  453. package/dist/plugins/twilio/src/credentials.js +23 -0
  454. package/dist/plugins/twilio/src/index.js +12 -26
  455. package/dist/plugins/twist/src/credentials.js +13 -0
  456. package/dist/plugins/twist/src/index.js +32 -44
  457. package/dist/plugins/twitter/src/credentials.js +16 -0
  458. package/dist/plugins/twitter/src/index.js +25 -37
  459. package/dist/plugins/typesafe/src/credentials.js +28 -0
  460. package/dist/plugins/typesafe/src/index.js +3 -1
  461. package/dist/plugins/typesafe/src/shared.js +23 -35
  462. package/dist/plugins/unleashedSoftware/src/credentials.js +21 -0
  463. package/dist/plugins/unleashedSoftware/src/index.js +13 -37
  464. package/dist/plugins/uplead/src/credentials.js +16 -0
  465. package/dist/plugins/uplead/src/index.js +11 -16
  466. package/dist/plugins/uproc/src/credentials.js +14 -0
  467. package/dist/plugins/uproc/src/index.js +7 -10
  468. package/dist/plugins/uptimerobot/src/credentials.js +14 -0
  469. package/dist/plugins/uptimerobot/src/index.js +28 -39
  470. package/dist/plugins/urlscanio/src/credentials.js +13 -0
  471. package/dist/plugins/urlscanio/src/index.js +13 -22
  472. package/dist/plugins/vercel/src/credentials.js +19 -0
  473. package/dist/plugins/vercel/src/deployments.js +27 -11
  474. package/dist/plugins/vercel/src/env.js +31 -12
  475. package/dist/plugins/vercel/src/index.js +2 -0
  476. package/dist/plugins/vercel/src/projects.js +6 -3
  477. package/dist/plugins/vercel/src/shared.js +32 -37
  478. package/dist/plugins/vero/src/credentials.js +17 -0
  479. package/dist/plugins/vero/src/index.js +18 -21
  480. package/dist/plugins/vonage/src/credentials.js +17 -0
  481. package/dist/plugins/vonage/src/index.js +14 -18
  482. package/dist/plugins/wekan/src/credentials.js +16 -0
  483. package/dist/plugins/wekan/src/index.js +33 -46
  484. package/dist/plugins/wolt/src/account.js +6 -0
  485. package/dist/plugins/wolt/src/catalog.js +2 -2
  486. package/dist/plugins/wolt/src/credentials.js +64 -0
  487. package/dist/plugins/wolt/src/index.js +8 -3
  488. package/dist/plugins/wolt/src/orders.js +2 -2
  489. package/dist/plugins/wolt/src/public.js +91 -0
  490. package/dist/plugins/wolt/src/shared.js +49 -158
  491. package/dist/plugins/woocommerce/src/credentials.js +16 -0
  492. package/dist/plugins/woocommerce/src/index.js +19 -37
  493. package/dist/plugins/wordpress/src/credentials.js +16 -0
  494. package/dist/plugins/wordpress/src/index.js +23 -42
  495. package/dist/plugins/xai/src/credentials.js +13 -0
  496. package/dist/plugins/xai/src/index.js +31 -30
  497. package/dist/plugins/xero/src/credentials.js +17 -0
  498. package/dist/plugins/xero/src/index.js +19 -36
  499. package/dist/plugins/yourls/src/credentials.js +17 -0
  500. package/dist/plugins/yourls/src/index.js +13 -23
  501. package/dist/plugins/zammad/src/credentials.js +15 -0
  502. package/dist/plugins/zammad/src/index.js +27 -47
  503. package/dist/plugins/zendesk/src/credentials.js +26 -0
  504. package/dist/plugins/zendesk/src/index.js +29 -48
  505. package/dist/plugins/zoho/src/credentials.js +17 -0
  506. package/dist/plugins/zoho/src/index.js +18 -38
  507. package/dist/plugins/zoom/src/credentials.js +19 -0
  508. package/dist/plugins/zoom/src/index.js +15 -30
  509. package/dist/plugins/zulip/src/credentials.js +16 -0
  510. package/dist/plugins/zulip/src/index.js +36 -42
  511. package/dist/sdk.d.ts +8 -0
  512. package/dist/sdk.js +3 -0
  513. package/package.json +1 -1
  514. package/dist/plugins/_shared/authedFetch.js +0 -33
  515. package/dist/plugins/_shared/tokenRefresh.js +0 -41
@@ -1,4 +1,4 @@
1
- import type { OAuth2Definition, OAuthApplication, OAuthAuthorizationOptions, OAuthCodeOptions, OAuthJwtIdentity, OAuthRuntimeOptions, OAuthTokens } from "./types.js";
1
+ import type { OAuth2Definition, OAuthApplication, OAuthAuthorizationOptions, OAuthCodeOptions, OAuthJwtIdentity, OAuthResourceOwner, OAuthRuntimeOptions, OAuthTokens } from "./types.js";
2
2
  /** Shared by definition registration and both setup primitives; no truthy coercion. */
3
3
  export declare function validateOAuth2ExchangePolicy(endpoint: OAuth2Definition["exchange"]): void;
4
4
  /** Redirect registration and state custody belong to the host's setup lifecycle. */
@@ -15,6 +15,12 @@ export declare function acquireOAuth2JwtToken(definition: OAuth2Definition, inpu
15
15
  identity: OAuthJwtIdentity;
16
16
  scopes: string[];
17
17
  }, options?: OAuthRuntimeOptions): Promise<OAuthTokens>;
18
+ /** Resource-owner password grant, the owner's fields under the endpoint's own names. */
19
+ export declare function acquireOAuth2PasswordToken(definition: OAuth2Definition, input: {
20
+ owner: OAuthResourceOwner;
21
+ application?: OAuthApplication;
22
+ scopes?: string[];
23
+ }, options?: OAuthRuntimeOptions): Promise<OAuthTokens>;
18
24
  export declare function acquireOAuth2ClientToken(definition: OAuth2Definition, input: {
19
25
  application: OAuthApplication;
20
26
  scopes?: string[];
@@ -52,6 +52,7 @@ async function operate(definition, operation, application, parameters, options)
52
52
  refresh: "refresh_token",
53
53
  clientCredentials: "client_credentials",
54
54
  jwtBearer: "urn:ietf:params:oauth:grant-type:jwt-bearer",
55
+ password: "password",
55
56
  };
56
57
  const tokens = await requestOAuth2Token(configured, { ...parameters, grant_type: standard[operation] }, application, options);
57
58
  notifyObserver(options.onEvent, { ...event, outcome: "issued" });
@@ -149,6 +150,15 @@ export async function acquireOAuth2JwtToken(definition, input, options = {}) {
149
150
  }
150
151
  return operate(definition, "jwtBearer", undefined, { assertion }, { ...options, now: () => now });
151
152
  }
153
+ /** Resource-owner password grant, the owner's fields under the endpoint's own names. */
154
+ export async function acquireOAuth2PasswordToken(definition, input, options = {}) {
155
+ const names = definition.password?.fields ?? {};
156
+ return operate(definition, "password", input.application, {
157
+ [names.username ?? "username"]: required(input.owner.username),
158
+ [names.password ?? "password"]: required(input.owner.password),
159
+ ...(input.scopes?.length ? { scope: input.scopes.join(" ") } : {}),
160
+ }, options);
161
+ }
152
162
  export async function acquireOAuth2ClientToken(definition, input, options = {}) {
153
163
  return operate(definition, "clientCredentials", input.application, input.scopes?.length ? { scope: input.scopes.join(" ") } : {}, options);
154
164
  }
@@ -1,5 +1,6 @@
1
1
  import type { OAuth2TokenEndpoint, OAuthApplication, OAuthRuntimeOptions, OAuthTokens } from "./types.js";
2
2
  export declare function providerParameters(parameters?: Record<string, string>): Record<string, string>;
3
+ export declare function providerHeaders(headers?: Record<string, string>): Record<string, string>;
3
4
  export declare function oauthEndpoint(value: string): URL;
4
5
  /** Only normalized grant fields survive decoding; arbitrary response metadata is discarded. */
5
6
  export declare function decodeOAuthTokens(input: unknown, mapping?: OAuth2TokenEndpoint["response"], now?: number): OAuthTokens;
@@ -1,3 +1,4 @@
1
+ import { headerName } from "../credentials/policy.js";
1
2
  import { AuthError } from "./errors.js";
2
3
  const MAX_RESPONSE_BYTES = 1024 * 1024;
3
4
  const protectedParameters = new Set([
@@ -22,6 +23,15 @@ export function providerParameters(parameters = {}) {
22
23
  }
23
24
  return { ...parameters };
24
25
  }
26
+ /** Headers a token request owns; provider headers cannot replace them. */
27
+ const protocolHeaders = new Set(["authorization", "accept", "content-type"]);
28
+ export function providerHeaders(headers = {}) {
29
+ for (const [name, value] of Object.entries(headers)) {
30
+ if (protocolHeaders.has(headerName(name)) || typeof value !== "string")
31
+ throw new AuthError("invalid_definition");
32
+ }
33
+ return { ...headers };
34
+ }
25
35
  export function oauthEndpoint(value) {
26
36
  try {
27
37
  const url = new URL(value);
@@ -148,7 +158,10 @@ export async function requestOAuth2Token(endpoint, parameters, application, opti
148
158
  throw new AuthError("invalid_definition");
149
159
  fields.grant_type = endpoint.grantType;
150
160
  }
151
- const headers = { Accept: "application/json" };
161
+ const headers = {
162
+ ...providerHeaders(endpoint.headers),
163
+ Accept: "application/json",
164
+ };
152
165
  if (endpoint.clientAuthentication !== "none") {
153
166
  if (!application ||
154
167
  typeof application.clientId !== "string" ||
@@ -180,6 +193,11 @@ export async function requestOAuth2Token(endpoint, parameters, application, opti
180
193
  throw new AuthError("invalid_definition");
181
194
  }
182
195
  }
196
+ if (endpoint.refreshTokenBearer) {
197
+ if (headers.Authorization || !fields.refresh_token)
198
+ throw new AuthError("invalid_definition");
199
+ headers.Authorization = `Bearer ${fields.refresh_token}`;
200
+ }
183
201
  if (endpoint.encoding !== undefined &&
184
202
  endpoint.encoding !== "form" &&
185
203
  endpoint.encoding !== "json") {
@@ -14,6 +14,14 @@ export interface OAuth2Definition {
14
14
  refresh?: OAuth2TokenEndpoint;
15
15
  clientCredentials?: OAuth2TokenEndpoint;
16
16
  jwtBearer?: OAuth2TokenEndpoint;
17
+ /** Resource-owner password grant (RFC 6749 §4.3). */
18
+ password?: OAuth2TokenEndpoint & {
19
+ /** The provider's names for the owner's fields; `username` and `password` when absent. */
20
+ fields?: {
21
+ username?: string;
22
+ password?: string;
23
+ };
24
+ };
17
25
  }
18
26
  /** Each operation can use a different endpoint, encoding, and client authentication. */
19
27
  export interface OAuth2TokenEndpoint {
@@ -25,6 +33,14 @@ export interface OAuth2TokenEndpoint {
25
33
  grantType?: string | null;
26
34
  /** Provider-specific fields; cannot replace protocol-owned parameters. */
27
35
  parameters?: Record<string, string>;
36
+ /**
37
+ * Fixed provider headers (a mobile app's client version, a device id
38
+ * from public config); cannot claim Authorization, Accept or
39
+ * Content-Type.
40
+ */
41
+ headers?: Record<string, string>;
42
+ /** Also send the refresh token as the request's bearer, as some mobile APIs require. */
43
+ refreshTokenBearer?: boolean;
28
44
  response?: {
29
45
  /** Path to a token object inside a provider envelope. No expression evaluation. */
30
46
  path?: string[];
@@ -52,13 +68,18 @@ export interface OAuthTokens {
52
68
  /** Only fields explicitly selected by the definition's response mapping. */
53
69
  metadata?: Record<string, string>;
54
70
  }
71
+ /** Host-selected resource owner for a password grant. Never accepted from resource/action input. */
72
+ export interface OAuthResourceOwner {
73
+ username: string;
74
+ password: string;
75
+ }
55
76
  /** Host-selected signing identity. Never accepted from resource/action input. */
56
77
  export interface OAuthJwtIdentity {
57
78
  issuer: string;
58
79
  privateKey: string;
59
80
  subject?: string;
60
81
  }
61
- export type OAuthOperation = "exchange" | "refresh" | "clientCredentials" | "jwtBearer";
82
+ export type OAuthOperation = "exchange" | "refresh" | "clientCredentials" | "jwtBearer" | "password";
62
83
  /** Protocol events report issuance, never durability. They contain no credential data. */
63
84
  export interface OAuthEvent {
64
85
  definition: string;
@@ -1,5 +1,6 @@
1
1
  import type { RunlineConfig } from "../config/types.js";
2
2
  import type { ConnectionProvider } from "../connections/types.js";
3
+ import type { CredentialBroker, CredentialBrokerCall } from "../credentials/transport.js";
3
4
  import type { PluginRegistry } from "../plugin/registry.js";
4
5
  export interface ExecuteResult {
5
6
  result: unknown;
@@ -34,6 +35,12 @@ export interface ActionInvocation {
34
35
  export interface EngineHooks {
35
36
  /** Host-owned resolution and persistence. Defaults to process-local memory. */
36
37
  connectionProvider?: ConnectionProvider;
38
+ /**
39
+ * Host-signed requests: built per action call of a plugin that declares
40
+ * its credential, and handed to the action as `ctx.credentials`. Absent,
41
+ * plugins sign with their own connection.
42
+ */
43
+ credentialBroker?: (call: CredentialBrokerCall) => CredentialBroker;
37
44
  /**
38
45
  * Observer for every action invocation. Must not throw — but if it
39
46
  * does, the engine swallows it: observability never breaks a run.
@@ -363,6 +363,15 @@ export class ExecutionEngine {
363
363
  const ctx = {
364
364
  connection,
365
365
  context,
366
+ ...(this.hooks.credentialBroker && plugin.credential
367
+ ? {
368
+ credentials: this.hooks.credentialBroker({
369
+ plugin: plugin.name,
370
+ action: action.name,
371
+ context,
372
+ }),
373
+ }
374
+ : {}),
366
375
  log: {
367
376
  info: (msg) => console.log(`[${plugin.name}] ${msg}`),
368
377
  warn: (msg) => console.warn(`[${plugin.name}] ${msg}`),
@@ -1,5 +1,57 @@
1
- import type { CredentialTarget, HttpMethod } from "./types.js";
1
+ import type { CredentialAuthentication, CredentialMethod, CredentialTarget, HttpMethod, SecretPlacement } from "./types.js";
2
2
  export declare const HTTP_METHODS: readonly HttpMethod[];
3
+ /**
4
+ * Headers only the transport sets, whatever the method signs with: the
5
+ * credential in Authorization, and a COPY or MOVE Destination held to its
6
+ * target. No caller, allowed header or idempotency header may claim them.
7
+ */
8
+ export declare const TRANSPORT_HEADERS: readonly string[];
9
+ /** The most any target may declare, and any host may allow, per request. */
10
+ export declare const TARGET_TIMEOUT_LIMIT_MS: number;
11
+ export declare const TARGET_RESPONSE_LIMIT_BYTES: number;
12
+ /** A positive integer no larger than `limit`. */
13
+ export declare function bounded(value: unknown, limit: number): boolean;
3
14
  export declare function headerName(name: string): string;
15
+ /** A method's target by name, own properties only. */
16
+ export declare function targetOf(method: CredentialMethod, name: string): CredentialTarget | undefined;
4
17
  export declare function targetBase(target: CredentialTarget): URL;
18
+ /** The static placements that sign requests to `target`. */
19
+ export declare function placementsFor(auth: Extract<CredentialAuthentication, {
20
+ kind: "static";
21
+ }>, target: string): SecretPlacement[];
22
+ /** Headers a method's authentication sets on `target`, lowercased; callers never set them. */
23
+ export declare function injectedHeaders(auth: CredentialAuthentication, target: string): string[];
24
+ /**
25
+ * Query parameters a method's authentication sets on `target`, a body
26
+ * part's included (it reaches the query when a request has no body);
27
+ * callers never set them.
28
+ */
29
+ export declare function injectedParams(auth: CredentialAuthentication, target: string): string[];
30
+ /** Body fields a method's authentication sets on `target`; callers never set them. */
31
+ export declare function injectedFields(auth: CredentialAuthentication, target: string): string[];
32
+ /** JSON pointers a method's authentication fills on `target`; callers leave null at each. */
33
+ export declare function injectedPointers(auth: CredentialAuthentication, target: string): string[];
34
+ /**
35
+ * The container and key a JSON pointer names in a parsed JSON value, or
36
+ * undefined when any step does not resolve: a missing key, an array index
37
+ * out of range, or a scalar in the way.
38
+ */
39
+ export declare function pointerSlot(value: unknown, pointer: string): {
40
+ holder: Record<string, unknown>;
41
+ key: string;
42
+ } | undefined;
43
+ /** A request body the transport can add a field to, by its Content-Type. */
44
+ export declare function bodyFormat(headers: Headers): "json" | "form" | undefined;
45
+ /**
46
+ * The top-level field names of a JSON-object or form body. Anything else —
47
+ * no recognized Content-Type, malformed JSON, a JSON value that is not an
48
+ * object — cannot carry a body part and is refused.
49
+ */
50
+ export declare function bodyFields(headers: Headers, body: Uint8Array): string[];
51
+ /**
52
+ * Query parameters only the transport may set: common credential names,
53
+ * and the method's own placed query parameters. Compared
54
+ * case-insensitively, since providers differ in how they match names.
55
+ */
56
+ export declare function refuseCredentialParams(url: URL, declared: readonly string[]): void;
5
57
  export declare function resourceUrl(target: CredentialTarget, path: string): URL;
@@ -6,7 +6,28 @@ export const HTTP_METHODS = [
6
6
  "PUT",
7
7
  "PATCH",
8
8
  "DELETE",
9
+ "MKCOL",
10
+ "COPY",
11
+ "MOVE",
9
12
  ];
13
+ /**
14
+ * Headers only the transport sets, whatever the method signs with: the
15
+ * credential in Authorization, and a COPY or MOVE Destination held to its
16
+ * target. No caller, allowed header or idempotency header may claim them.
17
+ */
18
+ export const TRANSPORT_HEADERS = [
19
+ "authorization",
20
+ "destination",
21
+ ];
22
+ /** The most any target may declare, and any host may allow, per request. */
23
+ export const TARGET_TIMEOUT_LIMIT_MS = 60 * 60_000;
24
+ export const TARGET_RESPONSE_LIMIT_BYTES = 1024 * 1024 * 1024;
25
+ /** A positive integer no larger than `limit`. */
26
+ export function bounded(value, limit) {
27
+ return (Number.isSafeInteger(value) &&
28
+ value > 0 &&
29
+ value <= limit);
30
+ }
10
31
  export function headerName(name) {
11
32
  if (typeof name !== "string" || !/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/.test(name))
12
33
  throw new AuthError("invalid_definition");
@@ -29,10 +50,14 @@ export function headerName(name) {
29
50
  throw new AuthError("invalid_definition");
30
51
  return lower;
31
52
  }
53
+ /** A method's target by name, own properties only. */
54
+ export function targetOf(method, name) {
55
+ return Object.hasOwn(method.targets, name) ? method.targets[name] : undefined;
56
+ }
32
57
  export function targetBase(target) {
33
58
  try {
34
59
  const url = new URL(target.baseUrl);
35
- if (url.protocol !== "https:" ||
60
+ if (url.protocol !== (target.socket === true ? "wss:" : "https:") ||
36
61
  url.username ||
37
62
  url.password ||
38
63
  url.search ||
@@ -52,20 +77,135 @@ export function targetBase(target) {
52
77
  function controls(value) {
53
78
  return [...value].some((char) => char.charCodeAt(0) <= 32 || char.charCodeAt(0) === 127);
54
79
  }
55
- function safePath(path) {
80
+ function safePath(path, encodedSlashes = false) {
56
81
  // Reject ambiguous encodings and segments before URL normalization. Query values
57
82
  // are separate data; encoded URLs in query parameters are not destinations.
58
83
  if (/[\\\s]/.test(path) || controls(path))
59
84
  throw new Error();
60
85
  for (const segment of path.split("/")) {
61
86
  const decoded = decodeURIComponent(segment);
62
- if (decoded === "." ||
63
- decoded === ".." ||
64
- /[%/\\]/.test(decoded) ||
87
+ // An opted-in target's segment may hold encoded slashes, but no piece
88
+ // of it may be empty or a dot segment once decoded.
89
+ const pieces = encodedSlashes ? decoded.split("/") : [decoded];
90
+ if ((pieces.length > 1 && pieces.some((piece) => !piece)) ||
91
+ pieces.some((piece) => piece === "." || piece === "..") ||
92
+ (encodedSlashes ? /[%\\]/ : /[%/\\]/).test(decoded) ||
65
93
  [...decoded].some((char) => char.charCodeAt(0) < 32 || char.charCodeAt(0) === 127))
66
94
  throw new Error();
67
95
  }
68
96
  }
97
+ /** The static placements that sign requests to `target`. */
98
+ export function placementsFor(auth, target) {
99
+ return auth.placements.filter((placement) => !placement.targets || placement.targets.includes(target));
100
+ }
101
+ /** Headers a method's authentication sets on `target`, lowercased; callers never set them. */
102
+ export function injectedHeaders(auth, target) {
103
+ if (auth.kind === "none")
104
+ return [];
105
+ if (auth.kind === "oauth2")
106
+ return ["authorization"];
107
+ return placementsFor(auth, target).flatMap((placement) => placement.in === "header" ||
108
+ placement.in === "jwt" ||
109
+ placement.in === "querySignature"
110
+ ? [headerName(placement.name)]
111
+ : placement.in === "basic"
112
+ ? ["authorization"]
113
+ : []);
114
+ }
115
+ /**
116
+ * Query parameters a method's authentication sets on `target`, a body
117
+ * part's included (it reaches the query when a request has no body);
118
+ * callers never set them.
119
+ */
120
+ export function injectedParams(auth, target) {
121
+ if (auth.kind !== "static")
122
+ return [];
123
+ return placementsFor(auth, target).flatMap((placement) => placement.in === "query" || placement.in === "body" ? [placement.name] : []);
124
+ }
125
+ /** Body fields a method's authentication sets on `target`; callers never set them. */
126
+ export function injectedFields(auth, target) {
127
+ if (auth.kind !== "static")
128
+ return [];
129
+ return placementsFor(auth, target).flatMap((placement) => placement.in === "body" ? [placement.name] : []);
130
+ }
131
+ /** JSON pointers a method's authentication fills on `target`; callers leave null at each. */
132
+ export function injectedPointers(auth, target) {
133
+ if (auth.kind !== "static")
134
+ return [];
135
+ return placementsFor(auth, target).flatMap((placement) => placement.in === "jsonPointer" ? [placement.pointer] : []);
136
+ }
137
+ /**
138
+ * The container and key a JSON pointer names in a parsed JSON value, or
139
+ * undefined when any step does not resolve: a missing key, an array index
140
+ * out of range, or a scalar in the way.
141
+ */
142
+ export function pointerSlot(value, pointer) {
143
+ const steps = pointer.slice(1).split("/");
144
+ let current = value;
145
+ for (const [index, step] of steps.entries()) {
146
+ if (!current ||
147
+ typeof current !== "object" ||
148
+ (Array.isArray(current) &&
149
+ (!/^\d+$/.test(step) || Number(step) >= current.length)) ||
150
+ !Object.hasOwn(current, step))
151
+ return undefined;
152
+ const holder = current;
153
+ if (index === steps.length - 1)
154
+ return { holder, key: step };
155
+ current = holder[step];
156
+ }
157
+ return undefined;
158
+ }
159
+ /** A request body the transport can add a field to, by its Content-Type. */
160
+ export function bodyFormat(headers) {
161
+ const type = headers.get("content-type")?.split(";")[0].trim().toLowerCase();
162
+ return type === "application/json"
163
+ ? "json"
164
+ : type === "application/x-www-form-urlencoded"
165
+ ? "form"
166
+ : undefined;
167
+ }
168
+ /**
169
+ * The top-level field names of a JSON-object or form body. Anything else —
170
+ * no recognized Content-Type, malformed JSON, a JSON value that is not an
171
+ * object — cannot carry a body part and is refused.
172
+ */
173
+ export function bodyFields(headers, body) {
174
+ const text = Buffer.from(body).toString();
175
+ const format = bodyFormat(headers);
176
+ if (format === "form")
177
+ return [...new URLSearchParams(text).keys()];
178
+ if (format === "json") {
179
+ let value;
180
+ try {
181
+ value = JSON.parse(text);
182
+ }
183
+ catch {
184
+ throw new AuthError("request_not_allowed");
185
+ }
186
+ if (value && typeof value === "object" && !Array.isArray(value))
187
+ return Object.keys(value);
188
+ }
189
+ throw new AuthError("request_not_allowed");
190
+ }
191
+ /**
192
+ * Query parameters only the transport may set: common credential names,
193
+ * and the method's own placed query parameters. Compared
194
+ * case-insensitively, since providers differ in how they match names.
195
+ */
196
+ export function refuseCredentialParams(url, declared) {
197
+ const reserved = [
198
+ "access_token",
199
+ "refresh_token",
200
+ "client_secret",
201
+ "api_key",
202
+ "authorization",
203
+ ...declared.map((name) => name.toLowerCase()),
204
+ ];
205
+ for (const name of url.searchParams.keys())
206
+ if (reserved.includes(name.toLowerCase()))
207
+ throw new AuthError("request_not_allowed");
208
+ }
69
209
  export function resourceUrl(target, path) {
70
210
  const base = targetBase(target);
71
211
  try {
@@ -76,7 +216,7 @@ export function resourceUrl(target, path) {
76
216
  path.includes("\\") ||
77
217
  controls(path))
78
218
  throw new Error();
79
- safePath(path.split("?")[0]);
219
+ safePath(path.split("?")[0], target.encodedSlashes === true);
80
220
  const url = new URL(path, base);
81
221
  if (url.origin !== base.origin ||
82
222
  !url.pathname.startsWith(base.pathname) ||
@@ -9,6 +9,15 @@ export declare const OAuthTokensSchema: t.TObject<{
9
9
  tokenType: t.TOptional<t.TString>;
10
10
  metadata: t.TOptional<t.TRecord<"^.*$", t.TString>>;
11
11
  }>;
12
+ /**
13
+ * Stored shape of a static secret: exactly its named parts, each a string,
14
+ * the `optional` ones allowed to be absent. A Basic part may be empty (a
15
+ * key as the username with no password, or the reverse); the transport
16
+ * refuses an empty part anywhere else.
17
+ */
18
+ export declare function staticSecretSchema(parts: readonly string[], optional?: readonly string[]): t.TObject<{
19
+ [k: string]: t.TString;
20
+ }>;
12
21
  export declare const OAuthGrantSchema: t.TObject<{
13
22
  tokens: t.TObject<{
14
23
  accessToken: t.TOptional<t.TString>;