nvent 0.4.4 → 0.5.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 (293) hide show
  1. package/dist/module.d.mts +4 -185
  2. package/dist/module.json +3 -3
  3. package/dist/module.mjs +451 -257
  4. package/dist/runtime/adapters/base/index.d.ts +6 -0
  5. package/dist/runtime/adapters/base/index.js +1 -0
  6. package/dist/runtime/adapters/base/store-validator.d.ts +48 -0
  7. package/dist/runtime/adapters/base/store-validator.js +147 -0
  8. package/dist/runtime/adapters/builtin/file-queue.d.ts +67 -0
  9. package/dist/runtime/adapters/builtin/file-queue.js +499 -0
  10. package/dist/runtime/adapters/builtin/file-store.d.ts +32 -0
  11. package/dist/runtime/adapters/builtin/file-store.js +206 -0
  12. package/dist/runtime/adapters/builtin/file-stream.d.ts +39 -0
  13. package/dist/runtime/adapters/builtin/file-stream.js +56 -0
  14. package/dist/runtime/adapters/builtin/index.d.ts +10 -0
  15. package/dist/runtime/adapters/builtin/index.js +5 -0
  16. package/dist/runtime/adapters/builtin/memory-queue.d.ts +52 -0
  17. package/dist/runtime/adapters/builtin/memory-queue.js +243 -0
  18. package/dist/runtime/adapters/builtin/memory-store.d.ts +68 -0
  19. package/dist/runtime/adapters/builtin/memory-store.js +333 -0
  20. package/dist/runtime/adapters/builtin/memory-stream.d.ts +21 -0
  21. package/dist/runtime/adapters/builtin/memory-stream.js +56 -0
  22. package/dist/runtime/adapters/factory.d.ts +31 -0
  23. package/dist/runtime/adapters/factory.js +134 -0
  24. package/dist/runtime/adapters/index.d.ts +8 -0
  25. package/dist/runtime/adapters/index.js +3 -0
  26. package/dist/runtime/adapters/interfaces/index.d.ts +11 -0
  27. package/dist/runtime/adapters/interfaces/index.js +3 -0
  28. package/dist/runtime/adapters/interfaces/queue.d.ts +150 -0
  29. package/dist/runtime/adapters/interfaces/store.d.ts +297 -0
  30. package/dist/runtime/adapters/interfaces/stream.d.ts +62 -0
  31. package/dist/runtime/adapters/registry.d.ts +85 -0
  32. package/dist/runtime/adapters/registry.js +161 -0
  33. package/dist/runtime/config/index.d.ts +29 -0
  34. package/dist/runtime/config/index.js +175 -0
  35. package/dist/runtime/config/types.d.ts +397 -0
  36. package/dist/runtime/config/types.js +0 -0
  37. package/dist/runtime/{server-utils/events → events}/eventBus.d.ts +1 -1
  38. package/dist/runtime/events/types.d.ts +145 -0
  39. package/dist/runtime/events/types.js +0 -0
  40. package/dist/runtime/events/utils/scheduleTrigger.d.ts +8 -0
  41. package/dist/runtime/events/utils/scheduleTrigger.js +69 -0
  42. package/dist/runtime/events/utils/stallDetector.d.ts +140 -0
  43. package/dist/runtime/events/utils/stallDetector.js +436 -0
  44. package/dist/runtime/events/utils/triggerRuntime.d.ts +58 -0
  45. package/dist/runtime/events/utils/triggerRuntime.js +212 -0
  46. package/dist/runtime/{server-utils/events → events}/wiring/flowWiring.d.ts +12 -11
  47. package/dist/runtime/events/wiring/flowWiring.js +1020 -0
  48. package/dist/runtime/events/wiring/registry.d.ts +19 -0
  49. package/dist/runtime/events/wiring/registry.js +35 -0
  50. package/dist/runtime/events/wiring/stateWiring.d.ts +37 -0
  51. package/dist/runtime/events/wiring/stateWiring.js +92 -0
  52. package/dist/runtime/events/wiring/streamWiring.d.ts +36 -0
  53. package/dist/runtime/events/wiring/streamWiring.js +156 -0
  54. package/dist/runtime/events/wiring/triggerWiring.d.ts +21 -0
  55. package/dist/runtime/events/wiring/triggerWiring.js +412 -0
  56. package/dist/runtime/nitro/plugins/00.adapters.d.ts +14 -0
  57. package/dist/runtime/nitro/plugins/00.adapters.js +73 -0
  58. package/dist/runtime/nitro/plugins/02.workers.js +63 -0
  59. package/dist/runtime/nitro/plugins/03.triggers.d.ts +12 -0
  60. package/dist/runtime/nitro/plugins/03.triggers.js +55 -0
  61. package/dist/runtime/nitro/routes/webhook.await.d.ts +23 -0
  62. package/dist/runtime/nitro/routes/webhook.await.js +90 -0
  63. package/dist/runtime/nitro/routes/webhook.trigger.d.ts +69 -0
  64. package/dist/runtime/nitro/routes/webhook.trigger.js +64 -0
  65. package/dist/runtime/nitro/utils/adapters.d.ts +66 -0
  66. package/dist/runtime/nitro/utils/adapters.js +51 -0
  67. package/dist/runtime/nitro/utils/awaitPatterns/event.d.ts +15 -0
  68. package/dist/runtime/nitro/utils/awaitPatterns/event.js +120 -0
  69. package/dist/runtime/nitro/utils/awaitPatterns/index.d.ts +28 -0
  70. package/dist/runtime/nitro/utils/awaitPatterns/index.js +55 -0
  71. package/dist/runtime/nitro/utils/awaitPatterns/schedule.d.ts +16 -0
  72. package/dist/runtime/nitro/utils/awaitPatterns/schedule.js +78 -0
  73. package/dist/runtime/nitro/utils/awaitPatterns/time.d.ts +15 -0
  74. package/dist/runtime/nitro/utils/awaitPatterns/time.js +67 -0
  75. package/dist/runtime/nitro/utils/awaitPatterns/webhook.d.ts +15 -0
  76. package/dist/runtime/nitro/utils/awaitPatterns/webhook.js +120 -0
  77. package/dist/runtime/nitro/utils/defineFunction.d.ts +10 -0
  78. package/dist/runtime/nitro/utils/defineFunction.js +17 -0
  79. package/dist/runtime/nitro/utils/defineFunctionConfig.d.ts +310 -0
  80. package/dist/runtime/nitro/utils/defineFunctionConfig.js +3 -0
  81. package/dist/runtime/nitro/utils/defineHooks.d.ts +41 -0
  82. package/dist/runtime/nitro/utils/defineHooks.js +6 -0
  83. package/dist/runtime/nitro/utils/registerAdapter.d.ts +59 -0
  84. package/dist/runtime/nitro/utils/registerAdapter.js +13 -0
  85. package/dist/runtime/nitro/utils/useAwait.d.ts +71 -0
  86. package/dist/runtime/nitro/utils/useAwait.js +139 -0
  87. package/dist/runtime/{server-utils → nitro}/utils/useEventManager.d.ts +2 -2
  88. package/dist/runtime/{server-utils → nitro}/utils/useEventManager.js +1 -1
  89. package/dist/runtime/nitro/utils/useFlow.d.ts +68 -0
  90. package/dist/runtime/nitro/utils/useFlow.js +226 -0
  91. package/dist/runtime/nitro/utils/useHookRegistry.d.ts +34 -0
  92. package/dist/runtime/nitro/utils/useHookRegistry.js +25 -0
  93. package/dist/runtime/{server-utils → nitro}/utils/useNventLogger.js +2 -2
  94. package/dist/runtime/nitro/utils/useRunContext.d.ts +6 -0
  95. package/dist/runtime/nitro/utils/useRunContext.js +102 -0
  96. package/dist/runtime/nitro/utils/useStreamTopics.d.ts +83 -0
  97. package/dist/runtime/nitro/utils/useStreamTopics.js +94 -0
  98. package/dist/runtime/nitro/utils/useTrigger.d.ts +150 -0
  99. package/dist/runtime/nitro/utils/useTrigger.js +320 -0
  100. package/dist/runtime/scheduler/index.d.ts +33 -0
  101. package/dist/runtime/scheduler/index.js +38 -0
  102. package/dist/runtime/scheduler/scheduler.d.ts +113 -0
  103. package/dist/runtime/scheduler/scheduler.js +623 -0
  104. package/dist/runtime/scheduler/types.d.ts +116 -0
  105. package/dist/runtime/scheduler/types.js +0 -0
  106. package/dist/runtime/tsconfig.json +8 -0
  107. package/dist/runtime/worker/node/runner.d.ts +53 -0
  108. package/dist/runtime/worker/node/runner.js +327 -0
  109. package/dist/types.d.mts +2 -2
  110. package/package.json +16 -46
  111. package/LICENSE +0 -21
  112. package/README.md +0 -389
  113. package/dist/runtime/app/assets/vueflow.css +0 -1
  114. package/dist/runtime/app/components/ConfirmDialog.d.vue.ts +0 -33
  115. package/dist/runtime/app/components/ConfirmDialog.vue +0 -121
  116. package/dist/runtime/app/components/ConfirmDialog.vue.d.ts +0 -33
  117. package/dist/runtime/app/components/FlowDiagram.d.vue.ts +0 -64
  118. package/dist/runtime/app/components/FlowDiagram.vue +0 -338
  119. package/dist/runtime/app/components/FlowDiagram.vue.d.ts +0 -64
  120. package/dist/runtime/app/components/FlowNodeCard.d.vue.ts +0 -29
  121. package/dist/runtime/app/components/FlowNodeCard.vue +0 -156
  122. package/dist/runtime/app/components/FlowNodeCard.vue.d.ts +0 -29
  123. package/dist/runtime/app/components/FlowRunOverview.d.vue.ts +0 -9
  124. package/dist/runtime/app/components/FlowRunOverview.vue +0 -291
  125. package/dist/runtime/app/components/FlowRunOverview.vue.d.ts +0 -9
  126. package/dist/runtime/app/components/FlowRunStatusBadge.d.vue.ts +0 -14
  127. package/dist/runtime/app/components/FlowRunStatusBadge.vue +0 -60
  128. package/dist/runtime/app/components/FlowRunStatusBadge.vue.d.ts +0 -14
  129. package/dist/runtime/app/components/FlowRunTimeline.d.vue.ts +0 -12
  130. package/dist/runtime/app/components/FlowRunTimeline.vue +0 -127
  131. package/dist/runtime/app/components/FlowRunTimeline.vue.d.ts +0 -12
  132. package/dist/runtime/app/components/FlowScheduleDialog.d.vue.ts +0 -16
  133. package/dist/runtime/app/components/FlowScheduleDialog.vue +0 -226
  134. package/dist/runtime/app/components/FlowScheduleDialog.vue.d.ts +0 -16
  135. package/dist/runtime/app/components/FlowSchedulesList.d.vue.ts +0 -12
  136. package/dist/runtime/app/components/FlowSchedulesList.vue +0 -99
  137. package/dist/runtime/app/components/FlowSchedulesList.vue.d.ts +0 -12
  138. package/dist/runtime/app/components/JobScheduling.d.vue.ts +0 -6
  139. package/dist/runtime/app/components/JobScheduling.vue +0 -203
  140. package/dist/runtime/app/components/JobScheduling.vue.d.ts +0 -6
  141. package/dist/runtime/app/components/ListItem.d.vue.ts +0 -23
  142. package/dist/runtime/app/components/ListItem.vue +0 -70
  143. package/dist/runtime/app/components/ListItem.vue.d.ts +0 -23
  144. package/dist/runtime/app/components/QueueConfigDetails.d.vue.ts +0 -45
  145. package/dist/runtime/app/components/QueueConfigDetails.vue +0 -412
  146. package/dist/runtime/app/components/QueueConfigDetails.vue.d.ts +0 -45
  147. package/dist/runtime/app/components/StatCounter.d.vue.ts +0 -9
  148. package/dist/runtime/app/components/StatCounter.vue +0 -25
  149. package/dist/runtime/app/components/StatCounter.vue.d.ts +0 -9
  150. package/dist/runtime/app/components/TimelineList.d.vue.ts +0 -7
  151. package/dist/runtime/app/components/TimelineList.vue +0 -210
  152. package/dist/runtime/app/components/TimelineList.vue.d.ts +0 -7
  153. package/dist/runtime/app/components/nhealth/component-router.d.vue.ts +0 -46
  154. package/dist/runtime/app/components/nhealth/component-router.vue +0 -26
  155. package/dist/runtime/app/components/nhealth/component-router.vue.d.ts +0 -46
  156. package/dist/runtime/app/components/nhealth/component-shell.d.vue.ts +0 -24
  157. package/dist/runtime/app/components/nhealth/component-shell.vue +0 -89
  158. package/dist/runtime/app/components/nhealth/component-shell.vue.d.ts +0 -24
  159. package/dist/runtime/app/composables/useAnalyzedFlows.d.ts +0 -14
  160. package/dist/runtime/app/composables/useAnalyzedFlows.js +0 -8
  161. package/dist/runtime/app/composables/useComponentRouter.d.ts +0 -38
  162. package/dist/runtime/app/composables/useComponentRouter.js +0 -240
  163. package/dist/runtime/app/composables/useFlowRunTimeline.d.ts +0 -80
  164. package/dist/runtime/app/composables/useFlowRunTimeline.js +0 -68
  165. package/dist/runtime/app/composables/useFlowRuns.d.ts +0 -18
  166. package/dist/runtime/app/composables/useFlowRuns.js +0 -32
  167. package/dist/runtime/app/composables/useFlowRunsInfinite.d.ts +0 -24
  168. package/dist/runtime/app/composables/useFlowRunsInfinite.js +0 -123
  169. package/dist/runtime/app/composables/useFlowRunsPolling.d.ts +0 -9
  170. package/dist/runtime/app/composables/useFlowRunsPolling.js +0 -33
  171. package/dist/runtime/app/composables/useFlowState.d.ts +0 -125
  172. package/dist/runtime/app/composables/useFlowState.js +0 -211
  173. package/dist/runtime/app/composables/useFlowWebSocket.d.ts +0 -27
  174. package/dist/runtime/app/composables/useFlowWebSocket.js +0 -205
  175. package/dist/runtime/app/composables/useFlowsNavigation.d.ts +0 -10
  176. package/dist/runtime/app/composables/useFlowsNavigation.js +0 -58
  177. package/dist/runtime/app/composables/useQueueJobs.d.ts +0 -26
  178. package/dist/runtime/app/composables/useQueueJobs.js +0 -20
  179. package/dist/runtime/app/composables/useQueueUpdates.d.ts +0 -26
  180. package/dist/runtime/app/composables/useQueueUpdates.js +0 -122
  181. package/dist/runtime/app/composables/useQueues.d.ts +0 -45
  182. package/dist/runtime/app/composables/useQueues.js +0 -26
  183. package/dist/runtime/app/composables/useQueuesLive.d.ts +0 -19
  184. package/dist/runtime/app/composables/useQueuesLive.js +0 -143
  185. package/dist/runtime/app/pages/flows/index.d.vue.ts +0 -3
  186. package/dist/runtime/app/pages/flows/index.vue +0 -645
  187. package/dist/runtime/app/pages/flows/index.vue.d.ts +0 -3
  188. package/dist/runtime/app/pages/index.d.vue.ts +0 -3
  189. package/dist/runtime/app/pages/index.vue +0 -34
  190. package/dist/runtime/app/pages/index.vue.d.ts +0 -3
  191. package/dist/runtime/app/pages/queues/index.d.vue.ts +0 -3
  192. package/dist/runtime/app/pages/queues/index.vue +0 -229
  193. package/dist/runtime/app/pages/queues/index.vue.d.ts +0 -3
  194. package/dist/runtime/app/pages/queues/job.d.vue.ts +0 -3
  195. package/dist/runtime/app/pages/queues/job.vue +0 -262
  196. package/dist/runtime/app/pages/queues/job.vue.d.ts +0 -3
  197. package/dist/runtime/app/pages/queues/jobs.d.vue.ts +0 -3
  198. package/dist/runtime/app/pages/queues/jobs.vue +0 -291
  199. package/dist/runtime/app/pages/queues/jobs.vue.d.ts +0 -3
  200. package/dist/runtime/app/plugins/vueflow.client.d.ts +0 -2
  201. package/dist/runtime/app/plugins/vueflow.client.js +0 -11
  202. package/dist/runtime/constants.d.ts +0 -11
  203. package/dist/runtime/constants.js +0 -11
  204. package/dist/runtime/schema.d.ts +0 -37
  205. package/dist/runtime/schema.js +0 -20
  206. package/dist/runtime/server/api/_flows/[name]/clear-history.delete.d.ts +0 -10
  207. package/dist/runtime/server/api/_flows/[name]/clear-history.delete.js +0 -44
  208. package/dist/runtime/server/api/_flows/[name]/runs.get.d.ts +0 -7
  209. package/dist/runtime/server/api/_flows/[name]/runs.get.js +0 -53
  210. package/dist/runtime/server/api/_flows/[name]/schedule.post.js +0 -57
  211. package/dist/runtime/server/api/_flows/[name]/schedules/[id].delete.d.ts +0 -2
  212. package/dist/runtime/server/api/_flows/[name]/schedules/[id].delete.js +0 -42
  213. package/dist/runtime/server/api/_flows/[name]/schedules.get.d.ts +0 -2
  214. package/dist/runtime/server/api/_flows/[name]/schedules.get.js +0 -48
  215. package/dist/runtime/server/api/_flows/[name]/start.post.d.ts +0 -2
  216. package/dist/runtime/server/api/_flows/[name]/start.post.js +0 -9
  217. package/dist/runtime/server/api/_flows/index.get.d.ts +0 -6
  218. package/dist/runtime/server/api/_flows/index.get.js +0 -5
  219. package/dist/runtime/server/api/_flows/ws.d.ts +0 -60
  220. package/dist/runtime/server/api/_flows/ws.js +0 -188
  221. package/dist/runtime/server/api/_queues/[name]/job/[id].get.d.ts +0 -2
  222. package/dist/runtime/server/api/_queues/[name]/job/[id].get.js +0 -9
  223. package/dist/runtime/server/api/_queues/[name]/job/index.get.d.ts +0 -2
  224. package/dist/runtime/server/api/_queues/[name]/job/index.get.js +0 -18
  225. package/dist/runtime/server/api/_queues/index.get.d.ts +0 -2
  226. package/dist/runtime/server/api/_queues/index.get.js +0 -63
  227. package/dist/runtime/server/api/_queues/ws.d.ts +0 -48
  228. package/dist/runtime/server/api/_queues/ws.js +0 -205
  229. package/dist/runtime/server/plugins/00.event-store.d.ts +0 -13
  230. package/dist/runtime/server/plugins/00.event-store.js +0 -16
  231. package/dist/runtime/server/plugins/flow-management.d.ts +0 -13
  232. package/dist/runtime/server/plugins/flow-management.js +0 -65
  233. package/dist/runtime/server/plugins/queue-management.d.ts +0 -2
  234. package/dist/runtime/server/plugins/queue-management.js +0 -27
  235. package/dist/runtime/server/plugins/state-cleanup.d.ts +0 -11
  236. package/dist/runtime/server/plugins/state-cleanup.js +0 -93
  237. package/dist/runtime/server/plugins/worker-management.d.ts +0 -2
  238. package/dist/runtime/server/plugins/worker-management.js +0 -33
  239. package/dist/runtime/server/tsconfig.json +0 -3
  240. package/dist/runtime/server-utils/events/adapters/fileAdapter.d.ts +0 -2
  241. package/dist/runtime/server-utils/events/adapters/fileAdapter.js +0 -382
  242. package/dist/runtime/server-utils/events/adapters/memoryAdapter.d.ts +0 -2
  243. package/dist/runtime/server-utils/events/adapters/memoryAdapter.js +0 -171
  244. package/dist/runtime/server-utils/events/adapters/redis/redisAdapter.d.ts +0 -2
  245. package/dist/runtime/server-utils/events/adapters/redis/redisAdapter.js +0 -348
  246. package/dist/runtime/server-utils/events/adapters/redis/redisPubSubGateway.d.ts +0 -30
  247. package/dist/runtime/server-utils/events/adapters/redis/redisPubSubGateway.js +0 -82
  248. package/dist/runtime/server-utils/events/eventStoreFactory.d.ts +0 -19
  249. package/dist/runtime/server-utils/events/eventStoreFactory.js +0 -44
  250. package/dist/runtime/server-utils/events/streamNames.d.ts +0 -17
  251. package/dist/runtime/server-utils/events/streamNames.js +0 -17
  252. package/dist/runtime/server-utils/events/types.d.ts +0 -63
  253. package/dist/runtime/server-utils/events/wiring/flowWiring.js +0 -409
  254. package/dist/runtime/server-utils/events/wiring/registry.d.ts +0 -10
  255. package/dist/runtime/server-utils/events/wiring/registry.js +0 -24
  256. package/dist/runtime/server-utils/queue/adapters/bullmq.d.ts +0 -18
  257. package/dist/runtime/server-utils/queue/adapters/bullmq.js +0 -164
  258. package/dist/runtime/server-utils/queue/queueFactory.d.ts +0 -3
  259. package/dist/runtime/server-utils/queue/queueFactory.js +0 -10
  260. package/dist/runtime/server-utils/queue/types.d.ts +0 -47
  261. package/dist/runtime/server-utils/state/adapters/redis.d.ts +0 -2
  262. package/dist/runtime/server-utils/state/adapters/redis.js +0 -42
  263. package/dist/runtime/server-utils/state/stateFactory.d.ts +0 -3
  264. package/dist/runtime/server-utils/state/stateFactory.js +0 -17
  265. package/dist/runtime/server-utils/state/types.d.ts +0 -23
  266. package/dist/runtime/server-utils/utils/defineQueueConfig.d.ts +0 -154
  267. package/dist/runtime/server-utils/utils/defineQueueConfig.js +0 -2
  268. package/dist/runtime/server-utils/utils/defineQueueWorker.d.ts +0 -10
  269. package/dist/runtime/server-utils/utils/defineQueueWorker.js +0 -17
  270. package/dist/runtime/server-utils/utils/useEventStore.d.ts +0 -20
  271. package/dist/runtime/server-utils/utils/useEventStore.js +0 -119
  272. package/dist/runtime/server-utils/utils/useFlowEngine.d.ts +0 -9
  273. package/dist/runtime/server-utils/utils/useFlowEngine.js +0 -44
  274. package/dist/runtime/server-utils/utils/useLogs.d.ts +0 -41
  275. package/dist/runtime/server-utils/utils/useLogs.js +0 -74
  276. package/dist/runtime/server-utils/utils/useQueue.d.ts +0 -31
  277. package/dist/runtime/server-utils/utils/useQueue.js +0 -24
  278. package/dist/runtime/server-utils/worker/adapter.d.ts +0 -4
  279. package/dist/runtime/server-utils/worker/adapter.js +0 -66
  280. package/dist/runtime/server-utils/worker/runner/node.d.ts +0 -27
  281. package/dist/runtime/server-utils/worker/runner/node.js +0 -196
  282. package/dist/runtime/types.d.ts +0 -132
  283. /package/dist/runtime/{server-utils/events/types.js → adapters/interfaces/queue.js} +0 -0
  284. /package/dist/runtime/{server-utils/queue/types.js → adapters/interfaces/store.js} +0 -0
  285. /package/dist/runtime/{server-utils/state/types.js → adapters/interfaces/stream.js} +0 -0
  286. /package/dist/runtime/{server-utils/events → events}/eventBus.js +0 -0
  287. /package/dist/runtime/{server/plugins/00.ws-lifecycle.d.ts → nitro/plugins/01.ws-lifecycle.d.ts} +0 -0
  288. /package/dist/runtime/{server/plugins/00.ws-lifecycle.js → nitro/plugins/01.ws-lifecycle.js} +0 -0
  289. /package/dist/runtime/{server/api/_flows/[name]/schedule.post.d.ts → nitro/plugins/02.workers.d.ts} +0 -0
  290. /package/dist/runtime/{server-utils → nitro}/utils/useNventLogger.d.ts +0 -0
  291. /package/dist/runtime/{server-utils → nitro}/utils/wsPeerManager.d.ts +0 -0
  292. /package/dist/runtime/{server-utils → nitro}/utils/wsPeerManager.js +0 -0
  293. /package/dist/runtime/{python → worker/python}/get_config.py +0 -0
