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.
- package/dist/module.d.mts +3 -184
- package/dist/module.json +3 -3
- package/dist/module.mjs +133 -197
- package/dist/runtime/adapters/builtin/file-queue.d.ts +53 -0
- package/dist/runtime/adapters/builtin/file-queue.js +435 -0
- package/dist/runtime/adapters/builtin/file-store.d.ts +46 -0
- package/dist/runtime/adapters/builtin/file-store.js +225 -0
- package/dist/runtime/adapters/builtin/file-stream.d.ts +39 -0
- package/dist/runtime/adapters/builtin/file-stream.js +56 -0
- package/dist/runtime/adapters/builtin/index.d.ts +10 -0
- package/dist/runtime/adapters/builtin/index.js +5 -0
- package/dist/runtime/adapters/builtin/memory-queue.d.ts +52 -0
- package/dist/runtime/adapters/builtin/memory-queue.js +239 -0
- package/dist/runtime/adapters/builtin/memory-store.d.ts +57 -0
- package/dist/runtime/adapters/builtin/memory-store.js +263 -0
- package/dist/runtime/adapters/builtin/memory-stream.d.ts +21 -0
- package/dist/runtime/adapters/builtin/memory-stream.js +56 -0
- package/dist/runtime/adapters/factory.d.ts +31 -0
- package/dist/runtime/adapters/factory.js +100 -0
- package/dist/runtime/adapters/index.d.ts +8 -0
- package/dist/runtime/adapters/index.js +3 -0
- package/dist/runtime/adapters/interfaces/index.d.ts +11 -0
- package/dist/runtime/adapters/interfaces/index.js +3 -0
- package/dist/runtime/adapters/interfaces/queue.d.ts +150 -0
- package/dist/runtime/adapters/interfaces/store.d.ts +233 -0
- package/dist/runtime/adapters/interfaces/stream.d.ts +62 -0
- package/dist/runtime/adapters/registry.d.ts +85 -0
- package/dist/runtime/adapters/registry.js +161 -0
- package/dist/runtime/config/index.d.ts +29 -0
- package/dist/runtime/config/index.js +167 -0
- package/dist/runtime/config/types.d.ts +367 -0
- package/dist/runtime/config/types.js +0 -0
- package/dist/runtime/events/types.d.ts +116 -0
- package/dist/runtime/events/types.js +0 -0
- package/dist/runtime/events/utils/stallDetector.d.ts +99 -0
- package/dist/runtime/events/utils/stallDetector.js +237 -0
- package/dist/runtime/{server-utils/events → events}/wiring/flowWiring.d.ts +3 -8
- package/dist/runtime/{server-utils/events → events}/wiring/flowWiring.js +119 -36
- package/dist/runtime/events/wiring/registry.d.ts +19 -0
- package/dist/runtime/events/wiring/registry.js +33 -0
- package/dist/runtime/events/wiring/stateWiring.d.ts +37 -0
- package/dist/runtime/events/wiring/stateWiring.js +92 -0
- package/dist/runtime/events/wiring/streamWiring.d.ts +32 -0
- package/dist/runtime/events/wiring/streamWiring.js +79 -0
- package/dist/runtime/server/api/_flows/[name]/clear-history.delete.js +16 -5
- package/dist/runtime/server/api/_flows/[name]/runs/[runId]/cancel.post.js +21 -0
- package/dist/runtime/server/api/_flows/[name]/runs.get.d.ts +12 -2
- package/dist/runtime/server/api/_flows/[name]/runs.get.js +15 -4
- package/dist/runtime/server/api/_flows/[name]/schedule.post.js +11 -2
- package/dist/runtime/server/api/_flows/[name]/schedules/[id].delete.js +21 -16
- package/dist/runtime/server/api/_flows/[name]/schedules.get.js +21 -19
- package/dist/runtime/server/api/_flows/ws.js +43 -22
- package/dist/runtime/server/api/_queues/[name]/job/[id].get.js +8 -3
- package/dist/runtime/server/api/_queues/[name]/job/index.get.js +12 -3
- package/dist/runtime/server/api/_queues/index.get.js +66 -23
- package/dist/runtime/server/api/_queues/ws.js +14 -4
- package/dist/runtime/server/plugins/00.adapters.d.ts +14 -0
- package/dist/runtime/server/plugins/00.adapters.js +69 -0
- package/dist/runtime/server/plugins/02.workers.js +45 -0
- package/dist/runtime/tsconfig.json +8 -0
- package/dist/runtime/utils/adapters.d.ts +66 -0
- package/dist/runtime/utils/adapters.js +51 -0
- package/dist/runtime/utils/defineFunction.d.ts +10 -0
- package/dist/runtime/{server-utils/utils/defineQueueWorker.js → utils/defineFunction.js} +4 -4
- package/dist/runtime/{server-utils/utils/defineQueueConfig.d.ts → utils/defineFunctionConfig.d.ts} +3 -3
- package/dist/runtime/utils/defineFunctionConfig.js +2 -0
- package/dist/runtime/utils/registerAdapter.d.ts +59 -0
- package/dist/runtime/utils/registerAdapter.js +13 -0
- package/dist/runtime/utils/useFlowEngine.d.ts +19 -0
- package/dist/runtime/utils/useFlowEngine.js +108 -0
- package/dist/runtime/{server-utils/utils → utils}/useNventLogger.js +2 -2
- package/dist/runtime/utils/useStreamTopics.d.ts +72 -0
- package/dist/runtime/utils/useStreamTopics.js +47 -0
- package/dist/runtime/{server-utils/worker/runner/node.d.ts → worker/node/runner.d.ts} +18 -2
- package/dist/runtime/{server-utils/worker/runner/node.js → worker/node/runner.js} +44 -17
- package/dist/types.d.mts +2 -2
- package/package.json +14 -44
- package/LICENSE +0 -21
- package/README.md +0 -389
- package/dist/runtime/app/assets/vueflow.css +0 -1
- package/dist/runtime/app/components/ConfirmDialog.d.vue.ts +0 -33
- package/dist/runtime/app/components/ConfirmDialog.vue +0 -121
- package/dist/runtime/app/components/ConfirmDialog.vue.d.ts +0 -33
- package/dist/runtime/app/components/FlowDiagram.d.vue.ts +0 -64
- package/dist/runtime/app/components/FlowDiagram.vue +0 -338
- package/dist/runtime/app/components/FlowDiagram.vue.d.ts +0 -64
- package/dist/runtime/app/components/FlowNodeCard.d.vue.ts +0 -29
- package/dist/runtime/app/components/FlowNodeCard.vue +0 -156
- package/dist/runtime/app/components/FlowNodeCard.vue.d.ts +0 -29
- package/dist/runtime/app/components/FlowRunOverview.d.vue.ts +0 -9
- package/dist/runtime/app/components/FlowRunOverview.vue +0 -291
- package/dist/runtime/app/components/FlowRunOverview.vue.d.ts +0 -9
- package/dist/runtime/app/components/FlowRunStatusBadge.d.vue.ts +0 -14
- package/dist/runtime/app/components/FlowRunStatusBadge.vue +0 -60
- package/dist/runtime/app/components/FlowRunStatusBadge.vue.d.ts +0 -14
- package/dist/runtime/app/components/FlowRunTimeline.d.vue.ts +0 -12
- package/dist/runtime/app/components/FlowRunTimeline.vue +0 -127
- package/dist/runtime/app/components/FlowRunTimeline.vue.d.ts +0 -12
- package/dist/runtime/app/components/FlowScheduleDialog.d.vue.ts +0 -16
- package/dist/runtime/app/components/FlowScheduleDialog.vue +0 -226
- package/dist/runtime/app/components/FlowScheduleDialog.vue.d.ts +0 -16
- package/dist/runtime/app/components/FlowSchedulesList.d.vue.ts +0 -12
- package/dist/runtime/app/components/FlowSchedulesList.vue +0 -99
- package/dist/runtime/app/components/FlowSchedulesList.vue.d.ts +0 -12
- package/dist/runtime/app/components/JobScheduling.d.vue.ts +0 -6
- package/dist/runtime/app/components/JobScheduling.vue +0 -203
- package/dist/runtime/app/components/JobScheduling.vue.d.ts +0 -6
- package/dist/runtime/app/components/ListItem.d.vue.ts +0 -23
- package/dist/runtime/app/components/ListItem.vue +0 -70
- package/dist/runtime/app/components/ListItem.vue.d.ts +0 -23
- package/dist/runtime/app/components/QueueConfigDetails.d.vue.ts +0 -45
- package/dist/runtime/app/components/QueueConfigDetails.vue +0 -412
- package/dist/runtime/app/components/QueueConfigDetails.vue.d.ts +0 -45
- package/dist/runtime/app/components/StatCounter.d.vue.ts +0 -9
- package/dist/runtime/app/components/StatCounter.vue +0 -25
- package/dist/runtime/app/components/StatCounter.vue.d.ts +0 -9
- package/dist/runtime/app/components/TimelineList.d.vue.ts +0 -7
- package/dist/runtime/app/components/TimelineList.vue +0 -210
- package/dist/runtime/app/components/TimelineList.vue.d.ts +0 -7
- package/dist/runtime/app/components/nhealth/component-router.d.vue.ts +0 -46
- package/dist/runtime/app/components/nhealth/component-router.vue +0 -26
- package/dist/runtime/app/components/nhealth/component-router.vue.d.ts +0 -46
- package/dist/runtime/app/components/nhealth/component-shell.d.vue.ts +0 -24
- package/dist/runtime/app/components/nhealth/component-shell.vue +0 -89
- package/dist/runtime/app/components/nhealth/component-shell.vue.d.ts +0 -24
- package/dist/runtime/app/composables/useAnalyzedFlows.d.ts +0 -14
- package/dist/runtime/app/composables/useAnalyzedFlows.js +0 -8
- package/dist/runtime/app/composables/useComponentRouter.d.ts +0 -38
- package/dist/runtime/app/composables/useComponentRouter.js +0 -240
- package/dist/runtime/app/composables/useFlowRunTimeline.d.ts +0 -15
- package/dist/runtime/app/composables/useFlowRunTimeline.js +0 -66
- package/dist/runtime/app/composables/useFlowRuns.d.ts +0 -18
- package/dist/runtime/app/composables/useFlowRuns.js +0 -32
- package/dist/runtime/app/composables/useFlowRunsInfinite.d.ts +0 -24
- package/dist/runtime/app/composables/useFlowRunsInfinite.js +0 -123
- package/dist/runtime/app/composables/useFlowRunsPolling.d.ts +0 -9
- package/dist/runtime/app/composables/useFlowRunsPolling.js +0 -33
- package/dist/runtime/app/composables/useFlowState.d.ts +0 -125
- package/dist/runtime/app/composables/useFlowState.js +0 -211
- package/dist/runtime/app/composables/useFlowWebSocket.d.ts +0 -27
- package/dist/runtime/app/composables/useFlowWebSocket.js +0 -205
- package/dist/runtime/app/composables/useFlowsNavigation.d.ts +0 -10
- package/dist/runtime/app/composables/useFlowsNavigation.js +0 -58
- package/dist/runtime/app/composables/useQueueJobs.d.ts +0 -20
- package/dist/runtime/app/composables/useQueueJobs.js +0 -20
- package/dist/runtime/app/composables/useQueueUpdates.d.ts +0 -26
- package/dist/runtime/app/composables/useQueueUpdates.js +0 -122
- package/dist/runtime/app/composables/useQueues.d.ts +0 -44
- package/dist/runtime/app/composables/useQueues.js +0 -26
- package/dist/runtime/app/composables/useQueuesLive.d.ts +0 -19
- package/dist/runtime/app/composables/useQueuesLive.js +0 -143
- package/dist/runtime/app/pages/flows/index.d.vue.ts +0 -3
- package/dist/runtime/app/pages/flows/index.vue +0 -645
- package/dist/runtime/app/pages/flows/index.vue.d.ts +0 -3
- package/dist/runtime/app/pages/index.d.vue.ts +0 -3
- package/dist/runtime/app/pages/index.vue +0 -34
- package/dist/runtime/app/pages/index.vue.d.ts +0 -3
- package/dist/runtime/app/pages/queues/index.d.vue.ts +0 -3
- package/dist/runtime/app/pages/queues/index.vue +0 -229
- package/dist/runtime/app/pages/queues/index.vue.d.ts +0 -3
- package/dist/runtime/app/pages/queues/job.d.vue.ts +0 -3
- package/dist/runtime/app/pages/queues/job.vue +0 -262
- package/dist/runtime/app/pages/queues/job.vue.d.ts +0 -3
- package/dist/runtime/app/pages/queues/jobs.d.vue.ts +0 -3
- package/dist/runtime/app/pages/queues/jobs.vue +0 -291
- package/dist/runtime/app/pages/queues/jobs.vue.d.ts +0 -3
- package/dist/runtime/app/plugins/vueflow.client.d.ts +0 -2
- package/dist/runtime/app/plugins/vueflow.client.js +0 -11
- package/dist/runtime/constants.d.ts +0 -11
- package/dist/runtime/constants.js +0 -11
- package/dist/runtime/schema.d.ts +0 -37
- package/dist/runtime/schema.js +0 -20
- package/dist/runtime/server/plugins/00.event-store.d.ts +0 -13
- package/dist/runtime/server/plugins/00.event-store.js +0 -16
- package/dist/runtime/server/plugins/flow-management.d.ts +0 -13
- package/dist/runtime/server/plugins/flow-management.js +0 -65
- package/dist/runtime/server/plugins/queue-management.js +0 -27
- package/dist/runtime/server/plugins/state-cleanup.d.ts +0 -11
- package/dist/runtime/server/plugins/state-cleanup.js +0 -93
- package/dist/runtime/server/plugins/worker-management.js +0 -33
- package/dist/runtime/server/tsconfig.json +0 -3
- package/dist/runtime/server-utils/events/adapters/fileAdapter.d.ts +0 -2
- package/dist/runtime/server-utils/events/adapters/fileAdapter.js +0 -382
- package/dist/runtime/server-utils/events/adapters/memoryAdapter.d.ts +0 -2
- package/dist/runtime/server-utils/events/adapters/memoryAdapter.js +0 -171
- package/dist/runtime/server-utils/events/adapters/redis/redisAdapter.d.ts +0 -2
- package/dist/runtime/server-utils/events/adapters/redis/redisAdapter.js +0 -348
- package/dist/runtime/server-utils/events/adapters/redis/redisPubSubGateway.d.ts +0 -30
- package/dist/runtime/server-utils/events/adapters/redis/redisPubSubGateway.js +0 -82
- package/dist/runtime/server-utils/events/eventStoreFactory.d.ts +0 -19
- package/dist/runtime/server-utils/events/eventStoreFactory.js +0 -44
- package/dist/runtime/server-utils/events/streamNames.d.ts +0 -17
- package/dist/runtime/server-utils/events/streamNames.js +0 -17
- package/dist/runtime/server-utils/events/types.d.ts +0 -63
- package/dist/runtime/server-utils/events/wiring/registry.d.ts +0 -10
- package/dist/runtime/server-utils/events/wiring/registry.js +0 -24
- package/dist/runtime/server-utils/queue/adapters/bullmq.d.ts +0 -18
- package/dist/runtime/server-utils/queue/adapters/bullmq.js +0 -164
- package/dist/runtime/server-utils/queue/queueFactory.d.ts +0 -3
- package/dist/runtime/server-utils/queue/queueFactory.js +0 -10
- package/dist/runtime/server-utils/queue/types.d.ts +0 -47
- package/dist/runtime/server-utils/state/adapters/redis.d.ts +0 -2
- package/dist/runtime/server-utils/state/adapters/redis.js +0 -42
- package/dist/runtime/server-utils/state/stateFactory.d.ts +0 -3
- package/dist/runtime/server-utils/state/stateFactory.js +0 -17
- package/dist/runtime/server-utils/state/types.d.ts +0 -23
- package/dist/runtime/server-utils/utils/defineQueueConfig.js +0 -2
- package/dist/runtime/server-utils/utils/defineQueueWorker.d.ts +0 -10
- package/dist/runtime/server-utils/utils/useEventStore.d.ts +0 -20
- package/dist/runtime/server-utils/utils/useEventStore.js +0 -119
- package/dist/runtime/server-utils/utils/useFlowEngine.d.ts +0 -9
- package/dist/runtime/server-utils/utils/useFlowEngine.js +0 -44
- package/dist/runtime/server-utils/utils/useLogs.d.ts +0 -41
- package/dist/runtime/server-utils/utils/useLogs.js +0 -74
- package/dist/runtime/server-utils/utils/useQueue.d.ts +0 -31
- package/dist/runtime/server-utils/utils/useQueue.js +0 -24
- package/dist/runtime/server-utils/worker/adapter.d.ts +0 -4
- package/dist/runtime/server-utils/worker/adapter.js +0 -66
- package/dist/runtime/types.d.ts +0 -132
- /package/dist/runtime/{server-utils/events/types.js → adapters/interfaces/queue.js} +0 -0
- /package/dist/runtime/{server-utils/queue/types.js → adapters/interfaces/store.js} +0 -0
- /package/dist/runtime/{server-utils/state/types.js → adapters/interfaces/stream.js} +0 -0
- /package/dist/runtime/{server-utils/events → events}/eventBus.d.ts +0 -0
- /package/dist/runtime/{server-utils/events → events}/eventBus.js +0 -0
- /package/dist/runtime/server/{plugins/queue-management.d.ts → api/_flows/[name]/runs/[runId]/cancel.post.d.ts} +0 -0
- /package/dist/runtime/server/plugins/{00.ws-lifecycle.d.ts → 01.ws-lifecycle.d.ts} +0 -0
- /package/dist/runtime/server/plugins/{00.ws-lifecycle.js → 01.ws-lifecycle.js} +0 -0
- /package/dist/runtime/server/plugins/{worker-management.d.ts → 02.workers.d.ts} +0 -0
- /package/dist/runtime/{server-utils/utils → utils}/useEventManager.d.ts +0 -0
- /package/dist/runtime/{server-utils/utils → utils}/useEventManager.js +0 -0
- /package/dist/runtime/{server-utils/utils → utils}/useNventLogger.d.ts +0 -0
- /package/dist/runtime/{server-utils/utils → utils}/wsPeerManager.d.ts +0 -0
- /package/dist/runtime/{server-utils/utils → utils}/wsPeerManager.js +0 -0
- /package/dist/runtime/{python → worker/python}/get_config.py +0 -0
|
@@ -1,291 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="h-full flex flex-col overflow-hidden">
|
|
3
|
-
<!-- Header -->
|
|
4
|
-
<div class="border-b border-gray-200 dark:border-gray-800 px-6 py-3 shrink-0">
|
|
5
|
-
<div class="flex items-center justify-between">
|
|
6
|
-
<div class="flex items-center gap-4">
|
|
7
|
-
<UButton
|
|
8
|
-
icon="i-lucide-arrow-left"
|
|
9
|
-
size="xs"
|
|
10
|
-
color="neutral"
|
|
11
|
-
variant="ghost"
|
|
12
|
-
@click="back"
|
|
13
|
-
/>
|
|
14
|
-
<div>
|
|
15
|
-
<h1 class="text-lg font-semibold">
|
|
16
|
-
{{ queueName }}
|
|
17
|
-
</h1>
|
|
18
|
-
<p class="text-xs text-gray-500">
|
|
19
|
-
Queue Jobs
|
|
20
|
-
</p>
|
|
21
|
-
</div>
|
|
22
|
-
</div>
|
|
23
|
-
<div class="flex items-center gap-3">
|
|
24
|
-
<div
|
|
25
|
-
v-if="isConnected"
|
|
26
|
-
class="flex items-center gap-1.5 text-xs text-emerald-600 dark:text-emerald-400"
|
|
27
|
-
>
|
|
28
|
-
<div class="w-2 h-2 rounded-full bg-emerald-500 animate-pulse" />
|
|
29
|
-
<span>Live</span>
|
|
30
|
-
<span
|
|
31
|
-
v-if="isAutoRefreshing"
|
|
32
|
-
class="text-[10px] text-gray-400"
|
|
33
|
-
>
|
|
34
|
-
(updating...)
|
|
35
|
-
</span>
|
|
36
|
-
</div>
|
|
37
|
-
<div
|
|
38
|
-
v-else-if="isReconnecting"
|
|
39
|
-
class="flex items-center gap-1.5 text-xs text-amber-600 dark:text-amber-400"
|
|
40
|
-
>
|
|
41
|
-
<div class="w-2 h-2 rounded-full bg-amber-500 animate-pulse" />
|
|
42
|
-
<span>Reconnecting...</span>
|
|
43
|
-
</div>
|
|
44
|
-
<UBadge
|
|
45
|
-
:label="counts?.active.toString() || '0'"
|
|
46
|
-
color="warning"
|
|
47
|
-
variant="subtle"
|
|
48
|
-
>
|
|
49
|
-
<template #leading>
|
|
50
|
-
Active
|
|
51
|
-
</template>
|
|
52
|
-
</UBadge>
|
|
53
|
-
<UBadge
|
|
54
|
-
:label="counts?.waiting.toString() || '0'"
|
|
55
|
-
color="info"
|
|
56
|
-
variant="subtle"
|
|
57
|
-
>
|
|
58
|
-
<template #leading>
|
|
59
|
-
Waiting
|
|
60
|
-
</template>
|
|
61
|
-
</UBadge>
|
|
62
|
-
<UBadge
|
|
63
|
-
:label="counts?.completed.toString() || '0'"
|
|
64
|
-
color="success"
|
|
65
|
-
variant="subtle"
|
|
66
|
-
>
|
|
67
|
-
<template #leading>
|
|
68
|
-
Completed
|
|
69
|
-
</template>
|
|
70
|
-
</UBadge>
|
|
71
|
-
<UBadge
|
|
72
|
-
:label="counts?.failed.toString() || '0'"
|
|
73
|
-
color="error"
|
|
74
|
-
variant="subtle"
|
|
75
|
-
>
|
|
76
|
-
<template #leading>
|
|
77
|
-
Failed
|
|
78
|
-
</template>
|
|
79
|
-
</UBadge>
|
|
80
|
-
<USelectMenu
|
|
81
|
-
v-model="selectedStateOption"
|
|
82
|
-
:items="stateOptions"
|
|
83
|
-
placeholder="All States"
|
|
84
|
-
size="xs"
|
|
85
|
-
class="w-32"
|
|
86
|
-
/>
|
|
87
|
-
<UButton
|
|
88
|
-
icon="i-lucide-refresh-cw"
|
|
89
|
-
size="xs"
|
|
90
|
-
color="neutral"
|
|
91
|
-
variant="ghost"
|
|
92
|
-
:loading="status === 'pending'"
|
|
93
|
-
@click.prevent="onRefresh"
|
|
94
|
-
>
|
|
95
|
-
Refresh
|
|
96
|
-
</UButton>
|
|
97
|
-
</div>
|
|
98
|
-
</div>
|
|
99
|
-
</div>
|
|
100
|
-
|
|
101
|
-
<!-- Main Content -->
|
|
102
|
-
<div class="flex-1 min-h-0 overflow-hidden flex flex-col">
|
|
103
|
-
<div
|
|
104
|
-
v-if="!data || !data.jobs || data.jobs.length === 0"
|
|
105
|
-
class="flex-1 flex items-center justify-center text-sm text-gray-400"
|
|
106
|
-
>
|
|
107
|
-
No jobs found
|
|
108
|
-
</div>
|
|
109
|
-
<template v-else>
|
|
110
|
-
<div class="flex-1 min-h-0 p-4 overflow-auto">
|
|
111
|
-
<UTable
|
|
112
|
-
ref="table"
|
|
113
|
-
v-model:pagination="pagination"
|
|
114
|
-
:data="data.jobs"
|
|
115
|
-
:columns="columns"
|
|
116
|
-
:loading="status === 'pending'"
|
|
117
|
-
:pagination-options="{
|
|
118
|
-
getPaginationRowModel: getPaginationRowModel()
|
|
119
|
-
}"
|
|
120
|
-
:ui="{
|
|
121
|
-
base: 'table-fixed border-separate border-spacing-0',
|
|
122
|
-
thead: '[&>tr]:bg-elevated/50 [&>tr]:after:content-none',
|
|
123
|
-
tbody: '[&>tr]:last:[&>td]:border-b-0',
|
|
124
|
-
th: 'py-2 first:rounded-l-lg last:rounded-r-lg border-y border-default first:border-l last:border-r',
|
|
125
|
-
td: 'border-b border-default',
|
|
126
|
-
separator: 'h-0'
|
|
127
|
-
}"
|
|
128
|
-
/>
|
|
129
|
-
</div>
|
|
130
|
-
|
|
131
|
-
<div class="flex items-center justify-between gap-3 border-t border-default p-4 shrink-0">
|
|
132
|
-
<div class="text-sm text-muted">
|
|
133
|
-
Showing {{ Math.min(pagination.pageIndex * pagination.pageSize + pagination.pageSize, data.jobs.length) }} of {{ data.jobs.length }} job(s)
|
|
134
|
-
<span
|
|
135
|
-
v-if="selectedState"
|
|
136
|
-
class="text-gray-400"
|
|
137
|
-
>
|
|
138
|
-
(filtered by {{ selectedStateOption?.label }})
|
|
139
|
-
</span>
|
|
140
|
-
</div>
|
|
141
|
-
<div class="flex items-center gap-1.5">
|
|
142
|
-
<UPagination
|
|
143
|
-
:default-page="(table?.tableApi?.getState().pagination.pageIndex || 0) + 1"
|
|
144
|
-
:items-per-page="table?.tableApi?.getState().pagination.pageSize || 20"
|
|
145
|
-
:total="data.jobs.length"
|
|
146
|
-
@update:page="(p) => table?.tableApi?.setPageIndex(p - 1)"
|
|
147
|
-
/>
|
|
148
|
-
</div>
|
|
149
|
-
</div>
|
|
150
|
-
</template>
|
|
151
|
-
</div>
|
|
152
|
-
</div>
|
|
153
|
-
</template>
|
|
154
|
-
|
|
155
|
-
<script setup>
|
|
156
|
-
import { ref, computed, watch } from "#imports";
|
|
157
|
-
import { getPaginationRowModel } from "@tanstack/table-core";
|
|
158
|
-
import { UTable, UButton, UBadge, UPagination, USelectMenu } from "#components";
|
|
159
|
-
import { useQueueJobs } from "../../composables/useQueueJobs";
|
|
160
|
-
import { useQueueUpdates } from "../../composables/useQueueUpdates";
|
|
161
|
-
import { useComponentRouter } from "../../composables/useComponentRouter";
|
|
162
|
-
const UBadgeComponent = resolveComponent("UBadge");
|
|
163
|
-
const UButtonComponent = resolveComponent("UButton");
|
|
164
|
-
const router = useComponentRouter();
|
|
165
|
-
const queueName = computed(() => router.route.value?.params?.name || "");
|
|
166
|
-
const stateOptions = [
|
|
167
|
-
{ label: "All States", value: null },
|
|
168
|
-
{ label: "Waiting", value: "waiting" },
|
|
169
|
-
{ label: "Active", value: "active" },
|
|
170
|
-
{ label: "Completed", value: "completed" },
|
|
171
|
-
{ label: "Failed", value: "failed" },
|
|
172
|
-
{ label: "Delayed", value: "delayed" },
|
|
173
|
-
{ label: "Paused", value: "paused" }
|
|
174
|
-
];
|
|
175
|
-
const selectedStateOption = ref(stateOptions[0]);
|
|
176
|
-
const selectedState = computed(() => selectedStateOption.value?.value ?? null);
|
|
177
|
-
const { data, refresh, status } = useQueueJobs(queueName, selectedState);
|
|
178
|
-
const { counts, isConnected, isReconnecting, shouldRefreshJobs, resetRefreshFlag } = useQueueUpdates(queueName);
|
|
179
|
-
const isAutoRefreshing = ref(false);
|
|
180
|
-
watch(selectedState, () => {
|
|
181
|
-
if (table.value?.tableApi) {
|
|
182
|
-
table.value.tableApi.setPageIndex(0);
|
|
183
|
-
}
|
|
184
|
-
});
|
|
185
|
-
watch(shouldRefreshJobs, async (shouldRefresh) => {
|
|
186
|
-
if (shouldRefresh) {
|
|
187
|
-
isAutoRefreshing.value = true;
|
|
188
|
-
await refresh();
|
|
189
|
-
resetRefreshFlag();
|
|
190
|
-
setTimeout(() => {
|
|
191
|
-
isAutoRefreshing.value = false;
|
|
192
|
-
}, 500);
|
|
193
|
-
}
|
|
194
|
-
});
|
|
195
|
-
const table = useTemplateRef("table");
|
|
196
|
-
const pagination = ref({
|
|
197
|
-
pageIndex: 0,
|
|
198
|
-
pageSize: 20
|
|
199
|
-
});
|
|
200
|
-
const onRefresh = async () => {
|
|
201
|
-
await refresh();
|
|
202
|
-
};
|
|
203
|
-
const back = () => {
|
|
204
|
-
router.push("/queues");
|
|
205
|
-
};
|
|
206
|
-
const selectJob = (jobId) => {
|
|
207
|
-
router.push(`/queues/${queueName.value}/jobs/${jobId}`);
|
|
208
|
-
};
|
|
209
|
-
const columns = [
|
|
210
|
-
{
|
|
211
|
-
accessorKey: "id",
|
|
212
|
-
header: "Job ID",
|
|
213
|
-
cell: ({ row }) => {
|
|
214
|
-
const id = row.original.id;
|
|
215
|
-
return h("div", {
|
|
216
|
-
class: "font-mono text-xs cursor-pointer hover:underline",
|
|
217
|
-
onClick: () => selectJob(row.original.id)
|
|
218
|
-
}, id.length > 16 ? `${id.substring(0, 8)}...${id.substring(id.length - 8)}` : id);
|
|
219
|
-
}
|
|
220
|
-
},
|
|
221
|
-
{
|
|
222
|
-
accessorKey: "name",
|
|
223
|
-
header: "Name",
|
|
224
|
-
cell: ({ row }) => {
|
|
225
|
-
return h("div", {
|
|
226
|
-
class: "font-medium cursor-pointer hover:underline",
|
|
227
|
-
onClick: () => selectJob(row.original.id)
|
|
228
|
-
}, row.original.name);
|
|
229
|
-
}
|
|
230
|
-
},
|
|
231
|
-
{
|
|
232
|
-
accessorKey: "state",
|
|
233
|
-
header: "State",
|
|
234
|
-
cell: ({ row }) => {
|
|
235
|
-
const state = row.original.state;
|
|
236
|
-
const colorMap = {
|
|
237
|
-
waiting: "info",
|
|
238
|
-
active: "warning",
|
|
239
|
-
completed: "success",
|
|
240
|
-
failed: "error",
|
|
241
|
-
delayed: "secondary",
|
|
242
|
-
paused: "warning"
|
|
243
|
-
};
|
|
244
|
-
return h(UBadgeComponent, {
|
|
245
|
-
label: state || "unknown",
|
|
246
|
-
color: colorMap[state || ""] || "neutral",
|
|
247
|
-
variant: "subtle",
|
|
248
|
-
class: "capitalize"
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
},
|
|
252
|
-
{
|
|
253
|
-
accessorKey: "timestamp",
|
|
254
|
-
header: "Created",
|
|
255
|
-
cell: ({ row }) => {
|
|
256
|
-
const timestamp = row.original.timestamp;
|
|
257
|
-
if (!timestamp) return h("div", { class: "text-gray-400 text-xs" }, "-");
|
|
258
|
-
const date = new Date(timestamp);
|
|
259
|
-
return h(
|
|
260
|
-
"div",
|
|
261
|
-
{ class: "text-xs" },
|
|
262
|
-
date.toLocaleString("de-DE", {
|
|
263
|
-
timeZone: "Europe/Berlin",
|
|
264
|
-
day: "2-digit",
|
|
265
|
-
month: "2-digit",
|
|
266
|
-
year: "numeric",
|
|
267
|
-
hour: "2-digit",
|
|
268
|
-
minute: "2-digit",
|
|
269
|
-
second: "2-digit"
|
|
270
|
-
})
|
|
271
|
-
);
|
|
272
|
-
}
|
|
273
|
-
},
|
|
274
|
-
{
|
|
275
|
-
id: "actions",
|
|
276
|
-
header: "",
|
|
277
|
-
cell: ({ row }) => {
|
|
278
|
-
return h(UButtonComponent, {
|
|
279
|
-
icon: "i-lucide-arrow-right",
|
|
280
|
-
size: "xs",
|
|
281
|
-
color: "neutral",
|
|
282
|
-
variant: "ghost",
|
|
283
|
-
square: true,
|
|
284
|
-
onClick: () => {
|
|
285
|
-
selectJob(row.original.id);
|
|
286
|
-
}
|
|
287
|
-
});
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
];
|
|
291
|
-
</script>
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
-
declare const _default: typeof __VLS_export;
|
|
3
|
-
export default _default;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { defineNuxtPlugin } from "#imports";
|
|
2
|
-
import { VueFlow } from "@vue-flow/core";
|
|
3
|
-
import { Controls } from "@vue-flow/controls";
|
|
4
|
-
import { MiniMap } from "@vue-flow/minimap";
|
|
5
|
-
import { Background } from "@vue-flow/background";
|
|
6
|
-
export default defineNuxtPlugin((nuxtApp) => {
|
|
7
|
-
nuxtApp.vueApp.component("VueFlow", VueFlow);
|
|
8
|
-
nuxtApp.vueApp.component("Controls", Controls);
|
|
9
|
-
nuxtApp.vueApp.component("MiniMap", MiniMap);
|
|
10
|
-
nuxtApp.vueApp.component("Background", Background);
|
|
11
|
-
});
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export declare const QUEUE_STATUSES: {
|
|
2
|
-
readonly latest: "latest";
|
|
3
|
-
readonly active: "active";
|
|
4
|
-
readonly waiting: "waiting";
|
|
5
|
-
readonly waitingChildren: "waiting-children";
|
|
6
|
-
readonly prioritized: "prioritized";
|
|
7
|
-
readonly completed: "completed";
|
|
8
|
-
readonly failed: "failed";
|
|
9
|
-
readonly delayed: "delayed";
|
|
10
|
-
readonly paused: "paused";
|
|
11
|
-
};
|
package/dist/runtime/schema.d.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import z from 'zod';
|
|
2
|
-
export declare const JobSchema: z.ZodObject<{
|
|
3
|
-
id: z.ZodString;
|
|
4
|
-
name: z.ZodString;
|
|
5
|
-
data: z.ZodAny;
|
|
6
|
-
progress: z.ZodNumber;
|
|
7
|
-
opts: z.ZodObject<{
|
|
8
|
-
attempts: z.ZodNumber;
|
|
9
|
-
delay: z.ZodOptional<z.ZodNumber>;
|
|
10
|
-
}, z.core.$strip>;
|
|
11
|
-
state: z.ZodAny;
|
|
12
|
-
returnvalue: z.ZodAny;
|
|
13
|
-
attemptsStarted: z.ZodNumber;
|
|
14
|
-
attemptsMade: z.ZodNumber;
|
|
15
|
-
delay: z.ZodNumber;
|
|
16
|
-
timestamp: z.ZodNumber;
|
|
17
|
-
finishedOn: z.ZodOptional<z.ZodNumber>;
|
|
18
|
-
processedOn: z.ZodOptional<z.ZodNumber>;
|
|
19
|
-
}, z.core.$strip>;
|
|
20
|
-
export declare const JobSchemaArray: z.ZodArray<z.ZodObject<{
|
|
21
|
-
id: z.ZodString;
|
|
22
|
-
name: z.ZodString;
|
|
23
|
-
data: z.ZodAny;
|
|
24
|
-
progress: z.ZodNumber;
|
|
25
|
-
opts: z.ZodObject<{
|
|
26
|
-
attempts: z.ZodNumber;
|
|
27
|
-
delay: z.ZodOptional<z.ZodNumber>;
|
|
28
|
-
}, z.core.$strip>;
|
|
29
|
-
state: z.ZodAny;
|
|
30
|
-
returnvalue: z.ZodAny;
|
|
31
|
-
attemptsStarted: z.ZodNumber;
|
|
32
|
-
attemptsMade: z.ZodNumber;
|
|
33
|
-
delay: z.ZodNumber;
|
|
34
|
-
timestamp: z.ZodNumber;
|
|
35
|
-
finishedOn: z.ZodOptional<z.ZodNumber>;
|
|
36
|
-
processedOn: z.ZodOptional<z.ZodNumber>;
|
|
37
|
-
}, z.core.$strip>>;
|
package/dist/runtime/schema.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import z from "zod";
|
|
2
|
-
export const JobSchema = z.object({
|
|
3
|
-
id: z.string(),
|
|
4
|
-
name: z.string(),
|
|
5
|
-
data: z.any(),
|
|
6
|
-
progress: z.number(),
|
|
7
|
-
opts: z.object({
|
|
8
|
-
attempts: z.number(),
|
|
9
|
-
delay: z.number().optional()
|
|
10
|
-
}),
|
|
11
|
-
state: z.any(),
|
|
12
|
-
returnvalue: z.any(),
|
|
13
|
-
attemptsStarted: z.number(),
|
|
14
|
-
attemptsMade: z.number(),
|
|
15
|
-
delay: z.number(),
|
|
16
|
-
timestamp: z.number(),
|
|
17
|
-
finishedOn: z.number().optional(),
|
|
18
|
-
processedOn: z.number().optional()
|
|
19
|
-
});
|
|
20
|
-
export const JobSchemaArray = z.array(JobSchema);
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Flow Run Snapshots (stream-based)
|
|
3
|
-
*
|
|
4
|
-
* Writes append-only snapshot events to nq:proj:flow:<flowName>:<runId>
|
|
5
|
-
* for key lifecycle kinds:
|
|
6
|
-
* - flow.start -> status=running
|
|
7
|
-
* - flow.complete -> status=completed
|
|
8
|
-
* - runner.log (with correlationId) -> logsCount++ (as a patch)
|
|
9
|
-
*
|
|
10
|
-
* Consumers reduce the small snapshot stream to a final object.
|
|
11
|
-
*/
|
|
12
|
-
declare const _default: any;
|
|
13
|
-
export default _default;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { defineNitroPlugin } from "#imports";
|
|
2
|
-
import { getEventStoreFactory } from "../../server-utils/events/eventStoreFactory.js";
|
|
3
|
-
export default defineNitroPlugin(() => {
|
|
4
|
-
const factory = getEventStoreFactory();
|
|
5
|
-
factory.start();
|
|
6
|
-
return {
|
|
7
|
-
hooks: {
|
|
8
|
-
close: async () => {
|
|
9
|
-
try {
|
|
10
|
-
factory.stop();
|
|
11
|
-
} catch {
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
});
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Flow Management Plugin
|
|
3
|
-
*
|
|
4
|
-
* Handles NEW flow starts from external triggers:
|
|
5
|
-
* - Processes external triggers to start new flows
|
|
6
|
-
* - Emits flow.start events for new flow runs
|
|
7
|
-
* - Maps flowIds to flowNames
|
|
8
|
-
*
|
|
9
|
-
* Note: Step orchestration (checking dependencies, triggering next steps)
|
|
10
|
-
* is handled by flowWiring.ts which subscribes to emit/step.completed events
|
|
11
|
-
*/
|
|
12
|
-
declare const _default: any;
|
|
13
|
-
export default _default;
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { defineNitroPlugin, useEventManager, $useQueueRegistry, useQueue, useNventLogger } from "#imports";
|
|
2
|
-
export default defineNitroPlugin((nitro) => {
|
|
3
|
-
const logger = useNventLogger("plugin-flow-management");
|
|
4
|
-
const { onType, publishBus } = useEventManager();
|
|
5
|
-
const registry = $useQueueRegistry();
|
|
6
|
-
const flowIdToName = /* @__PURE__ */ new Map();
|
|
7
|
-
const getFlowNameById = (id) => {
|
|
8
|
-
const cached = flowIdToName.get(id);
|
|
9
|
-
if (cached) return cached;
|
|
10
|
-
try {
|
|
11
|
-
const flows = registry?.flows || {};
|
|
12
|
-
for (const [name, def] of Object.entries(flows)) {
|
|
13
|
-
if (def?.id === id) {
|
|
14
|
-
flowIdToName.set(id, name);
|
|
15
|
-
return name;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
} catch {
|
|
19
|
-
}
|
|
20
|
-
return void 0;
|
|
21
|
-
};
|
|
22
|
-
const unsubscribes = [];
|
|
23
|
-
unsubscribes.push(onType("emit", async (e) => {
|
|
24
|
-
if (e.runId) return;
|
|
25
|
-
const emitName = e.data?.name;
|
|
26
|
-
if (!emitName) return;
|
|
27
|
-
const triggers = Object.keys(registry?.eventIndex || {});
|
|
28
|
-
if (!triggers.includes(emitName)) return;
|
|
29
|
-
const { enqueue } = useQueue();
|
|
30
|
-
const targets = (registry?.eventIndex)[emitName] || [];
|
|
31
|
-
for (const t of targets) {
|
|
32
|
-
const payload = { ...e.data };
|
|
33
|
-
try {
|
|
34
|
-
const id = await enqueue(t.queue, { name: t.step, data: payload });
|
|
35
|
-
try {
|
|
36
|
-
const targetFlowName = getFlowNameById(String(t.flowId)) || String(t.flowId);
|
|
37
|
-
const newRunId = String(id);
|
|
38
|
-
await publishBus({
|
|
39
|
-
type: "flow.start",
|
|
40
|
-
runId: newRunId,
|
|
41
|
-
flowName: targetFlowName,
|
|
42
|
-
data: { input: payload }
|
|
43
|
-
});
|
|
44
|
-
if (process.env.NQ_DEBUG_EVENTS === "1") {
|
|
45
|
-
logger.info("[flow-lifecycle] started new flow:", {
|
|
46
|
-
flowName: targetFlowName,
|
|
47
|
-
runId: newRunId,
|
|
48
|
-
entryStep: t.step
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
} catch {
|
|
52
|
-
}
|
|
53
|
-
} catch (err) {
|
|
54
|
-
logger.warn("[flow-lifecycle] failed to start flow:", {
|
|
55
|
-
step: t.step,
|
|
56
|
-
error: err?.message
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}));
|
|
61
|
-
nitro.hooks.hook("close", () => {
|
|
62
|
-
unsubscribes.forEach((fn) => fn());
|
|
63
|
-
flowIdToName.clear();
|
|
64
|
-
});
|
|
65
|
-
});
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { defineNitroPlugin, useNventLogger } from "#imports";
|
|
2
|
-
import { BullMQProvider } from "../../server-utils/queue/adapters/bullmq.js";
|
|
3
|
-
import { setQueueProvider, getQueueProvider } from "../../server-utils/queue/queueFactory.js";
|
|
4
|
-
export default defineNitroPlugin(async (nitroApp) => {
|
|
5
|
-
const logger = useNventLogger("plugin-queue-management");
|
|
6
|
-
try {
|
|
7
|
-
const existingProvider = getQueueProvider();
|
|
8
|
-
if (existingProvider) {
|
|
9
|
-
logger.info("[queues plugin] Closing existing queue provider before creating new one...");
|
|
10
|
-
await existingProvider.close();
|
|
11
|
-
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
12
|
-
}
|
|
13
|
-
} catch {
|
|
14
|
-
}
|
|
15
|
-
const provider = new BullMQProvider();
|
|
16
|
-
await provider.init();
|
|
17
|
-
setQueueProvider(provider);
|
|
18
|
-
nitroApp.hooks.hook("close", async () => {
|
|
19
|
-
logger.info("[queues plugin] Closing queue provider...");
|
|
20
|
-
await provider.close();
|
|
21
|
-
});
|
|
22
|
-
return {
|
|
23
|
-
async close() {
|
|
24
|
-
await provider.close();
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
});
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* State Cleanup Plugin
|
|
3
|
-
*
|
|
4
|
-
* Handles automatic cleanup of flow state based on configuration strategy:
|
|
5
|
-
* - 'never': State persists indefinitely
|
|
6
|
-
* - 'immediate': Cleanup after each step (original behavior, not recommended)
|
|
7
|
-
* - 'on-complete': Cleanup when flow completes (recommended, uses lifecycle tracking)
|
|
8
|
-
* - 'ttl': State expires automatically via TTL (handled by storage provider)
|
|
9
|
-
*/
|
|
10
|
-
declare const _default: any;
|
|
11
|
-
export default _default;
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { useNventLogger, defineNitroPlugin, useEventManager, useRuntimeConfig } from "#imports";
|
|
2
|
-
import { getStateProvider } from "../../server-utils/state/stateFactory.js";
|
|
3
|
-
export default defineNitroPlugin(() => {
|
|
4
|
-
const logger = useNventLogger("plugin-state-cleanup");
|
|
5
|
-
const rc = useRuntimeConfig();
|
|
6
|
-
const cleanup = rc?.queue?.state?.cleanup || { strategy: "never" };
|
|
7
|
-
if (cleanup.strategy === "never" || cleanup.strategy === "ttl") {
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
const { onType } = useEventManager();
|
|
11
|
-
const unsubs = [];
|
|
12
|
-
if (cleanup.strategy === "on-complete") {
|
|
13
|
-
unsubs.push(onType("flow.completed", async (event) => {
|
|
14
|
-
const flowId = event.runId;
|
|
15
|
-
if (!flowId) return;
|
|
16
|
-
try {
|
|
17
|
-
const sp = getStateProvider();
|
|
18
|
-
const prefix = `flow:${flowId}:`;
|
|
19
|
-
const { keys } = await sp.list(prefix);
|
|
20
|
-
if (keys.length > 0) {
|
|
21
|
-
const rc2 = useRuntimeConfig();
|
|
22
|
-
const ns = rc2?.queue?.state?.namespace || "nq";
|
|
23
|
-
const nsPrefix = `${ns}:`;
|
|
24
|
-
await Promise.all(keys.map((k) => {
|
|
25
|
-
const keyWithoutNs = k.startsWith(nsPrefix) ? k.substring(nsPrefix.length) : k;
|
|
26
|
-
return sp.delete(keyWithoutNs);
|
|
27
|
-
}));
|
|
28
|
-
logger.info(`Cleaned up ${keys.length} state keys after flow completion`, { flowId, keys });
|
|
29
|
-
}
|
|
30
|
-
} catch (error) {
|
|
31
|
-
logger.error("Error cleaning up state after flow completion", { flowId, error });
|
|
32
|
-
}
|
|
33
|
-
}));
|
|
34
|
-
unsubs.push(onType("flow.failed", async (event) => {
|
|
35
|
-
const flowId = event.runId;
|
|
36
|
-
if (!flowId) return;
|
|
37
|
-
try {
|
|
38
|
-
const sp = getStateProvider();
|
|
39
|
-
const prefix = `flow:${flowId}:`;
|
|
40
|
-
const { keys } = await sp.list(prefix);
|
|
41
|
-
if (keys.length > 0) {
|
|
42
|
-
const rc2 = useRuntimeConfig();
|
|
43
|
-
const ns = rc2?.queue?.state?.namespace || "nq";
|
|
44
|
-
const nsPrefix = `${ns}:`;
|
|
45
|
-
await Promise.all(keys.map((k) => {
|
|
46
|
-
const keyWithoutNs = k.startsWith(nsPrefix) ? k.substring(nsPrefix.length) : k;
|
|
47
|
-
return sp.delete(keyWithoutNs);
|
|
48
|
-
}));
|
|
49
|
-
logger.info(`Cleaned up ${keys.length} state keys after flow failure`, { flowId, keys });
|
|
50
|
-
}
|
|
51
|
-
} catch (error) {
|
|
52
|
-
logger.error("Error cleaning up state after flow failure", { flowId, error });
|
|
53
|
-
}
|
|
54
|
-
}));
|
|
55
|
-
logger.debug("Plugin initialized with strategy: on-complete");
|
|
56
|
-
} else if (cleanup.strategy === "immediate") {
|
|
57
|
-
unsubs.push(onType("step.completed", async (event) => {
|
|
58
|
-
const flowId = event.runId;
|
|
59
|
-
if (!flowId) return;
|
|
60
|
-
try {
|
|
61
|
-
const sp = getStateProvider();
|
|
62
|
-
const prefix = `flow:${flowId}:`;
|
|
63
|
-
const { keys } = await sp.list(prefix);
|
|
64
|
-
if (keys.length > 0) {
|
|
65
|
-
const rc2 = useRuntimeConfig();
|
|
66
|
-
const ns = rc2?.queue?.state?.namespace || "nq";
|
|
67
|
-
const nsPrefix = `${ns}:`;
|
|
68
|
-
await Promise.all(keys.map((k) => {
|
|
69
|
-
const keyWithoutNs = k.startsWith(nsPrefix) ? k.substring(nsPrefix.length) : k;
|
|
70
|
-
return sp.delete(keyWithoutNs);
|
|
71
|
-
}));
|
|
72
|
-
logger.info(`Cleaned up ${keys.length} state keys after step completion`, { flowId, keys });
|
|
73
|
-
}
|
|
74
|
-
} catch (error) {
|
|
75
|
-
logger.error("Error cleaning up state after step", { flowId, error });
|
|
76
|
-
}
|
|
77
|
-
}));
|
|
78
|
-
logger.debug("Plugin initialized with strategy: immediate");
|
|
79
|
-
}
|
|
80
|
-
return {
|
|
81
|
-
hooks: {
|
|
82
|
-
close: async () => {
|
|
83
|
-
for (const u of unsubs) {
|
|
84
|
-
try {
|
|
85
|
-
u();
|
|
86
|
-
} catch {
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
unsubs.length = 0;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
});
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { defineNitroPlugin, $useWorkerHandlers, $useQueueRegistry } from "#imports";
|
|
2
|
-
import { registerTsWorker, closeAllWorkers } from "../../server-utils/worker/adapter.js";
|
|
3
|
-
export default defineNitroPlugin(async (nitroApp) => {
|
|
4
|
-
nitroApp.hooks.hook("close", async () => {
|
|
5
|
-
await closeAllWorkers();
|
|
6
|
-
});
|
|
7
|
-
try {
|
|
8
|
-
const handlers = $useWorkerHandlers();
|
|
9
|
-
const registry = $useQueueRegistry() || { workers: [] };
|
|
10
|
-
for (const entry of handlers) {
|
|
11
|
-
const { queue, id, handler } = entry;
|
|
12
|
-
const w = registry.workers.find((rw) => rw?.id === id || rw?.queue?.name === queue && rw?.absPath === entry.absPath);
|
|
13
|
-
let jobName;
|
|
14
|
-
if (w?.flow?.step) {
|
|
15
|
-
jobName = Array.isArray(w.flow.step) ? w.flow.step[0] : w.flow.step;
|
|
16
|
-
} else {
|
|
17
|
-
jobName = id.includes("/") ? id.split("/").pop() : id;
|
|
18
|
-
}
|
|
19
|
-
if (typeof handler === "function") {
|
|
20
|
-
const cfg = w && w.worker || {};
|
|
21
|
-
const opts = {};
|
|
22
|
-
if (typeof cfg.concurrency === "number") opts.concurrency = cfg.concurrency;
|
|
23
|
-
if (typeof cfg.lockDurationMs === "number") opts.lockDuration = cfg.lockDurationMs;
|
|
24
|
-
if (typeof cfg.maxStalledCount === "number") opts.maxStalledCount = cfg.maxStalledCount;
|
|
25
|
-
if (typeof cfg.drainDelayMs === "number") opts.drainDelay = cfg.drainDelayMs;
|
|
26
|
-
if (typeof cfg.autorun === "boolean") opts.autorun = cfg.autorun;
|
|
27
|
-
if (w?.queue?.prefix) opts.prefix = w.queue.prefix;
|
|
28
|
-
await registerTsWorker(queue, jobName, handler, opts);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
} catch {
|
|
32
|
-
}
|
|
33
|
-
});
|