n8n-nodes-base 0.233.0 → 0.234.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (262) hide show
  1. package/dist/build.tsbuildinfo +1 -1
  2. package/dist/credentials/{SendInBlueApi.credentials.d.ts → BrevoApi.credentials.d.ts} +1 -1
  3. package/dist/credentials/{SendInBlueApi.credentials.js → BrevoApi.credentials.js} +7 -7
  4. package/dist/credentials/BrevoApi.credentials.js.map +1 -0
  5. package/dist/credentials/CrowdDevApi.credentials.d.ts +9 -0
  6. package/dist/credentials/CrowdDevApi.credentials.js +62 -0
  7. package/dist/credentials/CrowdDevApi.credentials.js.map +1 -0
  8. package/dist/credentials/HttpCustomAuth.credentials.d.ts +9 -0
  9. package/dist/credentials/HttpCustomAuth.credentials.js +25 -0
  10. package/dist/credentials/HttpCustomAuth.credentials.js.map +1 -0
  11. package/dist/credentials/TwitterOAuth1Api.credentials.js +6 -0
  12. package/dist/credentials/TwitterOAuth1Api.credentials.js.map +1 -1
  13. package/dist/credentials/TwitterOAuth2Api.credentials.d.ts +8 -0
  14. package/dist/credentials/TwitterOAuth2Api.credentials.js +73 -0
  15. package/dist/credentials/TwitterOAuth2Api.credentials.js.map +1 -0
  16. package/dist/known/credentials.json +289 -12
  17. package/dist/known/nodes.json +16 -8
  18. package/dist/nodes/{SendInBlue → Brevo}/AttributeDescription.js +1 -1
  19. package/dist/nodes/Brevo/AttributeDescription.js.map +1 -0
  20. package/dist/nodes/{SendInBlue/SendInBlue.node.d.ts → Brevo/Brevo.node.d.ts} +1 -1
  21. package/dist/nodes/{SendInBlue/SendInBlue.node.js → Brevo/Brevo.node.js} +9 -9
  22. package/dist/nodes/Brevo/Brevo.node.js.map +1 -0
  23. package/dist/nodes/{SendInBlue/SendInBlue.node.json → Brevo/Brevo.node.json} +5 -4
  24. package/dist/nodes/{SendInBlue/SendInBlueTrigger.node.d.ts → Brevo/BrevoTrigger.node.d.ts} +1 -1
  25. package/dist/nodes/{SendInBlue/SendInBlueTrigger.node.js → Brevo/BrevoTrigger.node.js} +11 -11
  26. package/dist/nodes/Brevo/BrevoTrigger.node.js.map +1 -0
  27. package/dist/nodes/{SendInBlue/SendInBlueTrigger.node.json → Brevo/BrevoTrigger.node.json} +5 -4
  28. package/dist/nodes/Brevo/ContactDescription.js.map +1 -0
  29. package/dist/nodes/{SendInBlue → Brevo}/EmailDescription.js +10 -10
  30. package/dist/nodes/Brevo/EmailDescription.js.map +1 -0
  31. package/dist/nodes/{SendInBlue → Brevo}/GenericFunctions.d.ts +2 -2
  32. package/dist/nodes/{SendInBlue → Brevo}/GenericFunctions.js +14 -14
  33. package/dist/nodes/Brevo/GenericFunctions.js.map +1 -0
  34. package/dist/nodes/Brevo/SenderDescrition.js.map +1 -0
  35. package/dist/nodes/Brevo/brevo.svg +4 -0
  36. package/dist/nodes/CrowdDev/CrowdDev.node.d.ts +4 -0
  37. package/dist/nodes/CrowdDev/CrowdDev.node.js +36 -0
  38. package/dist/nodes/CrowdDev/CrowdDev.node.js.map +1 -0
  39. package/dist/nodes/CrowdDev/CrowdDev.node.json +18 -0
  40. package/dist/nodes/CrowdDev/CrowdDevTrigger.node.d.ts +12 -0
  41. package/dist/nodes/CrowdDev/CrowdDevTrigger.node.js +145 -0
  42. package/dist/nodes/CrowdDev/CrowdDevTrigger.node.js.map +1 -0
  43. package/dist/nodes/CrowdDev/CrowdDevTrigger.node.json +18 -0
  44. package/dist/nodes/CrowdDev/GenericFunctions.d.ts +7 -0
  45. package/dist/nodes/CrowdDev/GenericFunctions.js +157 -0
  46. package/dist/nodes/CrowdDev/GenericFunctions.js.map +1 -0
  47. package/dist/nodes/CrowdDev/crowdDev.svg +15 -0
  48. package/dist/nodes/CrowdDev/descriptions/activityFields.d.ts +4 -0
  49. package/dist/nodes/CrowdDev/descriptions/activityFields.js +180 -0
  50. package/dist/nodes/CrowdDev/descriptions/activityFields.js.map +1 -0
  51. package/dist/nodes/CrowdDev/descriptions/automationFields.d.ts +4 -0
  52. package/dist/nodes/CrowdDev/descriptions/automationFields.js +126 -0
  53. package/dist/nodes/CrowdDev/descriptions/automationFields.js.map +1 -0
  54. package/dist/nodes/CrowdDev/descriptions/index.d.ts +2 -0
  55. package/dist/nodes/CrowdDev/descriptions/index.js +26 -0
  56. package/dist/nodes/CrowdDev/descriptions/index.js.map +1 -0
  57. package/dist/nodes/CrowdDev/descriptions/memberFields.d.ts +4 -0
  58. package/dist/nodes/CrowdDev/descriptions/memberFields.js +291 -0
  59. package/dist/nodes/CrowdDev/descriptions/memberFields.js.map +1 -0
  60. package/dist/nodes/CrowdDev/descriptions/noteFields.d.ts +4 -0
  61. package/dist/nodes/CrowdDev/descriptions/noteFields.js +90 -0
  62. package/dist/nodes/CrowdDev/descriptions/noteFields.js.map +1 -0
  63. package/dist/nodes/CrowdDev/descriptions/organizationFields.d.ts +4 -0
  64. package/dist/nodes/CrowdDev/descriptions/organizationFields.js +146 -0
  65. package/dist/nodes/CrowdDev/descriptions/organizationFields.js.map +1 -0
  66. package/dist/nodes/CrowdDev/descriptions/resources.d.ts +2 -0
  67. package/dist/nodes/CrowdDev/descriptions/resources.js +38 -0
  68. package/dist/nodes/CrowdDev/descriptions/resources.js.map +1 -0
  69. package/dist/nodes/CrowdDev/descriptions/shared.d.ts +2 -0
  70. package/dist/nodes/CrowdDev/descriptions/shared.js +29 -0
  71. package/dist/nodes/CrowdDev/descriptions/shared.js.map +1 -0
  72. package/dist/nodes/CrowdDev/descriptions/taskFields.d.ts +4 -0
  73. package/dist/nodes/CrowdDev/descriptions/taskFields.js +159 -0
  74. package/dist/nodes/CrowdDev/descriptions/taskFields.js.map +1 -0
  75. package/dist/nodes/CrowdDev/descriptions/utils.d.ts +5 -0
  76. package/dist/nodes/CrowdDev/descriptions/utils.js +55 -0
  77. package/dist/nodes/CrowdDev/descriptions/utils.js.map +1 -0
  78. package/dist/nodes/Google/Drive/GoogleDriveTrigger.node.js +5 -4
  79. package/dist/nodes/Google/Drive/GoogleDriveTrigger.node.js.map +1 -1
  80. package/dist/nodes/Google/Drive/v1/GoogleDriveV1.node.js +7 -6
  81. package/dist/nodes/Google/Drive/v1/GoogleDriveV1.node.js.map +1 -1
  82. package/dist/nodes/Google/Drive/v2/actions/common.descriptions.js +11 -10
  83. package/dist/nodes/Google/Drive/v2/actions/common.descriptions.js.map +1 -1
  84. package/dist/nodes/Google/Sheet/GoogleSheetsTrigger.node.js +3 -2
  85. package/dist/nodes/Google/Sheet/GoogleSheetsTrigger.node.js.map +1 -1
  86. package/dist/nodes/Google/Sheet/v2/actions/sheet/Sheet.resource.js +3 -2
  87. package/dist/nodes/Google/Sheet/v2/actions/sheet/Sheet.resource.js.map +1 -1
  88. package/dist/nodes/Google/Sheet/v2/actions/spreadsheet/delete.operation.js +3 -2
  89. package/dist/nodes/Google/Sheet/v2/actions/spreadsheet/delete.operation.js.map +1 -1
  90. package/dist/nodes/Google/constants.d.ts +2 -0
  91. package/dist/nodes/Google/constants.js +6 -0
  92. package/dist/nodes/Google/constants.js.map +1 -0
  93. package/dist/nodes/GraphQL/GraphQL.node.js +32 -0
  94. package/dist/nodes/GraphQL/GraphQL.node.js.map +1 -1
  95. package/dist/nodes/HttpRequest/V1/HttpRequestV1.node.js +1 -0
  96. package/dist/nodes/HttpRequest/V1/HttpRequestV1.node.js.map +1 -1
  97. package/dist/nodes/HttpRequest/V2/HttpRequestV2.node.js +1 -0
  98. package/dist/nodes/HttpRequest/V2/HttpRequestV2.node.js.map +1 -1
  99. package/dist/nodes/HttpRequest/V3/HttpRequestV3.node.js +24 -1
  100. package/dist/nodes/HttpRequest/V3/HttpRequestV3.node.js.map +1 -1
  101. package/dist/nodes/ItemLists/ItemLists.node.js +3 -1
  102. package/dist/nodes/ItemLists/ItemLists.node.js.map +1 -1
  103. package/dist/nodes/ItemLists/V3/ItemListsV3.node.d.ts +6 -0
  104. package/dist/nodes/ItemLists/V3/ItemListsV3.node.js +18 -0
  105. package/dist/nodes/ItemLists/V3/ItemListsV3.node.js.map +1 -0
  106. package/dist/nodes/ItemLists/V3/actions/common.descriptions.d.ts +2 -0
  107. package/dist/nodes/ItemLists/V3/actions/common.descriptions.js +11 -0
  108. package/dist/nodes/ItemLists/V3/actions/common.descriptions.js.map +1 -0
  109. package/dist/nodes/ItemLists/V3/actions/itemList/concatenateItems.operation.d.ts +23 -0
  110. package/dist/nodes/ItemLists/V3/actions/itemList/concatenateItems.operation.js +303 -0
  111. package/dist/nodes/ItemLists/V3/actions/itemList/concatenateItems.operation.js.map +1 -0
  112. package/dist/nodes/ItemLists/V3/actions/itemList/index.d.ts +9 -0
  113. package/dist/nodes/ItemLists/V3/actions/itemList/index.js +97 -0
  114. package/dist/nodes/ItemLists/V3/actions/itemList/index.js.map +1 -0
  115. package/dist/nodes/ItemLists/V3/actions/itemList/limit.operation.d.ts +23 -0
  116. package/dist/nodes/ItemLists/V3/actions/itemList/limit.operation.js +57 -0
  117. package/dist/nodes/ItemLists/V3/actions/itemList/limit.operation.js.map +1 -0
  118. package/dist/nodes/ItemLists/V3/actions/itemList/removeDuplicates.operation.d.ts +23 -0
  119. package/dist/nodes/ItemLists/V3/actions/itemList/removeDuplicates.operation.js +204 -0
  120. package/dist/nodes/ItemLists/V3/actions/itemList/removeDuplicates.operation.js.map +1 -0
  121. package/dist/nodes/ItemLists/V3/actions/itemList/sort.operation.d.ts +23 -0
  122. package/dist/nodes/ItemLists/V3/actions/itemList/sort.operation.js +262 -0
  123. package/dist/nodes/ItemLists/V3/actions/itemList/sort.operation.js.map +1 -0
  124. package/dist/nodes/ItemLists/V3/actions/itemList/splitOutItems.operation.d.ts +23 -0
  125. package/dist/nodes/ItemLists/V3/actions/itemList/splitOutItems.operation.js +183 -0
  126. package/dist/nodes/ItemLists/V3/actions/itemList/splitOutItems.operation.js.map +1 -0
  127. package/dist/nodes/ItemLists/V3/actions/itemList/summarize.operation.d.ts +23 -0
  128. package/dist/nodes/ItemLists/V3/actions/itemList/summarize.operation.js +491 -0
  129. package/dist/nodes/ItemLists/V3/actions/itemList/summarize.operation.js.map +1 -0
  130. package/dist/nodes/ItemLists/V3/actions/node.type.d.ts +6 -0
  131. package/dist/nodes/ItemLists/V3/actions/node.type.js +3 -0
  132. package/dist/nodes/ItemLists/V3/actions/node.type.js.map +1 -0
  133. package/dist/nodes/ItemLists/V3/actions/router.d.ts +2 -0
  134. package/dist/nodes/ItemLists/V3/actions/router.js +53 -0
  135. package/dist/nodes/ItemLists/V3/actions/router.js.map +1 -0
  136. package/dist/nodes/ItemLists/V3/actions/versionDescription.d.ts +2 -0
  137. package/dist/nodes/ItemLists/V3/actions/versionDescription.js +58 -0
  138. package/dist/nodes/ItemLists/V3/actions/versionDescription.js.map +1 -0
  139. package/dist/nodes/ItemLists/V3/helpers/utils.d.ts +5 -0
  140. package/dist/nodes/ItemLists/V3/helpers/utils.js +57 -0
  141. package/dist/nodes/ItemLists/V3/helpers/utils.js.map +1 -0
  142. package/dist/nodes/ItemLists/test/node/workflow.update_3.json +606 -0
  143. package/dist/nodes/Microsoft/ToDo/MicrosoftToDo.node.js +7 -0
  144. package/dist/nodes/Microsoft/ToDo/MicrosoftToDo.node.js.map +1 -1
  145. package/dist/nodes/Microsoft/ToDo/TaskDescription.js +7 -0
  146. package/dist/nodes/Microsoft/ToDo/TaskDescription.js.map +1 -1
  147. package/dist/nodes/MySql/v2/actions/common.descriptions.js +4 -4
  148. package/dist/nodes/MySql/v2/actions/common.descriptions.js.map +1 -1
  149. package/dist/nodes/MySql/v2/actions/database/executeQuery.operation.js +1 -9
  150. package/dist/nodes/MySql/v2/actions/database/executeQuery.operation.js.map +1 -1
  151. package/dist/nodes/MySql/v2/actions/database/insert.operation.js +1 -1
  152. package/dist/nodes/MySql/v2/actions/database/insert.operation.js.map +1 -1
  153. package/dist/nodes/MySql/v2/actions/database/update.operation.js +2 -2
  154. package/dist/nodes/MySql/v2/actions/database/update.operation.js.map +1 -1
  155. package/dist/nodes/MySql/v2/actions/database/upsert.operation.js +2 -2
  156. package/dist/nodes/MySql/v2/actions/database/upsert.operation.js.map +1 -1
  157. package/dist/nodes/Notion/DatabasePageDescription.js +41 -0
  158. package/dist/nodes/Notion/DatabasePageDescription.js.map +1 -1
  159. package/dist/nodes/Notion/v2/NotionV2.node.js +9 -0
  160. package/dist/nodes/Notion/v2/NotionV2.node.js.map +1 -1
  161. package/dist/nodes/Postgres/v2/actions/common.descriptions.js +4 -4
  162. package/dist/nodes/Postgres/v2/actions/common.descriptions.js.map +1 -1
  163. package/dist/nodes/Postgres/v2/actions/database/executeQuery.operation.js +1 -9
  164. package/dist/nodes/Postgres/v2/actions/database/executeQuery.operation.js.map +1 -1
  165. package/dist/nodes/Postgres/v2/actions/database/insert.operation.js +1 -1
  166. package/dist/nodes/Postgres/v2/actions/database/insert.operation.js.map +1 -1
  167. package/dist/nodes/Postgres/v2/actions/database/update.operation.js +2 -2
  168. package/dist/nodes/Postgres/v2/actions/database/update.operation.js.map +1 -1
  169. package/dist/nodes/Postgres/v2/actions/database/upsert.operation.js +2 -2
  170. package/dist/nodes/Postgres/v2/actions/database/upsert.operation.js.map +1 -1
  171. package/dist/nodes/Postgres/v2/helpers/utils.d.ts +1 -1
  172. package/dist/nodes/Postgres/v2/helpers/utils.js +3 -3
  173. package/dist/nodes/Postgres/v2/helpers/utils.js.map +1 -1
  174. package/dist/nodes/Postgres/v2/methods/resourceMapping.js +1 -1
  175. package/dist/nodes/Postgres/v2/methods/resourceMapping.js.map +1 -1
  176. package/dist/nodes/Salesforce/ContactDescription.js +3 -3
  177. package/dist/nodes/Salesforce/ContactDescription.js.map +1 -1
  178. package/dist/nodes/Strapi/GenericFunctions.js +2 -2
  179. package/dist/nodes/Strapi/GenericFunctions.js.map +1 -1
  180. package/dist/nodes/Strava/ActivityDescription.js +7 -0
  181. package/dist/nodes/Strava/ActivityDescription.js.map +1 -1
  182. package/dist/nodes/Strava/Strava.node.js +0 -6
  183. package/dist/nodes/Strava/Strava.node.js.map +1 -1
  184. package/dist/nodes/Twitter/Twitter.node.d.ts +3 -9
  185. package/dist/nodes/Twitter/Twitter.node.js +12 -224
  186. package/dist/nodes/Twitter/Twitter.node.js.map +1 -1
  187. package/dist/nodes/Twitter/Twitter.node.json +2 -1
  188. package/dist/nodes/Twitter/V1/DirectMessageDescription.js.map +1 -0
  189. package/dist/nodes/Twitter/V1/GenericFunctions.js.map +1 -0
  190. package/dist/nodes/Twitter/V1/TweetDescription.js.map +1 -0
  191. package/dist/nodes/Twitter/V1/TweetInterface.js.map +1 -0
  192. package/dist/nodes/Twitter/V1/TwitterV1.node.d.ts +11 -0
  193. package/dist/nodes/Twitter/V1/TwitterV1.node.js +235 -0
  194. package/dist/nodes/Twitter/V1/TwitterV1.node.js.map +1 -0
  195. package/dist/nodes/Twitter/V2/DirectMessageDescription.d.ts +3 -0
  196. package/dist/nodes/Twitter/V2/DirectMessageDescription.js +100 -0
  197. package/dist/nodes/Twitter/V2/DirectMessageDescription.js.map +1 -0
  198. package/dist/nodes/Twitter/V2/GenericFunctions.d.ts +5 -0
  199. package/dist/nodes/Twitter/V2/GenericFunctions.js +88 -0
  200. package/dist/nodes/Twitter/V2/GenericFunctions.js.map +1 -0
  201. package/dist/nodes/Twitter/V2/ListDescription.d.ts +3 -0
  202. package/dist/nodes/Twitter/V2/ListDescription.js +92 -0
  203. package/dist/nodes/Twitter/V2/ListDescription.js.map +1 -0
  204. package/dist/nodes/Twitter/V2/TweetDescription.d.ts +3 -0
  205. package/dist/nodes/Twitter/V2/TweetDescription.js +452 -0
  206. package/dist/nodes/Twitter/V2/TweetDescription.js.map +1 -0
  207. package/dist/nodes/Twitter/V2/TweetInterface.d.ts +23 -0
  208. package/dist/nodes/Twitter/V2/TweetInterface.js +3 -0
  209. package/dist/nodes/Twitter/V2/TweetInterface.js.map +1 -0
  210. package/dist/nodes/Twitter/V2/TwitterV2.node.d.ts +11 -0
  211. package/dist/nodes/Twitter/V2/TwitterV2.node.js +245 -0
  212. package/dist/nodes/Twitter/V2/TwitterV2.node.js.map +1 -0
  213. package/dist/nodes/Twitter/V2/UserDescription.d.ts +3 -0
  214. package/dist/nodes/Twitter/V2/UserDescription.js +76 -0
  215. package/dist/nodes/Twitter/V2/UserDescription.js.map +1 -0
  216. package/dist/nodes/Twitter/test/Workflow_Twitter_UnitTest.json +284 -0
  217. package/dist/nodes/Wait/Wait.node.d.ts +7 -4
  218. package/dist/nodes/Wait/Wait.node.js +77 -499
  219. package/dist/nodes/Wait/Wait.node.js.map +1 -1
  220. package/dist/nodes/Webhook/Webhook.node.d.ts +8 -3
  221. package/dist/nodes/Webhook/Webhook.node.js +148 -460
  222. package/dist/nodes/Webhook/Webhook.node.js.map +1 -1
  223. package/dist/nodes/Webhook/description.d.ts +10 -0
  224. package/dist/nodes/Webhook/description.js +325 -0
  225. package/dist/nodes/Webhook/description.js.map +1 -0
  226. package/dist/nodes/Webhook/error.d.ts +4 -0
  227. package/dist/nodes/Webhook/error.js +20 -0
  228. package/dist/nodes/Webhook/error.js.map +1 -0
  229. package/dist/nodes/Xml/Xml.node.js +1 -1
  230. package/dist/nodes/Xml/Xml.node.js.map +1 -1
  231. package/dist/nodes/Xml/test/node/workflow.xml-valid-data.json +134 -0
  232. package/dist/package.json +9 -4
  233. package/dist/types/credentials.json +5 -2
  234. package/dist/types/nodes.json +31 -27
  235. package/package.json +11 -6
  236. package/dist/credentials/SendInBlueApi.credentials.js.map +0 -1
  237. package/dist/nodes/SendInBlue/AttributeDescription.js.map +0 -1
  238. package/dist/nodes/SendInBlue/ContactDescription.js.map +0 -1
  239. package/dist/nodes/SendInBlue/EmailDescription.js.map +0 -1
  240. package/dist/nodes/SendInBlue/GenericFunctions.js.map +0 -1
  241. package/dist/nodes/SendInBlue/SendInBlue.node.js.map +0 -1
  242. package/dist/nodes/SendInBlue/SendInBlueTrigger.node.js.map +0 -1
  243. package/dist/nodes/SendInBlue/SenderDescrition.js.map +0 -1
  244. package/dist/nodes/SendInBlue/sendinblue.svg +0 -20
  245. package/dist/nodes/Twitter/DirectMessageDescription.js.map +0 -1
  246. package/dist/nodes/Twitter/GenericFunctions.js.map +0 -1
  247. package/dist/nodes/Twitter/TweetDescription.js.map +0 -1
  248. package/dist/nodes/Twitter/TweetInterface.js.map +0 -1
  249. /package/dist/nodes/{SendInBlue → Brevo}/AttributeDescription.d.ts +0 -0
  250. /package/dist/nodes/{SendInBlue → Brevo}/ContactDescription.d.ts +0 -0
  251. /package/dist/nodes/{SendInBlue → Brevo}/ContactDescription.js +0 -0
  252. /package/dist/nodes/{SendInBlue → Brevo}/EmailDescription.d.ts +0 -0
  253. /package/dist/nodes/{SendInBlue → Brevo}/SenderDescrition.d.ts +0 -0
  254. /package/dist/nodes/{SendInBlue → Brevo}/SenderDescrition.js +0 -0
  255. /package/dist/nodes/Twitter/{DirectMessageDescription.d.ts → V1/DirectMessageDescription.d.ts} +0 -0
  256. /package/dist/nodes/Twitter/{DirectMessageDescription.js → V1/DirectMessageDescription.js} +0 -0
  257. /package/dist/nodes/Twitter/{GenericFunctions.d.ts → V1/GenericFunctions.d.ts} +0 -0
  258. /package/dist/nodes/Twitter/{GenericFunctions.js → V1/GenericFunctions.js} +0 -0
  259. /package/dist/nodes/Twitter/{TweetDescription.d.ts → V1/TweetDescription.d.ts} +0 -0
  260. /package/dist/nodes/Twitter/{TweetDescription.js → V1/TweetDescription.js} +0 -0
  261. /package/dist/nodes/Twitter/{TweetInterface.d.ts → V1/TweetInterface.d.ts} +0 -0
  262. /package/dist/nodes/Twitter/{TweetInterface.js → V1/TweetInterface.js} +0 -0
