nvent 0.4.3 → 0.4.5

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 (234) hide show
  1. package/dist/module.d.mts +3 -184
  2. package/dist/module.json +3 -3
  3. package/dist/module.mjs +133 -197
  4. package/dist/runtime/adapters/builtin/file-queue.d.ts +53 -0
  5. package/dist/runtime/adapters/builtin/file-queue.js +435 -0
  6. package/dist/runtime/adapters/builtin/file-store.d.ts +46 -0
  7. package/dist/runtime/adapters/builtin/file-store.js +225 -0
  8. package/dist/runtime/adapters/builtin/file-stream.d.ts +39 -0
  9. package/dist/runtime/adapters/builtin/file-stream.js +56 -0
  10. package/dist/runtime/adapters/builtin/index.d.ts +10 -0
  11. package/dist/runtime/adapters/builtin/index.js +5 -0
  12. package/dist/runtime/adapters/builtin/memory-queue.d.ts +52 -0
  13. package/dist/runtime/adapters/builtin/memory-queue.js +239 -0
  14. package/dist/runtime/adapters/builtin/memory-store.d.ts +57 -0
  15. package/dist/runtime/adapters/builtin/memory-store.js +263 -0
  16. package/dist/runtime/adapters/builtin/memory-stream.d.ts +21 -0
  17. package/dist/runtime/adapters/builtin/memory-stream.js +56 -0
  18. package/dist/runtime/adapters/factory.d.ts +31 -0
  19. package/dist/runtime/adapters/factory.js +100 -0
  20. package/dist/runtime/adapters/index.d.ts +8 -0
  21. package/dist/runtime/adapters/index.js +3 -0
  22. package/dist/runtime/adapters/interfaces/index.d.ts +11 -0
  23. package/dist/runtime/adapters/interfaces/index.js +3 -0
  24. package/dist/runtime/adapters/interfaces/queue.d.ts +150 -0
  25. package/dist/runtime/adapters/interfaces/store.d.ts +233 -0
  26. package/dist/runtime/adapters/interfaces/stream.d.ts +62 -0
  27. package/dist/runtime/adapters/registry.d.ts +85 -0
  28. package/dist/runtime/adapters/registry.js +161 -0
  29. package/dist/runtime/config/index.d.ts +29 -0
  30. package/dist/runtime/config/index.js +167 -0
  31. package/dist/runtime/config/types.d.ts +367 -0
  32. package/dist/runtime/config/types.js +0 -0
  33. package/dist/runtime/events/types.d.ts +116 -0
  34. package/dist/runtime/events/types.js +0 -0
  35. package/dist/runtime/events/utils/stallDetector.d.ts +99 -0
  36. package/dist/runtime/events/utils/stallDetector.js +237 -0
  37. package/dist/runtime/{server-utils/events → events}/wiring/flowWiring.d.ts +3 -8
  38. package/dist/runtime/{server-utils/events → events}/wiring/flowWiring.js +119 -36
  39. package/dist/runtime/events/wiring/registry.d.ts +19 -0
  40. package/dist/runtime/events/wiring/registry.js +33 -0
  41. package/dist/runtime/events/wiring/stateWiring.d.ts +37 -0
  42. package/dist/runtime/events/wiring/stateWiring.js +92 -0
  43. package/dist/runtime/events/wiring/streamWiring.d.ts +32 -0
  44. package/dist/runtime/events/wiring/streamWiring.js +79 -0
  45. package/dist/runtime/server/api/_flows/[name]/clear-history.delete.js +16 -5
  46. package/dist/runtime/server/api/_flows/[name]/runs/[runId]/cancel.post.js +21 -0
  47. package/dist/runtime/server/api/_flows/[name]/runs.get.d.ts +12 -2
  48. package/dist/runtime/server/api/_flows/[name]/runs.get.js +15 -4
  49. package/dist/runtime/server/api/_flows/[name]/schedule.post.js +11 -2
  50. package/dist/runtime/server/api/_flows/[name]/schedules/[id].delete.js +21 -16
  51. package/dist/runtime/server/api/_flows/[name]/schedules.get.js +21 -19
  52. package/dist/runtime/server/api/_flows/ws.js +43 -22
  53. package/dist/runtime/server/api/_queues/[name]/job/[id].get.js +8 -3
  54. package/dist/runtime/server/api/_queues/[name]/job/index.get.js +12 -3
  55. package/dist/runtime/server/api/_queues/index.get.js +66 -23
  56. package/dist/runtime/server/api/_queues/ws.js +14 -4
  57. package/dist/runtime/server/plugins/00.adapters.d.ts +14 -0
  58. package/dist/runtime/server/plugins/00.adapters.js +69 -0
  59. package/dist/runtime/server/plugins/02.workers.js +45 -0
  60. package/dist/runtime/tsconfig.json +8 -0
  61. package/dist/runtime/utils/adapters.d.ts +66 -0
  62. package/dist/runtime/utils/adapters.js +51 -0
  63. package/dist/runtime/utils/defineFunction.d.ts +10 -0
  64. package/dist/runtime/{server-utils/utils/defineQueueWorker.js → utils/defineFunction.js} +4 -4
  65. package/dist/runtime/{server-utils/utils/defineQueueConfig.d.ts → utils/defineFunctionConfig.d.ts} +3 -3
  66. package/dist/runtime/utils/defineFunctionConfig.js +2 -0
  67. package/dist/runtime/utils/registerAdapter.d.ts +59 -0
  68. package/dist/runtime/utils/registerAdapter.js +13 -0
  69. package/dist/runtime/utils/useFlowEngine.d.ts +19 -0
  70. package/dist/runtime/utils/useFlowEngine.js +108 -0
  71. package/dist/runtime/{server-utils/utils → utils}/useNventLogger.js +2 -2
  72. package/dist/runtime/utils/useStreamTopics.d.ts +72 -0
  73. package/dist/runtime/utils/useStreamTopics.js +47 -0
  74. package/dist/runtime/{server-utils/worker/runner/node.d.ts → worker/node/runner.d.ts} +18 -2
  75. package/dist/runtime/{server-utils/worker/runner/node.js → worker/node/runner.js} +44 -17
  76. package/dist/types.d.mts +2 -2
  77. package/package.json +14 -44
  78. package/LICENSE +0 -21
  79. package/README.md +0 -389
  80. package/dist/runtime/app/assets/vueflow.css +0 -1
  81. package/dist/runtime/app/components/ConfirmDialog.d.vue.ts +0 -33
  82. package/dist/runtime/app/components/ConfirmDialog.vue +0 -121
  83. package/dist/runtime/app/components/ConfirmDialog.vue.d.ts +0 -33
  84. package/dist/runtime/app/components/FlowDiagram.d.vue.ts +0 -64
  85. package/dist/runtime/app/components/FlowDiagram.vue +0 -338
  86. package/dist/runtime/app/components/FlowDiagram.vue.d.ts +0 -64
  87. package/dist/runtime/app/components/FlowNodeCard.d.vue.ts +0 -29
  88. package/dist/runtime/app/components/FlowNodeCard.vue +0 -156
  89. package/dist/runtime/app/components/FlowNodeCard.vue.d.ts +0 -29
  90. package/dist/runtime/app/components/FlowRunOverview.d.vue.ts +0 -9
  91. package/dist/runtime/app/components/FlowRunOverview.vue +0 -291
  92. package/dist/runtime/app/components/FlowRunOverview.vue.d.ts +0 -9
  93. package/dist/runtime/app/components/FlowRunStatusBadge.d.vue.ts +0 -14
  94. package/dist/runtime/app/components/FlowRunStatusBadge.vue +0 -60
  95. package/dist/runtime/app/components/FlowRunStatusBadge.vue.d.ts +0 -14
  96. package/dist/runtime/app/components/FlowRunTimeline.d.vue.ts +0 -12
  97. package/dist/runtime/app/components/FlowRunTimeline.vue +0 -127
  98. package/dist/runtime/app/components/FlowRunTimeline.vue.d.ts +0 -12
  99. package/dist/runtime/app/components/FlowScheduleDialog.d.vue.ts +0 -16
  100. package/dist/runtime/app/components/FlowScheduleDialog.vue +0 -226
  101. package/dist/runtime/app/components/FlowScheduleDialog.vue.d.ts +0 -16
  102. package/dist/runtime/app/components/FlowSchedulesList.d.vue.ts +0 -12
  103. package/dist/runtime/app/components/FlowSchedulesList.vue +0 -99
  104. package/dist/runtime/app/components/FlowSchedulesList.vue.d.ts +0 -12
  105. package/dist/runtime/app/components/JobScheduling.d.vue.ts +0 -6
  106. package/dist/runtime/app/components/JobScheduling.vue +0 -203
  107. package/dist/runtime/app/components/JobScheduling.vue.d.ts +0 -6
  108. package/dist/runtime/app/components/ListItem.d.vue.ts +0 -23
  109. package/dist/runtime/app/components/ListItem.vue +0 -70
  110. package/dist/runtime/app/components/ListItem.vue.d.ts +0 -23
  111. package/dist/runtime/app/components/QueueConfigDetails.d.vue.ts +0 -45
  112. package/dist/runtime/app/components/QueueConfigDetails.vue +0 -412
  113. package/dist/runtime/app/components/QueueConfigDetails.vue.d.ts +0 -45
  114. package/dist/runtime/app/components/StatCounter.d.vue.ts +0 -9
  115. package/dist/runtime/app/components/StatCounter.vue +0 -25
  116. package/dist/runtime/app/components/StatCounter.vue.d.ts +0 -9
  117. package/dist/runtime/app/components/TimelineList.d.vue.ts +0 -7
  118. package/dist/runtime/app/components/TimelineList.vue +0 -210
  119. package/dist/runtime/app/components/TimelineList.vue.d.ts +0 -7
  120. package/dist/runtime/app/components/nhealth/component-router.d.vue.ts +0 -46
  121. package/dist/runtime/app/components/nhealth/component-router.vue +0 -26
  122. package/dist/runtime/app/components/nhealth/component-router.vue.d.ts +0 -46
  123. package/dist/runtime/app/components/nhealth/component-shell.d.vue.ts +0 -24
  124. package/dist/runtime/app/components/nhealth/component-shell.vue +0 -89
  125. package/dist/runtime/app/components/nhealth/component-shell.vue.d.ts +0 -24
  126. package/dist/runtime/app/composables/useAnalyzedFlows.d.ts +0 -14
  127. package/dist/runtime/app/composables/useAnalyzedFlows.js +0 -8
  128. package/dist/runtime/app/composables/useComponentRouter.d.ts +0 -38
  129. package/dist/runtime/app/composables/useComponentRouter.js +0 -240
  130. package/dist/runtime/app/composables/useFlowRunTimeline.d.ts +0 -15
  131. package/dist/runtime/app/composables/useFlowRunTimeline.js +0 -66
  132. package/dist/runtime/app/composables/useFlowRuns.d.ts +0 -18
  133. package/dist/runtime/app/composables/useFlowRuns.js +0 -32
  134. package/dist/runtime/app/composables/useFlowRunsInfinite.d.ts +0 -24
  135. package/dist/runtime/app/composables/useFlowRunsInfinite.js +0 -123
  136. package/dist/runtime/app/composables/useFlowRunsPolling.d.ts +0 -9
  137. package/dist/runtime/app/composables/useFlowRunsPolling.js +0 -33
  138. package/dist/runtime/app/composables/useFlowState.d.ts +0 -125
  139. package/dist/runtime/app/composables/useFlowState.js +0 -211
  140. package/dist/runtime/app/composables/useFlowWebSocket.d.ts +0 -27
  141. package/dist/runtime/app/composables/useFlowWebSocket.js +0 -205
  142. package/dist/runtime/app/composables/useFlowsNavigation.d.ts +0 -10
  143. package/dist/runtime/app/composables/useFlowsNavigation.js +0 -58
  144. package/dist/runtime/app/composables/useQueueJobs.d.ts +0 -20
  145. package/dist/runtime/app/composables/useQueueJobs.js +0 -20
  146. package/dist/runtime/app/composables/useQueueUpdates.d.ts +0 -26
  147. package/dist/runtime/app/composables/useQueueUpdates.js +0 -122
  148. package/dist/runtime/app/composables/useQueues.d.ts +0 -44
  149. package/dist/runtime/app/composables/useQueues.js +0 -26
  150. package/dist/runtime/app/composables/useQueuesLive.d.ts +0 -19
  151. package/dist/runtime/app/composables/useQueuesLive.js +0 -143
  152. package/dist/runtime/app/pages/flows/index.d.vue.ts +0 -3
  153. package/dist/runtime/app/pages/flows/index.vue +0 -645
  154. package/dist/runtime/app/pages/flows/index.vue.d.ts +0 -3
  155. package/dist/runtime/app/pages/index.d.vue.ts +0 -3
  156. package/dist/runtime/app/pages/index.vue +0 -34
  157. package/dist/runtime/app/pages/index.vue.d.ts +0 -3
  158. package/dist/runtime/app/pages/queues/index.d.vue.ts +0 -3
  159. package/dist/runtime/app/pages/queues/index.vue +0 -229
  160. package/dist/runtime/app/pages/queues/index.vue.d.ts +0 -3
  161. package/dist/runtime/app/pages/queues/job.d.vue.ts +0 -3
  162. package/dist/runtime/app/pages/queues/job.vue +0 -262
  163. package/dist/runtime/app/pages/queues/job.vue.d.ts +0 -3
  164. package/dist/runtime/app/pages/queues/jobs.d.vue.ts +0 -3
  165. package/dist/runtime/app/pages/queues/jobs.vue +0 -291
  166. package/dist/runtime/app/pages/queues/jobs.vue.d.ts +0 -3
  167. package/dist/runtime/app/plugins/vueflow.client.d.ts +0 -2
  168. package/dist/runtime/app/plugins/vueflow.client.js +0 -11
  169. package/dist/runtime/constants.d.ts +0 -11
  170. package/dist/runtime/constants.js +0 -11
  171. package/dist/runtime/schema.d.ts +0 -37
  172. package/dist/runtime/schema.js +0 -20
  173. package/dist/runtime/server/plugins/00.event-store.d.ts +0 -13
  174. package/dist/runtime/server/plugins/00.event-store.js +0 -16
  175. package/dist/runtime/server/plugins/flow-management.d.ts +0 -13
  176. package/dist/runtime/server/plugins/flow-management.js +0 -65
  177. package/dist/runtime/server/plugins/queue-management.js +0 -27
  178. package/dist/runtime/server/plugins/state-cleanup.d.ts +0 -11
  179. package/dist/runtime/server/plugins/state-cleanup.js +0 -93
  180. package/dist/runtime/server/plugins/worker-management.js +0 -33
  181. package/dist/runtime/server/tsconfig.json +0 -3
  182. package/dist/runtime/server-utils/events/adapters/fileAdapter.d.ts +0 -2
  183. package/dist/runtime/server-utils/events/adapters/fileAdapter.js +0 -382
  184. package/dist/runtime/server-utils/events/adapters/memoryAdapter.d.ts +0 -2
  185. package/dist/runtime/server-utils/events/adapters/memoryAdapter.js +0 -171
  186. package/dist/runtime/server-utils/events/adapters/redis/redisAdapter.d.ts +0 -2
  187. package/dist/runtime/server-utils/events/adapters/redis/redisAdapter.js +0 -348
  188. package/dist/runtime/server-utils/events/adapters/redis/redisPubSubGateway.d.ts +0 -30
  189. package/dist/runtime/server-utils/events/adapters/redis/redisPubSubGateway.js +0 -82
  190. package/dist/runtime/server-utils/events/eventStoreFactory.d.ts +0 -19
  191. package/dist/runtime/server-utils/events/eventStoreFactory.js +0 -44
  192. package/dist/runtime/server-utils/events/streamNames.d.ts +0 -17
  193. package/dist/runtime/server-utils/events/streamNames.js +0 -17
  194. package/dist/runtime/server-utils/events/types.d.ts +0 -63
  195. package/dist/runtime/server-utils/events/wiring/registry.d.ts +0 -10
  196. package/dist/runtime/server-utils/events/wiring/registry.js +0 -24
  197. package/dist/runtime/server-utils/queue/adapters/bullmq.d.ts +0 -18
  198. package/dist/runtime/server-utils/queue/adapters/bullmq.js +0 -164
  199. package/dist/runtime/server-utils/queue/queueFactory.d.ts +0 -3
  200. package/dist/runtime/server-utils/queue/queueFactory.js +0 -10
  201. package/dist/runtime/server-utils/queue/types.d.ts +0 -47
  202. package/dist/runtime/server-utils/state/adapters/redis.d.ts +0 -2
  203. package/dist/runtime/server-utils/state/adapters/redis.js +0 -42
  204. package/dist/runtime/server-utils/state/stateFactory.d.ts +0 -3
  205. package/dist/runtime/server-utils/state/stateFactory.js +0 -17
  206. package/dist/runtime/server-utils/state/types.d.ts +0 -23
  207. package/dist/runtime/server-utils/utils/defineQueueConfig.js +0 -2
  208. package/dist/runtime/server-utils/utils/defineQueueWorker.d.ts +0 -10
  209. package/dist/runtime/server-utils/utils/useEventStore.d.ts +0 -20
  210. package/dist/runtime/server-utils/utils/useEventStore.js +0 -119
  211. package/dist/runtime/server-utils/utils/useFlowEngine.d.ts +0 -9
  212. package/dist/runtime/server-utils/utils/useFlowEngine.js +0 -44
  213. package/dist/runtime/server-utils/utils/useLogs.d.ts +0 -41
  214. package/dist/runtime/server-utils/utils/useLogs.js +0 -74
  215. package/dist/runtime/server-utils/utils/useQueue.d.ts +0 -31
  216. package/dist/runtime/server-utils/utils/useQueue.js +0 -24
  217. package/dist/runtime/server-utils/worker/adapter.d.ts +0 -4
  218. package/dist/runtime/server-utils/worker/adapter.js +0 -66
  219. package/dist/runtime/types.d.ts +0 -132
  220. /package/dist/runtime/{server-utils/events/types.js → adapters/interfaces/queue.js} +0 -0
  221. /package/dist/runtime/{server-utils/queue/types.js → adapters/interfaces/store.js} +0 -0
  222. /package/dist/runtime/{server-utils/state/types.js → adapters/interfaces/stream.js} +0 -0
  223. /package/dist/runtime/{server-utils/events → events}/eventBus.d.ts +0 -0
  224. /package/dist/runtime/{server-utils/events → events}/eventBus.js +0 -0
  225. /package/dist/runtime/server/{plugins/queue-management.d.ts → api/_flows/[name]/runs/[runId]/cancel.post.d.ts} +0 -0
  226. /package/dist/runtime/server/plugins/{00.ws-lifecycle.d.ts → 01.ws-lifecycle.d.ts} +0 -0
  227. /package/dist/runtime/server/plugins/{00.ws-lifecycle.js → 01.ws-lifecycle.js} +0 -0
  228. /package/dist/runtime/server/plugins/{worker-management.d.ts → 02.workers.d.ts} +0 -0
  229. /package/dist/runtime/{server-utils/utils → utils}/useEventManager.d.ts +0 -0
  230. /package/dist/runtime/{server-utils/utils → utils}/useEventManager.js +0 -0
  231. /package/dist/runtime/{server-utils/utils → utils}/useNventLogger.d.ts +0 -0
  232. /package/dist/runtime/{server-utils/utils → utils}/wsPeerManager.d.ts +0 -0
  233. /package/dist/runtime/{server-utils/utils → utils}/wsPeerManager.js +0 -0
  234. /package/dist/runtime/{python → worker/python}/get_config.py +0 -0
