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,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Stream naming utilities
|
|
3
|
-
*
|
|
4
|
-
* Core streams:
|
|
5
|
-
* - nq:flow:{runId} - Flow run event stream
|
|
6
|
-
* - nq:flows:{flowName} - Sorted set index of flow runs by flow name
|
|
7
|
-
*/
|
|
8
|
-
export interface StreamNamesConfig {
|
|
9
|
-
flow?: string | ((runId: string) => string);
|
|
10
|
-
flowIndex?: string | ((flowName: string) => string);
|
|
11
|
-
}
|
|
12
|
-
export interface StreamNames {
|
|
13
|
-
flow: (runId: string) => string;
|
|
14
|
-
flowIndex: (flowName: string) => string;
|
|
15
|
-
}
|
|
16
|
-
export declare function getStreamNames(): StreamNames;
|
|
17
|
-
export default getStreamNames;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { useRuntimeConfig } from "#imports";
|
|
2
|
-
function defaults() {
|
|
3
|
-
return {
|
|
4
|
-
flow: (runId) => `nq:flow:${runId}`,
|
|
5
|
-
flowIndex: (flowName) => `nq:flows:${flowName}`
|
|
6
|
-
};
|
|
7
|
-
}
|
|
8
|
-
export function getStreamNames() {
|
|
9
|
-
const rc = useRuntimeConfig();
|
|
10
|
-
const cfg = rc?.queue?.eventStore?.streams || {};
|
|
11
|
-
const d = defaults();
|
|
12
|
-
return {
|
|
13
|
-
flow: typeof cfg.flow === "string" ? (runId) => `${cfg.flow}${runId}` : cfg.flow || d.flow,
|
|
14
|
-
flowIndex: typeof cfg.flowIndex === "string" ? (flowName) => `${cfg.flowIndex}${flowName}` : cfg.flowIndex || d.flowIndex
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
export default getStreamNames;
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import type { EventRecord } from '../types.js';
|
|
2
|
-
export interface PublishContext {
|
|
3
|
-
queue?: string;
|
|
4
|
-
jobId?: string;
|
|
5
|
-
/** Flow run ID for flow events */
|
|
6
|
-
flowId?: string;
|
|
7
|
-
/** Trigger ID for trigger events */
|
|
8
|
-
triggerId?: string;
|
|
9
|
-
}
|
|
10
|
-
export interface PublishPayload<T = any> {
|
|
11
|
-
type: string;
|
|
12
|
-
runId: string;
|
|
13
|
-
flowName: string;
|
|
14
|
-
stepName?: string;
|
|
15
|
-
stepId?: string;
|
|
16
|
-
attempt?: number;
|
|
17
|
-
data?: T;
|
|
18
|
-
}
|
|
19
|
-
export interface EventReadOptions {
|
|
20
|
-
fromId?: string;
|
|
21
|
-
limit?: number;
|
|
22
|
-
direction?: 'forward' | 'backward';
|
|
23
|
-
}
|
|
24
|
-
export interface EventSubscription {
|
|
25
|
-
unsubscribe(): void;
|
|
26
|
-
}
|
|
27
|
-
export interface IndexEntry {
|
|
28
|
-
id: string;
|
|
29
|
-
score: number;
|
|
30
|
-
metadata?: {
|
|
31
|
-
status?: 'running' | 'completed' | 'failed';
|
|
32
|
-
startedAt?: number;
|
|
33
|
-
completedAt?: number;
|
|
34
|
-
stepCount?: number;
|
|
35
|
-
completedSteps?: number;
|
|
36
|
-
emittedEvents?: string[];
|
|
37
|
-
version?: number;
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
export interface IndexReadOptions {
|
|
41
|
-
offset?: number;
|
|
42
|
-
limit?: number;
|
|
43
|
-
}
|
|
44
|
-
export interface EventStoreAdapter {
|
|
45
|
-
append(subject: string, e: Omit<EventRecord, 'id' | 'ts'>): Promise<EventRecord>;
|
|
46
|
-
read(subject: string, opts?: EventReadOptions): Promise<EventRecord[]>;
|
|
47
|
-
subscribe(subject: string, onEvent: (e: EventRecord) => void): Promise<EventSubscription>;
|
|
48
|
-
indexAdd?(key: string, id: string, score: number, metadata?: Record<string, any>): Promise<void>;
|
|
49
|
-
indexGet?(key: string, id: string): Promise<IndexEntry | null>;
|
|
50
|
-
indexUpdate?(key: string, id: string, metadata: Record<string, any>): Promise<boolean>;
|
|
51
|
-
indexUpdateWithRetry?(key: string, id: string, metadata: Record<string, any>, maxRetries?: number): Promise<void>;
|
|
52
|
-
indexIncrement?(key: string, id: string, field: string, increment?: number): Promise<number>;
|
|
53
|
-
indexRead?(key: string, opts?: IndexReadOptions): Promise<IndexEntry[]>;
|
|
54
|
-
setMetadataTTL?(flowName: string, runId: string, ttlSeconds: number): Promise<void>;
|
|
55
|
-
cleanupCompletedFlows?(key: string, retentionSeconds: number): Promise<number>;
|
|
56
|
-
/** Delete a specific stream/subject */
|
|
57
|
-
deleteStream?(subject: string): Promise<void>;
|
|
58
|
-
/** Delete all streams matching a pattern (e.g., 'flow:*' or 'trigger:webhook-*') */
|
|
59
|
-
deleteByPattern?(pattern: string): Promise<number>;
|
|
60
|
-
/** Delete an index key */
|
|
61
|
-
deleteIndex?(key: string): Promise<void>;
|
|
62
|
-
close(): Promise<void>;
|
|
63
|
-
}
|
|
@@ -1,409 +0,0 @@
|
|
|
1
|
-
import { getEventBus } from "../eventBus.js";
|
|
2
|
-
import { useEventStore, $useAnalyzedFlows, $useQueueRegistry, useQueue, useNventLogger } from "#imports";
|
|
3
|
-
export function checkPendingStepTriggers(step, emittedEvents, completedSteps) {
|
|
4
|
-
if (!step.subscribes || step.subscribes.length === 0) {
|
|
5
|
-
return true;
|
|
6
|
-
}
|
|
7
|
-
return step.subscribes.every((sub) => {
|
|
8
|
-
if (emittedEvents.has(sub)) return true;
|
|
9
|
-
const [prefix, value] = sub.split(":");
|
|
10
|
-
if (prefix === "step" && value) {
|
|
11
|
-
return completedSteps.has(value);
|
|
12
|
-
}
|
|
13
|
-
return false;
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
async function checkAndTriggerPendingSteps(flowName, runId, store) {
|
|
17
|
-
const logger = useNventLogger("flow-wiring");
|
|
18
|
-
try {
|
|
19
|
-
const analyzedFlows = $useAnalyzedFlows();
|
|
20
|
-
const registry = $useQueueRegistry();
|
|
21
|
-
const { enqueue } = useQueue();
|
|
22
|
-
const flowDef = analyzedFlows.find((f) => f.id === flowName);
|
|
23
|
-
if (!flowDef?.steps) return;
|
|
24
|
-
const indexKey = store.names().flowIndex(flowName);
|
|
25
|
-
const flowEntry = await store.indexGet(indexKey, runId);
|
|
26
|
-
if (!flowEntry?.metadata) return;
|
|
27
|
-
const emittedEvents = new Set(flowEntry.metadata.emittedEvents || []);
|
|
28
|
-
const streamName = store.names().flow(runId);
|
|
29
|
-
const allEvents = await store.read(streamName);
|
|
30
|
-
const completedSteps = /* @__PURE__ */ new Set();
|
|
31
|
-
for (const event of allEvents) {
|
|
32
|
-
if (event.type === "step.completed" && "stepName" in event) {
|
|
33
|
-
completedSteps.add(event.stepName);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
for (const [stepName, stepDef] of Object.entries(flowDef.steps)) {
|
|
37
|
-
const step = stepDef;
|
|
38
|
-
if (!step.subscribes || completedSteps.has(stepName)) continue;
|
|
39
|
-
const canTrigger = checkPendingStepTriggers(step, emittedEvents, completedSteps);
|
|
40
|
-
if (canTrigger) {
|
|
41
|
-
const flowRegistry = (registry?.flows || {})[flowName];
|
|
42
|
-
const stepMeta = flowRegistry?.steps?.[stepName];
|
|
43
|
-
if (stepMeta?.queue) {
|
|
44
|
-
const emitData = {};
|
|
45
|
-
const subscribes = step.subscribes || [];
|
|
46
|
-
for (const sub of subscribes) {
|
|
47
|
-
const emitEvent = allEvents.find(
|
|
48
|
-
(evt) => evt.type === "emit" && evt.data?.name === sub
|
|
49
|
-
);
|
|
50
|
-
if (emitEvent && emitEvent.data?.payload !== void 0) {
|
|
51
|
-
emitData[sub] = emitEvent.data.payload;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
const payload = {
|
|
55
|
-
flowId: runId,
|
|
56
|
-
flowName,
|
|
57
|
-
input: emitData
|
|
58
|
-
// Keyed by event name
|
|
59
|
-
};
|
|
60
|
-
const jobId = `${runId}__${stepName}`;
|
|
61
|
-
try {
|
|
62
|
-
await enqueue(stepMeta.queue, { name: stepName, data: payload, opts: { jobId } });
|
|
63
|
-
logger.debug("Triggered pending step", {
|
|
64
|
-
flowName,
|
|
65
|
-
runId,
|
|
66
|
-
step: stepName,
|
|
67
|
-
subscribes: step.subscribes
|
|
68
|
-
});
|
|
69
|
-
} catch {
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
} catch (err) {
|
|
75
|
-
logger.warn("Failed to check pending steps", {
|
|
76
|
-
flowName,
|
|
77
|
-
runId,
|
|
78
|
-
error: err?.message
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
export function analyzeFlowCompletion(flowSteps, entryStep, events) {
|
|
83
|
-
const allSteps = entryStep ? [entryStep, ...Object.keys(flowSteps)] : Object.keys(flowSteps);
|
|
84
|
-
const completedSteps = /* @__PURE__ */ new Set();
|
|
85
|
-
const failedSteps = /* @__PURE__ */ new Set();
|
|
86
|
-
const retriedSteps = /* @__PURE__ */ new Map();
|
|
87
|
-
let startedAt = 0;
|
|
88
|
-
let completedAt = 0;
|
|
89
|
-
for (const event of events) {
|
|
90
|
-
if (event.type === "flow.start") {
|
|
91
|
-
startedAt = typeof event.ts === "string" ? new Date(event.ts).getTime() : 0;
|
|
92
|
-
}
|
|
93
|
-
if (event.type === "step.completed" && "stepName" in event) {
|
|
94
|
-
completedSteps.add(event.stepName);
|
|
95
|
-
}
|
|
96
|
-
if (event.type === "step.retry" && "stepName" in event) {
|
|
97
|
-
const currentAttempts = retriedSteps.get(event.stepName) || 0;
|
|
98
|
-
retriedSteps.set(event.stepName, currentAttempts + 1);
|
|
99
|
-
}
|
|
100
|
-
if (event.type === "step.failed" && "stepName" in event) {
|
|
101
|
-
failedSteps.add(event.stepName);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
const finalFailedSteps = /* @__PURE__ */ new Set();
|
|
105
|
-
for (const stepName of failedSteps) {
|
|
106
|
-
let lastRetryIndex = -1;
|
|
107
|
-
let lastFailedIndex = -1;
|
|
108
|
-
for (let i = 0; i < events.length; i++) {
|
|
109
|
-
const event = events[i];
|
|
110
|
-
if ("stepName" in event && event.stepName === stepName) {
|
|
111
|
-
if (event.type === "step.retry") {
|
|
112
|
-
lastRetryIndex = i;
|
|
113
|
-
}
|
|
114
|
-
if (event.type === "step.failed") {
|
|
115
|
-
lastFailedIndex = i;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
if (lastFailedIndex > lastRetryIndex) {
|
|
120
|
-
finalFailedSteps.add(stepName);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
const totalSteps = allSteps.length;
|
|
124
|
-
const hasFinalFailures = finalFailedSteps.size > 0;
|
|
125
|
-
let hasBlockingFailure = false;
|
|
126
|
-
if (hasFinalFailures) {
|
|
127
|
-
for (const failedStepName of finalFailedSteps) {
|
|
128
|
-
const failedStepDef = flowSteps[failedStepName];
|
|
129
|
-
if (failedStepDef?.emits && failedStepDef.emits.length > 0) {
|
|
130
|
-
for (const [stepName, stepDef] of Object.entries(flowSteps)) {
|
|
131
|
-
const step = stepDef;
|
|
132
|
-
if (stepName === failedStepName) continue;
|
|
133
|
-
if (step.subscribes && step.subscribes.length > 0) {
|
|
134
|
-
const dependsOnFailedStep = step.subscribes.some((sub) => {
|
|
135
|
-
return failedStepDef.emits.some(
|
|
136
|
-
(emit) => sub === `${failedStepName}.${emit}` || sub === emit
|
|
137
|
-
);
|
|
138
|
-
});
|
|
139
|
-
if (dependsOnFailedStep && !completedSteps.has(stepName)) {
|
|
140
|
-
hasBlockingFailure = true;
|
|
141
|
-
break;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
if (hasBlockingFailure) break;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
if (hasBlockingFailure) {
|
|
150
|
-
return {
|
|
151
|
-
status: "failed",
|
|
152
|
-
totalSteps,
|
|
153
|
-
completedSteps: completedSteps.size,
|
|
154
|
-
startedAt,
|
|
155
|
-
completedAt: Date.now()
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
const allCompleted = allSteps.every(
|
|
159
|
-
(step) => completedSteps.has(step) || finalFailedSteps.has(step)
|
|
160
|
-
);
|
|
161
|
-
let status = "running";
|
|
162
|
-
if (allCompleted) {
|
|
163
|
-
status = "completed";
|
|
164
|
-
completedAt = Date.now();
|
|
165
|
-
}
|
|
166
|
-
return {
|
|
167
|
-
status,
|
|
168
|
-
totalSteps,
|
|
169
|
-
completedSteps: completedSteps.size,
|
|
170
|
-
startedAt,
|
|
171
|
-
completedAt
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
export function createFlowWiring(deps) {
|
|
175
|
-
const { adapter } = deps;
|
|
176
|
-
const bus = getEventBus();
|
|
177
|
-
const unsubs = [];
|
|
178
|
-
let wired = false;
|
|
179
|
-
const indexFlowRun = async (flowName, flowId, timestamp, metadata) => {
|
|
180
|
-
const logger = useNventLogger("flow-wiring");
|
|
181
|
-
try {
|
|
182
|
-
const store = useEventStore();
|
|
183
|
-
const names = store.names();
|
|
184
|
-
const indexKey = names.flowIndex(flowName);
|
|
185
|
-
await store.indexAdd(indexKey, flowId, timestamp, metadata);
|
|
186
|
-
logger.debug("Indexed run", { flowName, flowId, indexKey, timestamp, metadata });
|
|
187
|
-
} catch (err) {
|
|
188
|
-
logger.error("Failed to index run", { error: err });
|
|
189
|
-
}
|
|
190
|
-
};
|
|
191
|
-
function start() {
|
|
192
|
-
if (wired) return;
|
|
193
|
-
wired = true;
|
|
194
|
-
const logger = useNventLogger("flow-wiring");
|
|
195
|
-
const store = useEventStore();
|
|
196
|
-
const names = store.names();
|
|
197
|
-
const handlePersistence = async (e) => {
|
|
198
|
-
try {
|
|
199
|
-
if (e.id && e.ts) {
|
|
200
|
-
return;
|
|
201
|
-
}
|
|
202
|
-
const runId = e.runId;
|
|
203
|
-
if (!runId) {
|
|
204
|
-
return;
|
|
205
|
-
}
|
|
206
|
-
const flowName = e.flowName;
|
|
207
|
-
if (!flowName) {
|
|
208
|
-
return;
|
|
209
|
-
}
|
|
210
|
-
const streamName = names.flow(runId);
|
|
211
|
-
const eventData = {
|
|
212
|
-
type: e.type,
|
|
213
|
-
runId: e.runId,
|
|
214
|
-
flowName: e.flowName,
|
|
215
|
-
data: e.data
|
|
216
|
-
};
|
|
217
|
-
if ("stepName" in e && e.stepName) eventData.stepName = e.stepName;
|
|
218
|
-
if ("stepId" in e && e.stepId) eventData.stepId = e.stepId;
|
|
219
|
-
if ("attempt" in e && e.attempt) eventData.attempt = e.attempt;
|
|
220
|
-
await adapter.append(streamName, eventData);
|
|
221
|
-
if (e.type === "flow.completed" || e.type === "flow.failed") {
|
|
222
|
-
logger.info("Stored terminal event to stream", {
|
|
223
|
-
type: e.type,
|
|
224
|
-
flowName,
|
|
225
|
-
runId
|
|
226
|
-
});
|
|
227
|
-
} else {
|
|
228
|
-
logger.debug("Stored event to stream", {
|
|
229
|
-
type: e.type,
|
|
230
|
-
flowName,
|
|
231
|
-
runId,
|
|
232
|
-
stepName: "stepName" in e ? e.stepName : void 0
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
} catch (err) {
|
|
236
|
-
logger.error("ERROR persisting event", {
|
|
237
|
-
type: e.type,
|
|
238
|
-
runId: e.runId,
|
|
239
|
-
flowName: e.flowName,
|
|
240
|
-
error: err?.message
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
};
|
|
244
|
-
const handleOrchestration = async (e) => {
|
|
245
|
-
try {
|
|
246
|
-
if (e.id && e.ts) {
|
|
247
|
-
return;
|
|
248
|
-
}
|
|
249
|
-
if (e.type === "flow.completed" || e.type === "flow.failed") {
|
|
250
|
-
return;
|
|
251
|
-
}
|
|
252
|
-
const runId = e.runId;
|
|
253
|
-
if (!runId) return;
|
|
254
|
-
const flowName = e.flowName;
|
|
255
|
-
if (!flowName) return;
|
|
256
|
-
const streamName = names.flow(runId);
|
|
257
|
-
const indexKey = names.flowIndex(flowName);
|
|
258
|
-
if (e.type === "flow.start") {
|
|
259
|
-
const timestamp = Date.now();
|
|
260
|
-
await indexFlowRun(flowName, runId, timestamp, {
|
|
261
|
-
status: "running",
|
|
262
|
-
startedAt: timestamp,
|
|
263
|
-
stepCount: 0,
|
|
264
|
-
completedSteps: 0,
|
|
265
|
-
emittedEvents: []
|
|
266
|
-
});
|
|
267
|
-
}
|
|
268
|
-
if (e.type === "step.completed") {
|
|
269
|
-
try {
|
|
270
|
-
const newCount = await store.indexIncrement(indexKey, runId, "completedSteps", 1);
|
|
271
|
-
logger.debug("Incremented completedSteps", {
|
|
272
|
-
flowName,
|
|
273
|
-
runId,
|
|
274
|
-
stepName: "stepName" in e ? e.stepName : "unknown",
|
|
275
|
-
newCount
|
|
276
|
-
});
|
|
277
|
-
} catch (err) {
|
|
278
|
-
logger.warn("Failed to update completedSteps", {
|
|
279
|
-
flowName,
|
|
280
|
-
runId,
|
|
281
|
-
error: err?.message
|
|
282
|
-
});
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
if (e.type === "emit") {
|
|
286
|
-
const emitEvent = e;
|
|
287
|
-
const eventName = emitEvent.data?.name || emitEvent.data?.topic;
|
|
288
|
-
if (!eventName) {
|
|
289
|
-
logger.warn("Emit event missing name/topic", { flowName, runId, data: emitEvent.data });
|
|
290
|
-
} else {
|
|
291
|
-
try {
|
|
292
|
-
const currentEntry = await store.indexGet(indexKey, runId);
|
|
293
|
-
const emittedEvents = (currentEntry?.metadata?.emittedEvents || []).filter((item) => item != null && typeof item === "string");
|
|
294
|
-
if (!emittedEvents.includes(eventName)) {
|
|
295
|
-
await store.indexUpdateWithRetry(indexKey, runId, {
|
|
296
|
-
emittedEvents: [...emittedEvents, eventName]
|
|
297
|
-
});
|
|
298
|
-
logger.debug("Tracked emit event", {
|
|
299
|
-
flowName,
|
|
300
|
-
runId,
|
|
301
|
-
name: eventName,
|
|
302
|
-
allEmitted: [...emittedEvents, eventName]
|
|
303
|
-
});
|
|
304
|
-
}
|
|
305
|
-
} catch (err) {
|
|
306
|
-
logger.warn("Failed to track emitted event", {
|
|
307
|
-
flowName,
|
|
308
|
-
runId,
|
|
309
|
-
event: eventName,
|
|
310
|
-
error: err?.message
|
|
311
|
-
});
|
|
312
|
-
}
|
|
313
|
-
await checkAndTriggerPendingSteps(flowName, runId, store);
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
if (e.type === "step.completed" || e.type === "step.failed") {
|
|
317
|
-
await checkAndTriggerPendingSteps(flowName, runId, store);
|
|
318
|
-
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
319
|
-
try {
|
|
320
|
-
const allEvents = await store.read(streamName);
|
|
321
|
-
const analyzedFlows = $useAnalyzedFlows();
|
|
322
|
-
const flowDef = analyzedFlows.find((f) => f.id === flowName);
|
|
323
|
-
if (flowDef?.steps) {
|
|
324
|
-
const entryStepName = flowDef.entry?.step;
|
|
325
|
-
const analysis = analyzeFlowCompletion(flowDef.steps, entryStepName, allEvents);
|
|
326
|
-
const updateMetadata = {
|
|
327
|
-
status: analysis.status,
|
|
328
|
-
stepCount: analysis.totalSteps
|
|
329
|
-
};
|
|
330
|
-
if (analysis.status !== "running" && analysis.completedAt) {
|
|
331
|
-
updateMetadata.completedAt = analysis.completedAt;
|
|
332
|
-
}
|
|
333
|
-
await store.indexUpdateWithRetry(indexKey, runId, updateMetadata);
|
|
334
|
-
if (analysis.status === "completed" || analysis.status === "failed") {
|
|
335
|
-
const eventType = analysis.status === "completed" ? "flow.completed" : "flow.failed";
|
|
336
|
-
const terminalEventExists = allEvents.some(
|
|
337
|
-
(evt) => evt.type === "flow.completed" || evt.type === "flow.failed"
|
|
338
|
-
);
|
|
339
|
-
if (terminalEventExists) {
|
|
340
|
-
logger.debug("Terminal event already exists, skipping publish", {
|
|
341
|
-
flowName,
|
|
342
|
-
runId,
|
|
343
|
-
eventType
|
|
344
|
-
});
|
|
345
|
-
} else {
|
|
346
|
-
logger.info("Publishing terminal event to bus", {
|
|
347
|
-
flowName,
|
|
348
|
-
runId,
|
|
349
|
-
eventType
|
|
350
|
-
});
|
|
351
|
-
await bus.publish({
|
|
352
|
-
type: eventType,
|
|
353
|
-
runId,
|
|
354
|
-
flowName,
|
|
355
|
-
data: {}
|
|
356
|
-
});
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
} catch (err) {
|
|
361
|
-
logger.warn("Failed to analyze flow completion", {
|
|
362
|
-
flowName,
|
|
363
|
-
runId,
|
|
364
|
-
error: err?.message
|
|
365
|
-
});
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
} catch (err) {
|
|
369
|
-
logger.error("ERROR handling event", {
|
|
370
|
-
type: e.type,
|
|
371
|
-
runId: e.runId,
|
|
372
|
-
flowName: e.flowName,
|
|
373
|
-
error: err?.message,
|
|
374
|
-
stack: err?.stack
|
|
375
|
-
});
|
|
376
|
-
}
|
|
377
|
-
};
|
|
378
|
-
const eventTypes = [
|
|
379
|
-
"flow.start",
|
|
380
|
-
"flow.completed",
|
|
381
|
-
"flow.failed",
|
|
382
|
-
"step.started",
|
|
383
|
-
"step.completed",
|
|
384
|
-
"step.failed",
|
|
385
|
-
"step.retry",
|
|
386
|
-
"log",
|
|
387
|
-
"emit",
|
|
388
|
-
"state"
|
|
389
|
-
];
|
|
390
|
-
for (const type of eventTypes) {
|
|
391
|
-
unsubs.push(bus.onType(type, handlePersistence));
|
|
392
|
-
}
|
|
393
|
-
for (const type of eventTypes) {
|
|
394
|
-
unsubs.push(bus.onType(type, handleOrchestration));
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
function stop() {
|
|
398
|
-
const logger = useNventLogger("flow-wiring");
|
|
399
|
-
for (const u of unsubs.splice(0)) {
|
|
400
|
-
try {
|
|
401
|
-
u();
|
|
402
|
-
} catch {
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
wired = false;
|
|
406
|
-
logger.debug("Flow wiring stopped");
|
|
407
|
-
}
|
|
408
|
-
return { start, stop };
|
|
409
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { StreamAdapter } from '../types.js';
|
|
2
|
-
export interface WiringDeps {
|
|
3
|
-
adapter: StreamAdapter;
|
|
4
|
-
names?: any;
|
|
5
|
-
}
|
|
6
|
-
export interface Wiring {
|
|
7
|
-
start(): void;
|
|
8
|
-
stop(): void;
|
|
9
|
-
}
|
|
10
|
-
export declare function createWiringRegistry(deps: WiringDeps): Wiring;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { createFlowWiring } from "./flowWiring.js";
|
|
2
|
-
export function createWiringRegistry(deps) {
|
|
3
|
-
const wirings = [
|
|
4
|
-
createFlowWiring({ adapter: deps.adapter })
|
|
5
|
-
// add future wirings here (triggers, webhooks, etc.)
|
|
6
|
-
];
|
|
7
|
-
let started = false;
|
|
8
|
-
return {
|
|
9
|
-
start() {
|
|
10
|
-
if (started) return;
|
|
11
|
-
started = true;
|
|
12
|
-
for (const w of wirings) w.start();
|
|
13
|
-
},
|
|
14
|
-
stop() {
|
|
15
|
-
for (const w of wirings) {
|
|
16
|
-
try {
|
|
17
|
-
w.stop();
|
|
18
|
-
} catch {
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
started = false;
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { QueueProvider, JobInput, Job, JobsQuery, ScheduleOptions, QueueEvent, JobCounts } from '../types.js';
|
|
2
|
-
export declare class BullMQProvider implements QueueProvider {
|
|
3
|
-
private queues;
|
|
4
|
-
private logger;
|
|
5
|
-
init(): Promise<void>;
|
|
6
|
-
private ensureQueue;
|
|
7
|
-
enqueue(queueName: string, job: JobInput): Promise<string>;
|
|
8
|
-
schedule(queueName: string, job: JobInput, opts?: ScheduleOptions): Promise<string>;
|
|
9
|
-
getJob(queueName: string, id: string): Promise<Job | null>;
|
|
10
|
-
getJobs(queueName: string, _q?: JobsQuery): Promise<Job[]>;
|
|
11
|
-
on(queueName: string, event: QueueEvent, cb: (p: any) => void): () => void;
|
|
12
|
-
isPaused(queueName: string): Promise<boolean>;
|
|
13
|
-
getJobCounts(queueName: string): Promise<JobCounts>;
|
|
14
|
-
pause(queueName: string): Promise<void>;
|
|
15
|
-
resume(queueName: string): Promise<void>;
|
|
16
|
-
close(): Promise<void>;
|
|
17
|
-
private toJob;
|
|
18
|
-
}
|