runline 0.34.0 → 0.36.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 (493) hide show
  1. package/dist/auth/errors.d.ts +3 -3
  2. package/dist/auth/errors.js +3 -3
  3. package/dist/core/engine.js +12 -8
  4. package/dist/credentials/aws-plugin.d.ts +79 -0
  5. package/dist/credentials/aws-plugin.js +179 -0
  6. package/dist/credentials/aws.d.ts +41 -0
  7. package/dist/credentials/aws.js +213 -0
  8. package/dist/credentials/broker.d.ts +11 -0
  9. package/dist/credentials/broker.js +222 -0
  10. package/dist/credentials/plugin.d.ts +255 -0
  11. package/dist/{plugins/_shared/credentials.js → credentials/plugin.js} +40 -12
  12. package/dist/credentials/policy.d.ts +11 -3
  13. package/dist/credentials/policy.js +22 -3
  14. package/dist/credentials/registry.d.ts +14 -0
  15. package/dist/credentials/registry.js +60 -2
  16. package/dist/credentials/sigv4.d.ts +47 -0
  17. package/dist/credentials/sigv4.js +145 -0
  18. package/dist/credentials/transport.d.ts +9 -0
  19. package/dist/credentials/transport.js +106 -26
  20. package/dist/credentials/types.d.ts +73 -4
  21. package/dist/index.d.ts +9 -2
  22. package/dist/index.js +6 -1
  23. package/dist/plugin/schema.d.ts +16 -4
  24. package/dist/plugin/schema.js +28 -5
  25. package/dist/plugin/types.d.ts +8 -0
  26. package/dist/plugins/_shared/base64.js +30 -0
  27. package/dist/plugins/_shared/googleAuth.js +65 -6
  28. package/dist/plugins/_shared/googleCredentials.js +41 -9
  29. package/dist/plugins/_shared/localFile.js +40 -0
  30. package/dist/plugins/_shared/mediaFile.js +16 -13
  31. package/dist/plugins/_shared/microsoftAuth.js +22 -9
  32. package/dist/plugins/_shared/microsoftCredentials.js +13 -9
  33. package/dist/plugins/_shared/shiftCloud.js +14 -19
  34. package/dist/plugins/_shared/shiftCredentials.js +1 -2
  35. package/dist/plugins/_shared/shiftUpload.js +14 -10
  36. package/dist/plugins/actionNetwork/src/credentials.js +1 -1
  37. package/dist/plugins/actionNetwork/src/index.js +1 -1
  38. package/dist/plugins/activeCampaign/src/credentials.js +1 -1
  39. package/dist/plugins/activeCampaign/src/index.js +1 -1
  40. package/dist/plugins/adalo/src/credentials.js +1 -1
  41. package/dist/plugins/adalo/src/index.js +1 -1
  42. package/dist/plugins/affinity/src/credentials.js +1 -1
  43. package/dist/plugins/affinity/src/index.js +1 -1
  44. package/dist/plugins/agentMail/src/credentials.js +35 -0
  45. package/dist/plugins/agentMail/src/drafts.js +137 -0
  46. package/dist/plugins/agentMail/src/inboxes.js +95 -0
  47. package/dist/plugins/agentMail/src/index.js +35 -0
  48. package/dist/plugins/agentMail/src/messages.js +154 -0
  49. package/dist/plugins/agentMail/src/schemas.js +156 -0
  50. package/dist/plugins/agentMail/src/shared.js +202 -0
  51. package/dist/plugins/agentMail/src/threads.js +75 -0
  52. package/dist/plugins/agileCrm/src/credentials.js +1 -1
  53. package/dist/plugins/agileCrm/src/index.js +1 -1
  54. package/dist/plugins/airtable/src/credentials.js +1 -1
  55. package/dist/plugins/airtable/src/index.js +1 -1
  56. package/dist/plugins/airtop/src/credentials.js +1 -1
  57. package/dist/plugins/airtop/src/index.js +1 -1
  58. package/dist/plugins/apiTemplateIo/src/credentials.js +1 -1
  59. package/dist/plugins/apiTemplateIo/src/index.js +1 -1
  60. package/dist/plugins/asana/src/credentials.js +1 -1
  61. package/dist/plugins/asana/src/index.js +1 -1
  62. package/dist/plugins/autopilot/src/credentials.js +1 -1
  63. package/dist/plugins/autopilot/src/index.js +1 -1
  64. package/dist/plugins/bambooHr/src/credentials.js +1 -1
  65. package/dist/plugins/bambooHr/src/index.js +1 -1
  66. package/dist/plugins/bannerbear/src/credentials.js +1 -1
  67. package/dist/plugins/bannerbear/src/index.js +1 -1
  68. package/dist/plugins/baserow/src/credentials.js +1 -1
  69. package/dist/plugins/baserow/src/index.js +1 -1
  70. package/dist/plugins/beeminder/src/credentials.js +1 -1
  71. package/dist/plugins/beeminder/src/index.js +1 -1
  72. package/dist/plugins/bitly/src/credentials.js +1 -1
  73. package/dist/plugins/bitly/src/index.js +1 -1
  74. package/dist/plugins/bitwarden/src/credentials.js +1 -1
  75. package/dist/plugins/bitwarden/src/index.js +1 -1
  76. package/dist/plugins/box/src/credentials.js +1 -1
  77. package/dist/plugins/box/src/index.js +1 -1
  78. package/dist/plugins/brandfetch/src/credentials.js +1 -1
  79. package/dist/plugins/brandfetch/src/index.js +1 -1
  80. package/dist/plugins/brevo/src/credentials.js +1 -1
  81. package/dist/plugins/brevo/src/index.js +1 -1
  82. package/dist/plugins/bubble/src/credentials.js +1 -1
  83. package/dist/plugins/bubble/src/index.js +1 -1
  84. package/dist/plugins/chargebee/src/credentials.js +1 -1
  85. package/dist/plugins/chargebee/src/index.js +1 -1
  86. package/dist/plugins/circleci/src/credentials.js +1 -1
  87. package/dist/plugins/circleci/src/index.js +1 -1
  88. package/dist/plugins/ciscoWebex/src/credentials.js +1 -1
  89. package/dist/plugins/ciscoWebex/src/index.js +1 -1
  90. package/dist/plugins/clearbit/src/credentials.js +1 -1
  91. package/dist/plugins/clearbit/src/index.js +1 -1
  92. package/dist/plugins/clickup/src/credentials.js +1 -1
  93. package/dist/plugins/clickup/src/index.js +1 -1
  94. package/dist/plugins/clockify/src/credentials.js +1 -1
  95. package/dist/plugins/clockify/src/index.js +1 -1
  96. package/dist/plugins/cloudflare/src/credentials.js +1 -1
  97. package/dist/plugins/cloudflare/src/index.js +1 -1
  98. package/dist/plugins/cockpit/src/credentials.js +1 -1
  99. package/dist/plugins/cockpit/src/index.js +1 -1
  100. package/dist/plugins/coda/src/credentials.js +1 -1
  101. package/dist/plugins/coda/src/index.js +1 -1
  102. package/dist/plugins/coingecko/src/credentials.js +1 -1
  103. package/dist/plugins/coingecko/src/index.js +1 -1
  104. package/dist/plugins/contentful/src/credentials.js +1 -1
  105. package/dist/plugins/contentful/src/index.js +1 -1
  106. package/dist/plugins/convertkit/src/credentials.js +1 -1
  107. package/dist/plugins/convertkit/src/index.js +1 -1
  108. package/dist/plugins/copper/src/credentials.js +1 -1
  109. package/dist/plugins/copper/src/index.js +1 -1
  110. package/dist/plugins/cortex/src/credentials.js +1 -1
  111. package/dist/plugins/cortex/src/index.js +1 -1
  112. package/dist/plugins/currents/src/credentials.js +1 -1
  113. package/dist/plugins/currents/src/index.js +1 -1
  114. package/dist/plugins/customerIo/src/credentials.js +1 -1
  115. package/dist/plugins/customerIo/src/index.js +1 -1
  116. package/dist/plugins/databricks/src/credentials.js +1 -1
  117. package/dist/plugins/databricks/src/index.js +1 -1
  118. package/dist/plugins/deepl/src/credentials.js +1 -1
  119. package/dist/plugins/deepl/src/index.js +1 -1
  120. package/dist/plugins/demio/src/credentials.js +1 -1
  121. package/dist/plugins/demio/src/index.js +1 -1
  122. package/dist/plugins/dhl/src/credentials.js +1 -1
  123. package/dist/plugins/dhl/src/index.js +1 -1
  124. package/dist/plugins/discord/src/credentials.js +1 -1
  125. package/dist/plugins/discord/src/index.js +1 -1
  126. package/dist/plugins/discourse/src/credentials.js +1 -1
  127. package/dist/plugins/discourse/src/index.js +1 -1
  128. package/dist/plugins/disqus/src/credentials.js +1 -1
  129. package/dist/plugins/disqus/src/index.js +1 -1
  130. package/dist/plugins/drift/src/credentials.js +1 -1
  131. package/dist/plugins/drift/src/index.js +1 -1
  132. package/dist/plugins/dropbox/src/credentials.js +1 -1
  133. package/dist/plugins/dropbox/src/index.js +1 -1
  134. package/dist/plugins/dropcontact/src/credentials.js +1 -1
  135. package/dist/plugins/dropcontact/src/index.js +1 -1
  136. package/dist/plugins/egoi/src/credentials.js +1 -1
  137. package/dist/plugins/egoi/src/index.js +1 -1
  138. package/dist/plugins/elasticsearch/src/credentials.js +1 -1
  139. package/dist/plugins/elasticsearch/src/index.js +1 -1
  140. package/dist/plugins/elevenlabs/src/credentials.js +1 -1
  141. package/dist/plugins/elevenlabs/src/shared.js +30 -46
  142. package/dist/plugins/elevenlabs/src/workflows.js +1 -1
  143. package/dist/plugins/emelia/src/credentials.js +1 -1
  144. package/dist/plugins/emelia/src/index.js +1 -1
  145. package/dist/plugins/erpnext/src/credentials.js +1 -1
  146. package/dist/plugins/erpnext/src/index.js +1 -1
  147. package/dist/plugins/facebookGraph/src/credentials.js +1 -1
  148. package/dist/plugins/facebookGraph/src/index.js +1 -2
  149. package/dist/plugins/fal/src/credentials.js +1 -1
  150. package/dist/plugins/fal/src/index.js +1 -1
  151. package/dist/plugins/fal/src/shared.js +1 -1
  152. package/dist/plugins/freshdesk/src/credentials.js +1 -1
  153. package/dist/plugins/freshdesk/src/index.js +1 -1
  154. package/dist/plugins/freshservice/src/credentials.js +1 -1
  155. package/dist/plugins/freshservice/src/index.js +1 -1
  156. package/dist/plugins/freshworksCrm/src/credentials.js +1 -1
  157. package/dist/plugins/freshworksCrm/src/index.js +1 -1
  158. package/dist/plugins/getresponse/src/credentials.js +1 -1
  159. package/dist/plugins/getresponse/src/index.js +1 -1
  160. package/dist/plugins/gett/src/credentials.js +1 -2
  161. package/dist/plugins/gett/src/index.js +1 -1
  162. package/dist/plugins/gett/src/login.js +1 -1
  163. package/dist/plugins/gett/src/session.js +1 -1
  164. package/dist/plugins/gett/src/shared.js +1 -2
  165. package/dist/plugins/ghost/src/credentials.js +1 -1
  166. package/dist/plugins/ghost/src/index.js +1 -1
  167. package/dist/plugins/github/src/credentials.js +1 -1
  168. package/dist/plugins/github/src/index.js +1 -1
  169. package/dist/plugins/gitlab/src/credentials.js +1 -1
  170. package/dist/plugins/gitlab/src/index.js +1 -1
  171. package/dist/plugins/gmail/src/index.js +23 -86
  172. package/dist/plugins/gong/src/credentials.js +1 -1
  173. package/dist/plugins/gong/src/index.js +1 -1
  174. package/dist/plugins/googleAppsScript/src/index.js +14 -2
  175. package/dist/plugins/googleCalendar/src/index.js +7 -40
  176. package/dist/plugins/googleContacts/src/index.js +3 -33
  177. package/dist/plugins/googleDocs/src/index.js +2 -33
  178. package/dist/plugins/googleDocs/src/shared.js +1 -1
  179. package/dist/plugins/googleDrive/src/index.js +20 -46
  180. package/dist/plugins/googleImage/src/credentials.js +1 -1
  181. package/dist/plugins/googleImage/src/index.js +2 -2
  182. package/dist/plugins/googleSheets/src/index.js +3 -35
  183. package/dist/plugins/googleSlides/src/index.js +3 -33
  184. package/dist/plugins/googleTasks/src/index.js +3 -33
  185. package/dist/plugins/gotify/src/credentials.js +1 -1
  186. package/dist/plugins/gotify/src/index.js +1 -1
  187. package/dist/plugins/gotowebinar/src/credentials.js +1 -1
  188. package/dist/plugins/gotowebinar/src/index.js +1 -1
  189. package/dist/plugins/grafana/src/credentials.js +1 -1
  190. package/dist/plugins/grafana/src/index.js +1 -1
  191. package/dist/plugins/graphql/src/credentials.js +1 -1
  192. package/dist/plugins/graphql/src/index.js +1 -1
  193. package/dist/plugins/grist/src/credentials.js +1 -1
  194. package/dist/plugins/grist/src/index.js +1 -1
  195. package/dist/plugins/halopsa/src/credentials.js +1 -2
  196. package/dist/plugins/halopsa/src/index.js +1 -1
  197. package/dist/plugins/harvest/src/credentials.js +1 -1
  198. package/dist/plugins/harvest/src/index.js +1 -1
  199. package/dist/plugins/helpscout/src/credentials.js +1 -1
  200. package/dist/plugins/helpscout/src/index.js +1 -1
  201. package/dist/plugins/highlevel/src/credentials.js +1 -1
  202. package/dist/plugins/highlevel/src/index.js +9 -3
  203. package/dist/plugins/homeAssistant/src/credentials.js +1 -1
  204. package/dist/plugins/homeAssistant/src/index.js +1 -1
  205. package/dist/plugins/hubspot/src/credentials.js +1 -1
  206. package/dist/plugins/hubspot/src/index.js +1 -1
  207. package/dist/plugins/humanticAi/src/credentials.js +1 -1
  208. package/dist/plugins/humanticAi/src/index.js +1 -1
  209. package/dist/plugins/hunter/src/credentials.js +1 -1
  210. package/dist/plugins/hunter/src/index.js +1 -1
  211. package/dist/plugins/intercom/src/credentials.js +1 -1
  212. package/dist/plugins/intercom/src/index.js +1 -1
  213. package/dist/plugins/iterable/src/credentials.js +1 -1
  214. package/dist/plugins/iterable/src/index.js +1 -1
  215. package/dist/plugins/jenkins/src/credentials.js +1 -1
  216. package/dist/plugins/jenkins/src/index.js +1 -1
  217. package/dist/plugins/jira/src/credentials.js +1 -1
  218. package/dist/plugins/jira/src/index.js +1 -1
  219. package/dist/plugins/keap/src/credentials.js +1 -1
  220. package/dist/plugins/keap/src/index.js +1 -1
  221. package/dist/plugins/kobotoolbox/src/credentials.js +1 -1
  222. package/dist/plugins/kobotoolbox/src/index.js +1 -1
  223. package/dist/plugins/lemlist/src/credentials.js +1 -1
  224. package/dist/plugins/lemlist/src/index.js +1 -1
  225. package/dist/plugins/linear/src/credentials.js +1 -1
  226. package/dist/plugins/linear/src/shared.js +1 -1
  227. package/dist/plugins/lingvanex/src/credentials.js +1 -1
  228. package/dist/plugins/lingvanex/src/index.js +1 -1
  229. package/dist/plugins/linkedin/src/credentials.js +1 -1
  230. package/dist/plugins/linkedin/src/index.js +1 -1
  231. package/dist/plugins/lonescale/src/credentials.js +1 -1
  232. package/dist/plugins/lonescale/src/index.js +1 -1
  233. package/dist/plugins/magento/src/credentials.js +1 -1
  234. package/dist/plugins/magento/src/index.js +1 -1
  235. package/dist/plugins/mailcheck/src/credentials.js +1 -1
  236. package/dist/plugins/mailcheck/src/index.js +1 -1
  237. package/dist/plugins/mailchimp/src/credentials.js +1 -1
  238. package/dist/plugins/mailchimp/src/index.js +1 -1
  239. package/dist/plugins/mailerlite/src/credentials.js +1 -1
  240. package/dist/plugins/mailerlite/src/index.js +1 -1
  241. package/dist/plugins/mailgun/src/credentials.js +1 -1
  242. package/dist/plugins/mailgun/src/index.js +1 -1
  243. package/dist/plugins/mailjet/src/credentials.js +1 -1
  244. package/dist/plugins/mailjet/src/index.js +1 -1
  245. package/dist/plugins/mandrill/src/credentials.js +1 -1
  246. package/dist/plugins/mandrill/src/index.js +1 -1
  247. package/dist/plugins/marketstack/src/credentials.js +1 -1
  248. package/dist/plugins/marketstack/src/index.js +1 -1
  249. package/dist/plugins/matrix/src/credentials.js +1 -1
  250. package/dist/plugins/matrix/src/index.js +1 -1
  251. package/dist/plugins/mattermost/src/credentials.js +1 -1
  252. package/dist/plugins/mattermost/src/index.js +1 -1
  253. package/dist/plugins/mautic/src/credentials.js +1 -1
  254. package/dist/plugins/mautic/src/index.js +1 -1
  255. package/dist/plugins/medium/src/credentials.js +1 -1
  256. package/dist/plugins/medium/src/index.js +1 -1
  257. package/dist/plugins/messagebird/src/credentials.js +1 -1
  258. package/dist/plugins/messagebird/src/index.js +1 -1
  259. package/dist/plugins/metabase/src/credentials.js +1 -1
  260. package/dist/plugins/metabase/src/index.js +1 -1
  261. package/dist/plugins/microsoftCalendar/src/index.js +2 -7
  262. package/dist/plugins/microsoftFiles/src/index.js +17 -9
  263. package/dist/plugins/microsoftMail/src/index.js +2 -7
  264. package/dist/plugins/misp/src/credentials.js +1 -1
  265. package/dist/plugins/misp/src/index.js +1 -1
  266. package/dist/plugins/mocean/src/credentials.js +1 -1
  267. package/dist/plugins/mocean/src/index.js +1 -1
  268. package/dist/plugins/monday/src/credentials.js +1 -1
  269. package/dist/plugins/monday/src/index.js +1 -1
  270. package/dist/plugins/monicaCrm/src/credentials.js +1 -1
  271. package/dist/plugins/monicaCrm/src/index.js +1 -1
  272. package/dist/plugins/msg91/src/credentials.js +1 -1
  273. package/dist/plugins/msg91/src/index.js +1 -1
  274. package/dist/plugins/nasa/src/credentials.js +1 -1
  275. package/dist/plugins/nasa/src/index.js +1 -1
  276. package/dist/plugins/netlify/src/credentials.js +1 -1
  277. package/dist/plugins/netlify/src/index.js +1 -1
  278. package/dist/plugins/netscalerAdc/src/credentials.js +1 -1
  279. package/dist/plugins/netscalerAdc/src/index.js +1 -1
  280. package/dist/plugins/nextcloud/src/credentials.js +1 -2
  281. package/dist/plugins/nextcloud/src/index.js +1 -1
  282. package/dist/plugins/nocodb/src/credentials.js +1 -1
  283. package/dist/plugins/nocodb/src/index.js +1 -1
  284. package/dist/plugins/notion/src/credentials.js +1 -1
  285. package/dist/plugins/notion/src/index.js +1 -1
  286. package/dist/plugins/npm/src/credentials.js +1 -1
  287. package/dist/plugins/npm/src/index.js +1 -1
  288. package/dist/plugins/odoo/src/credentials.js +1 -1
  289. package/dist/plugins/odoo/src/index.js +1 -2
  290. package/dist/plugins/okta/src/credentials.js +1 -1
  291. package/dist/plugins/okta/src/index.js +1 -2
  292. package/dist/plugins/oneSimpleApi/src/credentials.js +1 -1
  293. package/dist/plugins/oneSimpleApi/src/index.js +1 -1
  294. package/dist/plugins/onfleet/src/credentials.js +1 -1
  295. package/dist/plugins/onfleet/src/index.js +1 -1
  296. package/dist/plugins/openai/src/credentials.js +1 -1
  297. package/dist/plugins/openai/src/index.js +2 -2
  298. package/dist/plugins/openweathermap/src/credentials.js +1 -1
  299. package/dist/plugins/openweathermap/src/index.js +1 -1
  300. package/dist/plugins/oura/src/credentials.js +1 -1
  301. package/dist/plugins/oura/src/index.js +1 -1
  302. package/dist/plugins/paddle/src/credentials.js +1 -1
  303. package/dist/plugins/paddle/src/index.js +1 -1
  304. package/dist/plugins/pagerduty/src/credentials.js +1 -1
  305. package/dist/plugins/pagerduty/src/index.js +1 -1
  306. package/dist/plugins/parallel/src/credentials.js +1 -1
  307. package/dist/plugins/parallel/src/index.js +15 -1
  308. package/dist/plugins/paypal/src/credentials.js +1 -1
  309. package/dist/plugins/paypal/src/index.js +1 -1
  310. package/dist/plugins/peekalink/src/credentials.js +1 -1
  311. package/dist/plugins/peekalink/src/index.js +1 -1
  312. package/dist/plugins/phantombuster/src/credentials.js +1 -1
  313. package/dist/plugins/phantombuster/src/index.js +1 -1
  314. package/dist/plugins/philipsHue/src/credentials.js +1 -1
  315. package/dist/plugins/philipsHue/src/index.js +1 -1
  316. package/dist/plugins/pipedrive/src/credentials.js +1 -1
  317. package/dist/plugins/pipedrive/src/index.js +1 -1
  318. package/dist/plugins/plaud/src/shared.js +1 -2
  319. package/dist/plugins/plivo/src/credentials.js +1 -1
  320. package/dist/plugins/plivo/src/index.js +1 -1
  321. package/dist/plugins/posthog/src/credentials.js +1 -1
  322. package/dist/plugins/posthog/src/index.js +1 -1
  323. package/dist/plugins/profitwell/src/credentials.js +1 -1
  324. package/dist/plugins/profitwell/src/index.js +1 -1
  325. package/dist/plugins/pushbullet/src/credentials.js +1 -1
  326. package/dist/plugins/pushbullet/src/index.js +1 -1
  327. package/dist/plugins/pushcut/src/credentials.js +1 -1
  328. package/dist/plugins/pushcut/src/index.js +1 -1
  329. package/dist/plugins/pushover/src/credentials.js +1 -1
  330. package/dist/plugins/pushover/src/index.js +1 -1
  331. package/dist/plugins/quickbase/src/credentials.js +1 -1
  332. package/dist/plugins/quickbase/src/index.js +1 -1
  333. package/dist/plugins/quickbooks/src/credentials.js +1 -1
  334. package/dist/plugins/quickbooks/src/index.js +1 -1
  335. package/dist/plugins/raindrop/src/credentials.js +1 -1
  336. package/dist/plugins/raindrop/src/index.js +1 -1
  337. package/dist/plugins/recraft/src/credentials.js +1 -1
  338. package/dist/plugins/recraft/src/index.js +2 -2
  339. package/dist/plugins/reddit/src/credentials.js +1 -1
  340. package/dist/plugins/reddit/src/index.js +1 -1
  341. package/dist/plugins/replicate/src/credentials.js +1 -1
  342. package/dist/plugins/replicate/src/index.js +2 -2
  343. package/dist/plugins/rocketchat/src/credentials.js +1 -1
  344. package/dist/plugins/rocketchat/src/index.js +1 -1
  345. package/dist/plugins/rundeck/src/credentials.js +1 -1
  346. package/dist/plugins/rundeck/src/index.js +1 -1
  347. package/dist/plugins/salesforce/src/credentials.js +1 -2
  348. package/dist/plugins/salesforce/src/shared.js +1 -2
  349. package/dist/plugins/salesforce/src/sobjects.js +1 -1
  350. package/dist/plugins/salesmate/src/credentials.js +1 -1
  351. package/dist/plugins/salesmate/src/index.js +1 -1
  352. package/dist/plugins/securityScorecard/src/credentials.js +1 -1
  353. package/dist/plugins/securityScorecard/src/index.js +1 -1
  354. package/dist/plugins/segment/src/credentials.js +1 -1
  355. package/dist/plugins/segment/src/index.js +1 -1
  356. package/dist/plugins/sendgrid/src/credentials.js +1 -1
  357. package/dist/plugins/sendgrid/src/index.js +1 -2
  358. package/dist/plugins/sendy/src/credentials.js +1 -1
  359. package/dist/plugins/sendy/src/index.js +1 -1
  360. package/dist/plugins/sentry/src/credentials.js +1 -1
  361. package/dist/plugins/sentry/src/index.js +1 -1
  362. package/dist/plugins/servicenow/src/credentials.js +1 -1
  363. package/dist/plugins/servicenow/src/index.js +1 -1
  364. package/dist/plugins/shiftAtlas/src/graph.js +2 -1
  365. package/dist/plugins/shiftAtlas/src/shared.js +1 -1
  366. package/dist/plugins/shiftBwm/src/shared.js +2 -4
  367. package/dist/plugins/shiftCrm/src/access.js +2 -1
  368. package/dist/plugins/shiftCrm/src/accounts.js +2 -1
  369. package/dist/plugins/shiftCrm/src/imports.js +2 -1
  370. package/dist/plugins/shiftCrm/src/opportunities.js +2 -1
  371. package/dist/plugins/shiftCrm/src/people.js +2 -1
  372. package/dist/plugins/shiftCrm/src/records.js +2 -1
  373. package/dist/plugins/shiftCrm/src/shared.js +1 -1
  374. package/dist/plugins/shiftCrm/src/tasks.js +2 -1
  375. package/dist/plugins/shiftObjects/src/objects.js +3 -2
  376. package/dist/plugins/shiftOcr/src/index.js +10 -4
  377. package/dist/plugins/shiftPages/src/pages.js +2 -1
  378. package/dist/plugins/shiftPages/src/shared.js +3 -2
  379. package/dist/plugins/shiftTranscription/src/shared.js +1 -1
  380. package/dist/plugins/shiftTranscription/src/transcription.js +3 -2
  381. package/dist/plugins/shiftWork/src/issue-views.js +2 -1
  382. package/dist/plugins/shiftWork/src/issues.js +2 -1
  383. package/dist/plugins/shiftWork/src/projects.js +2 -1
  384. package/dist/plugins/shiftWork/src/shared.js +1 -1
  385. package/dist/plugins/shopify/src/credentials.js +1 -1
  386. package/dist/plugins/shopify/src/index.js +1 -1
  387. package/dist/plugins/signl4/src/credentials.js +1 -1
  388. package/dist/plugins/signl4/src/index.js +1 -1
  389. package/dist/plugins/slack/src/credentials.js +1 -1
  390. package/dist/plugins/slack/src/index.js +1 -1
  391. package/dist/plugins/sms77/src/credentials.js +1 -1
  392. package/dist/plugins/sms77/src/index.js +1 -1
  393. package/dist/plugins/splunk/src/credentials.js +1 -1
  394. package/dist/plugins/splunk/src/index.js +1 -1
  395. package/dist/plugins/spotify/src/credentials.js +1 -1
  396. package/dist/plugins/spotify/src/index.js +1 -1
  397. package/dist/plugins/stackby/src/credentials.js +1 -1
  398. package/dist/plugins/stackby/src/index.js +1 -1
  399. package/dist/plugins/steel/src/auth.js +1 -1
  400. package/dist/plugins/steel/src/browser.js +1 -1
  401. package/dist/plugins/steel/src/captchas.js +1 -1
  402. package/dist/plugins/steel/src/extensions.js +1 -1
  403. package/dist/plugins/steel/src/files.js +1 -1
  404. package/dist/plugins/steel/src/profiles.js +1 -1
  405. package/dist/plugins/steel/src/sessions.js +1 -1
  406. package/dist/plugins/steel/src/shared.js +1 -1
  407. package/dist/plugins/storyblok/src/credentials.js +1 -1
  408. package/dist/plugins/storyblok/src/index.js +1 -1
  409. package/dist/plugins/strapi/src/credentials.js +1 -1
  410. package/dist/plugins/strapi/src/index.js +1 -1
  411. package/dist/plugins/strava/src/credentials.js +1 -1
  412. package/dist/plugins/strava/src/index.js +1 -1
  413. package/dist/plugins/stripe/src/credentials.js +1 -1
  414. package/dist/plugins/stripe/src/index.js +1 -1
  415. package/dist/plugins/supabase/src/credentials.js +1 -1
  416. package/dist/plugins/supabase/src/index.js +1 -1
  417. package/dist/plugins/syncromsp/src/credentials.js +1 -1
  418. package/dist/plugins/syncromsp/src/index.js +1 -1
  419. package/dist/plugins/tapfiliate/src/credentials.js +1 -1
  420. package/dist/plugins/tapfiliate/src/index.js +1 -1
  421. package/dist/plugins/telegram/src/credentials.js +1 -1
  422. package/dist/plugins/telegram/src/index.js +1 -1
  423. package/dist/plugins/thehive/src/credentials.js +1 -1
  424. package/dist/plugins/thehive/src/index.js +1 -1
  425. package/dist/plugins/thehiveProject/src/credentials.js +1 -1
  426. package/dist/plugins/thehiveProject/src/index.js +1 -1
  427. package/dist/plugins/todoist/src/credentials.js +1 -1
  428. package/dist/plugins/todoist/src/index.js +1 -1
  429. package/dist/plugins/together/src/credentials.js +1 -1
  430. package/dist/plugins/together/src/index.js +2 -2
  431. package/dist/plugins/travisci/src/credentials.js +1 -1
  432. package/dist/plugins/travisci/src/index.js +1 -1
  433. package/dist/plugins/trello/src/credentials.js +1 -1
  434. package/dist/plugins/trello/src/index.js +1 -1
  435. package/dist/plugins/twake/src/credentials.js +1 -1
  436. package/dist/plugins/twake/src/index.js +1 -1
  437. package/dist/plugins/twilio/src/credentials.js +1 -1
  438. package/dist/plugins/twilio/src/index.js +1 -1
  439. package/dist/plugins/twist/src/credentials.js +1 -1
  440. package/dist/plugins/twist/src/index.js +1 -1
  441. package/dist/plugins/twitter/src/credentials.js +1 -1
  442. package/dist/plugins/twitter/src/index.js +1 -1
  443. package/dist/plugins/typesafe/src/credentials.js +1 -1
  444. package/dist/plugins/typesafe/src/shared.js +1 -1
  445. package/dist/plugins/unleashedSoftware/src/credentials.js +1 -1
  446. package/dist/plugins/unleashedSoftware/src/index.js +1 -1
  447. package/dist/plugins/uplead/src/credentials.js +1 -1
  448. package/dist/plugins/uplead/src/index.js +1 -1
  449. package/dist/plugins/uproc/src/credentials.js +1 -1
  450. package/dist/plugins/uproc/src/index.js +1 -1
  451. package/dist/plugins/uptimerobot/src/credentials.js +1 -1
  452. package/dist/plugins/uptimerobot/src/index.js +1 -1
  453. package/dist/plugins/urlscanio/src/credentials.js +1 -1
  454. package/dist/plugins/urlscanio/src/index.js +1 -1
  455. package/dist/plugins/vercel/src/credentials.js +1 -1
  456. package/dist/plugins/vercel/src/deployments.js +1 -1
  457. package/dist/plugins/vercel/src/env.js +1 -1
  458. package/dist/plugins/vercel/src/projects.js +1 -1
  459. package/dist/plugins/vercel/src/shared.js +1 -2
  460. package/dist/plugins/vero/src/credentials.js +1 -1
  461. package/dist/plugins/vero/src/index.js +1 -1
  462. package/dist/plugins/vonage/src/credentials.js +1 -1
  463. package/dist/plugins/vonage/src/index.js +1 -1
  464. package/dist/plugins/wekan/src/credentials.js +1 -1
  465. package/dist/plugins/wekan/src/index.js +1 -1
  466. package/dist/plugins/wolt/src/account.js +1 -1
  467. package/dist/plugins/wolt/src/credentials.js +1 -1
  468. package/dist/plugins/wolt/src/index.js +1 -1
  469. package/dist/plugins/wolt/src/shared.js +1 -2
  470. package/dist/plugins/woocommerce/src/credentials.js +1 -1
  471. package/dist/plugins/woocommerce/src/index.js +1 -1
  472. package/dist/plugins/wordpress/src/credentials.js +1 -1
  473. package/dist/plugins/wordpress/src/index.js +1 -1
  474. package/dist/plugins/xai/src/credentials.js +1 -1
  475. package/dist/plugins/xai/src/index.js +2 -2
  476. package/dist/plugins/xero/src/credentials.js +1 -1
  477. package/dist/plugins/xero/src/index.js +1 -1
  478. package/dist/plugins/yourls/src/credentials.js +1 -1
  479. package/dist/plugins/yourls/src/index.js +1 -1
  480. package/dist/plugins/zammad/src/credentials.js +1 -1
  481. package/dist/plugins/zammad/src/index.js +1 -1
  482. package/dist/plugins/zendesk/src/credentials.js +1 -1
  483. package/dist/plugins/zendesk/src/index.js +1 -1
  484. package/dist/plugins/zoho/src/credentials.js +1 -1
  485. package/dist/plugins/zoho/src/index.js +1 -1
  486. package/dist/plugins/zoom/src/credentials.js +1 -1
  487. package/dist/plugins/zoom/src/index.js +1 -1
  488. package/dist/plugins/zulip/src/credentials.js +1 -1
  489. package/dist/plugins/zulip/src/index.js +1 -1
  490. package/package.json +4 -2
  491. package/dist/plugins/_shared/credentialAdapter.js +0 -152
  492. package/dist/tests/helpers/engine-harness.d.ts +0 -1
  493. package/dist/tests/helpers/engine-harness.js +0 -236