package/dist/module.d.mts CHANGED
@@ -1,193 +1,12 @@
1
1
  import * as _nuxt_schema from '@nuxt/schema';
2
-
3
- /**
4
- * Redis connection configuration
5
- */
6
- interface RedisConfig {
7
- host?: string;
8
- port?: number;
9
- username?: string;
10
- password?: string;
11
- db?: number;
12
- url?: string;
13
- }
14
- /**
15
- * PostgreSQL connection configuration
16
- */
17
- interface PostgresConfig {
18
- connectionString?: string;
19
- host?: string;
20
- port?: number;
21
- database?: string;
22
- user?: string;
23
- password?: string;
24
- }
25
- /**
26
- * Queue provider configuration
27
- */
28
- interface QueueConfig {
29
- /**
30
- * Queue backend adapter: 'redis' (BullMQ) or 'postgres' (PGBoss)
31
- */
32
- adapter?: 'redis' | 'postgres';
33
- /**
34
- * Redis connection config (when using BullMQ)
35
- */
36
- redis?: RedisConfig;
37
- /**
38
- * Postgres connection config (when using PGBoss)
39
- */
40
- postgres?: PostgresConfig;
41
- /**
42
- * Default configuration for queues and workers.
43
- * Combines both queue and worker options for convenience.
44
- */
45
- defaultConfig?: {
46
- prefix?: string;
47
- defaultJobOptions?: {
48
- attempts?: number;
49
- backoff?: number | {
50
- type: 'fixed' | 'exponential';
51
- delay: number;
52
- };
53
- delay?: number;
54
- priority?: number;
55
- timeout?: number;
56
- lifo?: boolean;
57
- removeOnComplete?: boolean | number;
58
- removeOnFail?: boolean | number;
59
- };
60
- limiter?: {
61
- max?: number;
62
- duration?: number;
63
- groupKey?: string;
64
- };
65
- worker?: {
66
- concurrency?: number;
67
- lockDurationMs?: number;
68
- maxStalledCount?: number;
69
- drainDelayMs?: number;
70
- autorun?: boolean;
71
- pollingIntervalMs?: number;
72
- };
73
- };
74
- }
75
- /**
76
- * State provider configuration
77
- */
78
- interface StateConfig {
79
- adapter?: 'redis' | 'postgres';
80
- namespace?: string;
81
- autoScope?: 'always' | 'flow' | 'never';
82
- cleanup?: {
83
- strategy?: 'never' | 'immediate' | 'ttl' | 'on-complete';
84
- ttlMs?: number;
85
- };
86
- redis?: RedisConfig;
87
- postgres?: PostgresConfig;
88
- }
89
- /**
90
- * Event store configuration
91
- */
92
- interface EventStoreConfig {
93
- adapter?: 'redis' | 'postgres' | 'memory' | 'file';
94
- streams?: any;
95
- options?: {
96
- file?: {
97
- dir?: string;
98
- ext?: string;
99
- pollMs?: number;
100
- };
101
- };
102
- redis?: RedisConfig;
103
- postgres?: PostgresConfig;
104
- /**
105
- * Retention settings for event lifecycle tracking
106
- */
107
- retention?: {
108
- /**
109
- * How long to keep event stream data (in seconds)
110
- * @default 604800 (7 days)
111
- */
112
- eventTTL?: number;
113
- /**
114
- * How long to keep flow metadata after completion/failure (in seconds)
115
- * @default 2592000 (30 days)
116
- */
117
- metadataTTL?: number;
118
- };
119
- }
120
- /**
121
- * Store shortcut - sets all backends to the same storage
122
- */
123
- interface StoreShortcut {
124
- /**
125
- * Storage backend adapter to use for everything
126
- */
127
- adapter: 'redis' | 'postgres';
128
- /**
129
- * Redis config (used when adapter is 'redis')
130
- */
131
- redis?: RedisConfig;
132
- /**
133
- * Postgres config (used when adapter is 'postgres')
134
- */
135
- postgres?: PostgresConfig;
136
- }
137
- /**
138
- * Module options for nuxt-queue
139
- */
140
- interface ModuleOptions {
141
- /**
142
- * Directory to scan for queue workers
143
- */
144
- dir?: string;
145
- /**
146
- * Enable dev UI
147
- */
148
- ui?: boolean;
149
- /**
150
- * Debug configuration
151
- */
152
- debug?: Record<string, any>;
153
- /**
154
- * Shortcut to configure all backends at once.
155
- * Setting this will configure queue, state, and eventStore to use the same backend.
156
- * Individual configs can still override this.
157
- */
158
- store?: StoreShortcut;
159
- /**
160
- * Queue provider configuration (BullMQ/PGBoss)
161
- */
162
- queue?: QueueConfig;
163
- /**
164
- * State provider configuration
165
- */
166
- state?: StateConfig;
167
- /**
168
- * Event store configuration
169
- */
170
- eventStore?: EventStoreConfig;
171
- }
172
- /**
173
- * Runtime config shape for queue module
174
- */
175
- interface QueueModuleConfig {
176
- debug?: Record<string, any>;
177
- workers: any[];
178
- registry?: any;
179
- queue: Required<QueueConfig>;
180
- state: Required<StateConfig>;
181
- eventStore: Required<EventStoreConfig>;
182
- rootDir?: string;
183
- }
2
+ import { ModuleConfig, ModuleOptions } from '../dist/runtime/config/types.js';
3
+ export { ModuleOptions } from '../dist/runtime/config/types.js';
184
4
 