@@ -0,0 +1,19 @@
1
+ export interface Wiring {
2
+ start(): void | Promise<void>;
3
+ stop(): void | Promise<void>;
4
+ }
5
+ export interface WiringRegistryOptions {
6
+ /**
7
+ * Stream wiring options
8
+ */
9
+ streamWiring?: {
10
+ enabled?: boolean;
11
+ };
12
+ /**
13
+ * State wiring options
14
+ */
15
+ stateWiring?: {
16
+ strategy?: 'never' | 'on-complete' | 'immediate' | 'ttl';
17
+ };
18
+ }
19
+ export declare function createWiringRegistry(opts?: WiringRegistryOptions): Wiring;
@@ -0,0 +1,35 @@
1
+ import { createFlowWiring } from "./flowWiring.js";
2
+ import { createStreamWiring } from "./streamWiring.js";
3
+ import { createStateWiring } from "./stateWiring.js";
4
+ import { createTriggerWiring } from "./triggerWiring.js";
5
+ export function createWiringRegistry(opts) {
6
+ const wirings = [
7
+ // 1. Flow orchestration (persistence, completion tracking, step triggering)
8
+ createFlowWiring(),
9
+ // 2. Stream wiring (publish persisted events to UI clients)
10
+ createStreamWiring(opts?.streamWiring || {
11
+ enabled: true
12
+ }),
13
+ // 3. State wiring (automatic state cleanup)
14
+ createStateWiring(opts?.stateWiring),
15
+ // 4. Trigger wiring (v0.5: trigger.fired, await.registered, await.resolved)
16
+ createTriggerWiring()
17
+ ];
18
+ let started = false;
19
+ return {
20
+ async start() {
21
+ if (started) return;
22
+ started = true;
23
+ for (const w of wirings) await w.start();
24
+ },
25
+ async stop() {
26
+ for (const w of wirings) {
27
+ try {
28
+ await w.stop();
29
+ } catch {
30
+ }
31
+ }
32
+ started = false;
33
+ }
34
+ };
35
+ }
@@ -0,0 +1,37 @@
1
+ /**
2
+ * State Wiring - Automatic cleanup of flow state
3
+ *
4
+ * Subscribes to the local event bus (single source of truth) and handles
5
+ * automatic cleanup of flow state based on configuration strategy.
6
+ *
7
+ * Cleanup strategies:
8
+ * - 'never': State persists indefinitely (default)
9
+ * - 'on-complete': Cleanup when flow completes (recommended)
10
+ * - 'immediate': Cleanup after each step (not recommended)
11
+ * - 'ttl': State expires automatically via TTL (handled by storage provider)
12
+ *
13
+ * Benefits:
14
+ * - Single source of truth (event bus)
15
+ * - Configurable cleanup strategies
16
+ * - Clear separation of concerns
17
+ */
18
+ export interface StateWiringOptions {
19
+ /**
20
+ * Cleanup strategy
21
+ * - 'never': State persists indefinitely
22
+ * - 'on-complete': Cleanup when flow completes (recommended)
23
+ * - 'immediate': Cleanup after each step
24
+ * - 'ttl': State expires automatically via TTL
25
+ * Default: 'never'
26
+ */
27
+ strategy?: 'never' | 'on-complete' | 'immediate' | 'ttl';
28
+ }
29
+ /**
30
+ * Create state wiring
31
+ *
32
+ * Subscribes to event bus and handles state cleanup based on configuration
33
+ */
34
+ export declare function createStateWiring(opts?: StateWiringOptions): {
35
+ start: () => void;
36
+ stop: () => void;
37
+ };
@@ -0,0 +1,92 @@
1
+ import { getEventBus } from "../eventBus.js";
2
+ import { useNventLogger, useStateAdapter, useRuntimeConfig } from "#imports";
3
+ export function createStateWiring(opts) {
4
+ let strategy = opts?.strategy;
5
+ if (!strategy) {
6
+ try {
7
+ const rc = useRuntimeConfig();
8
+ strategy = rc?.nvent?.store?.state?.cleanup?.strategy || "never";
9
+ } catch {
10
+ strategy = "never";
11
+ }
12
+ }
13
+ const bus = getEventBus();
14
+ const unsubs = [];
15
+ let wired = false;
16
+ function start() {
17
+ if (wired) return;
18
+ wired = true;
19
+ if (strategy === "never" || strategy === "ttl") {
20
+ return;
21
+ }
22
+ const logger = useNventLogger("state-wiring");
23
+ const stateAdapter = useStateAdapter();
24
+ logger.info("Starting state wiring", { strategy });
25
+ if (strategy === "on-complete") {
26
+ const cleanupFlowState = async (event, reason) => {
27
+ const flowId = event.runId;
28
+ if (!flowId) return;
29
+ try {
30
+ const pattern = `flow:${flowId}:*`;
31
+ const deletedCount = await stateAdapter.clear(pattern);
32
+ if (deletedCount > 0) {
33
+ logger.info(`Cleaned up state after ${reason}`, {
34
+ flowId,
35
+ deletedCount
36
+ });
37
+ }
38
+ } catch (error) {
39
+ logger.error(`Error cleaning up state after ${reason}`, {
40
+ flowId,
41
+ error: error?.message
42
+ });
43
+ }
44
+ };
45
+ const handleFlowCompleted = (event) => cleanupFlowState(event, "flow completion");
46
+ const handleFlowFailed = (event) => cleanupFlowState(event, "flow failure");
47
+ const handleFlowCanceled = (event) => cleanupFlowState(event, "flow cancellation");
48
+ const handleFlowStalled = (event) => cleanupFlowState(event, "flow stall");
49
+ unsubs.push(bus.onType("flow.completed", handleFlowCompleted));
50
+ unsubs.push(bus.onType("flow.failed", handleFlowFailed));
51
+ unsubs.push(bus.onType("flow.cancel", handleFlowCanceled));
52
+ unsubs.push(bus.onType("flow.stalled", handleFlowStalled));
53
+ logger.debug("State cleanup enabled: on-complete (includes stalled and canceled)");
54
+ } else if (strategy === "immediate") {
55
+ const handleStepCompleted = async (event) => {
56
+ const flowId = event.runId;
57
+ if (!flowId) return;
58
+ try {
59
+ const pattern = `flow:${flowId}:*`;
60
+ const deletedCount = await stateAdapter.clear(pattern);
61
+ if (deletedCount > 0) {
62
+ logger.info("Cleaned up state after step completion", {
63
+ flowId,
64
+ stepName: event.stepName,
65
+ deletedCount
66
+ });
67
+ }
68
+ } catch (error) {
69
+ logger.error("Error cleaning up state after step", {
70
+ flowId,
71
+ error: error?.message
72
+ });
73
+ }
74
+ };
75
+ unsubs.push(bus.onType("step.completed", handleStepCompleted));
76
+ logger.debug("State cleanup enabled: immediate");
77
+ }
78
+ logger.info("State wiring started");
79
+ }
80
+ function stop() {
81
+ const logger = useNventLogger("state-wiring");
82
+ for (const unsub of unsubs.splice(0)) {
83
+ try {
84
+ unsub();
85
+ } catch {
86
+ }
87
+ }
88
+ wired = false;
89
+ logger.debug("State wiring stopped");
90
+ }
91
+ return { start, stop };
92
+ }
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Stream Wiring - Bridge event bus to StreamAdapter for real-time UI updates
3
+ *
4
+ * Architecture:
5
+ * 1. Event Bus - Single source of truth for all events (in-memory)
6
+ * 2. StreamWiring - Bridges persisted events to stream topics (this file)
7
+ * 3. StreamAdapter - Pub/sub for real-time distribution (Redis/Memory)
8
+ * 4. WebSocket handlers - Subscribe to topics and send to clients
9
+ *
10
+ * Flow:
11
+ * Event Bus → StreamWiring → StreamAdapter → WebSocket → UI
12
+ *
13
+ * Stream Topics (defined in useStreamTopics):
14
+ * - stream:flow:events:{runId} - Flow events for specific run
15
+ * - stream:flow:stats - Flow statistics updates
16
+ * - stream:trigger:events:{triggerName} - Trigger events
17
+ * - stream:trigger:stats - Trigger statistics updates
18
+ *
19
+ * Only publishes persisted events (with id/ts) to avoid duplicates
20
+ */
21
+ export interface StreamWiringOptions {
22
+ /**
23
+ * Enable client messages (WebSocket/SSE)
24
+ * Default: true
25
+ */
26
+ enabled?: boolean;
27
+ }
28
+ /**
29
+ * Create stream wiring
30
+ *
31
+ * Subscribes to event bus and publishes persisted events to UI clients
32
+ */
33
+ export declare function createStreamWiring(opts?: StreamWiringOptions): {
34
+ start: () => void;
35
+ stop: () => void;
36
+ };
@@ -0,0 +1,156 @@
1
+ import { getEventBus } from "../eventBus.js";
2
+ import { useNventLogger, useStreamAdapter, useStreamTopics } from "#imports";
3
+ export function createStreamWiring(opts = {}) {
4
+ const {
5
+ enabled = true
6
+ } = opts;
7
+ const bus = getEventBus();
8
+ const unsubs = [];
9
+ let wired = false;
10
+ function start() {
11
+ if (wired) return;
12
+ wired = true;
13
+ if (!enabled) return;
14
+ const logger = useNventLogger("stream-wiring");
15
+ const stream = useStreamAdapter();
16
+ const { StreamTopics } = useStreamTopics();
17
+ logger.info("Starting stream wiring for UI clients");
18
+ const handleFlowEvent = async (e) => {
19
+ if (!e.id || !e.ts) return;
20
+ const runId = e.runId;
21
+ if (!runId) return;
22
+ try {
23
+ const topic = StreamTopics.flowEvents(runId);
24
+ await stream.publish(topic, {
25
+ type: "flow.event",
26
+ data: {
27
+ event: {
28
+ id: e.id,
29
+ ts: e.ts,
30
+ type: e.type,
31
+ runId: e.runId,
32
+ flowName: e.flowName,
33
+ // Include step-specific fields for UI
34
+ stepName: e.stepName,
35
+ stepId: e.stepId,
36
+ attempt: e.attempt,
37
+ data: e.data
38
+ }
39
+ },
40
+ timestamp: Date.now()
41
+ });
42
+ logger.debug("Published flow event to stream", { type: e.type, runId });
43
+ } catch (err) {
44
+ logger.error("Failed to publish flow event to stream", {
45
+ error: err?.message
46
+ });
47
+ }
48
+ };
49
+ const handleTriggerEvent = async (e) => {
50
+ if (!e.id || !e.ts) return;
51
+ const triggerName = e.triggerName;
52
+ if (!triggerName) return;
53
+ try {
54
+ const topic = StreamTopics.triggerEvents(triggerName);
55
+ await stream.publish(topic, {
56
+ type: "trigger.event",
57
+ data: {
58
+ event: {
59
+ id: e.id,
60
+ ts: e.ts,
61
+ type: e.type,
62
+ triggerName,
63
+ data: e.data
64
+ }
65
+ },
66
+ timestamp: Date.now()
67
+ });
68
+ logger.debug("Published trigger event to stream", {
69
+ triggerName,
70
+ type: e.type,
71
+ id: e.id
72
+ });
73
+ } catch (err) {
74
+ logger.error("Failed to publish trigger event to stream", {
75
+ triggerName,
76
+ type: e.type,
77
+ error: err?.message
78
+ });
79
+ }
80
+ };
81
+ const flowEventTypes = [
82
+ "flow.start",
83
+ "flow.completed",
84
+ "flow.failed",
85
+ "flow.cancel",
86
+ "step.started",
87
+ "step.completed",
88
+ "step.failed",
89
+ "step.retry",
90
+ "await.registered",
91
+ "await.resolved",
92
+ "await.timeout",
93
+ "log",
94
+ "emit"
95
+ ];
96
+ const triggerEventTypes = [
97
+ "trigger.registered",
98
+ "trigger.updated",
99
+ "trigger.deleted",
100
+ "trigger.fired",
101
+ "subscription.added",
102
+ "subscription.removed"
103
+ ];
104
+ const handleFlowStatsUpdate = async (e) => {
105
+ try {
106
+ const topic = StreamTopics.flowStats();
107
+ await stream.publish(topic, {
108
+ id: e.flowName,
109
+ metadata: e.metadata
110
+ });
111
+ logger.debug("Published flow stats to stream", { flowName: e.flowName });
112
+ } catch (err) {
113
+ logger.error("Failed to publish flow stats to stream", {
114
+ flowName: e.flowName,
115
+ error: err?.message
116
+ });
117
+ }
118
+ };
119
+ const handleTriggerStatsUpdate = async (e) => {
120
+ try {
121
+ const topic = StreamTopics.triggerStats();
122
+ await stream.publish(topic, {
123
+ id: e.triggerName,
124
+ metadata: e.metadata
125
+ });
126
+ logger.debug("Published trigger stats to stream", { triggerName: e.triggerName });
127
+ } catch (err) {
128
+ logger.error("Failed to publish trigger stats to stream", {
129
+ triggerName: e.triggerName,
130
+ error: err?.message
131
+ });
132
+ }
133
+ };
134
+ for (const type of flowEventTypes) {
135
+ unsubs.push(bus.onType(type, handleFlowEvent));
136
+ }
137
+ for (const type of triggerEventTypes) {
138
+ unsubs.push(bus.onType(type, handleTriggerEvent));
139
+ }
140
+ unsubs.push(bus.onType("flow.stats.updated", handleFlowStatsUpdate));
141
+ unsubs.push(bus.onType("trigger.stats.updated", handleTriggerStatsUpdate));
142
+ logger.info("Stream wiring started - listening for persisted flow and trigger events");
143
+ }
144
+ function stop() {
145
+ const logger = useNventLogger("stream-wiring");
146
+ for (const unsub of unsubs.splice(0)) {
147
+ try {
148
+ unsub();
149
+ } catch {
150
+ }
151
+ }
152
+ wired = false;
153
+ logger.debug("Stream wiring stopped");
154
+ }
155
+ return { start, stop };
156
+ }
@@ -0,0 +1,21 @@
1
+ import type { TriggerFiredEvent } from '../types.js';
2
+ /**
3
+ * Create trigger event wiring
4
+ * Listens to trigger.fired events and starts subscribed flows
5
+ * Handles await.registered and await.resolved events
6
+ */
7
+ export declare function createTriggerWiring(): {
8
+ start: () => Promise<void>;
9
+ stop: () => void;
10
+ };
11
+ /**
12
+ * Handle trigger.fired event
13
+ * Starts all subscribed flows (auto mode) or queues them (manual mode)
14
+ * Returns list of flows that were started for stream metadata
15
+ */
16
+ export declare function handleTriggerFired(event: TriggerFiredEvent): Promise<string[]>;
17
+ /**
18
+ * Start a flow from a trigger event
19
+ * Enqueues the entry step and publishes flow.start event
20
+ */
21
+ export declare function startFlowFromTrigger(flowName: string, triggerName: string, triggerData: any): Promise<void>;