@@ -0,0 +1,222 @@
1
+ import { createHash } from "node:crypto";
2
+ import { AuthError } from "../auth/errors.js";
3
+ import { CredentialRegistry } from "./registry.js";
4
+ import { CredentialTransport } from "./transport.js";
5
+ /**
6
+ * Where one action call's authenticated requests go: the host's broker
7
+ * when it supplies one — the credentials then live with the host, and no
8
+ * local signer is built — else this process signs with its own
9
+ * connection, from the plugin's declaration. Plugin-side: the host-side
10
+ * `credentialBroker` option is what supplies `ctx.credentials`.
11
+ */
12
+ export function brokerFor(ctx, declaration) {
13
+ if (ctx.credentials)
14
+ return ctx.credentials;
15
+ const { binding, transport } = localSigner(ctx, declaration);
16
+ return {
17
+ request: (input) => transport.request(binding, input),
18
+ probe: () => transport.probe(binding),
19
+ socketUrl: (input) => transport.socketUrl(binding, input),
20
+ };
21
+ }
22
+ /**
23
+ * Everything a stored token was issued under. A config whose selection
24
+ * hashes differently cannot use tokens issued for this one. A
25
+ * token of a declared grant was issued under the grant — its method,
26
+ * client and token endpoint (Microsoft's names the tenant) — not the
27
+ * plugin that asked, so every plugin of the grant hashes alike and shares
28
+ * it; any other token is the whole selection's, scopes and targets included.
29
+ */
30
+ function authorityOf(selection) {
31
+ const { type, method, application } = selection;
32
+ const auth = Object.hasOwn(type.methods, method)
33
+ ? type.methods[method].authentication
34
+ : undefined;
35
+ const issuedUnder = auth?.kind === "oauth2" && auth.grant !== undefined
36
+ ? {
37
+ grant: auth.grant,
38
+ method,
39
+ application,
40
+ endpoint: auth.definition.refresh,
41
+ }
42
+ : selection;
43
+ return createHash("sha256").update(JSON.stringify(issuedUnder)).digest("hex");
44
+ }
45
+ /**
46
+ * A stored secret's structured shape (a static secret's parts, or an AWS
47
+ * access key) from the flat fields and fixed values the declaration
48
+ * names, joined in order where a part concatenates them. Absent when a
49
+ * required part's field is missing, so the transport refuses it as
50
+ * invalid_credentials before any IO; a missing optional part is left out.
51
+ */
52
+ function staticSecret(current, sources, optional) {
53
+ if (!sources)
54
+ return undefined;
55
+ const secret = {};
56
+ for (const [key, source] of Object.entries(sources)) {
57
+ const joined = joinedPart(current, source);
58
+ if (joined !== undefined)
59
+ secret[key] = joined;
60
+ else if (!optional.includes(key))
61
+ return undefined;
62
+ }
63
+ return secret;
64
+ }
65
+ /**
66
+ * One part of a static secret: its field or fixed value, or the pieces it
67
+ * concatenates joined in order. Absent when any field it reads is missing
68
+ * or not a string.
69
+ */
70
+ function joinedPart(current, source) {
71
+ let joined = "";
72
+ for (const part of "concat" in source ? source.concat : [source]) {
73
+ const value = "value" in part ? part.value : current[part.field];
74
+ if (typeof value !== "string")
75
+ return undefined;
76
+ joined += value;
77
+ }
78
+ return joined;
79
+ }
80
+ /**
81
+ * How an issued credential is stored flat: an OAuth grant as its token
82
+ * fields, a role session as `awsSession`, each stamped with the authority
83
+ * (`expected`) it was issued under. Only those two are ever renewed and
84
+ * written back.
85
+ */
86
+ function writeBack(auth, expected) {
87
+ if (auth.kind === "awsSigV4" && auth.assumeRole) {
88
+ const { sessionField } = auth.assumeRole;
89
+ return (patch) => {
90
+ const session = patch[sessionField];
91
+ if (!session?.sessionToken)
92
+ throw new AuthError("invalid_credentials");
93
+ return { awsSession: { ...session, binding: expected } };
94
+ };
95
+ }
96
+ if (auth.kind !== "oauth2")
97
+ throw new AuthError("invalid_definition");
98
+ return (patch, current) => {
99
+ const grant = patch[auth.field];
100
+ if (!grant?.tokens.accessToken)
101
+ throw new AuthError("invalid_credentials");
102
+ return {
103
+ accessToken: grant.tokens.accessToken,
104
+ accessTokenExpiresAt: grant.tokens.expiresAt,
105
+ refreshToken: grant.tokens.refreshToken ?? current.refreshToken,
106
+ authTokenScope: grant.tokens.scope,
107
+ authTokenType: grant.tokens.tokenType,
108
+ authTokenRevision: grant.revision,
109
+ authTokenBinding: expected,
110
+ };
111
+ };
112
+ }
113
+ /**
114
+ * This process signing with its own connection. Flat CLI/env storage is a
115
+ * projection, not a second token cache or refresh engine.
116
+ */
117
+ function localSigner(ctx, declaration) {
118
+ const selection = declaration(ctx.connection.config);
119
+ const { type: definition, method } = selection;
120
+ if (!Object.hasOwn(definition.methods, method))
121
+ throw new AuthError("invalid_definition");
122
+ const auth = definition.methods[method].authentication;
123
+ const identity = { name: ctx.connection.name, plugin: ctx.connection.plugin };
124
+ const expected = authorityOf(selection);
125
+ const project = (current) => {
126
+ if (authorityOf(declaration(current)) !== expected)
127
+ throw new AuthError("binding_changed");
128
+ if (auth.kind === "none")
129
+ return {};
130
+ if (auth.kind === "static") {
131
+ const secret = staticSecret(current, selection.localSecret, auth.optionalParts ?? []);
132
+ return secret ? { [auth.field]: secret } : {};
133
+ }
134
+ if (auth.kind === "awsSigV4") {
135
+ const key = staticSecret(current, selection.localSecret, [
136
+ "sessionToken",
137
+ ]);
138
+ const cached = current.awsSession;
139
+ const sessionField = auth.assumeRole?.sessionField;
140
+ return {
141
+ ...(key ? { [auth.field]: key } : {}),
142
+ ...(sessionField && cached?.binding === expected
143
+ ? {
144
+ [sessionField]: {
145
+ accessKeyId: cached.accessKeyId,
146
+ secretAccessKey: cached.secretAccessKey,
147
+ sessionToken: cached.sessionToken,
148
+ expiresAt: cached.expiresAt,
149
+ revision: cached.revision,
150
+ },
151
+ }
152
+ : {}),
153
+ };
154
+ }
155
+ const compatible = current.authTokenBinding === undefined ||
156
+ current.authTokenBinding === expected;
157
+ const tokens = {
158
+ ...(compatible && current.accessToken !== undefined
159
+ ? { accessToken: current.accessToken }
160
+ : {}),
161
+ ...(current.refreshToken !== undefined
162
+ ? { refreshToken: current.refreshToken }
163
+ : {}),
164
+ ...(compatible && current.accessTokenExpiresAt !== undefined
165
+ ? { expiresAt: current.accessTokenExpiresAt }
166
+ : {}),
167
+ ...(compatible && current.authTokenScope !== undefined
168
+ ? { scope: current.authTokenScope }
169
+ : {}),
170
+ ...(compatible && current.authTokenType !== undefined
171
+ ? { tokenType: current.authTokenType }
172
+ : {}),
173
+ };
174
+ if (!Object.keys(tokens).length)
175
+ return {};
176
+ const revision = typeof current.authTokenRevision === "string" && compatible
177
+ ? current.authTokenRevision
178
+ : createHash("sha256").update(JSON.stringify(tokens)).digest("hex");
179
+ return { [auth.field]: { tokens, revision } };
180
+ };
181
+ const snapshot = () => ({
182
+ ...identity,
183
+ config: project(ctx.connection.config),
184
+ });
185
+ const binding = {
186
+ type: definition.id,
187
+ method,
188
+ identity,
189
+ application: selection.application,
190
+ ...(selection.jwtIdentity ? { jwtIdentity: selection.jwtIdentity } : {}),
191
+ ...(selection.resourceOwner
192
+ ? { resourceOwner: selection.resourceOwner }
193
+ : {}),
194
+ ...(selection.awsRole ? { awsRole: selection.awsRole } : {}),
195
+ connection: {
196
+ async read() {
197
+ return snapshot();
198
+ },
199
+ async update(change) {
200
+ const flatten = writeBack(auth, expected);
201
+ await ctx.updateConnection(async (current) => {
202
+ const projected = project(current);
203
+ const patch = typeof change === "function" ? await change(projected) : change;
204
+ return patch ? flatten(patch, current) : undefined;
205
+ });
206
+ return snapshot();
207
+ },
208
+ },
209
+ };
210
+ const registry = new CredentialRegistry();
211
+ registry.register(definition);
212
+ // The widest defaults the transport allows, so an undeclared slow call
213
+ // (image generation, exports) is bounded rather than cut short; targets
214
+ // that declare their own deadline or ceiling get it up to the host caps.
215
+ const transport = new CredentialTransport(registry, {
216
+ fetch: globalThis.fetch,
217
+ timeoutMs: 120_000,
218
+ maxRequestBytes: 64 * 1024 * 1024,
219
+ maxResponseBytes: 64 * 1024 * 1024,
220
+ });
221
+ return { binding, transport };
222
+ }
@@ -0,0 +1,255 @@
1
+ /**
2
+ * The plugin side of the credential broker, public to every plugin —
3
+ * bundled or custom: one declaration factory for static keys, one stored
4
+ * grant shape for OAuth methods, one way to turn public config into an
5
+ * HTTPS target, one request path.
6
+ */
7
+ import * as t from "typebox";
8
+ import type { ActionContext } from "../plugin/types.js";
9
+ import type { CredentialDeclaration, CredentialProbe, CredentialTarget, HttpMethod, LocalSecretPart, SecretPlacement } from "./types.js";
10
+ /**
11
+ * The stored shape of an OAuth method: one optional revisioned grant in the
12
+ * `grant` field, absent until the first issuance.
13
+ */
14
+ export declare const grantSchema: t.TObject<{
15
+ grant: t.TOptional<t.TObject<{
16
+ tokens: t.TObject<{
17
+ accessToken: t.TOptional<t.TString>;
18
+ refreshToken: t.TOptional<t.TString>;
19
+ expiresAt: t.TOptional<t.TInteger>;
20
+ scope: t.TOptional<t.TString>;
21
+ tokenType: t.TOptional<t.TString>;
22
+ metadata: t.TOptional<t.TRecord<"^.*$", t.TString>>;
23
+ }>;
24
+ revision: t.TString;
25
+ }>>;
26
+ }>;
27
+ /**
28
+ * A flat config field, a fixed value such as Freshdesk's "X" password, or
29
+ * the two joined in order, such as Zendesk's `{email}/token` username.
30
+ */
31
+ type LocalSource = string | {
32
+ value: string;
33
+ } | {
34
+ concat: LocalSecretPart[];
35
+ };
36
+ /**
37
+ * How the secret is placed: a shorthand for a common single-secret case,
38
+ * or the general form of named parts and their placements. The kind names
39
+ * the method, so a stored selection keeps its method name.
40
+ */
41
+ type StaticAuth = {
42
+ kind: "bearer";
43
+ } | {
44
+ kind: "apiKey";
45
+ header: string;
46
+ prefix?: string;
47
+ } | {
48
+ kind: "queryKey";
49
+ param: string;
50
+ } | {
51
+ kind: "basic";
52
+ } | {
53
+ kind: "static";
54
+ parts: string[];
55
+ optionalParts?: string[];
56
+ placements: SecretPlacement[];
57
+ };
58
+ export interface StaticCredentialSpec {
59
+ /** Credential type id; one per provider, shared by its plugins. */
60
+ id: string;
61
+ auth: StaticAuth;
62
+ /**
63
+ * Where a CLI connection keeps each part: `secret` for the single-secret
64
+ * shorthands, `username` and `password` for basic, and one entry per
65
+ * part for the general form.
66
+ */
67
+ local: Record<string, LocalSource>;
68
+ /** Fixed targets, or targets built from public config (hosts, account paths). */
69
+ targets: Record<string, CredentialTarget> | ((config: Readonly<Record<string, unknown>>) => Record<string, CredentialTarget>);
70
+ probe?: CredentialProbe;
71
+ /**
72
+ * The credential is optional: a connection signs when it holds the flat
73
+ * secret fields (the CLI) or says `authenticated: true` in its public
74
+ * config (a host that stores the credential), and otherwise sends its
75
+ * requests unsigned through a `none` method — held to the same targets,
76
+ * or to targets of its own where the provider serves unsigned requests
77
+ * elsewhere.
78
+ */
79
+ optional?: true | {
80
+ targets: Record<string, CredentialTarget>;
81
+ };
82
+ }
83
+ /**
84
+ * A static-key plugin's declaration. The secret lives in one structured
85
+ * `credential` field — `{ secret }`, `{ username, password }` for basic, or
86
+ * the general form's named parts — and the method is named for the auth
87
+ * kind, so every static declaration has the same shape. A host stores the
88
+ * structured field; the CLI's flat fields are named by `local`.
89
+ */
90
+ export declare function staticCredential(spec: StaticCredentialSpec): CredentialDeclaration;
91
+ /**
92
+ * An HTTPS base URL from public config, with `path` appended beneath it.
93
+ * Anything else — plain HTTP, embedded credentials, a query or fragment —
94
+ * is invalid_credentials: the connection cannot be signed as configured.
95
+ */
96
+ export declare function httpsBase(value: unknown, path: string): string;
97
+ /** One DNS label from public config, for `https://{label}.provider.com/` hosts. */
98
+ export declare function hostLabel(value: unknown): string;
99
+ /**
100
+ * One of a config field's documented values — a region, an environment,
101
+ * a hosting mode — or `fallback` when the field is absent. Anything else
102
+ * is invalid_credentials, never mapped to a default: a mistyped value
103
+ * would otherwise send the credential to another host.
104
+ */
105
+ export declare function configChoice<const C extends string>(value: unknown, choices: readonly C[], fallback: C): C;
106
+ /**
107
+ * A boolean config field, as a boolean or the string a CLI or environment
108
+ * variable gives (`"true"`, `"false"`); false when absent. Anything else
109
+ * is invalid_credentials, as for `configChoice`: a mistyped sandbox or
110
+ * SSL flag must not read as false and reach the live host.
111
+ */
112
+ export declare function configFlag(value: unknown): boolean;
113
+ /**
114
+ * An ID or name as exactly one path segment, the one encoder every plugin
115
+ * uses. A value that is not one segment is refused rather than encoded: an
116
+ * empty value would address the parent collection (`items/`), a dot segment
117
+ * a sibling, and a separator more than one segment.
118
+ */
119
+ export declare function pathSegment(value: unknown): string;
120
+ /**
121
+ * A slash-separated name the API addresses as a sub-path — a model's
122
+ * `owner/name`, a file path, a nested job — each segment by `pathSegment`,
123
+ * its slashes kept.
124
+ */
125
+ export declare function pathSegments(value: unknown): string;
126
+ /**
127
+ * A slashed name as exactly one segment, its slashes encoded
128
+ * (`@scope/pkg` → `%40scope%2Fpkg`), for a target that declares
129
+ * `encodedSlashes`. An empty or dot piece, or a backslash, is refused.
130
+ */
131
+ export declare function slashEncodedSegment(value: unknown): string;
132
+ export interface CredentialCall {
133
+ target: string;
134
+ /** Relative to the target's base URL; may carry its own query. */
135
+ path: string;
136
+ method?: HttpMethod;
137
+ /** Appended to the path's query. Arrays repeat the key; null and undefined are skipped. */
138
+ query?: Record<string, unknown>;
139
+ /** Serialized as the JSON body, with a JSON Content-Type. */
140
+ json?: unknown;
141
+ /** Serialized as a form body, by the query's rules, with a form Content-Type. */
142
+ form?: Record<string, unknown>;
143
+ body?: string | Uint8Array;
144
+ headers?: Record<string, string>;
145
+ /** COPY and MOVE: the destination path beneath the same target. */
146
+ destination?: string;
147
+ /**
148
+ * The provider's deduplication key, for a target that declares
149
+ * `idempotency`: the transport sets the declared header itself and
150
+ * refuses the request on any other target or method.
151
+ */
152
+ idempotencyKey?: string;
153
+ }
154
+ /** The one authenticated request path: the host's broker, else the local signer. */
155
+ export declare function credentialRequest(ctx: ActionContext, declaration: CredentialDeclaration, call: CredentialCall): Promise<Response>;
156
+ /**
157
+ * A step that writes a grant into the connection — an owner login run
158
+ * against the provider — happens only where the grant lives: this process,
159
+ * signing with its own connection. Under a host that keeps the grant, setup
160
+ * is the host's, and the step refuses before any request.
161
+ */
162
+ export declare function refuseUnderHost(ctx: ActionContext): void;
163
+ /**
164
+ * A socket target's URL for this connection, from the broker: signed by
165
+ * the local signer, or a relay the host controls. A broker that serves no
166
+ * sockets refuses as unsupported_operation.
167
+ */
168
+ export declare function credentialSocketUrl(ctx: ActionContext, declaration: CredentialDeclaration, call: {
169
+ target: string;
170
+ path: string;
171
+ query?: Record<string, unknown>;
172
+ }): Promise<string>;
173
+ /**
174
+ * A provider error identifier worth handing back — an error code, a field
175
+ * path — as a plain name. Anything else is not a name and is dropped, so
176
+ * the code and field slots of a failure never carry free text.
177
+ */
178
+ export declare function errorIdentifier(value: unknown): string | undefined;
179
+ /**
180
+ * How a failed request reads: its HTTP status when the status is the
181
+ * failure, and the identifiers a provider returns for correcting the call
182
+ * — its error `code` and the offending `param`. No free text from a failed
183
+ * response reaches it: that is where a provider may echo the credential.
184
+ */
185
+ export declare function failureMessage(plugin: string, status: number | undefined, detail?: {
186
+ code?: string;
187
+ param?: string;
188
+ }): string;
189
+ /**
190
+ * A successful response whose answer reports failure — Slack's `ok: false`,
191
+ * an OCS status, a GraphQL `errors` entry — by the provider's code, the
192
+ * field at fault and its message. The answer is 2xx data the plugin
193
+ * already holds, so the message stays for the caller to act on, reduced
194
+ * to one line of at most 300 characters.
195
+ */
196
+ export declare function answerFailed(plugin: string, detail: {
197
+ code?: unknown;
198
+ param?: unknown;
199
+ message?: unknown;
200
+ }): Error;
201
+ /** A GraphQL answer's `errors`, read by `answerFailed` from the first entry. */
202
+ export declare function graphqlFailed(plugin: string, errors: unknown): Error;
203
+ /** A failed request, reported by status alone. */
204
+ export declare function requestFailed(plugin: string, status: number): Error;
205
+ /** What a provider's error envelope names, before it is reduced to identifiers. */
206
+ export interface ErrorEnvelope {
207
+ code?: unknown;
208
+ /** One field path, or several (joined in order). */
209
+ param?: unknown;
210
+ }
211
+ /**
212
+ * A failed response by its status and the identifiers its error envelope
213
+ * names. `read` picks the code and param out of the parsed JSON body, in
214
+ * the provider's own shape; only what `errorIdentifier` accepts is kept,
215
+ * so a provider's messages never reach the error. A body that is not JSON
216
+ * reports the status alone. The status rides on the error for callers
217
+ * that branch on it.
218
+ */
219
+ export declare function responseFailed(plugin: string, response: Response, read: (body: unknown) => ErrorEnvelope): Promise<Error & {
220
+ status: number;
221
+ }>;
222
+ /** A request that must succeed, for callers that read the Response itself (headers, text, bytes). */
223
+ export declare function credentialOk(ctx: ActionContext, declaration: CredentialDeclaration, plugin: string, call: CredentialCall): Promise<Response>;
224
+ /** What a JSON request answers for an empty (or 204) response. */
225
+ export type EmptyAnswer = {
226
+ success: true;
227
+ };
228
+ /**
229
+ * A successful response's JSON. `T` is the caller's statement of the
230
+ * answer's shape, unchecked, as for any parsed JSON; without one it is
231
+ * `unknown`. An empty answer is `EmptyAnswer`, so a caller whose endpoint
232
+ * can answer empty includes it in `T`. Every JSON request path reads its
233
+ * answer here, so they cannot disagree about empty or malformed bodies.
234
+ */
235
+ export declare function jsonAnswer<T = unknown>(response: Response): Promise<T>;
236
+ /**
237
+ * A successful response's JSON when its Content-Type says JSON; any other
238
+ * body — a text "OK", nothing at all — is an acknowledgement,
239
+ * `EmptyAnswer`. For APIs whose writes answer without JSON.
240
+ */
241
+ export declare function jsonOrAcknowledged<T = unknown>(response: Response): Promise<T | EmptyAnswer>;
242
+ /** A JSON request that must succeed; its answer is read by `jsonAnswer`. */
243
+ export declare function credentialJson<T = unknown>(ctx: ActionContext, declaration: CredentialDeclaration, plugin: string, call: CredentialCall): Promise<T>;
244
+ /**
245
+ * A next-page URL the API returned, as a path beneath the declared target
246
+ * it will be signed for. Anything outside that target's exact origin and
247
+ * path prefix is refused rather than followed with the credential attached.
248
+ */
249
+ export declare function pathWithin(ctx: ActionContext, declaration: CredentialDeclaration, target: string, value: string): string;
250
+ /** FormData as the buffered bytes the transport accepts, with its boundary. */
251
+ export declare function multipartBody(form: FormData): Promise<{
252
+ body: Uint8Array<ArrayBuffer>;
253
+ contentType: string;
254
+ }>;
255
+ export {};
@@ -1,12 +1,13 @@
1
- import { AuthError, OAuthGrantSchema, staticSecretSchema, } from "runline";
2
- import * as t from "typebox";
3
- import { credentialBroker } from "./credentialAdapter.js";
4
1
  /**
5
- * The plugin side of the credential broker, shared by every plugin: one
6
- * declaration factory for static keys, one stored grant shape for OAuth
7
- * methods, one way to turn public config into an HTTPS target, one
8
- * request path.
2
+ * The plugin side of the credential broker, public to every plugin —
3
+ * bundled or custom: one declaration factory for static keys, one stored
4
+ * grant shape for OAuth methods, one way to turn public config into an
5
+ * HTTPS target, one request path.
9
6
  */
