ts-workflow-engine-lite 2.1.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 (525) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +352 -0
  3. package/dist/src/api/ConsoleWebSocketManager.d.ts +57 -0
  4. package/dist/src/api/ConsoleWebSocketManager.js +206 -0
  5. package/dist/src/api/ConsoleWebSocketManager.js.map +1 -0
  6. package/dist/src/api/ErrorHandler.d.ts +52 -0
  7. package/dist/src/api/ErrorHandler.js +115 -0
  8. package/dist/src/api/ErrorHandler.js.map +1 -0
  9. package/dist/src/api/EventHistory.d.ts +73 -0
  10. package/dist/src/api/EventHistory.js +309 -0
  11. package/dist/src/api/EventHistory.js.map +1 -0
  12. package/dist/src/api/WebhookManager.d.ts +67 -0
  13. package/dist/src/api/WebhookManager.js +568 -0
  14. package/dist/src/api/WebhookManager.js.map +1 -0
  15. package/dist/src/api/docsPage.d.ts +1 -0
  16. package/dist/src/api/docsPage.js +321 -0
  17. package/dist/src/api/docsPage.js.map +1 -0
  18. package/dist/src/api/index.d.ts +8 -0
  19. package/dist/src/api/index.js +8 -0
  20. package/dist/src/api/index.js.map +1 -0
  21. package/dist/src/api/middleware/auth.d.ts +19 -0
  22. package/dist/src/api/middleware/auth.js +122 -0
  23. package/dist/src/api/middleware/auth.js.map +1 -0
  24. package/dist/src/api/middleware/index.d.ts +3 -0
  25. package/dist/src/api/middleware/index.js +3 -0
  26. package/dist/src/api/middleware/index.js.map +1 -0
  27. package/dist/src/api/middleware/rateLimit.d.ts +6 -0
  28. package/dist/src/api/middleware/rateLimit.js +69 -0
  29. package/dist/src/api/middleware/rateLimit.js.map +1 -0
  30. package/dist/src/api/middleware/rateLimitStore.d.ts +14 -0
  31. package/dist/src/api/middleware/rateLimitStore.js +44 -0
  32. package/dist/src/api/middleware/rateLimitStore.js.map +1 -0
  33. package/dist/src/api/middleware/rbac.d.ts +12 -0
  34. package/dist/src/api/middleware/rbac.js +120 -0
  35. package/dist/src/api/middleware/rbac.js.map +1 -0
  36. package/dist/src/api/openapi.d.ts +1917 -0
  37. package/dist/src/api/openapi.js +1758 -0
  38. package/dist/src/api/openapi.js.map +1 -0
  39. package/dist/src/api/playgroundPage.d.ts +1 -0
  40. package/dist/src/api/playgroundPage.js +765 -0
  41. package/dist/src/api/playgroundPage.js.map +1 -0
  42. package/dist/src/api/response.d.ts +22 -0
  43. package/dist/src/api/response.js +119 -0
  44. package/dist/src/api/response.js.map +1 -0
  45. package/dist/src/api/router.d.ts +17 -0
  46. package/dist/src/api/router.js +94 -0
  47. package/dist/src/api/router.js.map +1 -0
  48. package/dist/src/api/routes/analytics.d.ts +10 -0
  49. package/dist/src/api/routes/analytics.js +144 -0
  50. package/dist/src/api/routes/analytics.js.map +1 -0
  51. package/dist/src/api/routes/dlq.d.ts +3 -0
  52. package/dist/src/api/routes/dlq.js +248 -0
  53. package/dist/src/api/routes/dlq.js.map +1 -0
  54. package/dist/src/api/routes/eventHistory.d.ts +3 -0
  55. package/dist/src/api/routes/eventHistory.js +48 -0
  56. package/dist/src/api/routes/eventHistory.js.map +1 -0
  57. package/dist/src/api/routes/events.d.ts +3 -0
  58. package/dist/src/api/routes/events.js +205 -0
  59. package/dist/src/api/routes/events.js.map +1 -0
  60. package/dist/src/api/routes/functions.d.ts +3 -0
  61. package/dist/src/api/routes/functions.js +85 -0
  62. package/dist/src/api/routes/functions.js.map +1 -0
  63. package/dist/src/api/routes/instances.d.ts +3 -0
  64. package/dist/src/api/routes/instances.js +790 -0
  65. package/dist/src/api/routes/instances.js.map +1 -0
  66. package/dist/src/api/routes/templates.d.ts +3 -0
  67. package/dist/src/api/routes/templates.js +195 -0
  68. package/dist/src/api/routes/templates.js.map +1 -0
  69. package/dist/src/api/routes/webhooks.d.ts +3 -0
  70. package/dist/src/api/routes/webhooks.js +263 -0
  71. package/dist/src/api/routes/webhooks.js.map +1 -0
  72. package/dist/src/api/routes/workflows/analysis.d.ts +2 -0
  73. package/dist/src/api/routes/workflows/analysis.js +112 -0
  74. package/dist/src/api/routes/workflows/analysis.js.map +1 -0
  75. package/dist/src/api/routes/workflows/crud.d.ts +2 -0
  76. package/dist/src/api/routes/workflows/crud.js +140 -0
  77. package/dist/src/api/routes/workflows/crud.js.map +1 -0
  78. package/dist/src/api/routes/workflows/execution.d.ts +2 -0
  79. package/dist/src/api/routes/workflows/execution.js +204 -0
  80. package/dist/src/api/routes/workflows/execution.js.map +1 -0
  81. package/dist/src/api/routes/workflows/graph.d.ts +2 -0
  82. package/dist/src/api/routes/workflows/graph.js +51 -0
  83. package/dist/src/api/routes/workflows/graph.js.map +1 -0
  84. package/dist/src/api/routes/workflows/import.d.ts +2 -0
  85. package/dist/src/api/routes/workflows/import.js +238 -0
  86. package/dist/src/api/routes/workflows/import.js.map +1 -0
  87. package/dist/src/api/routes/workflows/index.d.ts +3 -0
  88. package/dist/src/api/routes/workflows/index.js +18 -0
  89. package/dist/src/api/routes/workflows/index.js.map +1 -0
  90. package/dist/src/api/routes/workflows/shared.d.ts +64 -0
  91. package/dist/src/api/routes/workflows/shared.js +304 -0
  92. package/dist/src/api/routes/workflows/shared.js.map +1 -0
  93. package/dist/src/api/routes/workflows/variables.d.ts +2 -0
  94. package/dist/src/api/routes/workflows/variables.js +34 -0
  95. package/dist/src/api/routes/workflows/variables.js.map +1 -0
  96. package/dist/src/api/routes/workflows/versioning.d.ts +2 -0
  97. package/dist/src/api/routes/workflows/versioning.js +235 -0
  98. package/dist/src/api/routes/workflows/versioning.js.map +1 -0
  99. package/dist/src/api/server.d.ts +13 -0
  100. package/dist/src/api/server.js +311 -0
  101. package/dist/src/api/server.js.map +1 -0
  102. package/dist/src/api/services/InstanceApplicationService.d.ts +74 -0
  103. package/dist/src/api/services/InstanceApplicationService.js +215 -0
  104. package/dist/src/api/services/InstanceApplicationService.js.map +1 -0
  105. package/dist/src/api/services/WorkflowApplicationService.d.ts +92 -0
  106. package/dist/src/api/services/WorkflowApplicationService.js +282 -0
  107. package/dist/src/api/services/WorkflowApplicationService.js.map +1 -0
  108. package/dist/src/api/services/index.d.ts +4 -0
  109. package/dist/src/api/services/index.js +3 -0
  110. package/dist/src/api/services/index.js.map +1 -0
  111. package/dist/src/api/types.d.ts +118 -0
  112. package/dist/src/api/types.js +2 -0
  113. package/dist/src/api/types.js.map +1 -0
  114. package/dist/src/api/utils/IdempotencyStore.d.ts +36 -0
  115. package/dist/src/api/utils/IdempotencyStore.js +121 -0
  116. package/dist/src/api/utils/IdempotencyStore.js.map +1 -0
  117. package/dist/src/api/utils/authConfig.d.ts +2 -0
  118. package/dist/src/api/utils/authConfig.js +25 -0
  119. package/dist/src/api/utils/authConfig.js.map +1 -0
  120. package/dist/src/api/utils/requestContext.d.ts +14 -0
  121. package/dist/src/api/utils/requestContext.js +31 -0
  122. package/dist/src/api/utils/requestContext.js.map +1 -0
  123. package/dist/src/api/utils/routeHelper.d.ts +25 -0
  124. package/dist/src/api/utils/routeHelper.js +30 -0
  125. package/dist/src/api/utils/routeHelper.js.map +1 -0
  126. package/dist/src/api/welcomePage.d.ts +1 -0
  127. package/dist/src/api/welcomePage.js +259 -0
  128. package/dist/src/api/welcomePage.js.map +1 -0
  129. package/dist/src/bootstrap.d.ts +20 -0
  130. package/dist/src/bootstrap.js +128 -0
  131. package/dist/src/bootstrap.js.map +1 -0
  132. package/dist/src/cli.d.ts +2 -0
  133. package/dist/src/cli.js +32 -0
  134. package/dist/src/cli.js.map +1 -0
  135. package/dist/src/config/AppConfig.d.ts +102 -0
  136. package/dist/src/config/AppConfig.js +452 -0
  137. package/dist/src/config/AppConfig.js.map +1 -0
  138. package/dist/src/config/redis.config.d.ts +6 -0
  139. package/dist/src/config/redis.config.js +9 -0
  140. package/dist/src/config/redis.config.js.map +1 -0
  141. package/dist/src/container.d.ts +29 -0
  142. package/dist/src/container.js +62 -0
  143. package/dist/src/container.js.map +1 -0
  144. package/dist/src/debug/BreakpointManager.d.ts +17 -0
  145. package/dist/src/debug/BreakpointManager.js +59 -0
  146. package/dist/src/debug/BreakpointManager.js.map +1 -0
  147. package/dist/src/debug/WorkflowDebugger.d.ts +34 -0
  148. package/dist/src/debug/WorkflowDebugger.js +117 -0
  149. package/dist/src/debug/WorkflowDebugger.js.map +1 -0
  150. package/dist/src/debug/index.d.ts +2 -0
  151. package/dist/src/debug/index.js +3 -0
  152. package/dist/src/debug/index.js.map +1 -0
  153. package/dist/src/demo/demoWorkflow.d.ts +3 -0
  154. package/dist/src/demo/demoWorkflow.js +82 -0
  155. package/dist/src/demo/demoWorkflow.js.map +1 -0
  156. package/dist/src/demo/exampleWorkflow.d.ts +36 -0
  157. package/dist/src/demo/exampleWorkflow.js +184 -0
  158. package/dist/src/demo/exampleWorkflow.js.map +1 -0
  159. package/dist/src/demo/index.d.ts +2 -0
  160. package/dist/src/demo/index.js +3 -0
  161. package/dist/src/demo/index.js.map +1 -0
  162. package/dist/src/dlq/DeadLetterQueue.d.ts +62 -0
  163. package/dist/src/dlq/DeadLetterQueue.js +342 -0
  164. package/dist/src/dlq/DeadLetterQueue.js.map +1 -0
  165. package/dist/src/dlq/index.d.ts +2 -0
  166. package/dist/src/dlq/index.js +2 -0
  167. package/dist/src/dlq/index.js.map +1 -0
  168. package/dist/src/dsl/DSLParser.d.ts +7 -0
  169. package/dist/src/dsl/DSLParser.js +252 -0
  170. package/dist/src/dsl/DSLParser.js.map +1 -0
  171. package/dist/src/dsl/WorkflowDSL.d.ts +40 -0
  172. package/dist/src/dsl/WorkflowDSL.js +2 -0
  173. package/dist/src/dsl/WorkflowDSL.js.map +1 -0
  174. package/dist/src/engine/CanaryReleaseManager.d.ts +39 -0
  175. package/dist/src/engine/CanaryReleaseManager.js +192 -0
  176. package/dist/src/engine/CanaryReleaseManager.js.map +1 -0
  177. package/dist/src/engine/ConcurrencyControl.d.ts +38 -0
  178. package/dist/src/engine/ConcurrencyControl.js +181 -0
  179. package/dist/src/engine/ConcurrencyControl.js.map +1 -0
  180. package/dist/src/engine/ContinueAsNewManager.d.ts +18 -0
  181. package/dist/src/engine/ContinueAsNewManager.js +29 -0
  182. package/dist/src/engine/ContinueAsNewManager.js.map +1 -0
  183. package/dist/src/engine/DataValidator.d.ts +15 -0
  184. package/dist/src/engine/DataValidator.js +121 -0
  185. package/dist/src/engine/DataValidator.js.map +1 -0
  186. package/dist/src/engine/DryRunExecutor.d.ts +48 -0
  187. package/dist/src/engine/DryRunExecutor.js +256 -0
  188. package/dist/src/engine/DryRunExecutor.js.map +1 -0
  189. package/dist/src/engine/ExecutionOrchestrator.d.ts +19 -0
  190. package/dist/src/engine/ExecutionOrchestrator.js +579 -0
  191. package/dist/src/engine/ExecutionOrchestrator.js.map +1 -0
  192. package/dist/src/engine/ExpressionEvaluator.d.ts +44 -0
  193. package/dist/src/engine/ExpressionEvaluator.js +1046 -0
  194. package/dist/src/engine/ExpressionEvaluator.js.map +1 -0
  195. package/dist/src/engine/HeartbeatManager.d.ts +42 -0
  196. package/dist/src/engine/HeartbeatManager.js +209 -0
  197. package/dist/src/engine/HeartbeatManager.js.map +1 -0
  198. package/dist/src/engine/InstanceManager.d.ts +21 -0
  199. package/dist/src/engine/InstanceManager.js +165 -0
  200. package/dist/src/engine/InstanceManager.js.map +1 -0
  201. package/dist/src/engine/InstanceSearch.d.ts +30 -0
  202. package/dist/src/engine/InstanceSearch.js +119 -0
  203. package/dist/src/engine/InstanceSearch.js.map +1 -0
  204. package/dist/src/engine/LifecycleManager.d.ts +18 -0
  205. package/dist/src/engine/LifecycleManager.js +82 -0
  206. package/dist/src/engine/LifecycleManager.js.map +1 -0
  207. package/dist/src/engine/ParallelExecutor.d.ts +26 -0
  208. package/dist/src/engine/ParallelExecutor.js +138 -0
  209. package/dist/src/engine/ParallelExecutor.js.map +1 -0
  210. package/dist/src/engine/SandboxEvaluator.d.ts +18 -0
  211. package/dist/src/engine/SandboxEvaluator.js +200 -0
  212. package/dist/src/engine/SandboxEvaluator.js.map +1 -0
  213. package/dist/src/engine/SchemaValidator.d.ts +30 -0
  214. package/dist/src/engine/SchemaValidator.js +630 -0
  215. package/dist/src/engine/SchemaValidator.js.map +1 -0
  216. package/dist/src/engine/SearchAttributeManager.d.ts +48 -0
  217. package/dist/src/engine/SearchAttributeManager.js +119 -0
  218. package/dist/src/engine/SearchAttributeManager.js.map +1 -0
  219. package/dist/src/engine/StateMachine.d.ts +13 -0
  220. package/dist/src/engine/StateMachine.js +66 -0
  221. package/dist/src/engine/StateMachine.js.map +1 -0
  222. package/dist/src/engine/StickyExecutionManager.d.ts +34 -0
  223. package/dist/src/engine/StickyExecutionManager.js +163 -0
  224. package/dist/src/engine/StickyExecutionManager.js.map +1 -0
  225. package/dist/src/engine/SubworkflowExecutor.d.ts +17 -0
  226. package/dist/src/engine/SubworkflowExecutor.js +157 -0
  227. package/dist/src/engine/SubworkflowExecutor.js.map +1 -0
  228. package/dist/src/engine/TaskExecutor.d.ts +12 -0
  229. package/dist/src/engine/TaskExecutor.js +124 -0
  230. package/dist/src/engine/TaskExecutor.js.map +1 -0
  231. package/dist/src/engine/TaskQueueManager.d.ts +42 -0
  232. package/dist/src/engine/TaskQueueManager.js +175 -0
  233. package/dist/src/engine/TaskQueueManager.js.map +1 -0
  234. package/dist/src/engine/WorkflowEngine.d.ts +117 -0
  235. package/dist/src/engine/WorkflowEngine.js +443 -0
  236. package/dist/src/engine/WorkflowEngine.js.map +1 -0
  237. package/dist/src/engine/WorkflowInstanceControl.d.ts +21 -0
  238. package/dist/src/engine/WorkflowInstanceControl.js +306 -0
  239. package/dist/src/engine/WorkflowInstanceControl.js.map +1 -0
  240. package/dist/src/engine/WorkflowPersistenceCoordinator.d.ts +12 -0
  241. package/dist/src/engine/WorkflowPersistenceCoordinator.js +93 -0
  242. package/dist/src/engine/WorkflowPersistenceCoordinator.js.map +1 -0
  243. package/dist/src/engine/WorkflowRegistry.d.ts +38 -0
  244. package/dist/src/engine/WorkflowRegistry.js +130 -0
  245. package/dist/src/engine/WorkflowRegistry.js.map +1 -0
  246. package/dist/src/engine/WorkflowVersionManager.d.ts +24 -0
  247. package/dist/src/engine/WorkflowVersionManager.js +121 -0
  248. package/dist/src/engine/WorkflowVersionManager.js.map +1 -0
  249. package/dist/src/engine/createEngine.d.ts +8 -0
  250. package/dist/src/engine/createEngine.js +21 -0
  251. package/dist/src/engine/createEngine.js.map +1 -0
  252. package/dist/src/engine/errors.d.ts +18 -0
  253. package/dist/src/engine/errors.js +37 -0
  254. package/dist/src/engine/errors.js.map +1 -0
  255. package/dist/src/engine/executors/ApprovalNodeExecutor.d.ts +12 -0
  256. package/dist/src/engine/executors/ApprovalNodeExecutor.js +68 -0
  257. package/dist/src/engine/executors/ApprovalNodeExecutor.js.map +1 -0
  258. package/dist/src/engine/executors/ConditionNodeExecutor.d.ts +16 -0
  259. package/dist/src/engine/executors/ConditionNodeExecutor.js +63 -0
  260. package/dist/src/engine/executors/ConditionNodeExecutor.js.map +1 -0
  261. package/dist/src/engine/executors/HttpNodeExecutor.d.ts +27 -0
  262. package/dist/src/engine/executors/HttpNodeExecutor.js +179 -0
  263. package/dist/src/engine/executors/HttpNodeExecutor.js.map +1 -0
  264. package/dist/src/engine/executors/JoinNodeExecutor.d.ts +13 -0
  265. package/dist/src/engine/executors/JoinNodeExecutor.js +37 -0
  266. package/dist/src/engine/executors/JoinNodeExecutor.js.map +1 -0
  267. package/dist/src/engine/executors/LoopNodeExecutor.d.ts +20 -0
  268. package/dist/src/engine/executors/LoopNodeExecutor.js +165 -0
  269. package/dist/src/engine/executors/LoopNodeExecutor.js.map +1 -0
  270. package/dist/src/engine/executors/NotificationNodeExecutor.d.ts +8 -0
  271. package/dist/src/engine/executors/NotificationNodeExecutor.js +33 -0
  272. package/dist/src/engine/executors/NotificationNodeExecutor.js.map +1 -0
  273. package/dist/src/engine/executors/QueueNodeExecutor.d.ts +23 -0
  274. package/dist/src/engine/executors/QueueNodeExecutor.js +87 -0
  275. package/dist/src/engine/executors/QueueNodeExecutor.js.map +1 -0
  276. package/dist/src/engine/executors/RouterNodeExecutor.d.ts +20 -0
  277. package/dist/src/engine/executors/RouterNodeExecutor.js +82 -0
  278. package/dist/src/engine/executors/RouterNodeExecutor.js.map +1 -0
  279. package/dist/src/engine/executors/SqlNodeExecutor.d.ts +27 -0
  280. package/dist/src/engine/executors/SqlNodeExecutor.js +74 -0
  281. package/dist/src/engine/executors/SqlNodeExecutor.js.map +1 -0
  282. package/dist/src/engine/executors/TransformNodeExecutor.d.ts +9 -0
  283. package/dist/src/engine/executors/TransformNodeExecutor.js +44 -0
  284. package/dist/src/engine/executors/TransformNodeExecutor.js.map +1 -0
  285. package/dist/src/engine/functions/collectionFunctions.d.ts +2 -0
  286. package/dist/src/engine/functions/collectionFunctions.js +129 -0
  287. package/dist/src/engine/functions/collectionFunctions.js.map +1 -0
  288. package/dist/src/engine/functions/customFunctions.d.ts +11 -0
  289. package/dist/src/engine/functions/customFunctions.js +42 -0
  290. package/dist/src/engine/functions/customFunctions.js.map +1 -0
  291. package/dist/src/engine/functions/dateFunctions.d.ts +2 -0
  292. package/dist/src/engine/functions/dateFunctions.js +71 -0
  293. package/dist/src/engine/functions/dateFunctions.js.map +1 -0
  294. package/dist/src/engine/functions/index.d.ts +14 -0
  295. package/dist/src/engine/functions/index.js +35 -0
  296. package/dist/src/engine/functions/index.js.map +1 -0
  297. package/dist/src/engine/functions/stringFunctions.d.ts +2 -0
  298. package/dist/src/engine/functions/stringFunctions.js +66 -0
  299. package/dist/src/engine/functions/stringFunctions.js.map +1 -0
  300. package/dist/src/engine/functions/typeFunctions.d.ts +2 -0
  301. package/dist/src/engine/functions/typeFunctions.js +70 -0
  302. package/dist/src/engine/functions/typeFunctions.js.map +1 -0
  303. package/dist/src/engine/functions/types.d.ts +6 -0
  304. package/dist/src/engine/functions/types.js +2 -0
  305. package/dist/src/engine/functions/types.js.map +1 -0
  306. package/dist/src/engine/index.d.ts +21 -0
  307. package/dist/src/engine/index.js +18 -0
  308. package/dist/src/engine/index.js.map +1 -0
  309. package/dist/src/engine/nodeDispatch/controlNodes.d.ts +2 -0
  310. package/dist/src/engine/nodeDispatch/controlNodes.js +208 -0
  311. package/dist/src/engine/nodeDispatch/controlNodes.js.map +1 -0
  312. package/dist/src/engine/nodeDispatch/helpers.d.ts +27 -0
  313. package/dist/src/engine/nodeDispatch/helpers.js +185 -0
  314. package/dist/src/engine/nodeDispatch/helpers.js.map +1 -0
  315. package/dist/src/engine/nodeDispatch/ioNodes.d.ts +2 -0
  316. package/dist/src/engine/nodeDispatch/ioNodes.js +89 -0
  317. package/dist/src/engine/nodeDispatch/ioNodes.js.map +1 -0
  318. package/dist/src/engine/nodeDispatch/types.d.ts +13 -0
  319. package/dist/src/engine/nodeDispatch/types.js +2 -0
  320. package/dist/src/engine/nodeDispatch/types.js.map +1 -0
  321. package/dist/src/engine/nodeDispatch/workflowNodes.d.ts +2 -0
  322. package/dist/src/engine/nodeDispatch/workflowNodes.js +33 -0
  323. package/dist/src/engine/nodeDispatch/workflowNodes.js.map +1 -0
  324. package/dist/src/engine/worker/ActionSandboxMessage.d.ts +29 -0
  325. package/dist/src/engine/worker/ActionSandboxMessage.js +7 -0
  326. package/dist/src/engine/worker/ActionSandboxMessage.js.map +1 -0
  327. package/dist/src/engine/worker/ActionSandboxPool.d.ts +34 -0
  328. package/dist/src/engine/worker/ActionSandboxPool.js +204 -0
  329. package/dist/src/engine/worker/ActionSandboxPool.js.map +1 -0
  330. package/dist/src/engine/worker/ActionSandboxWorker.d.ts +1 -0
  331. package/dist/src/engine/worker/ActionSandboxWorker.js +25 -0
  332. package/dist/src/engine/worker/ActionSandboxWorker.js.map +1 -0
  333. package/dist/src/engine/worker/WorkerMessage.d.ts +35 -0
  334. package/dist/src/engine/worker/WorkerMessage.js +7 -0
  335. package/dist/src/engine/worker/WorkerMessage.js.map +1 -0
  336. package/dist/src/engine/worker/WorkerPool.d.ts +42 -0
  337. package/dist/src/engine/worker/WorkerPool.js +273 -0
  338. package/dist/src/engine/worker/WorkerPool.js.map +1 -0
  339. package/dist/src/engine/worker/WorkerProcess.d.ts +1 -0
  340. package/dist/src/engine/worker/WorkerProcess.js +76 -0
  341. package/dist/src/engine/worker/WorkerProcess.js.map +1 -0
  342. package/dist/src/event/EventBus.d.ts +11 -0
  343. package/dist/src/event/EventBus.js +44 -0
  344. package/dist/src/event/EventBus.js.map +1 -0
  345. package/dist/src/event/EventCoordinator.d.ts +26 -0
  346. package/dist/src/event/EventCoordinator.js +205 -0
  347. package/dist/src/event/EventCoordinator.js.map +1 -0
  348. package/dist/src/event/EventDeduplicator.d.ts +31 -0
  349. package/dist/src/event/EventDeduplicator.js +100 -0
  350. package/dist/src/event/EventDeduplicator.js.map +1 -0
  351. package/dist/src/event/HookManager.d.ts +31 -0
  352. package/dist/src/event/HookManager.js +88 -0
  353. package/dist/src/event/HookManager.js.map +1 -0
  354. package/dist/src/event/MessageBus.d.ts +39 -0
  355. package/dist/src/event/MessageBus.js +131 -0
  356. package/dist/src/event/MessageBus.js.map +1 -0
  357. package/dist/src/event/index.d.ts +3 -0
  358. package/dist/src/event/index.js +4 -0
  359. package/dist/src/event/index.js.map +1 -0
  360. package/dist/src/index.d.ts +40 -0
  361. package/dist/src/index.js +33 -0
  362. package/dist/src/index.js.map +1 -0
  363. package/dist/src/lifecycle.d.ts +17 -0
  364. package/dist/src/lifecycle.js +84 -0
  365. package/dist/src/lifecycle.js.map +1 -0
  366. package/dist/src/metrics/AnalyticsCollector.d.ts +57 -0
  367. package/dist/src/metrics/AnalyticsCollector.js +140 -0
  368. package/dist/src/metrics/AnalyticsCollector.js.map +1 -0
  369. package/dist/src/metrics/AnomalyDetector.d.ts +21 -0
  370. package/dist/src/metrics/AnomalyDetector.js +120 -0
  371. package/dist/src/metrics/AnomalyDetector.js.map +1 -0
  372. package/dist/src/metrics/MetricsAggregator.d.ts +43 -0
  373. package/dist/src/metrics/MetricsAggregator.js +243 -0
  374. package/dist/src/metrics/MetricsAggregator.js.map +1 -0
  375. package/dist/src/metrics/SlaMonitor.d.ts +48 -0
  376. package/dist/src/metrics/SlaMonitor.js +130 -0
  377. package/dist/src/metrics/SlaMonitor.js.map +1 -0
  378. package/dist/src/metrics/index.d.ts +75 -0
  379. package/dist/src/metrics/index.js +293 -0
  380. package/dist/src/metrics/index.js.map +1 -0
  381. package/dist/src/model/Instance.d.ts +38 -0
  382. package/dist/src/model/Instance.js +12 -0
  383. package/dist/src/model/Instance.js.map +1 -0
  384. package/dist/src/model/RetryPolicy.d.ts +11 -0
  385. package/dist/src/model/RetryPolicy.js +30 -0
  386. package/dist/src/model/RetryPolicy.js.map +1 -0
  387. package/dist/src/model/Schedule.d.ts +34 -0
  388. package/dist/src/model/Schedule.js +50 -0
  389. package/dist/src/model/Schedule.js.map +1 -0
  390. package/dist/src/model/Workflow.d.ts +73 -0
  391. package/dist/src/model/Workflow.js +2 -0
  392. package/dist/src/model/Workflow.js.map +1 -0
  393. package/dist/src/model/WorkflowGraph.d.ts +32 -0
  394. package/dist/src/model/WorkflowGraph.js +267 -0
  395. package/dist/src/model/WorkflowGraph.js.map +1 -0
  396. package/dist/src/model/WorkflowSchema.d.ts +154 -0
  397. package/dist/src/model/WorkflowSchema.js +233 -0
  398. package/dist/src/model/WorkflowSchema.js.map +1 -0
  399. package/dist/src/model/WorkflowVariables.d.ts +15 -0
  400. package/dist/src/model/WorkflowVariables.js +77 -0
  401. package/dist/src/model/WorkflowVariables.js.map +1 -0
  402. package/dist/src/notification/NotificationChannel.d.ts +19 -0
  403. package/dist/src/notification/NotificationChannel.js +2 -0
  404. package/dist/src/notification/NotificationChannel.js.map +1 -0
  405. package/dist/src/notification/NotificationManager.d.ts +20 -0
  406. package/dist/src/notification/NotificationManager.js +59 -0
  407. package/dist/src/notification/NotificationManager.js.map +1 -0
  408. package/dist/src/notification/channels/DingtalkChannel.d.ts +7 -0
  409. package/dist/src/notification/channels/DingtalkChannel.js +18 -0
  410. package/dist/src/notification/channels/DingtalkChannel.js.map +1 -0
  411. package/dist/src/notification/channels/EmailChannel.d.ts +21 -0
  412. package/dist/src/notification/channels/EmailChannel.js +32 -0
  413. package/dist/src/notification/channels/EmailChannel.js.map +1 -0
  414. package/dist/src/notification/channels/FeishuChannel.d.ts +7 -0
  415. package/dist/src/notification/channels/FeishuChannel.js +18 -0
  416. package/dist/src/notification/channels/FeishuChannel.js.map +1 -0
  417. package/dist/src/notification/channels/SlackChannel.d.ts +7 -0
  418. package/dist/src/notification/channels/SlackChannel.js +18 -0
  419. package/dist/src/notification/channels/SlackChannel.js.map +1 -0
  420. package/dist/src/notification/channels/SmsChannel.d.ts +24 -0
  421. package/dist/src/notification/channels/SmsChannel.js +37 -0
  422. package/dist/src/notification/channels/SmsChannel.js.map +1 -0
  423. package/dist/src/notification/channels/WebhookChannel.d.ts +17 -0
  424. package/dist/src/notification/channels/WebhookChannel.js +61 -0
  425. package/dist/src/notification/channels/WebhookChannel.js.map +1 -0
  426. package/dist/src/notification/index.d.ts +24 -0
  427. package/dist/src/notification/index.js +61 -0
  428. package/dist/src/notification/index.js.map +1 -0
  429. package/dist/src/scheduler/CronScheduler.d.ts +20 -0
  430. package/dist/src/scheduler/CronScheduler.js +82 -0
  431. package/dist/src/scheduler/CronScheduler.js.map +1 -0
  432. package/dist/src/scheduler/EnhancedCronScheduler.d.ts +27 -0
  433. package/dist/src/scheduler/EnhancedCronScheduler.js +177 -0
  434. package/dist/src/scheduler/EnhancedCronScheduler.js.map +1 -0
  435. package/dist/src/storage/ArchiveManager.d.ts +21 -0
  436. package/dist/src/storage/ArchiveManager.js +140 -0
  437. package/dist/src/storage/ArchiveManager.js.map +1 -0
  438. package/dist/src/storage/LocalFileStorage.d.ts +64 -0
  439. package/dist/src/storage/LocalFileStorage.js +470 -0
  440. package/dist/src/storage/LocalFileStorage.js.map +1 -0
  441. package/dist/src/storage/MemoryStorage.d.ts +65 -0
  442. package/dist/src/storage/MemoryStorage.js +422 -0
  443. package/dist/src/storage/MemoryStorage.js.map +1 -0
  444. package/dist/src/storage/StorageProvider.d.ts +223 -0
  445. package/dist/src/storage/StorageProvider.js +2 -0
  446. package/dist/src/storage/StorageProvider.js.map +1 -0
  447. package/dist/src/storage/builtin-adapters.d.ts +1 -0
  448. package/dist/src/storage/builtin-adapters.js +20 -0
  449. package/dist/src/storage/builtin-adapters.js.map +1 -0
  450. package/dist/src/storage/index.d.ts +17 -0
  451. package/dist/src/storage/index.js +52 -0
  452. package/dist/src/storage/index.js.map +1 -0
  453. package/dist/src/storage/registry.d.ts +6 -0
  454. package/dist/src/storage/registry.js +23 -0
  455. package/dist/src/storage/registry.js.map +1 -0
  456. package/dist/src/telemetry/index.d.ts +53 -0
  457. package/dist/src/telemetry/index.js +73 -0
  458. package/dist/src/telemetry/index.js.map +1 -0
  459. package/dist/src/telemetry/spanRegistry.d.ts +9 -0
  460. package/dist/src/telemetry/spanRegistry.js +14 -0
  461. package/dist/src/telemetry/spanRegistry.js.map +1 -0
  462. package/dist/src/templates/AutoExtract.d.ts +2 -0
  463. package/dist/src/templates/AutoExtract.js +124 -0
  464. package/dist/src/templates/AutoExtract.js.map +1 -0
  465. package/dist/src/templates/TemplateGallery.d.ts +54 -0
  466. package/dist/src/templates/TemplateGallery.js +139 -0
  467. package/dist/src/templates/TemplateGallery.js.map +1 -0
  468. package/dist/src/templates/TemplateRegistry.d.ts +16 -0
  469. package/dist/src/templates/TemplateRegistry.js +92 -0
  470. package/dist/src/templates/TemplateRegistry.js.map +1 -0
  471. package/dist/src/templates/WorkflowTemplate.d.ts +24 -0
  472. package/dist/src/templates/WorkflowTemplate.js +2 -0
  473. package/dist/src/templates/WorkflowTemplate.js.map +1 -0
  474. package/dist/src/templates/builtin/HttpCallbackTemplate.d.ts +2 -0
  475. package/dist/src/templates/builtin/HttpCallbackTemplate.js +47 -0
  476. package/dist/src/templates/builtin/HttpCallbackTemplate.js.map +1 -0
  477. package/dist/src/templates/builtin/index.d.ts +3 -0
  478. package/dist/src/templates/builtin/index.js +11 -0
  479. package/dist/src/templates/builtin/index.js.map +1 -0
  480. package/dist/src/templates/index.d.ts +3 -0
  481. package/dist/src/templates/index.js +3 -0
  482. package/dist/src/templates/index.js.map +1 -0
  483. package/dist/src/testing/MutationTester.d.ts +27 -0
  484. package/dist/src/testing/MutationTester.js +157 -0
  485. package/dist/src/testing/MutationTester.js.map +1 -0
  486. package/dist/src/testing/TestGenerator.d.ts +31 -0
  487. package/dist/src/testing/TestGenerator.js +345 -0
  488. package/dist/src/testing/TestGenerator.js.map +1 -0
  489. package/dist/src/testing/index.d.ts +2 -0
  490. package/dist/src/testing/index.js +3 -0
  491. package/dist/src/testing/index.js.map +1 -0
  492. package/dist/src/testing/testWorkflow.d.ts +51 -0
  493. package/dist/src/testing/testWorkflow.js +167 -0
  494. package/dist/src/testing/testWorkflow.js.map +1 -0
  495. package/dist/src/utils/AuditLogger.d.ts +36 -0
  496. package/dist/src/utils/AuditLogger.js +148 -0
  497. package/dist/src/utils/AuditLogger.js.map +1 -0
  498. package/dist/src/utils/BoundedMap.d.ts +34 -0
  499. package/dist/src/utils/BoundedMap.js +125 -0
  500. package/dist/src/utils/BoundedMap.js.map +1 -0
  501. package/dist/src/utils/LeaseStore.d.ts +7 -0
  502. package/dist/src/utils/LeaseStore.js +102 -0
  503. package/dist/src/utils/LeaseStore.js.map +1 -0
  504. package/dist/src/utils/Logger.d.ts +26 -0
  505. package/dist/src/utils/Logger.js +279 -0
  506. package/dist/src/utils/Logger.js.map +1 -0
  507. package/dist/src/utils/SecretManager.d.ts +41 -0
  508. package/dist/src/utils/SecretManager.js +139 -0
  509. package/dist/src/utils/SecretManager.js.map +1 -0
  510. package/dist/src/utils/StructuredLogger.d.ts +45 -0
  511. package/dist/src/utils/StructuredLogger.js +118 -0
  512. package/dist/src/utils/StructuredLogger.js.map +1 -0
  513. package/dist/src/utils/concurrency.d.ts +3 -0
  514. package/dist/src/utils/concurrency.js +22 -0
  515. package/dist/src/utils/concurrency.js.map +1 -0
  516. package/dist/src/utils/env.d.ts +5 -0
  517. package/dist/src/utils/env.js +15 -0
  518. package/dist/src/utils/env.js.map +1 -0
  519. package/dist/src/utils/index.d.ts +5 -0
  520. package/dist/src/utils/index.js +4 -0
  521. package/dist/src/utils/index.js.map +1 -0
  522. package/dist/src/utils/secrets.d.ts +5 -0
  523. package/dist/src/utils/secrets.js +27 -0
  524. package/dist/src/utils/secrets.js.map +1 -0
  525. package/package.json +159 -0
