n8n-workflow 2.31.1 → 2.32.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 (408) hide show
  1. package/dist/cjs/augment-object.js +136 -146
  2. package/dist/cjs/augment-object.js.map +1 -1
  3. package/dist/cjs/build.tsbuildinfo +1 -1
  4. package/dist/cjs/common/find-ai-root-node-names.js +36 -46
  5. package/dist/cjs/common/find-ai-root-node-names.js.map +1 -1
  6. package/dist/cjs/common/get-child-nodes.js +8 -18
  7. package/dist/cjs/common/get-child-nodes.js.map +1 -1
  8. package/dist/cjs/common/get-connected-nodes.js +84 -94
  9. package/dist/cjs/common/get-connected-nodes.js.map +1 -1
  10. package/dist/cjs/common/get-node-by-name.js +16 -26
  11. package/dist/cjs/common/get-node-by-name.js.map +1 -1
  12. package/dist/cjs/common/get-parent-nodes.js +14 -24
  13. package/dist/cjs/common/get-parent-nodes.js.map +1 -1
  14. package/dist/cjs/common/index.js +9 -19
  15. package/dist/cjs/common/index.js.map +1 -1
  16. package/dist/cjs/common/map-connections-by-destination.js +31 -41
  17. package/dist/cjs/common/map-connections-by-destination.js.map +1 -1
  18. package/dist/cjs/common/resolve-variables.d.ts +8 -0
  19. package/dist/cjs/common/resolve-variables.d.ts.map +1 -1
  20. package/dist/cjs/common/resolve-variables.js +46 -33
  21. package/dist/cjs/common/resolve-variables.js.map +1 -1
  22. package/dist/cjs/connections-diff.js +58 -68
  23. package/dist/cjs/connections-diff.js.map +1 -1
  24. package/dist/cjs/constants.d.ts +3 -3
  25. package/dist/cjs/constants.d.ts.map +1 -1
  26. package/dist/cjs/constants.js +157 -166
  27. package/dist/cjs/constants.js.map +1 -1
  28. package/dist/cjs/credential-domain-restrictions.js +153 -163
  29. package/dist/cjs/credential-domain-restrictions.js.map +1 -1
  30. package/dist/cjs/cron.d.ts.map +1 -1
  31. package/dist/cjs/cron.js +25 -35
  32. package/dist/cjs/cron.js.map +1 -1
  33. package/dist/cjs/data-table.types.js +10 -20
  34. package/dist/cjs/data-table.types.js.map +1 -1
  35. package/dist/cjs/dynamic-credentials-helpers.js +93 -103
  36. package/dist/cjs/dynamic-credentials-helpers.js.map +1 -1
  37. package/dist/cjs/errors/abstract/execution-base.error.d.ts.map +1 -1
  38. package/dist/cjs/errors/abstract/execution-base.error.js +41 -51
  39. package/dist/cjs/errors/abstract/execution-base.error.js.map +1 -1
  40. package/dist/cjs/errors/abstract/node.error.d.ts.map +1 -1
  41. package/dist/cjs/errors/abstract/node.error.js +142 -152
  42. package/dist/cjs/errors/abstract/node.error.js.map +1 -1
  43. package/dist/cjs/errors/base/base.error.d.ts.map +1 -1
  44. package/dist/cjs/errors/base/base.error.js +35 -45
  45. package/dist/cjs/errors/base/base.error.js.map +1 -1
  46. package/dist/cjs/errors/base/operational.error.d.ts.map +1 -1
  47. package/dist/cjs/errors/base/operational.error.js +17 -27
  48. package/dist/cjs/errors/base/operational.error.js.map +1 -1
  49. package/dist/cjs/errors/base/unexpected.error.d.ts.map +1 -1
  50. package/dist/cjs/errors/base/unexpected.error.js +17 -27
  51. package/dist/cjs/errors/base/unexpected.error.js.map +1 -1
  52. package/dist/cjs/errors/base/user.error.d.ts.map +1 -1
  53. package/dist/cjs/errors/base/user.error.js +17 -27
  54. package/dist/cjs/errors/base/user.error.js.map +1 -1
  55. package/dist/cjs/errors/cli-subworkflow-operation.error.js +7 -17
  56. package/dist/cjs/errors/cli-subworkflow-operation.error.js.map +1 -1
  57. package/dist/cjs/errors/db-connection-timeout-error.d.ts.map +1 -1
  58. package/dist/cjs/errors/db-connection-timeout-error.js +11 -21
  59. package/dist/cjs/errors/db-connection-timeout-error.js.map +1 -1
  60. package/dist/cjs/errors/execution-cancelled.error.d.ts.map +1 -1
  61. package/dist/cjs/errors/execution-cancelled.error.js +33 -43
  62. package/dist/cjs/errors/execution-cancelled.error.js.map +1 -1
  63. package/dist/cjs/errors/expression-class-extension.error.d.ts.map +1 -1
  64. package/dist/cjs/errors/expression-class-extension.error.js +9 -19
  65. package/dist/cjs/errors/expression-class-extension.error.js.map +1 -1
  66. package/dist/cjs/errors/expression-computed-destructuring.error.d.ts.map +1 -1
  67. package/dist/cjs/errors/expression-computed-destructuring.error.js +9 -19
  68. package/dist/cjs/errors/expression-computed-destructuring.error.js.map +1 -1
  69. package/dist/cjs/errors/expression-destructuring.error.d.ts.map +1 -1
  70. package/dist/cjs/errors/expression-destructuring.error.js +9 -19
  71. package/dist/cjs/errors/expression-destructuring.error.js.map +1 -1
  72. package/dist/cjs/errors/expression-extension.error.js +7 -17
  73. package/dist/cjs/errors/expression-extension.error.js.map +1 -1
  74. package/dist/cjs/errors/expression-reserved-variable.error.d.ts.map +1 -1
  75. package/dist/cjs/errors/expression-reserved-variable.error.js +9 -19
  76. package/dist/cjs/errors/expression-reserved-variable.error.js.map +1 -1
  77. package/dist/cjs/errors/expression-with-statement.error.d.ts.map +1 -1
  78. package/dist/cjs/errors/expression-with-statement.error.js +9 -19
  79. package/dist/cjs/errors/expression-with-statement.error.js.map +1 -1
  80. package/dist/cjs/errors/expression.error.d.ts.map +1 -1
  81. package/dist/cjs/errors/expression.error.js +33 -43
  82. package/dist/cjs/errors/expression.error.js.map +1 -1
  83. package/dist/cjs/errors/index.js +62 -72
  84. package/dist/cjs/errors/index.js.map +1 -1
  85. package/dist/cjs/errors/node-api.error.d.ts.map +1 -1
  86. package/dist/cjs/errors/node-api.error.js +227 -237
  87. package/dist/cjs/errors/node-api.error.js.map +1 -1
  88. package/dist/cjs/errors/node-operation.error.d.ts.map +1 -1
  89. package/dist/cjs/errors/node-operation.error.js +43 -53
  90. package/dist/cjs/errors/node-operation.error.js.map +1 -1
  91. package/dist/cjs/errors/node-ssl.error.d.ts.map +1 -1
  92. package/dist/cjs/errors/node-ssl.error.js +9 -19
  93. package/dist/cjs/errors/node-ssl.error.js.map +1 -1
  94. package/dist/cjs/errors/subworkflow-operation.error.d.ts.map +1 -1
  95. package/dist/cjs/errors/subworkflow-operation.error.js +18 -28
  96. package/dist/cjs/errors/subworkflow-operation.error.js.map +1 -1
  97. package/dist/cjs/errors/trigger-close.error.d.ts.map +1 -1
  98. package/dist/cjs/errors/trigger-close.error.js +11 -21
  99. package/dist/cjs/errors/trigger-close.error.js.map +1 -1
  100. package/dist/cjs/errors/webhook-taken.error.d.ts.map +1 -1
  101. package/dist/cjs/errors/webhook-taken.error.js +9 -19
  102. package/dist/cjs/errors/webhook-taken.error.js.map +1 -1
  103. package/dist/cjs/errors/workflow-activation.error.d.ts.map +1 -1
  104. package/dist/cjs/errors/workflow-activation.error.js +54 -64
  105. package/dist/cjs/errors/workflow-activation.error.js.map +1 -1
  106. package/dist/cjs/errors/workflow-configuration.error.js +10 -20
  107. package/dist/cjs/errors/workflow-configuration.error.js.map +1 -1
  108. package/dist/cjs/errors/workflow-deactivation.error.js +7 -17
  109. package/dist/cjs/errors/workflow-deactivation.error.js.map +1 -1
  110. package/dist/cjs/errors/workflow-operation.error.d.ts.map +1 -1
  111. package/dist/cjs/errors/workflow-operation.error.js +20 -30
  112. package/dist/cjs/errors/workflow-operation.error.js.map +1 -1
  113. package/dist/cjs/evaluation-helpers.js +16 -26
  114. package/dist/cjs/evaluation-helpers.js.map +1 -1
  115. package/dist/cjs/execution-context-establishment-hooks.d.ts.map +1 -1
  116. package/dist/cjs/execution-context-establishment-hooks.js +43 -49
  117. package/dist/cjs/execution-context-establishment-hooks.js.map +1 -1
  118. package/dist/cjs/execution-context.d.ts +14 -14
  119. package/dist/cjs/execution-context.d.ts.map +1 -1
  120. package/dist/cjs/execution-context.js +203 -213
  121. package/dist/cjs/execution-context.js.map +1 -1
  122. package/dist/cjs/execution-status.d.ts +2 -2
  123. package/dist/cjs/execution-status.d.ts.map +1 -1
  124. package/dist/cjs/execution-status.js +27 -37
  125. package/dist/cjs/execution-status.js.map +1 -1
  126. package/dist/cjs/expression-evaluator-proxy.d.ts.map +1 -1
  127. package/dist/cjs/expression-evaluator-proxy.js +18 -28
  128. package/dist/cjs/expression-evaluator-proxy.js.map +1 -1
  129. package/dist/cjs/expression-sandboxing.d.ts.map +1 -1
  130. package/dist/cjs/expression-sandboxing.js +447 -457
  131. package/dist/cjs/expression-sandboxing.js.map +1 -1
  132. package/dist/cjs/expression.d.ts.map +1 -1
  133. package/dist/cjs/expression.js +535 -546
  134. package/dist/cjs/expression.js.map +1 -1
  135. package/dist/cjs/expressions/expression-helpers.d.ts.map +1 -1
  136. package/dist/cjs/expressions/expression-helpers.js +13 -23
  137. package/dist/cjs/expressions/expression-helpers.js.map +1 -1
  138. package/dist/cjs/extensions/array-extensions.js +591 -601
  139. package/dist/cjs/extensions/array-extensions.js.map +1 -1
  140. package/dist/cjs/extensions/boolean-extensions.d.ts +1 -1
  141. package/dist/cjs/extensions/boolean-extensions.js +38 -48
  142. package/dist/cjs/extensions/boolean-extensions.js.map +1 -1
  143. package/dist/cjs/extensions/date-extensions.js +507 -517
  144. package/dist/cjs/extensions/date-extensions.js.map +1 -1
  145. package/dist/cjs/extensions/expression-extension.d.ts.map +1 -1
  146. package/dist/cjs/extensions/expression-extension.js +455 -465
  147. package/dist/cjs/extensions/expression-extension.js.map +1 -1
  148. package/dist/cjs/extensions/expression-parser.d.ts.map +1 -1
  149. package/dist/cjs/extensions/expression-parser.js +82 -92
  150. package/dist/cjs/extensions/expression-parser.js.map +1 -1
  151. package/dist/cjs/extensions/extended-functions.d.ts +10 -18
  152. package/dist/cjs/extensions/extended-functions.d.ts.map +1 -1
  153. package/dist/cjs/extensions/extended-functions.js +80 -90
  154. package/dist/cjs/extensions/extended-functions.js.map +1 -1
  155. package/dist/cjs/extensions/extensions.js +2 -12
  156. package/dist/cjs/extensions/index.js +10 -20
  157. package/dist/cjs/extensions/index.js.map +1 -1
  158. package/dist/cjs/extensions/number-extensions.js +226 -236
  159. package/dist/cjs/extensions/number-extensions.js.map +1 -1
  160. package/dist/cjs/extensions/object-extensions.js +274 -284
  161. package/dist/cjs/extensions/object-extensions.js.map +1 -1
  162. package/dist/cjs/extensions/string-extensions.d.ts +1 -1
  163. package/dist/cjs/extensions/string-extensions.d.ts.map +1 -1
  164. package/dist/cjs/extensions/string-extensions.js +769 -779
  165. package/dist/cjs/extensions/string-extensions.js.map +1 -1
  166. package/dist/cjs/extensions/utils.d.ts.map +1 -1
  167. package/dist/cjs/extensions/utils.js +35 -45
  168. package/dist/cjs/extensions/utils.js.map +1 -1
  169. package/dist/cjs/from-ai-parse-utils.js +393 -403
  170. package/dist/cjs/from-ai-parse-utils.js.map +1 -1
  171. package/dist/cjs/global-state.js +12 -22
  172. package/dist/cjs/global-state.js.map +1 -1
  173. package/dist/cjs/graph/graph-utils.js +166 -176
  174. package/dist/cjs/graph/graph-utils.js.map +1 -1
  175. package/dist/cjs/highlighted-data.js +13 -23
  176. package/dist/cjs/highlighted-data.js.map +1 -1
  177. package/dist/cjs/index.js +105 -115
  178. package/dist/cjs/index.js.map +1 -1
  179. package/dist/cjs/interfaces.d.ts +112 -22
  180. package/dist/cjs/interfaces.d.ts.map +1 -1
  181. package/dist/cjs/interfaces.js +62 -72
  182. package/dist/cjs/interfaces.js.map +1 -1
  183. package/dist/cjs/jmespath-query.js +26 -36
  184. package/dist/cjs/jmespath-query.js.map +1 -1
  185. package/dist/cjs/logger-proxy.d.ts.map +1 -1
  186. package/dist/cjs/logger-proxy.js +15 -25
  187. package/dist/cjs/logger-proxy.js.map +1 -1
  188. package/dist/cjs/mcp-helpers.js +10 -20
  189. package/dist/cjs/mcp-helpers.js.map +1 -1
  190. package/dist/cjs/message-event-bus.d.ts +184 -165
  191. package/dist/cjs/message-event-bus.d.ts.map +1 -1
  192. package/dist/cjs/message-event-bus.js +207 -217
  193. package/dist/cjs/message-event-bus.js.map +1 -1
  194. package/dist/cjs/metadata-utils.js +35 -45
  195. package/dist/cjs/metadata-utils.js.map +1 -1
  196. package/dist/cjs/native-methods/array.methods.js +527 -537
  197. package/dist/cjs/native-methods/array.methods.js.map +1 -1
  198. package/dist/cjs/native-methods/boolean.methods.js +18 -28
  199. package/dist/cjs/native-methods/boolean.methods.js.map +1 -1
  200. package/dist/cjs/native-methods/index.js +16 -26
  201. package/dist/cjs/native-methods/index.js.map +1 -1
  202. package/dist/cjs/native-methods/number.methods.js +79 -89
  203. package/dist/cjs/native-methods/number.methods.js.map +1 -1
  204. package/dist/cjs/native-methods/object.methods.js +7 -17
  205. package/dist/cjs/native-methods/object.methods.js.map +1 -1
  206. package/dist/cjs/native-methods/string.methods.js +474 -484
  207. package/dist/cjs/native-methods/string.methods.js.map +1 -1
  208. package/dist/cjs/node-grouping-validation.d.ts +6 -0
  209. package/dist/cjs/node-grouping-validation.d.ts.map +1 -1
  210. package/dist/cjs/node-grouping-validation.js +165 -144
  211. package/dist/cjs/node-grouping-validation.js.map +1 -1
  212. package/dist/cjs/node-helpers.d.ts.map +1 -1
  213. package/dist/cjs/node-helpers.js +1486 -1493
  214. package/dist/cjs/node-helpers.js.map +1 -1
  215. package/dist/cjs/node-parameters/filter-parameter.d.ts.map +1 -1
  216. package/dist/cjs/node-parameters/filter-parameter.js +315 -325
  217. package/dist/cjs/node-parameters/filter-parameter.js.map +1 -1
  218. package/dist/cjs/node-parameters/node-parameter-value-type-guard.js +105 -115
  219. package/dist/cjs/node-parameters/node-parameter-value-type-guard.js.map +1 -1
  220. package/dist/cjs/node-parameters/parameter-type-validation.js +120 -130
  221. package/dist/cjs/node-parameters/parameter-type-validation.js.map +1 -1
  222. package/dist/cjs/node-parameters/path-utils.js +21 -31
  223. package/dist/cjs/node-parameters/path-utils.js.map +1 -1
  224. package/dist/cjs/node-parameters/rename-node-utils.js +22 -32
  225. package/dist/cjs/node-parameters/rename-node-utils.js.map +1 -1
  226. package/dist/cjs/node-reference-parser-utils.js +472 -482
  227. package/dist/cjs/node-reference-parser-utils.js.map +1 -1
  228. package/dist/cjs/node-validation.js +59 -69
  229. package/dist/cjs/node-validation.js.map +1 -1
  230. package/dist/cjs/observable-object.js +56 -66
  231. package/dist/cjs/observable-object.js.map +1 -1
  232. package/dist/cjs/redaction-channels.js +36 -46
  233. package/dist/cjs/redaction-channels.js.map +1 -1
  234. package/dist/cjs/run-execution-data/run-execution-data.js +15 -25
  235. package/dist/cjs/run-execution-data/run-execution-data.js.map +1 -1
  236. package/dist/cjs/run-execution-data/run-execution-data.v0.js +2 -12
  237. package/dist/cjs/run-execution-data/run-execution-data.v1.js +26 -36
  238. package/dist/cjs/run-execution-data/run-execution-data.v1.js.map +1 -1
  239. package/dist/cjs/run-execution-data-factory.js +113 -123
  240. package/dist/cjs/run-execution-data-factory.js.map +1 -1
  241. package/dist/cjs/schemas.d.ts +13 -13
  242. package/dist/cjs/schemas.d.ts.map +1 -1
  243. package/dist/cjs/schemas.js +351 -360
  244. package/dist/cjs/schemas.js.map +1 -1
  245. package/dist/cjs/sub-workflow-output.js +10 -20
  246. package/dist/cjs/sub-workflow-output.js.map +1 -1
  247. package/dist/cjs/telemetry-helpers.d.ts.map +1 -1
  248. package/dist/cjs/telemetry-helpers.js +716 -726
  249. package/dist/cjs/telemetry-helpers.js.map +1 -1
  250. package/dist/cjs/tool-helpers.js +18 -28
  251. package/dist/cjs/tool-helpers.js.map +1 -1
  252. package/dist/cjs/trigger-identity.js +41 -51
  253. package/dist/cjs/trigger-identity.js.map +1 -1
  254. package/dist/cjs/trimmed-task-data.js +21 -31
  255. package/dist/cjs/trimmed-task-data.js.map +1 -1
  256. package/dist/cjs/type-guards.d.ts +3 -3
  257. package/dist/cjs/type-guards.d.ts.map +1 -1
  258. package/dist/cjs/type-guards.js +74 -84
  259. package/dist/cjs/type-guards.js.map +1 -1
  260. package/dist/cjs/type-validation.d.ts.map +1 -1
  261. package/dist/cjs/type-validation.js +383 -393
  262. package/dist/cjs/type-validation.js.map +1 -1
  263. package/dist/cjs/utils.d.ts +2 -2
  264. package/dist/cjs/utils.d.ts.map +1 -1
  265. package/dist/cjs/utils.js +430 -440
  266. package/dist/cjs/utils.js.map +1 -1
  267. package/dist/cjs/versioned-node-type.d.ts.map +1 -1
  268. package/dist/cjs/versioned-node-type.js +20 -30
  269. package/dist/cjs/versioned-node-type.js.map +1 -1
  270. package/dist/cjs/workflow-checksum.js +67 -77
  271. package/dist/cjs/workflow-checksum.js.map +1 -1
  272. package/dist/cjs/workflow-data-proxy-env-provider.js +58 -68
  273. package/dist/cjs/workflow-data-proxy-env-provider.js.map +1 -1
  274. package/dist/cjs/workflow-data-proxy-helpers.js +8 -18
  275. package/dist/cjs/workflow-data-proxy-helpers.js.map +1 -1
  276. package/dist/cjs/workflow-data-proxy.d.ts.map +1 -1
  277. package/dist/cjs/workflow-data-proxy.js +1162 -1172
  278. package/dist/cjs/workflow-data-proxy.js.map +1 -1
  279. package/dist/cjs/workflow-diff.d.ts +2 -1
  280. package/dist/cjs/workflow-diff.d.ts.map +1 -1
  281. package/dist/cjs/workflow-diff.js +292 -300
  282. package/dist/cjs/workflow-diff.js.map +1 -1
  283. package/dist/cjs/workflow-environments-helper.js +23 -33
  284. package/dist/cjs/workflow-environments-helper.js.map +1 -1
  285. package/dist/cjs/workflow-expression.d.ts.map +1 -1
  286. package/dist/cjs/workflow-expression.js +97 -107
  287. package/dist/cjs/workflow-expression.js.map +1 -1
  288. package/dist/cjs/workflow-structure-validation.d.ts.map +1 -1
  289. package/dist/cjs/workflow-structure-validation.js +140 -150
  290. package/dist/cjs/workflow-structure-validation.js.map +1 -1
  291. package/dist/cjs/workflow-validation.js +40 -50
  292. package/dist/cjs/workflow-validation.js.map +1 -1
  293. package/dist/cjs/workflow.d.ts.map +1 -1
  294. package/dist/cjs/workflow.js +612 -622
  295. package/dist/cjs/workflow.js.map +1 -1
  296. package/dist/esm/common/get-child-nodes.js.map +1 -1
  297. package/dist/esm/common/get-connected-nodes.js.map +1 -1
  298. package/dist/esm/common/get-parent-nodes.js.map +1 -1
  299. package/dist/esm/common/resolve-variables.d.ts +8 -0
  300. package/dist/esm/common/resolve-variables.d.ts.map +1 -1
  301. package/dist/esm/common/resolve-variables.js +22 -0
  302. package/dist/esm/common/resolve-variables.js.map +1 -1
  303. package/dist/esm/constants.d.ts +3 -3
  304. package/dist/esm/constants.d.ts.map +1 -1
  305. package/dist/esm/cron.d.ts.map +1 -1
  306. package/dist/esm/errors/abstract/execution-base.error.d.ts.map +1 -1
  307. package/dist/esm/errors/abstract/execution-base.error.js.map +1 -1
  308. package/dist/esm/errors/abstract/node.error.d.ts.map +1 -1
  309. package/dist/esm/errors/abstract/node.error.js.map +1 -1
  310. package/dist/esm/errors/base/base.error.d.ts.map +1 -1
  311. package/dist/esm/errors/base/base.error.js.map +1 -1
  312. package/dist/esm/errors/base/operational.error.d.ts.map +1 -1
  313. package/dist/esm/errors/base/operational.error.js.map +1 -1
  314. package/dist/esm/errors/base/unexpected.error.d.ts.map +1 -1
  315. package/dist/esm/errors/base/unexpected.error.js.map +1 -1
  316. package/dist/esm/errors/base/user.error.d.ts.map +1 -1
  317. package/dist/esm/errors/base/user.error.js.map +1 -1
  318. package/dist/esm/errors/db-connection-timeout-error.d.ts.map +1 -1
  319. package/dist/esm/errors/execution-cancelled.error.d.ts.map +1 -1
  320. package/dist/esm/errors/expression-class-extension.error.d.ts.map +1 -1
  321. package/dist/esm/errors/expression-computed-destructuring.error.d.ts.map +1 -1
  322. package/dist/esm/errors/expression-destructuring.error.d.ts.map +1 -1
  323. package/dist/esm/errors/expression-reserved-variable.error.d.ts.map +1 -1
  324. package/dist/esm/errors/expression-with-statement.error.d.ts.map +1 -1
  325. package/dist/esm/errors/expression.error.d.ts.map +1 -1
  326. package/dist/esm/errors/node-api.error.d.ts.map +1 -1
  327. package/dist/esm/errors/node-api.error.js.map +1 -1
  328. package/dist/esm/errors/node-operation.error.d.ts.map +1 -1
  329. package/dist/esm/errors/node-operation.error.js.map +1 -1
  330. package/dist/esm/errors/node-ssl.error.d.ts.map +1 -1
  331. package/dist/esm/errors/subworkflow-operation.error.d.ts.map +1 -1
  332. package/dist/esm/errors/trigger-close.error.d.ts.map +1 -1
  333. package/dist/esm/errors/trigger-close.error.js.map +1 -1
  334. package/dist/esm/errors/webhook-taken.error.d.ts.map +1 -1
  335. package/dist/esm/errors/workflow-activation.error.d.ts.map +1 -1
  336. package/dist/esm/errors/workflow-activation.error.js.map +1 -1
  337. package/dist/esm/errors/workflow-operation.error.d.ts.map +1 -1
  338. package/dist/esm/execution-context-establishment-hooks.d.ts.map +1 -1
  339. package/dist/esm/execution-context-establishment-hooks.js +7 -3
  340. package/dist/esm/execution-context-establishment-hooks.js.map +1 -1
  341. package/dist/esm/execution-context.d.ts +14 -14
  342. package/dist/esm/execution-context.d.ts.map +1 -1
  343. package/dist/esm/execution-status.d.ts +2 -2
  344. package/dist/esm/execution-status.d.ts.map +1 -1
  345. package/dist/esm/expression-evaluator-proxy.d.ts.map +1 -1
  346. package/dist/esm/expression-sandboxing.d.ts.map +1 -1
  347. package/dist/esm/expression-sandboxing.js.map +1 -1
  348. package/dist/esm/expression.d.ts.map +1 -1
  349. package/dist/esm/expression.js.map +1 -1
  350. package/dist/esm/expressions/expression-helpers.d.ts.map +1 -1
  351. package/dist/esm/extensions/boolean-extensions.d.ts +1 -1
  352. package/dist/esm/extensions/expression-extension.d.ts.map +1 -1
  353. package/dist/esm/extensions/expression-parser.d.ts.map +1 -1
  354. package/dist/esm/extensions/extended-functions.d.ts +10 -18
  355. package/dist/esm/extensions/extended-functions.d.ts.map +1 -1
  356. package/dist/esm/extensions/number-extensions.js.map +1 -1
  357. package/dist/esm/extensions/string-extensions.d.ts +1 -1
  358. package/dist/esm/extensions/string-extensions.d.ts.map +1 -1
  359. package/dist/esm/extensions/string-extensions.js.map +1 -1
  360. package/dist/esm/extensions/utils.d.ts.map +1 -1
  361. package/dist/esm/from-ai-parse-utils.js.map +1 -1
  362. package/dist/esm/interfaces.d.ts +112 -22
  363. package/dist/esm/interfaces.d.ts.map +1 -1
  364. package/dist/esm/interfaces.js.map +1 -1
  365. package/dist/esm/logger-proxy.d.ts.map +1 -1
  366. package/dist/esm/message-event-bus.d.ts +184 -165
  367. package/dist/esm/message-event-bus.d.ts.map +1 -1
  368. package/dist/esm/message-event-bus.js +2 -2
  369. package/dist/esm/message-event-bus.js.map +1 -1
  370. package/dist/esm/node-grouping-validation.d.ts +6 -0
  371. package/dist/esm/node-grouping-validation.d.ts.map +1 -1
  372. package/dist/esm/node-grouping-validation.js +34 -5
  373. package/dist/esm/node-grouping-validation.js.map +1 -1
  374. package/dist/esm/node-helpers.d.ts.map +1 -1
  375. package/dist/esm/node-helpers.js +3 -0
  376. package/dist/esm/node-helpers.js.map +1 -1
  377. package/dist/esm/node-parameters/filter-parameter.d.ts.map +1 -1
  378. package/dist/esm/node-parameters/filter-parameter.js.map +1 -1
  379. package/dist/esm/node-reference-parser-utils.js.map +1 -1
  380. package/dist/esm/run-execution-data-factory.js.map +1 -1
  381. package/dist/esm/schemas.d.ts +13 -13
  382. package/dist/esm/schemas.d.ts.map +1 -1
  383. package/dist/esm/schemas.js +1 -0
  384. package/dist/esm/schemas.js.map +1 -1
  385. package/dist/esm/telemetry-helpers.d.ts.map +1 -1
  386. package/dist/esm/telemetry-helpers.js.map +1 -1
  387. package/dist/esm/type-guards.d.ts +3 -3
  388. package/dist/esm/type-guards.d.ts.map +1 -1
  389. package/dist/esm/type-validation.d.ts.map +1 -1
  390. package/dist/esm/type-validation.js.map +1 -1
  391. package/dist/esm/typecheck.tsbuildinfo +1 -1
  392. package/dist/esm/utils.d.ts +2 -2
  393. package/dist/esm/utils.d.ts.map +1 -1
  394. package/dist/esm/utils.js.map +1 -1
  395. package/dist/esm/versioned-node-type.d.ts.map +1 -1
  396. package/dist/esm/workflow-data-proxy.d.ts.map +1 -1
  397. package/dist/esm/workflow-data-proxy.js.map +1 -1
  398. package/dist/esm/workflow-diff.d.ts +2 -1
  399. package/dist/esm/workflow-diff.d.ts.map +1 -1
  400. package/dist/esm/workflow-diff.js +3 -1
  401. package/dist/esm/workflow-diff.js.map +1 -1
  402. package/dist/esm/workflow-expression.d.ts.map +1 -1
  403. package/dist/esm/workflow-expression.js.map +1 -1
  404. package/dist/esm/workflow-structure-validation.d.ts.map +1 -1
  405. package/dist/esm/workflow-structure-validation.js.map +1 -1
  406. package/dist/esm/workflow.d.ts.map +1 -1
  407. package/dist/esm/workflow.js.map +1 -1
  408. package/package.json +9 -8
