@n8n/instance-ai 1.0.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 (504) hide show
  1. package/LICENSE.md +88 -0
  2. package/dist/agent/instance-agent.d.ts +3 -0
  3. package/dist/agent/instance-agent.js +215 -0
  4. package/dist/agent/instance-agent.js.map +1 -0
  5. package/dist/agent/register-with-mastra.d.ts +3 -0
  6. package/dist/agent/register-with-mastra.js +19 -0
  7. package/dist/agent/register-with-mastra.js.map +1 -0
  8. package/dist/agent/sanitize-mcp-schemas.d.ts +2 -0
  9. package/dist/agent/sanitize-mcp-schemas.js +91 -0
  10. package/dist/agent/sanitize-mcp-schemas.js.map +1 -0
  11. package/dist/agent/sub-agent-factory.d.ts +14 -0
  12. package/dist/agent/sub-agent-factory.js +48 -0
  13. package/dist/agent/sub-agent-factory.js.map +1 -0
  14. package/dist/agent/system-prompt.d.ts +13 -0
  15. package/dist/agent/system-prompt.js +226 -0
  16. package/dist/agent/system-prompt.js.map +1 -0
  17. package/dist/build.tsbuildinfo +1 -0
  18. package/dist/compaction/compaction-helper.d.ts +9 -0
  19. package/dist/compaction/compaction-helper.js +58 -0
  20. package/dist/compaction/compaction-helper.js.map +1 -0
  21. package/dist/compaction/index.d.ts +2 -0
  22. package/dist/compaction/index.js +6 -0
  23. package/dist/compaction/index.js.map +1 -0
  24. package/dist/domain-access/domain-access-tracker.d.ts +9 -0
  25. package/dist/domain-access/domain-access-tracker.js +46 -0
  26. package/dist/domain-access/domain-access-tracker.js.map +1 -0
  27. package/dist/domain-access/domain-gating.d.ts +65 -0
  28. package/dist/domain-access/domain-gating.js +68 -0
  29. package/dist/domain-access/domain-gating.js.map +1 -0
  30. package/dist/domain-access/index.d.ts +4 -0
  31. package/dist/domain-access/index.js +11 -0
  32. package/dist/domain-access/index.js.map +1 -0
  33. package/dist/event-bus/event-bus.interface.d.ts +15 -0
  34. package/dist/event-bus/event-bus.interface.js +3 -0
  35. package/dist/event-bus/event-bus.interface.js.map +1 -0
  36. package/dist/event-bus/index.d.ts +1 -0
  37. package/dist/event-bus/index.js +3 -0
  38. package/dist/event-bus/index.js.map +1 -0
  39. package/dist/index.d.ts +46 -0
  40. package/dist/index.js +89 -0
  41. package/dist/index.js.map +1 -0
  42. package/dist/mcp/mcp-client-manager.d.ts +6 -0
  43. package/dist/mcp/mcp-client-manager.js +34 -0
  44. package/dist/mcp/mcp-client-manager.js.map +1 -0
  45. package/dist/memory/memory-config.d.ts +3 -0
  46. package/dist/memory/memory-config.js +29 -0
  47. package/dist/memory/memory-config.js.map +1 -0
  48. package/dist/memory/title-utils.d.ts +3 -0
  49. package/dist/memory/title-utils.js +42 -0
  50. package/dist/memory/title-utils.js.map +1 -0
  51. package/dist/memory/working-memory-template.d.ts +1 -0
  52. package/dist/memory/working-memory-template.js +25 -0
  53. package/dist/memory/working-memory-template.js.map +1 -0
  54. package/dist/planned-tasks/planned-task-service.d.ts +33 -0
  55. package/dist/planned-tasks/planned-task-service.js +151 -0
  56. package/dist/planned-tasks/planned-task-service.js.map +1 -0
  57. package/dist/runtime/background-task-manager.d.ts +53 -0
  58. package/dist/runtime/background-task-manager.js +127 -0
  59. package/dist/runtime/background-task-manager.js.map +1 -0
  60. package/dist/runtime/resumable-stream-executor.d.ts +75 -0
  61. package/dist/runtime/resumable-stream-executor.js +1552 -0
  62. package/dist/runtime/resumable-stream-executor.js.map +1 -0
  63. package/dist/runtime/run-state-registry.d.ts +109 -0
  64. package/dist/runtime/run-state-registry.js +210 -0
  65. package/dist/runtime/run-state-registry.js.map +1 -0
  66. package/dist/runtime/stream-runner.d.ts +27 -0
  67. package/dist/runtime/stream-runner.js +87 -0
  68. package/dist/runtime/stream-runner.js.map +1 -0
  69. package/dist/runtime/working-memory-tracing.d.ts +19 -0
  70. package/dist/runtime/working-memory-tracing.js +111 -0
  71. package/dist/runtime/working-memory-tracing.js.map +1 -0
  72. package/dist/storage/agent-tree-snapshot.d.ts +7 -0
  73. package/dist/storage/agent-tree-snapshot.js +3 -0
  74. package/dist/storage/agent-tree-snapshot.js.map +1 -0
  75. package/dist/storage/index.d.ts +10 -0
  76. package/dist/storage/index.js +17 -0
  77. package/dist/storage/index.js.map +1 -0
  78. package/dist/storage/iteration-log.d.ts +30 -0
  79. package/dist/storage/iteration-log.js +31 -0
  80. package/dist/storage/iteration-log.js.map +1 -0
  81. package/dist/storage/mastra-iteration-log-storage.d.ts +10 -0
  82. package/dist/storage/mastra-iteration-log-storage.js +57 -0
  83. package/dist/storage/mastra-iteration-log-storage.js.map +1 -0
  84. package/dist/storage/mastra-task-storage.d.ts +9 -0
  85. package/dist/storage/mastra-task-storage.js +35 -0
  86. package/dist/storage/mastra-task-storage.js.map +1 -0
  87. package/dist/storage/planned-task-storage.d.ts +10 -0
  88. package/dist/storage/planned-task-storage.js +97 -0
  89. package/dist/storage/planned-task-storage.js.map +1 -0
  90. package/dist/storage/thread-patch.d.ts +16 -0
  91. package/dist/storage/thread-patch.js +50 -0
  92. package/dist/storage/thread-patch.js.map +1 -0
  93. package/dist/storage/workflow-loop-storage.d.ts +217 -0
  94. package/dist/storage/workflow-loop-storage.js +59 -0
  95. package/dist/storage/workflow-loop-storage.js.map +1 -0
  96. package/dist/stream/consume-with-hitl.d.ts +22 -0
  97. package/dist/stream/consume-with-hitl.js +29 -0
  98. package/dist/stream/consume-with-hitl.js.map +1 -0
  99. package/dist/stream/map-chunk.d.ts +2 -0
  100. package/dist/stream/map-chunk.js +224 -0
  101. package/dist/stream/map-chunk.js.map +1 -0
  102. package/dist/tools/best-practices/get-best-practices.tool.d.ts +12 -0
  103. package/dist/tools/best-practices/get-best-practices.tool.js +64 -0
  104. package/dist/tools/best-practices/get-best-practices.tool.js.map +1 -0
  105. package/dist/tools/best-practices/guides/chatbot.d.ts +1 -0
  106. package/dist/tools/best-practices/guides/chatbot.js +111 -0
  107. package/dist/tools/best-practices/guides/chatbot.js.map +1 -0
  108. package/dist/tools/best-practices/guides/content-generation.d.ts +1 -0
  109. package/dist/tools/best-practices/guides/content-generation.js +108 -0
  110. package/dist/tools/best-practices/guides/content-generation.js.map +1 -0
  111. package/dist/tools/best-practices/guides/data-extraction.d.ts +1 -0
  112. package/dist/tools/best-practices/guides/data-extraction.js +115 -0
  113. package/dist/tools/best-practices/guides/data-extraction.js.map +1 -0
  114. package/dist/tools/best-practices/guides/data-persistence.d.ts +1 -0
  115. package/dist/tools/best-practices/guides/data-persistence.js +198 -0
  116. package/dist/tools/best-practices/guides/data-persistence.js.map +1 -0
  117. package/dist/tools/best-practices/guides/data-transformation.d.ts +1 -0
  118. package/dist/tools/best-practices/guides/data-transformation.js +139 -0
  119. package/dist/tools/best-practices/guides/data-transformation.js.map +1 -0
  120. package/dist/tools/best-practices/guides/document-processing.d.ts +1 -0
  121. package/dist/tools/best-practices/guides/document-processing.js +326 -0
  122. package/dist/tools/best-practices/guides/document-processing.js.map +1 -0
  123. package/dist/tools/best-practices/guides/form-input.d.ts +1 -0
  124. package/dist/tools/best-practices/guides/form-input.js +166 -0
  125. package/dist/tools/best-practices/guides/form-input.js.map +1 -0
  126. package/dist/tools/best-practices/guides/notification.d.ts +1 -0
  127. package/dist/tools/best-practices/guides/notification.js +128 -0
  128. package/dist/tools/best-practices/guides/notification.js.map +1 -0
  129. package/dist/tools/best-practices/guides/scheduling.d.ts +1 -0
  130. package/dist/tools/best-practices/guides/scheduling.js +145 -0
  131. package/dist/tools/best-practices/guides/scheduling.js.map +1 -0
  132. package/dist/tools/best-practices/guides/scraping-and-research.d.ts +1 -0
  133. package/dist/tools/best-practices/guides/scraping-and-research.js +151 -0
  134. package/dist/tools/best-practices/guides/scraping-and-research.js.map +1 -0
  135. package/dist/tools/best-practices/guides/triage.d.ts +1 -0
  136. package/dist/tools/best-practices/guides/triage.js +142 -0
  137. package/dist/tools/best-practices/guides/triage.js.map +1 -0
  138. package/dist/tools/best-practices/index.d.ts +2 -0
  139. package/dist/tools/best-practices/index.js +34 -0
  140. package/dist/tools/best-practices/index.js.map +1 -0
  141. package/dist/tools/best-practices/techniques.d.ts +20 -0
  142. package/dist/tools/best-practices/techniques.js +40 -0
  143. package/dist/tools/best-practices/techniques.js.map +1 -0
  144. package/dist/tools/credentials/delete-credential.tool.d.ts +21 -0
  145. package/dist/tools/credentials/delete-credential.tool.js +51 -0
  146. package/dist/tools/credentials/delete-credential.tool.js.map +1 -0
  147. package/dist/tools/credentials/get-credential.tool.d.ts +4 -0
  148. package/dist/tools/credentials/get-credential.tool.js +26 -0
  149. package/dist/tools/credentials/get-credential.tool.js.map +1 -0
  150. package/dist/tools/credentials/list-credentials.tool.d.ts +6 -0
  151. package/dist/tools/credentials/list-credentials.tool.js +30 -0
  152. package/dist/tools/credentials/list-credentials.tool.js.map +1 -0
  153. package/dist/tools/credentials/search-credential-types.tool.d.ts +6 -0
  154. package/dist/tools/credentials/search-credential-types.tool.js +44 -0
  155. package/dist/tools/credentials/search-credential-types.tool.js.map +1 -0
  156. package/dist/tools/credentials/setup-credentials.tool.d.ts +73 -0
  157. package/dist/tools/credentials/setup-credentials.tool.js +134 -0
  158. package/dist/tools/credentials/setup-credentials.tool.js.map +1 -0
  159. package/dist/tools/credentials/test-credential.tool.d.ts +7 -0
  160. package/dist/tools/credentials/test-credential.tool.js +30 -0
  161. package/dist/tools/credentials/test-credential.tool.js.map +1 -0
  162. package/dist/tools/data-tables/add-data-table-column.tool.d.ts +27 -0
  163. package/dist/tools/data-tables/add-data-table-column.tool.js +60 -0
  164. package/dist/tools/data-tables/add-data-table-column.tool.js.map +1 -0
  165. package/dist/tools/data-tables/create-data-table.tool.d.ts +36 -0
  166. package/dist/tools/data-tables/create-data-table.tool.js +79 -0
  167. package/dist/tools/data-tables/create-data-table.tool.js.map +1 -0
  168. package/dist/tools/data-tables/delete-data-table-column.tool.d.ts +21 -0
  169. package/dist/tools/data-tables/delete-data-table-column.tool.js +48 -0
  170. package/dist/tools/data-tables/delete-data-table-column.tool.js.map +1 -0
  171. package/dist/tools/data-tables/delete-data-table-rows.tool.d.ts +29 -0
  172. package/dist/tools/data-tables/delete-data-table-rows.tool.js +63 -0
  173. package/dist/tools/data-tables/delete-data-table-rows.tool.js.map +1 -0
  174. package/dist/tools/data-tables/delete-data-table.tool.d.ts +20 -0
  175. package/dist/tools/data-tables/delete-data-table.tool.js +46 -0
  176. package/dist/tools/data-tables/delete-data-table.tool.js.map +1 -0
  177. package/dist/tools/data-tables/get-data-table-schema.tool.d.ts +11 -0
  178. package/dist/tools/data-tables/get-data-table-schema.tool.js +27 -0
  179. package/dist/tools/data-tables/get-data-table-schema.tool.js.map +1 -0
  180. package/dist/tools/data-tables/insert-data-table-rows.tool.d.ts +21 -0
  181. package/dist/tools/data-tables/insert-data-table-rows.tool.js +52 -0
  182. package/dist/tools/data-tables/insert-data-table-rows.tool.js.map +1 -0
  183. package/dist/tools/data-tables/list-data-tables.tool.d.ts +6 -0
  184. package/dist/tools/data-tables/list-data-tables.tool.js +32 -0
  185. package/dist/tools/data-tables/list-data-tables.tool.js.map +1 -0
  186. package/dist/tools/data-tables/query-data-table-rows.tool.d.ts +21 -0
  187. package/dist/tools/data-tables/query-data-table-rows.tool.js +54 -0
  188. package/dist/tools/data-tables/query-data-table-rows.tool.js.map +1 -0
  189. package/dist/tools/data-tables/rename-data-table-column.tool.d.ts +22 -0
  190. package/dist/tools/data-tables/rename-data-table-column.tool.js +49 -0
  191. package/dist/tools/data-tables/rename-data-table-column.tool.js.map +1 -0
  192. package/dist/tools/data-tables/update-data-table-rows.tool.d.ts +29 -0
  193. package/dist/tools/data-tables/update-data-table-rows.tool.js +57 -0
  194. package/dist/tools/data-tables/update-data-table-rows.tool.js.map +1 -0
  195. package/dist/tools/executions/debug-execution.tool.d.ts +4 -0
  196. package/dist/tools/executions/debug-execution.tool.js +41 -0
  197. package/dist/tools/executions/debug-execution.tool.js.map +1 -0
  198. package/dist/tools/executions/get-execution.tool.d.ts +4 -0
  199. package/dist/tools/executions/get-execution.tool.js +26 -0
  200. package/dist/tools/executions/get-execution.tool.js.map +1 -0
  201. package/dist/tools/executions/get-node-output.tool.d.ts +7 -0
  202. package/dist/tools/executions/get-node-output.tool.js +44 -0
  203. package/dist/tools/executions/get-node-output.tool.js.map +1 -0
  204. package/dist/tools/executions/list-executions.tool.d.ts +8 -0
  205. package/dist/tools/executions/list-executions.tool.js +45 -0
  206. package/dist/tools/executions/list-executions.tool.js.map +1 -0
  207. package/dist/tools/executions/run-workflow.tool.d.ts +24 -0
  208. package/dist/tools/executions/run-workflow.tool.js +82 -0
  209. package/dist/tools/executions/run-workflow.tool.js.map +1 -0
  210. package/dist/tools/executions/stop-execution.tool.d.ts +7 -0
  211. package/dist/tools/executions/stop-execution.tool.js +22 -0
  212. package/dist/tools/executions/stop-execution.tool.js.map +1 -0
  213. package/dist/tools/filesystem/create-tools-from-mcp-server.d.ts +3 -0
  214. package/dist/tools/filesystem/create-tools-from-mcp-server.js +61 -0
  215. package/dist/tools/filesystem/create-tools-from-mcp-server.js.map +1 -0
  216. package/dist/tools/filesystem/get-file-tree.tool.d.ts +22 -0
  217. package/dist/tools/filesystem/get-file-tree.tool.js +64 -0
  218. package/dist/tools/filesystem/get-file-tree.tool.js.map +1 -0
  219. package/dist/tools/filesystem/list-files.tool.d.ts +30 -0
  220. package/dist/tools/filesystem/list-files.tool.js +100 -0
  221. package/dist/tools/filesystem/list-files.tool.js.map +1 -0
  222. package/dist/tools/filesystem/read-file.tool.d.ts +25 -0
  223. package/dist/tools/filesystem/read-file.tool.js +83 -0
  224. package/dist/tools/filesystem/read-file.tool.js.map +1 -0
  225. package/dist/tools/filesystem/search-files.tool.d.ts +31 -0
  226. package/dist/tools/filesystem/search-files.tool.js +96 -0
  227. package/dist/tools/filesystem/search-files.tool.js.map +1 -0
  228. package/dist/tools/index.d.ts +2385 -0
  229. package/dist/tools/index.js +195 -0
  230. package/dist/tools/index.js.map +1 -0
  231. package/dist/tools/nodes/explore-node-resources.tool.d.ts +21 -0
  232. package/dist/tools/nodes/explore-node-resources.tool.js +71 -0
  233. package/dist/tools/nodes/explore-node-resources.tool.js.map +1 -0
  234. package/dist/tools/nodes/get-node-description.tool.d.ts +23 -0
  235. package/dist/tools/nodes/get-node-description.tool.js +52 -0
  236. package/dist/tools/nodes/get-node-description.tool.js.map +1 -0
  237. package/dist/tools/nodes/get-node-type-definition.tool.d.ts +17 -0
  238. package/dist/tools/nodes/get-node-type-definition.tool.js +73 -0
  239. package/dist/tools/nodes/get-node-type-definition.tool.js.map +1 -0
  240. package/dist/tools/nodes/get-suggested-nodes.tool.d.ts +14 -0
  241. package/dist/tools/nodes/get-suggested-nodes.tool.js +54 -0
  242. package/dist/tools/nodes/get-suggested-nodes.tool.js.map +1 -0
  243. package/dist/tools/nodes/list-nodes.tool.d.ts +6 -0
  244. package/dist/tools/nodes/list-nodes.tool.js +33 -0
  245. package/dist/tools/nodes/list-nodes.tool.js.map +1 -0
  246. package/dist/tools/nodes/node-search-engine.d.ts +18 -0
  247. package/dist/tools/nodes/node-search-engine.js +266 -0
  248. package/dist/tools/nodes/node-search-engine.js.map +1 -0
  249. package/dist/tools/nodes/node-search-engine.types.d.ts +38 -0
  250. package/dist/tools/nodes/node-search-engine.types.js +18 -0
  251. package/dist/tools/nodes/node-search-engine.types.js.map +1 -0
  252. package/dist/tools/nodes/search-nodes.tool.d.ts +28 -0
  253. package/dist/tools/nodes/search-nodes.tool.js +87 -0
  254. package/dist/tools/nodes/search-nodes.tool.js.map +1 -0
  255. package/dist/tools/nodes/suggested-nodes-data.d.ts +11 -0
  256. package/dist/tools/nodes/suggested-nodes-data.js +326 -0
  257. package/dist/tools/nodes/suggested-nodes-data.js.map +1 -0
  258. package/dist/tools/orchestration/browser-credential-setup.tool.d.ts +14 -0
  259. package/dist/tools/orchestration/browser-credential-setup.tool.js +429 -0
  260. package/dist/tools/orchestration/browser-credential-setup.tool.js.map +1 -0
  261. package/dist/tools/orchestration/build-workflow-agent.prompt.d.ts +2 -0
  262. package/dist/tools/orchestration/build-workflow-agent.prompt.js +836 -0
  263. package/dist/tools/orchestration/build-workflow-agent.prompt.js.map +1 -0
  264. package/dist/tools/orchestration/build-workflow-agent.tool.d.ts +23 -0
  265. package/dist/tools/orchestration/build-workflow-agent.tool.js +503 -0
  266. package/dist/tools/orchestration/build-workflow-agent.tool.js.map +1 -0
  267. package/dist/tools/orchestration/cancel-background-task.tool.d.ts +6 -0
  268. package/dist/tools/orchestration/cancel-background-task.tool.js +24 -0
  269. package/dist/tools/orchestration/cancel-background-task.tool.js.map +1 -0
  270. package/dist/tools/orchestration/correct-background-task.tool.d.ts +7 -0
  271. package/dist/tools/orchestration/correct-background-task.tool.js +41 -0
  272. package/dist/tools/orchestration/correct-background-task.tool.js.map +1 -0
  273. package/dist/tools/orchestration/data-table-agent.prompt.d.ts +1 -0
  274. package/dist/tools/orchestration/data-table-agent.prompt.js +29 -0
  275. package/dist/tools/orchestration/data-table-agent.prompt.js.map +1 -0
  276. package/dist/tools/orchestration/data-table-agent.tool.d.ts +21 -0
  277. package/dist/tools/orchestration/data-table-agent.tool.js +171 -0
  278. package/dist/tools/orchestration/data-table-agent.tool.js.map +1 -0
  279. package/dist/tools/orchestration/delegate.schemas.d.ts +32 -0
  280. package/dist/tools/orchestration/delegate.schemas.js +29 -0
  281. package/dist/tools/orchestration/delegate.schemas.js.map +1 -0
  282. package/dist/tools/orchestration/delegate.tool.d.ts +27 -0
  283. package/dist/tools/orchestration/delegate.tool.js +307 -0
  284. package/dist/tools/orchestration/delegate.tool.js.map +1 -0
  285. package/dist/tools/orchestration/display-utils.d.ts +1 -0
  286. package/dist/tools/orchestration/display-utils.js +8 -0
  287. package/dist/tools/orchestration/display-utils.js.map +1 -0
  288. package/dist/tools/orchestration/plan.tool.d.ts +45 -0
  289. package/dist/tools/orchestration/plan.tool.js +99 -0
  290. package/dist/tools/orchestration/plan.tool.js.map +1 -0
  291. package/dist/tools/orchestration/report-verification-verdict.tool.d.ts +14 -0
  292. package/dist/tools/orchestration/report-verification-verdict.tool.js +66 -0
  293. package/dist/tools/orchestration/report-verification-verdict.tool.js.map +1 -0
  294. package/dist/tools/orchestration/research-agent-prompt.d.ts +1 -0
  295. package/dist/tools/orchestration/research-agent-prompt.js +28 -0
  296. package/dist/tools/orchestration/research-agent-prompt.js.map +1 -0
  297. package/dist/tools/orchestration/research-with-agent.tool.d.ts +23 -0
  298. package/dist/tools/orchestration/research-with-agent.tool.js +160 -0
  299. package/dist/tools/orchestration/research-with-agent.tool.js.map +1 -0
  300. package/dist/tools/orchestration/tracing-utils.d.ts +20 -0
  301. package/dist/tools/orchestration/tracing-utils.js +102 -0
  302. package/dist/tools/orchestration/tracing-utils.js.map +1 -0
  303. package/dist/tools/orchestration/update-tasks.tool.d.ts +10 -0
  304. package/dist/tools/orchestration/update-tasks.tool.js +26 -0
  305. package/dist/tools/orchestration/update-tasks.tool.js.map +1 -0
  306. package/dist/tools/orchestration/verify-built-workflow.tool.d.ts +13 -0
  307. package/dist/tools/orchestration/verify-built-workflow.tool.js +58 -0
  308. package/dist/tools/orchestration/verify-built-workflow.tool.js.map +1 -0
  309. package/dist/tools/shared/ask-user.tool.d.ts +61 -0
  310. package/dist/tools/shared/ask-user.tool.js +98 -0
  311. package/dist/tools/shared/ask-user.tool.js.map +1 -0
  312. package/dist/tools/templates/search-template-parameters.tool.d.ts +11 -0
  313. package/dist/tools/templates/search-template-parameters.tool.js +55 -0
  314. package/dist/tools/templates/search-template-parameters.tool.js.map +1 -0
  315. package/dist/tools/templates/search-template-structures.tool.d.ts +12 -0
  316. package/dist/tools/templates/search-template-structures.tool.js +45 -0
  317. package/dist/tools/templates/search-template-structures.tool.js.map +1 -0
  318. package/dist/tools/templates/template-api.d.ts +21 -0
  319. package/dist/tools/templates/template-api.js +104 -0
  320. package/dist/tools/templates/template-api.js.map +1 -0
  321. package/dist/tools/templates/types.d.ts +52 -0
  322. package/dist/tools/templates/types.js +37 -0
  323. package/dist/tools/templates/types.js.map +1 -0
  324. package/dist/tools/utils/mermaid.utils.d.ts +15 -0
  325. package/dist/tools/utils/mermaid.utils.js +622 -0
  326. package/dist/tools/utils/mermaid.utils.js.map +1 -0
  327. package/dist/tools/utils/node-configuration.utils.d.ts +6 -0
  328. package/dist/tools/utils/node-configuration.utils.js +77 -0
  329. package/dist/tools/utils/node-configuration.utils.js.map +1 -0
  330. package/dist/tools/web-research/fetch-url.tool.d.ts +27 -0
  331. package/dist/tools/web-research/fetch-url.tool.js +116 -0
  332. package/dist/tools/web-research/fetch-url.tool.js.map +1 -0
  333. package/dist/tools/web-research/index.d.ts +1 -0
  334. package/dist/tools/web-research/index.js +6 -0
  335. package/dist/tools/web-research/index.js.map +1 -0
  336. package/dist/tools/web-research/sanitize-web-content.d.ts +3 -0
  337. package/dist/tools/web-research/sanitize-web-content.js +36 -0
  338. package/dist/tools/web-research/sanitize-web-content.js.map +1 -0
  339. package/dist/tools/web-research/web-search.tool.d.ts +6 -0
  340. package/dist/tools/web-research/web-search.tool.js +57 -0
  341. package/dist/tools/web-research/web-search.tool.js.map +1 -0
  342. package/dist/tools/workflows/apply-workflow-credentials.tool.d.ts +10 -0
  343. package/dist/tools/workflows/apply-workflow-credentials.tool.js +87 -0
  344. package/dist/tools/workflows/apply-workflow-credentials.tool.js.map +1 -0
  345. package/dist/tools/workflows/build-workflow.tool.d.ts +16 -0
  346. package/dist/tools/workflows/build-workflow.tool.js +163 -0
  347. package/dist/tools/workflows/build-workflow.tool.js.map +1 -0
  348. package/dist/tools/workflows/delete-workflow.tool.d.ts +21 -0
  349. package/dist/tools/workflows/delete-workflow.tool.js +51 -0
  350. package/dist/tools/workflows/delete-workflow.tool.js.map +1 -0
  351. package/dist/tools/workflows/get-workflow-as-code.tool.d.ts +14 -0
  352. package/dist/tools/workflows/get-workflow-as-code.tool.js +37 -0
  353. package/dist/tools/workflows/get-workflow-as-code.tool.js.map +1 -0
  354. package/dist/tools/workflows/get-workflow-version.tool.d.ts +21 -0
  355. package/dist/tools/workflows/get-workflow-version.tool.js +38 -0
  356. package/dist/tools/workflows/get-workflow-version.tool.js.map +1 -0
  357. package/dist/tools/workflows/get-workflow.tool.d.ts +18 -0
  358. package/dist/tools/workflows/get-workflow.tool.js +36 -0
  359. package/dist/tools/workflows/get-workflow.tool.js.map +1 -0
  360. package/dist/tools/workflows/list-workflow-versions.tool.d.ts +8 -0
  361. package/dist/tools/workflows/list-workflow-versions.tool.js +47 -0
  362. package/dist/tools/workflows/list-workflow-versions.tool.js.map +1 -0
  363. package/dist/tools/workflows/list-workflows.tool.d.ts +14 -0
  364. package/dist/tools/workflows/list-workflows.tool.js +42 -0
  365. package/dist/tools/workflows/list-workflows.tool.js.map +1 -0
  366. package/dist/tools/workflows/materialize-node-type.tool.d.ts +23 -0
  367. package/dist/tools/workflows/materialize-node-type.tool.js +105 -0
  368. package/dist/tools/workflows/materialize-node-type.tool.js.map +1 -0
  369. package/dist/tools/workflows/publish-workflow.tool.d.ts +24 -0
  370. package/dist/tools/workflows/publish-workflow.tool.js +92 -0
  371. package/dist/tools/workflows/publish-workflow.tool.js.map +1 -0
  372. package/dist/tools/workflows/resolve-credentials.d.ts +14 -0
  373. package/dist/tools/workflows/resolve-credentials.js +89 -0
  374. package/dist/tools/workflows/resolve-credentials.js.map +1 -0
  375. package/dist/tools/workflows/restore-workflow-version.tool.d.ts +22 -0
  376. package/dist/tools/workflows/restore-workflow-version.tool.js +65 -0
  377. package/dist/tools/workflows/restore-workflow-version.tool.js.map +1 -0
  378. package/dist/tools/workflows/setup-workflow.schema.d.ts +331 -0
  379. package/dist/tools/workflows/setup-workflow.schema.js +21 -0
  380. package/dist/tools/workflows/setup-workflow.schema.js.map +1 -0
  381. package/dist/tools/workflows/setup-workflow.service.d.ts +40 -0
  382. package/dist/tools/workflows/setup-workflow.service.js +470 -0
  383. package/dist/tools/workflows/setup-workflow.service.js.map +1 -0
  384. package/dist/tools/workflows/setup-workflow.tool.d.ts +150 -0
  385. package/dist/tools/workflows/setup-workflow.tool.js +219 -0
  386. package/dist/tools/workflows/setup-workflow.tool.js.map +1 -0
  387. package/dist/tools/workflows/submit-workflow.tool.d.ts +33 -0
  388. package/dist/tools/workflows/submit-workflow.tool.js +258 -0
  389. package/dist/tools/workflows/submit-workflow.tool.js.map +1 -0
  390. package/dist/tools/workflows/unpublish-workflow.tool.d.ts +22 -0
  391. package/dist/tools/workflows/unpublish-workflow.tool.js +61 -0
  392. package/dist/tools/workflows/unpublish-workflow.tool.js.map +1 -0
  393. package/dist/tools/workflows/update-workflow-version.tool.d.ts +9 -0
  394. package/dist/tools/workflows/update-workflow-version.tool.js +35 -0
  395. package/dist/tools/workflows/update-workflow-version.tool.js.map +1 -0
  396. package/dist/tools/workflows/write-sandbox-file.tool.d.ts +13 -0
  397. package/dist/tools/workflows/write-sandbox-file.tool.js +53 -0
  398. package/dist/tools/workflows/write-sandbox-file.tool.js.map +1 -0
  399. package/dist/tools/workspace/cleanup-test-executions.tool.d.ts +22 -0
  400. package/dist/tools/workspace/cleanup-test-executions.tool.js +58 -0
  401. package/dist/tools/workspace/cleanup-test-executions.tool.js.map +1 -0
  402. package/dist/tools/workspace/create-folder.tool.d.ts +24 -0
  403. package/dist/tools/workspace/create-folder.tool.js +59 -0
  404. package/dist/tools/workspace/create-folder.tool.js.map +1 -0
  405. package/dist/tools/workspace/delete-folder.tool.d.ts +24 -0
  406. package/dist/tools/workspace/delete-folder.tool.js +60 -0
  407. package/dist/tools/workspace/delete-folder.tool.js.map +1 -0
  408. package/dist/tools/workspace/list-folders.tool.d.ts +6 -0
  409. package/dist/tools/workspace/list-folders.tool.js +26 -0
  410. package/dist/tools/workspace/list-folders.tool.js.map +1 -0
  411. package/dist/tools/workspace/list-projects.tool.d.ts +4 -0
  412. package/dist/tools/workspace/list-projects.tool.js +24 -0
  413. package/dist/tools/workspace/list-projects.tool.js.map +1 -0
  414. package/dist/tools/workspace/list-tags.tool.d.ts +7 -0
  415. package/dist/tools/workspace/list-tags.tool.js +23 -0
  416. package/dist/tools/workspace/list-tags.tool.js.map +1 -0
  417. package/dist/tools/workspace/move-workflow-to-folder.tool.d.ts +23 -0
  418. package/dist/tools/workspace/move-workflow-to-folder.tool.js +56 -0
  419. package/dist/tools/workspace/move-workflow-to-folder.tool.js.map +1 -0
  420. package/dist/tools/workspace/tag-workflow.tool.d.ts +22 -0
  421. package/dist/tools/workspace/tag-workflow.tool.js +52 -0
  422. package/dist/tools/workspace/tag-workflow.tool.js.map +1 -0
  423. package/dist/tracing/langsmith-tracing.d.ts +56 -0
  424. package/dist/tracing/langsmith-tracing.js +810 -0
  425. package/dist/tracing/langsmith-tracing.js.map +1 -0
  426. package/dist/types.d.ts +709 -0
  427. package/dist/types.js +3 -0
  428. package/dist/types.js.map +1 -0
  429. package/dist/utils/agent-tree.d.ts +3 -0
  430. package/dist/utils/agent-tree.js +23 -0
  431. package/dist/utils/agent-tree.js.map +1 -0
  432. package/dist/utils/format-timestamp.d.ts +1 -0
  433. package/dist/utils/format-timestamp.js +19 -0
  434. package/dist/utils/format-timestamp.js.map +1 -0
  435. package/dist/utils/stream-helpers.d.ts +15 -0
  436. package/dist/utils/stream-helpers.js +26 -0
  437. package/dist/utils/stream-helpers.js.map +1 -0
  438. package/dist/workflow-builder/extract-code.d.ts +5 -0
  439. package/dist/workflow-builder/extract-code.js +105 -0
  440. package/dist/workflow-builder/extract-code.js.map +1 -0
  441. package/dist/workflow-builder/index.d.ts +5 -0
  442. package/dist/workflow-builder/index.js +19 -0
  443. package/dist/workflow-builder/index.js.map +1 -0
  444. package/dist/workflow-builder/parse-validate.d.ts +6 -0
  445. package/dist/workflow-builder/parse-validate.js +49 -0
  446. package/dist/workflow-builder/parse-validate.js.map +1 -0
  447. package/dist/workflow-builder/patch-code.d.ts +14 -0
  448. package/dist/workflow-builder/patch-code.js +117 -0
  449. package/dist/workflow-builder/patch-code.js.map +1 -0
  450. package/dist/workflow-builder/sdk-prompt-sections.d.ts +4 -0
  451. package/dist/workflow-builder/sdk-prompt-sections.js +517 -0
  452. package/dist/workflow-builder/sdk-prompt-sections.js.map +1 -0
  453. package/dist/workflow-builder/types.d.ts +11 -0
  454. package/dist/workflow-builder/types.js +3 -0
  455. package/dist/workflow-builder/types.js.map +1 -0
  456. package/dist/workflow-loop/guidance.d.ts +5 -0
  457. package/dist/workflow-loop/guidance.js +37 -0
  458. package/dist/workflow-loop/guidance.js.map +1 -0
  459. package/dist/workflow-loop/index.d.ts +5 -0
  460. package/dist/workflow-loop/index.js +25 -0
  461. package/dist/workflow-loop/index.js.map +1 -0
  462. package/dist/workflow-loop/runtime.d.ts +8 -0
  463. package/dist/workflow-loop/runtime.js +40 -0
  464. package/dist/workflow-loop/runtime.js.map +1 -0
  465. package/dist/workflow-loop/workflow-loop-controller.d.ts +11 -0
  466. package/dist/workflow-loop/workflow-loop-controller.js +212 -0
  467. package/dist/workflow-loop/workflow-loop-controller.js.map +1 -0
  468. package/dist/workflow-loop/workflow-loop-state.d.ts +189 -0
  469. package/dist/workflow-loop/workflow-loop-state.js +77 -0
  470. package/dist/workflow-loop/workflow-loop-state.js.map +1 -0
  471. package/dist/workflow-loop/workflow-task-service.d.ts +13 -0
  472. package/dist/workflow-loop/workflow-task-service.js +35 -0
  473. package/dist/workflow-loop/workflow-task-service.js.map +1 -0
  474. package/dist/workspace/builder-sandbox-factory.d.ts +25 -0
  475. package/dist/workspace/builder-sandbox-factory.js +199 -0
  476. package/dist/workspace/builder-sandbox-factory.js.map +1 -0
  477. package/dist/workspace/create-workspace.d.ts +33 -0
  478. package/dist/workspace/create-workspace.js +56 -0
  479. package/dist/workspace/create-workspace.js.map +1 -0
  480. package/dist/workspace/daytona-filesystem.d.ts +25 -0
  481. package/dist/workspace/daytona-filesystem.js +109 -0
  482. package/dist/workspace/daytona-filesystem.js.map +1 -0
  483. package/dist/workspace/n8n-sandbox-client.d.ts +105 -0
  484. package/dist/workspace/n8n-sandbox-client.js +335 -0
  485. package/dist/workspace/n8n-sandbox-client.js.map +1 -0
  486. package/dist/workspace/n8n-sandbox-filesystem.d.ts +25 -0
  487. package/dist/workspace/n8n-sandbox-filesystem.js +128 -0
  488. package/dist/workspace/n8n-sandbox-filesystem.js.map +1 -0
  489. package/dist/workspace/n8n-sandbox-image-manager.d.ts +5 -0
  490. package/dist/workspace/n8n-sandbox-image-manager.js +25 -0
  491. package/dist/workspace/n8n-sandbox-image-manager.js.map +1 -0
  492. package/dist/workspace/n8n-sandbox-sandbox.d.ts +27 -0
  493. package/dist/workspace/n8n-sandbox-sandbox.js +103 -0
  494. package/dist/workspace/n8n-sandbox-sandbox.js.map +1 -0
  495. package/dist/workspace/sandbox-fs.d.ts +9 -0
  496. package/dist/workspace/sandbox-fs.js +43 -0
  497. package/dist/workspace/sandbox-fs.js.map +1 -0
  498. package/dist/workspace/sandbox-setup.d.ts +11 -0
  499. package/dist/workspace/sandbox-setup.js +139 -0
  500. package/dist/workspace/sandbox-setup.js.map +1 -0
  501. package/dist/workspace/snapshot-manager.d.ts +8 -0
  502. package/dist/workspace/snapshot-manager.js +31 -0
  503. package/dist/workspace/snapshot-manager.js.map +1 -0
  504. package/package.json +54 -0