185
5
  declare module '@nuxt/schema' {
186
6
  interface RuntimeConfig {
187
- queue: QueueModuleConfig;
7
+ nvent: ModuleConfig;
188
8
  }
189
9
  }
190
10
  declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
191
11
 
192
12
  export { _default as default };
193
- export type { ModuleOptions };
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
- "name": "queue",
3
- "version": "0.1",
4
- "configKey": "queue",
2
+ "name": "nvent",
3
+ "version": "0.4.1",
4
+ "configKey": "nvent",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { dirname, join, extname, relative } from 'node:path';
2
- import { useLogger, defineNuxtModule, createResolver, addServerScanDir, addImportsDir, addPlugin, addComponentsDir, addComponent, addTemplate, addServerImports, updateTemplates } from '@nuxt/kit';
2
+ import { useLogger, defineNuxtModule, createResolver, addServerScanDir, addTemplate, addTypeTemplate, addServerImports, updateTemplates } from '@nuxt/kit';
3
3
  import defu from 'defu';
4
4
  import { existsSync, realpathSync } from 'node:fs';
5
5
  import { globby } from 'globby';
@@ -10,6 +10,7 @@ import { spawn } from 'node:child_process';
10
10
  import chokidar from 'chokidar';
11
11
  import { join as join$1 } from 'pathe';
