@decaf-ts/as-graph 0.7.0 → 0.8.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 (383) hide show
  1. package/README.md +92 -12
  2. package/assets/i18n/en.json +1519 -130
  3. package/dist/as-graph.cjs +1 -1
  4. package/dist/as-graph.cjs.map +1 -1
  5. package/dist/as-graph.js +1 -1
  6. package/dist/as-graph.js.map +1 -1
  7. package/lib/cjs/dagster/DagsterGraphExecutionBackend.cjs +13 -0
  8. package/lib/cjs/dagster/DagsterGraphExecutionBackend.cjs.map +1 -1
  9. package/lib/cjs/dagster/capabilities.cjs +5 -0
  10. package/lib/cjs/dagster/capabilities.cjs.map +1 -1
  11. package/lib/cjs/engine/execution/GraphCodeMode.cjs +42 -0
  12. package/lib/cjs/engine/execution/GraphCodeMode.cjs.map +1 -1
  13. package/lib/cjs/engine/execution/GraphExecutionEngine.cjs +35 -4
  14. package/lib/cjs/engine/execution/GraphExecutionEngine.cjs.map +1 -1
  15. package/lib/cjs/engine/validation/GraphNodeInstanceValidator.cjs +29 -1
  16. package/lib/cjs/engine/validation/GraphNodeInstanceValidator.cjs.map +1 -1
  17. package/lib/cjs/engine/validation/GraphWorkflowDocumentValidator.cjs +6 -2
  18. package/lib/cjs/engine/validation/GraphWorkflowDocumentValidator.cjs.map +1 -1
  19. package/lib/cjs/mastra/MastraWorkflowCompiler.cjs +41 -9
  20. package/lib/cjs/mastra/MastraWorkflowCompiler.cjs.map +1 -1
  21. package/lib/cjs/nest/graph/GraphEngineController.cjs +18 -0
  22. package/lib/cjs/nest/graph/GraphEngineController.cjs.map +1 -1
  23. package/lib/cjs/nest/graph/GraphNodeCatalogueController.cjs +14 -0
  24. package/lib/cjs/nest/graph/GraphNodeCatalogueController.cjs.map +1 -1
  25. package/lib/cjs/nest/graph/GraphRunController.cjs +17 -0
  26. package/lib/cjs/nest/graph/GraphRunController.cjs.map +1 -1
  27. package/lib/cjs/nest/graph/GraphWorkflowController.cjs +34 -5
  28. package/lib/cjs/nest/graph/GraphWorkflowController.cjs.map +1 -1
  29. package/lib/cjs/node/comms/discord/node.cjs +384 -0
  30. package/lib/cjs/node/comms/discord/node.cjs.map +1 -0
  31. package/lib/cjs/node/comms/outlook/node.cjs +395 -0
  32. package/lib/cjs/node/comms/outlook/node.cjs.map +1 -0
  33. package/lib/cjs/node/comms/whatsapp/node.cjs +341 -0
  34. package/lib/cjs/node/comms/whatsapp/node.cjs.map +1 -0
  35. package/lib/cjs/node/data/aggregate/node.cjs +196 -0
  36. package/lib/cjs/node/data/aggregate/node.cjs.map +1 -0
  37. package/lib/cjs/node/data/compare-datasets/node.cjs +331 -0
  38. package/lib/cjs/node/data/compare-datasets/node.cjs.map +1 -0
  39. package/lib/cjs/node/data/item-lists/node.cjs +416 -0
  40. package/lib/cjs/node/data/item-lists/node.cjs.map +1 -0
  41. package/lib/cjs/node/data/remove-duplicates/node.cjs +141 -0
  42. package/lib/cjs/node/data/remove-duplicates/node.cjs.map +1 -0
  43. package/lib/cjs/node/data/summarize/node.cjs +155 -0
  44. package/lib/cjs/node/data/summarize/node.cjs.map +1 -0
  45. package/lib/cjs/node/data/support.cjs +5 -0
  46. package/lib/cjs/node/data/support.cjs.map +1 -1
  47. package/lib/cjs/node/data/transform-utils.cjs +719 -0
  48. package/lib/cjs/node/data/transform-utils.cjs.map +1 -0
  49. package/lib/cjs/node/index.cjs +216 -110
  50. package/lib/cjs/node/index.cjs.map +1 -1
  51. package/lib/cjs/node/io/confluence/node.cjs +253 -0
  52. package/lib/cjs/node/io/confluence/node.cjs.map +1 -0
  53. package/lib/cjs/node/io/convert-to-file/node.cjs +349 -0
  54. package/lib/cjs/node/io/convert-to-file/node.cjs.map +1 -0
  55. package/lib/cjs/node/io/file-support.cjs +311 -0
  56. package/lib/cjs/node/io/file-support.cjs.map +1 -0
  57. package/lib/cjs/node/io/google-calendar/node.cjs +359 -0
  58. package/lib/cjs/node/io/google-calendar/node.cjs.map +1 -0
  59. package/lib/cjs/node/io/google-docs/node.cjs +272 -0
  60. package/lib/cjs/node/io/google-docs/node.cjs.map +1 -0
  61. package/lib/cjs/node/io/html/node.cjs +275 -0
  62. package/lib/cjs/node/io/html/node.cjs.map +1 -0
  63. package/lib/cjs/node/io/html-extract/node.cjs +162 -0
  64. package/lib/cjs/node/io/html-extract/node.cjs.map +1 -0
  65. package/lib/cjs/node/io/html-support.cjs +246 -0
  66. package/lib/cjs/node/io/html-support.cjs.map +1 -0
  67. package/lib/cjs/node/io/jira/node.cjs +351 -0
  68. package/lib/cjs/node/io/jira/node.cjs.map +1 -0
  69. package/lib/cjs/node/io/markdown/node.cjs +229 -0
  70. package/lib/cjs/node/io/markdown/node.cjs.map +1 -0
  71. package/lib/cjs/node/io/microsoft-excel/node.cjs +261 -0
  72. package/lib/cjs/node/io/microsoft-excel/node.cjs.map +1 -0
  73. package/lib/cjs/node/io/microsoft-sharepoint/node.cjs +274 -0
  74. package/lib/cjs/node/io/microsoft-sharepoint/node.cjs.map +1 -0
  75. package/lib/cjs/node/io/read-binary-file/node.cjs +114 -0
  76. package/lib/cjs/node/io/read-binary-file/node.cjs.map +1 -0
  77. package/lib/cjs/node/io/read-binary-files/node.cjs +113 -0
  78. package/lib/cjs/node/io/read-binary-files/node.cjs.map +1 -0
  79. package/lib/cjs/node/io/write-binary-file/node.cjs +164 -0
  80. package/lib/cjs/node/io/write-binary-file/node.cjs.map +1 -0
  81. package/lib/cjs/node/io/xml/node.cjs +322 -0
  82. package/lib/cjs/node/io/xml/node.cjs.map +1 -0
  83. package/lib/cjs/node/manifests.cjs +137 -79
  84. package/lib/cjs/node/manifests.cjs.map +1 -1
  85. package/lib/cjs/node/storage/rabbitmq/node.cjs +252 -0
  86. package/lib/cjs/node/storage/rabbitmq/node.cjs.map +1 -0
  87. package/lib/cjs/node/triggers/error/node.cjs +108 -0
  88. package/lib/cjs/node/triggers/error/node.cjs.map +1 -0
  89. package/lib/cjs/node/triggers/postgres/node.cjs +244 -0
  90. package/lib/cjs/node/triggers/postgres/node.cjs.map +1 -0
  91. package/lib/cjs/node/triggers/rabbitmq/node.cjs +284 -0
  92. package/lib/cjs/node/triggers/rabbitmq/node.cjs.map +1 -0
  93. package/lib/cjs/node/triggers/redis/node.cjs +233 -0
  94. package/lib/cjs/node/triggers/redis/node.cjs.map +1 -0
  95. package/lib/cjs/node/triggers/sse/node.cjs +196 -0
  96. package/lib/cjs/node/triggers/sse/node.cjs.map +1 -0
  97. package/lib/cjs/node/triggers/support.cjs +107 -0
  98. package/lib/cjs/node/triggers/support.cjs.map +1 -0
  99. package/lib/cjs/node/triggers/workflow/node.cjs +193 -0
  100. package/lib/cjs/node/triggers/workflow/node.cjs.map +1 -0
  101. package/lib/cjs/shared/graph/catalog/GraphValueSchemaDerivation.cjs +20 -3
  102. package/lib/cjs/shared/graph/catalog/GraphValueSchemaDerivation.cjs.map +1 -1
  103. package/lib/cjs/workflows/boundary-value.workflow.cjs +38 -0
  104. package/lib/cjs/workflows/boundary-value.workflow.cjs.map +1 -0
  105. package/lib/cjs/workflows/builders.cjs +47 -0
  106. package/lib/cjs/workflows/builders.cjs.map +1 -0
  107. package/lib/cjs/workflows/chat-agent.workflow.cjs +40 -0
  108. package/lib/cjs/workflows/chat-agent.workflow.cjs.map +1 -0
  109. package/lib/cjs/workflows/error-boundary.workflow.cjs +54 -0
  110. package/lib/cjs/workflows/error-boundary.workflow.cjs.map +1 -0
  111. package/lib/cjs/workflows/event-map.workflow.cjs +37 -0
  112. package/lib/cjs/workflows/event-map.workflow.cjs.map +1 -0
  113. package/lib/cjs/workflows/foreach-break.workflow.cjs +58 -0
  114. package/lib/cjs/workflows/foreach-break.workflow.cjs.map +1 -0
  115. package/lib/cjs/workflows/human-approval.workflow.cjs +44 -0
  116. package/lib/cjs/workflows/human-approval.workflow.cjs.map +1 -0
  117. package/lib/cjs/workflows/if-switch.workflow.cjs +66 -0
  118. package/lib/cjs/workflows/if-switch.workflow.cjs.map +1 -0
  119. package/lib/cjs/workflows/index.cjs +135 -0
  120. package/lib/cjs/workflows/index.cjs.map +1 -0
  121. package/lib/cjs/workflows/loops-while-until.workflow.cjs +76 -0
  122. package/lib/cjs/workflows/loops-while-until.workflow.cjs.map +1 -0
  123. package/lib/cjs/workflows/manual-log.workflow.cjs +52 -0
  124. package/lib/cjs/workflows/manual-log.workflow.cjs.map +1 -0
  125. package/lib/cjs/workflows/schedule-code.workflow.cjs +42 -0
  126. package/lib/cjs/workflows/schedule-code.workflow.cjs.map +1 -0
  127. package/lib/cjs/workflows/types.cjs +4 -0
  128. package/lib/cjs/workflows/types.cjs.map +1 -0
  129. package/lib/cjs/workflows/value-templates.workflow.cjs +43 -0
  130. package/lib/cjs/workflows/value-templates.workflow.cjs.map +1 -0
  131. package/lib/cjs/workflows/webhook-form.workflow.cjs +48 -0
  132. package/lib/cjs/workflows/webhook-form.workflow.cjs.map +1 -0
  133. package/lib/esm/dagster/DagsterGraphExecutionBackend.js +13 -0
  134. package/lib/esm/dagster/DagsterGraphExecutionBackend.js.map +1 -1
  135. package/lib/esm/dagster/capabilities.js +5 -0
  136. package/lib/esm/dagster/capabilities.js.map +1 -1
  137. package/lib/esm/engine/execution/GraphCodeMode.js +40 -0
  138. package/lib/esm/engine/execution/GraphCodeMode.js.map +1 -1
  139. package/lib/esm/engine/execution/GraphExecutionBackend.js.map +1 -1
  140. package/lib/esm/engine/execution/GraphExecutionEngine.js +36 -5
  141. package/lib/esm/engine/execution/GraphExecutionEngine.js.map +1 -1
  142. package/lib/esm/engine/validation/GraphNodeInstanceValidator.js +29 -1
  143. package/lib/esm/engine/validation/GraphNodeInstanceValidator.js.map +1 -1
  144. package/lib/esm/engine/validation/GraphWorkflowDocumentValidator.js +6 -2
  145. package/lib/esm/engine/validation/GraphWorkflowDocumentValidator.js.map +1 -1
  146. package/lib/esm/mastra/MastraMemory.js.map +1 -1
  147. package/lib/esm/mastra/MastraWorkflowCompiler.js +41 -9
  148. package/lib/esm/mastra/MastraWorkflowCompiler.js.map +1 -1
  149. package/lib/esm/nest/graph/GraphEngineController.js +19 -1
  150. package/lib/esm/nest/graph/GraphEngineController.js.map +1 -1
  151. package/lib/esm/nest/graph/GraphNodeCatalogueController.js +15 -1
  152. package/lib/esm/nest/graph/GraphNodeCatalogueController.js.map +1 -1
  153. package/lib/esm/nest/graph/GraphRunController.js +18 -1
  154. package/lib/esm/nest/graph/GraphRunController.js.map +1 -1
  155. package/lib/esm/nest/graph/GraphWorkflowController.js +35 -6
  156. package/lib/esm/nest/graph/GraphWorkflowController.js.map +1 -1
  157. package/lib/esm/node/comms/discord/node.js +375 -0
  158. package/lib/esm/node/comms/discord/node.js.map +1 -0
  159. package/lib/esm/node/comms/outlook/node.js +386 -0
  160. package/lib/esm/node/comms/outlook/node.js.map +1 -0
  161. package/lib/esm/node/comms/whatsapp/node.js +332 -0
  162. package/lib/esm/node/comms/whatsapp/node.js.map +1 -0
  163. package/lib/esm/node/data/aggregate/node.js +187 -0
  164. package/lib/esm/node/data/aggregate/node.js.map +1 -0
  165. package/lib/esm/node/data/compare-datasets/node.js +322 -0
  166. package/lib/esm/node/data/compare-datasets/node.js.map +1 -0
  167. package/lib/esm/node/data/item-lists/node.js +407 -0
  168. package/lib/esm/node/data/item-lists/node.js.map +1 -0
  169. package/lib/esm/node/data/remove-duplicates/node.js +132 -0
  170. package/lib/esm/node/data/remove-duplicates/node.js.map +1 -0
  171. package/lib/esm/node/data/summarize/node.js +146 -0
  172. package/lib/esm/node/data/summarize/node.js.map +1 -0
  173. package/lib/esm/node/data/support.js +5 -1
  174. package/lib/esm/node/data/support.js.map +1 -1
  175. package/lib/esm/node/data/transform-utils.js +702 -0
  176. package/lib/esm/node/data/transform-utils.js.map +1 -0
  177. package/lib/esm/node/index.js +110 -4
  178. package/lib/esm/node/index.js.map +1 -1
  179. package/lib/esm/node/io/confluence/node.js +244 -0
  180. package/lib/esm/node/io/confluence/node.js.map +1 -0
  181. package/lib/esm/node/io/convert-to-file/node.js +340 -0
  182. package/lib/esm/node/io/convert-to-file/node.js.map +1 -0
  183. package/lib/esm/node/io/file-support.js +299 -0
  184. package/lib/esm/node/io/file-support.js.map +1 -0
  185. package/lib/esm/node/io/google-calendar/node.js +350 -0
  186. package/lib/esm/node/io/google-calendar/node.js.map +1 -0
  187. package/lib/esm/node/io/google-docs/node.js +263 -0
  188. package/lib/esm/node/io/google-docs/node.js.map +1 -0
  189. package/lib/esm/node/io/html/node.js +266 -0
  190. package/lib/esm/node/io/html/node.js.map +1 -0
  191. package/lib/esm/node/io/html-extract/node.js +153 -0
  192. package/lib/esm/node/io/html-extract/node.js.map +1 -0
  193. package/lib/esm/node/io/html-support.js +206 -0
  194. package/lib/esm/node/io/html-support.js.map +1 -0
  195. package/lib/esm/node/io/jira/node.js +342 -0
  196. package/lib/esm/node/io/jira/node.js.map +1 -0
  197. package/lib/esm/node/io/markdown/node.js +217 -0
  198. package/lib/esm/node/io/markdown/node.js.map +1 -0
  199. package/lib/esm/node/io/microsoft-excel/node.js +252 -0
  200. package/lib/esm/node/io/microsoft-excel/node.js.map +1 -0
  201. package/lib/esm/node/io/microsoft-sharepoint/node.js +265 -0
  202. package/lib/esm/node/io/microsoft-sharepoint/node.js.map +1 -0
  203. package/lib/esm/node/io/read-binary-file/node.js +105 -0
  204. package/lib/esm/node/io/read-binary-file/node.js.map +1 -0
  205. package/lib/esm/node/io/read-binary-files/node.js +104 -0
  206. package/lib/esm/node/io/read-binary-files/node.js.map +1 -0
  207. package/lib/esm/node/io/write-binary-file/node.js +155 -0
  208. package/lib/esm/node/io/write-binary-file/node.js.map +1 -0
  209. package/lib/esm/node/io/xml/node.js +313 -0
  210. package/lib/esm/node/io/xml/node.js.map +1 -0
  211. package/lib/esm/node/manifests.js +58 -0
  212. package/lib/esm/node/manifests.js.map +1 -1
  213. package/lib/esm/node/storage/rabbitmq/node.js +243 -0
  214. package/lib/esm/node/storage/rabbitmq/node.js.map +1 -0
  215. package/lib/esm/node/triggers/error/node.js +99 -0
  216. package/lib/esm/node/triggers/error/node.js.map +1 -0
  217. package/lib/esm/node/triggers/postgres/node.js +235 -0
  218. package/lib/esm/node/triggers/postgres/node.js.map +1 -0
  219. package/lib/esm/node/triggers/rabbitmq/node.js +275 -0
  220. package/lib/esm/node/triggers/rabbitmq/node.js.map +1 -0
  221. package/lib/esm/node/triggers/redis/node.js +224 -0
  222. package/lib/esm/node/triggers/redis/node.js.map +1 -0
  223. package/lib/esm/node/triggers/sse/node.js +187 -0
  224. package/lib/esm/node/triggers/sse/node.js.map +1 -0
  225. package/lib/esm/node/triggers/support.js +99 -0
  226. package/lib/esm/node/triggers/support.js.map +1 -0
  227. package/lib/esm/node/triggers/workflow/node.js +184 -0
  228. package/lib/esm/node/triggers/workflow/node.js.map +1 -0
  229. package/lib/esm/shared/graph/catalog/GraphValueSchemaDerivation.js +20 -3
  230. package/lib/esm/shared/graph/catalog/GraphValueSchemaDerivation.js.map +1 -1
  231. package/lib/esm/workflows/boundary-value.workflow.js +34 -0
  232. package/lib/esm/workflows/boundary-value.workflow.js.map +1 -0
  233. package/lib/esm/workflows/builders.js +40 -0
  234. package/lib/esm/workflows/builders.js.map +1 -0
  235. package/lib/esm/workflows/chat-agent.workflow.js +36 -0
  236. package/lib/esm/workflows/chat-agent.workflow.js.map +1 -0
  237. package/lib/esm/workflows/error-boundary.workflow.js +50 -0
  238. package/lib/esm/workflows/error-boundary.workflow.js.map +1 -0
  239. package/lib/esm/workflows/event-map.workflow.js +33 -0
  240. package/lib/esm/workflows/event-map.workflow.js.map +1 -0
  241. package/lib/esm/workflows/foreach-break.workflow.js +54 -0
  242. package/lib/esm/workflows/foreach-break.workflow.js.map +1 -0
  243. package/lib/esm/workflows/human-approval.workflow.js +40 -0
  244. package/lib/esm/workflows/human-approval.workflow.js.map +1 -0
  245. package/lib/esm/workflows/if-switch.workflow.js +62 -0
  246. package/lib/esm/workflows/if-switch.workflow.js.map +1 -0
  247. package/lib/esm/workflows/index.js +116 -0
  248. package/lib/esm/workflows/index.js.map +1 -0
  249. package/lib/esm/workflows/loops-while-until.workflow.js +72 -0
  250. package/lib/esm/workflows/loops-while-until.workflow.js.map +1 -0
  251. package/lib/esm/workflows/manual-log.workflow.js +48 -0
  252. package/lib/esm/workflows/manual-log.workflow.js.map +1 -0
  253. package/lib/esm/workflows/schedule-code.workflow.js +38 -0
  254. package/lib/esm/workflows/schedule-code.workflow.js.map +1 -0
  255. package/lib/esm/workflows/types.js +2 -0
  256. package/lib/esm/workflows/types.js.map +1 -0
  257. package/lib/esm/workflows/value-templates.workflow.js +39 -0
  258. package/lib/esm/workflows/value-templates.workflow.js.map +1 -0
  259. package/lib/esm/workflows/webhook-form.workflow.js +44 -0
  260. package/lib/esm/workflows/webhook-form.workflow.js.map +1 -0
  261. package/lib/types/dagster/DagsterGraphExecutionBackend.d.cts +7 -0
  262. package/lib/types/dagster/DagsterGraphExecutionBackend.d.mts +7 -0
  263. package/lib/types/engine/execution/GraphCodeMode.d.cts +46 -0
  264. package/lib/types/engine/execution/GraphCodeMode.d.mts +46 -0
  265. package/lib/types/engine/execution/GraphExecutionBackend.d.cts +21 -0
  266. package/lib/types/engine/execution/GraphExecutionBackend.d.mts +21 -0
  267. package/lib/types/engine/execution/GraphExecutionEngine.d.cts +28 -3
  268. package/lib/types/engine/execution/GraphExecutionEngine.d.mts +28 -3
  269. package/lib/types/engine/validation/GraphNodeInstanceValidator.d.cts +11 -1
  270. package/lib/types/engine/validation/GraphNodeInstanceValidator.d.mts +11 -1
  271. package/lib/types/engine/validation/GraphWorkflowDocumentValidator.d.cts +7 -0
  272. package/lib/types/engine/validation/GraphWorkflowDocumentValidator.d.mts +7 -0
  273. package/lib/types/mastra/MastraWorkflowCompiler.d.cts +23 -8
  274. package/lib/types/mastra/MastraWorkflowCompiler.d.mts +23 -8
  275. package/lib/types/nest/graph/GraphEngineController.d.cts +19 -0
  276. package/lib/types/nest/graph/GraphEngineController.d.mts +19 -0
  277. package/lib/types/nest/graph/GraphNodeCatalogueController.d.cts +13 -0
  278. package/lib/types/nest/graph/GraphNodeCatalogueController.d.mts +13 -0
  279. package/lib/types/nest/graph/GraphRunController.d.cts +16 -0
  280. package/lib/types/nest/graph/GraphRunController.d.mts +16 -0
  281. package/lib/types/nest/graph/GraphWorkflowController.d.cts +26 -3
  282. package/lib/types/nest/graph/GraphWorkflowController.d.mts +26 -3
  283. package/lib/types/node/comms/discord/node.d.cts +67 -0
  284. package/lib/types/node/comms/discord/node.d.mts +67 -0
  285. package/lib/types/node/comms/outlook/node.d.cts +77 -0
  286. package/lib/types/node/comms/outlook/node.d.mts +77 -0
  287. package/lib/types/node/comms/whatsapp/node.d.cts +71 -0
  288. package/lib/types/node/comms/whatsapp/node.d.mts +71 -0
  289. package/lib/types/node/data/aggregate/node.d.cts +58 -0
  290. package/lib/types/node/data/aggregate/node.d.mts +58 -0
  291. package/lib/types/node/data/compare-datasets/node.d.cts +72 -0
  292. package/lib/types/node/data/compare-datasets/node.d.mts +72 -0
  293. package/lib/types/node/data/item-lists/node.d.cts +92 -0
  294. package/lib/types/node/data/item-lists/node.d.mts +92 -0
  295. package/lib/types/node/data/remove-duplicates/node.d.cts +47 -0
  296. package/lib/types/node/data/remove-duplicates/node.d.mts +47 -0
  297. package/lib/types/node/data/summarize/node.d.cts +44 -0
  298. package/lib/types/node/data/summarize/node.d.mts +44 -0
  299. package/lib/types/node/data/support.d.cts +13 -0
  300. package/lib/types/node/data/support.d.mts +13 -0
  301. package/lib/types/node/data/transform-utils.d.cts +236 -0
  302. package/lib/types/node/data/transform-utils.d.mts +236 -0
  303. package/lib/types/node/index.d.cts +54 -6
  304. package/lib/types/node/index.d.mts +54 -6
  305. package/lib/types/node/io/confluence/node.d.cts +49 -0
  306. package/lib/types/node/io/confluence/node.d.mts +49 -0
  307. package/lib/types/node/io/convert-to-file/node.d.cts +75 -0
  308. package/lib/types/node/io/convert-to-file/node.d.mts +75 -0
  309. package/lib/types/node/io/file-support.d.cts +118 -0
  310. package/lib/types/node/io/file-support.d.mts +118 -0
  311. package/lib/types/node/io/google-calendar/node.d.cts +65 -0
  312. package/lib/types/node/io/google-calendar/node.d.mts +65 -0
  313. package/lib/types/node/io/google-docs/node.d.cts +51 -0
  314. package/lib/types/node/io/google-docs/node.d.mts +51 -0
  315. package/lib/types/node/io/html/node.d.cts +68 -0
  316. package/lib/types/node/io/html/node.d.mts +68 -0
  317. package/lib/types/node/io/html-extract/node.d.cts +42 -0
  318. package/lib/types/node/io/html-extract/node.d.mts +42 -0
  319. package/lib/types/node/io/html-support.d.cts +69 -0
  320. package/lib/types/node/io/html-support.d.mts +69 -0
  321. package/lib/types/node/io/jira/node.d.cts +57 -0
  322. package/lib/types/node/io/jira/node.d.mts +57 -0
  323. package/lib/types/node/io/markdown/node.d.cts +61 -0
  324. package/lib/types/node/io/markdown/node.d.mts +61 -0
  325. package/lib/types/node/io/microsoft-excel/node.d.cts +45 -0
  326. package/lib/types/node/io/microsoft-excel/node.d.mts +45 -0
  327. package/lib/types/node/io/microsoft-sharepoint/node.d.cts +47 -0
  328. package/lib/types/node/io/microsoft-sharepoint/node.d.mts +47 -0
  329. package/lib/types/node/io/read-binary-file/node.d.cts +45 -0
  330. package/lib/types/node/io/read-binary-file/node.d.mts +45 -0
  331. package/lib/types/node/io/read-binary-files/node.d.cts +41 -0
  332. package/lib/types/node/io/read-binary-files/node.d.mts +41 -0
  333. package/lib/types/node/io/write-binary-file/node.d.cts +55 -0
  334. package/lib/types/node/io/write-binary-file/node.d.mts +55 -0
  335. package/lib/types/node/io/xml/node.d.cts +67 -0
  336. package/lib/types/node/io/xml/node.d.mts +67 -0
  337. package/lib/types/node/storage/rabbitmq/node.d.cts +55 -0
  338. package/lib/types/node/storage/rabbitmq/node.d.mts +55 -0
  339. package/lib/types/node/triggers/error/node.d.cts +34 -0
  340. package/lib/types/node/triggers/error/node.d.mts +34 -0
  341. package/lib/types/node/triggers/postgres/node.d.cts +54 -0
  342. package/lib/types/node/triggers/postgres/node.d.mts +54 -0
  343. package/lib/types/node/triggers/rabbitmq/node.d.cts +59 -0
  344. package/lib/types/node/triggers/rabbitmq/node.d.mts +59 -0
  345. package/lib/types/node/triggers/redis/node.d.cts +53 -0
  346. package/lib/types/node/triggers/redis/node.d.mts +53 -0
  347. package/lib/types/node/triggers/sse/node.d.cts +43 -0
  348. package/lib/types/node/triggers/sse/node.d.mts +43 -0
  349. package/lib/types/node/triggers/support.d.cts +41 -0
  350. package/lib/types/node/triggers/support.d.mts +41 -0
  351. package/lib/types/node/triggers/workflow/node.d.cts +46 -0
  352. package/lib/types/node/triggers/workflow/node.d.mts +46 -0
  353. package/lib/types/workflows/boundary-value.workflow.d.cts +3 -0
  354. package/lib/types/workflows/boundary-value.workflow.d.mts +3 -0
  355. package/lib/types/workflows/builders.d.cts +31 -0
  356. package/lib/types/workflows/builders.d.mts +31 -0
  357. package/lib/types/workflows/chat-agent.workflow.d.cts +3 -0
  358. package/lib/types/workflows/chat-agent.workflow.d.mts +3 -0
  359. package/lib/types/workflows/error-boundary.workflow.d.cts +3 -0
  360. package/lib/types/workflows/error-boundary.workflow.d.mts +3 -0
  361. package/lib/types/workflows/event-map.workflow.d.cts +3 -0
  362. package/lib/types/workflows/event-map.workflow.d.mts +3 -0
  363. package/lib/types/workflows/foreach-break.workflow.d.cts +3 -0
  364. package/lib/types/workflows/foreach-break.workflow.d.mts +3 -0
  365. package/lib/types/workflows/human-approval.workflow.d.cts +3 -0
  366. package/lib/types/workflows/human-approval.workflow.d.mts +3 -0
  367. package/lib/types/workflows/if-switch.workflow.d.cts +3 -0
  368. package/lib/types/workflows/if-switch.workflow.d.mts +3 -0
  369. package/lib/types/workflows/index.d.cts +37 -0
  370. package/lib/types/workflows/index.d.mts +37 -0
  371. package/lib/types/workflows/loops-while-until.workflow.d.cts +3 -0
  372. package/lib/types/workflows/loops-while-until.workflow.d.mts +3 -0
  373. package/lib/types/workflows/manual-log.workflow.d.cts +3 -0
  374. package/lib/types/workflows/manual-log.workflow.d.mts +3 -0
  375. package/lib/types/workflows/schedule-code.workflow.d.cts +3 -0
  376. package/lib/types/workflows/schedule-code.workflow.d.mts +3 -0
  377. package/lib/types/workflows/types.d.cts +32 -0
  378. package/lib/types/workflows/types.d.mts +32 -0
  379. package/lib/types/workflows/value-templates.workflow.d.cts +16 -0
  380. package/lib/types/workflows/value-templates.workflow.d.mts +16 -0
  381. package/lib/types/workflows/webhook-form.workflow.d.cts +3 -0
  382. package/lib/types/workflows/webhook-form.workflow.d.mts +3 -0
  383. package/package.json +247 -25
