nvent 0.4.4 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module.d.mts +4 -185
- package/dist/module.json +3 -3
- package/dist/module.mjs +451 -257
- package/dist/runtime/adapters/base/index.d.ts +6 -0
- package/dist/runtime/adapters/base/index.js +1 -0
- package/dist/runtime/adapters/base/store-validator.d.ts +48 -0
- package/dist/runtime/adapters/base/store-validator.js +147 -0
- package/dist/runtime/adapters/builtin/file-queue.d.ts +67 -0
- package/dist/runtime/adapters/builtin/file-queue.js +499 -0
- package/dist/runtime/adapters/builtin/file-store.d.ts +32 -0
- package/dist/runtime/adapters/builtin/file-store.js +206 -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 +243 -0
- package/dist/runtime/adapters/builtin/memory-store.d.ts +68 -0
- package/dist/runtime/adapters/builtin/memory-store.js +333 -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 +134 -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 +297 -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 +175 -0
- package/dist/runtime/config/types.d.ts +397 -0
- package/dist/runtime/config/types.js +0 -0
- package/dist/runtime/{server-utils/events → events}/eventBus.d.ts +1 -1
- package/dist/runtime/events/types.d.ts +145 -0
- package/dist/runtime/events/types.js +0 -0
- package/dist/runtime/events/utils/scheduleTrigger.d.ts +8 -0
- package/dist/runtime/events/utils/scheduleTrigger.js +69 -0
- package/dist/runtime/events/utils/stallDetector.d.ts +140 -0
- package/dist/runtime/events/utils/stallDetector.js +436 -0
- package/dist/runtime/events/utils/triggerRuntime.d.ts +58 -0
- package/dist/runtime/events/utils/triggerRuntime.js +212 -0
- package/dist/runtime/{server-utils/events → events}/wiring/flowWiring.d.ts +12 -11
- package/dist/runtime/events/wiring/flowWiring.js +1020 -0
- package/dist/runtime/events/wiring/registry.d.ts +19 -0
- package/dist/runtime/events/wiring/registry.js +35 -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 +36 -0
- package/dist/runtime/events/wiring/streamWiring.js +156 -0
- package/dist/runtime/events/wiring/triggerWiring.d.ts +21 -0
- package/dist/runtime/events/wiring/triggerWiring.js +412 -0
- package/dist/runtime/nitro/plugins/00.adapters.d.ts +14 -0
- package/dist/runtime/nitro/plugins/00.adapters.js +73 -0
- package/dist/runtime/nitro/plugins/02.workers.js +63 -0
- package/dist/runtime/nitro/plugins/03.triggers.d.ts +12 -0
- package/dist/runtime/nitro/plugins/03.triggers.js +55 -0
- package/dist/runtime/nitro/routes/webhook.await.d.ts +23 -0
- package/dist/runtime/nitro/routes/webhook.await.js +90 -0
- package/dist/runtime/nitro/routes/webhook.trigger.d.ts +69 -0
- package/dist/runtime/nitro/routes/webhook.trigger.js +64 -0
- package/dist/runtime/nitro/utils/adapters.d.ts +66 -0
- package/dist/runtime/nitro/utils/adapters.js +51 -0
- package/dist/runtime/nitro/utils/awaitPatterns/event.d.ts +15 -0
- package/dist/runtime/nitro/utils/awaitPatterns/event.js +120 -0
- package/dist/runtime/nitro/utils/awaitPatterns/index.d.ts +28 -0
- package/dist/runtime/nitro/utils/awaitPatterns/index.js +55 -0
- package/dist/runtime/nitro/utils/awaitPatterns/schedule.d.ts +16 -0
- package/dist/runtime/nitro/utils/awaitPatterns/schedule.js +78 -0
- package/dist/runtime/nitro/utils/awaitPatterns/time.d.ts +15 -0
- package/dist/runtime/nitro/utils/awaitPatterns/time.js +67 -0
- package/dist/runtime/nitro/utils/awaitPatterns/webhook.d.ts +15 -0
- package/dist/runtime/nitro/utils/awaitPatterns/webhook.js +120 -0
- package/dist/runtime/nitro/utils/defineFunction.d.ts +10 -0
- package/dist/runtime/nitro/utils/defineFunction.js +17 -0
- package/dist/runtime/nitro/utils/defineFunctionConfig.d.ts +310 -0
- package/dist/runtime/nitro/utils/defineFunctionConfig.js +3 -0
- package/dist/runtime/nitro/utils/defineHooks.d.ts +41 -0
- package/dist/runtime/nitro/utils/defineHooks.js +6 -0
- package/dist/runtime/nitro/utils/registerAdapter.d.ts +59 -0
- package/dist/runtime/nitro/utils/registerAdapter.js +13 -0
- package/dist/runtime/nitro/utils/useAwait.d.ts +71 -0
- package/dist/runtime/nitro/utils/useAwait.js +139 -0
- package/dist/runtime/{server-utils → nitro}/utils/useEventManager.d.ts +2 -2
- package/dist/runtime/{server-utils → nitro}/utils/useEventManager.js +1 -1
- package/dist/runtime/nitro/utils/useFlow.d.ts +68 -0
- package/dist/runtime/nitro/utils/useFlow.js +226 -0
- package/dist/runtime/nitro/utils/useHookRegistry.d.ts +34 -0
- package/dist/runtime/nitro/utils/useHookRegistry.js +25 -0
- package/dist/runtime/{server-utils → nitro}/utils/useNventLogger.js +2 -2
- package/dist/runtime/nitro/utils/useRunContext.d.ts +6 -0
- package/dist/runtime/nitro/utils/useRunContext.js +102 -0
- package/dist/runtime/nitro/utils/useStreamTopics.d.ts +83 -0
- package/dist/runtime/nitro/utils/useStreamTopics.js +94 -0
- package/dist/runtime/nitro/utils/useTrigger.d.ts +150 -0
- package/dist/runtime/nitro/utils/useTrigger.js +320 -0
- package/dist/runtime/scheduler/index.d.ts +33 -0
- package/dist/runtime/scheduler/index.js +38 -0
- package/dist/runtime/scheduler/scheduler.d.ts +113 -0
- package/dist/runtime/scheduler/scheduler.js +623 -0
- package/dist/runtime/scheduler/types.d.ts +116 -0
- package/dist/runtime/scheduler/types.js +0 -0
- package/dist/runtime/tsconfig.json +8 -0
- package/dist/runtime/worker/node/runner.d.ts +53 -0
- package/dist/runtime/worker/node/runner.js +327 -0
- package/dist/types.d.mts +2 -2
- package/package.json +16 -46
- 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 -80
- package/dist/runtime/app/composables/useFlowRunTimeline.js +0 -68
- 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 -26
- 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 -45
- 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/api/_flows/[name]/clear-history.delete.d.ts +0 -10
- package/dist/runtime/server/api/_flows/[name]/clear-history.delete.js +0 -44
- package/dist/runtime/server/api/_flows/[name]/runs.get.d.ts +0 -7
- package/dist/runtime/server/api/_flows/[name]/runs.get.js +0 -53
- package/dist/runtime/server/api/_flows/[name]/schedule.post.js +0 -57
- package/dist/runtime/server/api/_flows/[name]/schedules/[id].delete.d.ts +0 -2
- package/dist/runtime/server/api/_flows/[name]/schedules/[id].delete.js +0 -42
- package/dist/runtime/server/api/_flows/[name]/schedules.get.d.ts +0 -2
- package/dist/runtime/server/api/_flows/[name]/schedules.get.js +0 -48
- package/dist/runtime/server/api/_flows/[name]/start.post.d.ts +0 -2
- package/dist/runtime/server/api/_flows/[name]/start.post.js +0 -9
- package/dist/runtime/server/api/_flows/index.get.d.ts +0 -6
- package/dist/runtime/server/api/_flows/index.get.js +0 -5
- package/dist/runtime/server/api/_flows/ws.d.ts +0 -60
- package/dist/runtime/server/api/_flows/ws.js +0 -188
- package/dist/runtime/server/api/_queues/[name]/job/[id].get.d.ts +0 -2
- package/dist/runtime/server/api/_queues/[name]/job/[id].get.js +0 -9
- package/dist/runtime/server/api/_queues/[name]/job/index.get.d.ts +0 -2
- package/dist/runtime/server/api/_queues/[name]/job/index.get.js +0 -18
- package/dist/runtime/server/api/_queues/index.get.d.ts +0 -2
- package/dist/runtime/server/api/_queues/index.get.js +0 -63
- package/dist/runtime/server/api/_queues/ws.d.ts +0 -48
- package/dist/runtime/server/api/_queues/ws.js +0 -205
- 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.d.ts +0 -2
- 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.d.ts +0 -2
- 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/flowWiring.js +0 -409
- 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.d.ts +0 -154
- 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/defineQueueWorker.js +0 -17
- 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/server-utils/worker/runner/node.d.ts +0 -27
- package/dist/runtime/server-utils/worker/runner/node.js +0 -196
- 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.js +0 -0
- /package/dist/runtime/{server/plugins/00.ws-lifecycle.d.ts → nitro/plugins/01.ws-lifecycle.d.ts} +0 -0
- /package/dist/runtime/{server/plugins/00.ws-lifecycle.js → nitro/plugins/01.ws-lifecycle.js} +0 -0
- /package/dist/runtime/{server/api/_flows/[name]/schedule.post.d.ts → nitro/plugins/02.workers.d.ts} +0 -0
- /package/dist/runtime/{server-utils → nitro}/utils/useNventLogger.d.ts +0 -0
- /package/dist/runtime/{server-utils → nitro}/utils/wsPeerManager.d.ts +0 -0
- /package/dist/runtime/{server-utils → nitro}/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, resolveComponent, useTemplateRef, h } 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,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* DELETE /api/_flows/:flowName/clear-history
|
|
3
|
-
*
|
|
4
|
-
* Clears all event history for a specific flow.
|
|
5
|
-
* This deletes:
|
|
6
|
-
* - All flow run streams (nq:flow:run-*)
|
|
7
|
-
* - The flow runs index (nq:flows:<flowName>)
|
|
8
|
-
*/
|
|
9
|
-
declare const _default: any;
|
|
10
|
-
export default _default;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { defineEventHandler, createError, useEventStore } from "#imports";
|
|
2
|
-
export default defineEventHandler(async (event) => {
|
|
3
|
-
const flowName = event.context.params?.name;
|
|
4
|
-
if (!flowName) {
|
|
5
|
-
throw createError({ statusCode: 400, statusMessage: "Flow name required" });
|
|
6
|
-
}
|
|
7
|
-
try {
|
|
8
|
-
const store = useEventStore();
|
|
9
|
-
const names = store.names();
|
|
10
|
-
let deletedStreams = 0;
|
|
11
|
-
let deletedIndex = false;
|
|
12
|
-
const indexKey = names.flowIndex(flowName);
|
|
13
|
-
if (store.indexRead) {
|
|
14
|
-
const runs = await store.indexRead(indexKey, { limit: 1e4 });
|
|
15
|
-
if (store.deleteStream) {
|
|
16
|
-
for (const run of runs) {
|
|
17
|
-
const streamName = names.flow(run.id);
|
|
18
|
-
await store.deleteStream(streamName);
|
|
19
|
-
if (store.deleteIndex) {
|
|
20
|
-
const metaKey = `${indexKey}:meta:${run.id}`;
|
|
21
|
-
await store.deleteIndex(metaKey);
|
|
22
|
-
}
|
|
23
|
-
deletedStreams++;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
if (store.deleteIndex) {
|
|
28
|
-
await store.deleteIndex(indexKey);
|
|
29
|
-
deletedIndex = true;
|
|
30
|
-
}
|
|
31
|
-
return {
|
|
32
|
-
success: true,
|
|
33
|
-
flowName,
|
|
34
|
-
deletedStreams,
|
|
35
|
-
deletedIndex
|
|
36
|
-
};
|
|
37
|
-
} catch (error) {
|
|
38
|
-
throw createError({
|
|
39
|
-
statusCode: 500,
|
|
40
|
-
statusMessage: "Failed to clear flow history",
|
|
41
|
-
data: error instanceof Error ? error.message : String(error)
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
});
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { defineEventHandler, getRouterParam, getQuery, useEventStore, useNventLogger } from "#imports";
|
|
2
|
-
export default defineEventHandler(async (event) => {
|
|
3
|
-
const logger = useNventLogger("api-flows-runs");
|
|
4
|
-
const flowName = getRouterParam(event, "name");
|
|
5
|
-
const query = getQuery(event);
|
|
6
|
-
const limit = Math.min(Number.parseInt(query.limit) || 50, 100);
|
|
7
|
-
const offset = Math.max(Number.parseInt(query.offset) || 0, 0);
|
|
8
|
-
const status = query.status;
|
|
9
|
-
event.node.res.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
|
|
10
|
-
event.node.res.setHeader("Pragma", "no-cache");
|
|
11
|
-
if (!flowName) {
|
|
12
|
-
return { error: "Missing flow name" };
|
|
13
|
-
}
|
|
14
|
-
const store = useEventStore();
|
|
15
|
-
const names = store.names();
|
|
16
|
-
try {
|
|
17
|
-
const runIndexKey = names.flowIndex(flowName);
|
|
18
|
-
let totalCount = 0;
|
|
19
|
-
try {
|
|
20
|
-
const allEntries = await store.indexRead(runIndexKey, { limit: 1e4 });
|
|
21
|
-
totalCount = allEntries.length;
|
|
22
|
-
} catch {
|
|
23
|
-
totalCount = 0;
|
|
24
|
-
}
|
|
25
|
-
const entries = await store.indexRead(runIndexKey, { offset, limit });
|
|
26
|
-
const filteredEntries = status ? entries.filter((e) => e.metadata?.status === status) : entries;
|
|
27
|
-
const items = filteredEntries.map((entry) => ({
|
|
28
|
-
id: entry.id,
|
|
29
|
-
flowName,
|
|
30
|
-
status: entry.metadata?.status || "unknown",
|
|
31
|
-
createdAt: new Date(entry.score).toISOString(),
|
|
32
|
-
startedAt: entry.metadata?.startedAt ? new Date(entry.metadata.startedAt).toISOString() : void 0,
|
|
33
|
-
completedAt: entry.metadata?.completedAt ? new Date(entry.metadata.completedAt).toISOString() : void 0,
|
|
34
|
-
stepCount: entry.metadata?.stepCount || 0,
|
|
35
|
-
completedSteps: entry.metadata?.completedSteps || 0
|
|
36
|
-
}));
|
|
37
|
-
return {
|
|
38
|
-
flowName,
|
|
39
|
-
count: items.length,
|
|
40
|
-
total: totalCount,
|
|
41
|
-
offset,
|
|
42
|
-
limit,
|
|
43
|
-
hasMore: offset + items.length < totalCount,
|
|
44
|
-
items
|
|
45
|
-
};
|
|
46
|
-
} catch (err) {
|
|
47
|
-
logger.error("[flows/runs] error:", { error: err });
|
|
48
|
-
return {
|
|
49
|
-
error: "Failed to list runs",
|
|
50
|
-
message: err instanceof Error ? err.message : String(err)
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
});
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { defineEventHandler, readBody, getRouterParam, createError, useQueue, $useQueueRegistry } from "#imports";
|
|
2
|
-
export default defineEventHandler(async (event) => {
|
|
3
|
-
const flowName = getRouterParam(event, "name");
|
|
4
|
-
if (!flowName) {
|
|
5
|
-
throw createError({ statusCode: 400, statusMessage: "Flow name is required" });
|
|
6
|
-
}
|
|
7
|
-
const body = await readBody(event);
|
|
8
|
-
const { input, cron, delay, jobId, metadata } = body;
|
|
9
|
-
if (cron && delay) {
|
|
10
|
-
throw createError({
|
|
11
|
-
statusCode: 400,
|
|
12
|
-
statusMessage: "Cannot specify both cron and delay"
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
if (!cron && !delay) {
|
|
16
|
-
throw createError({
|
|
17
|
-
statusCode: 400,
|
|
18
|
-
statusMessage: "Must specify either cron or delay"
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
const registry = $useQueueRegistry();
|
|
22
|
-
const flow = registry?.flows?.[flowName];
|
|
23
|
-
if (!flow || !flow.entry) {
|
|
24
|
-
throw createError({ statusCode: 404, statusMessage: `Flow '${flowName}' not found` });
|
|
25
|
-
}
|
|
26
|
-
const queueName = typeof flow.entry.queue === "string" ? flow.entry.queue : flow.entry.queue?.name || flow.entry.queue;
|
|
27
|
-
const queue = useQueue();
|
|
28
|
-
const scheduleOpts = {};
|
|
29
|
-
if (cron) scheduleOpts.cron = cron;
|
|
30
|
-
if (delay) scheduleOpts.delay = delay;
|
|
31
|
-
const jobData = {
|
|
32
|
-
__scheduledFlowStart: true,
|
|
33
|
-
__flowName: flowName,
|
|
34
|
-
__flowInput: input || {},
|
|
35
|
-
__schedule: {
|
|
36
|
-
metadata,
|
|
37
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
const id = await queue.schedule(
|
|
41
|
-
queueName,
|
|
42
|
-
{
|
|
43
|
-
name: flow.entry.step,
|
|
44
|
-
data: jobData,
|
|
45
|
-
opts: jobId ? { jobId } : void 0
|
|
46
|
-
},
|
|
47
|
-
scheduleOpts
|
|
48
|
-
);
|
|
49
|
-
return {
|
|
50
|
-
id,
|
|
51
|
-
flowName,
|
|
52
|
-
queue: queueName,
|
|
53
|
-
step: flow.entry.step,
|
|
54
|
-
schedule: scheduleOpts,
|
|
55
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
56
|
-
};
|
|
57
|
-
});
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { defineEventHandler, getRouterParam, createError, useRuntimeConfig, $useQueueRegistry } from "#imports";
|
|
2
|
-
import { Queue } from "bullmq";
|
|
3
|
-
export default defineEventHandler(async (event) => {
|
|
4
|
-
const flowName = getRouterParam(event, "name");
|
|
5
|
-
const scheduleId = getRouterParam(event, "id");
|
|
6
|
-
if (!flowName || !scheduleId) {
|
|
7
|
-
throw createError({ statusCode: 400, statusMessage: "Flow name and schedule ID are required" });
|
|
8
|
-
}
|
|
9
|
-
const registry = $useQueueRegistry();
|
|
10
|
-
const flow = registry?.flows?.[flowName];
|
|
11
|
-
if (!flow || !flow.entry) {
|
|
12
|
-
throw createError({ statusCode: 404, statusMessage: `Flow '${flowName}' not found` });
|
|
13
|
-
}
|
|
14
|
-
const queueName = typeof flow.entry.queue === "string" ? flow.entry.queue : flow.entry.queue?.name || flow.entry.queue;
|
|
15
|
-
const rc = useRuntimeConfig();
|
|
16
|
-
const connection = rc.queue?.redis;
|
|
17
|
-
let prefix;
|
|
18
|
-
try {
|
|
19
|
-
if (registry && Array.isArray(registry.workers)) {
|
|
20
|
-
const worker = registry.workers.find((w) => w?.queue?.name === queueName);
|
|
21
|
-
if (worker?.queue?.prefix) {
|
|
22
|
-
prefix = worker.queue.prefix;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
} catch {
|
|
26
|
-
}
|
|
27
|
-
const queue = new Queue(queueName, { connection, prefix });
|
|
28
|
-
try {
|
|
29
|
-
await queue.removeRepeatableByKey(scheduleId);
|
|
30
|
-
await queue.close();
|
|
31
|
-
return {
|
|
32
|
-
success: true,
|
|
33
|
-
message: "Schedule deleted successfully"
|
|
34
|
-
};
|
|
35
|
-
} catch (error) {
|
|
36
|
-
await queue.close();
|
|
37
|
-
throw createError({
|
|
38
|
-
statusCode: 500,
|
|
39
|
-
statusMessage: `Failed to delete schedule: ${error.message}`
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
});
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { defineEventHandler, getRouterParam, createError, useRuntimeConfig, $useQueueRegistry } from "#imports";
|
|
2
|
-
import { Queue } from "bullmq";
|
|
3
|
-
export default defineEventHandler(async (event) => {
|
|
4
|
-
const flowName = getRouterParam(event, "name");
|
|
5
|
-
if (!flowName) {
|
|
6
|
-
throw createError({ statusCode: 400, statusMessage: "Flow name is required" });
|
|
7
|
-
}
|
|
8
|
-
const registry = $useQueueRegistry();
|
|
9
|
-
const flow = registry?.flows?.[flowName];
|
|
10
|
-
if (!flow || !flow.entry) {
|
|
11
|
-
throw createError({ statusCode: 404, statusMessage: `Flow '${flowName}' not found` });
|
|
12
|
-
}
|
|
13
|
-
const rc = useRuntimeConfig();
|
|
14
|
-
const connection = rc.queue?.redis;
|
|
15
|
-
const queueName = typeof flow.entry.queue === "string" ? flow.entry.queue : flow.entry.queue?.name || flow.entry.queue;
|
|
16
|
-
let prefix;
|
|
17
|
-
try {
|
|
18
|
-
if (registry && Array.isArray(registry.workers)) {
|
|
19
|
-
const worker = registry.workers.find((w) => w?.queue?.name === queueName);
|
|
20
|
-
if (worker?.queue?.prefix) {
|
|
21
|
-
prefix = worker.queue.prefix;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
} catch {
|
|
25
|
-
}
|
|
26
|
-
const queue = new Queue(queueName, { connection, prefix });
|
|
27
|
-
try {
|
|
28
|
-
const repeatableJobs = await queue.getRepeatableJobs();
|
|
29
|
-
const schedules = repeatableJobs.filter((job) => job.name === flow.entry.step).map((job) => ({
|
|
30
|
-
id: job.key,
|
|
31
|
-
flowName,
|
|
32
|
-
queue: queueName,
|
|
33
|
-
step: flow.entry.step,
|
|
34
|
-
schedule: {
|
|
35
|
-
cron: job.pattern
|
|
36
|
-
},
|
|
37
|
-
nextRun: job.next ? new Date(job.next).toISOString() : void 0
|
|
38
|
-
}));
|
|
39
|
-
await queue.close();
|
|
40
|
-
return schedules;
|
|
41
|
-
} catch (error) {
|
|
42
|
-
await queue.close();
|
|
43
|
-
throw createError({
|
|
44
|
-
statusCode: 500,
|
|
45
|
-
statusMessage: `Failed to list schedules: ${error.message}`
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
});
|