nvent 0.4.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 (192) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +389 -0
  3. package/dist/module.d.mts +193 -0
  4. package/dist/module.json +9 -0
  5. package/dist/module.mjs +974 -0
  6. package/dist/runtime/app/components/ConfirmDialog.d.vue.ts +33 -0
  7. package/dist/runtime/app/components/ConfirmDialog.vue +121 -0
  8. package/dist/runtime/app/components/ConfirmDialog.vue.d.ts +33 -0
  9. package/dist/runtime/app/components/FlowDiagram.d.vue.ts +64 -0
  10. package/dist/runtime/app/components/FlowDiagram.vue +338 -0
  11. package/dist/runtime/app/components/FlowDiagram.vue.d.ts +64 -0
  12. package/dist/runtime/app/components/FlowNodeCard.d.vue.ts +29 -0
  13. package/dist/runtime/app/components/FlowNodeCard.vue +156 -0
  14. package/dist/runtime/app/components/FlowNodeCard.vue.d.ts +29 -0
  15. package/dist/runtime/app/components/FlowRunOverview.d.vue.ts +9 -0
  16. package/dist/runtime/app/components/FlowRunOverview.vue +291 -0
  17. package/dist/runtime/app/components/FlowRunOverview.vue.d.ts +9 -0
  18. package/dist/runtime/app/components/FlowRunStatusBadge.d.vue.ts +14 -0
  19. package/dist/runtime/app/components/FlowRunStatusBadge.vue +60 -0
  20. package/dist/runtime/app/components/FlowRunStatusBadge.vue.d.ts +14 -0
  21. package/dist/runtime/app/components/FlowRunTimeline.d.vue.ts +12 -0
  22. package/dist/runtime/app/components/FlowRunTimeline.vue +127 -0
  23. package/dist/runtime/app/components/FlowRunTimeline.vue.d.ts +12 -0
  24. package/dist/runtime/app/components/FlowScheduleDialog.d.vue.ts +16 -0
  25. package/dist/runtime/app/components/FlowScheduleDialog.vue +226 -0
  26. package/dist/runtime/app/components/FlowScheduleDialog.vue.d.ts +16 -0
  27. package/dist/runtime/app/components/FlowSchedulesList.d.vue.ts +12 -0
  28. package/dist/runtime/app/components/FlowSchedulesList.vue +99 -0
  29. package/dist/runtime/app/components/FlowSchedulesList.vue.d.ts +12 -0
  30. package/dist/runtime/app/components/JobScheduling.d.vue.ts +6 -0
  31. package/dist/runtime/app/components/JobScheduling.vue +203 -0
  32. package/dist/runtime/app/components/JobScheduling.vue.d.ts +6 -0
  33. package/dist/runtime/app/components/ListItem.d.vue.ts +23 -0
  34. package/dist/runtime/app/components/ListItem.vue +70 -0
  35. package/dist/runtime/app/components/ListItem.vue.d.ts +23 -0
  36. package/dist/runtime/app/components/QueueConfigDetails.d.vue.ts +45 -0
  37. package/dist/runtime/app/components/QueueConfigDetails.vue +412 -0
  38. package/dist/runtime/app/components/QueueConfigDetails.vue.d.ts +45 -0
  39. package/dist/runtime/app/components/StatCounter.d.vue.ts +9 -0
  40. package/dist/runtime/app/components/StatCounter.vue +25 -0
  41. package/dist/runtime/app/components/StatCounter.vue.d.ts +9 -0
  42. package/dist/runtime/app/components/TimelineList.d.vue.ts +7 -0
  43. package/dist/runtime/app/components/TimelineList.vue +210 -0
  44. package/dist/runtime/app/components/TimelineList.vue.d.ts +7 -0
  45. package/dist/runtime/app/components/nhealth/component-router.d.vue.ts +46 -0
  46. package/dist/runtime/app/components/nhealth/component-router.vue +26 -0
  47. package/dist/runtime/app/components/nhealth/component-router.vue.d.ts +46 -0
  48. package/dist/runtime/app/components/nhealth/component-shell.d.vue.ts +24 -0
  49. package/dist/runtime/app/components/nhealth/component-shell.vue +89 -0
  50. package/dist/runtime/app/components/nhealth/component-shell.vue.d.ts +24 -0
  51. package/dist/runtime/app/composables/useAnalyzedFlows.d.ts +14 -0
  52. package/dist/runtime/app/composables/useAnalyzedFlows.js +7 -0
  53. package/dist/runtime/app/composables/useComponentRouter.d.ts +38 -0
  54. package/dist/runtime/app/composables/useComponentRouter.js +240 -0
  55. package/dist/runtime/app/composables/useFlowRunTimeline.d.ts +15 -0
  56. package/dist/runtime/app/composables/useFlowRunTimeline.js +66 -0
  57. package/dist/runtime/app/composables/useFlowRuns.d.ts +11 -0
  58. package/dist/runtime/app/composables/useFlowRuns.js +31 -0
  59. package/dist/runtime/app/composables/useFlowRunsInfinite.d.ts +24 -0
  60. package/dist/runtime/app/composables/useFlowRunsInfinite.js +123 -0
  61. package/dist/runtime/app/composables/useFlowRunsPolling.d.ts +8 -0
  62. package/dist/runtime/app/composables/useFlowRunsPolling.js +26 -0
  63. package/dist/runtime/app/composables/useFlowState.d.ts +125 -0
  64. package/dist/runtime/app/composables/useFlowState.js +211 -0
  65. package/dist/runtime/app/composables/useFlowWebSocket.d.ts +27 -0
  66. package/dist/runtime/app/composables/useFlowWebSocket.js +205 -0
  67. package/dist/runtime/app/composables/useFlowsNavigation.d.ts +10 -0
  68. package/dist/runtime/app/composables/useFlowsNavigation.js +57 -0
  69. package/dist/runtime/app/composables/useQueueJobs.d.ts +20 -0
  70. package/dist/runtime/app/composables/useQueueJobs.js +20 -0
  71. package/dist/runtime/app/composables/useQueueUpdates.d.ts +26 -0
  72. package/dist/runtime/app/composables/useQueueUpdates.js +122 -0
  73. package/dist/runtime/app/composables/useQueues.d.ts +43 -0
  74. package/dist/runtime/app/composables/useQueues.js +26 -0
  75. package/dist/runtime/app/composables/useQueuesLive.d.ts +19 -0
  76. package/dist/runtime/app/composables/useQueuesLive.js +143 -0
  77. package/dist/runtime/app/pages/flows/index.d.vue.ts +3 -0
  78. package/dist/runtime/app/pages/flows/index.vue +645 -0
  79. package/dist/runtime/app/pages/flows/index.vue.d.ts +3 -0
  80. package/dist/runtime/app/pages/index.d.vue.ts +3 -0
  81. package/dist/runtime/app/pages/index.vue +34 -0
  82. package/dist/runtime/app/pages/index.vue.d.ts +3 -0
  83. package/dist/runtime/app/pages/queues/index.d.vue.ts +3 -0
  84. package/dist/runtime/app/pages/queues/index.vue +229 -0
  85. package/dist/runtime/app/pages/queues/index.vue.d.ts +3 -0
  86. package/dist/runtime/app/pages/queues/job.d.vue.ts +3 -0
  87. package/dist/runtime/app/pages/queues/job.vue +262 -0
  88. package/dist/runtime/app/pages/queues/job.vue.d.ts +3 -0
  89. package/dist/runtime/app/pages/queues/jobs.d.vue.ts +3 -0
  90. package/dist/runtime/app/pages/queues/jobs.vue +291 -0
  91. package/dist/runtime/app/pages/queues/jobs.vue.d.ts +3 -0
  92. package/dist/runtime/app/plugins/vueflow.client.d.ts +6 -0
  93. package/dist/runtime/app/plugins/vueflow.client.js +15 -0
  94. package/dist/runtime/constants.d.ts +11 -0
  95. package/dist/runtime/constants.js +11 -0
  96. package/dist/runtime/python/get_config.py +64 -0
  97. package/dist/runtime/schema.d.ts +37 -0
  98. package/dist/runtime/schema.js +20 -0
  99. package/dist/runtime/server/api/_flows/[name]/clear-history.delete.d.ts +10 -0
  100. package/dist/runtime/server/api/_flows/[name]/clear-history.delete.js +44 -0
  101. package/dist/runtime/server/api/_flows/[name]/runs.get.d.ts +7 -0
  102. package/dist/runtime/server/api/_flows/[name]/runs.get.js +53 -0
  103. package/dist/runtime/server/api/_flows/[name]/schedule.post.d.ts +2 -0
  104. package/dist/runtime/server/api/_flows/[name]/schedule.post.js +57 -0
  105. package/dist/runtime/server/api/_flows/[name]/schedules/[id].delete.d.ts +2 -0
  106. package/dist/runtime/server/api/_flows/[name]/schedules/[id].delete.js +42 -0
  107. package/dist/runtime/server/api/_flows/[name]/schedules.get.d.ts +2 -0
  108. package/dist/runtime/server/api/_flows/[name]/schedules.get.js +48 -0
  109. package/dist/runtime/server/api/_flows/[name]/start.post.d.ts +2 -0
  110. package/dist/runtime/server/api/_flows/[name]/start.post.js +9 -0
  111. package/dist/runtime/server/api/_flows/index.get.d.ts +6 -0
  112. package/dist/runtime/server/api/_flows/index.get.js +5 -0
  113. package/dist/runtime/server/api/_flows/ws.d.ts +60 -0
  114. package/dist/runtime/server/api/_flows/ws.js +183 -0
  115. package/dist/runtime/server/api/_queues/[name]/job/[id].get.d.ts +2 -0
  116. package/dist/runtime/server/api/_queues/[name]/job/[id].get.js +9 -0
  117. package/dist/runtime/server/api/_queues/[name]/job/index.get.d.ts +2 -0
  118. package/dist/runtime/server/api/_queues/[name]/job/index.get.js +18 -0
  119. package/dist/runtime/server/api/_queues/index.get.d.ts +2 -0
  120. package/dist/runtime/server/api/_queues/index.get.js +63 -0
  121. package/dist/runtime/server/api/_queues/ws.d.ts +48 -0
  122. package/dist/runtime/server/api/_queues/ws.js +200 -0
  123. package/dist/runtime/server/events/adapters/fileAdapter.d.ts +2 -0
  124. package/dist/runtime/server/events/adapters/fileAdapter.js +382 -0
  125. package/dist/runtime/server/events/adapters/memoryAdapter.d.ts +2 -0
  126. package/dist/runtime/server/events/adapters/memoryAdapter.js +171 -0
  127. package/dist/runtime/server/events/adapters/redis/redisAdapter.d.ts +2 -0
  128. package/dist/runtime/server/events/adapters/redis/redisAdapter.js +348 -0
  129. package/dist/runtime/server/events/adapters/redis/redisPubSubGateway.d.ts +29 -0
  130. package/dist/runtime/server/events/adapters/redis/redisPubSubGateway.js +82 -0
  131. package/dist/runtime/server/events/eventBus.d.ts +20 -0
  132. package/dist/runtime/server/events/eventBus.js +35 -0
  133. package/dist/runtime/server/events/eventStoreFactory.d.ts +19 -0
  134. package/dist/runtime/server/events/eventStoreFactory.js +44 -0
  135. package/dist/runtime/server/events/streamNames.d.ts +17 -0
  136. package/dist/runtime/server/events/streamNames.js +17 -0
  137. package/dist/runtime/server/events/types.d.ts +63 -0
  138. package/dist/runtime/server/events/types.js +0 -0
  139. package/dist/runtime/server/events/wiring/flowWiring.d.ts +33 -0
  140. package/dist/runtime/server/events/wiring/flowWiring.js +406 -0
  141. package/dist/runtime/server/events/wiring/registry.d.ts +10 -0
  142. package/dist/runtime/server/events/wiring/registry.js +24 -0
  143. package/dist/runtime/server/plugins/00.event-store.d.ts +13 -0
  144. package/dist/runtime/server/plugins/00.event-store.js +16 -0
  145. package/dist/runtime/server/plugins/00.ws-lifecycle.d.ts +5 -0
  146. package/dist/runtime/server/plugins/00.ws-lifecycle.js +66 -0
  147. package/dist/runtime/server/plugins/flow-management.d.ts +13 -0
  148. package/dist/runtime/server/plugins/flow-management.js +65 -0
  149. package/dist/runtime/server/plugins/queue-management.d.ts +2 -0
  150. package/dist/runtime/server/plugins/queue-management.js +27 -0
  151. package/dist/runtime/server/plugins/state-cleanup.d.ts +11 -0
  152. package/dist/runtime/server/plugins/state-cleanup.js +93 -0
  153. package/dist/runtime/server/plugins/worker-management.d.ts +2 -0
  154. package/dist/runtime/server/plugins/worker-management.js +33 -0
  155. package/dist/runtime/server/queue/adapters/bullmq.d.ts +17 -0
  156. package/dist/runtime/server/queue/adapters/bullmq.js +164 -0
  157. package/dist/runtime/server/queue/queueFactory.d.ts +3 -0
  158. package/dist/runtime/server/queue/queueFactory.js +10 -0
  159. package/dist/runtime/server/queue/types.d.ts +47 -0
  160. package/dist/runtime/server/queue/types.js +0 -0
  161. package/dist/runtime/server/state/adapters/redis.d.ts +2 -0
  162. package/dist/runtime/server/state/adapters/redis.js +42 -0
  163. package/dist/runtime/server/state/stateFactory.d.ts +3 -0
  164. package/dist/runtime/server/state/stateFactory.js +17 -0
  165. package/dist/runtime/server/state/types.d.ts +23 -0
  166. package/dist/runtime/server/state/types.js +0 -0
  167. package/dist/runtime/server/tsconfig.json +3 -0
  168. package/dist/runtime/server/utils/defineQueueConfig.d.ts +154 -0
  169. package/dist/runtime/server/utils/defineQueueConfig.js +2 -0
  170. package/dist/runtime/server/utils/defineQueueWorker.d.ts +10 -0
  171. package/dist/runtime/server/utils/defineQueueWorker.js +17 -0
  172. package/dist/runtime/server/utils/useEventManager.d.ts +15 -0
  173. package/dist/runtime/server/utils/useEventManager.js +26 -0
  174. package/dist/runtime/server/utils/useEventStore.d.ts +20 -0
  175. package/dist/runtime/server/utils/useEventStore.js +119 -0
  176. package/dist/runtime/server/utils/useFlowEngine.d.ts +9 -0
  177. package/dist/runtime/server/utils/useFlowEngine.js +44 -0
  178. package/dist/runtime/server/utils/useLogs.d.ts +41 -0
  179. package/dist/runtime/server/utils/useLogs.js +74 -0
  180. package/dist/runtime/server/utils/useQueue.d.ts +31 -0
  181. package/dist/runtime/server/utils/useQueue.js +24 -0
  182. package/dist/runtime/server/utils/useServerLogger.d.ts +42 -0
  183. package/dist/runtime/server/utils/useServerLogger.js +54 -0
  184. package/dist/runtime/server/utils/wsPeerManager.d.ts +34 -0
  185. package/dist/runtime/server/utils/wsPeerManager.js +23 -0
  186. package/dist/runtime/server/worker/adapter.d.ts +4 -0
  187. package/dist/runtime/server/worker/adapter.js +65 -0
  188. package/dist/runtime/server/worker/runner/node.d.ts +27 -0
  189. package/dist/runtime/server/worker/runner/node.js +196 -0
  190. package/dist/runtime/types.d.ts +132 -0
  191. package/dist/types.d.mts +3 -0
  192. package/package.json +75 -0
