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,397 @@
1
+ /**
2
+ * Redis connection configuration
3
+ */
4
+ export interface RedisConfig {
5
+ host?: string;
6
+ port?: number;
7
+ username?: string;
8
+ password?: string;
9
+ db?: number;
10
+ url?: string;
11
+ }
12
+ /**
13
+ * PostgreSQL connection configuration
14
+ */
15
+ export interface PostgresConfig {
16
+ connectionString?: string;
17
+ host?: string;
18
+ port?: number;
19
+ database?: string;
20
+ user?: string;
21
+ password?: string;
22
+ ssl?: boolean | object;
23
+ }
24
+ /**
25
+ * RabbitMQ connection configuration
26
+ */
27
+ export interface RabbitMQConfig {
28
+ url?: string;
29
+ host?: string;
30
+ port?: number;
31
+ username?: string;
32
+ password?: string;
33
+ vhost?: string;
34
+ }
35
+ /**
36
+ * Kafka connection configuration
37
+ */
38
+ export interface KafkaConfig {
39
+ brokers?: string[];
40
+ clientId?: string;
41
+ groupId?: string;
42
+ }
43
+ /**
44
+ * File storage configuration
45
+ */
46
+ export interface FileConfig {
47
+ /**
48
+ * Base directory for file storage
49
+ * @default '.data'
50
+ */
51
+ dataDir?: string;
52
+ }
53
+ /**
54
+ * Shared connection configurations (v0.4.1)
55
+ * Provides fallback connections for all adapters
56
+ */
57
+ export interface ConnectionsConfig {
58
+ /**
59
+ * Shared Redis connection - used by adapters that specify 'redis' but don't provide connection details
60
+ */
61
+ redis?: RedisConfig;
62
+ /**
63
+ * Shared Postgres connection - used by adapters that specify 'postgres' but don't provide connection details
64
+ */
65
+ postgres?: PostgresConfig;
66
+ /**
67
+ * Shared RabbitMQ connection - used by stream adapter when 'rabbitmq' is specified
68
+ */
69
+ rabbitmq?: RabbitMQConfig;
70
+ /**
71
+ * Shared Kafka connection - used by stream adapter when 'kafka' is specified
72
+ */
73
+ kafka?: KafkaConfig;
74
+ /**
75
+ * Shared file storage configuration - used by file adapters
76
+ */
77
+ file?: FileConfig;
78
+ }
79
+ /**
80
+ * Worker configuration
81
+ */
82
+ export interface WorkerConfig {
83
+ /**
84
+ * Number of concurrent jobs to process
85
+ * @default 2
86
+ */
87
+ concurrency?: number;
88
+ /**
89
+ * Lock duration for jobs in milliseconds
90
+ */
91
+ lockDurationMs?: number;
92
+ /**
93
+ * Maximum number of times a job can be stalled before failing
94
+ */
95
+ maxStalledCount?: number;
96
+ /**
97
+ * Delay before draining the queue on shutdown
98
+ */
99
+ drainDelayMs?: number;
100
+ /**
101
+ * Automatically start workers
102
+ * @default true
103
+ */
104
+ autorun?: boolean;
105
+ /**
106
+ * Polling interval for file adapter (milliseconds)
107
+ * @default 1000
108
+ */
109
+ pollingIntervalMs?: number;
110
+ }
111
+ /**
112
+ * Queue adapter configuration (v0.4.1)
113
+ */
114
+ export interface QueueConfig {
115
+ /**
116
+ * Queue backend adapter
117
+ * @default 'file'
118
+ */
119
+ adapter?: 'memory' | 'file' | 'redis' | 'postgres';
120
+ /**
121
+ * Redis connection (overrides connections.redis if specified)
122
+ */
123
+ redis?: RedisConfig;
124
+ /**
125
+ * Postgres connection (overrides connections.postgres if specified)
126
+ */
127
+ postgres?: PostgresConfig;
128
+ /**
129
+ * File storage configuration (overrides connections.file if specified)
130
+ */
131
+ file?: FileConfig;
132
+ /**
133
+ * Queue-specific options (BullMQ/PGBoss configuration)
134
+ */
135
+ prefix?: string;
136
+ /**
137
+ * PostgreSQL schema name for pg-boss tables
138
+ * Only applies when adapter is 'postgres'
139
+ * @default 'pgboss'
140
+ */
141
+ schema?: string;
142
+ defaultJobOptions?: {
143
+ attempts?: number;
144
+ backoff?: number | {
145
+ type: 'fixed' | 'exponential';
146
+ delay: number;
147
+ };
148
+ delay?: number;
149
+ priority?: number;
150
+ timeout?: number;
151
+ lifo?: boolean;
152
+ removeOnComplete?: boolean | number;
153
+ removeOnFail?: boolean | number;
154
+ };
155
+ limiter?: {
156
+ max?: number;
157
+ duration?: number;
158
+ groupKey?: string;
159
+ };
160
+ /**
161
+ * Worker configuration
162
+ */
163
+ worker?: WorkerConfig;
164
+ }
165
+ /**
166
+ * Stream adapter configuration (v0.4.1)
167
+ * Cross-instance pub/sub messaging
168
+ */
169
+ export interface StreamConfig {
170
+ /**
171
+ * Stream adapter
172
+ * @default 'memory'
173
+ */
174
+ adapter?: 'memory' | 'redis' | 'rabbitmq' | 'kafka';
175
+ /**
176
+ * Redis connection (overrides connections.redis if specified)
177
+ */
178
+ redis?: RedisConfig;
179
+ /**
180
+ * Postgres connection (overrides connections.postgres if specified)
181
+ */
182
+ postgres?: PostgresConfig;
183
+ /**
184
+ * RabbitMQ connection (overrides connections.rabbitmq if specified)
185
+ */
186
+ rabbitmq?: RabbitMQConfig;
187
+ /**
188
+ * Kafka connection (overrides connections.kafka if specified)
189
+ */
190
+ kafka?: KafkaConfig;
191
+ /**
192
+ * Stream-specific options
193
+ */
194
+ prefix?: string;
195
+ retryAttempts?: number;
196
+ retryDelay?: number;
197
+ }
198
+ /**
199
+ * Webhooks configuration
200
+ */
201
+ export interface WebhooksConfig {
202
+ /**
203
+ * Base URL for webhook endpoints
204
+ * Auto-detected from Nitro context in development
205
+ * Set explicitly for production or to override auto-detection
206
+ * @default Auto-detected from NUXT_PUBLIC_SITE_URL, NITRO_URL, or dev server (http://localhost:3000 fallback)
207
+ */
208
+ baseUrl?: string;
209
+ }
210
+ /**
211
+ * Flow configuration
212
+ */
213
+ export interface FlowConfig {
214
+ /**
215
+ * Stall detection configuration
216
+ * Detects and marks flows that have been running without activity for too long
217
+ */
218
+ stallDetection?: {
219
+ /**
220
+ * Enable stall detection
221
+ * @default true
222
+ */
223
+ enabled?: boolean;
224
+ /**
225
+ * Time in milliseconds after which a running flow without activity is considered stalled
226
+ * @default 1800000 (30 minutes)
227
+ */
228
+ stallTimeout?: number;
229
+ /**
230
+ * Interval in milliseconds for periodic stall checks
231
+ * @default 900000 (15 minutes)
232
+ */
233
+ checkInterval?: number;
234
+ /**
235
+ * Enable periodic background checks
236
+ * Set to false to use only lazy detection (when flows are queried)
237
+ * @default true
238
+ */
239
+ enablePeriodicCheck?: boolean;
240
+ };
241
+ }
242
+ /**
243
+ * State management configuration
244
+ */
245
+ export interface StateManagementConfig {
246
+ /**
247
+ * Automatic scope/flow ID assignment for state operations
248
+ * - 'always': Always create a new flow ID (recommended for most cases)
249
+ * - 'flow': Only use flow ID if provided in context
250
+ * - 'never': Never scope state to flow IDs
251
+ * @default 'always'
252
+ */
253
+ autoScope?: 'always' | 'flow' | 'never';
254
+ /**
255
+ * State cleanup strategy
256
+ */
257
+ cleanup?: {
258
+ /**
259
+ * Cleanup strategy
260
+ * - 'never': State persists indefinitely
261
+ * - 'immediate': Cleanup after each step (not recommended)
262
+ * - 'on-complete': Cleanup when flow completes (recommended)
263
+ * - 'ttl': Automatic expiration via TTL
264
+ * @default 'never'
265
+ */
266
+ strategy?: 'never' | 'immediate' | 'on-complete' | 'ttl';
267
+ /**
268
+ * TTL in milliseconds for 'ttl' strategy
269
+ * @default 3600000 (1 hour)
270
+ */
271
+ ttlMs?: number;
272
+ };
273
+ }
274
+ /**
275
+ * Store adapter configuration (v0.4.1)
276
+ * Three-tier storage: events (NDJSON), documents (JSON), KV (JSON), indices (JSON)
277
+ * Replaces both state and eventStore configs from v0.4.0
278
+ */
279
+ export interface StoreConfig {
280
+ /**
281
+ * Store adapter
282
+ * @default 'file'
283
+ */
284
+ adapter?: 'memory' | 'file' | 'redis' | 'postgres';
285
+ /**
286
+ * Redis connection (overrides connections.redis if specified)
287
+ */
288
+ redis?: RedisConfig;
289
+ /**
290
+ * Postgres connection (overrides connections.postgres if specified)
291
+ */
292
+ postgres?: PostgresConfig;
293
+ /**
294
+ * File storage configuration (overrides connections.file if specified)
295
+ */
296
+ file?: FileConfig;
297
+ /**
298
+ * Key prefix/namespace for all store operations
299
+ * @default 'nq'
300
+ */
301
+ prefix?: string;
302
+ /**
303
+ * PostgreSQL schema name for store tables
304
+ * Only applies when adapter is 'postgres'
305
+ * @default 'public'
306
+ */
307
+ schema?: string;
308
+ /**
309
+ * State management configuration (KV store behavior)
310
+ */
311
+ state?: StateManagementConfig;
312
+ /**
313
+ * Event stream TTL in seconds
314
+ * @default 604800 (7 days)
315
+ */
316
+ eventTTL?: number;
317
+ /**
318
+ * Metadata document TTL in seconds
319
+ * @default 2592000 (30 days)
320
+ */
321
+ metadataTTL?: number;
322
+ /**
323
+ * KV store TTL in seconds
324
+ */
325
+ kvTTL?: number;
326
+ /**
327
+ * Index TTL in seconds
328
+ */
329
+ indexTTL?: number;
330
+ /**
331
+ * Enable compression for stored data
332
+ */
333
+ compression?: boolean;
334
+ }
335
+ /**
336
+ * Module options for nvent (v0.4.1+)
337
+ */
338
+ export interface ModuleOptions {
339
+ /**
340
+ * Directory to scan for function definitions
341
+ * @default 'server/functions'
342
+ */
343
+ dir?: string;
344
+ /**
345
+ * Enable dev UI
346
+ * @default true in development
347
+ */
348
+ ui?: boolean;
349
+ /**
350
+ * Debug configuration
351
+ */
352
+ debug?: Record<string, any>;
353
+ /**
354
+ * Queue adapter configuration (job execution)
355
+ */
356
+ queue?: QueueConfig;
357
+ /**
358
+ * Stream adapter configuration (pub/sub messaging)
359
+ * @since v0.4.1
360
+ */
361
+ stream?: StreamConfig;
362
+ /**
363
+ * Store adapter configuration (persistence)
364
+ * Three-tier storage: events, documents, KV, indices
365
+ * @since v0.4.1
366
+ */
367
+ store?: StoreConfig;
368
+ /**
369
+ * Flow-specific configuration
370
+ * @since v0.4.1
371
+ */
372
+ flow?: FlowConfig;
373
+ /**
374
+ * Webhooks configuration
375
+ * @since v0.5.0
376
+ */
377
+ webhooks?: WebhooksConfig;
378
+ /**
379
+ * Shared connection configurations
380
+ * Used as fallback if adapters don't specify their own connections
381
+ * @since v0.4.1
382
+ */
383
+ connections?: ConnectionsConfig;
384
+ }
385
+ /**
386
+ * Runtime config shape for nvent module (v0.4.1+)
387
+ */
388
+ export interface ModuleConfig {
389
+ debug?: Record<string, any>;
390
+ queue: Required<QueueConfig>;
391
+ stream: Required<StreamConfig>;
392
+ store: Required<StoreConfig>;
393
+ flow: Required<FlowConfig>;
394
+ webhooks: Required<WebhooksConfig>;
395
+ connections: Required<ConnectionsConfig>;
396
+ rootDir?: string;
397
+ }
File without changes
@@ -1,5 +1,5 @@
1
1
  import { EventEmitter } from 'node:events';
