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,150 @@
1
+ /**
2
+ * Queue Adapter Interface
3
+ *
4
+ * Handles job queue operations only (enqueue, retrieve, manage)
5
+ * Does NOT handle event storage, state, or logging - those are separate concerns
6
+ */
7
+ export interface QueueAdapter {
8
+ /**
9
+ * Initialize the queue adapter
10
+ */
11
+ init(): Promise<void>;
12
+ /**
13
+ * Add a job to the queue
14
+ * @returns Job ID
15
+ */
16
+ enqueue(queueName: string, job: JobInput): Promise<string>;
17
+ /**
18
+ * Schedule a job (delayed or recurring)
19
+ * @returns Job ID
20
+ */
21
+ schedule(queueName: string, job: JobInput, opts?: ScheduleOptions): Promise<string>;
22
+ /**
23
+ * Get a specific job by ID
24
+ */
25
+ getJob(queueName: string, id: string): Promise<Job | null>;
26
+ /**
27
+ * Get multiple jobs with optional filtering
28
+ */
29
+ getJobs(queueName: string, query?: JobsQuery): Promise<Job[]>;
30
+ /**
31
+ * Subscribe to queue events
32
+ * @returns Unsubscribe function
33
+ */
34
+ on(queueName: string, event: QueueEvent, callback: (payload: any) => void): () => void;
35
+ /**
36
+ * Check if queue is paused
37
+ */
38
+ isPaused(queueName: string): Promise<boolean>;
39
+ /**
40
+ * Get job counts by state
41
+ */
42
+ getJobCounts(queueName: string): Promise<JobCounts>;
43
+ /**
44
+ * Get scheduled/repeatable jobs (cron jobs)
45
+ */
46
+ getScheduledJobs?(queueName: string): Promise<ScheduledJobInfo[]>;
47
+ /**
48
+ * Remove a scheduled/repeatable job
49
+ * @returns true if removed, false if not found
50
+ */
51
+ removeScheduledJob?(scheduleId: string): Promise<boolean>;
52
+ /**
53
+ * Pause the queue
54
+ */
55
+ pause(queueName: string): Promise<void>;
56
+ /**
57
+ * Resume the queue
58
+ */
59
+ resume(queueName: string): Promise<void>;
60
+ /**
61
+ * Register a worker handler for processing jobs
62
+ * This is called by the worker registration system
63
+ */
64
+ registerWorker(queueName: string, jobName: string, handler: WorkerHandler, opts?: WorkerOptions): void;
65
+ /**
66
+ * Start processing waiting jobs for a queue
67
+ * Should be called after all handlers are registered
68
+ */
69
+ startProcessingQueue?(queueName: string): void;
70
+ /**
71
+ * Close/cleanup the adapter
72
+ */
73
+ close(): Promise<void>;
74
+ }
75
+ export interface JobInput {
76
+ name: string;
77
+ data: any;
78
+ opts?: JobOptions;
79
+ }
80
+ export interface JobOptions {
81
+ jobId?: string;
82
+ attempts?: number;
83
+ backoff?: {
84
+ type: 'exponential' | 'fixed';
85
+ delay: number;
86
+ };
87
+ delay?: number;
88
+ priority?: number;
89
+ timeout?: number;
90
+ removeOnComplete?: boolean | number;
91
+ removeOnFail?: boolean | number;
92
+ }
93
+ export interface Job {
94
+ id: string;
95
+ name: string;
96
+ data: any;
97
+ returnvalue?: any;
98
+ failedReason?: string;
99
+ state: 'waiting' | 'active' | 'completed' | 'failed' | 'delayed' | 'paused';
100
+ timestamp?: number;
101
+ processedOn?: number;
102
+ finishedOn?: number;
103
+ attemptsMade?: number;
104
+ progress?: number;
105
+ }
106
+ export interface JobsQuery {
107
+ state?: JobState[];
108
+ limit?: number;
109
+ offset?: number;
110
+ }
111
+ export type JobState = 'waiting' | 'active' | 'completed' | 'failed' | 'delayed' | 'paused';
112
+ export interface ScheduleOptions {
113
+ delay?: number;
114
+ cron?: string;
115
+ repeat?: {
116
+ pattern?: string;
117
+ limit?: number;
118
+ };
119
+ }
120
+ export interface JobCounts {
121
+ active: number;
122
+ completed: number;
123
+ failed: number;
124
+ delayed: number;
125
+ waiting: number;
126
+ paused: number;
127
+ }
128
+ export interface ScheduledJobInfo {
129
+ id: string;
130
+ jobName: string;
131
+ queueName: string;
132
+ cron?: string;
133
+ pattern?: string;
134
+ nextRun?: Date;
135
+ repeatCount?: number;
136
+ limit?: number;
137
+ }
138
+ export type QueueEvent = 'waiting' | 'active' | 'progress' | 'completed' | 'failed' | 'delayed' | 'paused' | 'stalled';
139
+ export interface WorkerHandler {
140
+ (payload: any, ctx: WorkerContext): Promise<any>;
141
+ }
142
+ export interface WorkerContext {
143
+ jobId: string;
144
+ queueName: string;
145
+ [key: string]: any;
146
+ }
147
+ export interface WorkerOptions {
148
+ concurrency?: number;
149
+ autorun?: boolean;
150
+ }
@@ -0,0 +1,297 @@
1
+ /**
2
+ * Store Adapter Interface
3
+ *
4
+ * Three-tier storage system:
5
+ * 1. Event Stream - Append-only event log
6
+ * 2. Sorted Index - Time-ordered metadata storage
7
+ * 3. Key-Value Store - Fast lookups (for state, caching)
8
+ *
9
+ * ## Critical Implementation Requirements
10
+ *
11
+ * ### 1. Index Operations - add() vs update()
12
+ *
13
+ * **index.add()** - MUST completely REPLACE metadata when entry exists:
14
+ * ```typescript
15
+ * // First call
16
+ * await index.add('flows', 'my-flow', 123, { name: 'Flow', stats: {...} })
17
+ * // Second call - REPLACES entire metadata
18
+ * await index.add('flows', 'my-flow', 456, { lastRunAt: 789 })
19
+ * // Result: { lastRunAt: 789 } ← stats are LOST!
20
+ * ```
21
+ *
22
+ * **index.update()** - MUST perform DEEP MERGE of metadata:
23
+ * ```typescript
24
+ * // Initial state: { status: 'running', emittedEvents: { test: { completed: 1 } } }
25
+ * await index.update('runs', 'run-id', { emittedEvents: { another: { fired: 2 } } })
26
+ * // Result: { status: 'running', emittedEvents: { test: { completed: 1 }, another: { fired: 2 } } }
27
+ * ```
28
+ *
29
+ * ⚠️ **CRITICAL**: update() must perform DEEP merge at ALL nesting levels, not just top-level!
30
+ * - PostgreSQL `||` operator: Only shallow merge (top-level keys)
31
+ * - Redis HSET loop: Field-level merge (simulates deep merge for flat structures)
32
+ * - Memory defu(): True deep merge
33
+ *
34
+ * ### 2. Nested Metadata Structure
35
+ *
36
+ * Flow orchestration stores deeply nested metadata:
37
+ * ```typescript
38
+ * {
39
+ * emittedEvents: {
40
+ * 'step1': {
41
+ * 'completed': 1234567890,
42
+ * 'custom_event': 1234567891
43
+ * },
44
+ * 'step2': {
45
+ * 'completed': 1234567892
46
+ * }
47
+ * },
48
+ * awaitingSteps: {
49
+ * 'step_name': {
50
+ * status: 'awaiting',
51
+ * position: 'after',
52
+ * awaitType: 'event'
53
+ * }
54
+ * }
55
+ * }
56
+ * ```
57
+ *
58
+ * Multiple updates add to nested structures incrementally. If deep merge fails,
59
+ * flow orchestration will miss events and steps won't trigger.
60
+ *
61
+ * ### 3. Concurrent Updates
62
+ *
63
+ * Flow steps run in parallel and update metadata concurrently:
64
+ * - Multiple steps emit events simultaneously
65
+ * - Each emits triggers index.updateWithRetry() with partial metadata
66
+ * - Updates must NOT overwrite each other
67
+ * - Use optimistic locking (version field) + retries
68
+ *
69
+ * ### 4. Testing Deep Merge
70
+ *
71
+ * Test that your adapter correctly handles:
72
+ * ```typescript
73
+ * // Setup
74
+ * await index.add('test', 'id', 1, { a: { b: 1 }, c: 2 })
75
+ *
76
+ * // Update nested property
77
+ * await index.update('test', 'id', { a: { d: 3 } })
78
+ * const result = await index.get('test', 'id')
79
+ *
80
+ * // MUST preserve existing nested data
81
+ * expect(result.metadata).toEqual({ a: { b: 1, d: 3 }, c: 2 })
82
+ * // NOT: { a: { d: 3 }, c: 2 } ← b is lost!
83
+ * ```
84
+ *
85
+ */
86
+ export interface StoreAdapter {
87
+ /**
88
+ * Close/cleanup the adapter
89
+ */
90
+ close(): Promise<void>;
91
+ stream: {
92
+ /**
93
+ * Append an event to a subject's event stream
94
+ * @param subject - Event stream identifier (e.g., 'nq:flow:abc-123')
95
+ * @param event - Event to append (id and ts will be auto-generated)
96
+ * @returns The complete event record with generated id and timestamp
97
+ */
98
+ append(subject: string, event: Omit<EventRecord, 'id' | 'ts'>): Promise<EventRecord>;
99
+ /**
100
+ * Read events from a subject's event stream
101
+ * @param subject - Event stream identifier
102
+ * @param opts - Query options (filtering, pagination, etc.)
103
+ * @returns Array of event records
104
+ */
105
+ read(subject: string, opts?: EventReadOptions): Promise<EventRecord[]>;
106
+ /**
107
+ * Subscribe to new events in a subject's event stream (optional, not all adapters support this)
108
+ * @param subject - Event stream identifier (supports wildcards if adapter allows)
109
+ * @param onEvent - Callback for new events
110
+ * @returns Subscription handle for unsubscribing
111
+ */
112
+ subscribe?(subject: string, onEvent: (event: EventRecord) => void): Promise<EventSubscription>;
113
+ /**
114
+ * Delete an entire event stream
115
+ * @param subject - Event stream identifier
116
+ * @returns True if stream was deleted, false if not found
117
+ */
118
+ delete?(subject: string): Promise<boolean>;
119
+ };
120
+ kv: {
121
+ /**
122
+ * Get a value by key
123
+ */
124
+ get<T = any>(key: string): Promise<T | null>;
125
+ /**
126
+ * Set a value with optional TTL
127
+ * @param key - Key
128
+ * @param value - Value to store
129
+ * @param ttl - Time to live in seconds (optional)
130
+ */
131
+ set<T = any>(key: string, value: T, ttl?: number): Promise<void>;
132
+ /**
133
+ * Delete a key
134
+ */
135
+ delete(key: string): Promise<void>;
136
+ /**
137
+ * Delete all keys matching a pattern (optional, not all adapters support patterns)
138
+ * @returns Number of keys deleted
139
+ */
140
+ clear?(pattern: string): Promise<number>;
141
+ /**
142
+ * Atomic increment operation (optional, for counters)
143
+ * @returns New value after increment
144
+ */
145
+ increment?(key: string, by?: number): Promise<number>;
146
+ };
147
+ index: {
148
+ /**
149
+ * Add entry to a sorted index
150
+ * @param key - Index key (e.g., 'nq:flows:flowName')
151
+ * @param id - Entry ID
152
+ * @param score - Sort score (typically timestamp)
153
+ * @param metadata - Optional metadata to store with entry
154
+ */
155
+ add(key: string, id: string, score: number, metadata?: Record<string, any>): Promise<void>;
156
+ /**
157
+ * Get a single entry from a sorted index
158
+ * @param key - Index key
159
+ * @param id - Entry ID
160
+ * @returns Entry with score and metadata, or null if not found
161
+ */
162
+ get(key: string, id: string): Promise<{
163
+ id: string;
164
+ score: number;
165
+ metadata?: any;
166
+ } | null>;
167
+ /**
168
+ * Read entries from a sorted index (ordered by score descending)
169
+ * @param key - Index key
170
+ * @param opts - Pagination options
171
+ * @param opts.offset - Number of entries to skip
172
+ * @param opts.limit - Maximum number of entries to return
173
+ * @returns Array of entries with scores and metadata
174
+ */
175
+ read(key: string, opts?: {
176
+ offset?: number;
177
+ limit?: number;
178
+ }): Promise<Array<{
179
+ id: string;
180
+ score: number;
181
+ metadata?: any;
182
+ }>>;
183
+ /**
184
+ * Update metadata for an entry in a sorted index
185
+ * @param key - Index key
186
+ * @param id - Entry ID
187
+ * @param metadata - Metadata to update
188
+ * @returns True if update succeeded, false if version conflict
189
+ */
190
+ update(key: string, id: string, metadata: Record<string, any>): Promise<boolean>;
191
+ /**
192
+ * Update with automatic retries on version conflicts
193
+ * @param key - Index key
194
+ * @param id - Entry ID
195
+ * @param metadata - Metadata to update
196
+ * @param maxRetries - Maximum retry attempts (default: 3)
197
+ */
198
+ updateWithRetry(key: string, id: string, metadata: Record<string, any>, maxRetries?: number): Promise<void>;
199
+ /**
200
+ * Atomic increment of a metadata field in an index entry
201
+ * @param key - Index key
202
+ * @param id - Entry ID
203
+ * @param field - Field name to increment
204
+ * @param increment - Amount to increment by (default: 1)
205
+ * @returns New value after increment
206
+ */
207
+ increment(key: string, id: string, field: string, increment?: number): Promise<number>;
208
+ /**
209
+ * Delete an entry from a sorted index
210
+ * @param key - Index key
211
+ * @param id - Entry ID
212
+ * @returns True if entry was deleted, false if not found
213
+ */
214
+ delete(key: string, id: string): Promise<boolean>;
215
+ };
216
+ }
217
+ /**
218
+ * Event record in the event stream
219
+ * This is the storage representation - converts FlowEvent to/from storage format
220
+ */
221
+ export interface EventRecord {
222
+ id: string;
223
+ ts: number;
224
+ type: string;
225
+ runId: string;
226
+ flowName: string;
227
+ stepName?: string;
228
+ stepId?: string;
229
+ attempt?: number;
230
+ data?: any;
231
+ }
232
+ /**
233
+ * Options for reading events from the event stream
234
+ */
235
+ export interface EventReadOptions {
236
+ /**
237
+ * Filter by event types
238
+ */
239
+ types?: string[];
240
+ /**
241
+ * Read events after this ID
242
+ */
243
+ after?: string;
244
+ /**
245
+ * Read events before this ID
246
+ */
247
+ before?: string;
248
+ /**
249
+ * Read events from this timestamp
250
+ */
251
+ from?: number;
252
+ /**
253
+ * Read events until this timestamp
254
+ */
255
+ to?: number;
256
+ /**
257
+ * Maximum number of events to return
258
+ */
259
+ limit?: number;
260
+ /**
261
+ * Sort order ('asc' or 'desc')
262
+ */
263
+ order?: 'asc' | 'desc';
264
+ }
265
+ /**
266
+ * Subscription handle for event stream subscriptions
267
+ */
268
+ export interface EventSubscription {
269
+ id: string;
270
+ subject: string;
271
+ unsubscribe: () => Promise<void>;
272
+ }
273
+ /**
274
+ * Options for listing documents
275
+ */
276
+ export interface ListOptions {
277
+ /**
278
+ * Filter documents by field values
279
+ */
280
+ filter?: Record<string, any>;
281
+ /**
282
+ * Maximum number of documents to return
283
+ */
284
+ limit?: number;
285
+ /**
286
+ * Number of documents to skip
287
+ */
288
+ offset?: number;
289
+ /**
290
+ * Sort by field
291
+ */
292
+ sortBy?: string;
293
+ /**
294
+ * Sort order
295
+ */
296
+ order?: 'asc' | 'desc';
297
+ }
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Stream Adapter Interface
3
+ *
4
+ * Handles pub/sub messaging for cross-instance communication
5
+ * Replaces the pub/sub functionality from EventStoreAdapter.subscribe()
6
+ */
7
+ export interface StreamAdapter {
8
+ /**
9
+ * Initialize the stream adapter
10
+ */
11
+ init(): Promise<void>;
12
+ /**
13
+ * Publish an event to a topic
14
+ */
15
+ publish(topic: string, event: StreamEvent): Promise<void>;
16
+ /**
17
+ * Subscribe to a topic
18
+ * @returns Subscription handle for unsubscribing
19
+ */
20
+ subscribe(topic: string, handler: (event: StreamEvent) => void | Promise<void>, opts?: SubscribeOptions): Promise<SubscriptionHandle>;
21
+ /**
22
+ * Unsubscribe from a topic
23
+ */
24
+ unsubscribe(handle: SubscriptionHandle): Promise<void>;
25
+ /**
26
+ * List all active topics
27
+ */
28
+ listTopics(): Promise<string[]>;
29
+ /**
30
+ * Get number of subscribers for a topic
31
+ */
32
+ getSubscriptionCount(topic: string): Promise<number>;
33
+ /**
34
+ * Shutdown the adapter and cleanup resources
35
+ */
36
+ shutdown(): Promise<void>;
37
+ }
38
+ export interface StreamEvent {
39
+ type: string;
40
+ data: any;
41
+ metadata?: Record<string, any>;
42
+ timestamp?: number;
43
+ }
44
+ export interface SubscribeOptions {
45
+ /**
46
+ * Consumer group for load balancing (if supported)
47
+ */
48
+ group?: string;
49
+ /**
50
+ * Filter events by type pattern
51
+ */
52
+ filter?: string | RegExp;
53
+ /**
54
+ * Starting position (if supported by adapter)
55
+ */
56
+ fromBeginning?: boolean;
57
+ }
58
+ export interface SubscriptionHandle {
59
+ id: string;
60
+ topic: string;
61
+ unsubscribe: () => Promise<void>;
62
+ }
@@ -0,0 +1,85 @@
1
+ /**
2
+ * Adapter Registry
3
+ *
4
+ * Central registry for all adapter types (queue, stream, store)
5
+ * Adapters are registered via the nvent:registerAdapter Nuxt hook
6
+ */
7
+ import type { QueueAdapter, StreamAdapter, StoreAdapter } from './interfaces/index.js';
8
+ export declare class AdapterRegistry {
9
+ private queueAdapters;
10
+ private streamAdapters;
11
+ private storeAdapters;
12
+ /**
13
+ * Register a queue adapter
14
+ * @param name - Adapter name (e.g., 'redis', 'memory', 'postgres')
15
+ * @param adapter - QueueAdapter implementation
16
+ */
17
+ registerQueue(name: string, adapter: QueueAdapter): void;
18
+ /**
19
+ * Register a stream adapter
20
+ * @param name - Adapter name (e.g., 'redis', 'memory', 'rabbitmq')
21
+ * @param adapter - StreamAdapter implementation
22
+ */
23
+ registerStream(name: string, adapter: StreamAdapter): void;
24
+ /**
25
+ * Register a store adapter
26
+ * @param name - Adapter name (e.g., 'redis', 'memory', 'postgres')
27
+ * @param adapter - StoreAdapter implementation
28
+ */
29
+ registerStore(name: string, adapter: StoreAdapter): void;
30
+ /**
31
+ * Get a queue adapter by name
32
+ * @throws Error if adapter not found
33
+ */
34
+ getQueue(name: string): QueueAdapter;
35
+ /**
36
+ * Get a stream adapter by name
37
+ * @throws Error if adapter not found
38
+ */
39
+ getStream(name: string): StreamAdapter;
40
+ /**
41
+ * Get a store adapter by name
42
+ * @throws Error if adapter not found
43
+ */
44
+ getStore(name: string): StoreAdapter;
45
+ /**
46
+ * Check if a queue adapter is registered
47
+ */
48
+ hasQueue(name: string): boolean;
49
+ /**
50
+ * Check if a stream adapter is registered
51
+ */
52
+ hasStream(name: string): boolean;
53
+ /**
54
+ * Check if a store adapter is registered
55
+ */
56
+ hasStore(name: string): boolean;
57
+ /**
58
+ * List all registered queue adapters
59
+ */
60
+ listQueueAdapters(): string[];
61
+ /**
62
+ * List all registered stream adapters
63
+ */
64
+ listStreamAdapters(): string[];
65
+ /**
66
+ * List all registered store adapters
67
+ */
68
+ listStoreAdapters(): string[];
69
+ /**
70
+ * Initialize all registered adapters
71
+ */
72
+ initAll(): Promise<void>;
73
+ /**
74
+ * Close/cleanup all registered adapters
75
+ */
76
+ closeAll(): Promise<void>;
77
+ }
78
+ /**
79
+ * Get the global adapter registry instance
80
+ */
81
+ export declare function useAdapterRegistry(): AdapterRegistry;
82
+ /**
83
+ * Reset the registry (useful for testing)
84
+ */
85
+ export declare function resetAdapterRegistry(): void;