@@ -0,0 +1,33 @@
1
+ interface Props {
2
+ title: string;
3
+ description?: string;
4
+ items?: string[];
5
+ warning?: string;
6
+ confirmLabel?: string;
7
+ cancelLabel?: string;
8
+ confirmColor?: 'primary' | 'error' | 'warning' | 'success';
9
+ icon?: string;
10
+ iconColor?: 'primary' | 'error' | 'warning' | 'success' | 'info';
11
+ loading?: boolean;
12
+ }
13
+ type __VLS_Props = Props;
14
+ type __VLS_ModelProps = {
15
+ 'open'?: boolean;
16
+ };
17
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
18
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
19
+ cancel: () => any;
20
+ "update:open": (value: boolean) => any;
21
+ confirm: () => any;
22
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
23
+ onCancel?: (() => any) | undefined;
24
+ "onUpdate:open"?: ((value: boolean) => any) | undefined;
25
+ onConfirm?: (() => any) | undefined;
26
+ }>, {
27
+ confirmLabel: string;
28
+ cancelLabel: string;
29
+ confirmColor: "primary" | "error" | "warning" | "success";
30
+ iconColor: "primary" | "error" | "warning" | "success" | "info";
31
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
32
+ declare const _default: typeof __VLS_export;
33
+ export default _default;
@@ -0,0 +1,121 @@
1
+ <template>
2
+ <UModal
3
+ v-model:open="isOpen"
4
+ :ui="{
5
+ content: 'max-w-md'
6
+ }"
7
+ >
8
+ <template #header>
9
+ <div class="flex items-start gap-3">
10
+ <div
11
+ v-if="icon"
12
+ class="shrink-0 rounded-full p-2"
13
+ :class="iconColorClasses"
14
+ >
15
+ <UIcon
16
+ :name="icon"
17
+ class="size-5"
18
+ />
19
+ </div>
20
+ <div class="flex-1 min-w-0">
21
+ <h3 class="text-base font-semibold text-gray-900 dark:text-gray-100">
22
+ {{ title }}
23
+ </h3>
24
+ </div>
25
+ </div>
26
+ </template>
27
+
28
+ <template #body>
29
+ <div class="space-y-3">
30
+ <p
31
+ v-if="description"
32
+ class="text-sm text-gray-600 dark:text-gray-400"
33
+ >
34
+ {{ description }}
35
+ </p>
36
+ <ul
37
+ v-if="items && items.length > 0"
38
+ class="space-y-2 text-sm text-gray-600 dark:text-gray-400"
39
+ >
40
+ <li
41
+ v-for="(item, index) in items"
42
+ :key="index"
43
+ class="flex items-start gap-2"
44
+ >
45
+ <UIcon
46
+ name="i-lucide-circle"
47
+ class="size-1.5 mt-1.5 shrink-0"
48
+ />
49
+ <span>{{ item }}</span>
50
+ </li>
51
+ </ul>
52
+ <p
53
+ v-if="warning"
54
+ class="text-sm font-medium text-amber-600 dark:text-amber-400"
55
+ >
56
+ {{ warning }}
57
+ </p>
58
+ </div>
59
+ </template>
60
+
61
+ <template #footer>
62
+ <div class="flex justify-end gap-2">
63
+ <UButton
64
+ color="neutral"
65
+ variant="ghost"
66
+ :disabled="loading"
67
+ @click="handleCancel"
68
+ >
69
+ {{ cancelLabel }}
70
+ </UButton>
71
+ <UButton
72
+ :color="confirmColor"
73
+ :loading="loading"
74
+ @click="handleConfirm"
75
+ >
76
+ {{ confirmLabel }}
77
+ </UButton>
78
+ </div>
79
+ </template>
80
+ </UModal>
81
+ </template>
82
+
83
+ <script setup>
84
+ import { computed } from "#imports";
85
+ import { UModal, UButton, UIcon } from "#components";
86
+ const props = defineProps({
87
+ title: { type: String, required: true },
88
+ description: { type: String, required: false },
89
+ items: { type: Array, required: false },
90
+ warning: { type: String, required: false },
91
+ confirmLabel: { type: String, required: false, default: "Confirm" },
92
+ cancelLabel: { type: String, required: false, default: "Cancel" },
93
+ confirmColor: { type: String, required: false, default: "primary" },
94
+ icon: { type: String, required: false },
95
+ iconColor: { type: String, required: false, default: "primary" },
96
+ loading: { type: Boolean, required: false }
97
+ });
98
+ const isOpen = defineModel("open", { type: Boolean, ...{ default: false } });
99
+ const emit = defineEmits(["confirm", "cancel"]);
100
+ const iconColorClasses = computed(() => {
101
+ switch (props.iconColor) {
102
+ case "error":
103
+ return "bg-red-50 dark:bg-red-950/50 text-red-600 dark:text-red-400";
104
+ case "warning":
105
+ return "bg-amber-50 dark:bg-amber-950/50 text-amber-600 dark:text-amber-400";
106
+ case "success":
107
+ return "bg-emerald-50 dark:bg-emerald-950/50 text-emerald-600 dark:text-emerald-400";
108
+ case "info":
109
+ return "bg-blue-50 dark:bg-blue-950/50 text-blue-600 dark:text-blue-400";
110
+ default:
111
+ return "bg-primary-50 dark:bg-primary-950/50 text-primary-600 dark:text-primary-400";
112
+ }
113
+ });
114
+ const handleConfirm = () => {
115
+ emit("confirm");
116
+ };
117
+ const handleCancel = () => {
118
+ isOpen.value = false;
119
+ emit("cancel");
120
+ };
121
+ </script>
@@ -0,0 +1,33 @@
1
+ interface Props {
2
+ title: string;
3
+ description?: string;
4
+ items?: string[];
5
+ warning?: string;
6
+ confirmLabel?: string;
7
+ cancelLabel?: string;
8
+ confirmColor?: 'primary' | 'error' | 'warning' | 'success';
9
+ icon?: string;
10
+ iconColor?: 'primary' | 'error' | 'warning' | 'success' | 'info';
11
+ loading?: boolean;
12
+ }
13
+ type __VLS_Props = Props;
14
+ type __VLS_ModelProps = {
15
+ 'open'?: boolean;
16
+ };
17
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
18
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
19
+ cancel: () => any;
20
+ "update:open": (value: boolean) => any;
21
+ confirm: () => any;
22
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
23
+ onCancel?: (() => any) | undefined;
24
+ "onUpdate:open"?: ((value: boolean) => any) | undefined;
25
+ onConfirm?: (() => any) | undefined;
26
+ }>, {
27
+ confirmLabel: string;
28
+ cancelLabel: string;
29
+ confirmColor: "primary" | "error" | "warning" | "success";
30
+ iconColor: "primary" | "error" | "warning" | "success" | "info";
31
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
32
+ declare const _default: typeof __VLS_export;
33
+ export default _default;
@@ -0,0 +1,64 @@
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;
@@ -0,0 +1,338 @@
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>
@@ -0,0 +1,64 @@
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;
@@ -0,0 +1,29 @@
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;