12
12
  import { debounce } from 'perfect-debounce';
13
+ import { normalizeModuleOptions, getRedisStorageConfig, toRuntimeConfig } from '../dist/runtime/config/index.js';
13
14
 
14
15
  async function loadJsConfig(absPath) {
15
16
  const cacheBust = `?t=${Date.now()}`;
@@ -127,7 +128,7 @@ function astToValue(node) {
127
128
 
128
129
  async function loadPyConfig(absPath, logger) {
129
130
  const moduleDir = dirname(fileURLToPath(import.meta.url));
130
- const helper = join(moduleDir, "..", "..", "runtime", "python", "get_config.py");
131
+ const helper = join(moduleDir, "..", "..", "runtime", "worker", "python", "get_config.py");
131
132
  let pyConfig;
132
133
  if (existsSync(helper)) {
133
134
  pyConfig = await new Promise((resolve) => {
@@ -685,144 +686,12 @@ export default useAnalyzedFlows;
685
686
  `;
686
687
  }
687
688
 
688
- function normalizeModuleOptions(options) {
689
- const defaults = {
690
- dir: "queues",
691
- ui: true,
692
- debug: {},
693
- queue: {
694
- adapter: "redis",
695
- redis: {
696
- host: "127.0.0.1",
697
- port: 6379
698
- },
699
- defaultConfig: {
700
- // Queue options
701
- prefix: "nq",
702
- defaultJobOptions: {},
703
- // Worker options
704
- worker: {
705
- concurrency: 2,
706
- autorun: true
707
- }
708
- }
709
- },
710
- state: {
711
- adapter: "redis",
712
- namespace: "nq",
713
- autoScope: "always",
714
- cleanup: {
715
- strategy: "never"
716
- },
717
- redis: {
718
- host: "127.0.0.1",
719
- port: 6379
720
- }
721
- },
722
- eventStore: {
723
- adapter: "memory",
724
- options: {
725
- file: {
726
- dir: ".data/nq-events",
727
- ext: ".ndjson",
728
- pollMs: 1e3
729
- }
730
- },
731
- retention: {
732
- eventTTL: 604800,
733
- // 7 days
734
- metadataTTL: 2592e3
735
- // 30 days
736
- }
737
- }
738
- };
739
- if (options.store) {
740
- const storeConfig = expandStoreShortcut(options.store);
741
- return defu(options, storeConfig, defaults);
742
- }
743
- return defu(options, defaults);
744
- }
745
- function expandStoreShortcut(store) {
746
- if (!store) return {};
747
- const storeAdapter = store.adapter;
748
- if (storeAdapter === "redis") {
749
- const redisConfig = store.redis || {
750
- host: "127.0.0.1",
751
- port: 6379
752
- };
753
- return {
754
- queue: {
755
- adapter: "redis",
756
- redis: redisConfig,
757
- defaultConfig: {}
758
- },
759
- state: {
760
- adapter: "redis",
761
- namespace: "nq",
762
- autoScope: "always",
763
- cleanup: { strategy: "never" },
764
- redis: redisConfig
765
- },
766
- eventStore: {
767
- adapter: "redis",
768
- redis: redisConfig
769
- }
770
- };
771
- }
772
- if (storeAdapter === "postgres") {
773
- const postgresConfig = store.postgres || {
774
- connectionString: process.env.DATABASE_URL || "postgresql://localhost:5432/nuxt_queue"
775
- };
776
- return {
777
- queue: {
778
- adapter: "postgres",
779
- postgres: postgresConfig,
780
- defaultConfig: {}
781
- },
782
- state: {
783
- adapter: "postgres",
784
- postgres: postgresConfig
785
- },
786
- eventStore: {
787
- adapter: "postgres",
788
- postgres: postgresConfig
789
- }
790
- };
791
- }
792
- return {};
793
- }
794
- function toRuntimeConfig(normalizedOptions) {
795
- return {
796
- debug: normalizedOptions.debug,
797
- workers: [],
798
- queue: normalizedOptions.queue,
799
- state: normalizedOptions.state,
800
- eventStore: normalizedOptions.eventStore
801
- };
802
- }
803
- function getRedisStorageConfig(normalizedOptions) {
804
- const redisConfig = normalizedOptions.queue.redis || normalizedOptions.state.redis;
805
- if (!redisConfig) {
806
- return {
807
- host: "127.0.0.1",
808
- port: 6379
809
- };
810
- }
811
- return {
812
- host: redisConfig.host,
813
- port: redisConfig.port,
814
- username: redisConfig.username,
815
- password: redisConfig.password,
816
- db: redisConfig.db
817
- };
818
- }
819
-
820
689
  const meta = {
821
- name: "queue",
822
- version: "0.1",
823
- configKey: "queue"
690
+ name: "nvent",
691
+ version: "0.4.1",
692
+ configKey: "nvent"
824
693
  };
825
- const module = defineNuxtModule({
694
+ const module$1 = defineNuxtModule({
826
695
  meta,
827
696
  defaults: {},
828
697
  moduleDependencies: {
@@ -832,30 +701,10 @@ const module = defineNuxtModule({
832
701
  },
833
702
  async setup(options, nuxt) {
834
703
  const { resolve } = createResolver(import.meta.url);
835
- const config = normalizeModuleOptions(options);
704
+ const userConfig = nuxt.options[meta.configKey] || {};
705
+ const mergedOptions = { ...userConfig, ...options };
706
+ const config = normalizeModuleOptions(mergedOptions);
836
707
  addServerScanDir(resolve("./runtime/server"));
837
- addImportsDir(resolve("./runtime/shared/utils"));
838
- addImportsDir(resolve("./runtime/app/composables"));
839
- if (config.ui) {
840
- nuxt.options.css = nuxt.options.css || [];
841
- nuxt.options.css.push(resolve("./runtime/app/assets/vueflow.css"));
842
- addPlugin({
843
- src: resolve("./runtime/app/plugins/vueflow.client"),
844
- mode: "client"
845
- });
846
- addComponentsDir({
847
- path: resolve("./runtime/app/components"),
848
- prefix: "Queue"
849
- });
850
- addComponent({
851
- name: "QueueApp",
852
- filePath: resolve("./runtime/app/pages/index.vue"),
853
- global: true
854
- });
855
- }
856
- nuxt.options.vite.optimizeDeps = defu(nuxt.options.vite.optimizeDeps, {
857
- include: ["vanilla-jsoneditor"]
858
- });
859
708
  nuxt.hook("nitro:config", (nitro) => {
860
709
  const redisConfig = getRedisStorageConfig(config);
861
710
  nitro.storage = defu(nitro.storage || {}, {
@@ -870,28 +719,25 @@ const module = defineNuxtModule({
870
719
  });
871
720
  });
872
721
  const runtimeConfig = nuxt.options.runtimeConfig;
873
- runtimeConfig.queue = defu(runtimeConfig.queue || {}, toRuntimeConfig(config));
874
- if (!runtimeConfig.queue) runtimeConfig.queue = {};
875
- runtimeConfig.queue.rootDir = nuxt.options.rootDir;
722
+ runtimeConfig.nvent = defu(runtimeConfig.nvent || {}, toRuntimeConfig(config));
723
+ if (!runtimeConfig.nvent) runtimeConfig.nvent = {};
724
+ runtimeConfig.nvent.rootDir = nuxt.options.rootDir;
876
725
  const layerInfos = nuxt.options._layers.map((l) => ({
877
726
  rootDir: l.config.rootDir,
878
727
  serverDir: l.config?.serverDir || join(l.config.rootDir, "server")
879
728
  }));
880
- const { worker: _worker, ...queueOptions } = config.queue.defaultConfig || {};
729
+ const { worker, ...queueOptions } = config.queue;
881
730
  const defaultConfigs = {
882
731
  queue: queueOptions,
883
- worker: config.queue.defaultConfig?.worker
732
+ worker
884
733
  };
885
- const compiledRegistry = await compileRegistryFromServerWorkers(layerInfos, config.dir || "queues", defaultConfigs);
734
+ const compiledRegistry = await compileRegistryFromServerWorkers(layerInfos, config.dir || "functions", defaultConfigs);
886
735
  const compiledWithMeta = defu(compiledRegistry, {
887
736
  version: 1,
888
737
  compiledAt: (/* @__PURE__ */ new Date()).toISOString(),
889
738
  provider: { name: config.queue.adapter === "postgres" ? "pgboss" : "bullmq" },
890
739
  logger: { name: "console", level: "info" },
891
- state: config.state,
892
- eventStore: config.eventStore,
893
740
  runner: { ts: { isolate: "inprocess" }, py: { enabled: false, cmd: "python3", importMode: "file" } },
894
- workers: [],
895
741
  flows: {},
896
742
  eventIndex: {}
897
743
  });
@@ -919,6 +765,70 @@ const module = defineNuxtModule({
919
765
  write: true,
920
766
  getContents: () => generateAnalyzedFlowsTemplate(lastCompiledRegistry)
921
767
  });
768
+ addTypeTemplate({
769
+ filename: "types/nvent-adapters.d.ts",
770
+ getContents: () => `
771
+ // Auto-generated adapter type definitions
772
+ // External adapter packages can import these types
773
+
774
+ // Queue Adapter
775
+ export type {
776
+ QueueAdapter,
777
+ JobInput,
778
+ Job,
779
+ JobsQuery,
780
+ JobOptions,
781
+ JobState,
782
+ ScheduleOptions,
783
+ JobCounts,
784
+ QueueEvent,
785
+ WorkerHandler,
786
+ WorkerContext,
787
+ WorkerOptions,
788
+ } from ${JSON.stringify(resolve("./runtime/adapters/interfaces/queue"))}
789
+
790
+ // Stream Adapter
791
+ export type {
792
+ StreamAdapter,
793
+ StreamEvent,
794
+ SubscribeOptions,
795
+ SubscriptionHandle,
796
+ } from ${JSON.stringify(resolve("./runtime/adapters/interfaces/stream"))}
797
+
798
+ // Store Adapter
799
+ export type {
800
+ StoreAdapter,
801
+ EventRecord,
802
+ EventReadOptions,
803
+ EventSubscription,
804
+ ListOptions,
805
+ } from ${JSON.stringify(resolve("./runtime/adapters/interfaces/store"))}
806
+
807
+ // Event Types
808
+ export type {
809
+ EventType,
810
+ BaseEvent,
811
+ StepEvent,
812
+ FlowStartEvent,
813
+ FlowCompletedEvent,
814
+ FlowFailedEvent,
815
+ FlowCancelEvent,
816
+ FlowStalledEvent,
817
+ StepStartedEvent,
818
+ StepCompletedEvent,
819
+ StepFailedEvent,
820
+ StepRetryEvent,
821
+ LogEvent,
822
+ EmitEvent,
823
+ StateEvent,
824
+ FlowEvent,
825
+ } from ${JSON.stringify(resolve("./runtime/events/types"))}
826
+
827
+ // Adapter Registry
828
+ export type { AdapterRegistry } from ${JSON.stringify(resolve("./runtime/adapters/registry"))}
829
+ `.trim()
830
+ });
831
+ nuxt.options.alias["#nvent/adapters"] = resolve(nuxt.options.buildDir, "types/nvent-adapters");
922
832
  addServerImports([
923
833
  // Generated templates
924
834
  {
@@ -936,57 +846,83 @@ const module = defineNuxtModule({
936
846
  as: "$useAnalyzedFlows",
937
847
  from: resolve(nuxt.options.buildDir, "analyzed-flows")
938
848
  },
939
- // Core utilities for user code (moved to server-utils to avoid bundling issues)
849
+ // Core utilities for user code
940
850
  {
941
- name: "defineQueueConfig",
942
- from: resolve("./runtime/server-utils/utils/defineQueueConfig")
851
+ name: "defineFunctionConfig",
852
+ from: resolve("./runtime/utils/defineFunctionConfig")
943
853
  },
944
854
  {
945
- name: "defineQueueWorker",
946
- from: resolve("./runtime/server-utils/utils/defineQueueWorker")
855
+ name: "defineFunction",
856
+ from: resolve("./runtime/utils/defineFunction")
947
857
  },
948
858
  // Composables users may need in server code
949
859
  {
950
- name: "useQueue",
951
- from: resolve("./runtime/server-utils/utils/useQueue")
860
+ name: "useFlowEngine",
861
+ from: resolve("./runtime/utils/useFlowEngine")
952
862
  },
953
863
  {
954
- name: "useFlowEngine",
955
- from: resolve("./runtime/server-utils/utils/useFlowEngine")
864
+ name: "useEventManager",
865
+ from: resolve("./runtime/utils/useEventManager")
956
866
  },
957
867
  {
958
- name: "useEventStore",
959
- from: resolve("./runtime/server-utils/utils/useEventStore")
868
+ name: "usePeerManager",
869
+ from: resolve("./runtime/utils/wsPeerManager")
960
870
  },
961
871
  {
962
- name: "useLogs",
963
- from: resolve("./runtime/server-utils/utils/useLogs")
872
+ name: "useNventLogger",
873
+ from: resolve("./runtime/utils/useNventLogger")
964
874
  },
965
875
  {
966
- name: "useEventManager",
967
- from: resolve("./runtime/server-utils/utils/useEventManager")
876
+ name: "useQueueAdapter",
877
+ from: resolve("./runtime/utils/adapters")
968
878
  },
969
879
  {
970
- name: "usePeerManager",
971
- from: resolve("./runtime/server-utils/utils/wsPeerManager")
880
+ name: "useStoreAdapter",
881
+ from: resolve("./runtime/utils/adapters")
972
882
  },
973
883
  {
974
- name: "useNventLogger",
975
- from: resolve("./runtime/server-utils/utils/useNventLogger")
884
+ name: "useStreamAdapter",
885
+ from: resolve("./runtime/utils/adapters")
886
+ },
887
+ {
888
+ name: "useStateAdapter",
889
+ from: resolve("./runtime/utils/adapters")
890
+ },
891
+ {
892
+ name: "getAdapters",
893
+ from: resolve("./runtime/utils/adapters")
894
+ },
895
+ {
896
+ name: "setAdapters",
897
+ from: resolve("./runtime/utils/adapters")
898
+ },
899
+ {
900
+ name: "useStreamTopics",
901
+ from: resolve("./runtime/utils/useStreamTopics")
902
+ },
903
+ // Adapter registration utilities for external modules
904
+ {
905
+ name: "registerQueueAdapter",
906
+ from: resolve("./runtime/utils/registerAdapter")
907
+ },
908
+ {
909
+ name: "registerStreamAdapter",
910
+ from: resolve("./runtime/utils/registerAdapter")
911
+ },
912
+ {
913
+ name: "registerStoreAdapter",
914
+ from: resolve("./runtime/utils/registerAdapter")
976
915
  }
977
916
  ]);
978
917
  const refreshRegistry = async (reason, changedPath) => {
979
- const queuesRel = config.dir || "queues";
980
- const updatedRegistry = await compileRegistryFromServerWorkers(layerInfos, queuesRel, defaultConfigs);
918
+ const functionsDir = config.dir || "functions";
919
+ const updatedRegistry = await compileRegistryFromServerWorkers(layerInfos, functionsDir, defaultConfigs);
981
920
  lastCompiledRegistry = JSON.parse(JSON.stringify(defu(updatedRegistry, {
982
921
  version: 1,
983
922
  compiledAt: (/* @__PURE__ */ new Date()).toISOString(),
984
923
  provider: { name: config.queue.adapter === "postgres" ? "pgboss" : "bullmq" },
985
924
  logger: { name: "console", level: "info" },
986
- state: config.state,
987
- eventStore: config.eventStore,
988
925
  runner: { ts: { isolate: "inprocess" }, py: { enabled: false, cmd: "python3", importMode: "file" } },
989
- workers: [],
990
926
  flows: {},
991
927
  eventIndex: {}
992
928
  })));
@@ -1005,15 +941,15 @@ const module = defineNuxtModule({
1005
941
  console.log(`[nuxt-queue] templates updated`);
1006
942
  };
1007
943
  if (nuxt.options.dev) {
1008
- const queuesRel = config.dir || "queues";
944
+ const functionsDir = config.dir || "functions";
1009
945
  watchQueueFiles({
1010
946
  nuxt,
1011
947
  layerInfos,
1012
- queuesDir: queuesRel,
948
+ queuesDir: functionsDir,
1013
949
  onRefresh: refreshRegistry
1014
950
  });
1015
951
  }
1016
952
  }
1017
953
  });
1018
954
 
1019
- export { module as default };
955
+ export { module$1 as default };
@@ -0,0 +1,53 @@
1
+ /**
2
+ * File Queue Adapter
3
+ *
4
+ * File-based queue implementation for development/small deployments
5
+ * - Uses fastq for job processing (same as memory adapter)
6
+ * - Persists jobs to file system
7
+ * - Survives restarts
8
+ * - Single instance only (no distributed lock)
9
+ *
10
+ * Storage format:
11
+ * - {dataDir}/queues/{queueName}/jobs/{jobId}.json - Individual job files
12
+ * - Jobs are loaded on init and kept in memory with fastq
13
+ */
14
+ import type { QueueAdapter, JobInput, Job, JobsQuery, ScheduleOptions, JobCounts, QueueEvent, WorkerHandler, WorkerOptions } from '../interfaces/queue.js';
15
+ export interface FileQueueAdapterOptions {
16
+ dataDir: string;
17
+ maxQueueSize?: number;
18
+ }
19
+ export declare class FileQueueAdapter implements QueueAdapter {
20
+ private jobs;
21
+ private eventListeners;
22
+ private workers;
23
+ private scheduledJobs;
24
+ private options;
25
+ private initialized;
26
+ constructor(options: FileQueueAdapterOptions);
27
+ init(): Promise<void>;
28
+ private loadJobsFromDisk;
29
+ private persistJob;
30
+ private deleteJobFile;
31
+ enqueue(queueName: string, job: JobInput): Promise<string>;
32
+ schedule(queueName: string, job: JobInput, opts?: ScheduleOptions): Promise<string>;
33
+ getJob(_queueName: string, id: string): Promise<Job | null>;
34
+ getJobs(queueName: string, query?: JobsQuery): Promise<Job[]>;
35
+ on(queueName: string, event: QueueEvent, callback: (payload: any) => void): () => void;
36
+ isPaused(queueName: string): Promise<boolean>;
37
+ getJobCounts(queueName: string): Promise<JobCounts>;
38
+ getScheduledJobs(queueName: string): Promise<Array<any>>;
39
+ removeScheduledJob(scheduleId: string): Promise<boolean>;
40
+ pause(queueName: string): Promise<void>;
41
+ resume(queueName: string): Promise<void>;
42
+ close(): Promise<void>;
43
+ registerWorker(queueName: string, jobName: string, handler: WorkerHandler, opts?: WorkerOptions): void;
44
+ /**
45
+ * Start processing waiting jobs for a queue
46
+ * Should be called after all handlers are registered
47
+ */
48
+ startProcessingQueue(queueName: string): void;
49
+ private updateJobState;
50
+ private emitEvent;
51
+ private generateId;
52
+ private scheduleCronJob;
53
+ }