@@ -12,25 +12,13 @@ const basic_auth_1 = __importDefault(require("basic-auth"));
12
12
  const formidable_1 = __importDefault(require("formidable"));
13
13
  const isbot_1 = __importDefault(require("isbot"));
14
14
  const tmp_promise_1 = require("tmp-promise");
15
+ const description_1 = require("./description");
16
+ const error_1 = require("./error");
15
17
  const pipeline = (0, util_1.promisify)(stream_1.default.pipeline);
16
- function authorizationError(resp, realm, responseCode, message) {
17
- if (message === undefined) {
18
- message = 'Authorization problem!';
19
- if (responseCode === 401) {
20
- message = 'Authorization is required!';
21
- }
22
- else if (responseCode === 403) {
23
- message = 'Authorization data is wrong!';
24
- }
25
- }
26
- resp.writeHead(responseCode, { 'WWW-Authenticate': `Basic realm="${realm}"` });
27
- resp.end(message);
28
- return {
29
- noWebhookResponse: true,
30
- };
31
- }
32
- class Webhook {
18
+ class Webhook extends n8n_workflow_1.Node {
33
19
  constructor() {
20
+ super(...arguments);
21
+ this.authPropertyName = 'authentication';
34
22
  this.description = {
35
23
  displayName: 'Webhook',
36
24
  icon: 'file:webhook.svg',
@@ -53,96 +41,11 @@ class Webhook {
53
41
  },
54
42
  inputs: [],
55
43
  outputs: ['main'],
56
- credentials: [
57
- {
58
- name: 'httpBasicAuth',
59
- required: true,
60
- displayOptions: {
61
- show: {
62
- authentication: ['basicAuth'],
63
- },
64
- },
65
- },
66
- {
67
- name: 'httpHeaderAuth',
68
- required: true,
69
- displayOptions: {
70
- show: {
71
- authentication: ['headerAuth'],
72
- },
73
- },
74
- },
75
- ],
76
- webhooks: [
77
- {
78
- name: 'default',
79
- httpMethod: '={{$parameter["httpMethod"]}}',
80
- isFullPath: true,
81
- responseCode: '={{$parameter["responseCode"]}}',
82
- responseMode: '={{$parameter["responseMode"]}}',
83
- responseData: '={{$parameter["responseData"] || ($parameter.options.noResponseBody ? "noData" : undefined) }}',
84
- responseBinaryPropertyName: '={{$parameter["responseBinaryPropertyName"]}}',
85
- responseContentType: '={{$parameter["options"]["responseContentType"]}}',
86
- responsePropertyName: '={{$parameter["options"]["responsePropertyName"]}}',
87
- responseHeaders: '={{$parameter["options"]["responseHeaders"]}}',
88
- path: '={{$parameter["path"]}}',
89
- },
90
- ],
44
+ credentials: (0, description_1.credentialsProperty)(this.authPropertyName),
45
+ webhooks: [description_1.defaultWebhookDescription],
91
46
  properties: [
92
- {
93
- displayName: 'Authentication',
94
- name: 'authentication',
95
- type: 'options',
96
- options: [
97
- {
98
- name: 'Basic Auth',
99
- value: 'basicAuth',
100
- },
101
- {
102
- name: 'Header Auth',
103
- value: 'headerAuth',
104
- },
105
- {
106
- name: 'None',
107
- value: 'none',
108
- },
109
- ],
110
- default: 'none',
111
- description: 'The way to authenticate',
112
- },
113
- {
114
- displayName: 'HTTP Method',
115
- name: 'httpMethod',
116
- type: 'options',
117
- options: [
118
- {
119
- name: 'DELETE',
120
- value: 'DELETE',
121
- },
122
- {
123
- name: 'GET',
124
- value: 'GET',
125
- },
126
- {
127
- name: 'HEAD',
128
- value: 'HEAD',
129
- },
130
- {
131
- name: 'PATCH',
132
- value: 'PATCH',
133
- },
134
- {
135
- name: 'POST',
136
- value: 'POST',
137
- },
138
- {
139
- name: 'PUT',
140
- value: 'PUT',
141
- },
142
- ],
143
- default: 'GET',
144
- description: 'The HTTP method to listen to',
145
- },
47
+ (0, description_1.authenticationProperty)(this.authPropertyName),
48
+ description_1.httpMethodsProperty,
146
49
  {
147
50
  displayName: 'Path',
148
51
  name: 'path',
@@ -152,30 +55,7 @@ class Webhook {
152
55
  required: true,
153
56
  description: 'The path to listen to',
154
57
  },
155
- {
156
- displayName: 'Respond',
157
- name: 'responseMode',
158
- type: 'options',
159
- options: [
160
- {
161
- name: 'Immediately',
162
- value: 'onReceived',
163
- description: 'As soon as this node executes',
164
- },
165
- {
166
- name: 'When Last Node Finishes',
167
- value: 'lastNode',
168
- description: 'Returns data of the last-executed node',
169
- },
170
- {
171
- name: "Using 'Respond to Webhook' Node",
172
- value: 'responseNode',
173
- description: 'Response defined in that node',
174
- },
175
- ],
176
- default: 'onReceived',
177
- description: 'When and how to respond to the webhook',
178
- },
58
+ description_1.responseModeProperty,
179
59
  {
180
60
  displayName: 'Insert a \'Respond to Webhook\' node to control when and how you respond. <a href="https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.respondtowebhook/" target="_blank">More details</a>',
181
61
  name: 'webhookNotice',
@@ -187,363 +67,171 @@ class Webhook {
187
67
  },
188
68
  default: '',
189
69
  },
190
- {
191
- displayName: 'Response Code',
192
- name: 'responseCode',
193
- type: 'number',
194
- displayOptions: {
195
- hide: {
196
- responseMode: ['responseNode'],
197
- },
198
- },
199
- typeOptions: {
200
- minValue: 100,
201
- maxValue: 599,
202
- },
203
- default: 200,
204
- description: 'The HTTP Response code to return',
205
- },
206
- {
207
- displayName: 'Response Data',
208
- name: 'responseData',
209
- type: 'options',
210
- displayOptions: {
211
- show: {
212
- responseMode: ['lastNode'],
213
- },
214
- },
215
- options: [
216
- {
217
- name: 'All Entries',
218
- value: 'allEntries',
219
- description: 'Returns all the entries of the last node. Always returns an array.',
220
- },
221
- {
222
- name: 'First Entry JSON',
223
- value: 'firstEntryJson',
224
- description: 'Returns the JSON data of the first entry of the last node. Always returns a JSON object.',
225
- },
226
- {
227
- name: 'First Entry Binary',
228
- value: 'firstEntryBinary',
229
- description: 'Returns the binary data of the first entry of the last node. Always returns a binary file.',
230
- },
231
- {
232
- name: 'No Response Body',
233
- value: 'noData',
234
- description: 'Returns without a body',
235
- },
236
- ],
237
- default: 'firstEntryJson',
238
- description: 'What data should be returned. If it should return all items as an array or only the first item as object.',
239
- },
240
- {
241
- displayName: 'Property Name',
242
- name: 'responseBinaryPropertyName',
243
- type: 'string',
244
- required: true,
245
- default: 'data',
246
- displayOptions: {
247
- show: {
248
- responseData: ['firstEntryBinary'],
249
- },
250
- },
251
- description: 'Name of the binary property to return',
252
- },
253
- {
254
- displayName: 'Options',
255
- name: 'options',
256
- type: 'collection',
257
- placeholder: 'Add Option',
258
- default: {},
259
- options: [
260
- {
261
- displayName: 'Binary Data',
262
- name: 'binaryData',
263
- type: 'boolean',
264
- displayOptions: {
265
- show: {
266
- '/httpMethod': ['PATCH', 'PUT', 'POST'],
267
- },
268
- },
269
- default: false,
270
- description: 'Whether the webhook will receive binary data',
271
- },
272
- {
273
- displayName: 'Binary Property',
274
- name: 'binaryPropertyName',
275
- type: 'string',
276
- default: 'data',
277
- required: true,
278
- displayOptions: {
279
- show: {
280
- binaryData: [true],
281
- },
282
- },
283
- description: 'Name of the binary property to write the data of the received file to. If the data gets received via "Form-Data Multipart" it will be the prefix and a number starting with 0 will be attached to it.',
284
- },
285
- {
286
- displayName: 'Ignore Bots',
287
- name: 'ignoreBots',
288
- type: 'boolean',
289
- default: false,
290
- description: 'Whether to ignore requests from bots like link previewers and web crawlers',
291
- },
292
- {
293
- displayName: 'No Response Body',
294
- name: 'noResponseBody',
295
- type: 'boolean',
296
- default: false,
297
- description: 'Whether to send any body in the response',
298
- displayOptions: {
299
- hide: {
300
- rawBody: [true],
301
- },
302
- show: {
303
- '/responseMode': ['onReceived'],
304
- },
305
- },
306
- },
307
- {
308
- displayName: 'Raw Body',
309
- name: 'rawBody',
310
- type: 'boolean',
311
- displayOptions: {
312
- hide: {
313
- binaryData: [true],
314
- noResponseBody: [true],
315
- },
316
- },
317
- default: false,
318
- description: 'Raw body (binary)',
319
- },
320
- {
321
- displayName: 'Response Data',
322
- name: 'responseData',
323
- type: 'string',
324
- displayOptions: {
325
- show: {
326
- '/responseMode': ['onReceived'],
327
- },
328
- hide: {
329
- noResponseBody: [true],
330
- },
331
- },
332
- default: '',
333
- placeholder: 'success',
334
- description: 'Custom response data to send',
335
- },
336
- {
337
- displayName: 'Response Content-Type',
338
- name: 'responseContentType',
339
- type: 'string',
340
- displayOptions: {
341
- show: {
342
- '/responseData': ['firstEntryJson'],
343
- '/responseMode': ['lastNode'],
344
- },
345
- },
346
- default: '',
347
- placeholder: 'application/xml',
348
- description: 'Set a custom content-type to return if another one as the "application/json" should be returned',
349
- },
350
- {
351
- displayName: 'Response Headers',
352
- name: 'responseHeaders',
353
- placeholder: 'Add Response Header',
354
- description: 'Add headers to the webhook response',
355
- type: 'fixedCollection',
356
- typeOptions: {
357
- multipleValues: true,
358
- },
359
- default: {},
360
- options: [
361
- {
362
- name: 'entries',
363
- displayName: 'Entries',
364
- values: [
365
- {
366
- displayName: 'Name',
367
- name: 'name',
368
- type: 'string',
369
- default: '',
370
- description: 'Name of the header',
371
- },
372
- {
373
- displayName: 'Value',
374
- name: 'value',
375
- type: 'string',
376
- default: '',
377
- description: 'Value of the header',
378
- },
379
- ],
380
- },
381
- ],
382
- },
383
- {
384
- displayName: 'Property Name',
385
- name: 'responsePropertyName',
386
- type: 'string',
387
- displayOptions: {
388
- show: {
389
- '/responseData': ['firstEntryJson'],
390
- '/responseMode': ['lastNode'],
391
- },
392
- },
393
- default: 'data',
394
- description: 'Name of the property to return the data of instead of the whole JSON',
395
- },
396
- ],
397
- },
70
+ description_1.responseCodeProperty,
71
+ description_1.responseDataProperty,
72
+ description_1.responseBinaryPropertyNameProperty,
73
+ description_1.optionsProperty,
398
74
  ],
399
75
  };
400
76
  }
401
- async webhook() {
77
+ async webhook(context) {
402
78
  var _a;
403
- const authentication = this.getNodeParameter('authentication');
404
- const options = this.getNodeParameter('options', {});
405
- const req = this.getRequestObject();
406
- const resp = this.getResponseObject();
407
- const headers = this.getHeaderData();
408
- const realm = 'Webhook';
409
- const ignoreBots = options.ignoreBots;
410
- if (ignoreBots && (0, isbot_1.default)(headers['user-agent'])) {
411
- return authorizationError(resp, realm, 403);
79
+ const options = context.getNodeParameter('options', {});
80
+ const req = context.getRequestObject();
81
+ const resp = context.getResponseObject();
82
+ try {
83
+ if (options.ignoreBots && (0, isbot_1.default)(req.headers['user-agent']))
84
+ throw new error_1.WebhookAuthorizationError(403);
85
+ await this.validateAuth(context);
86
+ }
87
+ catch (error) {
88
+ if (error instanceof error_1.WebhookAuthorizationError) {
89
+ resp.writeHead(error.responseCode, { 'WWW-Authenticate': 'Basic realm="Webhook"' });
90
+ resp.end(error.message);
91
+ return { noWebhookResponse: true };
92
+ }
93
+ throw error;
412
94
  }
95
+ const mimeType = (_a = req.headers['content-type']) !== null && _a !== void 0 ? _a : 'application/json';
96
+ if (mimeType.includes('multipart/form-data')) {
97
+ return this.handleFormData(context);
98
+ }
99
+ if (options.binaryData) {
100
+ return this.handleBinaryData(context);
101
+ }
102
+ const response = {
103
+ json: {
104
+ headers: req.headers,
105
+ params: req.params,
106
+ query: req.query,
107
+ body: req.body,
108
+ },
109
+ binary: options.rawBody
110
+ ? {
111
+ data: {
112
+ data: req.rawBody.toString(n8n_workflow_1.BINARY_ENCODING),
113
+ mimeType,
114
+ },
115
+ }
116
+ : undefined,
117
+ };
118
+ return {
119
+ webhookResponse: options.responseData,
120
+ workflowData: [[response]],
121
+ };
122
+ }
123
+ async validateAuth(context) {
124
+ const authentication = context.getNodeParameter(this.authPropertyName);
125
+ if (authentication === 'none')
126
+ return;
127
+ const req = context.getRequestObject();
128
+ const headers = context.getHeaderData();
413
129
  if (authentication === 'basicAuth') {
414
- let httpBasicAuth;
130
+ let expectedAuth;
415
131
  try {
416
- httpBasicAuth = await this.getCredentials('httpBasicAuth');
417
- }
418
- catch (error) {
132
+ expectedAuth = await context.getCredentials('httpBasicAuth');
419
133
  }
420
- if (httpBasicAuth === undefined || !httpBasicAuth.user || !httpBasicAuth.password) {
421
- return authorizationError(resp, realm, 500, 'No authentication data defined on node!');
134
+ catch { }
135
+ if (expectedAuth === undefined || !expectedAuth.user || !expectedAuth.password) {
136
+ throw new error_1.WebhookAuthorizationError(500, 'No authentication data defined on node!');
422
137
  }
423
- const basicAuthData = (0, basic_auth_1.default)(req);
424
- if (basicAuthData === undefined) {
425
- return authorizationError(resp, realm, 401);
426
- }
427
- if (basicAuthData.name !== httpBasicAuth.user ||
428
- basicAuthData.pass !== httpBasicAuth.password) {
429
- return authorizationError(resp, realm, 403);
138
+ const providedAuth = (0, basic_auth_1.default)(req);
139
+ if (!providedAuth)
140
+ throw new error_1.WebhookAuthorizationError(401);
141
+ if (providedAuth.name !== expectedAuth.user || providedAuth.pass !== expectedAuth.password) {
142
+ throw new error_1.WebhookAuthorizationError(403);
430
143
  }
431
144
  }
432
145
  else if (authentication === 'headerAuth') {
433
- let httpHeaderAuth;
146
+ let expectedAuth;
434
147
  try {
435
- httpHeaderAuth = await this.getCredentials('httpHeaderAuth');
436
- }
437
- catch (error) {
148
+ expectedAuth = await context.getCredentials('httpHeaderAuth');
438
149
  }
439
- if (httpHeaderAuth === undefined || !httpHeaderAuth.name || !httpHeaderAuth.value) {
440
- return authorizationError(resp, realm, 500, 'No authentication data defined on node!');
150
+ catch { }
151
+ if (expectedAuth === undefined || !expectedAuth.name || !expectedAuth.value) {
152
+ throw new error_1.WebhookAuthorizationError(500, 'No authentication data defined on node!');
441
153
  }
442
- const headerName = httpHeaderAuth.name.toLowerCase();
443
- const headerValue = httpHeaderAuth.value;
154
+ const headerName = expectedAuth.name.toLowerCase();
155
+ const expectedValue = expectedAuth.value;
444
156
  if (!headers.hasOwnProperty(headerName) ||
445
- headers[headerName] !== headerValue) {
446
- return authorizationError(resp, realm, 403);
157
+ headers[headerName] !== expectedValue) {
158
+ throw new error_1.WebhookAuthorizationError(403);
447
159
  }
448
160
  }
449
- const mimeType = (_a = headers['content-type']) !== null && _a !== void 0 ? _a : 'application/json';
450
- if (mimeType.includes('multipart/form-data')) {
451
- const form = new formidable_1.default.IncomingForm({ multiples: true });
452
- return new Promise((resolve, _reject) => {
453
- form.parse(req, async (err, data, files) => {
454
- const returnItem = {
455
- binary: {},
456
- json: {
457
- headers,
458
- params: this.getParamsData(),
459
- query: this.getQueryData(),
460
- body: data,
461
- },
462
- };
463
- let count = 0;
464
- for (const xfile of Object.keys(files)) {
465
- const processFiles = [];
466
- let multiFile = false;
467
- if (Array.isArray(files[xfile])) {
468
- processFiles.push(...files[xfile]);
469
- multiFile = true;
470
- }
471
- else {
472
- processFiles.push(files[xfile]);
473
- }
474
- let fileCount = 0;
475
- for (const file of processFiles) {
476
- let binaryPropertyName = xfile;
477
- if (binaryPropertyName.endsWith('[]')) {
478
- binaryPropertyName = binaryPropertyName.slice(0, -2);
479
- }
480
- if (multiFile) {
481
- binaryPropertyName += fileCount++;
482
- }
483
- if (options.binaryPropertyName) {
484
- binaryPropertyName = `${options.binaryPropertyName}${count}`;
485
- }
486
- const fileJson = file.toJSON();
487
- returnItem.binary[binaryPropertyName] = await this.nodeHelpers.copyBinaryFile(file.path, fileJson.name || fileJson.filename, fileJson.type);
488
- count += 1;
489
- }
490
- }
491
- resolve({
492
- workflowData: [[returnItem]],
493
- });
494
- });
495
- });
496
- }
497
- if (options.binaryData === true) {
498
- const binaryFile = await (0, tmp_promise_1.file)({ prefix: 'n8n-webhook-' });
499
- try {
500
- await pipeline(req, fs_1.default.createWriteStream(binaryFile.path));
161
+ }
162
+ async handleFormData(context) {
163
+ const req = context.getRequestObject();
164
+ const options = context.getNodeParameter('options', {});
165
+ const form = new formidable_1.default.IncomingForm({ multiples: true });
166
+ return new Promise((resolve, _reject) => {
167
+ form.parse(req, async (err, data, files) => {
501
168
  const returnItem = {
502
169
  binary: {},
503
170
  json: {
504
- headers,
505
- params: this.getParamsData(),
506
- query: this.getQueryData(),
507
- body: this.getBodyData(),
171
+ headers: req.headers,
172
+ params: req.params,
173
+ query: req.query,
174
+ body: data,
508
175
  },
509
176
  };
510
- const binaryPropertyName = (options.binaryPropertyName || 'data');
511
- returnItem.binary[binaryPropertyName] = await this.nodeHelpers.copyBinaryFile(binaryFile.path, mimeType);
512
- return {
513
- workflowData: [[returnItem]],
514
- };
515
- }
516
- catch (error) {
517
- throw new n8n_workflow_1.NodeOperationError(this.getNode(), error);
518
- }
519
- finally {
520
- await binaryFile.cleanup();
521
- }
522
- }
523
- const response = {
524
- json: {
525
- headers,
526
- params: this.getParamsData(),
527
- query: this.getQueryData(),
528
- body: this.getBodyData(),
529
- },
530
- };
531
- if (options.rawBody) {
532
- response.binary = {
533
- data: {
534
- data: req.rawBody.toString(n8n_workflow_1.BINARY_ENCODING),
535
- mimeType,
177
+ let count = 0;
178
+ for (const xfile of Object.keys(files)) {
179
+ const processFiles = [];
180
+ let multiFile = false;
181
+ if (Array.isArray(files[xfile])) {
182
+ processFiles.push(...files[xfile]);
183
+ multiFile = true;
184
+ }
185
+ else {
186
+ processFiles.push(files[xfile]);
187
+ }
188
+ let fileCount = 0;
189
+ for (const file of processFiles) {
190
+ let binaryPropertyName = xfile;
191
+ if (binaryPropertyName.endsWith('[]')) {
192
+ binaryPropertyName = binaryPropertyName.slice(0, -2);
193
+ }
194
+ if (multiFile) {
195
+ binaryPropertyName += fileCount++;
196
+ }
197
+ if (options.binaryPropertyName) {
198
+ binaryPropertyName = `${options.binaryPropertyName}${count}`;
199
+ }
200
+ const fileJson = file.toJSON();
201
+ returnItem.binary[binaryPropertyName] = await context.nodeHelpers.copyBinaryFile(file.path, fileJson.name || fileJson.filename, fileJson.type);
202
+ count += 1;
203
+ }
204
+ }
205
+ resolve({ workflowData: [[returnItem]] });
206
+ });
207
+ });
208
+ }
209
+ async handleBinaryData(context) {
210
+ var _a;
211
+ const req = context.getRequestObject();
212
+ const options = context.getNodeParameter('options', {});
213
+ const binaryFile = await (0, tmp_promise_1.file)({ prefix: 'n8n-webhook-' });
214
+ try {
215
+ await pipeline(req, fs_1.default.createWriteStream(binaryFile.path));
216
+ const returnItem = {
217
+ binary: {},
218
+ json: {
219
+ headers: req.headers,
220
+ params: req.params,
221
+ query: req.query,
222
+ body: req.body,
536
223
  },
537
224
  };
225
+ const binaryPropertyName = (options.binaryPropertyName || 'data');
226
+ returnItem.binary[binaryPropertyName] = await context.nodeHelpers.copyBinaryFile(binaryFile.path, (_a = req.headers['content-type']) !== null && _a !== void 0 ? _a : 'application/octet-stream');
227
+ return { workflowData: [[returnItem]] };
538
228
  }
539
- let webhookResponse;
540
- if (options.responseData) {
541
- webhookResponse = options.responseData;
229
+ catch (error) {
230
+ throw new n8n_workflow_1.NodeOperationError(context.getNode(), error);
231
+ }
232
+ finally {
233
+ await binaryFile.cleanup();
542
234
  }
543
- return {
544
- webhookResponse,
545
- workflowData: [[response]],
546
- };
547
235
  }
548
236
  }
549
237
  exports.Webhook = Webhook;