@@ -1,639 +1,629 @@
1
+ "use strict";
1
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
2
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
3
4
  };
4
- (function (factory) {
5
- if (typeof module === "object" && typeof module.exports === "object") {
6
- var v = factory(require, exports);
7
- if (v !== undefined) module.exports = v;
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.arrayExtensions = void 0;
7
+ exports.average = average;
8
+ exports.toJsonString = toJsonString;
9
+ exports.toInt = toInt;
10
+ exports.toFloat = toFloat;
11
+ exports.toBoolean = toBoolean;
12
+ exports.toDateTime = toDateTime;
13
+ // NOTE: This file is intentionally mirrored in @n8n/expression-runtime/src/extensions/
14
+ // for use inside the isolated VM. Changes here must be reflected there and vice versa.
15
+ // TODO: Eliminate the duplication. The blocker is that @n8n/expression-runtime is
16
+ // Vite-stubbed for browser builds (to exclude isolated-vm), which prevents n8n-workflow
17
+ // from importing these extension utilities directly from the runtime package. Fix by
18
+ // splitting @n8n/expression-runtime into a browser-safe extensions subpath (not stubbed)
19
+ // and a node-only VM entry (stubbed).
20
+ const isEqual_1 = __importDefault(require("lodash/isEqual"));
21
+ const uniqWith_1 = __importDefault(require("lodash/uniqWith"));
22
+ const object_extensions_1 = require("./object-extensions");
23
+ const expression_extension_error_1 = require("../errors/expression-extension.error");
24
+ const expression_error_1 = require("../errors/expression.error");
25
+ const utils_1 = require("../utils");
26
+ function first(value) {
27
+ return value[0];
28
+ }
29
+ function isEmpty(value) {
30
+ return value.length === 0;
31
+ }
32
+ function isNotEmpty(value) {
33
+ return value.length > 0;
34
+ }
35
+ function last(value) {
36
+ return value[value.length - 1];
37
+ }
38
+ function pluck(value, extraArgs) {
39
+ if (!Array.isArray(extraArgs)) {
40
+ throw new expression_error_1.ExpressionError('arguments must be passed to pluck');
8
41
  }
9
- else if (typeof define === "function" && define.amd) {
10
- define(["require", "exports", "lodash/isEqual", "lodash/uniqWith", "./object-extensions", "../errors/expression-extension.error", "../errors/expression.error", "../utils"], factory);
42
+ if (!extraArgs || extraArgs.length === 0) {
43
+ return value;
11
44
  }
12
- })(function (require, exports) {
13
- "use strict";
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.arrayExtensions = void 0;
16
- exports.average = average;
17
- exports.toJsonString = toJsonString;
18
- exports.toInt = toInt;
19
- exports.toFloat = toFloat;
20
- exports.toBoolean = toBoolean;
21
- exports.toDateTime = toDateTime;
22
- // NOTE: This file is intentionally mirrored in @n8n/expression-runtime/src/extensions/
23
- // for use inside the isolated VM. Changes here must be reflected there and vice versa.
24
- // TODO: Eliminate the duplication. The blocker is that @n8n/expression-runtime is
25
- // Vite-stubbed for browser builds (to exclude isolated-vm), which prevents n8n-workflow
26
- // from importing these extension utilities directly from the runtime package. Fix by
27
- // splitting @n8n/expression-runtime into a browser-safe extensions subpath (not stubbed)
28
- // and a node-only VM entry (stubbed).
29
- const isEqual_1 = __importDefault(require("lodash/isEqual"));
30
- const uniqWith_1 = __importDefault(require("lodash/uniqWith"));
31
- const object_extensions_1 = require("./object-extensions");
32
- const expression_extension_error_1 = require("../errors/expression-extension.error");
33
- const expression_error_1 = require("../errors/expression.error");
34
- const utils_1 = require("../utils");
35
- function first(value) {
36
- return value[0];
37
- }
38
- function isEmpty(value) {
39
- return value.length === 0;
40
- }
41
- function isNotEmpty(value) {
42
- return value.length > 0;
43
- }
44
- function last(value) {
45
- return value[value.length - 1];
46
- }
47
- function pluck(value, extraArgs) {
48
- if (!Array.isArray(extraArgs)) {
49
- throw new expression_error_1.ExpressionError('arguments must be passed to pluck');
50
- }
51
- if (!extraArgs || extraArgs.length === 0) {
52
- return value;
53
- }
54
- const plucked = value.reduce((pluckedFromObject, current) => {
55
- if (current && typeof current === 'object') {
56
- const p = [];
57
- Object.keys(current).forEach((k) => {
58
- extraArgs.forEach((field) => {
59
- if (current && field === k) {
60
- p.push(current[k]);
61
- }
62
- });
45
+ const plucked = value.reduce((pluckedFromObject, current) => {
46
+ if (current && typeof current === 'object') {
47
+ const p = [];
48
+ Object.keys(current).forEach((k) => {
49
+ extraArgs.forEach((field) => {
50
+ if (current && field === k) {
51
+ p.push(current[k]);
52
+ }
63
53
  });
64
- if (p.length > 0) {
65
- pluckedFromObject.push(p.length === 1 ? p[0] : p);
66
- }
67
- }
68
- return pluckedFromObject;
69
- }, new Array());
70
- return plucked;
71
- }
72
- function randomItem(value) {
73
- const len = value === undefined ? 0 : value.length;
74
- return len ? value[(0, utils_1.randomInt)(len)] : undefined;
75
- }
76
- function unique(value, extraArgs) {
77
- const mapForEqualityCheck = (item) => {
78
- if (extraArgs.length > 0 && item && typeof item === 'object') {
79
- return extraArgs.reduce((acc, key) => {
80
- acc[key] = item[key];
81
- return acc;
82
- }, {});
54
+ });
55
+ if (p.length > 0) {
56
+ pluckedFromObject.push(p.length === 1 ? p[0] : p);
83
57
  }
84
- return item;
85
- };
86
- return (0, uniqWith_1.default)(value, (a, b) => (0, isEqual_1.default)(mapForEqualityCheck(a), mapForEqualityCheck(b)));
87
- }
88
- const ensureNumberArray = (arr, { fnName }) => {
89
- if (arr.some((i) => typeof i !== 'number')) {
90
- throw new expression_extension_error_1.ExpressionExtensionError(`${fnName}(): all array elements must be numbers`);
91
58
  }
59
+ return pluckedFromObject;
60
+ }, new Array());
61
+ return plucked;
62
+ }
63
+ function randomItem(value) {
64
+ const len = value === undefined ? 0 : value.length;
65
+ return len ? value[(0, utils_1.randomInt)(len)] : undefined;
66
+ }
67
+ function unique(value, extraArgs) {
68
+ const mapForEqualityCheck = (item) => {
69
+ if (extraArgs.length > 0 && item && typeof item === 'object') {
70
+ return extraArgs.reduce((acc, key) => {
71
+ acc[key] = item[key];
72
+ return acc;
73
+ }, {});
74
+ }
75
+ return item;
92
76
  };
93
- function sum(value) {
94
- ensureNumberArray(value, { fnName: 'sum' });
95
- return value.reduce((p, c) => {
96
- if (typeof c === 'string') {
97
- return p + parseFloat(c);
98
- }
99
- if (typeof c !== 'number') {
100
- return NaN;
101
- }
102
- return p + c;
103
- }, 0);
104
- }
105
- function min(value) {
106
- ensureNumberArray(value, { fnName: 'min' });
107
- return Math.min(...value.map((v) => {
108
- if (typeof v === 'string') {
109
- return parseFloat(v);
110
- }
111
- if (typeof v !== 'number') {
112
- return NaN;
113
- }
114
- return v;
115
- }));
116
- }
117
- function max(value) {
118
- ensureNumberArray(value, { fnName: 'max' });
119
- return Math.max(...value.map((v) => {
120
- if (typeof v === 'string') {
121
- return parseFloat(v);
122
- }
123
- if (typeof v !== 'number') {
124
- return NaN;
125
- }
126
- return v;
127
- }));
77
+ return (0, uniqWith_1.default)(value, (a, b) => (0, isEqual_1.default)(mapForEqualityCheck(a), mapForEqualityCheck(b)));
78
+ }
79
+ const ensureNumberArray = (arr, { fnName }) => {
80
+ if (arr.some((i) => typeof i !== 'number')) {
81
+ throw new expression_extension_error_1.ExpressionExtensionError(`${fnName}(): all array elements must be numbers`);
128
82
  }
129
- function average(value) {
130
- ensureNumberArray(value, { fnName: 'average' });
131
- // This would usually be NaN but I don't think users
132
- // will expect that
133
- if (value.length === 0) {
134
- return 0;
83
+ };
84
+ function sum(value) {
85
+ ensureNumberArray(value, { fnName: 'sum' });
86
+ return value.reduce((p, c) => {
87
+ if (typeof c === 'string') {
88
+ return p + parseFloat(c);
135
89
  }
136
- return sum(value) / value.length;
137
- }
138
- function compact(value) {
139
- return value
140
- .filter((v) => {
141
- if (v && typeof v === 'object' && Object.keys(v).length === 0)
142
- return false;
143
- return v !== null && v !== undefined && v !== 'nil' && v !== '';
144
- })
145
- .map((v) => {
146
- if (typeof v === 'object' && v !== null) {
147
- return (0, object_extensions_1.compact)(v);
148
- }
149
- return v;
150
- });
151
- }
152
- function smartJoin(value, extraArgs) {
153
- const [keyField, valueField] = extraArgs;
154
- if (!keyField || !valueField || typeof keyField !== 'string' || typeof valueField !== 'string') {
155
- throw new expression_extension_error_1.ExpressionExtensionError('smartJoin(): expected two string args, e.g. .smartJoin("name", "value")');
90
+ if (typeof c !== 'number') {
91
+ return NaN;
156
92
  }
157
- // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-return
158
- return value.reduce((o, v) => {
159
- if (typeof v === 'object' && v !== null && keyField in v && valueField in v) {
160
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any
161
- o[v[keyField]] = v[valueField];
162
- }
163
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
164
- return o;
165
- }, {});
166
- }
167
- function chunk(value, extraArgs) {
168
- const [chunkSize] = extraArgs;
169
- if (typeof chunkSize !== 'number' || chunkSize === 0) {
170
- throw new expression_extension_error_1.ExpressionExtensionError('chunk(): expected non-zero numeric arg, e.g. .chunk(5)');
93
+ return p + c;
94
+ }, 0);
95
+ }
96
+ function min(value) {
97
+ ensureNumberArray(value, { fnName: 'min' });
98
+ return Math.min(...value.map((v) => {
99
+ if (typeof v === 'string') {
100
+ return parseFloat(v);
171
101
  }
172
- const chunks = [];
173
- for (let i = 0; i < value.length; i += chunkSize) {
174
- // I have no clue why eslint thinks 2 numbers could be anything but that but here we are
175
- chunks.push(value.slice(i, i + chunkSize));
102
+ if (typeof v !== 'number') {
103
+ return NaN;
176
104
  }
177
- return chunks;
105
+ return v;
106
+ }));
107
+ }
108
+ function max(value) {
109
+ ensureNumberArray(value, { fnName: 'max' });
110
+ return Math.max(...value.map((v) => {
111
+ if (typeof v === 'string') {
112
+ return parseFloat(v);
113
+ }
114
+ if (typeof v !== 'number') {
115
+ return NaN;
116
+ }
117
+ return v;
118
+ }));
119
+ }
120
+ function average(value) {
121
+ ensureNumberArray(value, { fnName: 'average' });
122
+ // This would usually be NaN but I don't think users
123
+ // will expect that
124
+ if (value.length === 0) {
125
+ return 0;
178
126
  }
179
- function renameKeys(value, extraArgs) {
180
- if (extraArgs.length === 0 || extraArgs.length % 2 !== 0) {
181
- throw new expression_extension_error_1.ExpressionExtensionError('renameKeys(): expected an even amount of args: from1, to1 [, from2, to2, ...]. e.g. .renameKeys("name", "title")');
127
+ return sum(value) / value.length;
128
+ }
129
+ function compact(value) {
130
+ return value
131
+ .filter((v) => {
132
+ if (v && typeof v === 'object' && Object.keys(v).length === 0)
133
+ return false;
134
+ return v !== null && v !== undefined && v !== 'nil' && v !== '';
135
+ })
136
+ .map((v) => {
137
+ if (typeof v === 'object' && v !== null) {
138
+ return (0, object_extensions_1.compact)(v);
182
139
  }
183
- return value.map((v) => {
184
- if (typeof v !== 'object' || v === null) {
185
- return v;
186
- }
187
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-explicit-any
188
- const newObj = { ...v };
189
- const chunkedArgs = chunk(extraArgs, [2]);
190
- chunkedArgs.forEach(([from, to]) => {
191
- if (from in newObj) {
192
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
193
- newObj[to] = newObj[from];
194
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
195
- delete newObj[from];
196
- }
197
- });
198
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
199
- return newObj;
200
- });
140
+ return v;
141
+ });
142
+ }
143
+ function smartJoin(value, extraArgs) {
144
+ const [keyField, valueField] = extraArgs;
145
+ if (!keyField || !valueField || typeof keyField !== 'string' || typeof valueField !== 'string') {
146
+ throw new expression_extension_error_1.ExpressionExtensionError('smartJoin(): expected two string args, e.g. .smartJoin("name", "value")');
201
147
  }
202
- function mergeObjects(value, extraArgs) {
203
- const [other] = extraArgs;
204
- if (!other) {
205
- return value;
148
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-return
149
+ return value.reduce((o, v) => {
150
+ if (typeof v === 'object' && v !== null && keyField in v && valueField in v) {
151
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any
152
+ o[v[keyField]] = v[valueField];
206
153
  }
207
- if (typeof other !== 'object') {
208
- throw new expression_extension_error_1.ExpressionExtensionError('merge(): expected object arg');
154
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
155
+ return o;
156
+ }, {});
157
+ }
158
+ function chunk(value, extraArgs) {
159
+ const [chunkSize] = extraArgs;
160
+ if (typeof chunkSize !== 'number' || chunkSize === 0) {
161
+ throw new expression_extension_error_1.ExpressionExtensionError('chunk(): expected non-zero numeric arg, e.g. .chunk(5)');
162
+ }
163
+ const chunks = [];
164
+ for (let i = 0; i < value.length; i += chunkSize) {
165
+ // I have no clue why eslint thinks 2 numbers could be anything but that but here we are
166
+ chunks.push(value.slice(i, i + chunkSize));
167
+ }
168
+ return chunks;
169
+ }
170
+ function renameKeys(value, extraArgs) {
171
+ if (extraArgs.length === 0 || extraArgs.length % 2 !== 0) {
172
+ throw new expression_extension_error_1.ExpressionExtensionError('renameKeys(): expected an even amount of args: from1, to1 [, from2, to2, ...]. e.g. .renameKeys("name", "title")');
173
+ }
174
+ return value.map((v) => {
175
+ if (typeof v !== 'object' || v === null) {
176
+ return v;
209
177
  }
210
- const newObject = { ...value };
211
- for (const [key, val] of Object.entries(other)) {
212
- if (!(key in newObject)) {
213
- newObject[key] = val;
178
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-explicit-any
179
+ const newObj = { ...v };
180
+ const chunkedArgs = chunk(extraArgs, [2]);
181
+ chunkedArgs.forEach(([from, to]) => {
182
+ if (from in newObj) {
183
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
184
+ newObj[to] = newObj[from];
185
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
186
+ delete newObj[from];
214
187
  }
215
- }
216
- return newObject;
188
+ });
189
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
190
+ return newObj;
191
+ });
192
+ }
193
+ function mergeObjects(value, extraArgs) {
194
+ const [other] = extraArgs;
195
+ if (!other) {
196
+ return value;
217
197
  }
218
- function merge(value, extraArgs) {
219
- const [others] = extraArgs;
220
- if (others === undefined) {
221
- // If there are no arguments passed, merge all objects within the array
222
- const merged = value.reduce((combined, current) => {
223
- if (current !== null && typeof current === 'object' && !Array.isArray(current)) {
224
- combined = mergeObjects(combined, [current]);
225
- }
226
- return combined;
227
- }, {});
228
- return merged;
229
- }
230
- if (!Array.isArray(others)) {
231
- throw new expression_extension_error_1.ExpressionExtensionError('merge(): expected array arg, e.g. .merge([{ id: 1, otherValue: 3 }])');
198
+ if (typeof other !== 'object') {
199
+ throw new expression_extension_error_1.ExpressionExtensionError('merge(): expected object arg');
200
+ }
201
+ const newObject = { ...value };
202
+ for (const [key, val] of Object.entries(other)) {
203
+ if (!(key in newObject)) {
204
+ newObject[key] = val;
232
205
  }
233
- const listLength = value.length > others.length ? value.length : others.length;
234
- let merged = {};
235
- for (let i = 0; i < listLength; i++) {
236
- if (value[i] !== undefined) {
237
- if (typeof value[i] === 'object' && typeof others[i] === 'object') {
238
- merged = Object.assign(merged, mergeObjects(value[i], [others[i]]));
239
- }
206
+ }
207
+ return newObject;
208
+ }
209
+ function merge(value, extraArgs) {
210
+ const [others] = extraArgs;
211
+ if (others === undefined) {
212
+ // If there are no arguments passed, merge all objects within the array
213
+ const merged = value.reduce((combined, current) => {
214
+ if (current !== null && typeof current === 'object' && !Array.isArray(current)) {
215
+ combined = mergeObjects(combined, [current]);
240
216
  }
241
- }
217
+ return combined;
218
+ }, {});
242
219
  return merged;
243
220
  }
244
- function union(value, extraArgs) {
245
- const [others] = extraArgs;
246
- if (!Array.isArray(others)) {
247
- throw new expression_extension_error_1.ExpressionExtensionError('union(): expected array arg, e.g. .union([1, 2, 3, 4])');
248
- }
249
- const newArr = Array.from(value);
250
- for (const v of others) {
251
- if (newArr.findIndex((w) => (0, isEqual_1.default)(w, v)) === -1) {
252
- newArr.push(v);
253
- }
254
- }
255
- return unique(newArr, []);
221
+ if (!Array.isArray(others)) {
222
+ throw new expression_extension_error_1.ExpressionExtensionError('merge(): expected array arg, e.g. .merge([{ id: 1, otherValue: 3 }])');
256
223
  }
257
- function difference(value, extraArgs) {
258
- const [others] = extraArgs;
259
- if (!Array.isArray(others)) {
260
- throw new expression_extension_error_1.ExpressionExtensionError('difference(): expected array arg, e.g. .difference([1, 2, 3, 4])');
261
- }
262
- const newArr = [];
263
- for (const v of value) {
264
- if (others.findIndex((w) => (0, isEqual_1.default)(w, v)) === -1) {
265
- newArr.push(v);
224
+ const listLength = value.length > others.length ? value.length : others.length;
225
+ let merged = {};
226
+ for (let i = 0; i < listLength; i++) {
227
+ if (value[i] !== undefined) {
228
+ if (typeof value[i] === 'object' && typeof others[i] === 'object') {
229
+ merged = Object.assign(merged, mergeObjects(value[i], [others[i]]));
266
230
  }
267
231
  }
268
- return unique(newArr, []);
269
232
  }
270
- function intersection(value, extraArgs) {
271
- const [others] = extraArgs;
272
- if (!Array.isArray(others)) {
273
- throw new expression_extension_error_1.ExpressionExtensionError('intersection(): expected array arg, e.g. .intersection([1, 2, 3, 4])');
274
- }
275
- const newArr = [];
276
- for (const v of value) {
277
- if (others.findIndex((w) => (0, isEqual_1.default)(w, v)) !== -1) {
278
- newArr.push(v);
279
- }
280
- }
281
- for (const v of others) {
282
- if (value.findIndex((w) => (0, isEqual_1.default)(w, v)) !== -1) {
283
- newArr.push(v);
284
- }
285
- }
286
- return unique(newArr, []);
233
+ return merged;
234
+ }
235
+ function union(value, extraArgs) {
236
+ const [others] = extraArgs;
237
+ if (!Array.isArray(others)) {
238
+ throw new expression_extension_error_1.ExpressionExtensionError('union(): expected array arg, e.g. .union([1, 2, 3, 4])');
287
239
  }
288
- function append(value, extraArgs) {
289
- return value.concat(extraArgs);
240
+ const newArr = Array.from(value);
241
+ for (const v of others) {
242
+ if (newArr.findIndex((w) => (0, isEqual_1.default)(w, v)) === -1) {
243
+ newArr.push(v);
244
+ }
290
245
  }
291
- function toJsonString(value) {
292
- return JSON.stringify(value);
246
+ return unique(newArr, []);
247
+ }
248
+ function difference(value, extraArgs) {
249
+ const [others] = extraArgs;
250
+ if (!Array.isArray(others)) {
251
+ throw new expression_extension_error_1.ExpressionExtensionError('difference(): expected array arg, e.g. .difference([1, 2, 3, 4])');
293
252
  }
294
- function toInt() {
295
- return undefined;
253
+ const newArr = [];
254
+ for (const v of value) {
255
+ if (others.findIndex((w) => (0, isEqual_1.default)(w, v)) === -1) {
256
+ newArr.push(v);
257
+ }
296
258
  }
297
- function toFloat() {
298
- return undefined;
259
+ return unique(newArr, []);
260
+ }
261
+ function intersection(value, extraArgs) {
262
+ const [others] = extraArgs;
263
+ if (!Array.isArray(others)) {
264
+ throw new expression_extension_error_1.ExpressionExtensionError('intersection(): expected array arg, e.g. .intersection([1, 2, 3, 4])');
299
265
  }
300
- function toBoolean() {
301
- return undefined;
266
+ const newArr = [];
267
+ for (const v of value) {
268
+ if (others.findIndex((w) => (0, isEqual_1.default)(w, v)) !== -1) {
269
+ newArr.push(v);
270
+ }
302
271
  }
303
- function toDateTime() {
304
- return undefined;
272
+ for (const v of others) {
273
+ if (value.findIndex((w) => (0, isEqual_1.default)(w, v)) !== -1) {
274
+ newArr.push(v);
275
+ }
305
276
  }
306
- average.doc = {
307
- name: 'average',
308
- aliases: ['mean'],
309
- description: 'Returns the average of the numbers in the array. Throws an error if there are any non-numbers.',
310
- examples: [{ example: '[12, 1, 5].average()', evaluated: '6' }],
311
- returnType: 'number',
312
- docURL: 'https://docs.n8n.io/code/builtin/data-transformation-functions/arrays/#array-average',
313
- };
314
- compact.doc = {
315
- name: 'compact',
316
- aliases: ['removeEmpty'],
317
- description: 'Removes any empty values from the array. <code>null</code>, <code>""</code> and <code>undefined</code> count as empty.',
318
- examples: [{ example: '[2, null, 1, ""].compact()', evaluated: '[2, 1]' }],
319
- returnType: 'Array',
320
- docURL: 'https://docs.n8n.io/code/builtin/data-transformation-functions/arrays/#array-compact',
321
- };
322
- isEmpty.doc = {
323
- name: 'isEmpty',
324
- description: 'Returns <code>true</code> if the array has no elements or is <code>null</code>',
325
- examples: [
326
- { example: '[].isEmpty()', evaluated: 'true' },
327
- { example: "['quick', 'brown', 'fox'].isEmpty()", evaluated: 'false' },
328
- ],
329
- returnType: 'boolean',
330
- docURL: 'https://docs.n8n.io/code/builtin/data-transformation-functions/arrays/#array-isEmpty',
331
- };
332
- isNotEmpty.doc = {
333
- name: 'isNotEmpty',
334
- description: 'Returns <code>true</code> if the array has at least one element',
335
- examples: [
336
- { example: "['quick', 'brown', 'fox'].isNotEmpty()", evaluated: 'true' },
337
- { example: '[].isNotEmpty()', evaluated: 'false' },
338
- ],
339
- returnType: 'boolean',
340
- docURL: 'https://docs.n8n.io/code/builtin/data-transformation-functions/arrays/#array-isNotEmpty',
341
- };
342
- first.doc = {
343
- name: 'first',
344
- aliases: ['head'],
345
- description: 'Returns the first element of the array',
346
- examples: [{ example: "['quick', 'brown', 'fox'].first()", evaluated: "'quick'" }],
347
- returnType: 'any',
348
- docURL: 'https://docs.n8n.io/code/builtin/data-transformation-functions/arrays/#array-first',
349
- };
350
- last.doc = {
351
- name: 'last',
352
- aliases: ['tail'],
353
- description: 'Returns the last element of the array',
354
- examples: [{ example: "['quick', 'brown', 'fox'].last()", evaluated: "'fox'" }],
355
- returnType: 'any',
356
- docURL: 'https://docs.n8n.io/code/builtin/data-transformation-functions/arrays/#array-last',
357
- };
358
- max.doc = {
359
- name: 'max',
360
- description: 'Returns the largest number in the array. Throws an error if there are any non-numbers.',
361
- examples: [{ example: '[1, 12, 5].max()', evaluated: '12' }],
362
- returnType: 'number',
363
- docURL: 'https://docs.n8n.io/code/builtin/data-transformation-functions/arrays/#array-max',
364
- };
365
- min.doc = {
366
- name: 'min',
367
- description: 'Returns the smallest number in the array. Throws an error if there are any non-numbers.',
368
- examples: [{ example: '[12, 1, 5].min()', evaluated: '1' }],
369
- returnType: 'number',
370
- docURL: 'https://docs.n8n.io/code/builtin/data-transformation-functions/arrays/#array-min',
371
- };
372
- randomItem.doc = {
373
- name: 'randomItem',
374
- description: 'Returns a randomly-chosen element from the array',
375
- examples: [
376
- { example: "['quick', 'brown', 'fox'].randomItem()", evaluated: "'brown'" },
377
- { example: "['quick', 'brown', 'fox'].randomItem()", evaluated: "'quick'" },
378
- ],
379
- returnType: 'any',
380
- docURL: 'https://docs.n8n.io/code/builtin/data-transformation-functions/arrays/#array-randomItem',
381
- };
382
- sum.doc = {
383
- name: 'sum',
384
- description: 'Returns the total of all the numbers in the array. Throws an error if there are any non-numbers.',
385
- examples: [{ example: '[12, 1, 5].sum()', evaluated: '18' }],
386
- returnType: 'number',
387
- docURL: 'https://docs.n8n.io/code/builtin/data-transformation-functions/arrays/#array-sum',
388
- };
389
- chunk.doc = {
390
- name: 'chunk',
391
- description: 'Splits the array into an array of sub-arrays, each with the given length',
392
- examples: [{ example: '[1, 2, 3, 4, 5, 6].chunk(2)', evaluated: '[[1,2],[3,4],[5,6]]' }],
393
- returnType: 'Array',
394
- args: [
395
- {
396
- name: 'length',
397
- optional: false,
398
- description: 'The number of elements in each chunk',
399
- type: 'number',
400
- },
401
- ],
402
- docURL: 'https://docs.n8n.io/code/builtin/data-transformation-functions/arrays/#array-chunk',
403
- };
404
- difference.doc = {
405
- name: 'difference',
406
- description: "Compares two arrays. Returns all elements in the base array that aren't present\nin <code>otherArray</code>.",
407
- examples: [{ example: '[1, 2, 3].difference([2, 3])', evaluated: '[1]' }],
408
- returnType: 'Array',
409
- args: [
410
- {
411
- name: 'otherArray',
412
- optional: false,
413
- description: 'The array to compare to the base array',
414
- type: 'Array',
415
- },
416
- ],
417
- docURL: 'https://docs.n8n.io/code/builtin/data-transformation-functions/arrays/#array-difference',
418
- };
419
- intersection.doc = {
420
- name: 'intersection',
421
- description: 'Compares two arrays. Returns all elements in the base array that are also present in the other array.',
422
- examples: [{ example: '[1, 2].intersection([2, 3])', evaluated: '[2]' }],
423
- returnType: 'Array',
424
- args: [
425
- {
426
- name: 'otherArray',
427
- optional: false,
428
- description: 'The array to compare to the base array',
429
- type: 'Array',
430
- },
431
- ],
432
- docURL: 'https://docs.n8n.io/code/builtin/data-transformation-functions/arrays/#array-intersection',
433
- };
434
- merge.doc = {
435
- name: 'merge',
436
- description: 'Merges two Object-arrays into one object by merging the key-value pairs of each element.',
437
- examples: [
438
- {
439
- example: "[{ name: 'Nathan' }, { age: 42 }].merge([{ city: 'Berlin' }, { country: 'Germany' }])",
440
- evaluated: "{ name: 'Nathan', age: 42, city: 'Berlin', country: 'Germany' }",
441
- },
442
- ],
443
- returnType: 'Object',
444
- args: [
445
- {
446
- name: 'otherArray',
447
- optional: false,
448
- description: 'The array to merge into the base array',
449
- type: 'Array',
450
- },
451
- ],
452
- docURL: 'https://docs.n8n.io/code/builtin/data-transformation-functions/arrays/#array-merge',
453
- };
454
- pluck.doc = {
455
- name: 'pluck',
456
- description: 'Returns an array containing the values of the given field(s) in each Object of the array. Ignores any array elements that aren’t Objects or don’t have a key matching the field name(s) provided.',
457
- examples: [
458
- {
459
- example: "[{ name: 'Nathan', age: 42 },{ name: 'Jan', city: 'Berlin' }].pluck('name')",
460
- evaluated: '["Nathan", "Jan"]',
461
- },
462
- {
463
- example: "[{ name: 'Nathan', age: 42 },{ name: 'Jan', city: 'Berlin' }].pluck('age')",
464
- evaluated: '[42]',
465
- },
466
- ],
467
- returnType: 'Array',
468
- args: [
469
- {
470
- name: 'fieldNames',
471
- optional: false,
472
- variadic: true,
473
- description: 'The keys to retrieve the value of',
474
- type: 'string',
475
- },
476
- ],
477
- docURL: 'https://docs.n8n.io/code/builtin/data-transformation-functions/arrays/#array-pluck',
478
- };
479
- renameKeys.doc = {
480
- name: 'renameKeys',
481
- description: 'Changes all matching keys (field names) of any Objects in the array. Rename more than one key by\nadding extra arguments, i.e. <code>from1, to1, from2, to2, ...</code>.',
482
- examples: [
483
- {
484
- example: "[{ name: 'bob' }, { name: 'meg' }].renameKeys('name', 'x')",
485
- evaluated: "[{ x: 'bob' }, { x: 'meg' }]",
486
- },
487
- ],
488
- returnType: 'Array',
489
- args: [
490
- {
491
- name: 'from',
492
- optional: false,
493
- description: 'The key to rename',
494
- type: 'string',
495
- },
496
- { name: 'to', optional: false, description: 'The new key name', type: 'string' },
497
- ],
498
- docURL: 'https://docs.n8n.io/code/builtin/data-transformation-functions/arrays/#array-renameKeys',
499
- };
500
- smartJoin.doc = {
501
- name: 'smartJoin',
502
- description: 'Creates a single Object from an array of Objects. Each Object in the array provides one field for the returned Object. Each Object in the array must contain a field with the key name and a field with the value.',
503
- examples: [
504
- {
505
- example: "[{ field: 'age', value: 2 }, { field: 'city', value: 'Berlin' }].smartJoin('field', 'value')",
506
- evaluated: "{ age: 2, city: 'Berlin' }",
507
- },
508
- ],
509
- returnType: 'Object',
510
- args: [
511
- {
512
- name: 'keyField',
513
- optional: false,
514
- description: 'The field in each Object containing the key name',
515
- type: 'string',
516
- },
517
- {
518
- name: 'nameField',
519
- optional: false,
520
- description: 'The field in each Object containing the value',
521
- type: 'string',
522
- },
523
- ],
524
- docURL: 'https://docs.n8n.io/code/builtin/data-transformation-functions/arrays/#array-smartJoin',
525
- };
526
- union.doc = {
527
- name: 'union',
528
- description: 'Concatenates two arrays and then removes any duplicates',
529
- examples: [{ example: '[1, 2].union([2, 3])', evaluated: '[1, 2, 3]' }],
530
- returnType: 'Array',
531
- args: [
532
- {
533
- name: 'otherArray',
534
- optional: false,
535
- description: 'The array to union with the base array',
536
- type: 'Array',
537
- },
538
- ],
539
- docURL: 'https://docs.n8n.io/code/builtin/data-transformation-functions/arrays/#array-union',
540
- };
541
- unique.doc = {
542
- name: 'unique',
543
- description: 'Removes any duplicate elements from the array',
544
- examples: [
545
- { example: "['quick', 'brown', 'quick'].unique()", evaluated: "['quick', 'brown']" },
546
- {
547
- example: "[{ name: 'Nathan', age: 42 }, { name: 'Nathan', age: 22 }].unique()",
548
- evaluated: "[{ name: 'Nathan', age: 42 }, { name: 'Nathan', age: 22 }]",
549
- },
550
- {
551
- example: "[{ name: 'Nathan', age: 42 }, { name: 'Nathan', age: 22 }].unique('name')",
552
- evaluated: "[{ name: 'Nathan', age: 42 }]",
553
- },
554
- ],
555
- returnType: 'any',
556
- aliases: ['removeDuplicates'],
557
- docURL: 'https://docs.n8n.io/code/builtin/data-transformation-functions/arrays/#array-unique',
558
- args: [
559
- {
560
- name: 'fieldNames',
561
- optional: false,
562
- variadic: true,
563
- description: 'The object keys to check for equality',
564
- type: 'any',
565
- },
566
- ],
567
- };
568
- toJsonString.doc = {
569
- name: 'toJsonString',
570
- description: "Converts the array to a JSON string. The same as JavaScript's <code>JSON.stringify()</code>.",
571
- examples: [
572
- {
573
- example: "['quick', 'brown', 'fox'].toJsonString()",
574
- evaluated: '\'["quick","brown","fox"]\'',
575
- },
576
- ],
577
- docURL: 'https://docs.n8n.io/code/builtin/data-transformation-functions/arrays/#array-toJsonString',
578
- returnType: 'string',
579
- };
580
- append.doc = {
581
- name: 'append',
582
- aliases: ['push'],
583
- description: 'Adds new elements to the end of the array. Similar to <code>push()</code>, but returns the modified array. Consider using spread syntax instead (see examples).',
584
- examples: [
585
- { example: "['forget', 'me'].append('not')", evaluated: "['forget', 'me', 'not']" },
586
- { example: '[9, 0, 2].append(1, 0)', evaluated: '[9, 0, 2, 1, 0]' },
587
- {
588
- example: '[...[9, 0, 2], 1, 0]',
589
- evaluated: '[9, 0, 2, 1, 0]',
590
- description: 'Consider using spread syntax instead',
591
- },
592
- ],
593
- docURL: 'https://docs.n8n.io/code/builtin/data-transformation-functions/arrays/#array-append',
594
- returnType: 'Array',
595
- args: [
596
- {
597
- name: 'elements',
598
- optional: false,
599
- variadic: true,
600
- description: 'The elements to append, in order',
601
- type: 'any',
602
- },
603
- ],
604
- };
605
- const removeDuplicates = unique.bind({});
606
- removeDuplicates.doc = { ...unique.doc, hidden: true };
607
- exports.arrayExtensions = {
608
- typeName: 'Array',
609
- functions: {
610
- removeDuplicates,
611
- unique,
612
- first,
613
- last,
614
- pluck,
615
- randomItem,
616
- sum,
617
- min,
618
- max,
619
- average,
620
- isNotEmpty,
621
- isEmpty,
622
- compact,
623
- smartJoin,
624
- chunk,
625
- renameKeys,
626
- merge,
627
- union,
628
- difference,
629
- intersection,
630
- append,
631
- toJsonString,
632
- toInt,
633
- toFloat,
634
- toBoolean,
635
- toDateTime,
277
+ return unique(newArr, []);
278
+ }
279
+ function append(value, extraArgs) {
280
+ return value.concat(extraArgs);
281
+ }
282
+ function toJsonString(value) {
283
+ return JSON.stringify(value);
284
+ }
285
+ function toInt() {
286
+ return undefined;
287
+ }
288
+ function toFloat() {
289
+ return undefined;
290
+ }
291
+ function toBoolean() {
292
+ return undefined;
293
+ }
294
+ function toDateTime() {
295
+ return undefined;
296
+ }
297
+ average.doc = {
298
+ name: 'average',
299
+ aliases: ['mean'],
300
+ description: 'Returns the average of the numbers in the array. Throws an error if there are any non-numbers.',
301
+ examples: [{ example: '[12, 1, 5].average()', evaluated: '6' }],
302
+ returnType: 'number',
303
+ docURL: 'https://docs.n8n.io/code/builtin/data-transformation-functions/arrays/#array-average',
304
+ };
305
+ compact.doc = {
306
+ name: 'compact',
307
+ aliases: ['removeEmpty'],
308
+ description: 'Removes any empty values from the array. <code>null</code>, <code>""</code> and <code>undefined</code> count as empty.',
309
+ examples: [{ example: '[2, null, 1, ""].compact()', evaluated: '[2, 1]' }],
310
+ returnType: 'Array',
311
+ docURL: 'https://docs.n8n.io/code/builtin/data-transformation-functions/arrays/#array-compact',
312
+ };
313
+ isEmpty.doc = {
314
+ name: 'isEmpty',
315
+ description: 'Returns <code>true</code> if the array has no elements or is <code>null</code>',
316
+ examples: [
317
+ { example: '[].isEmpty()', evaluated: 'true' },
318
+ { example: "['quick', 'brown', 'fox'].isEmpty()", evaluated: 'false' },
319
+ ],
320
+ returnType: 'boolean',
321
+ docURL: 'https://docs.n8n.io/code/builtin/data-transformation-functions/arrays/#array-isEmpty',
322
+ };
323
+ isNotEmpty.doc = {
324
+ name: 'isNotEmpty',
325
+ description: 'Returns <code>true</code> if the array has at least one element',
326
+ examples: [
327
+ { example: "['quick', 'brown', 'fox'].isNotEmpty()", evaluated: 'true' },
328
+ { example: '[].isNotEmpty()', evaluated: 'false' },
329
+ ],
330
+ returnType: 'boolean',
331
+ docURL: 'https://docs.n8n.io/code/builtin/data-transformation-functions/arrays/#array-isNotEmpty',
332
+ };
333
+ first.doc = {
334
+ name: 'first',
335
+ aliases: ['head'],
336
+ description: 'Returns the first element of the array',
337
+ examples: [{ example: "['quick', 'brown', 'fox'].first()", evaluated: "'quick'" }],
338
+ returnType: 'any',
339
+ docURL: 'https://docs.n8n.io/code/builtin/data-transformation-functions/arrays/#array-first',
340
+ };
341
+ last.doc = {
342
+ name: 'last',
343
+ aliases: ['tail'],
344
+ description: 'Returns the last element of the array',
345
+ examples: [{ example: "['quick', 'brown', 'fox'].last()", evaluated: "'fox'" }],
346
+ returnType: 'any',
347
+ docURL: 'https://docs.n8n.io/code/builtin/data-transformation-functions/arrays/#array-last',
348
+ };
349
+ max.doc = {
350
+ name: 'max',
351
+ description: 'Returns the largest number in the array. Throws an error if there are any non-numbers.',
352
+ examples: [{ example: '[1, 12, 5].max()', evaluated: '12' }],
353
+ returnType: 'number',
354
+ docURL: 'https://docs.n8n.io/code/builtin/data-transformation-functions/arrays/#array-max',
355
+ };
356
+ min.doc = {
357
+ name: 'min',
358
+ description: 'Returns the smallest number in the array. Throws an error if there are any non-numbers.',
359
+ examples: [{ example: '[12, 1, 5].min()', evaluated: '1' }],
360
+ returnType: 'number',
361
+ docURL: 'https://docs.n8n.io/code/builtin/data-transformation-functions/arrays/#array-min',
362
+ };
363
+ randomItem.doc = {
364
+ name: 'randomItem',
365
+ description: 'Returns a randomly-chosen element from the array',
366
+ examples: [
367
+ { example: "['quick', 'brown', 'fox'].randomItem()", evaluated: "'brown'" },
368
+ { example: "['quick', 'brown', 'fox'].randomItem()", evaluated: "'quick'" },
369
+ ],
370
+ returnType: 'any',
371
+ docURL: 'https://docs.n8n.io/code/builtin/data-transformation-functions/arrays/#array-randomItem',
372
+ };
373
+ sum.doc = {
374
+ name: 'sum',
375
+ description: 'Returns the total of all the numbers in the array. Throws an error if there are any non-numbers.',
376
+ examples: [{ example: '[12, 1, 5].sum()', evaluated: '18' }],
377
+ returnType: 'number',
378
+ docURL: 'https://docs.n8n.io/code/builtin/data-transformation-functions/arrays/#array-sum',
379
+ };
380
+ chunk.doc = {
381
+ name: 'chunk',
382
+ description: 'Splits the array into an array of sub-arrays, each with the given length',
383
+ examples: [{ example: '[1, 2, 3, 4, 5, 6].chunk(2)', evaluated: '[[1,2],[3,4],[5,6]]' }],
384
+ returnType: 'Array',
385
+ args: [
386
+ {
387
+ name: 'length',
388
+ optional: false,
389
+ description: 'The number of elements in each chunk',
390
+ type: 'number',
636
391
  },
637
- };
638
- });
392
+ ],
393
+ docURL: 'https://docs.n8n.io/code/builtin/data-transformation-functions/arrays/#array-chunk',
394
+ };
395
+ difference.doc = {
396
+ name: 'difference',
397
+ description: "Compares two arrays. Returns all elements in the base array that aren't present\nin <code>otherArray</code>.",
398
+ examples: [{ example: '[1, 2, 3].difference([2, 3])', evaluated: '[1]' }],
399
+ returnType: 'Array',
400
+ args: [
401
+ {
402
+ name: 'otherArray',
403
+ optional: false,
404
+ description: 'The array to compare to the base array',
405
+ type: 'Array',
406
+ },
407
+ ],
408
+ docURL: 'https://docs.n8n.io/code/builtin/data-transformation-functions/arrays/#array-difference',
409
+ };
410
+ intersection.doc = {
411
+ name: 'intersection',
412
+ description: 'Compares two arrays. Returns all elements in the base array that are also present in the other array.',
413
+ examples: [{ example: '[1, 2].intersection([2, 3])', evaluated: '[2]' }],
414
+ returnType: 'Array',
415
+ args: [
416
+ {
417
+ name: 'otherArray',
418
+ optional: false,
419
+ description: 'The array to compare to the base array',
420
+ type: 'Array',
421
+ },
422
+ ],
423
+ docURL: 'https://docs.n8n.io/code/builtin/data-transformation-functions/arrays/#array-intersection',
424
+ };
425
+ merge.doc = {
426
+ name: 'merge',
427
+ description: 'Merges two Object-arrays into one object by merging the key-value pairs of each element.',
428
+ examples: [
429
+ {
430
+ example: "[{ name: 'Nathan' }, { age: 42 }].merge([{ city: 'Berlin' }, { country: 'Germany' }])",
431
+ evaluated: "{ name: 'Nathan', age: 42, city: 'Berlin', country: 'Germany' }",
432
+ },
433
+ ],
434
+ returnType: 'Object',
435
+ args: [
436
+ {
437
+ name: 'otherArray',
438
+ optional: false,
439
+ description: 'The array to merge into the base array',
440
+ type: 'Array',
441
+ },
442
+ ],
443
+ docURL: 'https://docs.n8n.io/code/builtin/data-transformation-functions/arrays/#array-merge',
444
+ };
445
+ pluck.doc = {
446
+ name: 'pluck',
447
+ description: 'Returns an array containing the values of the given field(s) in each Object of the array. Ignores any array elements that aren’t Objects or don’t have a key matching the field name(s) provided.',
448
+ examples: [
449
+ {
450
+ example: "[{ name: 'Nathan', age: 42 },{ name: 'Jan', city: 'Berlin' }].pluck('name')",
451
+ evaluated: '["Nathan", "Jan"]',
452
+ },
453
+ {
454
+ example: "[{ name: 'Nathan', age: 42 },{ name: 'Jan', city: 'Berlin' }].pluck('age')",
455
+ evaluated: '[42]',
456
+ },
457
+ ],
458
+ returnType: 'Array',
459
+ args: [
460
+ {
461
+ name: 'fieldNames',
462
+ optional: false,
463
+ variadic: true,
464
+ description: 'The keys to retrieve the value of',
465
+ type: 'string',
466
+ },
467
+ ],
468
+ docURL: 'https://docs.n8n.io/code/builtin/data-transformation-functions/arrays/#array-pluck',
469
+ };
470
+ renameKeys.doc = {
471
+ name: 'renameKeys',
472
+ description: 'Changes all matching keys (field names) of any Objects in the array. Rename more than one key by\nadding extra arguments, i.e. <code>from1, to1, from2, to2, ...</code>.',
473
+ examples: [
474
+ {
475
+ example: "[{ name: 'bob' }, { name: 'meg' }].renameKeys('name', 'x')",
476
+ evaluated: "[{ x: 'bob' }, { x: 'meg' }]",
477
+ },
478
+ ],
479
+ returnType: 'Array',
480
+ args: [
481
+ {
482
+ name: 'from',
483
+ optional: false,
484
+ description: 'The key to rename',
485
+ type: 'string',
486
+ },
487
+ { name: 'to', optional: false, description: 'The new key name', type: 'string' },
488
+ ],
489
+ docURL: 'https://docs.n8n.io/code/builtin/data-transformation-functions/arrays/#array-renameKeys',
490
+ };
491
+ smartJoin.doc = {
492
+ name: 'smartJoin',
493
+ description: 'Creates a single Object from an array of Objects. Each Object in the array provides one field for the returned Object. Each Object in the array must contain a field with the key name and a field with the value.',
494
+ examples: [
495
+ {
496
+ example: "[{ field: 'age', value: 2 }, { field: 'city', value: 'Berlin' }].smartJoin('field', 'value')",
497
+ evaluated: "{ age: 2, city: 'Berlin' }",
498
+ },
499
+ ],
500
+ returnType: 'Object',
501
+ args: [
502
+ {
503
+ name: 'keyField',
504
+ optional: false,
505
+ description: 'The field in each Object containing the key name',
506
+ type: 'string',
507
+ },
508
+ {
509
+ name: 'nameField',
510
+ optional: false,
511
+ description: 'The field in each Object containing the value',
512
+ type: 'string',
513
+ },
514
+ ],
515
+ docURL: 'https://docs.n8n.io/code/builtin/data-transformation-functions/arrays/#array-smartJoin',
516
+ };
517
+ union.doc = {
518
+ name: 'union',
519
+ description: 'Concatenates two arrays and then removes any duplicates',
520
+ examples: [{ example: '[1, 2].union([2, 3])', evaluated: '[1, 2, 3]' }],
521
+ returnType: 'Array',
522
+ args: [
523
+ {
524
+ name: 'otherArray',
525
+ optional: false,
526
+ description: 'The array to union with the base array',
527
+ type: 'Array',
528
+ },
529
+ ],
530
+ docURL: 'https://docs.n8n.io/code/builtin/data-transformation-functions/arrays/#array-union',
531
+ };
532
+ unique.doc = {
533
+ name: 'unique',
534
+ description: 'Removes any duplicate elements from the array',
535
+ examples: [
536
+ { example: "['quick', 'brown', 'quick'].unique()", evaluated: "['quick', 'brown']" },
537
+ {
538
+ example: "[{ name: 'Nathan', age: 42 }, { name: 'Nathan', age: 22 }].unique()",
539
+ evaluated: "[{ name: 'Nathan', age: 42 }, { name: 'Nathan', age: 22 }]",
540
+ },
541
+ {
542
+ example: "[{ name: 'Nathan', age: 42 }, { name: 'Nathan', age: 22 }].unique('name')",
543
+ evaluated: "[{ name: 'Nathan', age: 42 }]",
544
+ },
545
+ ],
546
+ returnType: 'any',
547
+ aliases: ['removeDuplicates'],
548
+ docURL: 'https://docs.n8n.io/code/builtin/data-transformation-functions/arrays/#array-unique',
549
+ args: [
550
+ {
551
+ name: 'fieldNames',
552
+ optional: false,
553
+ variadic: true,
554
+ description: 'The object keys to check for equality',
555
+ type: 'any',
556
+ },
557
+ ],
558
+ };
559
+ toJsonString.doc = {
560
+ name: 'toJsonString',
561
+ description: "Converts the array to a JSON string. The same as JavaScript's <code>JSON.stringify()</code>.",
562
+ examples: [
563
+ {
564
+ example: "['quick', 'brown', 'fox'].toJsonString()",
565
+ evaluated: '\'["quick","brown","fox"]\'',
566
+ },
567
+ ],
568
+ docURL: 'https://docs.n8n.io/code/builtin/data-transformation-functions/arrays/#array-toJsonString',
569
+ returnType: 'string',
570
+ };
571
+ append.doc = {
572
+ name: 'append',
573
+ aliases: ['push'],
574
+ description: 'Adds new elements to the end of the array. Similar to <code>push()</code>, but returns the modified array. Consider using spread syntax instead (see examples).',
575
+ examples: [
576
+ { example: "['forget', 'me'].append('not')", evaluated: "['forget', 'me', 'not']" },
577
+ { example: '[9, 0, 2].append(1, 0)', evaluated: '[9, 0, 2, 1, 0]' },
578
+ {
579
+ example: '[...[9, 0, 2], 1, 0]',
580
+ evaluated: '[9, 0, 2, 1, 0]',
581
+ description: 'Consider using spread syntax instead',
582
+ },
583
+ ],
584
+ docURL: 'https://docs.n8n.io/code/builtin/data-transformation-functions/arrays/#array-append',
585
+ returnType: 'Array',
586
+ args: [
587
+ {
588
+ name: 'elements',
589
+ optional: false,
590
+ variadic: true,
591
+ description: 'The elements to append, in order',
592
+ type: 'any',
593
+ },
594
+ ],
595
+ };
596
+ const removeDuplicates = unique.bind({});
597
+ removeDuplicates.doc = { ...unique.doc, hidden: true };
598
+ exports.arrayExtensions = {
599
+ typeName: 'Array',
600
+ functions: {
601
+ removeDuplicates,
602
+ unique,
603
+ first,
604
+ last,
605
+ pluck,
606
+ randomItem,
607
+ sum,
608
+ min,
609
+ max,
610
+ average,
611
+ isNotEmpty,
612
+ isEmpty,
613
+ compact,
614
+ smartJoin,
615
+ chunk,
616
+ renameKeys,
617
+ merge,
618
+ union,
619
+ difference,
620
+ intersection,
621
+ append,
622
+ toJsonString,
623
+ toInt,
624
+ toFloat,
625
+ toBoolean,
626
+ toDateTime,
627
+ },
628
+ };
639
629
  //# sourceMappingURL=array-extensions.js.map