7
+ import * as t from "typebox";
8
+ import { AuthError } from "../auth/errors.js";
9
+ import { brokerFor } from "./broker.js";
10
+ import { OAuthGrantSchema, staticSecretSchema } from "./registry.js";
10
11
  /**
11
12
  * The stored shape of an OAuth method: one optional revisioned grant in the
12
13
  * `grant` field, absent until the first issuance.
@@ -213,7 +214,7 @@ export function credentialRequest(ctx, declaration, call) {
213
214
  }
214
215
  : undefined;
215
216
  const payload = body?.body ?? call.body;
216
- return credentialBroker(ctx, declaration).request({
217
+ return brokerFor(ctx, declaration).request({
217
218
  target: call.target,
218
219
  path: withQuery(call.path, call.query),
219
220
  method: call.method ?? "GET",
@@ -226,6 +227,9 @@ export function credentialRequest(ctx, declaration, call) {
226
227
  ...(call.destination !== undefined
227
228
  ? { destination: call.destination }
228
229
  : {}),
230
+ ...(call.idempotencyKey !== undefined
231
+ ? { idempotencyKey: call.idempotencyKey }
232
+ : {}),
229
233
  });
230
234
  }
231
235
  /**
@@ -244,7 +248,7 @@ export function refuseUnderHost(ctx) {
244
248
  * sockets refuses as unsupported_operation.
245
249
  */
