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,498 +1,488 @@
1
- (function (factory) {
2
- if (typeof module === "object" && typeof module.exports === "object") {
3
- var v = factory(require, exports);
4
- if (v !== undefined) module.exports = v;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.extendTransform = exports.hasNativeMethod = exports.hasExpressionExtension = exports.EXTENSION_OBJECTS = void 0;
4
+ exports.extend = extend;
5
+ exports.extendOptional = extendOptional;
6
+ exports.extendSyntax = extendSyntax;
7
+ const esprima_next_1 = require("esprima-next");
8
+ const luxon_1 = require("luxon");
9
+ const recast_1 = require("recast");
10
+ const util_1 = require("recast/lib/util");
11
+ const array_extensions_1 = require("./array-extensions");
12
+ const boolean_extensions_1 = require("./boolean-extensions");
13
+ const date_extensions_1 = require("./date-extensions");
14
+ const expression_parser_1 = require("./expression-parser");
15
+ const number_extensions_1 = require("./number-extensions");
16
+ const object_extensions_1 = require("./object-extensions");
17
+ const string_extensions_1 = require("./string-extensions");
18
+ const utils_1 = require("./utils");
19
+ const expression_extension_error_1 = require("../errors/expression-extension.error");
20
+ const utils_2 = require("../utils");
21
+ const EXPRESSION_EXTENDER = 'extend';
22
+ const EXPRESSION_EXTENDER_OPTIONAL = 'extendOptional';
23
+ function isEmpty(value) {
24
+ return value === null || value === undefined || !value;
25
+ }
26
+ function isNotEmpty(value) {
27
+ return !isEmpty(value);
28
+ }
29
+ exports.EXTENSION_OBJECTS = [
30
+ array_extensions_1.arrayExtensions,
31
+ date_extensions_1.dateExtensions,
32
+ number_extensions_1.numberExtensions,
33
+ object_extensions_1.objectExtensions,
34
+ string_extensions_1.stringExtensions,
35
+ boolean_extensions_1.booleanExtensions,
36
+ ];
37
+ // eslint-disable-next-line @typescript-eslint/no-restricted-types
38
+ const genericExtensions = {
39
+ isEmpty,
40
+ isNotEmpty,
41
+ };
42
+ const EXPRESSION_EXTENSION_METHODS = Array.from(new Set([
43
+ ...Object.keys(string_extensions_1.stringExtensions.functions),
44
+ ...Object.keys(number_extensions_1.numberExtensions.functions),
45
+ ...Object.keys(date_extensions_1.dateExtensions.functions),
46
+ ...Object.keys(array_extensions_1.arrayExtensions.functions),
47
+ ...Object.keys(object_extensions_1.objectExtensions.functions),
48
+ ...Object.keys(boolean_extensions_1.booleanExtensions.functions),
49
+ ...Object.keys(genericExtensions),
50
+ ]));
51
+ const EXPRESSION_EXTENSION_REGEX = new RegExp(`(\\$if|\\.(${EXPRESSION_EXTENSION_METHODS.join('|')})\\s*(\\?\\.)?)\\s*\\(`);
52
+ const isExpressionExtension = (str) => EXPRESSION_EXTENSION_METHODS.some((m) => m === str);
53
+ const hasExpressionExtension = (str) => EXPRESSION_EXTENSION_REGEX.test(str);
54
+ exports.hasExpressionExtension = hasExpressionExtension;
55
+ const hasNativeMethod = (method) => {
56
+ if ((0, exports.hasExpressionExtension)(method)) {
57
+ return false;
5
58
  }
6
- else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "esprima-next", "luxon", "recast", "recast/lib/util", "./array-extensions", "./boolean-extensions", "./date-extensions", "./expression-parser", "./number-extensions", "./object-extensions", "./string-extensions", "./utils", "../errors/expression-extension.error", "../utils"], factory);
8
- }
9
- })(function (require, exports) {
10
- "use strict";
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.extendTransform = exports.hasNativeMethod = exports.hasExpressionExtension = exports.EXTENSION_OBJECTS = void 0;
13
- exports.extend = extend;
14
- exports.extendOptional = extendOptional;
15
- exports.extendSyntax = extendSyntax;
16
- const esprima_next_1 = require("esprima-next");
17
- const luxon_1 = require("luxon");
18
- const recast_1 = require("recast");
19
- const util_1 = require("recast/lib/util");
20
- const array_extensions_1 = require("./array-extensions");
21
- const boolean_extensions_1 = require("./boolean-extensions");
22
- const date_extensions_1 = require("./date-extensions");
23
- const expression_parser_1 = require("./expression-parser");
24
- const number_extensions_1 = require("./number-extensions");
25
- const object_extensions_1 = require("./object-extensions");
26
- const string_extensions_1 = require("./string-extensions");
27
- const utils_1 = require("./utils");
28
- const expression_extension_error_1 = require("../errors/expression-extension.error");
29
- const utils_2 = require("../utils");
30
- const EXPRESSION_EXTENDER = 'extend';
31
- const EXPRESSION_EXTENDER_OPTIONAL = 'extendOptional';
32
- function isEmpty(value) {
33
- return value === null || value === undefined || !value;
34
- }
35
- function isNotEmpty(value) {
36
- return !isEmpty(value);
37
- }
38
- exports.EXTENSION_OBJECTS = [
39
- array_extensions_1.arrayExtensions,
40
- date_extensions_1.dateExtensions,
41
- number_extensions_1.numberExtensions,
42
- object_extensions_1.objectExtensions,
43
- string_extensions_1.stringExtensions,
44
- boolean_extensions_1.booleanExtensions,
45
- ];
46
- // eslint-disable-next-line @typescript-eslint/no-restricted-types
47
- const genericExtensions = {
48
- isEmpty,
49
- isNotEmpty,
50
- };
51
- const EXPRESSION_EXTENSION_METHODS = Array.from(new Set([
52
- ...Object.keys(string_extensions_1.stringExtensions.functions),
53
- ...Object.keys(number_extensions_1.numberExtensions.functions),
54
- ...Object.keys(date_extensions_1.dateExtensions.functions),
55
- ...Object.keys(array_extensions_1.arrayExtensions.functions),
56
- ...Object.keys(object_extensions_1.objectExtensions.functions),
57
- ...Object.keys(boolean_extensions_1.booleanExtensions.functions),
58
- ...Object.keys(genericExtensions),
59
- ]));
60
- const EXPRESSION_EXTENSION_REGEX = new RegExp(`(\\$if|\\.(${EXPRESSION_EXTENSION_METHODS.join('|')})\\s*(\\?\\.)?)\\s*\\(`);
61
- const isExpressionExtension = (str) => EXPRESSION_EXTENSION_METHODS.some((m) => m === str);
62
- const hasExpressionExtension = (str) => EXPRESSION_EXTENSION_REGEX.test(str);
63
- exports.hasExpressionExtension = hasExpressionExtension;
64
- const hasNativeMethod = (method) => {
65
- if ((0, exports.hasExpressionExtension)(method)) {
59
+ const methods = method
60
+ .replace(/[^\w\s]/gi, ' ')
61
+ .split(' ')
62
+ .filter(Boolean); // DateTime.now().toLocaleString().format() => [DateTime,now,toLocaleString,format]
63
+ return methods.every((methodName) => {
64
+ return [String.prototype, Array.prototype, Number.prototype, Date.prototype].some((nativeType) => {
65
+ if (methodName in nativeType) {
66
+ return true;
67
+ }
66
68
  return false;
67
- }
68
- const methods = method
69
- .replace(/[^\w\s]/gi, ' ')
70
- .split(' ')
71
- .filter(Boolean); // DateTime.now().toLocaleString().format() => [DateTime,now,toLocaleString,format]
72
- return methods.every((methodName) => {
73
- return [String.prototype, Array.prototype, Number.prototype, Date.prototype].some((nativeType) => {
74
- if (methodName in nativeType) {
75
- return true;
76
- }
77
- return false;
78
- });
79
- });
80
- };
81
- exports.hasNativeMethod = hasNativeMethod;
82
- // /**
83
- // * recast's types aren't great and we need to use a lot of anys
84
- // */
85
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
86
- function parseWithEsprimaNext(source, options) {
87
- const ast = (0, esprima_next_1.parse)(source, {
88
- loc: true,
89
- locations: true,
90
- comment: true,
91
- range: (0, util_1.getOption)(options, 'range', false),
92
- tolerant: (0, util_1.getOption)(options, 'tolerant', true),
93
- tokens: true,
94
- jsx: (0, util_1.getOption)(options, 'jsx', false),
95
- sourceType: (0, util_1.getOption)(options, 'sourceType', 'module'),
96
69
  });
97
- return ast;
98
- }
99
- /**
100
- * A function to inject an extender function call into the AST of an expression.
101
- * This uses recast to do the transform.
102
- *
103
- * This function also polyfills optional chaining if using extended functions.
104
- *
105
- * ```ts
106
- * 'a'.method('x') // becomes
107
- * extend('a', 'method', ['x']);
108
- *
109
- * 'a'.first('x').second('y') // becomes
110
- * extend(extend('a', 'first', ['x']), 'second', ['y']));
111
- * ```
112
- */
113
- const extendTransform = (expression) => {
114
- try {
115
- const ast = (0, recast_1.parse)(expression, { parser: { parse: parseWithEsprimaNext } });
116
- let currentChain = 1;
117
- // Polyfill optional chaining
118
- (0, recast_1.visit)(ast, {
119
- // eslint-disable-next-line complexity
120
- visitChainExpression(path) {
121
- this.traverse(path);
122
- const chainNumber = currentChain;
123
- currentChain += 1;
124
- // This is to match behavior in our original expression evaluator (tmpl)
125
- const globalIdentifier = recast_1.types.builders.identifier(typeof window !== 'object' ? 'global' : 'window');
126
- // We want to define all of our commonly used identifiers and member
127
- // expressions now so we don't have to create multiple instances
128
- const undefinedIdentifier = recast_1.types.builders.identifier('undefined');
129
- const cancelIdentifier = recast_1.types.builders.identifier(`chainCancelToken${chainNumber}`);
130
- const valueIdentifier = recast_1.types.builders.identifier(`chainValue${chainNumber}`);
131
- const cancelMemberExpression = recast_1.types.builders.memberExpression(globalIdentifier, cancelIdentifier);
132
- const valueMemberExpression = recast_1.types.builders.memberExpression(globalIdentifier, valueIdentifier);
133
- const patchedStack = [];
134
- // This builds the cancel check. This lets us slide to the end of the expression
135
- // if it's undefined/null at any of the optional points of the chain.
136
- const buildCancelCheckWrapper = (node) => {
137
- return recast_1.types.builders.conditionalExpression(recast_1.types.builders.binaryExpression('===', cancelMemberExpression, recast_1.types.builders.booleanLiteral(true)), undefinedIdentifier, node);
138
- };
139
- // This is just a quick small wrapper to create the assignment expression
140
- // for the running value.
141
- const buildValueAssignWrapper = (node) => {
142
- return recast_1.types.builders.assignmentExpression('=', valueMemberExpression, node);
143
- };
144
- // This builds what actually does the comparison. It wraps the current
145
- // chunk of the expression with a nullish coalescing operator that returns
146
- // undefined if it's null or undefined. We do this because optional chains
147
- // always return undefined if they fail part way, even if the value they
148
- // fail on is null.
149
- const buildOptionalWrapper = (node) => {
150
- return recast_1.types.builders.binaryExpression('===', recast_1.types.builders.logicalExpression('??', buildValueAssignWrapper(node), undefinedIdentifier), undefinedIdentifier);
151
- };
152
- // Another small wrapper, but for assigning to the cancel token this time.
153
- const buildCancelAssignWrapper = (node) => {
154
- return recast_1.types.builders.assignmentExpression('=', cancelMemberExpression, node);
155
- };
156
- let currentNode = path.node.expression;
157
- let currentPatch = null;
158
- let patchTop = null;
159
- let wrapNextTopInOptionalExtend = false;
160
- // This patches the previous node to use our current one as it's left hand value.
161
- // It takes `window.chainValue1.test1` and `window.chainValue1.test2` and turns it
162
- // into `window.chainValue1.test2.test1`.
163
- const updatePatch = (toPatch, node) => {
164
- if (toPatch.type === 'MemberExpression' || toPatch.type === 'OptionalMemberExpression') {
165
- toPatch.object = node;
166
- }
167
- else if (toPatch.type === 'CallExpression' ||
168
- toPatch.type === 'OptionalCallExpression') {
169
- toPatch.callee = node;
170
- }
171
- };
172
- // This loop walks down an optional chain from the top. This will walk
173
- // from right to left through an optional chain. We keep track of our current
174
- // top of the chain (furthest right) and create a chain below it. This chain
175
- // contains all of the (member and call) expressions that we need. These are
176
- // patched versions that reference our current chain value. We then push this
177
- // chain onto a stack when we hit an optional point in our chain.
178
- while (true) {
179
- // This should only ever be these types but you can optional chain on
180
- // JSX nodes, which we don't support.
70
+ });
71
+ };
72
+ exports.hasNativeMethod = hasNativeMethod;
73
+ // /**
74
+ // * recast's types aren't great and we need to use a lot of anys
75
+ // */
76
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
77
+ function parseWithEsprimaNext(source, options) {
78
+ const ast = (0, esprima_next_1.parse)(source, {
79
+ loc: true,
80
+ locations: true,
81
+ comment: true,
82
+ range: (0, util_1.getOption)(options, 'range', false),
83
+ tolerant: (0, util_1.getOption)(options, 'tolerant', true),
84
+ tokens: true,
85
+ jsx: (0, util_1.getOption)(options, 'jsx', false),
86
+ sourceType: (0, util_1.getOption)(options, 'sourceType', 'module'),
87
+ });
88
+ return ast;
89
+ }
90
+ /**
91
+ * A function to inject an extender function call into the AST of an expression.
92
+ * This uses recast to do the transform.
93
+ *
94
+ * This function also polyfills optional chaining if using extended functions.
95
+ *
96
+ * ```ts
97
+ * 'a'.method('x') // becomes
98
+ * extend('a', 'method', ['x']);
99
+ *
100
+ * 'a'.first('x').second('y') // becomes
101
+ * extend(extend('a', 'first', ['x']), 'second', ['y']));
102
+ * ```
103
+ */
104
+ const extendTransform = (expression) => {
105
+ try {
106
+ const ast = (0, recast_1.parse)(expression, { parser: { parse: parseWithEsprimaNext } });
107
+ let currentChain = 1;
108
+ // Polyfill optional chaining
109
+ (0, recast_1.visit)(ast, {
110
+ // eslint-disable-next-line complexity
111
+ visitChainExpression(path) {
112
+ this.traverse(path);
113
+ const chainNumber = currentChain;
114
+ currentChain += 1;
115
+ // This is to match behavior in our original expression evaluator (tmpl)
116
+ const globalIdentifier = recast_1.types.builders.identifier(typeof window !== 'object' ? 'global' : 'window');
117
+ // We want to define all of our commonly used identifiers and member
118
+ // expressions now so we don't have to create multiple instances
119
+ const undefinedIdentifier = recast_1.types.builders.identifier('undefined');
120
+ const cancelIdentifier = recast_1.types.builders.identifier(`chainCancelToken${chainNumber}`);
121
+ const valueIdentifier = recast_1.types.builders.identifier(`chainValue${chainNumber}`);
122
+ const cancelMemberExpression = recast_1.types.builders.memberExpression(globalIdentifier, cancelIdentifier);
123
+ const valueMemberExpression = recast_1.types.builders.memberExpression(globalIdentifier, valueIdentifier);
124
+ const patchedStack = [];
125
+ // This builds the cancel check. This lets us slide to the end of the expression
126
+ // if it's undefined/null at any of the optional points of the chain.
127
+ const buildCancelCheckWrapper = (node) => {
128
+ return recast_1.types.builders.conditionalExpression(recast_1.types.builders.binaryExpression('===', cancelMemberExpression, recast_1.types.builders.booleanLiteral(true)), undefinedIdentifier, node);
129
+ };
130
+ // This is just a quick small wrapper to create the assignment expression
131
+ // for the running value.
132
+ const buildValueAssignWrapper = (node) => {
133
+ return recast_1.types.builders.assignmentExpression('=', valueMemberExpression, node);
134
+ };
135
+ // This builds what actually does the comparison. It wraps the current
136
+ // chunk of the expression with a nullish coalescing operator that returns
137
+ // undefined if it's null or undefined. We do this because optional chains
138
+ // always return undefined if they fail part way, even if the value they
139
+ // fail on is null.
140
+ const buildOptionalWrapper = (node) => {
141
+ return recast_1.types.builders.binaryExpression('===', recast_1.types.builders.logicalExpression('??', buildValueAssignWrapper(node), undefinedIdentifier), undefinedIdentifier);
142
+ };
143
+ // Another small wrapper, but for assigning to the cancel token this time.
144
+ const buildCancelAssignWrapper = (node) => {
145
+ return recast_1.types.builders.assignmentExpression('=', cancelMemberExpression, node);
146
+ };
147
+ let currentNode = path.node.expression;
148
+ let currentPatch = null;
149
+ let patchTop = null;
150
+ let wrapNextTopInOptionalExtend = false;
151
+ // This patches the previous node to use our current one as it's left hand value.
152
+ // It takes `window.chainValue1.test1` and `window.chainValue1.test2` and turns it
153
+ // into `window.chainValue1.test2.test1`.
154
+ const updatePatch = (toPatch, node) => {
155
+ if (toPatch.type === 'MemberExpression' || toPatch.type === 'OptionalMemberExpression') {
156
+ toPatch.object = node;
157
+ }
158
+ else if (toPatch.type === 'CallExpression' ||
159
+ toPatch.type === 'OptionalCallExpression') {
160
+ toPatch.callee = node;
161
+ }
162
+ };
163
+ // This loop walks down an optional chain from the top. This will walk
164
+ // from right to left through an optional chain. We keep track of our current
165
+ // top of the chain (furthest right) and create a chain below it. This chain
166
+ // contains all of the (member and call) expressions that we need. These are
167
+ // patched versions that reference our current chain value. We then push this
168
+ // chain onto a stack when we hit an optional point in our chain.
169
+ while (true) {
170
+ // This should only ever be these types but you can optional chain on
171
+ // JSX nodes, which we don't support.
172
+ if (currentNode.type === 'MemberExpression' ||
173
+ currentNode.type === 'OptionalMemberExpression' ||
174
+ currentNode.type === 'CallExpression' ||
175
+ currentNode.type === 'OptionalCallExpression') {
176
+ let patchNode;
177
+ // Here we take the current node and extract the parts we actually care
178
+ // about.
179
+ // In the case of a member expression we take the property it's trying to
180
+ // access and make the object it's accessing be our chain value.
181
181
  if (currentNode.type === 'MemberExpression' ||
182
- currentNode.type === 'OptionalMemberExpression' ||
183
- currentNode.type === 'CallExpression' ||
184
- currentNode.type === 'OptionalCallExpression') {
185
- let patchNode;
186
- // Here we take the current node and extract the parts we actually care
187
- // about.
188
- // In the case of a member expression we take the property it's trying to
189
- // access and make the object it's accessing be our chain value.
190
- if (currentNode.type === 'MemberExpression' ||
191
- currentNode.type === 'OptionalMemberExpression') {
192
- patchNode = recast_1.types.builders.memberExpression(valueMemberExpression, currentNode.property);
193
- // In the case of a call expression we take the arguments and make the
194
- // callee our chain value.
195
- }
196
- else {
197
- patchNode = recast_1.types.builders.callExpression(valueMemberExpression, currentNode.arguments);
198
- }
199
- // If we have a previous node we patch it here.
200
- if (currentPatch) {
201
- updatePatch(currentPatch, patchNode);
202
- }
203
- // If we have no top patch (first run, or just pushed onto the stack) we
204
- // note it here.
205
- if (!patchTop) {
206
- patchTop = patchNode;
207
- }
208
- currentPatch = patchNode;
209
- // This is an optional in our chain. In here we'll push the node onto the
210
- // stack. We also do a polyfill if the top of the stack is function call
211
- // that might be a extended function.
212
- if (currentNode.optional) {
213
- // Implement polyfill described below
214
- if (wrapNextTopInOptionalExtend) {
215
- wrapNextTopInOptionalExtend = false;
216
- // This shouldn't ever happen
217
- if (patchTop.type === 'MemberExpression' &&
218
- patchTop.property.type === 'Identifier') {
219
- patchTop = recast_1.types.builders.callExpression(recast_1.types.builders.identifier(EXPRESSION_EXTENDER_OPTIONAL), [patchTop.object, recast_1.types.builders.stringLiteral(patchTop.property.name)]);
220
- }
221
- }
222
- patchedStack.push(patchTop);
223
- patchTop = null;
224
- currentPatch = null;
225
- // Attempting to optional chain on an extended function. If we don't
226
- // polyfill this most calls will always be undefined. Marking that the
227
- // next part of the chain should be wrapped in our polyfill.
228
- if ((currentNode.type === 'CallExpression' ||
229
- currentNode.type === 'OptionalCallExpression') &&
230
- (currentNode.callee.type === 'MemberExpression' ||
231
- currentNode.callee.type === 'OptionalMemberExpression') &&
232
- currentNode.callee.property.type === 'Identifier' &&
233
- isExpressionExtension(currentNode.callee.property.name)) {
234
- wrapNextTopInOptionalExtend = true;
235
- }
236
- }
237
- // Finally we get the next point AST to walk down.
238
- if (currentNode.type === 'MemberExpression' ||
239
- currentNode.type === 'OptionalMemberExpression') {
240
- currentNode = currentNode.object;
241
- }
242
- else {
243
- currentNode = currentNode.callee;
244
- }
182
+ currentNode.type === 'OptionalMemberExpression') {
183
+ patchNode = recast_1.types.builders.memberExpression(valueMemberExpression, currentNode.property);
184
+ // In the case of a call expression we take the arguments and make the
185
+ // callee our chain value.
245
186
  }
246
187
  else {
247
- // We update the final patch to point to the first part of the optional chain
248
- // which is probably an identifier for an object.
249
- if (currentPatch) {
250
- updatePatch(currentPatch, currentNode);
251
- if (!patchTop) {
252
- patchTop = currentPatch;
253
- }
254
- }
188
+ patchNode = recast_1.types.builders.callExpression(valueMemberExpression, currentNode.arguments);
189
+ }
190
+ // If we have a previous node we patch it here.
191
+ if (currentPatch) {
192
+ updatePatch(currentPatch, patchNode);
193
+ }
194
+ // If we have no top patch (first run, or just pushed onto the stack) we
195
+ // note it here.
196
+ if (!patchTop) {
197
+ patchTop = patchNode;
198
+ }
199
+ currentPatch = patchNode;
200
+ // This is an optional in our chain. In here we'll push the node onto the
201
+ // stack. We also do a polyfill if the top of the stack is function call
202
+ // that might be a extended function.
203
+ if (currentNode.optional) {
204
+ // Implement polyfill described below
255
205
  if (wrapNextTopInOptionalExtend) {
256
206
  wrapNextTopInOptionalExtend = false;
257
207
  // This shouldn't ever happen
258
- if (patchTop?.type === 'MemberExpression' &&
208
+ if (patchTop.type === 'MemberExpression' &&
259
209
  patchTop.property.type === 'Identifier') {
260
210
  patchTop = recast_1.types.builders.callExpression(recast_1.types.builders.identifier(EXPRESSION_EXTENDER_OPTIONAL), [patchTop.object, recast_1.types.builders.stringLiteral(patchTop.property.name)]);
261
211
  }
262
212
  }
263
- // Push the first part of our chain to stack.
264
- if (patchTop) {
265
- patchedStack.push(patchTop);
266
- }
267
- else {
268
- patchedStack.push(currentNode);
213
+ patchedStack.push(patchTop);
214
+ patchTop = null;
215
+ currentPatch = null;
216
+ // Attempting to optional chain on an extended function. If we don't
217
+ // polyfill this most calls will always be undefined. Marking that the
218
+ // next part of the chain should be wrapped in our polyfill.
219
+ if ((currentNode.type === 'CallExpression' ||
220
+ currentNode.type === 'OptionalCallExpression') &&
221
+ (currentNode.callee.type === 'MemberExpression' ||
222
+ currentNode.callee.type === 'OptionalMemberExpression') &&
223
+ currentNode.callee.property.type === 'Identifier' &&
224
+ isExpressionExtension(currentNode.callee.property.name)) {
225
+ wrapNextTopInOptionalExtend = true;
269
226
  }
270
- break;
227
+ }
228
+ // Finally we get the next point AST to walk down.
229
+ if (currentNode.type === 'MemberExpression' ||
230
+ currentNode.type === 'OptionalMemberExpression') {
231
+ currentNode = currentNode.object;
232
+ }
233
+ else {
234
+ currentNode = currentNode.callee;
271
235
  }
272
236
  }
273
- // Since we're working from right to left we need to flip the stack
274
- // for the correct order of operations
275
- patchedStack.reverse();
276
- // Walk the node stack and wrap all our expressions in cancel/assignment
277
- // wrappers.
278
- for (let i = 0; i < patchedStack.length; i++) {
279
- let node = patchedStack[i];
280
- // We don't wrap the last expression in an assignment wrapper because
281
- // it's going to be returned anyway. We just wrap it in a cancel check
282
- // wrapper.
283
- if (i !== patchedStack.length - 1) {
284
- node = buildCancelAssignWrapper(buildOptionalWrapper(node));
237
+ else {
238
+ // We update the final patch to point to the first part of the optional chain
239
+ // which is probably an identifier for an object.
240
+ if (currentPatch) {
241
+ updatePatch(currentPatch, currentNode);
242
+ if (!patchTop) {
243
+ patchTop = currentPatch;
244
+ }
245
+ }
246
+ if (wrapNextTopInOptionalExtend) {
247
+ wrapNextTopInOptionalExtend = false;
248
+ // This shouldn't ever happen
249
+ if (patchTop?.type === 'MemberExpression' &&
250
+ patchTop.property.type === 'Identifier') {
251
+ patchTop = recast_1.types.builders.callExpression(recast_1.types.builders.identifier(EXPRESSION_EXTENDER_OPTIONAL), [patchTop.object, recast_1.types.builders.stringLiteral(patchTop.property.name)]);
252
+ }
285
253
  }
286
- // Don't wrap the first part in a cancel wrapper because the cancel
287
- // token will always be undefined.
288
- if (i !== 0) {
289
- node = buildCancelCheckWrapper(node);
254
+ // Push the first part of our chain to stack.
255
+ if (patchTop) {
256
+ patchedStack.push(patchTop);
290
257
  }
291
- // Replace the node in the stack with our wrapped one
292
- patchedStack[i] = node;
258
+ else {
259
+ patchedStack.push(currentNode);
260
+ }
261
+ break;
293
262
  }
294
- // Put all our expressions in a sequence expression (also called a
295
- // group operator). These will all be executed in order and the value
296
- // of the final expression will be returned.
297
- const sequenceNode = recast_1.types.builders.sequenceExpression(patchedStack);
298
- path.replace(sequenceNode);
299
- },
300
- });
301
- // Extended functions
302
- (0, recast_1.visit)(ast, {
303
- visitCallExpression(path) {
304
- this.traverse(path);
305
- if (path.node.callee.type === 'MemberExpression' &&
306
- path.node.callee.property.type === 'Identifier' &&
307
- isExpressionExtension(path.node.callee.property.name)) {
308
- path.replace(recast_1.types.builders.callExpression(recast_1.types.builders.identifier(EXPRESSION_EXTENDER), [
309
- path.node.callee.object,
310
- recast_1.types.builders.stringLiteral(path.node.callee.property.name),
311
- recast_1.types.builders.arrayExpression(path.node.arguments),
312
- ]));
263
+ }
264
+ // Since we're working from right to left we need to flip the stack
265
+ // for the correct order of operations
266
+ patchedStack.reverse();
267
+ // Walk the node stack and wrap all our expressions in cancel/assignment
268
+ // wrappers.
269
+ for (let i = 0; i < patchedStack.length; i++) {
270
+ let node = patchedStack[i];
271
+ // We don't wrap the last expression in an assignment wrapper because
272
+ // it's going to be returned anyway. We just wrap it in a cancel check
273
+ // wrapper.
274
+ if (i !== patchedStack.length - 1) {
275
+ node = buildCancelAssignWrapper(buildOptionalWrapper(node));
313
276
  }
314
- else if (path.node.callee.type === 'Identifier' &&
315
- path.node.callee.name === '$if' &&
316
- path.node.arguments.every((v) => v.type !== 'SpreadElement')) {
317
- if (path.node.arguments.length < 2) {
318
- throw new expression_extension_error_1.ExpressionExtensionError('$if requires at least 2 parameters: test, value_if_true[, and value_if_false]');
319
- }
320
- const test = path.node.arguments[0];
321
- const consequent = path.node.arguments[1];
322
- const alternative = path.node.arguments[2] === undefined
323
- ? recast_1.types.builders.booleanLiteral(false)
324
- : path.node.arguments[2];
325
- path.replace(recast_1.types.builders.conditionalExpression(
326
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-explicit-any
327
- test,
328
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-explicit-any
329
- consequent,
330
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-explicit-any
331
- alternative));
277
+ // Don't wrap the first part in a cancel wrapper because the cancel
278
+ // token will always be undefined.
279
+ if (i !== 0) {
280
+ node = buildCancelCheckWrapper(node);
332
281
  }
333
- },
334
- });
335
- return (0, recast_1.print)(ast);
336
- }
337
- catch (e) {
338
- return;
339
- }
340
- };
341
- exports.extendTransform = extendTransform;
342
- function isDate(input) {
343
- if (typeof input !== 'string' || !input.length) {
344
- return false;
345
- }
346
- if (!/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/.test(input)) {
347
- return false;
348
- }
349
- const d = new Date(input);
350
- return d instanceof Date && !isNaN(d.valueOf()) && d.toISOString() === input;
282
+ // Replace the node in the stack with our wrapped one
283
+ patchedStack[i] = node;
284
+ }
285
+ // Put all our expressions in a sequence expression (also called a
286
+ // group operator). These will all be executed in order and the value
287
+ // of the final expression will be returned.
288
+ const sequenceNode = recast_1.types.builders.sequenceExpression(patchedStack);
289
+ path.replace(sequenceNode);
290
+ },
291
+ });
292
+ // Extended functions
293
+ (0, recast_1.visit)(ast, {
294
+ visitCallExpression(path) {
295
+ this.traverse(path);
296
+ if (path.node.callee.type === 'MemberExpression' &&
297
+ path.node.callee.property.type === 'Identifier' &&
298
+ isExpressionExtension(path.node.callee.property.name)) {
299
+ path.replace(recast_1.types.builders.callExpression(recast_1.types.builders.identifier(EXPRESSION_EXTENDER), [
300
+ path.node.callee.object,
301
+ recast_1.types.builders.stringLiteral(path.node.callee.property.name),
302
+ recast_1.types.builders.arrayExpression(path.node.arguments),
303
+ ]));
304
+ }
305
+ else if (path.node.callee.type === 'Identifier' &&
306
+ path.node.callee.name === '$if' &&
307
+ path.node.arguments.every((v) => v.type !== 'SpreadElement')) {
308
+ if (path.node.arguments.length < 2) {
309
+ throw new expression_extension_error_1.ExpressionExtensionError('$if requires at least 2 parameters: test, value_if_true[, and value_if_false]');
310
+ }
311
+ const test = path.node.arguments[0];
312
+ const consequent = path.node.arguments[1];
313
+ const alternative = path.node.arguments[2] === undefined
314
+ ? recast_1.types.builders.booleanLiteral(false)
315
+ : path.node.arguments[2];
316
+ path.replace(recast_1.types.builders.conditionalExpression(
317
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-explicit-any
318
+ test,
319
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-explicit-any
320
+ consequent,
321
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-explicit-any
322
+ alternative));
323
+ }
324
+ },
325
+ });
326
+ return (0, recast_1.print)(ast);
351
327
  }
352
- function findExtendedFunction(input, functionName) {
353
- // Coerce to string early so the name is stable for the property check below
354
- const name = typeof functionName === 'string' ? functionName : String(functionName);
355
- // Ensure the property name is in the allowed set before looking it up
356
- if (!(0, utils_2.isSafeObjectProperty)(name)) {
357
- throw new expression_extension_error_1.ExpressionExtensionError(`Cannot access "${name}" via expression extension due to security concerns`);
358
- }
359
- // eslint-disable-next-line @typescript-eslint/no-restricted-types
360
- let foundFunction;
361
- if (Array.isArray(input)) {
362
- foundFunction = array_extensions_1.arrayExtensions.functions[name];
363
- }
364
- else if (isDate(input) && name !== 'toDate' && name !== 'toDateTime') {
365
- // If it's a string date (from $json), convert it to a Date object,
366
- // unless that function is `toDate`, since `toDate` does something
367
- // very different on date objects
368
- input = new Date(input);
369
- foundFunction = date_extensions_1.dateExtensions.functions[name];
370
- }
371
- else if (typeof input === 'string') {
372
- foundFunction = string_extensions_1.stringExtensions.functions[name];
373
- }
374
- else if (typeof input === 'number') {
375
- foundFunction = number_extensions_1.numberExtensions.functions[name];
376
- }
377
- else if (input && (luxon_1.DateTime.isDateTime(input) || input instanceof Date)) {
378
- foundFunction = date_extensions_1.dateExtensions.functions[name];
379
- }
380
- else if (input !== null && typeof input === 'object') {
381
- foundFunction = object_extensions_1.objectExtensions.functions[name];
328
+ catch (e) {
329
+ return;
330
+ }
331
+ };
332
+ exports.extendTransform = extendTransform;
333
+ function isDate(input) {
334
+ if (typeof input !== 'string' || !input.length) {
335
+ return false;
336
+ }
337
+ if (!/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/.test(input)) {
338
+ return false;
339
+ }
340
+ const d = new Date(input);
341
+ return d instanceof Date && !isNaN(d.valueOf()) && d.toISOString() === input;
342
+ }
343
+ function findExtendedFunction(input, functionName) {
344
+ // Coerce to string early so the name is stable for the property check below
345
+ const name = typeof functionName === 'string' ? functionName : String(functionName);
346
+ // Ensure the property name is in the allowed set before looking it up
347
+ if (!(0, utils_2.isSafeObjectProperty)(name)) {
348
+ throw new expression_extension_error_1.ExpressionExtensionError(`Cannot access "${name}" via expression extension due to security concerns`);
349
+ }
350
+ // eslint-disable-next-line @typescript-eslint/no-restricted-types
351
+ let foundFunction;
352
+ if (Array.isArray(input)) {
353
+ foundFunction = array_extensions_1.arrayExtensions.functions[name];
354
+ }
355
+ else if (isDate(input) && name !== 'toDate' && name !== 'toDateTime') {
356
+ // If it's a string date (from $json), convert it to a Date object,
357
+ // unless that function is `toDate`, since `toDate` does something
358
+ // very different on date objects
359
+ input = new Date(input);
360
+ foundFunction = date_extensions_1.dateExtensions.functions[name];
361
+ }
362
+ else if (typeof input === 'string') {
363
+ foundFunction = string_extensions_1.stringExtensions.functions[name];
364
+ }
365
+ else if (typeof input === 'number') {
366
+ foundFunction = number_extensions_1.numberExtensions.functions[name];
367
+ }
368
+ else if (input && (luxon_1.DateTime.isDateTime(input) || input instanceof Date)) {
369
+ foundFunction = date_extensions_1.dateExtensions.functions[name];
370
+ }
371
+ else if (input !== null && typeof input === 'object') {
372
+ foundFunction = object_extensions_1.objectExtensions.functions[name];
373
+ }
374
+ else if (typeof input === 'boolean') {
375
+ foundFunction = boolean_extensions_1.booleanExtensions.functions[name];
376
+ }
377
+ // Look for generic or builtin
378
+ if (!foundFunction) {
379
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
380
+ const inputAny = input;
381
+ // This is likely a builtin we're implementing for another type
382
+ // (e.g. toLocaleString). We'll return that instead
383
+ if (inputAny && name && typeof inputAny[name] === 'function') {
384
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
385
+ return { type: 'native', function: inputAny[name] };
382
386
  }
383
- else if (typeof input === 'boolean') {
384
- foundFunction = boolean_extensions_1.booleanExtensions.functions[name];
387
+ // Use a generic version if available
388
+ foundFunction = genericExtensions[name];
389
+ }
390
+ if (!foundFunction) {
391
+ return undefined;
392
+ }
393
+ return { type: 'extended', function: foundFunction };
394
+ }
395
+ /**
396
+ * Extender function injected by expression extension plugin to allow calls to extensions.
397
+ *
398
+ * ```ts
399
+ * extend(input, "functionName", [...args]);
400
+ * ```
401
+ */
402
+ function extend(input, functionName, args) {
403
+ const foundFunction = findExtendedFunction(input, functionName);
404
+ // No type specific or generic function found. Check to see if
405
+ // any types have a function with that name. Then throw an error
406
+ // letting the user know the available types.
407
+ if (!foundFunction) {
408
+ (0, utils_1.checkIfValueDefinedOrThrow)(input, functionName);
409
+ const haveFunction = exports.EXTENSION_OBJECTS.filter((v) => functionName in v.functions);
410
+ if (!haveFunction.length) {
411
+ // This shouldn't really be possible but we should cover it anyway
412
+ throw new expression_extension_error_1.ExpressionExtensionError(`Unknown expression function: ${functionName}`);
385
413
  }
386
- // Look for generic or builtin
387
- if (!foundFunction) {
388
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
389
- const inputAny = input;
390
- // This is likely a builtin we're implementing for another type
391
- // (e.g. toLocaleString). We'll return that instead
392
- if (inputAny && name && typeof inputAny[name] === 'function') {
393
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
394
- return { type: 'native', function: inputAny[name] };
395
- }
396
- // Use a generic version if available
397
- foundFunction = genericExtensions[name];
414
+ if (haveFunction.length > 1) {
415
+ const lastType = `"${haveFunction.pop().typeName}"`;
416
+ const typeNames = `${haveFunction.map((v) => `"${v.typeName}"`).join(', ')}, and ${lastType}`;
417
+ throw new expression_extension_error_1.ExpressionExtensionError(`${functionName}() is only callable on types ${typeNames}`);
398
418
  }
399
- if (!foundFunction) {
400
- return undefined;
419
+ else {
420
+ throw new expression_extension_error_1.ExpressionExtensionError(`${functionName}() is only callable on type "${haveFunction[0].typeName}"`);
401
421
  }
402
- return { type: 'extended', function: foundFunction };
403
422
  }
404
- /**
405
- * Extender function injected by expression extension plugin to allow calls to extensions.
406
- *
407
- * ```ts
408
- * extend(input, "functionName", [...args]);
409
- * ```
410
- */
411
- function extend(input, functionName, args) {
412
- const foundFunction = findExtendedFunction(input, functionName);
413
- // No type specific or generic function found. Check to see if
414
- // any types have a function with that name. Then throw an error
415
- // letting the user know the available types.
416
- if (!foundFunction) {
417
- (0, utils_1.checkIfValueDefinedOrThrow)(input, functionName);
418
- const haveFunction = exports.EXTENSION_OBJECTS.filter((v) => functionName in v.functions);
419
- if (!haveFunction.length) {
420
- // This shouldn't really be possible but we should cover it anyway
421
- throw new expression_extension_error_1.ExpressionExtensionError(`Unknown expression function: ${functionName}`);
422
- }
423
- if (haveFunction.length > 1) {
424
- const lastType = `"${haveFunction.pop().typeName}"`;
425
- const typeNames = `${haveFunction.map((v) => `"${v.typeName}"`).join(', ')}, and ${lastType}`;
426
- throw new expression_extension_error_1.ExpressionExtensionError(`${functionName}() is only callable on types ${typeNames}`);
427
- }
428
- else {
429
- throw new expression_extension_error_1.ExpressionExtensionError(`${functionName}() is only callable on type "${haveFunction[0].typeName}"`);
430
- }
431
- }
432
- if (foundFunction.type === 'native') {
433
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
434
- return foundFunction.function.apply(input, args);
435
- }
423
+ if (foundFunction.type === 'native') {
424
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
425
+ return foundFunction.function.apply(input, args);
426
+ }
427
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
428
+ return foundFunction.function(input, args);
429
+ }
430
+ function extendOptional(input, functionName) {
431
+ const foundFunction = findExtendedFunction(input, functionName);
432
+ if (!foundFunction) {
433
+ return undefined;
434
+ }
435
+ if (foundFunction.type === 'native') {
436
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
437
+ return foundFunction.function.bind(input);
438
+ }
439
+ return (...args) => {
436
440
  // eslint-disable-next-line @typescript-eslint/no-unsafe-return
437
441
  return foundFunction.function(input, args);
442
+ };
443
+ }
444
+ const EXTENDED_SYNTAX_CACHE = {};
445
+ function extendSyntax(bracketedExpression, forceExtend = false) {
446
+ const chunks = (0, expression_parser_1.splitExpression)(bracketedExpression);
447
+ const codeChunks = chunks
448
+ .filter((c) => c.type === 'code')
449
+ .map((c) => c.text.replace(/("|').*?("|')/, '').trim());
450
+ if ((!codeChunks.some(exports.hasExpressionExtension) || (0, exports.hasNativeMethod)(bracketedExpression)) &&
451
+ !forceExtend) {
452
+ return bracketedExpression;
438
453
  }
439
- function extendOptional(input, functionName) {
440
- const foundFunction = findExtendedFunction(input, functionName);
441
- if (!foundFunction) {
442
- return undefined;
443
- }
444
- if (foundFunction.type === 'native') {
445
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
446
- return foundFunction.function.bind(input);
447
- }
448
- return (...args) => {
449
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
450
- return foundFunction.function(input, args);
451
- };
454
+ // If we've seen this expression before grab it from the cache
455
+ if (bracketedExpression in EXTENDED_SYNTAX_CACHE) {
456
+ return EXTENDED_SYNTAX_CACHE[bracketedExpression];
452
457
  }
453
- const EXTENDED_SYNTAX_CACHE = {};
454
- function extendSyntax(bracketedExpression, forceExtend = false) {
455
- const chunks = (0, expression_parser_1.splitExpression)(bracketedExpression);
456
- const codeChunks = chunks
457
- .filter((c) => c.type === 'code')
458
- .map((c) => c.text.replace(/("|').*?("|')/, '').trim());
459
- if ((!codeChunks.some(exports.hasExpressionExtension) || (0, exports.hasNativeMethod)(bracketedExpression)) &&
460
- !forceExtend) {
461
- return bracketedExpression;
462
- }
463
- // If we've seen this expression before grab it from the cache
464
- if (bracketedExpression in EXTENDED_SYNTAX_CACHE) {
465
- return EXTENDED_SYNTAX_CACHE[bracketedExpression];
466
- }
467
- const extendedChunks = chunks.map((chunk) => {
468
- if (chunk.type === 'code') {
469
- let output = (0, exports.extendTransform)(chunk.text);
470
- // esprima fails to parse bare objects (e.g. `{ data: something }`), we can
471
- // work around this by wrapping it in an parentheses
472
- if (!output?.code && chunk.text.trim()[0] === '{') {
473
- output = (0, exports.extendTransform)(`(${chunk.text})`);
474
- }
475
- if (!output?.code) {
476
- throw new expression_extension_error_1.ExpressionExtensionError('invalid syntax');
477
- }
478
- let text = output.code;
479
- // We need to cut off any trailing semicolons. These cause issues
480
- // with certain types of expression and cause the whole expression
481
- // to fail.
482
- if (text.trim().endsWith(';')) {
483
- text = text.trim().slice(0, -1);
484
- }
485
- return {
486
- ...chunk,
487
- text,
488
- };
458
+ const extendedChunks = chunks.map((chunk) => {
459
+ if (chunk.type === 'code') {
460
+ let output = (0, exports.extendTransform)(chunk.text);
461
+ // esprima fails to parse bare objects (e.g. `{ data: something }`), we can
462
+ // work around this by wrapping it in an parentheses
463
+ if (!output?.code && chunk.text.trim()[0] === '{') {
464
+ output = (0, exports.extendTransform)(`(${chunk.text})`);
489
465
  }
490
- return chunk;
491
- });
492
- const expression = (0, expression_parser_1.joinExpression)(extendedChunks);
493
- // Cache the expression so we don't have to do this transform again
494
- EXTENDED_SYNTAX_CACHE[bracketedExpression] = expression;
495
- return expression;
496
- }
497
- });
466
+ if (!output?.code) {
467
+ throw new expression_extension_error_1.ExpressionExtensionError('invalid syntax');
468
+ }
469
+ let text = output.code;
470
+ // We need to cut off any trailing semicolons. These cause issues
471
+ // with certain types of expression and cause the whole expression
472
+ // to fail.
473
+ if (text.trim().endsWith(';')) {
474
+ text = text.trim().slice(0, -1);
475
+ }
476
+ return {
477
+ ...chunk,
478
+ text,
479
+ };
480
+ }
481
+ return chunk;
482
+ });
483
+ const expression = (0, expression_parser_1.joinExpression)(extendedChunks);
484
+ // Cache the expression so we don't have to do this transform again
485
+ EXTENDED_SYNTAX_CACHE[bracketedExpression] = expression;
486
+ return expression;
487
+ }
498
488
  //# sourceMappingURL=expression-extension.js.map