2
- import type { EventRecord } from '../types.js';
2
+ import type { EventRecord } from './types.js';
3
3
  type Handler = (e: EventRecord) => void;
4
4
  declare global {
5
5
  var __nq_bus_emitter: EventEmitter | undefined;
@@ -0,0 +1,145 @@
1
+ export interface PublishContext {
2
+ queue?: string;
3
+ jobId?: string;
4
+ /** Flow run ID for flow events */
5
+ flowId?: string;
6
+ /** Trigger ID for trigger events */
7
+ triggerId?: string;
8
+ }
9
+ export interface PublishPayload<T = any> {
10
+ type: string;
11
+ runId: string;
12
+ flowName: string;
13
+ stepName?: string;
14
+ stepId?: string;
15
+ attempt?: number;
16
+ data?: T;
17
+ }
18
+ export type EventType = 'flow.start' | 'flow.completed' | 'flow.failed' | 'flow.cancel' | 'step.started' | 'step.completed' | 'step.failed' | 'step.retry' | 'log' | 'emit' | 'state' | 'flow.stalled' | 'trigger.fired' | 'trigger.registered' | 'await.registered' | 'await.resolved' | 'await.timeout';
19
+ export interface BaseEvent {
20
+ id?: string;
21
+ ts?: string;
22
+ type: EventType;
23
+ runId: string;
24
+ flowName: string;
25
+ }
26
+ export interface StepEvent extends BaseEvent {
27
+ stepName: string;
28
+ stepId: string;
29
+ attempt: number;
30
+ }
31
+ export interface FlowStartEvent extends BaseEvent {
32
+ type: 'flow.start';
33
+ data?: {
34
+ input?: any;
35
+ };
36
+ }
37
+ export interface FlowCompletedEvent extends BaseEvent {
38
+ type: 'flow.completed';
39
+ data?: {
40
+ result?: any;
41
+ };
42
+ }
43
+ export interface FlowFailedEvent extends BaseEvent {
44
+ type: 'flow.failed';
45
+ data?: {
46
+ error?: string;
47
+ stack?: string;
48
+ };
49
+ }
50
+ export interface FlowCancelEvent extends BaseEvent {
51
+ type: 'flow.cancel';
52
+ data?: {
53
+ canceledAt?: string;
54
+ };
55
+ }
56
+ export interface FlowStalledEvent extends BaseEvent {
57
+ type: 'flow.stalled';
58
+ data?: {
59
+ lastActivityAt?: number;
60
+ stallTimeout?: number;
61
+ };
62
+ }
63
+ export interface StepStartedEvent extends StepEvent {
64
+ type: 'step.started';
65
+ data?: {
66
+ input?: any;
67
+ };
68
+ }
69
+ export interface StepCompletedEvent extends StepEvent {
70
+ type: 'step.completed';
71
+ data?: {
72
+ result?: any;
73
+ };
74
+ }
75
+ export interface StepFailedEvent extends StepEvent {
76
+ type: 'step.failed';
77
+ data?: {
78
+ error?: string;
79
+ stack?: string;
80
+ };
81
+ }
82
+ export interface StepRetryEvent extends StepEvent {
83
+ type: 'step.retry';
84
+ data?: {
85
+ stepName: string;
86
+ queue: string;
87
+ attempt: number;
88
+ maxAttempts: number;
89
+ nextAttempt: number;
90
+ };
91
+ }
92
+ export interface LogEvent extends StepEvent {
93
+ type: 'log';
94
+ data: {
95
+ level: 'debug' | 'info' | 'warn' | 'error';
96
+ message: string;
97
+ [key: string]: any;
98
+ };
99
+ }
100
+ export interface EmitEvent extends StepEvent {
101
+ type: 'emit';
102
+ data: {
103
+ topic: string;
104
+ payload: any;
105
+ };
106
+ }
107
+ export interface StateEvent extends StepEvent {
108
+ type: 'state';
109
+ data: {
110
+ operation: 'get' | 'set' | 'delete';
111
+ scope?: string;
112
+ key: string;
113
+ value?: any;
114
+ };
115
+ }
116
+ export interface TriggerFiredEvent extends BaseEvent {
117
+ type: 'trigger.fired';
118
+ triggerName: string;
119
+ data: any;
120
+ }
121
+ export interface TriggerRegisteredEvent {
122
+ type: 'trigger.registered';
123
+ triggerName: string;
124
+ triggerType: 'event' | 'webhook' | 'schedule' | 'manual';
125
+ scope: 'flow' | 'run';
126
+ }
127
+ export interface AwaitRegisteredEvent extends BaseEvent {
128
+ type: 'await.registered';
129
+ stepName: string;
130
+ awaitType: 'webhook' | 'event' | 'schedule' | 'time';
131
+ position: 'before' | 'after';
132
+ config: any;
133
+ }
134
+ export interface AwaitResolvedEvent extends BaseEvent {
135
+ type: 'await.resolved';
136
+ stepName: string;
137
+ triggerData: any;
138
+ position: 'before' | 'after';
139
+ }
140
+ export interface AwaitTimeoutEvent extends BaseEvent {
141
+ type: 'await.timeout';
142
+ stepName: string;
143
+ action: 'fail' | 'continue' | 'retry';
144
+ }
145
+ export type FlowEvent = FlowStartEvent | FlowCompletedEvent | FlowFailedEvent | FlowCancelEvent | FlowStalledEvent | StepStartedEvent | StepCompletedEvent | StepFailedEvent | StepRetryEvent | LogEvent | EmitEvent | StateEvent | TriggerFiredEvent | TriggerRegisteredEvent | AwaitRegisteredEvent | AwaitResolvedEvent | AwaitTimeoutEvent;
File without changes
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Schedule or update a schedule trigger in the scheduler
3
+ */
4
+ export declare function scheduleTrigger(triggerName: string, scheduleConfig: any, triggerStatus?: string): Promise<void>;
5
+ /**
6
+ * Unschedule a schedule trigger from the scheduler
7
+ */
8
+ export declare function unscheduleTrigger(triggerName: string): Promise<void>;
@@ -0,0 +1,69 @@
1
+ import { useNventLogger, useScheduler } from "#imports";
2
+ import { getEventBus } from "../eventBus.js";
3
+ export async function scheduleTrigger(triggerName, scheduleConfig, triggerStatus) {
4
+ const logger = useNventLogger("trigger-wiring");
5
+ const scheduler = useScheduler();
6
+ const eventBus = getEventBus();
7
+ try {
8
+ const jobId = `trigger:${triggerName}`;
9
+ const handler = async () => {
10
+ logger.debug("Schedule trigger fired", { trigger: triggerName });
11
+ await eventBus.publish({
12
+ type: "trigger.fired",
13
+ triggerName,
14
+ data: {
15
+ scheduledAt: Date.now(),
16
+ timezone: scheduleConfig.timezone || "UTC"
17
+ }
18
+ });
19
+ };
20
+ await scheduler.unschedule(jobId);
21
+ const jobConfig = {
22
+ id: jobId,
23
+ type: scheduleConfig.cron ? "cron" : "interval",
24
+ name: `Schedule Trigger: ${triggerName}`,
25
+ handler,
26
+ metadata: {
27
+ triggerName,
28
+ type: "schedule-trigger",
29
+ scheduleConfig
30
+ },
31
+ enabled: triggerStatus === "active"
32
+ };
33
+ if (scheduleConfig.cron) {
34
+ jobConfig.cron = scheduleConfig.cron;
35
+ jobConfig.timezone = scheduleConfig.timezone || "UTC";
36
+ } else if (scheduleConfig.interval) {
37
+ jobConfig.interval = scheduleConfig.interval * 1e3;
38
+ }
39
+ await scheduler.schedule(jobConfig);
40
+ logger.info("Scheduled trigger", {
41
+ trigger: triggerName,
42
+ cron: scheduleConfig.cron,
43
+ interval: scheduleConfig.interval,
44
+ timezone: scheduleConfig.timezone
45
+ });
46
+ } catch (error) {
47
+ logger.error("Failed to schedule trigger", {
48
+ trigger: triggerName,
49
+ error: error instanceof Error ? error.message : String(error)
50
+ });
51
+ throw error;
52
+ }
53
+ }
54
+ export async function unscheduleTrigger(triggerName) {
55
+ const logger = useNventLogger("trigger-wiring");
56
+ const scheduler = useScheduler();
57
+ try {
58
+ const jobId = `trigger:${triggerName}`;
59
+ const removed = await scheduler.unschedule(jobId);
60
+ if (removed) {
61
+ logger.info("Unscheduled trigger", { trigger: triggerName });
62
+ }
63
+ } catch (error) {
64
+ logger.error("Failed to unschedule trigger", {
65
+ trigger: triggerName,
66
+ error: error instanceof Error ? error.message : String(error)
67
+ });
68
+ }
69
+ }