@@ -0,0 +1,233 @@
1
+ import { z } from "zod";
2
+ export const TaskTypeSchema = z.enum([
3
+ "action",
4
+ "wait",
5
+ "event",
6
+ "rollback",
7
+ "subworkflow",
8
+ "http",
9
+ "sql",
10
+ "queue",
11
+ "condition",
12
+ "router",
13
+ "loop",
14
+ "approval",
15
+ "notification",
16
+ "join",
17
+ "transform",
18
+ ]);
19
+ const httpNodeConfigSchema = z
20
+ .object({
21
+ method: z.enum([
22
+ "GET",
23
+ "POST",
24
+ "PUT",
25
+ "DELETE",
26
+ "PATCH",
27
+ "HEAD",
28
+ "OPTIONS",
29
+ ]),
30
+ url: z.string(),
31
+ headers: z.record(z.string(), z.string()).optional(),
32
+ body: z.unknown().optional(),
33
+ timeout: z.number().optional(),
34
+ retryPolicy: z
35
+ .object({
36
+ maxRetries: z.number(),
37
+ backoff: z.enum(["linear", "exponential"]),
38
+ initialDelay: z.number().optional(),
39
+ })
40
+ .optional(),
41
+ followRedirects: z.boolean().optional(),
42
+ })
43
+ .meta({ id: "HttpNodeConfig" });
44
+ const sqlNodeConfigSchema = z
45
+ .object({
46
+ connection: z.string(),
47
+ query: z.string(),
48
+ parameters: z.array(z.unknown()).optional(),
49
+ timeout: z.number().optional(),
50
+ database: z
51
+ .enum(["postgres", "mysql", "sqlite", "mssql", "generic"])
52
+ .optional(),
53
+ })
54
+ .meta({ id: "SqlNodeConfig" });
55
+ const queueNodeConfigSchema = z
56
+ .object({
57
+ operation: z.enum(["publish", "consume"]),
58
+ queue: z.string(),
59
+ message: z.unknown().optional(),
60
+ timeout: z.number().optional(),
61
+ })
62
+ .meta({ id: "QueueNodeConfig" });
63
+ const conditionNodeConfigSchema = z
64
+ .object({
65
+ condition: z.string(),
66
+ trueBranch: z.string(),
67
+ falseBranch: z.string(),
68
+ })
69
+ .meta({ id: "ConditionNodeConfig" });
70
+ const routerNodeConfigSchema = z
71
+ .object({
72
+ routes: z.array(z.object({
73
+ condition: z.string(),
74
+ target: z.string(),
75
+ priority: z.number().optional(),
76
+ })),
77
+ defaultTarget: z.string().optional(),
78
+ })
79
+ .meta({ id: "RouterNodeConfig" });
80
+ const loopNodeConfigSchema = z
81
+ .object({
82
+ collection: z.string(),
83
+ itemVariable: z.string(),
84
+ indexVariable: z.string().optional(),
85
+ body: z.string(),
86
+ parallel: z.boolean().optional(),
87
+ maxConcurrency: z.number().optional(),
88
+ })
89
+ .meta({ id: "LoopNodeConfig" });
90
+ export const ApprovalNodeConfigSchema = z
91
+ .object({
92
+ eventType: z.string().optional(),
93
+ prompt: z.string().optional(),
94
+ approvedTarget: z.string().optional(),
95
+ rejectedTarget: z.string().optional(),
96
+ timeoutMs: z.number().optional(),
97
+ requireInstanceIdMatch: z.boolean().optional(),
98
+ })
99
+ .meta({ id: "ApprovalNodeConfig" });
100
+ export const NotificationNodeConfigSchema = z
101
+ .object({
102
+ channel: z.union([
103
+ z.enum(["slack", "feishu", "dingtalk", "email", "webhook"]),
104
+ z.string(),
105
+ ]),
106
+ target: z.string(),
107
+ template: z.string(),
108
+ subject: z.string().optional(),
109
+ severity: z.enum(["info", "warning", "critical"]).optional(),
110
+ data: z.record(z.string(), z.unknown()).optional(),
111
+ })
112
+ .meta({ id: "NotificationNodeConfig" });
113
+ const joinNodeConfigSchema = z
114
+ .object({
115
+ waitFor: z.array(z.string()).min(1),
116
+ mode: z.enum(["all", "any"]).optional(),
117
+ })
118
+ .meta({ id: "JoinNodeConfig" });
119
+ const transformNodeConfigSchema = z
120
+ .object({
121
+ output: z.record(z.string(), z.string()),
122
+ })
123
+ .meta({ id: "TransformNodeConfig" });
124
+ export const WaitNodeConfigSchema = z
125
+ .object({
126
+ durationMs: z.number().optional(),
127
+ until: z.string().optional(),
128
+ durable: z.boolean().optional(),
129
+ })
130
+ .meta({ id: "WaitNodeConfig" });
131
+ export const nodeConfigSchemaByType = {
132
+ wait: WaitNodeConfigSchema,
133
+ http: httpNodeConfigSchema,
134
+ sql: sqlNodeConfigSchema,
135
+ queue: queueNodeConfigSchema,
136
+ condition: conditionNodeConfigSchema,
137
+ router: routerNodeConfigSchema,
138
+ loop: loopNodeConfigSchema,
139
+ approval: ApprovalNodeConfigSchema,
140
+ notification: NotificationNodeConfigSchema,
141
+ join: joinNodeConfigSchema,
142
+ transform: transformNodeConfigSchema,
143
+ };
144
+ const conditionalBranchSchema = z.object({
145
+ condition: z.string(),
146
+ target: z.string(),
147
+ });
148
+ const retryPolicySchema = z.record(z.string(), z.unknown());
149
+ export const TaskNodeSchema = z
150
+ .object({
151
+ id: z.string(),
152
+ type: TaskTypeSchema,
153
+ timeout: z.number().optional(),
154
+ next: z.array(z.string()).optional(),
155
+ onEvent: z.string().optional(),
156
+ rollbackTo: z.string().optional(),
157
+ failureNext: z.array(z.string()).optional(),
158
+ maxRetries: z.number().optional(),
159
+ retryPolicy: retryPolicySchema.optional(),
160
+ heartbeat: z
161
+ .object({
162
+ interval: z.number().optional(),
163
+ timeout: z.number().optional(),
164
+ })
165
+ .optional(),
166
+ conditionalNext: z.array(conditionalBranchSchema).optional(),
167
+ defaultNext: z.string().optional(),
168
+ subworkflowId: z.string().optional(),
169
+ subworkflowInput: z.record(z.string(), z.string()).optional(),
170
+ waitForCompletion: z.boolean().optional(),
171
+ output: z.unknown().optional(),
172
+ config: z.record(z.string(), z.unknown()).optional(),
173
+ inputSchema: z.record(z.string(), z.unknown()).optional(),
174
+ outputSchema: z.record(z.string(), z.unknown()).optional(),
175
+ })
176
+ .meta({ id: "TaskNode" });
177
+ export const WorkflowDefinitionSchema = z
178
+ .object({
179
+ id: z.string(),
180
+ name: z.string(),
181
+ version: z.string().optional(),
182
+ description: z.string().optional(),
183
+ nodes: z.record(z.string(), TaskNodeSchema),
184
+ startNode: z.string(),
185
+ cron: z.string().optional(),
186
+ triggerEvents: z.array(z.string()).optional(),
187
+ metadata: z.record(z.string(), z.unknown()).optional(),
188
+ createdAt: z.union([z.string(), z.number()]).optional(),
189
+ updatedAt: z.union([z.string(), z.number()]).optional(),
190
+ inputSchema: z.record(z.string(), z.unknown()).optional(),
191
+ outputSchema: z.record(z.string(), z.unknown()).optional(),
192
+ })
193
+ .meta({ id: "WorkflowDefinition" });
194
+ export function validateNodeConfig(type, config) {
195
+ const schema = nodeConfigSchemaByType[type];
196
+ if (!schema) {
197
+ return null;
198
+ }
199
+ return schema.safeParse(config ?? {});
200
+ }
201
+ export function getWorkflowDefinitionJsonSchema() {
202
+ return z.toJSONSchema(WorkflowDefinitionSchema, {
203
+ target: "draft-2020-12",
204
+ });
205
+ }
206
+ export function getNodeConfigJsonSchema(type) {
207
+ const schema = nodeConfigSchemaByType[type];
208
+ if (!schema) {
209
+ return null;
210
+ }
211
+ return z.toJSONSchema(schema, { target: "draft-2020-12" });
212
+ }
213
+ function toOpenApiComponents(rootName, zodSchema) {
214
+ const generated = z.toJSONSchema(zodSchema, {
215
+ target: "draft-2020-12",
216
+ });
217
+ const { $schema: _schema, $defs, ...root } = generated;
218
+ const rewritten = JSON.parse(JSON.stringify({ [rootName]: root, ...$defs }).replaceAll("#/$defs/", "#/components/schemas/"));
219
+ return rewritten;
220
+ }
221
+ export function getWorkflowOpenApiSchemas() {
222
+ let schemas = toOpenApiComponents("WorkflowDefinition", WorkflowDefinitionSchema);
223
+ for (const [type, configSchema] of Object.entries(nodeConfigSchemaByType)) {
224
+ if (!configSchema)
225
+ continue;
226
+ schemas = {
227
+ ...schemas,
228
+ ...toOpenApiComponents(`${type[0].toUpperCase()}${type.slice(1)}NodeConfig`, configSchema),
229
+ };
230
+ }
231
+ return schemas;
232
+ }
233
+ //# sourceMappingURL=WorkflowSchema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WorkflowSch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EAAE,CAAC,CAAC,UAAU,CACvD,UAAU,EACV,uBAAuB,CACxB,CACyB,CAAC;IAE7B,OAAO,SAAS,CAAC;AACnB,CAAC;AAKD,MAAM,UAAU,yBAAyB;IACvC,IAAI,OAAO,GAA4B,mBAAmB,CACxD,oBAAoB,EACpB,wBAAwB,CACzB,CAAC;IACF,KAAK,MAAM,CAAC,IAAI,EAAE,YAAY,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,sBAAsB,CAAC,EAAE,CAAC;QAC1E,IAAI,CAAC,YAAY;YAAE,SAAS;QAC5B,OAAO,GAAG;YACR,GAAG,OAAO;YACV,GAAG,mBAAmB,CACpB,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,YAAY,EACpD,YAAY,CACb;SACF,CAAC;IACJ,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,15 @@
1
+ import type { WorkflowDefinition } from "./Workflow.js";
2
+ export interface VariableSuggestion {
3
+ expression: string;
4
+ path: string;
5
+ source: "context" | "node-output";
6
+ nodeId?: string;
7
+ type?: string;
8
+ }
9
+ export declare function getContextVariableSuggestions(definition: Pick<WorkflowDefinition, "inputSchema">): VariableSuggestion[];
10
+ export declare function getNodeOutputVariableSuggestions(definition: WorkflowDefinition, options?: {
11
+ before?: string;
12
+ }): VariableSuggestion[];
13
+ export declare function getVariableSuggestions(definition: WorkflowDefinition, options?: {
14
+ before?: string;
15
+ }): VariableSuggestion[];
@@ -0,0 +1,77 @@
1
+ import { toGraph } from "./WorkflowGraph.js";
2
+ function schemaProperties(schema) {
3
+ const properties = schema?.properties;
4
+ if (!properties || typeof properties !== "object") {
5
+ return [];
6
+ }
7
+ return Object.entries(properties).map(([key, propSchema]) => ({
8
+ key,
9
+ type: propSchema && typeof propSchema === "object" && "type" in propSchema
10
+ ? String(propSchema.type)
11
+ : undefined,
12
+ }));
13
+ }
14
+ export function getContextVariableSuggestions(definition) {
15
+ const props = schemaProperties(definition.inputSchema);
16
+ if (props.length === 0) {
17
+ return [{ expression: "${context}", path: "context", source: "context" }];
18
+ }
19
+ return props.map(({ key, type }) => ({
20
+ expression: `\${context.${key}}`,
21
+ path: `context.${key}`,
22
+ source: "context",
23
+ type,
24
+ }));
25
+ }
26
+ function findAncestors(definition, targetId) {
27
+ const { edges } = toGraph(definition);
28
+ const predecessors = new Map();
29
+ for (const edge of edges) {
30
+ const list = predecessors.get(edge.target) ?? [];
31
+ list.push(edge.source);
32
+ predecessors.set(edge.target, list);
33
+ }
34
+ const ancestors = new Set();
35
+ const queue = [...(predecessors.get(targetId) ?? [])];
36
+ while (queue.length > 0) {
37
+ const nodeId = queue.shift();
38
+ if (ancestors.has(nodeId))
39
+ continue;
40
+ ancestors.add(nodeId);
41
+ queue.push(...(predecessors.get(nodeId) ?? []));
42
+ }
43
+ return ancestors;
44
+ }
45
+ export function getNodeOutputVariableSuggestions(definition, options) {
46
+ const nodeIds = Object.keys(definition.nodes ?? {});
47
+ const scoped = options?.before && nodeIds.includes(options.before)
48
+ ? nodeIds.filter((id) => findAncestors(definition, options.before).has(id))
49
+ : nodeIds.filter((id) => id !== options?.before);
50
+ const suggestions = [];
51
+ for (const nodeId of scoped) {
52
+ suggestions.push({
53
+ expression: `\${${nodeId}.output}`,
54
+ path: `${nodeId}.output`,
55
+ source: "node-output",
56
+ nodeId,
57
+ });
58
+ const node = definition.nodes[nodeId];
59
+ for (const { key, type } of schemaProperties(node.outputSchema)) {
60
+ suggestions.push({
61
+ expression: `\${${nodeId}.output.${key}}`,
62
+ path: `${nodeId}.output.${key}`,
63
+ source: "node-output",
64
+ nodeId,
65
+ type,
66
+ });
67
+ }
68
+ }
69
+ return suggestions;
70
+ }
71
+ export function getVariableSuggestions(definition, options) {
72
+ return [
73
+ ...getContextVariableSuggestions(definition),
74
+ ...getNodeOutputVariableSuggestions(definition, options),
75
+ ];
76
+ }
77
+ //# sourceMappingURL=Workflow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CAAC,EAAE,EAAE,EAAE,CACpB,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,MAAO,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CACnD;QACH,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,OAAO,EAAE,MAAM,CAAC,CAAC;IAErD,MAAM,WAAW,GAAyB,EAAE,CAAC;IAC7C,KAAK,MAAM,MAAM,IAAI,MAAM,EAAE,CAAC;QAC5B,WAAW,CAAC,IAAI,CAAC;YACf,UAAU,EAAE,MAAM,MAAM,UAAU;YAClC,IAAI,EAAE,GAAG,MAAM,SAAS;YACxB,MAAM,EAAE,aAAa;YACrB,MAAM;SACP,CAAC,CAAC;QACH,MAAM,IAAI,GAAG,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QACtC,KAAK,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,gBAAgB,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC;YAChE,WAAW,CAAC,IAAI,CAAC;gBACf,UAAU,EAAE,MAAM,MAAM,WAAW,GAAG,GAAG;gBACzC,IAAI,EAAE,GAAG,MAAM,WAAW,GAAG,EAAE;gBAC/B,MAAM,EAAE,aAAa;gBACrB,MAAM;gBACN,IAAI;aACL,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IACD,OAAO,WAAW,CAAC;AACrB,CAAC;AAID,MAAM,UAAU,sBAAsB,CACpC,UAA8B,EAC9B,OAA6B;IAE7B,OAAO;QACL,GAAG,6BAA6B,CAAC,UAAU,CAAC;QAC5C,GAAG,gCAAgC,CAAC,UAAU,EAAE,OAAO,CAAC;KACzD,CAAC;AACJ,CAAC"}
@@ -0,0 +1,19 @@
1
+ export type NotificationSeverity = "info" | "warning" | "critical";
2
+ export interface NotificationMessage {
3
+ target: string;
4
+ subject?: string;
5
+ body: string;
6
+ severity?: NotificationSeverity;
7
+ data?: Record<string, unknown>;
8
+ }
9
+ export interface NotificationResult {
10
+ ok: boolean;
11
+ channel: string;
12
+ detail?: unknown;
13
+ error?: string;
14
+ }
15
+ export interface NotificationChannel {
16
+ name: string;
17
+ send(message: NotificationMessage): Promise<NotificationResult>;
18
+ validate(): Promise<boolean>;
19
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=NotificationChannel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NotificationChannel.js","sourceRoot":"","sources":["../../../src/notification/NotificationChannel.ts"],"names":[],"mappings":""}
@@ -0,0 +1,20 @@
1
+ import type { NotificationChannel, NotificationMessage, NotificationResult } from "./NotificationChannel.js";
2
+ export declare class NotificationManager {
3
+ private readonly channels;
4
+ registerChannel(channel: NotificationChannel): void;
5
+ getChannel(name: string): NotificationChannel | undefined;
6
+ listChannels(): string[];
7
+ send(channelName: string, message: NotificationMessage): Promise<NotificationResult>;
8
+ renderTemplate(template: string, context: Record<string, unknown>, state?: {
9
+ nodes?: Record<string, {
10
+ output?: unknown;
11
+ }>;
12
+ }): string;
13
+ private renderValue;
14
+ renderMessage(message: NotificationMessage, context: Record<string, unknown>, state?: {
15
+ nodes?: Record<string, {
16
+ output?: unknown;
17
+ }>;
18
+ }): NotificationMessage;
19
+ }
20
+ export declare const notificationManager: NotificationManager;
@@ -0,0 +1,59 @@
1
+ import { getNestedValue, interpolateExpressions, interpolateObject, } from "../engine/ExpressionEvaluator.js";
2
+ import { Logger } from "../utils/Logger.js";
3
+ export class NotificationManager {
4
+ channels = new Map();
5
+ registerChannel(channel) {
6
+ this.channels.set(channel.name, channel);
7
+ Logger.info("system", "notification", `Notification channel registered: ${channel.name}`);
8
+ }
9
+ getChannel(name) {
10
+ return this.channels.get(name);
11
+ }
12
+ listChannels() {
13
+ return Array.from(this.channels.keys());
14
+ }
15
+ async send(channelName, message) {
16
+ const channel = this.channels.get(channelName);
17
+ if (!channel) {
18
+ throw new Error(`Notification channel not registered: ${channelName}`);
19
+ }
20
+ return channel.send(message);
21
+ }
22
+ renderTemplate(template, context, state) {
23
+ const withVariables = template.replace(/\{\{\s*([\w.]+)\s*\}\}/g, (match, path) => {
24
+ const value = getNestedValue(context, path);
25
+ return value !== undefined ? String(value) : match;
26
+ });
27
+ return interpolateExpressions(withVariables, context, state);
28
+ }
29
+ renderValue(value, context, state) {
30
+ if (typeof value === "string") {
31
+ return this.renderTemplate(value, context, state);
32
+ }
33
+ if (Array.isArray(value)) {
34
+ return value.map((item) => this.renderValue(item, context, state));
35
+ }
36
+ if (value !== null && typeof value === "object") {
37
+ const rendered = {};
38
+ for (const [key, item] of Object.entries(value)) {
39
+ rendered[key] = this.renderValue(item, context, state);
40
+ }
41
+ return rendered;
42
+ }
43
+ return value;
44
+ }
45
+ renderMessage(message, context, state) {
46
+ const interpolatedMessage = interpolateObject(message, context, state);
47
+ return {
48
+ ...interpolatedMessage,
49
+ body: this.renderTemplate(message.body, context, state),
50
+ subject: message.subject
51
+ ? this.renderTemplate(message.subject, context, state)
52
+ : undefined,
53
+ target: this.renderTemplate(message.target, context, state),
54
+ data: this.renderValue(interpolatedMessage.data, context, state),
55
+ };
56
+ }
57
+ }
58
+ export const notificationManager = new NotificationManager();
59
+ //# sourceMappingURL=NotificationManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NotificationManager.js","sourceRoot":"","sources":["../../../src/notification/NotificationManager.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,sBAAsB,EACtB,iBAAiB,GAClB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAWzC,MAAM,OAAO,mBAAmB;IACb,QAAQ,GAAG,IAAI,GAAG,EAA+B,CAAC;IAEnE,eAAe,CAAC,OAA4B;QAC1C,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACzC,MAAM,CAAC,IAAI,CACT,QAAQ,EACR,cAAc,EACd,oCAAo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AAE,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { NotificationMessage } from "../NotificationChannel.js";
2
+ import { WebhookChannel } from "./WebhookChannel.js";
3
+ export declare class DingtalkChannel extends WebhookChannel {
4
+ name: string;
5
+ protected buildPayload(message: NotificationMessage): unknown;
6
+ protected resolveUrl(_message: NotificationMessage): string;
7
+ }
@@ -0,0 +1,18 @@
1
+ import { WebhookChannel } from "./WebhookChannel.js";
2
+ export class DingtalkChannel extends WebhookChannel {
3
+ name = "dingtalk";
4
+ buildPayload(message) {
5
+ const prefix = message.subject ? `${message.subject}\n` : "";
6
+ return {
7
+ msgtype: "text",
8
+ text: { content: `${prefix}${message.body}` },
9
+ };
10
+ }
11
+ resolveUrl(_message) {
12
+ if (!this.webhookUrl) {
13
+ throw new Error("dingtalk channel requires a webhook URL");
14
+ }
15
+ return this.webhookUrl;
16
+ }
17
+ }
18
+ //# sourceMappingURL=DingtalkChannel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DingtalkChannel.js","sourceRoot":"","sources":["../../../../src/notification/channels/DingtalkChannel.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,MAAM,OAAO,eAAgB,SAAQ,cAAc;IACjD,IAAI,GAAG,UAAU,CAAC;IAER,YAAY,CAAC,OAA4B;QACjD,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7D,OAAO;YACL,OAAO,EAAE,MAAM;YACf,IAAI,EAAE,EAAE,OAAO,EAAE,GAAG,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,EAAE;SAC9C,CAAC;IACJ,CAAC;IAES,UAAU,CAAC,QAA6B;QAChD,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;QAC7D,CAAC;QACD,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;CACF"}
@@ -0,0 +1,21 @@
1
+ import type { NotificationChannel, NotificationMessage, NotificationResult } from "../NotificationChannel.js";
2
+ export interface EmailTransport {
3
+ sendMail(message: {
4
+ from: string;
5
+ to: string;
6
+ subject?: string;
7
+ text: string;
8
+ }): Promise<unknown>;
9
+ }
10
+ export interface EmailChannelOptions {
11
+ transport: EmailTransport;
12
+ from: string;
13
+ }
14
+ export declare class EmailChannel implements NotificationChannel {
15
+ name: string;
16
+ private readonly transport;
17
+ private readonly from;
18
+ constructor(options: EmailChannelOptions);
19
+ send(message: NotificationMessage): Promise<NotificationResult>;
20
+ validate(): Promise<boolean>;
21
+ }
@@ -0,0 +1,32 @@
1
+ import { Logger } from "../../utils/Logger.js";
2
+ export class EmailChannel {
3
+ name = "email";
4
+ transport;
5
+ from;
6
+ constructor(options) {
7
+ this.transport = options.transport;
8
+ this.from = options.from;
9
+ }
10
+ async send(message) {
11
+ try {
12
+ const detail = await this.transport.sendMail({
13
+ from: this.from,
14
+ to: message.target,
15
+ subject: message.subject,
16
+ text: message.body,
17
+ });
18
+ return { ok: true, channel: this.name, detail };
19
+ }
20
+ catch (error) {
21
+ const msg = error instanceof Error ? error.message : String(error);
22
+ Logger.warn("system", "notification", "email send failed", {
23
+ error: msg,
24
+ });
25
+ return { ok: false, channel: this.name, error: msg };
26
+ }
27
+ }
28
+ async validate() {
29
+ return Boolean(this.transport && this.from);
30
+ }
31
+ }
32
+ //# sourceMappingURL=EmailChannel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EmailChannel.js","sourceRoot":"","sources":["../../../../src/notification/channels/EmailChannel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAsB5C,MAAM,OAAO,YAAY;IACvB,IAAI,GAAG,OAAO,CAAC;IACE,SAAS,CAAiB;IAC1B,IAAI,CAAS;IAE9B,YAAY,OAA4B;QACtC,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;QACnC,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAC3B,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,OAA4B;QACrC,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;gBAC3C,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,EAAE,EAAE,OAAO,CAAC,MAAM;gBAClB,OAAO,EAAE,OAAO,CAAC,OAAO;gBACxB,IAAI,EAAE,OAAO,CAAC,IAAI;aACnB,CAAC,CAAC;YACH,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC;QAClD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,GAAG,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACnE,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,cAAc,EAAE,mBAAmB,EAAE;gBACzD,KAAK,EAAE,GAAG;aACX,CAAC,CAAC;YACH,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;QACvD,CAAC;IACH,CAAC;IAED,KAAK,CAAC,QAAQ;QACZ,OAAO,OAAO,CAAC,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC;IAC9C,CAAC;CACF"}
@@ -0,0 +1,7 @@
1
+ import type { NotificationMessage } from "../NotificationChannel.js";
2
+ import { WebhookChannel } from "./WebhookChannel.js";
3
+ export declare class FeishuChannel extends WebhookChannel {
4
+ name: string;
5
+ protected buildPayload(message: NotificationMessage): unknown;
6
+ protected resolveUrl(_message: NotificationMessage): string;
7
+ }
@@ -0,0 +1,18 @@
1
+ import { WebhookChannel } from "./WebhookChannel.js";
2
+ export class FeishuChannel extends WebhookChannel {
3
+ name = "feishu";
4
+ buildPayload(message) {
5
+ const prefix = message.subject ? `${message.subject}\n` : "";
6
+ return {
7
+ msg_type: "text",
8
+ content: { text: `${prefix}${message.body}` },
9
+ };
10
+ }
11
+ resolveUrl(_message) {
12
+ if (!this.webhookUrl) {
13
+ throw new Error("feishu channel requires a webhook URL");
14
+ }
15
+ return this.webhookUrl;
16
+ }
17
+ }
18
+ //# sourceMappingURL=FeishuChannel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FeishuChannel.js","sourceRoot":"","sources":["../../../../src/notification/channels/FeishuChannel.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,MAAM,OAAO,aAAc,SAAQ,cAAc;IAC/C,IAAI,GAAG,QAAQ,CAAC;IAEN,YAAY,CAAC,OAA4B;QACjD,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7D,OAAO;YACL,QAAQ,EAAE,MAAM;YAChB,OAAO,EAAE,EAAE,IAAI,EAAE,GAAG,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,EAAE;SAC9C,CAAC;IACJ,CAAC;IAES,UAAU,CAAC,QAA6B;QAChD,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;QAC3D,CAAC;QACD,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;CACF"}
@@ -0,0 +1,7 @@
1
+ import type { NotificationMessage } from "../NotificationChannel.js";
2
+ import { WebhookChannel } from "./WebhookChannel.js";
3
+ export declare class SlackChannel extends WebhookChannel {
4
+ name: string;
5
+ protected buildPayload(message: NotificationMessage): unknown;
6
+ protected resolveUrl(_message: NotificationMessage): string;
7
+ }
@@ -0,0 +1,18 @@
1
+ import { WebhookChannel } from "./WebhookChannel.js";
2
+ export class SlackChannel extends WebhookChannel {
3
+ name = "slack";
4
+ buildPayload(message) {
5
+ const prefix = message.subject ? `*${message.subject}*\n` : "";
6
+ return {
7
+ channel: message.target,
8
+ text: `${prefix}${message.body}`,
9
+ };
10
+ }
11
+ resolveUrl(_message) {
12
+ if (!this.webhookUrl) {
13
+ throw new Error("slack channel requires a webhook URL");
14
+ }
15
+ return this.webhookUrl;
16
+ }
17
+ }
18
+ //# sourceMappingURL=SlackChannel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SlackChannel.js","sourceRoot":"","sources":["../../../../src/notification/channels/SlackChannel.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,MAAM,OAAO,YAAa,SAAQ,cAAc;IAC9C,IAAI,GAAG,OAAO,CAAC;IAEL,YAAY,CAAC,OAA4B;QACjD,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,OAAO,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/D,OAAO;YACL,OAAO,EAAE,OAAO,CAAC,MAAM;YACvB,IAAI,EAAE,GAAG,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE;SACjC,CAAC;IACJ,CAAC;IAES,UAAU,CAAC,QAA6B;QAChD,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;QAC1D,CAAC;QACD,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;CACF"}
@@ -0,0 +1,24 @@
1
+ import type { NotificationChannel, NotificationMessage, NotificationResult } from "../NotificationChannel.js";
2
+ export interface SmsSendParams {
3
+ to: string;
4
+ content: string;
5
+ signName?: string;
6
+ }
7
+ export interface SmsSendResult {
8
+ messageId?: string;
9
+ }
10
+ export interface SmsTransport {
11
+ send(params: SmsSendParams): Promise<SmsSendResult>;
12
+ }
13
+ export interface SmsChannelOptions {
14
+ transport: SmsTransport;
15
+ signName?: string;
16
+ }
17
+ export declare class SmsChannel implements NotificationChannel {
18
+ name: string;
19
+ private readonly transport;
20
+ private readonly defaultSignName?;
21
+ constructor(options: SmsChannelOptions);
22
+ send(message: NotificationMessage): Promise<NotificationResult>;
23
+ validate(): Promise<boolean>;
24
+ }