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,9 +0,0 @@
|
|
|
1
|
-
import { defineEventHandler, getRouterParam, createError, readBody, useFlowEngine } from "#imports";
|
|
2
|
-
export default defineEventHandler(async (event) => {
|
|
3
|
-
const flowName = getRouterParam(event, "name");
|
|
4
|
-
if (!flowName) throw createError({ statusCode: 400, statusMessage: "Flow name is required" });
|
|
5
|
-
const { startFlow } = useFlowEngine();
|
|
6
|
-
const body = await readBody(event);
|
|
7
|
-
const result = await startFlow(flowName, body || {});
|
|
8
|
-
return result;
|
|
9
|
-
});
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WebSocket endpoint for flow run events
|
|
3
|
-
* Supports subscribing to specific flow runs and receiving real-time updates
|
|
4
|
-
*
|
|
5
|
-
* Message format (client -> server):
|
|
6
|
-
* {
|
|
7
|
-
* "type": "subscribe",
|
|
8
|
-
* "flowName": "example",
|
|
9
|
-
* "runId": "abc123"
|
|
10
|
-
* }
|
|
11
|
-
*
|
|
12
|
-
* {
|
|
13
|
-
* "type": "unsubscribe",
|
|
14
|
-
* "flowName": "example",
|
|
15
|
-
* "runId": "abc123"
|
|
16
|
-
* }
|
|
17
|
-
*
|
|
18
|
-
* {
|
|
19
|
-
* "type": "ping"
|
|
20
|
-
* }
|
|
21
|
-
*
|
|
22
|
-
* Message format (server -> client):
|
|
23
|
-
* {
|
|
24
|
-
* "type": "event",
|
|
25
|
-
* "flowName": "example",
|
|
26
|
-
* "runId": "abc123",
|
|
27
|
-
* "event": { v: 1, eventType: "...", record: {...} }
|
|
28
|
-
* }
|
|
29
|
-
*
|
|
30
|
-
* {
|
|
31
|
-
* "type": "history",
|
|
32
|
-
* "flowName": "example",
|
|
33
|
-
* "runId": "abc123",
|
|
34
|
-
* "events": [ ...historicalEvents ]
|
|
35
|
-
* }
|
|
36
|
-
*
|
|
37
|
-
* {
|
|
38
|
-
* "type": "subscribed",
|
|
39
|
-
* "flowName": "example",
|
|
40
|
-
* "runId": "abc123"
|
|
41
|
-
* }
|
|
42
|
-
*
|
|
43
|
-
* {
|
|
44
|
-
* "type": "unsubscribed",
|
|
45
|
-
* "flowName": "example",
|
|
46
|
-
* "runId": "abc123"
|
|
47
|
-
* }
|
|
48
|
-
*
|
|
49
|
-
* {
|
|
50
|
-
* "type": "pong",
|
|
51
|
-
* "timestamp": 1234567890
|
|
52
|
-
* }
|
|
53
|
-
*
|
|
54
|
-
* {
|
|
55
|
-
* "type": "error",
|
|
56
|
-
* "message": "error description"
|
|
57
|
-
* }
|
|
58
|
-
*/
|
|
59
|
-
declare const _default: any;
|
|
60
|
-
export default _default;
|
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
defineWebSocketHandler,
|
|
3
|
-
useEventStore,
|
|
4
|
-
usePeerManager,
|
|
5
|
-
useNventLogger
|
|
6
|
-
} from "#imports";
|
|
7
|
-
const peerContexts = /* @__PURE__ */ new WeakMap();
|
|
8
|
-
function safeSend(peer, data) {
|
|
9
|
-
try {
|
|
10
|
-
peer.send(JSON.stringify(data));
|
|
11
|
-
return true;
|
|
12
|
-
} catch {
|
|
13
|
-
return false;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
export default defineWebSocketHandler({
|
|
17
|
-
open(peer) {
|
|
18
|
-
const logger = useNventLogger("api-flows-ws");
|
|
19
|
-
logger.info("[ws] client connected:", { peerId: peer.id });
|
|
20
|
-
const { registerWsPeer } = usePeerManager();
|
|
21
|
-
registerWsPeer(peer);
|
|
22
|
-
peerContexts.set(peer, {
|
|
23
|
-
subscriptions: /* @__PURE__ */ new Map()
|
|
24
|
-
});
|
|
25
|
-
safeSend(peer, {
|
|
26
|
-
type: "connected",
|
|
27
|
-
timestamp: Date.now()
|
|
28
|
-
});
|
|
29
|
-
},
|
|
30
|
-
async message(peer, message) {
|
|
31
|
-
const logger = useNventLogger("api-flows-ws");
|
|
32
|
-
const context = peerContexts.get(peer);
|
|
33
|
-
if (!context) {
|
|
34
|
-
logger.error("[ws] no context for peer:", { peerId: peer.id });
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
let data;
|
|
38
|
-
try {
|
|
39
|
-
data = JSON.parse(message.text());
|
|
40
|
-
} catch {
|
|
41
|
-
safeSend(peer, {
|
|
42
|
-
type: "error",
|
|
43
|
-
message: "Invalid JSON"
|
|
44
|
-
});
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
const { type, flowName, runId } = data;
|
|
48
|
-
if (type === "subscribe") {
|
|
49
|
-
if (!flowName || !runId) {
|
|
50
|
-
safeSend(peer, {
|
|
51
|
-
type: "error",
|
|
52
|
-
message: "Missing flowName or runId"
|
|
53
|
-
});
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
const store = useEventStore();
|
|
57
|
-
const names = store.names();
|
|
58
|
-
const flowStream = names.flow(runId);
|
|
59
|
-
const subscriptionKey = `${flowName}:${runId}`;
|
|
60
|
-
const existingUnsub = context.subscriptions.get(subscriptionKey);
|
|
61
|
-
if (existingUnsub) {
|
|
62
|
-
try {
|
|
63
|
-
existingUnsub();
|
|
64
|
-
} catch (err) {
|
|
65
|
-
logger.error("[ws] error unsubscribing:", { error: err });
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
const unsub = store.subscribe(flowStream, async (event) => {
|
|
69
|
-
safeSend(peer, {
|
|
70
|
-
type: "event",
|
|
71
|
-
flowName,
|
|
72
|
-
runId,
|
|
73
|
-
event: {
|
|
74
|
-
v: 1,
|
|
75
|
-
eventType: event.type,
|
|
76
|
-
record: event
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
context.subscriptions.set(subscriptionKey, unsub);
|
|
81
|
-
try {
|
|
82
|
-
const historicalEvents = await store.read(flowStream, {
|
|
83
|
-
limit: 100,
|
|
84
|
-
direction: "forward"
|
|
85
|
-
});
|
|
86
|
-
safeSend(peer, {
|
|
87
|
-
type: "history",
|
|
88
|
-
flowName,
|
|
89
|
-
runId,
|
|
90
|
-
events: historicalEvents.map((e) => ({
|
|
91
|
-
v: 1,
|
|
92
|
-
eventType: e.kind || e.type,
|
|
93
|
-
record: e
|
|
94
|
-
}))
|
|
95
|
-
});
|
|
96
|
-
} catch (err) {
|
|
97
|
-
logger.error("[ws] error sending history:", { error: err });
|
|
98
|
-
safeSend(peer, {
|
|
99
|
-
type: "error",
|
|
100
|
-
message: "Failed to load history"
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
safeSend(peer, {
|
|
104
|
-
type: "subscribed",
|
|
105
|
-
flowName,
|
|
106
|
-
runId
|
|
107
|
-
});
|
|
108
|
-
} else if (type === "unsubscribe") {
|
|
109
|
-
if (!flowName || !runId) {
|
|
110
|
-
safeSend(peer, {
|
|
111
|
-
type: "error",
|
|
112
|
-
message: "Missing flowName or runId"
|
|
113
|
-
});
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
const subscriptionKey = `${flowName}:${runId}`;
|
|
117
|
-
const unsub = context.subscriptions.get(subscriptionKey);
|
|
118
|
-
if (unsub) {
|
|
119
|
-
try {
|
|
120
|
-
unsub();
|
|
121
|
-
context.subscriptions.delete(subscriptionKey);
|
|
122
|
-
safeSend(peer, {
|
|
123
|
-
type: "unsubscribed",
|
|
124
|
-
flowName,
|
|
125
|
-
runId
|
|
126
|
-
});
|
|
127
|
-
} catch (err) {
|
|
128
|
-
logger.error("[ws] error unsubscribing:", { error: err });
|
|
129
|
-
safeSend(peer, {
|
|
130
|
-
type: "error",
|
|
131
|
-
message: "Failed to unsubscribe"
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
} else if (type === "ping") {
|
|
136
|
-
safeSend(peer, {
|
|
137
|
-
type: "pong",
|
|
138
|
-
timestamp: Date.now()
|
|
139
|
-
});
|
|
140
|
-
} else {
|
|
141
|
-
safeSend(peer, {
|
|
142
|
-
type: "error",
|
|
143
|
-
message: `Unknown message type: ${type}`
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
},
|
|
147
|
-
close(peer, event) {
|
|
148
|
-
const logger = useNventLogger("api-flows-ws");
|
|
149
|
-
const isNormalClosure = event?.code === 1e3 || event?.code === 1001;
|
|
150
|
-
if (!isNormalClosure) {
|
|
151
|
-
logger.info("[ws] client disconnected:", { peerId: peer.id, code: event?.code, reason: event?.reason });
|
|
152
|
-
}
|
|
153
|
-
const { unregisterWsPeer } = usePeerManager();
|
|
154
|
-
unregisterWsPeer(peer);
|
|
155
|
-
const context = peerContexts.get(peer);
|
|
156
|
-
if (context) {
|
|
157
|
-
for (const unsub of context.subscriptions.values()) {
|
|
158
|
-
try {
|
|
159
|
-
unsub();
|
|
160
|
-
} catch (err) {
|
|
161
|
-
if (!isNormalClosure) {
|
|
162
|
-
logger.error("[ws] error unsubscribing on close:", { error: err });
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
context.subscriptions.clear();
|
|
167
|
-
peerContexts.delete(peer);
|
|
168
|
-
}
|
|
169
|
-
},
|
|
170
|
-
error(peer, error) {
|
|
171
|
-
const logger = useNventLogger("api-flows-ws");
|
|
172
|
-
logger.error("[ws] error for peer:", { peerId: peer.id, error });
|
|
173
|
-
const { unregisterWsPeer } = usePeerManager();
|
|
174
|
-
unregisterWsPeer(peer);
|
|
175
|
-
const context = peerContexts.get(peer);
|
|
176
|
-
if (context) {
|
|
177
|
-
for (const unsub of context.subscriptions.values()) {
|
|
178
|
-
try {
|
|
179
|
-
unsub();
|
|
180
|
-
} catch (err) {
|
|
181
|
-
logger.error("[ws] error unsubscribing on error:", { error: err });
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
context.subscriptions.clear();
|
|
185
|
-
peerContexts.delete(peer);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
});
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { defineEventHandler, getRouterParam, useQueue } from "#imports";
|
|
2
|
-
export default defineEventHandler(async (event) => {
|
|
3
|
-
const name = getRouterParam(event, "name") || "";
|
|
4
|
-
const id = getRouterParam(event, "id") || "";
|
|
5
|
-
const { getJob } = useQueue();
|
|
6
|
-
const job = await getJob(name, id);
|
|
7
|
-
if (!job) return null;
|
|
8
|
-
return { ...job, queue: name };
|
|
9
|
-
});
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { defineEventHandler, getRouterParam, getQuery, useQueue, createError } from "#imports";
|
|
2
|
-
export default defineEventHandler(async (event) => {
|
|
3
|
-
const name = getRouterParam(event, "name");
|
|
4
|
-
if (!name) {
|
|
5
|
-
throw createError({ statusCode: 400, statusMessage: "Missing queue name" });
|
|
6
|
-
}
|
|
7
|
-
const query = getQuery(event);
|
|
8
|
-
const state = query.state;
|
|
9
|
-
const { getJobs } = useQueue();
|
|
10
|
-
const jobs = await getJobs(name, {
|
|
11
|
-
state: state ? [state] : void 0,
|
|
12
|
-
limit: 1e3
|
|
13
|
-
// Fetch all jobs, pagination happens client-side
|
|
14
|
-
});
|
|
15
|
-
return {
|
|
16
|
-
jobs
|
|
17
|
-
};
|
|
18
|
-
});
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { defineEventHandler, useRuntimeConfig, $useQueueRegistry, useQueue, useNventLogger } from "#imports";
|
|
2
|
-
export default defineEventHandler(async () => {
|
|
3
|
-
const rc = useRuntimeConfig();
|
|
4
|
-
const logger = useNventLogger("api-queues-index");
|
|
5
|
-
const cfgQueues = rc?.queue?.queues || {};
|
|
6
|
-
const registry = $useQueueRegistry();
|
|
7
|
-
const queue = useQueue();
|
|
8
|
-
const names = /* @__PURE__ */ new Set();
|
|
9
|
-
for (const q in cfgQueues) names.add(q);
|
|
10
|
-
if (registry?.workers?.length) {
|
|
11
|
-
for (const w of registry.workers) names.add(w.queue.name);
|
|
12
|
-
}
|
|
13
|
-
const queuesWithCounts = await Promise.all(
|
|
14
|
-
Array.from(names).map(async (name) => {
|
|
15
|
-
try {
|
|
16
|
-
const counts = await queue.getJobCounts(name);
|
|
17
|
-
const isPaused = await queue.isPaused(name);
|
|
18
|
-
const worker = registry?.workers?.find((w) => w.queue.name === name);
|
|
19
|
-
const queueConfig = worker?.queue || {};
|
|
20
|
-
const workerConfig = worker?.worker || {};
|
|
21
|
-
return {
|
|
22
|
-
name,
|
|
23
|
-
counts,
|
|
24
|
-
isPaused,
|
|
25
|
-
config: {
|
|
26
|
-
queue: {
|
|
27
|
-
prefix: queueConfig.prefix,
|
|
28
|
-
defaultJobOptions: queueConfig.defaultJobOptions,
|
|
29
|
-
limiter: queueConfig.limiter
|
|
30
|
-
},
|
|
31
|
-
worker: {
|
|
32
|
-
concurrency: workerConfig.concurrency,
|
|
33
|
-
lockDurationMs: workerConfig.lockDurationMs,
|
|
34
|
-
maxStalledCount: workerConfig.maxStalledCount,
|
|
35
|
-
drainDelayMs: workerConfig.drainDelayMs,
|
|
36
|
-
autorun: workerConfig.autorun,
|
|
37
|
-
pollingIntervalMs: workerConfig.pollingIntervalMs
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
} catch (err) {
|
|
42
|
-
logger.error(`Failed to get counts for queue ${name}:`, { error: err });
|
|
43
|
-
return {
|
|
44
|
-
name,
|
|
45
|
-
counts: {
|
|
46
|
-
active: 0,
|
|
47
|
-
completed: 0,
|
|
48
|
-
failed: 0,
|
|
49
|
-
delayed: 0,
|
|
50
|
-
waiting: 0,
|
|
51
|
-
paused: 0
|
|
52
|
-
},
|
|
53
|
-
isPaused: false,
|
|
54
|
-
config: {
|
|
55
|
-
queue: {},
|
|
56
|
-
worker: {}
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
})
|
|
61
|
-
);
|
|
62
|
-
return queuesWithCounts;
|
|
63
|
-
});
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WebSocket endpoint for queue events
|
|
3
|
-
* Supports subscribing to specific queues and receiving real-time job updates
|
|
4
|
-
*
|
|
5
|
-
* Message format (client -> server):
|
|
6
|
-
* {
|
|
7
|
-
* "type": "subscribe",
|
|
8
|
-
* "queueName": "test"
|
|
9
|
-
* }
|
|
10
|
-
*
|
|
11
|
-
* {
|
|
12
|
-
* "type": "unsubscribe",
|
|
13
|
-
* "queueName": "test"
|
|
14
|
-
* }
|
|
15
|
-
*
|
|
16
|
-
* {
|
|
17
|
-
* "type": "ping"
|
|
18
|
-
* }
|
|
19
|
-
*
|
|
20
|
-
* Message format (server -> client):
|
|
21
|
-
* {
|
|
22
|
-
* "type": "event",
|
|
23
|
-
* "queueName": "test",
|
|
24
|
-
* "event": { eventType: "waiting|active|completed|failed", jobId: "...", ... }
|
|
25
|
-
* }
|
|
26
|
-
*
|
|
27
|
-
* {
|
|
28
|
-
* "type": "subscribed",
|
|
29
|
-
* "queueName": "test"
|
|
30
|
-
* }
|
|
31
|
-
*
|
|
32
|
-
* {
|
|
33
|
-
* "type": "unsubscribed",
|
|
34
|
-
* "queueName": "test"
|
|
35
|
-
* }
|
|
36
|
-
*
|
|
37
|
-
* {
|
|
38
|
-
* "type": "pong",
|
|
39
|
-
* "timestamp": 1234567890
|
|
40
|
-
* }
|
|
41
|
-
*
|
|
42
|
-
* {
|
|
43
|
-
* "type": "error",
|
|
44
|
-
* "message": "error description"
|
|
45
|
-
* }
|
|
46
|
-
*/
|
|
47
|
-
declare const _default: any;
|
|
48
|
-
export default _default;
|
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
defineWebSocketHandler,
|
|
3
|
-
useQueue,
|
|
4
|
-
usePeerManager,
|
|
5
|
-
useNventLogger
|
|
6
|
-
} from "#imports";
|
|
7
|
-
const peerContexts = /* @__PURE__ */ new WeakMap();
|
|
8
|
-
function safeSend(peer, data) {
|
|
9
|
-
try {
|
|
10
|
-
peer.send(JSON.stringify(data));
|
|
11
|
-
return true;
|
|
12
|
-
} catch {
|
|
13
|
-
return false;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
export default defineWebSocketHandler({
|
|
17
|
-
open(peer) {
|
|
18
|
-
const logger = useNventLogger("api-queues-ws");
|
|
19
|
-
logger.info("[ws:queues] client connected:", peer.id);
|
|
20
|
-
const { registerWsPeer } = usePeerManager();
|
|
21
|
-
registerWsPeer(peer);
|
|
22
|
-
peerContexts.set(peer, {
|
|
23
|
-
subscriptions: /* @__PURE__ */ new Map()
|
|
24
|
-
});
|
|
25
|
-
safeSend(peer, {
|
|
26
|
-
type: "connected",
|
|
27
|
-
timestamp: Date.now()
|
|
28
|
-
});
|
|
29
|
-
},
|
|
30
|
-
async message(peer, message) {
|
|
31
|
-
const logger = useNventLogger("api-queues-ws");
|
|
32
|
-
const context = peerContexts.get(peer);
|
|
33
|
-
if (!context) {
|
|
34
|
-
logger.error("[ws:queues] no context for peer:", peer.id);
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
let data;
|
|
38
|
-
try {
|
|
39
|
-
data = JSON.parse(message.text());
|
|
40
|
-
} catch {
|
|
41
|
-
safeSend(peer, {
|
|
42
|
-
type: "error",
|
|
43
|
-
message: "Invalid JSON"
|
|
44
|
-
});
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
const { type, queueName } = data;
|
|
48
|
-
if (type === "subscribe") {
|
|
49
|
-
if (!queueName) {
|
|
50
|
-
safeSend(peer, {
|
|
51
|
-
type: "error",
|
|
52
|
-
message: "Missing queueName"
|
|
53
|
-
});
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
const queue = useQueue();
|
|
57
|
-
const existingUnsub = context.subscriptions.get(queueName);
|
|
58
|
-
if (existingUnsub) {
|
|
59
|
-
try {
|
|
60
|
-
existingUnsub();
|
|
61
|
-
} catch (err) {
|
|
62
|
-
logger.error("[ws:queues] error unsubscribing:", err);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
const events = [
|
|
66
|
-
"waiting",
|
|
67
|
-
"active",
|
|
68
|
-
"completed",
|
|
69
|
-
"failed",
|
|
70
|
-
"progress"
|
|
71
|
-
];
|
|
72
|
-
const unsubs = events.map(
|
|
73
|
-
(eventType) => queue.on(queueName, eventType, async (payload) => {
|
|
74
|
-
safeSend(peer, {
|
|
75
|
-
type: "event",
|
|
76
|
-
queueName,
|
|
77
|
-
event: {
|
|
78
|
-
eventType,
|
|
79
|
-
...payload
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
if (["waiting", "active", "completed", "failed"].includes(eventType)) {
|
|
83
|
-
try {
|
|
84
|
-
const counts = await queue.getJobCounts(queueName);
|
|
85
|
-
safeSend(peer, {
|
|
86
|
-
type: "counts",
|
|
87
|
-
queueName,
|
|
88
|
-
counts
|
|
89
|
-
});
|
|
90
|
-
} catch (err) {
|
|
91
|
-
logger.error("[ws:queues] error fetching counts after event:", err);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
})
|
|
95
|
-
);
|
|
96
|
-
const unsub = () => {
|
|
97
|
-
for (const u of unsubs) {
|
|
98
|
-
try {
|
|
99
|
-
u();
|
|
100
|
-
} catch (err) {
|
|
101
|
-
logger.error("[ws:queues] error unsubscribing:", err);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
context.subscriptions.set(queueName, unsub);
|
|
106
|
-
try {
|
|
107
|
-
const counts = await queue.getJobCounts(queueName);
|
|
108
|
-
safeSend(peer, {
|
|
109
|
-
type: "counts",
|
|
110
|
-
queueName,
|
|
111
|
-
counts
|
|
112
|
-
});
|
|
113
|
-
} catch (err) {
|
|
114
|
-
logger.error("[ws:queues] error fetching counts:", err);
|
|
115
|
-
}
|
|
116
|
-
safeSend(peer, {
|
|
117
|
-
type: "subscribed",
|
|
118
|
-
queueName
|
|
119
|
-
});
|
|
120
|
-
} else if (type === "unsubscribe") {
|
|
121
|
-
if (!queueName) {
|
|
122
|
-
safeSend(peer, {
|
|
123
|
-
type: "error",
|
|
124
|
-
message: "Missing queueName"
|
|
125
|
-
});
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
const unsub = context.subscriptions.get(queueName);
|
|
129
|
-
if (unsub) {
|
|
130
|
-
try {
|
|
131
|
-
unsub();
|
|
132
|
-
context.subscriptions.delete(queueName);
|
|
133
|
-
safeSend(peer, {
|
|
134
|
-
type: "unsubscribed",
|
|
135
|
-
queueName
|
|
136
|
-
});
|
|
137
|
-
} catch (err) {
|
|
138
|
-
logger.error("[ws:queues] error unsubscribing:", err);
|
|
139
|
-
safeSend(peer, {
|
|
140
|
-
type: "error",
|
|
141
|
-
message: "Failed to unsubscribe"
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
} else if (type === "ping") {
|
|
146
|
-
safeSend(peer, {
|
|
147
|
-
type: "pong",
|
|
148
|
-
timestamp: Date.now()
|
|
149
|
-
});
|
|
150
|
-
} else {
|
|
151
|
-
safeSend(peer, {
|
|
152
|
-
type: "error",
|
|
153
|
-
message: `Unknown message type: ${type}`
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
},
|
|
157
|
-
close(peer, event) {
|
|
158
|
-
const logger = useNventLogger("api-queues-ws");
|
|
159
|
-
const isNormalClosure = event?.code === 1e3 || event?.code === 1001;
|
|
160
|
-
if (!isNormalClosure) {
|
|
161
|
-
logger.info("[ws:queues] client disconnected:", {
|
|
162
|
-
peerId: peer.id,
|
|
163
|
-
code: event?.code,
|
|
164
|
-
reason: event?.reason
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
const { unregisterWsPeer } = usePeerManager();
|
|
168
|
-
unregisterWsPeer(peer);
|
|
169
|
-
const context = peerContexts.get(peer);
|
|
170
|
-
if (context) {
|
|
171
|
-
for (const unsub of context.subscriptions.values()) {
|
|
172
|
-
try {
|
|
173
|
-
unsub();
|
|
174
|
-
} catch (err) {
|
|
175
|
-
if (!isNormalClosure) {
|
|
176
|
-
logger.error("[ws:queues] error unsubscribing on close:", err);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
context.subscriptions.clear();
|
|
181
|
-
peerContexts.delete(peer);
|
|
182
|
-
}
|
|
183
|
-
},
|
|
184
|
-
error(peer, error) {
|
|
185
|
-
const logger = useNventLogger("api-queues-ws");
|
|
186
|
-
logger.error("[ws:queues] error for peer:", {
|
|
187
|
-
peerId: peer.id,
|
|
188
|
-
error
|
|
189
|
-
});
|
|
190
|
-
const { unregisterWsPeer } = usePeerManager();
|
|
191
|
-
unregisterWsPeer(peer);
|
|
192
|
-
const context = peerContexts.get(peer);
|
|
193
|
-
if (context) {
|
|
194
|
-
for (const unsub of context.subscriptions.values()) {
|
|
195
|
-
try {
|
|
196
|
-
unsub();
|
|
197
|
-
} catch (err) {
|
|
198
|
-
logger.error("[ws:queues] error unsubscribing on error:", { error: err });
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
context.subscriptions.clear();
|
|
202
|
-
peerContexts.delete(peer);
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
});
|
|
@@ -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;
|