@@ -0,0 +1,266 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ /**
11
+ * @module as-graph/nodes/io/html
12
+ * @description HTML node with three operations: render a `{{path}}` template
13
+ * against the input (an array input renders one document per item), extract
14
+ * values from HTML using CSS selectors (see `HtmlExtractionValue`), and convert
15
+ * item data into an HTML table. Extraction accepts JSON, text, or base64 binary
16
+ * input and is backed by the helpers in `html-support`.
17
+ */
18
+ import { model, required } from "@decaf-ts/decorator-validation";
19
+ import { uielement } from "@decaf-ts/ui-decorators";
20
+ import { input, node, output } from "./../../../shared/graph/index.js";
21
+ import { GraphNode } from "./../../base.js";
22
+ import { GraphExecutionError } from "./../../../engine/errors/GraphExecutionError.js";
23
+ import { asGraphDataArray, getGraphDataValue, isGraphDataRecord, } from "./../../data/support.js";
24
+ import { binaryBufferOf } from "./../file-support.js";
25
+ import { extractHtmlValues, graphDataToHtmlTable, htmlDocumentOf, renderHtmlTemplate, } from "./../html-support.js";
26
+ /**
27
+ * HTML node (`core.io.html`): renders templates, extracts CSS-selected values,
28
+ * and converts item data to an HTML table.
29
+ */
30
+ let HtmlNode = class HtmlNode extends GraphNode {
31
+ constructor() {
32
+ super(...arguments);
33
+ /** Operation to perform (default `generateHtmlTemplate`). */
34
+ this.operation = "generateHtmlTemplate";
35
+ /** Extraction input kind (default `json`). */
36
+ this.sourceData = "json";
37
+ /** Field holding the HTML document or base64 payload (default `data`). */
38
+ this.dataPropertyName = "data";
39
+ /** CSS-selector extraction rules applied to each document. */
40
+ this.extractionValues = [];
41
+ /** Trim extracted values (default `true`). */
42
+ this.trimValues = true;
43
+ /** Collapse whitespace and newlines in extracted text (default `false`). */
44
+ this.cleanUpText = false;
45
+ /** Omit the default inline table styles (default `false`). */
46
+ this.customStyling = false;
47
+ /** Capitalize and humanize table headers (default `false`). */
48
+ this.capitalize = false;
49
+ }
50
+ /**
51
+ * Runs the configured HTML operation.
52
+ *
53
+ * @param request - Execution request; `inputs.value` carries the source data.
54
+ * @returns Execution values with the rendered, extracted, or tabular `result`
55
+ * and, for `convertToHtmlTable`, the `table` string.
56
+ * @throws {GraphExecutionError} `GRAPH_HTML_INVALID_INPUT` when extraction has
57
+ * no document, `GRAPH_HTML_EXTRACT_VALUES_REQUIRED` when no CSS selector is
58
+ * configured, or `GRAPH_HTML_TEMPLATE_REQUIRED` when template rendering has
59
+ * no template.
60
+ */
61
+ execute(request) {
62
+ const input = request.inputs["value"];
63
+ switch (this.operation) {
64
+ case "extractHtmlContent": {
65
+ const dataPropertyName = this.dataPropertyName || "data";
66
+ let documents;
67
+ if (this.sourceData === "binary") {
68
+ documents = [
69
+ binaryBufferOf(input, "base64", dataPropertyName).toString("utf8"),
70
+ ];
71
+ }
72
+ else if (isGraphDataRecord(input)) {
73
+ const selected = getGraphDataValue(input, dataPropertyName, true);
74
+ documents = htmlDocumentOf(selected ?? input);
75
+ }
76
+ else {
77
+ documents = htmlDocumentOf(input);
78
+ }
79
+ if (documents.length === 0) {
80
+ throw new GraphExecutionError("HTML node requires HTML content to extract", "GRAPH_HTML_INVALID_INPUT");
81
+ }
82
+ const values = (this.extractionValues ?? []).filter((entry) => entry && typeof entry.cssSelector === "string");
83
+ if (values.length === 0) {
84
+ throw new GraphExecutionError("HTML node requires at least one extraction value", "GRAPH_HTML_EXTRACT_VALUES_REQUIRED");
85
+ }
86
+ return {
87
+ result: documents.map((document) => extractHtmlValues(document, values, {
88
+ trimValues: this.trimValues !== false,
89
+ cleanUpText: this.cleanUpText === true,
90
+ })),
91
+ };
92
+ }
93
+ case "convertToHtmlTable": {
94
+ const table = graphDataToHtmlTable(asGraphDataArray(input), {
95
+ caption: this.caption,
96
+ tableAttributes: this.tableAttributes,
97
+ headerAttributes: this.headerAttributes,
98
+ rowAttributes: this.rowAttributes,
99
+ cellAttributes: this.cellAttributes,
100
+ customStyling: this.customStyling === true,
101
+ capitalize: this.capitalize === true,
102
+ });
103
+ return { result: table, table };
104
+ }
105
+ case "generateHtmlTemplate":
106
+ default: {
107
+ if (!this.html) {
108
+ throw new GraphExecutionError("HTML node requires a template to render", "GRAPH_HTML_TEMPLATE_REQUIRED");
109
+ }
110
+ if (Array.isArray(input)) {
111
+ return {
112
+ result: input
113
+ .filter((entry) => entry !== undefined && entry !== null)
114
+ .map((entry) => renderHtmlTemplate(this.html, entry)),
115
+ };
116
+ }
117
+ return { result: renderHtmlTemplate(this.html, input) };
118
+ }
119
+ }
120
+ }
121
+ };
122
+ __decorate([
123
+ input({ handle: "value" }),
124
+ __metadata("design:type", Object)
125
+ ], HtmlNode.prototype, "value", void 0);
126
+ __decorate([
127
+ uielement("ngx-decaf-crud-field", {
128
+ label: "graph.node.io.html.fields.operation.label",
129
+ type: "select",
130
+ }),
131
+ input({ handle: "operation", userControlled: true }),
132
+ __metadata("design:type", String)
133
+ ], HtmlNode.prototype, "operation", void 0);
134
+ __decorate([
135
+ uielement("ngx-decaf-crud-field", {
136
+ label: "graph.node.io.html.fields.html.label",
137
+ type: "textarea",
138
+ }),
139
+ input({ handle: "html", userControlled: true }),
140
+ __metadata("design:type", String)
141
+ ], HtmlNode.prototype, "html", void 0);
142
+ __decorate([
143
+ uielement("ngx-decaf-crud-field", {
144
+ label: "graph.node.io.html.fields.sourceData.label",
145
+ type: "select",
146
+ }),
147
+ input({ handle: "sourceData", userControlled: true }),
148
+ __metadata("design:type", String)
149
+ ], HtmlNode.prototype, "sourceData", void 0);
150
+ __decorate([
151
+ uielement("ngx-decaf-crud-field", {
152
+ label: "graph.node.io.html.fields.dataPropertyName.label",
153
+ placeholder: "graph.node.io.html.fields.dataPropertyName.placeholder",
154
+ type: "text",
155
+ }),
156
+ input({ handle: "dataPropertyName", userControlled: true }),
157
+ __metadata("design:type", String)
158
+ ], HtmlNode.prototype, "dataPropertyName", void 0);
159
+ __decorate([
160
+ uielement("ngx-decaf-crud-field", {
161
+ label: "graph.node.io.html.fields.extractionValues.label",
162
+ placeholder: "graph.node.io.html.fields.extractionValues.placeholder",
163
+ type: "collection",
164
+ }),
165
+ input({ handle: "extractionValues", userControlled: true, type: "array" }),
166
+ __metadata("design:type", Array)
167
+ ], HtmlNode.prototype, "extractionValues", void 0);
168
+ __decorate([
169
+ uielement("ngx-decaf-crud-field", {
170
+ label: "graph.node.io.html.fields.trimValues.label",
171
+ type: "checkbox",
172
+ }),
173
+ input({ handle: "trimValues", userControlled: true }),
174
+ __metadata("design:type", Boolean)
175
+ ], HtmlNode.prototype, "trimValues", void 0);
176
+ __decorate([
177
+ uielement("ngx-decaf-crud-field", {
178
+ label: "graph.node.io.html.fields.cleanUpText.label",
179
+ type: "checkbox",
180
+ }),
181
+ input({ handle: "cleanUpText", userControlled: true }),
182
+ __metadata("design:type", Boolean)
183
+ ], HtmlNode.prototype, "cleanUpText", void 0);
184
+ __decorate([
185
+ uielement("ngx-decaf-crud-field", {
186
+ label: "graph.node.io.html.fields.caption.label",
187
+ type: "text",
188
+ }),
189
+ input({ handle: "caption", userControlled: true }),
190
+ __metadata("design:type", String)
191
+ ], HtmlNode.prototype, "caption", void 0);
192
+ __decorate([
193
+ uielement("ngx-decaf-crud-field", {
194
+ label: "graph.node.io.html.fields.tableAttributes.label",
195
+ type: "text",
196
+ }),
197
+ input({ handle: "tableAttributes", userControlled: true }),
198
+ __metadata("design:type", String)
199
+ ], HtmlNode.prototype, "tableAttributes", void 0);
200
+ __decorate([
201
+ uielement("ngx-decaf-crud-field", {
202
+ label: "graph.node.io.html.fields.headerAttributes.label",
203
+ type: "text",
204
+ }),
205
+ input({ handle: "headerAttributes", userControlled: true }),
206
+ __metadata("design:type", String)
207
+ ], HtmlNode.prototype, "headerAttributes", void 0);
208
+ __decorate([
209
+ uielement("ngx-decaf-crud-field", {
210
+ label: "graph.node.io.html.fields.rowAttributes.label",
211
+ type: "text",
212
+ }),
213
+ input({ handle: "rowAttributes", userControlled: true }),
214
+ __metadata("design:type", String)
215
+ ], HtmlNode.prototype, "rowAttributes", void 0);
216
+ __decorate([
217
+ uielement("ngx-decaf-crud-field", {
218
+ label: "graph.node.io.html.fields.cellAttributes.label",
219
+ type: "text",
220
+ }),
221
+ input({ handle: "cellAttributes", userControlled: true }),
222
+ __metadata("design:type", String)
223
+ ], HtmlNode.prototype, "cellAttributes", void 0);
224
+ __decorate([
225
+ uielement("ngx-decaf-crud-field", {
226
+ label: "graph.node.io.html.fields.customStyling.label",
227
+ type: "checkbox",
228
+ }),
229
+ input({ handle: "customStyling", userControlled: true }),
230
+ __metadata("design:type", Boolean)
231
+ ], HtmlNode.prototype, "customStyling", void 0);
232
+ __decorate([
233
+ uielement("ngx-decaf-crud-field", {
234
+ label: "graph.node.io.html.fields.capitalize.label",
235
+ type: "checkbox",
236
+ }),
237
+ input({ handle: "capitalize", userControlled: true }),
238
+ __metadata("design:type", Boolean)
239
+ ], HtmlNode.prototype, "capitalize", void 0);
240
+ __decorate([
241
+ required(),
242
+ output({ handle: "result" }),
243
+ __metadata("design:type", Object)
244
+ ], HtmlNode.prototype, "result", void 0);
245
+ __decorate([
246
+ output({ handle: "table" }),
247
+ __metadata("design:type", String)
248
+ ], HtmlNode.prototype, "table", void 0);
249
+ HtmlNode = __decorate([
250
+ node("core.io.html", {
251
+ kind: "core.io.html",
252
+ category: "IO",
253
+ color: "#0ea5e9",
254
+ icon: "ti-brand-html5",
255
+ width: 96,
256
+ height: 96,
257
+ labels: ["io", "html", "template", "table"],
258
+ metadata: {
259
+ title: "graph.node.io.html.name",
260
+ description: "graph.node.io.html.description",
261
+ },
262
+ }),
263
+ model()
264
+ ], HtmlNode);
265
+ export { HtmlNode };
266
+ //# sourceMappingURL=node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.js","sourceRoot":"","sources":["../../../../../src/node/io/html/node.ts"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,yCAA8B;AAC5D,OAAO,EAAE,SAAS,EAAE,wBAAmB;AAKvC,OAAO,EAAE,mBAAmB,EAAE,wDAAmD;AACjF,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,GAClB,gCAA2B;AAC5B,OAAO,EAAE,cAAc,EAAE,6BAAwB;AACjD,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,cAAc,EACd,kBAAkB,GAEnB,6BAAwB;AAuBzB;;;GAGG;AAeI,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,SAAwC;IAA/D;;QA0FL,6DAA6D;QAM7D,cAAS,GAAkB,sBAAsB,CAAC;QAUlD,8CAA8C;QAM9C,eAAU,GAAmB,MAAM,CAAC;QAEpC,0EAA0E;QAO1E,qBAAgB,GAAW,MAAM,CAAC;QAElC,8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C;IACD,KAAK,EAAE;GACK,QAAQ,CAoNpB"}
@@ -0,0 +1,153 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ /**
11
+ * @module as-graph/nodes/io/html-extract
12
+ * @description Extracts values from one or more HTML documents with CSS
13
+ * selectors. Input may be a graph record (its `dataPropertyName` field or the
14
+ * record itself), raw HTML/text, an array of documents, or a base64 binary
15
+ * payload. Each document produces one record keyed by the configured
16
+ * extraction keys; see `extractHtmlValues` in `html-support`.
17
+ */
18
+ import { model, required } from "@decaf-ts/decorator-validation";
19
+ import { uielement } from "@decaf-ts/ui-decorators";
20
+ import { input, node, output } from "./../../../shared/graph/index.js";
21
+ import { GraphNode } from "./../../base.js";
22
+ import { GraphExecutionError } from "./../../../engine/errors/GraphExecutionError.js";
23
+ import { getGraphDataValue, isGraphDataRecord } from "./../../data/support.js";
24
+ import { binaryBufferOf } from "./../file-support.js";
25
+ import { extractHtmlValues, htmlDocumentOf, } from "./../html-support.js";
26
+ /**
27
+ * HTML Extract node (`core.io.htmlExtract`): applies CSS-selector extraction
28
+ * rules to each HTML document and returns one record per document.
29
+ */
30
+ let HtmlExtractNode = class HtmlExtractNode extends GraphNode {
31
+ constructor() {
32
+ super(...arguments);
33
+ /** Input kind (default `json`). */
34
+ this.sourceData = "json";
35
+ /** Field holding the HTML document or base64 payload (default `data`). */
36
+ this.dataPropertyName = "data";
37
+ /** CSS-selector extraction rules; entries without a `cssSelector` are ignored. */
38
+ this.extractionValues = [];
39
+ /** Trim extracted values (default `true`). */
40
+ this.trimValues = true;
41
+ /** Collapse whitespace and newlines in extracted text (default `false`). */
42
+ this.cleanUpText = false;
43
+ }
44
+ /**
45
+ * Extracts values from the input document(s).
46
+ *
47
+ * @param request - Execution request; `inputs.value` carries the document(s).
48
+ * @returns Execution values with the per-document extraction records.
49
+ * @throws {GraphExecutionError} `GRAPH_HTML_EXTRACT_INVALID_INPUT` when no
50
+ * document can be read, or `GRAPH_HTML_EXTRACT_VALUES_REQUIRED` when no CSS
51
+ * selector is configured.
52
+ */
53
+ execute(request) {
54
+ const input = request.inputs["value"];
55
+ const dataPropertyName = this.dataPropertyName || "data";
56
+ let documents;
57
+ if (this.sourceData === "binary") {
58
+ documents = [
59
+ binaryBufferOf(input, "base64", dataPropertyName).toString("utf8"),
60
+ ];
61
+ }
62
+ else if (isGraphDataRecord(input)) {
63
+ const selected = getGraphDataValue(input, dataPropertyName, true);
64
+ documents = htmlDocumentOf(selected ?? input);
65
+ }
66
+ else {
67
+ documents = htmlDocumentOf(input);
68
+ }
69
+ if (documents.length === 0) {
70
+ throw new GraphExecutionError("HTML Extract node requires HTML content", "GRAPH_HTML_EXTRACT_INVALID_INPUT");
71
+ }
72
+ const values = (this.extractionValues ?? []).filter((entry) => entry && typeof entry.cssSelector === "string");
73
+ if (values.length === 0) {
74
+ throw new GraphExecutionError("HTML Extract node requires at least one extraction value", "GRAPH_HTML_EXTRACT_VALUES_REQUIRED");
75
+ }
76
+ return {
77
+ result: documents.map((document) => extractHtmlValues(document, values, {
78
+ trimValues: this.trimValues !== false,
79
+ cleanUpText: this.cleanUpText === true,
80
+ })),
81
+ };
82
+ }
83
+ };
84
+ __decorate([
85
+ required(),
86
+ input({ handle: "value" }),
87
+ __metadata("design:type", Object)
88
+ ], HtmlExtractNode.prototype, "value", void 0);
89
+ __decorate([
90
+ uielement("ngx-decaf-crud-field", {
91
+ label: "graph.node.io.html_extract.fields.sourceData.label",
92
+ type: "select",
93
+ }),
94
+ input({ handle: "sourceData", userControlled: true }),
95
+ __metadata("design:type", String)
96
+ ], HtmlExtractNode.prototype, "sourceData", void 0);
97
+ __decorate([
98
+ uielement("ngx-decaf-crud-field", {
99
+ label: "graph.node.io.html_extract.fields.dataPropertyName.label",
100
+ placeholder: "graph.node.io.html_extract.fields.dataPropertyName.placeholder",
101
+ type: "text",
102
+ }),
103
+ input({ handle: "dataPropertyName", userControlled: true }),
104
+ __metadata("design:type", String)
105
+ ], HtmlExtractNode.prototype, "dataPropertyName", void 0);
106
+ __decorate([
107
+ uielement("ngx-decaf-crud-field", {
108
+ label: "graph.node.io.html_extract.fields.extractionValues.label",
109
+ placeholder: "graph.node.io.html_extract.fields.extractionValues.placeholder",
110
+ type: "collection",
111
+ }),
112
+ input({ handle: "extractionValues", userControlled: true, type: "array" }),
113
+ __metadata("design:type", Array)
114
+ ], HtmlExtractNode.prototype, "extractionValues", void 0);
115
+ __decorate([
116
+ uielement("ngx-decaf-crud-field", {
117
+ label: "graph.node.io.html_extract.fields.trimValues.label",
118
+ type: "checkbox",
119
+ }),
120
+ input({ handle: "trimValues", userControlled: true }),
121
+ __metadata("design:type", Boolean)
122
+ ], HtmlExtractNode.prototype, "trimValues", void 0);
123
+ __decorate([
124
+ uielement("ngx-decaf-crud-field", {
125
+ label: "graph.node.io.html_extract.fields.cleanUpText.label",
126
+ type: "checkbox",
127
+ }),
128
+ input({ handle: "cleanUpText", userControlled: true }),
129
+ __metadata("design:type", Boolean)
130
+ ], HtmlExtractNode.prototype, "cleanUpText", void 0);
131
+ __decorate([
132
+ required(),
133
+ output({ handle: "result" }),
134
+ __metadata("design:type", Array)
135
+ ], HtmlExtractNode.prototype, "result", void 0);
136
+ HtmlExtractNode = __decorate([
137
+ node("core.io.htmlExtract", {
138
+ kind: "core.io.htmlExtract",
139
+ category: "IO",
140
+ color: "#0ea5e9",
141
+ icon: "ti-cut",
142
+ width: 96,
143
+ height: 96,
144
+ labels: ["io", "html", "extract", "css"],
145
+ metadata: {
146
+ title: "graph.node.io.html_extract.name",
147
+ description: "graph.node.io.html_extract.description",
148
+ },
149
+ }),
150
+ model()
151
+ ], HtmlExtractNode);
152
+ export { HtmlExtractNode };
153
+ //# sourceMappingURL=node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.js","sourceRoot":"","sources":["../../../../../src/node/io/html-extract/node.ts"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,yCAA8B;AAC5D,OAAO,EAAE,SAAS,EAAE,wBAAmB;AAKvC,OAAO,EAAE,mBAAmB,EAAE,wDAAmD;AACjF,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,gCAA2B;AAC1E,OAAO,EAAE,cAAc,EAAE,6BAAwB;AACjD,OAAO,EACL,iBAAiB,EACjB,cAAc,GAEf,6BAAwB;AAczB;;;GAGG;AAeI,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,SAGpC;IAHM;;QA+DL,mCAAmC;QAMnC,eAAU,GAAsB,MAAM,CAAC;QAEvC,0EAA0E;QAQ1E,qBAAgB,GAAW,MAAM,CAAC;QAElC,kFAAkF;QAQlF,qBAAgB,GAA2B,EAAE,CAAC;QAE9C,8CAA8C;QAM9C,eAAU,GAAa,IAAI,CAAC;QAE5B,4EAA4E;QAM5E,gBAAW,GAAa,KAAK,CAAC;IAMhC,CAAC;IA3GC;;;;;;;;OAQG;IACM,OAAO,CACd,OAAwD;QAExD,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACtC,MAAM,gBAAgB,GAAG,IAAI,CAAC,gBAAgB,I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qB,EAAE;QAC3B,IAAI,EAAE,qBAAqB;QAC3B,QAAQ,EAAE,IAAI;QACd,KAAK,EAAE,SAAS;QAChB,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,EAAE;QACV,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,CAAC;QACxC,QAAQ,EAAE;YACR,KAAK,EAAE,iCAAiC;YACxC,WAAW,EAAE,wCAAwC;SACtD;KACF,CAAC;IACD,KAAK,EAAE;GACK,eAAe,CA+G3B"}
@@ -0,0 +1,206 @@
1
+ /**
2
+ * @module as-graph/nodes/io/html-support
3
+ * @summary HTML extraction, template rendering, and table helpers for the IO nodes.
4
+ * @description Cheerio-based extraction supports text, HTML, attribute, and form
5
+ * value returns, optional arrays for repeated matches, and selector-based
6
+ * text cleanup with `html-to-text`. The module also flattens HTML documents out
7
+ * of strings, arrays, buffers, and graph records, renders `{{path}}` templates,
8
+ * and builds HTML tables with optional captions and attributes.
9
+ */
10
+ import * as cheerio from "cheerio";
11
+ import { convert } from "html-to-text";
12
+ import { getGraphDataValue, isGraphDataRecord } from "./../data/support.js";
13
+ function applyTextOptions(value, options) {
14
+ if (value === undefined)
15
+ return value;
16
+ let result = value;
17
+ if (options.trimValues !== false)
18
+ result = result.trim();
19
+ if (options.cleanUpText) {
20
+ result = result
21
+ .replace(/^\s+|\s+$/g, "")
22
+ .replace(/(\r\n|\n|\r)/gm, "")
23
+ .replace(/\s+/g, " ");
24
+ }
25
+ return result;
26
+ }
27
+ function textOf(element, value) {
28
+ const entry = element;
29
+ if (!value.skipSelectors)
30
+ return entry.text() || undefined;
31
+ const selectors = value.skipSelectors
32
+ .split(",")
33
+ .map((selector) => selector.trim())
34
+ .filter((selector) => selector.length > 0)
35
+ .map((selector) => ({ selector, format: "skip" }));
36
+ return convert(entry.html() ?? "", { selectors }) || undefined;
37
+ }
38
+ function extractValue(element, value, options) {
39
+ const entry = element;
40
+ let result;
41
+ switch (value.returnValue ?? "text") {
42
+ case "attribute":
43
+ result = value.attribute ? entry.attr(value.attribute) : undefined;
44
+ break;
45
+ case "html":
46
+ result = entry.html() ?? undefined;
47
+ break;
48
+ case "value": {
49
+ const raw = entry.val();
50
+ result =
51
+ raw === undefined ? undefined : Array.isArray(raw) ? raw.join(",") : raw;
52
+ break;
53
+ }
54
+ case "text":
55
+ default:
56
+ result = textOf(element, value);
57
+ break;
58
+ }
59
+ if (result === undefined)
60
+ return undefined;
61
+ return applyTextOptions(result, options);
62
+ }
63
+ /**
64
+ * Applies extraction rules to an HTML document.
65
+ *
66
+ * @param html - The HTML document.
67
+ * @param values - Extraction rules; entries without a `cssSelector` are skipped.
68
+ * @param options - Text trimming/cleanup options.
69
+ * @returns A record keyed by each rule's `key` (or its selector).
70
+ */
71
+ export function extractHtmlValues(html, values, options = {}) {
72
+ const $ = cheerio.load(html);
73
+ const record = {};
74
+ for (const value of values) {
75
+ if (!value || typeof value.cssSelector !== "string")
76
+ continue;
77
+ const key = value.key || value.cssSelector;
78
+ const selection = $(value.cssSelector);
79
+ if (value.returnArray) {
80
+ const entries = [];
81
+ selection.each((_index, element) => {
82
+ entries.push(extractValue($(element), value, options));
83
+ });
84
+ record[key] = entries;
85
+ }
86
+ else {
87
+ record[key] = extractValue(selection, value, options);
88
+ }
89
+ }
90
+ return record;
91
+ }
92
+ /**
93
+ * Flattens a value into HTML document strings.
94
+ *
95
+ * Strings are used directly, arrays recurse, buffers/typed arrays/array
96
+ * buffers decode as UTF-8, and records contribute the first of their `data`,
97
+ * `content`, `html`, or `value` fields.
98
+ *
99
+ * @param value - The value to flatten.
100
+ * @returns The HTML document strings (empty when none can be found).
101
+ */
102
+ export function htmlDocumentOf(value) {
103
+ if (typeof value === "string")
104
+ return [value];
105
+ if (Array.isArray(value)) {
106
+ return value.flatMap((entry) => htmlDocumentOf(entry));
107
+ }
108
+ if (Buffer.isBuffer(value) || value instanceof Uint8Array) {
109
+ return [Buffer.from(value).toString("utf8")];
110
+ }
111
+ if (value instanceof ArrayBuffer) {
112
+ return [Buffer.from(new Uint8Array(value)).toString("utf8")];
113
+ }
114
+ if (isGraphDataRecord(value)) {
115
+ for (const key of ["data", "content", "html", "value"]) {
116
+ if (value[key] !== undefined && value[key] !== value) {
117
+ return htmlDocumentOf(value[key]);
118
+ }
119
+ }
120
+ }
121
+ return [];
122
+ }
123
+ /**
124
+ * Renders `{{path}}` placeholders against graph data.
125
+ *
126
+ * Paths are dot-addressed (an optional `$json.` prefix is dropped); missing
127
+ * values render as an empty string and objects render as JSON.
128
+ *
129
+ * @param template - The template text.
130
+ * @param data - The value used for placeholder lookup.
131
+ * @returns The rendered template.
132
+ */
133
+ export function renderHtmlTemplate(template, data) {
134
+ return template.replace(/\{\{\s*([^}]+?)\s*\}\}/g, (_match, rawPath) => {
135
+ const path = String(rawPath).replace(/^\$json\.?/, "").trim();
136
+ const value = getGraphDataValue(data, path, true);
137
+ if (value === undefined || value === null)
138
+ return "";
139
+ if (typeof value === "object")
140
+ return JSON.stringify(value);
141
+ return String(value);
142
+ });
143
+ }
144
+ function capitalizeHeader(header, capitalize) {
145
+ if (!capitalize)
146
+ return header;
147
+ return header
148
+ .split("_")
149
+ .filter((word) => word)
150
+ .map((word) => word[0].toUpperCase() + word.slice(1))
151
+ .join(" ");
152
+ }
153
+ /**
154
+ * Builds an HTML table from item records.
155
+ *
156
+ * Headers are the union of the record keys; booleans render as checkboxes and
157
+ * missing values as empty cells. Default inline styles are omitted when
158
+ * `customStyling` is set, and `capitalize` humanizes headers.
159
+ *
160
+ * @param items - The items to render; non-records become `{ value }` rows.
161
+ * @param options - Caption, attribute, styling, and header options.
162
+ * @returns The HTML table markup.
163
+ */
164
+ export function graphDataToHtmlTable(items, options = {}) {
165
+ const records = items.map((item) => isGraphDataRecord(item) ? item : { value: item });
166
+ const headers = Array.from(new Set(records.flatMap((record) => Object.keys(record))));
167
+ const tableStyle = options.customStyling
168
+ ? ""
169
+ : "style='border-spacing:0; font-family:helvetica,arial,sans-serif'";
170
+ const headerStyle = options.customStyling
171
+ ? ""
172
+ : "style='margin:0; padding:7px 20px 7px 0px; border-bottom:1px solid #eee; text-align:left; color:#888; font-weight:normal'";
173
+ const cellStyle = options.customStyling
174
+ ? ""
175
+ : "style='margin:0; padding:7px 20px 7px 0px; border-bottom:1px solid #eee'";
176
+ let table = `<table ${tableStyle} ${options.tableAttributes ?? ""}>`;
177
+ if (options.caption)
178
+ table += `<caption>${options.caption}</caption>`;
179
+ table += `<thead ${headerStyle} ${options.headerAttributes ?? ""}>`;
180
+ table += "<tr>";
181
+ table += headers
182
+ .map((header) => `<th>${capitalizeHeader(header, options.capitalize)}</th>`)
183
+ .join("");
184
+ table += "</tr></thead><tbody>";
185
+ for (const record of records) {
186
+ table += `<tr ${options.rowAttributes ?? ""}>`;
187
+ table += headers
188
+ .map((header) => {
189
+ const value = record[header];
190
+ let cell = `<td ${cellStyle} ${options.cellAttributes ?? ""}>`;
191
+ if (typeof value === "boolean") {
192
+ cell += `<input type="checkbox" ${value ? 'checked="checked"' : ""}/>`;
193
+ }
194
+ else {
195
+ cell += value === undefined || value === null ? "" : String(value);
196
+ }
197
+ cell += "</td>";
198
+ return cell;
199
+ })
200
+ .join("");
201
+ table += "</tr>";
202
+ }
203
+ table += "</tbody></table>";
204
+ return table;
205
+ }
206
+ //# sourceMappingURL=html-support.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"html-support.js","sourceRoot":"","sources":["../../../../src/node/io/html-support.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,6BAAwB;AAqBvE,SAAS,gBAAgB,CACvB,KAAyB,EACzB,OAA8B;IAE9B,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IACtC,IAAI,MAAM,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