246
250
  export async function credentialSocketUrl(ctx, declaration, call) {
247
- const broker = credentialBroker(ctx, declaration);
251
+ const broker = brokerFor(ctx, declaration);
248
252
  if (!broker.socketUrl)
249
253
  throw new AuthError("unsupported_operation");
250
254
  return broker.socketUrl({
@@ -265,8 +269,8 @@ export function errorIdentifier(value) {
265
269
  /**
266
270
  * How a failed request reads: its HTTP status when the status is the
267
271
  * failure, and the identifiers a provider returns for correcting the call
268
- * — its error `code` and the offending `param`. A failed response's body
269
- * is never read into it: that is where a provider may echo the credential.
272
+ * — its error `code` and the offending `param`. No free text from a failed
273
+ * response reaches it: that is where a provider may echo the credential.
270
274
  */
271
275
  export function failureMessage(plugin, status, detail = {}) {
272
276
  const identifiers = [detail.code, detail.param && `param: ${detail.param}`]
@@ -294,7 +298,7 @@ export function answerFailed(plugin, detail) {
294
298
  param: identifierOf(detail.param),
295
299
  });
296
300
  const text = typeof detail.message === "string"
297
- ? detail.message.replace(/[\u0000-\u001f\u007f\s]+/g, " ").trim()
301
+ ? detail.message.replace(/[\p{Cc}\s]+/gu, " ").trim()
298
302
  : "";
299
303
  const line = text.length > 300 ? `${text.slice(0, 300)}…` : text;
300
304
  return new Error(line ? `${head}: ${line}` : head);
@@ -312,6 +316,30 @@ export function graphqlFailed(plugin, errors) {
312
316
  export function requestFailed(plugin, status) {
313
317
  return new Error(failureMessage(plugin, status));
314
318
  }
319
+ /**
320
+ * A failed response by its status and the identifiers its error envelope
321
+ * names. `read` picks the code and param out of the parsed JSON body, in
322
+ * the provider's own shape; only what `errorIdentifier` accepts is kept,
323
+ * so a provider's messages never reach the error. A body that is not JSON
324
+ * reports the status alone. The status rides on the error for callers
325
+ * that branch on it.
326
+ */
327
+ export async function responseFailed(plugin, response, read) {
328
+ let envelope = {};
329
+ try {
330
+ envelope = read(JSON.parse(await response.text()));
331
+ }
332
+ catch {
333
+ envelope = {};
334
+ }
335
+ const params = (Array.isArray(envelope.param) ? envelope.param : [envelope.param])
336
+ .map(identifierOf)
337
+ .filter((param) => param !== undefined);
338
+ return Object.assign(new Error(failureMessage(plugin, response.status, {
339
+ code: identifierOf(envelope.code),
340
+ param: params.length ? params.join(", ") : undefined,
341
+ })), { status: response.status });
342
+ }
315
343
  /** A request that must succeed, for callers that read the Response itself (headers, text, bytes). */
316
344
  export async function credentialOk(ctx, declaration, plugin, call) {
317
345
  const response = await credentialRequest(ctx, declaration, call);
@@ -9,6 +9,12 @@ export declare const TRANSPORT_HEADERS: readonly string[];
9
9
  /** The most any target may declare, and any host may allow, per request. */
10
10
  export declare const TARGET_TIMEOUT_LIMIT_MS: number;
11
11
  export declare const TARGET_RESPONSE_LIMIT_BYTES: number;
12
+ /**
13
+ * A secret sent exactly as it is (a token in a header, a key in a query,
14
+ * a signature's credential): printable ASCII with no whitespace. Anything
15
+ * else is refused as invalid_credentials before it reaches a request.
16
+ */
17
+ export declare function secret(value: unknown): string;
12
18
  /** A positive integer no larger than `limit`. */
13
19
  export declare function bounded(value: unknown, limit: number): boolean;
14
20
  export declare function headerName(name: string): string;
@@ -22,9 +28,11 @@ export declare function placementsFor(auth: Extract<CredentialAuthentication, {
22
28
  /** Headers a method's authentication sets on `target`, lowercased; callers never set them. */
23
29
  export declare function injectedHeaders(auth: CredentialAuthentication, target: string): string[];
24
30
  /**
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.
31
+ * Query parameters a method's authentication owns on `target`, so callers
32
+ * never set them: the parameters a static method places, a body part's
33
+ * included (it reaches the query when a request has no body), and for
34
+ * SigV4 those of a presigned URL, which a header-signed request never
35
+ * carries.
28
36
  */
29
37
  export declare function injectedParams(auth: CredentialAuthentication, target: string): string[];
30
38
  /** Body fields a method's authentication sets on `target`; callers never set them. */
@@ -1,4 +1,5 @@
1
1
  import { AuthError } from "../auth/errors.js";
2
+ import { SIGV4_HEADERS, SIGV4_QUERY_PARAMETERS } from "./sigv4.js";
2
3
  export const HTTP_METHODS = [
3
4
  "GET",
4
5
  "HEAD",
@@ -22,6 +23,18 @@ export const TRANSPORT_HEADERS = [
22
23
  /** The most any target may declare, and any host may allow, per request. */
23
24
  export const TARGET_TIMEOUT_LIMIT_MS = 60 * 60_000;
24
25
  export const TARGET_RESPONSE_LIMIT_BYTES = 1024 * 1024 * 1024;
26
+ /**
27
+ * A secret sent exactly as it is (a token in a header, a key in a query,
28
+ * a signature's credential): printable ASCII with no whitespace. Anything
29
+ * else is refused as invalid_credentials before it reaches a request.
30
+ */
31
+ export function secret(value) {
32
+ if (typeof value !== "string" ||
33
+ !value ||
34
+ [...value].some((char) => char.charCodeAt(0) <= 32 || char.charCodeAt(0) > 126))
35
+ throw new AuthError("invalid_credentials");
36
+ return value;
37
+ }
25
38
  /** A positive integer no larger than `limit`. */
26
39
  export function bounded(value, limit) {
27
40
  return (Number.isSafeInteger(value) &&
@@ -104,6 +117,8 @@ export function injectedHeaders(auth, target) {
104
117
  return [];
105
118
  if (auth.kind === "oauth2")
106
119
  return ["authorization"];
120
+ if (auth.kind === "awsSigV4")
121
+ return [...SIGV4_HEADERS];
107
122
  return placementsFor(auth, target).flatMap((placement) => placement.in === "header" ||
108
123
  placement.in === "jwt" ||
109
124
  placement.in === "querySignature"
@@ -113,11 +128,15 @@ export function injectedHeaders(auth, target) {
113
128
  : []);
114
129
  }
115
130
  /**
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.
131
+ * Query parameters a method's authentication owns on `target`, so callers
132
+ * never set them: the parameters a static method places, a body part's
133
+ * included (it reaches the query when a request has no body), and for
134
+ * SigV4 those of a presigned URL, which a header-signed request never
135
+ * carries.
119
136
  */
120
137
  export function injectedParams(auth, target) {
138
+ if (auth.kind === "awsSigV4")
139
+ return [...SIGV4_QUERY_PARAMETERS];
121
140
  if (auth.kind !== "static")
122
141
  return [];
123
142
  return placementsFor(auth, target).flatMap((placement) => placement.in === "query" || placement.in === "body" ? [placement.name] : []);
@@ -29,6 +29,20 @@ export declare const OAuthGrantSchema: t.TObject<{
29
29
  }>;
30
30
  revision: t.TString;
31
31
  }>;
32
+ /** Stored shape of an AWS access key; a session's carries its token. */
33
+ export declare const AwsAccessKeySchema: t.TObject<{
34
+ accessKeyId: t.TString;
35
+ secretAccessKey: t.TString;
36
+ sessionToken: t.TOptional<t.TString>;
37
+ }>;
38
+ /** Stored shape of an assumed role's session. */
39
+ export declare const AwsSessionSchema: t.TObject<{
40
+ accessKeyId: t.TString;
41
+ secretAccessKey: t.TString;
42
+ sessionToken: t.TString;
43
+ expiresAt: t.TInteger;
44
+ revision: t.TString;
45
+ }>;
32
46
  /** No implicit defaults, provider inference, executable expressions, or replacement. */
33
47
  export declare class CredentialRegistry {
34
48
  private readonly types;