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
@@ -1,338 +0,0 @@
1
- <template>
2
- <div
3
- :class="heightClass"
4
- class="w-full border rounded bg-white/5"
5
- >
6
- <ClientOnly>
7
- <div class="relative h-full">
8
- <button
9
- v-if="flowId"
10
- class="absolute z-10 top-2 right-2 bg-gray-700 hover:bg-gray-600 text-white text-xs px-2 py-1 rounded"
11
- type="button"
12
- title="Reset layout"
13
- @click="resetLayout()"
14
- >
15
- Reset
16
- </button>
17
- <VueFlow
18
- ref="vueFlowRef"
19
- v-model:nodes="internalNodes"
20
- v-model:edges="internalEdges"
21
- :fit-view-on-init="true"
22
- class="h-full w-full"
23
- @node-click="onNodeClick"
24
- >
25
- <template #node-flow-step="{ id, data }">
26
- <FlowNodeCard
27
- :id="id"
28
- :data="data"
29
- kind="step"
30
- @action="onAction"
31
- />
32
- <Handle
33
- type="target"
34
- :position="Position.Top"
35
- />
36
- <Handle
37
- type="source"
38
- :position="Position.Bottom"
39
- />
40
- </template>
41
-
42
- <template #node-flow-entry="{ id, data }">
43
- <FlowNodeCard
44
- :id="id"
45
- :data="data"
46
- kind="entry"
47
- @action="onAction"
48
- />
49
- <Handle
50
- type="source"
51
- :position="Position.Bottom"
52
- />
53
- </template>
54
-
55
- <Background
56
- v-if="showBackground"
57
- pattern-color="#888"
58
- :gap="12"
59
- />
60
- <Controls v-if="showControls" />
61
- <MiniMap v-if="showMiniMap" />
62
- </VueFlow>
63
- </div>
64
- </ClientOnly>
65
- </div>
66
- </template>
67
-
68
- <script setup>
69
- import { computed, ref, watch, nextTick } from "#imports";
70
- import { Handle, Position } from "@vue-flow/core";
71
- import FlowNodeCard from "../components/FlowNodeCard.vue";
72
- const props = defineProps({
73
- flow: { type: [Object, null], required: false },
74
- heightClass: { type: String, required: false },
75
- showControls: { type: Boolean, required: false },
76
- showMiniMap: { type: Boolean, required: false },
77
- showBackground: { type: Boolean, required: false },
78
- stepStates: { type: Object, required: false }
79
- });
80
- const heightClass = computed(() => props.heightClass || "h-80");
81
- const emit = defineEmits(["nodeSelected", "nodeAction"]);
82
- const flowId = computed(() => props.flow?.id);
83
- const vueFlowRef = ref(null);
84
- const nodes = computed(() => {
85
- const out = [];
86
- const f = props.flow;
87
- if (!f) return out;
88
- const states = props.stepStates || {};
89
- const colWidth = 250;
90
- const rowHeight = 140;
91
- const horizontalGap = 50;
92
- const verticalGap = 80;
93
- const entryToStepsGap = 140;
94
- const nodeWidth = 220;
95
- let y = 0;
96
- if (f.entry) {
97
- const entryState = states[f.entry.step];
98
- const status = mapStatusToNodeStatus(entryState?.status);
99
- out.push({
100
- id: `entry:${f.entry.step}`,
101
- position: { x: -nodeWidth / 2, y },
102
- data: {
103
- label: f.entry.step,
104
- queue: f.entry.queue,
105
- status,
106
- attempt: entryState?.attempt,
107
- error: entryState?.error,
108
- runtime: f.entry.runtime,
109
- runtype: f.entry.runtype,
110
- emits: f.entry.emits
111
- },
112
- type: "flow-entry",
113
- style: { minWidth: `${nodeWidth}px` }
114
- });
115
- y += rowHeight + entryToStepsGap;
116
- }
117
- const steps = f.steps || {};
118
- if (f.analyzed?.levels && f.analyzed.levels.length > 0) {
119
- const levels = f.analyzed.levels.filter((level) => level.length > 0);
120
- levels.forEach((levelSteps) => {
121
- if (levelSteps.length === 0) return;
122
- const cols = Math.min(4, levelSteps.length);
123
- const rows = Math.ceil(levelSteps.length / cols);
124
- levelSteps.forEach((stepName, idx) => {
125
- const step = steps[stepName];
126
- if (!step) return;
127
- const stepState = states[stepName];
128
- const status = mapStatusToNodeStatus(stepState?.status);
129
- const col = idx % cols;
130
- const row = Math.floor(idx / cols);
131
- const remainingInLevel = levelSteps.length - row * cols;
132
- const nodesInThisRow = Math.min(cols, remainingInLevel);
133
- const rowWidth = nodesInThisRow * colWidth + (nodesInThisRow - 1) * horizontalGap;
134
- const rowStartX = -rowWidth / 2;
135
- const x = rowStartX + col * (colWidth + horizontalGap);
136
- const yPos = y + row * (rowHeight + verticalGap);
137
- out.push({
138
- id: `step:${stepName}`,
139
- position: { x, y: yPos },
140
- data: {
141
- label: stepName,
142
- queue: step?.queue,
143
- workerId: step?.workerId,
144
- status,
145
- attempt: stepState?.attempt,
146
- error: stepState?.error,
147
- runtime: step?.runtime,
148
- runtype: step?.runtype,
149
- emits: step?.emits
150
- },
151
- type: "flow-step",
152
- style: { minWidth: `${nodeWidth}px` }
153
- });
154
- });
155
- y += rows * (rowHeight + verticalGap);
156
- });
157
- } else {
158
- const names = Object.keys(steps);
159
- const cols = 3;
160
- names.forEach((name, idx) => {
161
- const step = steps[name];
162
- const stepState = states[name];
163
- const status = mapStatusToNodeStatus(stepState?.status);
164
- const col = idx % cols;
165
- const row = Math.floor(idx / cols);
166
- const totalRows = Math.ceil(names.length / cols);
167
- const isLastRow = row === totalRows - 1;
168
- const nodesInThisRow = isLastRow ? names.length % cols || cols : cols;
169
- const rowWidth = nodesInThisRow * colWidth + (nodesInThisRow - 1) * horizontalGap;
170
- const rowStartX = -rowWidth / 2;
171
- const x = rowStartX + col * (colWidth + horizontalGap);
172
- const yPos = y + row * (rowHeight + verticalGap);
173
- out.push({
174
- id: `step:${name}`,
175
- position: { x, y: yPos },
176
- data: {
177
- label: name,
178
- queue: step?.queue,
179
- workerId: step?.workerId,
180
- status,
181
- attempt: stepState?.attempt,
182
- error: stepState?.error,
183
- runtime: step?.runtime,
184
- runtype: step?.runtype,
185
- emits: step?.emits
186
- },
187
- type: "flow-step",
188
- style: { minWidth: `${nodeWidth}px` }
189
- });
190
- });
191
- }
192
- return out;
193
- });
194
- function mapStatusToNodeStatus(status) {
195
- switch (status) {
196
- case "running":
197
- case "retrying":
198
- case "waiting":
199
- return "running";
200
- case "completed":
201
- return "done";
202
- case "failed":
203
- case "timeout":
204
- return "error";
205
- default:
206
- return "idle";
207
- }
208
- }
209
- const edges = computed(() => {
210
- const f = props.flow;
211
- if (!f) return [];
212
- const states = props.stepStates || {};
213
- const added = /* @__PURE__ */ new Set();
214
- const out = [];
215
- function addEdge(source, target, label) {
216
- const id = `${source}->${target}${label ? `:${label}` : ""}`;
217
- if (added.has(id)) return;
218
- const sourceStep = source.split(":")[1];
219
- const targetStep = target.split(":")[1];
220
- const sourceState = sourceStep ? states[sourceStep] : void 0;
221
- const targetState = targetStep ? states[targetStep] : void 0;
222
- const animated = sourceState?.status === "completed" && (targetState?.status === "running" || targetState?.status === "pending" || !targetState);
223
- added.add(id);
224
- out.push({ id, source, target, label, animated });
225
- }
226
- if (f.analyzed?.steps) {
227
- const analyzedSteps = f.analyzed.steps;
228
- for (const [stepName, stepInfo] of Object.entries(analyzedSteps)) {
229
- const target = `step:${stepName}`;
230
- if (stepInfo.dependsOn.length > 0) {
231
- for (const depName of stepInfo.dependsOn) {
232
- const source = depName === f.entry?.step ? `entry:${depName}` : `step:${depName}`;
233
- addEdge(source, target);
234
- }
235
- } else if (f.entry) {
236
- addEdge(`entry:${f.entry.step}`, target);
237
- }
238
- }
239
- } else {
240
- console.warn("[FlowDiagram] No analyzed data available for edges");
241
- }
242
- return out;
243
- });
244
- const internalNodes = ref([]);
245
- const internalEdges = ref([]);
246
- function storageKey(flowId2) {
247
- return flowId2 ? `flow-layout:${flowId2}` : "flow-layout:unknown";
248
- }
249
- function applySavedPositions(nodesIn, flowId2) {
250
- if (!flowId2) return nodesIn;
251
- try {
252
- const raw = localStorage.getItem(storageKey(flowId2));
253
- if (!raw) return nodesIn;
254
- const saved = JSON.parse(raw);
255
- const byId = new Map(saved.map((s) => [s.id, s]));
256
- nodesIn.forEach((n) => {
257
- const s = byId.get(n.id);
258
- if (s) n.position = { x: s.x, y: s.y };
259
- });
260
- } catch {
261
- }
262
- return nodesIn;
263
- }
264
- function savePositionsDebounced(flowId2) {
265
- if (!flowId2) return;
266
- const payload = internalNodes.value.map((n) => ({ id: n.id, x: n.position.x, y: n.position.y }));
267
- try {
268
- localStorage.setItem(storageKey(flowId2), JSON.stringify(payload));
269
- } catch {
270
- }
271
- }
272
- watch(() => props.flow, (f) => {
273
- if (!f) {
274
- internalNodes.value = [];
275
- internalEdges.value = [];
276
- return;
277
- }
278
- const builtNodes = nodes.value.map((n) => ({ id: n.id, position: { ...n.position }, data: { ...n.data }, type: n.type, style: n.style }));
279
- const builtEdges = edges.value.map((e) => ({ id: e.id, source: e.source, target: e.target, label: e.label, animated: e.animated }));
280
- applySavedPositions(builtNodes, f.id);
281
- internalNodes.value = builtNodes;
282
- internalEdges.value = builtEdges;
283
- setTimeout(() => {
284
- if (vueFlowRef.value) {
285
- vueFlowRef.value.fitView({ padding: 0.2, duration: 200 });
286
- }
287
- }, 100);
288
- }, { immediate: true, deep: false });
289
- watch(() => props.stepStates, () => {
290
- if (!props.flow) return;
291
- const builtNodes = nodes.value.map((n) => ({ id: n.id, position: { ...n.position }, data: { ...n.data }, type: n.type, style: n.style }));
292
- const positionMap = new Map(internalNodes.value.map((n) => [n.id, n.position]));
293
- builtNodes.forEach((n) => {
294
- const existing = positionMap.get(n.id);
295
- if (existing) n.position = existing;
296
- });
297
- internalNodes.value = builtNodes;
298
- const builtEdges = edges.value.map((e) => ({ id: e.id, source: e.source, target: e.target, label: e.label, animated: e.animated }));
299
- internalEdges.value = builtEdges;
300
- }, { deep: true });
301
- watch(internalNodes, () => savePositionsDebounced(props.flow?.id), { deep: true });
302
- function onNodeClick(evt) {
303
- const id = evt?.node?.id || evt?.id;
304
- if (id) emit("nodeSelected", { id });
305
- }
306
- function onAction(payload) {
307
- emit("nodeAction", payload);
308
- }
309
- function resetLayout() {
310
- const id = flowId.value;
311
- if (!id) return;
312
- try {
313
- localStorage.removeItem(storageKey(id));
314
- } catch {
315
- }
316
- const freshNodes = nodes.value.map((n) => ({
317
- id: n.id,
318
- position: { x: n.position.x, y: n.position.y },
319
- data: { ...n.data },
320
- type: n.type,
321
- style: n.style
322
- }));
323
- internalNodes.value = freshNodes;
324
- nextTick(() => {
325
- if (vueFlowRef.value) {
326
- vueFlowRef.value.fitView({
327
- padding: 0.2,
328
- includeHiddenNodes: false,
329
- duration: 300
330
- });
331
- }
332
- });
333
- }
334
- </script>
335
-
336
- <style scoped>
337
- :deep(.vue-flow__node){background:transparent;border:none;box-shadow:none;display:inline-block;overflow:visible;padding:0}:deep(.vue-flow__node-input){border:none}:deep(.vue-flow__node.selected),:deep(.vue-flow__node:focus){border:none;box-shadow:none;outline:none}
338
- </style>
@@ -1,64 +0,0 @@
1
- interface FlowEntry {
2
- step: string;
3
- queue: string;
4
- workerId: string;
5
- runtime?: 'nodejs' | 'python';
6
- runtype?: 'inprocess' | 'task';
7
- emits?: string[];
8
- }
9
- interface FlowStep {
10
- queue: string;
11
- workerId: string;
12
- subscribes?: string[];
13
- runtime?: 'nodejs' | 'python';
14
- runtype?: 'inprocess' | 'task';
15
- emits?: string[];
16
- }
17
- interface AnalyzedStep extends FlowStep {
18
- name: string;
19
- dependsOn: string[];
20
- triggers: string[];
21
- level: number;
22
- }
23
- interface FlowMeta {
24
- id: string;
25
- entry?: FlowEntry;
26
- steps?: Record<string, FlowStep>;
27
- analyzed?: {
28
- levels: string[][];
29
- maxLevel: number;
30
- steps: Record<string, AnalyzedStep>;
31
- };
32
- }
33
- interface StepStatus {
34
- status: 'pending' | 'running' | 'completed' | 'failed' | 'retrying' | 'waiting' | 'timeout';
35
- attempt?: number;
36
- error?: string;
37
- }
38
- type __VLS_Props = {
39
- flow?: FlowMeta | null;
40
- heightClass?: string;
41
- showControls?: boolean;
42
- showMiniMap?: boolean;
43
- showBackground?: boolean;
44
- stepStates?: Record<string, StepStatus>;
45
- };
46
- declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
47
- nodeSelected: (payload: {
48
- id: string;
49
- }) => any;
50
- nodeAction: (payload: {
51
- id: string;
52
- action: "run" | "logs" | "details";
53
- }) => any;
54
- }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
55
- onNodeSelected?: ((payload: {
56
- id: string;
57
- }) => any) | undefined;
58
- onNodeAction?: ((payload: {
59
- id: string;
60
- action: "run" | "logs" | "details";
61
- }) => any) | undefined;
62
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
63
- declare const _default: typeof __VLS_export;
64
- export default _default;
@@ -1,29 +0,0 @@
1
- type Status = 'idle' | 'running' | 'error' | 'done' | string | undefined;
2
- type __VLS_Props = {
3
- id: string;
4
- data: {
5
- label?: string;
6
- queue?: string;
7
- workerId?: string;
8
- status?: Status;
9
- attempt?: number;
10
- error?: string;
11
- runtime?: 'nodejs' | 'python';
12
- runtype?: 'inprocess' | 'task';
13
- emits?: string[];
14
- };
15
- kind?: 'entry' | 'step';
16
- };
17
- declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
18
- action: (payload: {
19
- id: string;
20
- action: "run" | "logs" | "details";
21
- }) => any;
22
- }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
23
- onAction?: ((payload: {
24
- id: string;
25
- action: "run" | "logs" | "details";
26
- }) => any) | undefined;
27
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
28
- declare const _default: typeof __VLS_export;
29
- export default _default;
@@ -1,156 +0,0 @@
1
- <template>
2
- <UCard
3
- class="min-w-[220px] max-w-[300px]"
4
- :ui="{
5
- body: 'p-0',
6
- header: headerClass,
7
- footer: footerClass
8
- }"
9
- >
10
- <template #header>
11
- <div class="flex items-center justify-between gap-2">
12
- <div class="flex items-center gap-2 min-w-0">
13
- <UIcon
14
- v-if="runnerIcon"
15
- :name="runnerIcon"
16
- class="size-4 flex-shrink-0"
17
- :title="data?.workerId"
18
- />
19
- <p
20
- class="truncate font-medium"
21
- :title="data?.label"
22
- >
23
- {{ data?.label }}
24
- </p>
25
- </div>
26
- <UBadge
27
- :label="(data?.status || 'idle').toUpperCase()"
28
- size="xs"
29
- :color="statusColor(data?.status)"
30
- />
31
- </div>
32
- </template>
33
-
34
- <div class="px-3 py-2 text-xs space-y-1">
35
- <div class="flex items-center justify-between">
36
- <span class="text-gray-500 dark:text-gray-400">Queue</span>
37
- <span
38
- class="truncate ml-2 font-mono"
39
- :title="data?.queue"
40
- >{{ data?.queue || "-" }}</span>
41
- </div>
42
- <div class="flex items-center justify-between">
43
- <span class="text-gray-500 dark:text-gray-400">Worker</span>
44
- <span
45
- class="truncate ml-2 font-mono"
46
- :title="data?.workerId"
47
- >{{ data?.workerId || "-" }}</span>
48
- </div>
49
- <div
50
- v-if="data?.runtype"
51
- class="flex items-center justify-between"
52
- >
53
- <span class="text-gray-500 dark:text-gray-400">Mode</span>
54
- <UBadge
55
- :label="data.runtype"
56
- size="xs"
57
- color="neutral"
58
- variant="soft"
59
- />
60
- </div>
61
- <div
62
- v-if="data?.emits && data.emits.length > 0"
63
- class="flex items-start justify-between gap-2"
64
- >
65
- <span class="text-gray-500 dark:text-gray-400">Emits</span>
66
- <div class="flex flex-wrap gap-1 justify-end">
67
- <UBadge
68
- v-for="event in data.emits"
69
- :key="event"
70
- :label="event"
71
- size="xs"
72
- color="primary"
73
- variant="soft"
74
- />
75
- </div>
76
- </div>
77
- <div
78
- v-if="data?.attempt && data.attempt > 1"
79
- class="flex items-center justify-between"
80
- >
81
- <span class="text-gray-500 dark:text-gray-400">Attempts</span>
82
- <span class="ml-2 font-medium text-amber-600 dark:text-amber-400">
83
- {{ data.attempt }}
84
- </span>
85
- </div>
86
- <div
87
- v-if="data?.error"
88
- class="pt-1 border-t border-gray-200 dark:border-gray-700"
89
- >
90
- <span
91
- class="text-red-500 dark:text-red-400 block truncate"
92
- :title="data.error"
93
- >
94
- ⚠️ {{ data.error }}
95
- </span>
96
- </div>
97
- </div>
98
-
99
- <template #footer>
100
- <div class="flex items-center justify-center gap-2 w-full">
101
- <UButton
102
- size="xs"
103
- color="neutral"
104
- label="Logs"
105
- icon="i-heroicons-document-text-20-solid"
106
- @click="handleAction('logs')"
107
- />
108
- <UButton
109
- size="xs"
110
- color="neutral"
111
- label="Details"
112
- icon="i-heroicons-information-circle-20-solid"
113
- @click="handleAction('details')"
114
- />
115
- </div>
116
- </template>
117
- </UCard>
118
- </template>
119
-
120
- <script setup>
121
- import { computed } from "#imports";
122
- import { UCard, UButton, UBadge, UIcon } from "#components";
123
- const props = defineProps({
124
- id: { type: String, required: true },
125
- data: { type: Object, required: true },
126
- kind: { type: String, required: false }
127
- });
128
- const emit = defineEmits(["action"]);
129
- function handleAction(action) {
130
- emit("action", { id: props.id, action });
131
- }
132
- const headerClass = computed(() => props.kind === "entry" ? "px-3 py-2 bg-gradient-to-br from-emerald-800 to-emerald-700 text-emerald-50 rounded-t" : "px-3 py-2 bg-gradient-to-br from-gray-800 to-gray-700 text-gray-100 rounded-t");
133
- const footerClass = computed(() => props.kind === "entry" ? "px-3 pb-2 pt-1" : "px-3 pb-2 pt-1");
134
- const runnerIcon = computed(() => {
135
- const runtime = props.data?.runtime;
136
- if (runtime === "python") {
137
- return "i-devicon-python";
138
- }
139
- if (runtime === "nodejs") {
140
- return "i-devicon-nodejs";
141
- }
142
- return runtime ? "i-lucide-code" : void 0;
143
- });
144
- function statusColor(status) {
145
- switch (status) {
146
- case "running":
147
- return "warning";
148
- case "done":
149
- return "success";
150
- case "error":
151
- return "error";
152
- default:
153
- return "neutral";
154
- }
155
- }
156
- </script>
@@ -1,29 +0,0 @@
1
- type Status = 'idle' | 'running' | 'error' | 'done' | string | undefined;
2
- type __VLS_Props = {
3
- id: string;
4
- data: {
5
- label?: string;
6
- queue?: string;
7
- workerId?: string;
8
- status?: Status;
9
- attempt?: number;
10
- error?: string;
11
- runtime?: 'nodejs' | 'python';
12
- runtype?: 'inprocess' | 'task';
13
- emits?: string[];
14
- };
15
- kind?: 'entry' | 'step';
16
- };
17
- declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
18
- action: (payload: {
19
- id: string;
20
- action: "run" | "logs" | "details";
21
- }) => any;
22
- }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
23
- onAction?: ((payload: {
24
- id: string;
25
- action: "run" | "logs" | "details";
26
- }) => any) | undefined;
27
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
28
- declare const _default: typeof __VLS_export;
29
- export default _default;
@@ -1,9 +0,0 @@
1
- type __VLS_Props = {
2
- runStatus?: string;
3
- startedAt?: string;
4
- completedAt?: string;
5
- steps: any[];
6
- };
7
- declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
8
- declare const _default: typeof __VLS_export;
9
- export default _default;