@@ -0,0 +1,139 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getDocumentation = getDocumentation;
4
+ function getDocumentation() {
5
+ return `# Best Practices: Data Transformation
6
+
7
+ ## Workflow Design
8
+
9
+ ### Core Principles
10
+ - **Structure**: Always follow Input -> Transform -> Output pattern
11
+ - **Optimization**: Filter and reduce data early to improve performance
12
+
13
+ ### Design Best Practices
14
+ - Plan transformation requirements in plain language before building
15
+ - Use Modular Design: Create reusable sub-workflows for common tasks like "Data Cleaning" or "Error Handler"
16
+ - Batch datasets over 100 items using Split In Batches node to prevent timeouts
17
+
18
+ ## Recommended Nodes
19
+
20
+ ### Essential Transformation Nodes
21
+
22
+ #### Edit Fields (Set) (n8n-nodes-base.set)
23
+
24
+ **Purpose**: Create, modify, rename fields; change data types
25
+
26
+ **Key Setting**: "Keep Only Set" - drops all fields not explicitly defined (default: disabled)
27
+
28
+ **Use Cases**:
29
+ - Extract specific columns
30
+ - Add calculated fields
31
+ - Convert data types (string to number)
32
+ - Format dates using expressions
33
+
34
+ **Pitfalls**:
35
+ - Not understanding "Keep Only Set" behavior can lead to data loss
36
+ - Enabled: Drops all fields not explicitly defined (data loss risk)
37
+ - Disabled: Carries forward all fields (potential bloat)
38
+ - Always verify output structure after configuration
39
+
40
+ **Testing tip**: When transforming data from a workflow trigger, you can set values with a fallback default e.g. set name to {{$json.name || 'Jane Doe'}} to help test the workflow.
41
+
42
+ #### IF/Filter Nodes
43
+
44
+ **IF Node** (n8n-nodes-base.if):
45
+ - **Purpose**: Conditional processing and routing
46
+ - **Best Practice**: Use early to validate inputs and remove bad data
47
+ - **Example**: Check if required fields exist before processing
48
+
49
+ **Filter Node** (n8n-nodes-base.filter):
50
+ - **Purpose**: Filter items based on conditions
51
+ - **Best Practice**: Use early in workflow to reduce data volume
52
+
53
+ #### Merge Node (n8n-nodes-base.merge)
54
+
55
+ **Purpose**: Combine two data streams
56
+
57
+ **Modes**:
58
+ - Merge by Key (like database join)
59
+ - Merge by Index
60
+ - Append
61
+
62
+ **Pitfalls**:
63
+ - **Missing Keys**: Trying to merge on non-existent fields
64
+ - **Field Name Mismatch**: Different field names in sources
65
+ - **Solution**: Use Edit Fields node to normalize field names before merging
66
+
67
+ #### Code Node (n8n-nodes-base.code)
68
+
69
+ **Execution Modes**:
70
+ - "Run Once per Item": Process each item independently
71
+ - "Run Once for All Items": Access entire dataset (for aggregation)
72
+
73
+ **Return Format**: Must return array of objects with json property
74
+ \`\`\`javascript
75
+ return items; // or return [{ json: {...} }];
76
+ \`\`\`
77
+
78
+ **Pitfalls**:
79
+ - Wrong return format: Not returning array of objects with json property
80
+ - Overly complex: Stuffing entire workflow logic in one Code node
81
+ - Keep code nodes focused on single transformation aspect
82
+
83
+ #### Summarize Node (n8n-nodes-base.summarize)
84
+
85
+ **Purpose**: Pivot table-style aggregations (count, sum, average, min/max)
86
+
87
+ **Configuration**:
88
+ - Fields to Summarize: Choose aggregation function
89
+ - Fields to Split By: Grouping keys
90
+
91
+ **Output**: Single item with summary or multiple items per group
92
+
93
+ ### Data Restructuring Nodes
94
+
95
+ - **Split Out** (n8n-nodes-base.splitOut): Convert single item with array into multiple items
96
+ - **Aggregate** (n8n-nodes-base.aggregate): Combine multiple items into one
97
+ - **Remove Duplicates** (n8n-nodes-base.removeDuplicates): Delete duplicate items based on field criteria
98
+ - **Sort** (n8n-nodes-base.sort): Order items alphabetically/numerically
99
+ - **Limit** (n8n-nodes-base.limit): Trim to maximum number of items
100
+
101
+ ### Batch Processing
102
+
103
+ **Split In Batches** (n8n-nodes-base.splitInBatches):
104
+ - **Purpose**: Process large datasets in chunks
105
+ - **Use When**: Handling 100+ items with expensive operations (API calls, AI)
106
+
107
+ ## Input Data Validation
108
+ - Validate external data before processing: check for nulls, empty values, and edge cases (special chars, empty arrays)
109
+
110
+ ## Common Pitfalls to Avoid
111
+
112
+ ### Critical Mistakes
113
+
114
+ #### Edit Fields Node Issues
115
+ - **Mistake**: Not understanding "Keep Only Set" behavior
116
+ - Enabled: Drops all fields not explicitly defined (data loss risk)
117
+ - Disabled: Carries forward all fields (potential bloat)
118
+ - **Solution**: Always verify output structure after configuration
119
+
120
+ #### Code Node Errors
121
+ - **Wrong Return Format**: Not returning array of objects with json property
122
+ - **Fix**: Always return \`items\` or \`[{ json: {...} }]\`
123
+ - **Overly Complex**: Stuffing entire workflow logic in one Code node
124
+ - **Fix**: Keep code nodes focused on single transformation aspect
125
+
126
+ #### Merge Node Problems
127
+ - **Field Name Mismatch**: Different field names in sources
128
+ - **Fix**: Normalize field names with Edit Fields before merging
129
+
130
+ ### Performance Pitfalls
131
+ - Processing large datasets without batching -> timeouts
132
+ - Not filtering early -> unnecessary processing overhead
133
+ - Excessive node chaining -> visual clutter and slow execution
134
+
135
+ ### Data Validation Pitfalls
136
+ - Assuming input data is always perfect -> runtime errors
137
+ `;
138
+ }
139
+ //# sourceMappingURL=data-transformation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-transformation.js","sourceRoot":"","sources":["../../../../src/tools/best-practices/guides/data-transformation.ts"],"names":[],"mappings":";;AAAA,4CAsIC;AAtID,SAAgB,gBAAgB;IAC/B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoIP,CAAC;AACF,CAAC"}
@@ -0,0 +1 @@
1
+ export declare function getDocumentation(): string;
@@ -0,0 +1,326 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getDocumentation = getDocumentation;
4
+ function getDocumentation() {
5
+ return `# Best Practices: Document Processing Workflows
6
+
7
+ ## Workflow Design
8
+
9
+ Document processing workflows extract and act on content from files like PDFs, images, Word documents, and spreadsheets. Design your workflow following these core patterns:
10
+
11
+ ### Core Architecture Pattern
12
+ Trigger -> Capture Binary -> Extract Text -> Parse/Transform -> Route to Destination -> Notify
13
+
14
+ ### Common Flow Patterns
15
+
16
+ **Simple Document Processing:**
17
+ - Gmail Trigger -> Check file type -> Extract from File -> DataTable -> Slack notification
18
+ - Best for: Basic text-based PDFs with straightforward data extraction
19
+
20
+ **Complex Document Processing with AI:**
21
+ - Webhook -> File Type Check -> OCR (if image) -> AI Extract -> Validate -> CRM Update -> Multiple notifications
22
+ - Best for: Varied document formats requiring intelligent parsing
23
+
24
+ **Batch Document Processing:**
25
+ - Main workflow: Schedule Trigger -> Fetch Files -> Split In Batches -> Sub-workflow -> Merge Results -> Bulk Update
26
+ - Sub-workflow When Executed by Another Workflow -> Process result
27
+ - Best for: High-volume processing with API rate limits
28
+
29
+ **Multi-Source Document Aggregation:**
30
+ - Multiple Triggers (Email + Drive + Webhook) -> Set common fields -> Standardize -> Process -> Store
31
+ - Best for: Documents from various channels needing unified processing
32
+
33
+ ### Branching Strategy
34
+
35
+ Always branch early based on document characteristics:
36
+ - **File Type Branching**: Use IF/Switch nodes immediately after ingestion to route PDFs vs images vs spreadsheets
37
+ - **Provider Branching**: Route documents to provider-specific processing (e.g., different invoice formats)
38
+ - **Quality Branching**: Separate high-confidence extractions from those needing manual review
39
+
40
+ ## Binary Data Management
41
+ Documents in n8n are handled as binary data that must be carefully preserved throughout the workflow.
42
+
43
+ ### Referencing Binary Data from Other Nodes
44
+ When you need to reference binary data from a previous node, use this syntax:
45
+ - Expression: '{{ $('Node Name').item.binary.property_name }}' or {{ $binary.property_name }} if previous item
46
+ - Example for Gmail attachments: '{{ $('Gmail Trigger').item.binary.attachment_0 }}' or {{ $binary.attachment_0 }} if previous item
47
+ - Example for webhook data: '{{ $('Webhook').item.binary.data }}' or {{ $binary.data }} if previous item
48
+ - Important: The property name depends on how the previous node names the binary data
49
+
50
+ ### Preserving Binary Data
51
+ - Many nodes (Code, Edit Fields, AI nodes) output JSON and drop binary data by default
52
+ - Use parallel branches: one for processing, one to preserve the original file
53
+ - Rejoin branches with Merge node in pass-through mode
54
+ - Alternative: Configure nodes to keep binary (e.g., Edit field node's "Include Other Input Fields" option ON)
55
+
56
+ ### Memory Optimization
57
+ For high-volume processing:
58
+ - Process files sequentially or in small batches
59
+ - Drop unnecessary binary data after extraction to free memory
60
+
61
+ ### File Metadata
62
+ Documents uploaded via a form trigger will have various bits of metadata available - filename, mimetype and size.
63
+ These are accessible using an expression like {{ $json.documents[0].mimetype }} to access each of the document's details.
64
+ Multiple files can be uploaded to a form which is the reason for the documents array.
65
+
66
+ ## Text Extraction Strategy
67
+
68
+ Choose extraction method based on document type and content:
69
+
70
+ ### Critical: File Type Detection
71
+ **ALWAYS check the file type before using Extract from File node** (unless the file type is already known):
72
+ - Use IF node to check file extension or MIME type first
73
+ - The Extract from File node has multiple operations, each for a specific file type:
74
+ - "Extract from PDF" for PDF files
75
+ - "Extract from MS Excel" for Excel files (.xlsx, .xls)
76
+ - "Extract from MS Word" for Word documents (.docx, .doc)
77
+ - "Extract from CSV" for CSV files
78
+ - "Extract from HTML" for HTML files
79
+ - "Extract from RTF" for Rich Text Format files
80
+ - "Extract from Text File" for plain text files
81
+ - Using the wrong operation will result in errors or empty output
82
+
83
+ ### Decision Tree for Extraction
84
+ 1. **Check file type** -> Route to appropriate extraction method
85
+ 2. **Scanned image/PDF?** -> Use OCR service (OCR.space, AWS Textract, Google Vision)
86
+ 3. **Structured invoice/receipt?** -> Use specialized parser (Mindee) or AI extraction
87
+ 4. **Text-based document?** -> Use Extract from File with the correct operation for that file type
88
+
89
+ ### Fallback Strategy
90
+ Always implement fallback for extraction failures:
91
+ - Check if text extraction returns empty
92
+ - If empty, automatically route to OCR
93
+ - If OCR fails, send to manual review queue
94
+
95
+ ## Data Parsing & Classification
96
+
97
+ ### AI-Powered Extraction Pattern
98
+ For varied or complex documents:
99
+
100
+ Option 1 - Using Document Loader (Recommended for binary files):
101
+ 1. Pass binary data directly to Document Loader node (set Data Source to "Binary")
102
+ 2. Connect to AI Agent or LLM Chain for processing
103
+ 3. Validate extracted fields before processing
104
+
105
+ Option 2 - Using text extraction:
106
+ 1. Extract raw text using Extract from File or OCR
107
+ 2. Pass to AI Agent or LLM Chain with structured prompt
108
+ 3. Validate extracted fields before processing
109
+
110
+ Example system prompt structure:
111
+ "Extract the following fields from the document: [field list]. Return as JSON with this schema: [schema example]"
112
+
113
+ ### Document Classification Flow
114
+ Classify before processing for better accuracy:
115
+ 1. Initial AI classification (Invoice vs Receipt vs Contract)
116
+ 2. Route to specialized sub-workflow based on type
117
+ 3. Use type-specific prompts and validation rules
118
+ 4. This reduces errors and improves extraction quality
119
+
120
+ ## Error Handling Strategy
121
+
122
+ Build resilience at every step:
123
+
124
+ ### Validation Checkpoints
125
+ - After extraction: Verify text not empty
126
+ - After AI parsing: Validate JSON schema
127
+ - Before database insert: Check required fields
128
+ - After API calls: Verify success response
129
+
130
+ ## Performance Optimization
131
+
132
+ ### Batch Processing Strategy
133
+ - Use Split In Batches node: process 5-10 files at a time
134
+ - Implement delays between batches for rate-limited APIs
135
+ - Monitor memory usage and adjust batch size accordingly
136
+
137
+ ## Recommended Nodes
138
+
139
+ ### Triggers & Input
140
+
141
+ **Gmail Trigger (n8n-nodes-base.gmailTrigger)**
142
+ Purpose: Monitor Gmail for emails with attachments (Recommended over IMAP)
143
+ Advantages: Real-time processing, simpler authentication, better integration with Google Workspace
144
+ Critical Configuration for Attachments:
145
+ - **MUST set "Simplify" to FALSE** - otherwise attachments won't be available
146
+ - **MUST set "Download Attachments" to TRUE** to retrieve files
147
+ - Set appropriate label filters
148
+ - Set "Property Prefix Name" (e.g., "attachment_") - attachments will be named with this prefix plus index
149
+ - Important: When referencing its binary data, it will be referenced "attachment_0", "attachment_1", etc., NOT "data"
150
+
151
+ **Email Read (IMAP) (n8n-nodes-base.emailReadImap)**
152
+ Purpose: Alternative email fetching if there's no specialized node for email provider
153
+ Configuration:
154
+ - Enable "Download Attachments" to retrieve files
155
+ - Set "Property Prefix Name" (e.g., "attachment_") - attachments will be named with this prefix plus index
156
+ - Important: When referencing binary data, it will be referenced "attachment_0", "attachment_1", etc., NOT "data"
157
+
158
+ **HTTP Webhook (n8n-nodes-base.webhook)**
159
+ Purpose: Receive file uploads from web forms
160
+ Configuration: Enable "Raw Body" for binary data
161
+
162
+ **Google Drive Trigger (n8n-nodes-base.googleDriveTrigger)**
163
+ Purpose: Monitor folders for new documents
164
+ Configuration: Set appropriate folder and file type filters
165
+
166
+ ### Text Extraction
167
+
168
+ **Extract from File (n8n-nodes-base.extractFromFile)**
169
+ Purpose: Extract text from various file formats using format-specific operations
170
+ Critical: ALWAYS check file type first with an IF or Switch before and select the correct operation (Extract from PDF, Extract from MS Excel, etc.)
171
+ Critical: If the user requests handling of multiple file types (PDF, CSV, JSON, etc) then a Switch (n8n-nodes-base.switch) node should be used
172
+ to check the file type before text extraction. Multiple text extraction nodes should be used to handle each of the different file types. For example,
173
+ if the workflow contains a form trigger node which receives a file, then a Switch node MUST be used to split the different options out to different extraction nodes.
174
+ Output: Extracted text is returned under the "text" key in JSON (e.g., access with {{ $json.text }})
175
+ Pitfalls:
176
+ - Returns empty for scanned documents - always check and fallback to OCR; Using wrong operation causes errors
177
+ - If connecting to a document upload form (n8n-nodes-base.formTrigger) use a File field type and then connect it to the extract from file node using the field name.
178
+ For example if creating a form trigger with field "Upload Document" then set the extract from file input binary field to "Upload_Document"
179
+
180
+ **AWS Textract (n8n-nodes-base.awsTextract)**
181
+ Purpose: Advanced OCR with table and form detection
182
+ Best for: Structured documents like invoices and forms
183
+
184
+ **Mindee (n8n-nodes-base.mindee)**
185
+ Purpose: Specialized invoice and receipt parsing
186
+ Returns: Structured JSON with line items, totals, dates
187
+
188
+ ### Data Processing
189
+
190
+ **AI Agent (@n8n/n8n-nodes-langchain.agent)**
191
+ Purpose: Intelligent document parsing and decision making
192
+ Configuration: Include structured output tools for consistent results
193
+
194
+ **LLM Chain (@n8n/n8n-nodes-langchain.chainLlm)**
195
+ Purpose: Document classification and data extraction
196
+
197
+ **Document Loader (@n8n/n8n-nodes-langchain.documentLoader)**
198
+ Purpose: Load and process documents directly from binary data for AI processing
199
+ Critical: Use the "Binary" data source option to handle binary files directly - no need to convert to JSON first
200
+ Configuration: Select "Binary" as Data Source, specify the binary property name (by default data unless renamed in a previous node)
201
+ Best for: Direct document processing in AI workflows without intermediate extraction steps
202
+
203
+ **Structured Output Parser (@n8n/n8n-nodes-langchain.outputParserStructured)**
204
+ Purpose: Ensure AI outputs match expected JSON schema
205
+ Critical for: Database inserts and API calls
206
+
207
+ ### Vector Storage (for RAG/Semantic Search)
208
+ **Simple Vector Store (@n8n/n8n-nodes-langchain.vectorStore) - RECOMMENDED**
209
+ Purpose: Easy-to-setup vector storage for document embeddings
210
+ Advantages:
211
+ - No external dependencies or API keys required
212
+ - Works out of the box with local storage
213
+ - Perfect for prototyping and small to medium datasets
214
+ Configuration: Just connect and use - no complex setup needed
215
+ Best for: Most document processing workflows that need semantic search
216
+
217
+ ### Flow Control
218
+
219
+ **Split In Batches (n8n-nodes-base.splitInBatches)**
220
+ Purpose: Process multiple documents in controlled batches
221
+ Configuration: Set batch size based on API limits and memory
222
+ Outputs (in order):
223
+ - Output 0 "done": Executes after all batches are processed - use for final aggregation or notifications
224
+ - Output 1 "loop": Connect processing nodes here - executes for each batch
225
+ Important: Connect processing logic to the second output (loop), completion logic to the first output (done)
226
+
227
+ **Merge (n8n-nodes-base.merge)**
228
+ Purpose: Combine data from multiple branches that need to execute together
229
+ Critical: Merge node waits for ALL input branches to complete - do NOT use for independent/optional branches
230
+ Modes: Use "Pass Through" to preserve binary from one branch
231
+
232
+ **Edit Fields (Set) (n8n-nodes-base.set)**
233
+ Purpose: Better choice for combining data from separate/independent branches
234
+ Use for: Adding fields from different sources, preserving binary while adding processed data
235
+ Configuration: Set common fields and use "Include Other Input Fields" ON to preserve existing data including binary
236
+
237
+ **Execute Workflow Trigger (n8n-nodes-base.executeWorkflowTrigger)**
238
+ Purpose: Start point for sub-workflows that are called by other workflows
239
+ Configuration: Automatically receives data from the calling workflow including binary data
240
+ Best practice: Use for modular workflow design, heavy processing tasks, or reusable workflow components
241
+ Pairing: Must be used with Execute Workflow node in the parent workflow
242
+
243
+ **Execute Workflow (n8n-nodes-base.executeWorkflow)**
244
+ Purpose: Call and execute another workflow from within the current workflow
245
+ Critical configurations:
246
+ - Workflow ID: Use expression "{{ $workflow.id }}" to reference sub-workflows in the same workflow
247
+ - Choose execution mode: "Run Once for All Items" or "Run Once for Each Item"
248
+ - Binary data is automatically passed to the sub-workflow
249
+ Best practice: Use for delegating heavy processing, creating reusable modules, or managing memory in large batch operations
250
+
251
+ ### Data Destinations
252
+
253
+ **DataTable (n8n-nodes-base.dataTable)**
254
+ Purpose: Store extracted data in n8n's built-in data tables
255
+ Operations: Insert, Update, Select rows without external dependencies
256
+ Best for: Self-contained workflows that don't require external storage
257
+
258
+ **Google Sheets (n8n-nodes-base.googleSheets)**
259
+ Purpose: Log extracted data in external spreadsheet
260
+ Operations: Use "Append" for new rows, "Update" with key column for existing
261
+ Best for: Collaborative review and manual data validation
262
+
263
+ **Database Nodes**
264
+ - Postgres (n8n-nodes-base.postgres)
265
+ - MySQL (n8n-nodes-base.mySql)
266
+ - MongoDB (n8n-nodes-base.mongoDb)
267
+ Purpose: Store structured extraction results in production databases
268
+ Best Practice: Validate data schema before insert
269
+
270
+ ### Utilities
271
+
272
+ **IF/Switch (n8n-nodes-base.if, n8n-nodes-base.switch)**
273
+ Purpose: Route based on file type, extraction quality, or classification
274
+
275
+ **Function/Code (n8n-nodes-base.function, n8n-nodes-base.code)**
276
+ Purpose: Custom validation, data transformation, or regex extraction
277
+
278
+ **HTTP Request (n8n-nodes-base.httpRequest)**
279
+ Purpose: Call external OCR APIs (OCR.space, Google Vision, Mistral OCR)
280
+ Configuration: Set "Response Format: File" for downloads
281
+ Critical: NEVER set API keys directly in the request - user can set credentials from the UI for secure API key management
282
+
283
+ ## Common Pitfalls to Avoid
284
+
285
+ ### Binary Data Loss
286
+
287
+ **Problem**: Binary file "disappears" after processing nodes
288
+ **Solution**:
289
+ - Use Merge node to reattach binary after processing
290
+ - Or configure nodes to explicitly keep binary data
291
+ - In Code nodes: copy items[0].binary to output
292
+
293
+ ### Incorrect OCR Fallback
294
+
295
+ **Problem**: Not detecting when text extraction fails
296
+ **Solution**:
297
+ - Always check if extraction result is empty
298
+ - Implement automatic OCR fallback for scanned documents
299
+ - Don't assume all PDFs have extractable text
300
+
301
+ ### API Format Mismatches
302
+
303
+ **Problem**: Sending files in wrong format to APIs
304
+ **Solution**:
305
+ - Check if API needs multipart/form-data vs Base64
306
+ - Use "Extract from File" and "Convert to File" format conversion
307
+
308
+ ### Memory Overload
309
+
310
+ **Problem**: Workflow crashes with large or multiple files
311
+ **Solution**:
312
+ - Process files sequentially or in small batches
313
+ - Enable filesystem mode for binary data storage
314
+ - Drop unnecessary data after extraction
315
+ - Create a sub-workflow in the same workflow using "When Executed by Another Workflow" and "Execute Workflow". Delegate the heavy part of the workflow to the sub-workflow.
316
+
317
+ ### Duplicate Processing
318
+
319
+ **Problem**: Same documents processed repeatedly
320
+ **Solution**:
321
+ - Configure email triggers to mark as read
322
+ - Use "unseen" filters for email fetching
323
+ - Implement deduplication logic based on file hash or name
324
+ `;
325
+ }
326
+ //# sourceMappingURL=document-processing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"document-processing.js","sourceRoot":"","sources":["../../../../src/tools/best-practices/guides/document-processing.ts"],"names":[],"mappings":";;AAAA,4CAiUC;AAjUD,SAAgB,gBAAgB;IAC/B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+TP,CAAC;AACF,CAAC"}
@@ -0,0 +1 @@
1
+ export declare function getDocumentation(): string;
@@ -0,0 +1,166 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getDocumentation = getDocumentation;
4
+ function getDocumentation() {
5
+ return `# Best Practices: Form Input Workflows
6
+
7
+ ## Workflow Design
8
+
9
+ ### Critical: Always Store Raw Form Data
10
+
11
+ ALWAYS store raw form responses to a persistent data storage destination even if the primary purpose of the workflow is
12
+ to trigger another action (like sending to an API or triggering a notification). This allows users to monitor
13
+ form responses as part of the administration of their workflow.
14
+
15
+ Required storage destinations include:
16
+ - Google Sheets node
17
+ - Airtable node
18
+ - n8n Data Tables
19
+ - PostgreSQL/MySQL/MongoDB nodes
20
+ - Any other database or spreadsheet service
21
+
22
+ IMPORTANT: Simply using Set or Merge nodes is NOT sufficient. These nodes only transform data in memory - they do not
23
+ persist data. You must use an actual storage node (like Google Sheets, Airtable, or Data Tables) to write the data.
24
+
25
+ Storage Requirements:
26
+ - Store the un-edited user input immediately after the form steps are complete
27
+ - Do not store only a summary or edited version of the user's inputs - store the raw data
28
+ - For single-step forms: store immediately after the form trigger
29
+ - For multi-step forms: store immediately after aggregating all steps with Set/Merge nodes
30
+ - The storage node should appear in the workflow right after data collection/aggregation
31
+
32
+ ## Message Attribution
33
+
34
+ n8n forms attach the attribution "n8n workflow" to messages by default - you must disable this setting which will
35
+ often be called "Append n8n Attribution" for the n8n form nodes, add this setting and set it to false.
36
+
37
+ ## Multi-Step Forms
38
+
39
+ Build multi-step forms by chaining multiple Form nodes together. Each Form node represents a page or step in your form
40
+ sequence. Use the n8n Form Trigger node to start the workflow and display the first form page to the user.
41
+
42
+ ## Data Collection & Aggregation
43
+
44
+ Collect and merge all user responses from each form step before writing to your destination (e.g., Data Table). Use
45
+ Set or Merge nodes to combine data as needed. Make sure your JSON keys match the column names in your destination for
46
+ automatic mapping.
47
+
48
+ ## Conditional Logic & Branching
49
+
50
+ Use IF or Switch nodes to direct users to different form pages based on their previous answers. This enables dynamic
51
+ form flows where the path changes based on user input, creating personalized form experiences.
52
+
53
+ ## Dynamic Form Fields
54
+
55
+ For forms that require dynamic options (e.g., dropdowns populated from an API or previous step), generate the form
56
+ definition in a Code node and pass it to the Form node as JSON. You can define forms using JSON for dynamic or
57
+ conditional fields, and even generate form fields dynamically using a Code node if needed.
58
+
59
+ ## Input Validation
60
+
61
+ Validate user input between steps to ensure data quality. If input is invalid, loop back to the relevant form step with
62
+ an error message to guide the user to correct their submission. This prevents bad data from entering your system.
63
+
64
+ ## Recommended Nodes
65
+
66
+ ### n8n Form Trigger (n8n-nodes-base.formTrigger)
67
+
68
+ Purpose: Starts the workflow and displays the first form page to the user
69
+
70
+ Pitfalls:
71
+
72
+ - Use the Production URL for live forms; the Test URL is for development and debugging only
73
+ - Ensure the form trigger is properly configured before sharing URLs with users
74
+
75
+ ### n8n Form (n8n-nodes-base.form)
76
+
77
+ Purpose: Displays form pages in multi-step form sequences
78
+
79
+ Pitfalls:
80
+
81
+ - Each Form node represents one page/step in your form
82
+ - You can define forms using JSON for dynamic or conditional fields
83
+ - Generate form fields dynamically using a Code node if needed for complex scenarios
84
+
85
+ ### Storage Nodes
86
+
87
+ Purpose: Persist raw form data to a storage destination, preference should be for built-in n8n tables
88
+ but use the most applicable node depending on the user's request.
89
+
90
+ Required nodes (use at least one):
91
+ - Data table (n8n-nodes-base.dataTable): Built-in n8n storage for quick setup - preferred
92
+ - Google Sheets (n8n-nodes-base.googleSheets): Best for simple spreadsheet storage
93
+ - Airtable (n8n-nodes-base.airtable): Best for structured database with relationships
94
+ - Postgres (n8n-nodes-base.postgres) / MySQL (n8n-nodes-base.mySql) / MongoDB (n8n-nodes-base.mongoDb): For production database storage
95
+
96
+ Pitfalls:
97
+
98
+ - Every form workflow MUST include a storage node that actually writes data to a destination
99
+ - Set and Merge nodes alone are NOT sufficient - they only transform data in memory
100
+ - The storage node should be placed immediately after the form trigger (single-step) or after data aggregation (multi-step)
101
+
102
+ ### Code (n8n-nodes-base.code)
103
+
104
+ Purpose: Processes form data, generates dynamic form definitions, or implements custom validation logic
105
+
106
+ ### Edit Fields (Set) (n8n-nodes-base.set)
107
+
108
+ Purpose: Aggregates and transforms form data between steps (NOT for storage - use a storage node)
109
+
110
+ ### Merge (n8n-nodes-base.merge)
111
+
112
+ Purpose: Combines data from multiple form steps into a single dataset (NOT for storage - use a storage node)
113
+
114
+ Pitfalls:
115
+
116
+ - Ensure data from all form steps is properly merged before writing to destination
117
+ - Use appropriate merge modes (append, merge by key, etc.) for your use case
118
+ - Remember: Merge prepares data but does not store it - add a storage node after Merge
119
+
120
+ ### If (n8n-nodes-base.if)
121
+
122
+ Purpose: Routes users to different form pages based on their previous answers
123
+
124
+ ### Switch (n8n-nodes-base.switch)
125
+
126
+ Purpose: Implements multi-path conditional routing in complex forms
127
+
128
+ Pitfalls:
129
+
130
+ - Include a default case to handle unexpected input values
131
+ - Keep routing logic clear and maintainable
132
+
133
+ ## Common Pitfalls to Avoid
134
+
135
+ ### Missing Raw Form Response Storage
136
+
137
+ When building n8n forms it is recommended to always store the raw form response to some form of data storage (Googlesheets, Airtable, etc)
138
+ for administration later. It is CRITICAL if you create a n8n form node that you store the raw output with a storage node.
139
+
140
+ ### Data Loss in Multi-Step Forms
141
+
142
+ Aggregate all form step data using Set/Merge nodes before writing to your destination. Failing to merge data from multiple steps
143
+ can result in incomplete form submissions being stored. After merging, ensure you write the complete dataset to a storage node.
144
+
145
+ ### Poor User Experience
146
+
147
+ Use the Form Ending page type to show a completion message or redirect users after submission.
148
+ Without a proper ending, users may be confused about whether their submission was successful.
149
+
150
+ ### Invalid Data
151
+
152
+ Implement validation between form steps to catch errors early. Without validation, invalid data can
153
+ propagate through your workflow and corrupt your destination data.
154
+
155
+ ### Complex Field Generation
156
+
157
+ When generating dynamic form fields, ensure the JSON structure exactly matches what the Form
158
+ node expects. Test thoroughly with the Test URL before going live.
159
+
160
+ ### Mapping Errors
161
+
162
+ When writing to Google Sheets or other destinations, ensure field names match exactly. Mismatched names
163
+ will cause data to be written to wrong columns or fail entirely.
164
+ `;
165
+ }
166
+ //# sourceMappingURL=form-input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-input.js","sourceRoot":"","sources":["../../../../src/tools/best-practices/guides/form-input.ts"],"names":[],"mappings":";;AAAA,4CAiKC;AAjKD,SAAgB,gBAAgB;IAC/B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+JP,CAAC;AACF,CAAC"}
@@ -0,0 +1 @@
1
+ export declare function getDocumentation(): string;