nvent 0.4.4 → 0.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module.d.mts +3 -184
- package/dist/module.json +3 -3
- package/dist/module.mjs +133 -197
- package/dist/runtime/adapters/builtin/file-queue.d.ts +53 -0
- package/dist/runtime/adapters/builtin/file-queue.js +435 -0
- package/dist/runtime/adapters/builtin/file-store.d.ts +46 -0
- package/dist/runtime/adapters/builtin/file-store.js +225 -0
- package/dist/runtime/adapters/builtin/file-stream.d.ts +39 -0
- package/dist/runtime/adapters/builtin/file-stream.js +56 -0
- package/dist/runtime/adapters/builtin/index.d.ts +10 -0
- package/dist/runtime/adapters/builtin/index.js +5 -0
- package/dist/runtime/adapters/builtin/memory-queue.d.ts +52 -0
- package/dist/runtime/adapters/builtin/memory-queue.js +239 -0
- package/dist/runtime/adapters/builtin/memory-store.d.ts +57 -0
- package/dist/runtime/adapters/builtin/memory-store.js +263 -0
- package/dist/runtime/adapters/builtin/memory-stream.d.ts +21 -0
- package/dist/runtime/adapters/builtin/memory-stream.js +56 -0
- package/dist/runtime/adapters/factory.d.ts +31 -0
- package/dist/runtime/adapters/factory.js +100 -0
- package/dist/runtime/adapters/index.d.ts +8 -0
- package/dist/runtime/adapters/index.js +3 -0
- package/dist/runtime/adapters/interfaces/index.d.ts +11 -0
- package/dist/runtime/adapters/interfaces/index.js +3 -0
- package/dist/runtime/adapters/interfaces/queue.d.ts +150 -0
- package/dist/runtime/adapters/interfaces/store.d.ts +233 -0
- package/dist/runtime/adapters/interfaces/stream.d.ts +62 -0
- package/dist/runtime/adapters/registry.d.ts +85 -0
- package/dist/runtime/adapters/registry.js +161 -0
- package/dist/runtime/config/index.d.ts +29 -0
- package/dist/runtime/config/index.js +167 -0
- package/dist/runtime/config/types.d.ts +367 -0
- package/dist/runtime/config/types.js +0 -0
- package/dist/runtime/events/types.d.ts +116 -0
- package/dist/runtime/events/types.js +0 -0
- package/dist/runtime/events/utils/stallDetector.d.ts +99 -0
- package/dist/runtime/events/utils/stallDetector.js +237 -0
- package/dist/runtime/{server-utils/events → events}/wiring/flowWiring.d.ts +3 -8
- package/dist/runtime/{server-utils/events → events}/wiring/flowWiring.js +119 -36
- package/dist/runtime/events/wiring/registry.d.ts +19 -0
- package/dist/runtime/events/wiring/registry.js +33 -0
- package/dist/runtime/events/wiring/stateWiring.d.ts +37 -0
- package/dist/runtime/events/wiring/stateWiring.js +92 -0
- package/dist/runtime/events/wiring/streamWiring.d.ts +32 -0
- package/dist/runtime/events/wiring/streamWiring.js +79 -0
- package/dist/runtime/server/api/_flows/[name]/clear-history.delete.js +16 -5
- package/dist/runtime/server/api/_flows/[name]/runs/[runId]/cancel.post.js +21 -0
- package/dist/runtime/server/api/_flows/[name]/runs.get.d.ts +12 -2
- package/dist/runtime/server/api/_flows/[name]/runs.get.js +15 -4
- package/dist/runtime/server/api/_flows/[name]/schedule.post.js +11 -2
- package/dist/runtime/server/api/_flows/[name]/schedules/[id].delete.js +21 -16
- package/dist/runtime/server/api/_flows/[name]/schedules.get.js +21 -19
- package/dist/runtime/server/api/_flows/ws.js +43 -22
- package/dist/runtime/server/api/_queues/[name]/job/[id].get.js +8 -3
- package/dist/runtime/server/api/_queues/[name]/job/index.get.js +12 -3
- package/dist/runtime/server/api/_queues/index.get.js +66 -23
- package/dist/runtime/server/api/_queues/ws.js +14 -4
- package/dist/runtime/server/plugins/00.adapters.d.ts +14 -0
- package/dist/runtime/server/plugins/00.adapters.js +69 -0
- package/dist/runtime/server/plugins/02.workers.js +45 -0
- package/dist/runtime/tsconfig.json +8 -0
- package/dist/runtime/utils/adapters.d.ts +66 -0
- package/dist/runtime/utils/adapters.js +51 -0
- package/dist/runtime/utils/defineFunction.d.ts +10 -0
- package/dist/runtime/{server-utils/utils/defineQueueWorker.js → utils/defineFunction.js} +4 -4
- package/dist/runtime/{server-utils/utils/defineQueueConfig.d.ts → utils/defineFunctionConfig.d.ts} +3 -3
- package/dist/runtime/utils/defineFunctionConfig.js +2 -0
- package/dist/runtime/utils/registerAdapter.d.ts +59 -0
- package/dist/runtime/utils/registerAdapter.js +13 -0
- package/dist/runtime/utils/useFlowEngine.d.ts +19 -0
- package/dist/runtime/utils/useFlowEngine.js +108 -0
- package/dist/runtime/{server-utils/utils → utils}/useNventLogger.js +2 -2
- package/dist/runtime/utils/useStreamTopics.d.ts +72 -0
- package/dist/runtime/utils/useStreamTopics.js +47 -0
- package/dist/runtime/{server-utils/worker/runner/node.d.ts → worker/node/runner.d.ts} +18 -2
- package/dist/runtime/{server-utils/worker/runner/node.js → worker/node/runner.js} +44 -17
- package/dist/types.d.mts +2 -2
- package/package.json +14 -44
- package/LICENSE +0 -21
- package/README.md +0 -389
- package/dist/runtime/app/assets/vueflow.css +0 -1
- package/dist/runtime/app/components/ConfirmDialog.d.vue.ts +0 -33
- package/dist/runtime/app/components/ConfirmDialog.vue +0 -121
- package/dist/runtime/app/components/ConfirmDialog.vue.d.ts +0 -33
- package/dist/runtime/app/components/FlowDiagram.d.vue.ts +0 -64
- package/dist/runtime/app/components/FlowDiagram.vue +0 -338
- package/dist/runtime/app/components/FlowDiagram.vue.d.ts +0 -64
- package/dist/runtime/app/components/FlowNodeCard.d.vue.ts +0 -29
- package/dist/runtime/app/components/FlowNodeCard.vue +0 -156
- package/dist/runtime/app/components/FlowNodeCard.vue.d.ts +0 -29
- package/dist/runtime/app/components/FlowRunOverview.d.vue.ts +0 -9
- package/dist/runtime/app/components/FlowRunOverview.vue +0 -291
- package/dist/runtime/app/components/FlowRunOverview.vue.d.ts +0 -9
- package/dist/runtime/app/components/FlowRunStatusBadge.d.vue.ts +0 -14
- package/dist/runtime/app/components/FlowRunStatusBadge.vue +0 -60
- package/dist/runtime/app/components/FlowRunStatusBadge.vue.d.ts +0 -14
- package/dist/runtime/app/components/FlowRunTimeline.d.vue.ts +0 -12
- package/dist/runtime/app/components/FlowRunTimeline.vue +0 -127
- package/dist/runtime/app/components/FlowRunTimeline.vue.d.ts +0 -12
- package/dist/runtime/app/components/FlowScheduleDialog.d.vue.ts +0 -16
- package/dist/runtime/app/components/FlowScheduleDialog.vue +0 -226
- package/dist/runtime/app/components/FlowScheduleDialog.vue.d.ts +0 -16
- package/dist/runtime/app/components/FlowSchedulesList.d.vue.ts +0 -12
- package/dist/runtime/app/components/FlowSchedulesList.vue +0 -99
- package/dist/runtime/app/components/FlowSchedulesList.vue.d.ts +0 -12
- package/dist/runtime/app/components/JobScheduling.d.vue.ts +0 -6
- package/dist/runtime/app/components/JobScheduling.vue +0 -203
- package/dist/runtime/app/components/JobScheduling.vue.d.ts +0 -6
- package/dist/runtime/app/components/ListItem.d.vue.ts +0 -23
- package/dist/runtime/app/components/ListItem.vue +0 -70
- package/dist/runtime/app/components/ListItem.vue.d.ts +0 -23
- package/dist/runtime/app/components/QueueConfigDetails.d.vue.ts +0 -45
- package/dist/runtime/app/components/QueueConfigDetails.vue +0 -412
- package/dist/runtime/app/components/QueueConfigDetails.vue.d.ts +0 -45
- package/dist/runtime/app/components/StatCounter.d.vue.ts +0 -9
- package/dist/runtime/app/components/StatCounter.vue +0 -25
- package/dist/runtime/app/components/StatCounter.vue.d.ts +0 -9
- package/dist/runtime/app/components/TimelineList.d.vue.ts +0 -7
- package/dist/runtime/app/components/TimelineList.vue +0 -210
- package/dist/runtime/app/components/TimelineList.vue.d.ts +0 -7
- package/dist/runtime/app/components/nhealth/component-router.d.vue.ts +0 -46
- package/dist/runtime/app/components/nhealth/component-router.vue +0 -26
- package/dist/runtime/app/components/nhealth/component-router.vue.d.ts +0 -46
- package/dist/runtime/app/components/nhealth/component-shell.d.vue.ts +0 -24
- package/dist/runtime/app/components/nhealth/component-shell.vue +0 -89
- package/dist/runtime/app/components/nhealth/component-shell.vue.d.ts +0 -24
- package/dist/runtime/app/composables/useAnalyzedFlows.d.ts +0 -14
- package/dist/runtime/app/composables/useAnalyzedFlows.js +0 -8
- package/dist/runtime/app/composables/useComponentRouter.d.ts +0 -38
- package/dist/runtime/app/composables/useComponentRouter.js +0 -240
- package/dist/runtime/app/composables/useFlowRunTimeline.d.ts +0 -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/plugins/00.event-store.d.ts +0 -13
- package/dist/runtime/server/plugins/00.event-store.js +0 -16
- package/dist/runtime/server/plugins/flow-management.d.ts +0 -13
- package/dist/runtime/server/plugins/flow-management.js +0 -65
- package/dist/runtime/server/plugins/queue-management.js +0 -27
- package/dist/runtime/server/plugins/state-cleanup.d.ts +0 -11
- package/dist/runtime/server/plugins/state-cleanup.js +0 -93
- package/dist/runtime/server/plugins/worker-management.js +0 -33
- package/dist/runtime/server/tsconfig.json +0 -3
- package/dist/runtime/server-utils/events/adapters/fileAdapter.d.ts +0 -2
- package/dist/runtime/server-utils/events/adapters/fileAdapter.js +0 -382
- package/dist/runtime/server-utils/events/adapters/memoryAdapter.d.ts +0 -2
- package/dist/runtime/server-utils/events/adapters/memoryAdapter.js +0 -171
- package/dist/runtime/server-utils/events/adapters/redis/redisAdapter.d.ts +0 -2
- package/dist/runtime/server-utils/events/adapters/redis/redisAdapter.js +0 -348
- package/dist/runtime/server-utils/events/adapters/redis/redisPubSubGateway.d.ts +0 -30
- package/dist/runtime/server-utils/events/adapters/redis/redisPubSubGateway.js +0 -82
- package/dist/runtime/server-utils/events/eventStoreFactory.d.ts +0 -19
- package/dist/runtime/server-utils/events/eventStoreFactory.js +0 -44
- package/dist/runtime/server-utils/events/streamNames.d.ts +0 -17
- package/dist/runtime/server-utils/events/streamNames.js +0 -17
- package/dist/runtime/server-utils/events/types.d.ts +0 -63
- package/dist/runtime/server-utils/events/wiring/registry.d.ts +0 -10
- package/dist/runtime/server-utils/events/wiring/registry.js +0 -24
- package/dist/runtime/server-utils/queue/adapters/bullmq.d.ts +0 -18
- package/dist/runtime/server-utils/queue/adapters/bullmq.js +0 -164
- package/dist/runtime/server-utils/queue/queueFactory.d.ts +0 -3
- package/dist/runtime/server-utils/queue/queueFactory.js +0 -10
- package/dist/runtime/server-utils/queue/types.d.ts +0 -47
- package/dist/runtime/server-utils/state/adapters/redis.d.ts +0 -2
- package/dist/runtime/server-utils/state/adapters/redis.js +0 -42
- package/dist/runtime/server-utils/state/stateFactory.d.ts +0 -3
- package/dist/runtime/server-utils/state/stateFactory.js +0 -17
- package/dist/runtime/server-utils/state/types.d.ts +0 -23
- package/dist/runtime/server-utils/utils/defineQueueConfig.js +0 -2
- package/dist/runtime/server-utils/utils/defineQueueWorker.d.ts +0 -10
- package/dist/runtime/server-utils/utils/useEventStore.d.ts +0 -20
- package/dist/runtime/server-utils/utils/useEventStore.js +0 -119
- package/dist/runtime/server-utils/utils/useFlowEngine.d.ts +0 -9
- package/dist/runtime/server-utils/utils/useFlowEngine.js +0 -44
- package/dist/runtime/server-utils/utils/useLogs.d.ts +0 -41
- package/dist/runtime/server-utils/utils/useLogs.js +0 -74
- package/dist/runtime/server-utils/utils/useQueue.d.ts +0 -31
- package/dist/runtime/server-utils/utils/useQueue.js +0 -24
- package/dist/runtime/server-utils/worker/adapter.d.ts +0 -4
- package/dist/runtime/server-utils/worker/adapter.js +0 -66
- package/dist/runtime/types.d.ts +0 -132
- /package/dist/runtime/{server-utils/events/types.js → adapters/interfaces/queue.js} +0 -0
- /package/dist/runtime/{server-utils/queue/types.js → adapters/interfaces/store.js} +0 -0
- /package/dist/runtime/{server-utils/state/types.js → adapters/interfaces/stream.js} +0 -0
- /package/dist/runtime/{server-utils/events → events}/eventBus.d.ts +0 -0
- /package/dist/runtime/{server-utils/events → events}/eventBus.js +0 -0
- /package/dist/runtime/server/{plugins/queue-management.d.ts → api/_flows/[name]/runs/[runId]/cancel.post.d.ts} +0 -0
- /package/dist/runtime/server/plugins/{00.ws-lifecycle.d.ts → 01.ws-lifecycle.d.ts} +0 -0
- /package/dist/runtime/server/plugins/{00.ws-lifecycle.js → 01.ws-lifecycle.js} +0 -0
- /package/dist/runtime/server/plugins/{worker-management.d.ts → 02.workers.d.ts} +0 -0
- /package/dist/runtime/{server-utils/utils → utils}/useEventManager.d.ts +0 -0
- /package/dist/runtime/{server-utils/utils → utils}/useEventManager.js +0 -0
- /package/dist/runtime/{server-utils/utils → utils}/useNventLogger.d.ts +0 -0
- /package/dist/runtime/{server-utils/utils → utils}/wsPeerManager.d.ts +0 -0
- /package/dist/runtime/{server-utils/utils → utils}/wsPeerManager.js +0 -0
- /package/dist/runtime/{python → worker/python}/get_config.py +0 -0
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import defu from "defu";
|
|
2
|
+
export function normalizeModuleOptions(options) {
|
|
3
|
+
const defaults = {
|
|
4
|
+
dir: "functions",
|
|
5
|
+
ui: true,
|
|
6
|
+
debug: {},
|
|
7
|
+
connections: {},
|
|
8
|
+
queue: {
|
|
9
|
+
adapter: "file",
|
|
10
|
+
prefix: "nq",
|
|
11
|
+
defaultJobOptions: {},
|
|
12
|
+
worker: {
|
|
13
|
+
concurrency: 2,
|
|
14
|
+
autorun: true,
|
|
15
|
+
pollingIntervalMs: 1e3
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
stream: {
|
|
19
|
+
adapter: "memory",
|
|
20
|
+
prefix: "nq"
|
|
21
|
+
},
|
|
22
|
+
store: {
|
|
23
|
+
adapter: "file",
|
|
24
|
+
prefix: "nq",
|
|
25
|
+
state: {
|
|
26
|
+
autoScope: "always",
|
|
27
|
+
cleanup: {
|
|
28
|
+
strategy: "never",
|
|
29
|
+
ttlMs: 36e5
|
|
30
|
+
// 1 hour
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
eventTTL: 604800,
|
|
34
|
+
// 7 days
|
|
35
|
+
metadataTTL: 2592e3
|
|
36
|
+
// 30 days
|
|
37
|
+
},
|
|
38
|
+
flows: {
|
|
39
|
+
stallDetection: {
|
|
40
|
+
enabled: true,
|
|
41
|
+
stallTimeout: 30 * 60 * 1e3,
|
|
42
|
+
// 30 minutes
|
|
43
|
+
checkInterval: 15 * 60 * 1e3,
|
|
44
|
+
// 15 minutes
|
|
45
|
+
enablePeriodicCheck: true
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const normalized = defu(options, defaults);
|
|
50
|
+
const neededConnections = /* @__PURE__ */ new Set();
|
|
51
|
+
const queueAdapter = normalized.queue.adapter;
|
|
52
|
+
if (queueAdapter === "redis") {
|
|
53
|
+
neededConnections.add("redis");
|
|
54
|
+
} else if (queueAdapter === "postgres") {
|
|
55
|
+
neededConnections.add("postgres");
|
|
56
|
+
} else if (queueAdapter === "file") {
|
|
57
|
+
neededConnections.add("file");
|
|
58
|
+
}
|
|
59
|
+
const streamAdapter = normalized.stream.adapter;
|
|
60
|
+
if (streamAdapter === "redis") {
|
|
61
|
+
neededConnections.add("redis");
|
|
62
|
+
} else if (streamAdapter === "rabbitmq") {
|
|
63
|
+
neededConnections.add("rabbitmq");
|
|
64
|
+
} else if (streamAdapter === "kafka") {
|
|
65
|
+
neededConnections.add("kafka");
|
|
66
|
+
}
|
|
67
|
+
const storeAdapter = normalized.store.adapter;
|
|
68
|
+
if (storeAdapter === "redis") {
|
|
69
|
+
neededConnections.add("redis");
|
|
70
|
+
} else if (storeAdapter === "postgres") {
|
|
71
|
+
neededConnections.add("postgres");
|
|
72
|
+
} else if (storeAdapter === "file") {
|
|
73
|
+
neededConnections.add("file");
|
|
74
|
+
}
|
|
75
|
+
if (!normalized.connections) {
|
|
76
|
+
normalized.connections = {};
|
|
77
|
+
}
|
|
78
|
+
if (neededConnections.has("redis") && !normalized.connections.redis) {
|
|
79
|
+
normalized.connections.redis = {
|
|
80
|
+
host: "127.0.0.1",
|
|
81
|
+
port: 6379
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
if (neededConnections.has("postgres") && !normalized.connections.postgres) {
|
|
85
|
+
normalized.connections.postgres = {
|
|
86
|
+
connectionString: process.env.DATABASE_URL || "postgresql://localhost:5432/nuxt_queue"
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
if (neededConnections.has("rabbitmq") && !normalized.connections.rabbitmq) {
|
|
90
|
+
normalized.connections.rabbitmq = {
|
|
91
|
+
host: "localhost",
|
|
92
|
+
port: 5672
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
if (neededConnections.has("kafka") && !normalized.connections.kafka) {
|
|
96
|
+
normalized.connections.kafka = {
|
|
97
|
+
brokers: ["localhost:9092"]
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
if (neededConnections.has("file") && !normalized.connections.file) {
|
|
101
|
+
normalized.connections.file = {
|
|
102
|
+
dataDir: ".data"
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
applyConnectionFallback(normalized);
|
|
106
|
+
return normalized;
|
|
107
|
+
}
|
|
108
|
+
function applyConnectionFallback(config) {
|
|
109
|
+
if (!config.queue.redis && config.connections.redis) {
|
|
110
|
+
config.queue.redis = config.connections.redis;
|
|
111
|
+
}
|
|
112
|
+
if (!config.queue.postgres && config.connections.postgres) {
|
|
113
|
+
config.queue.postgres = config.connections.postgres;
|
|
114
|
+
}
|
|
115
|
+
if (!config.queue.file && config.connections.file) {
|
|
116
|
+
config.queue.file = {
|
|
117
|
+
dataDir: `${config.connections.file.dataDir}/queue`
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
if (!config.stream.redis && config.connections.redis) {
|
|
121
|
+
config.stream.redis = config.connections.redis;
|
|
122
|
+
}
|
|
123
|
+
if (!config.stream.rabbitmq && config.connections.rabbitmq) {
|
|
124
|
+
config.stream.rabbitmq = config.connections.rabbitmq;
|
|
125
|
+
}
|
|
126
|
+
if (!config.stream.kafka && config.connections.kafka) {
|
|
127
|
+
config.stream.kafka = config.connections.kafka;
|
|
128
|
+
}
|
|
129
|
+
if (!config.store.redis && config.connections.redis) {
|
|
130
|
+
config.store.redis = config.connections.redis;
|
|
131
|
+
}
|
|
132
|
+
if (!config.store.postgres && config.connections.postgres) {
|
|
133
|
+
config.store.postgres = config.connections.postgres;
|
|
134
|
+
}
|
|
135
|
+
if (!config.store.file && config.connections.file) {
|
|
136
|
+
config.store.file = {
|
|
137
|
+
dataDir: `${config.connections.file.dataDir}/store`
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
export function toRuntimeConfig(normalizedOptions) {
|
|
142
|
+
return {
|
|
143
|
+
debug: normalizedOptions.debug,
|
|
144
|
+
rootDir: void 0,
|
|
145
|
+
queue: normalizedOptions.queue,
|
|
146
|
+
stream: normalizedOptions.stream,
|
|
147
|
+
store: normalizedOptions.store,
|
|
148
|
+
connections: normalizedOptions.connections,
|
|
149
|
+
flows: normalizedOptions.flows
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
export function getRedisStorageConfig(normalizedOptions) {
|
|
153
|
+
const redisConfig = normalizedOptions.connections.redis;
|
|
154
|
+
if (!redisConfig) {
|
|
155
|
+
return {
|
|
156
|
+
host: "127.0.0.1",
|
|
157
|
+
port: 6379
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
return {
|
|
161
|
+
host: redisConfig.host,
|
|
162
|
+
port: redisConfig.port,
|
|
163
|
+
username: redisConfig.username,
|
|
164
|
+
password: redisConfig.password,
|
|
165
|
+
db: redisConfig.db
|
|
166
|
+
};
|
|
167
|
+
}
|
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Redis connection configuration
|
|
3
|
+
*/
|
|
4
|
+
export interface RedisConfig {
|
|
5
|
+
host?: string;
|
|
6
|
+
port?: number;
|
|
7
|
+
username?: string;
|
|
8
|
+
password?: string;
|
|
9
|
+
db?: number;
|
|
10
|
+
url?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* PostgreSQL connection configuration
|
|
14
|
+
*/
|
|
15
|
+
export interface PostgresConfig {
|
|
16
|
+
connectionString?: string;
|
|
17
|
+
host?: string;
|
|
18
|
+
port?: number;
|
|
19
|
+
database?: string;
|
|
20
|
+
user?: string;
|
|
21
|
+
password?: string;
|
|
22
|
+
ssl?: boolean | object;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* RabbitMQ connection configuration
|
|
26
|
+
*/
|
|
27
|
+
export interface RabbitMQConfig {
|
|
28
|
+
url?: string;
|
|
29
|
+
host?: string;
|
|
30
|
+
port?: number;
|
|
31
|
+
username?: string;
|
|
32
|
+
password?: string;
|
|
33
|
+
vhost?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Kafka connection configuration
|
|
37
|
+
*/
|
|
38
|
+
export interface KafkaConfig {
|
|
39
|
+
brokers?: string[];
|
|
40
|
+
clientId?: string;
|
|
41
|
+
groupId?: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* File storage configuration
|
|
45
|
+
*/
|
|
46
|
+
export interface FileConfig {
|
|
47
|
+
/**
|
|
48
|
+
* Base directory for file storage
|
|
49
|
+
* @default '.data'
|
|
50
|
+
*/
|
|
51
|
+
dataDir?: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Shared connection configurations (v0.4.1)
|
|
55
|
+
* Provides fallback connections for all adapters
|
|
56
|
+
*/
|
|
57
|
+
export interface ConnectionsConfig {
|
|
58
|
+
/**
|
|
59
|
+
* Shared Redis connection - used by adapters that specify 'redis' but don't provide connection details
|
|
60
|
+
*/
|
|
61
|
+
redis?: RedisConfig;
|
|
62
|
+
/**
|
|
63
|
+
* Shared Postgres connection - used by adapters that specify 'postgres' but don't provide connection details
|
|
64
|
+
*/
|
|
65
|
+
postgres?: PostgresConfig;
|
|
66
|
+
/**
|
|
67
|
+
* Shared RabbitMQ connection - used by stream adapter when 'rabbitmq' is specified
|
|
68
|
+
*/
|
|
69
|
+
rabbitmq?: RabbitMQConfig;
|
|
70
|
+
/**
|
|
71
|
+
* Shared Kafka connection - used by stream adapter when 'kafka' is specified
|
|
72
|
+
*/
|
|
73
|
+
kafka?: KafkaConfig;
|
|
74
|
+
/**
|
|
75
|
+
* Shared file storage configuration - used by file adapters
|
|
76
|
+
*/
|
|
77
|
+
file?: FileConfig;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Worker configuration
|
|
81
|
+
*/
|
|
82
|
+
export interface WorkerConfig {
|
|
83
|
+
/**
|
|
84
|
+
* Number of concurrent jobs to process
|
|
85
|
+
* @default 2
|
|
86
|
+
*/
|
|
87
|
+
concurrency?: number;
|
|
88
|
+
/**
|
|
89
|
+
* Lock duration for jobs in milliseconds
|
|
90
|
+
*/
|
|
91
|
+
lockDurationMs?: number;
|
|
92
|
+
/**
|
|
93
|
+
* Maximum number of times a job can be stalled before failing
|
|
94
|
+
*/
|
|
95
|
+
maxStalledCount?: number;
|
|
96
|
+
/**
|
|
97
|
+
* Delay before draining the queue on shutdown
|
|
98
|
+
*/
|
|
99
|
+
drainDelayMs?: number;
|
|
100
|
+
/**
|
|
101
|
+
* Automatically start workers
|
|
102
|
+
* @default true
|
|
103
|
+
*/
|
|
104
|
+
autorun?: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Polling interval for file adapter (milliseconds)
|
|
107
|
+
* @default 1000
|
|
108
|
+
*/
|
|
109
|
+
pollingIntervalMs?: number;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Queue adapter configuration (v0.4.1)
|
|
113
|
+
*/
|
|
114
|
+
export interface QueueConfig {
|
|
115
|
+
/**
|
|
116
|
+
* Queue backend adapter
|
|
117
|
+
* @default 'file'
|
|
118
|
+
*/
|
|
119
|
+
adapter?: 'memory' | 'file' | 'redis' | 'postgres';
|
|
120
|
+
/**
|
|
121
|
+
* Redis connection (overrides connections.redis if specified)
|
|
122
|
+
*/
|
|
123
|
+
redis?: RedisConfig;
|
|
124
|
+
/**
|
|
125
|
+
* Postgres connection (overrides connections.postgres if specified)
|
|
126
|
+
*/
|
|
127
|
+
postgres?: PostgresConfig;
|
|
128
|
+
/**
|
|
129
|
+
* File storage configuration (overrides connections.file if specified)
|
|
130
|
+
*/
|
|
131
|
+
file?: FileConfig;
|
|
132
|
+
/**
|
|
133
|
+
* Queue-specific options (BullMQ/PGBoss configuration)
|
|
134
|
+
*/
|
|
135
|
+
prefix?: string;
|
|
136
|
+
defaultJobOptions?: {
|
|
137
|
+
attempts?: number;
|
|
138
|
+
backoff?: number | {
|
|
139
|
+
type: 'fixed' | 'exponential';
|
|
140
|
+
delay: number;
|
|
141
|
+
};
|
|
142
|
+
delay?: number;
|
|
143
|
+
priority?: number;
|
|
144
|
+
timeout?: number;
|
|
145
|
+
lifo?: boolean;
|
|
146
|
+
removeOnComplete?: boolean | number;
|
|
147
|
+
removeOnFail?: boolean | number;
|
|
148
|
+
};
|
|
149
|
+
limiter?: {
|
|
150
|
+
max?: number;
|
|
151
|
+
duration?: number;
|
|
152
|
+
groupKey?: string;
|
|
153
|
+
};
|
|
154
|
+
/**
|
|
155
|
+
* Worker configuration
|
|
156
|
+
*/
|
|
157
|
+
worker?: WorkerConfig;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Stream adapter configuration (v0.4.1)
|
|
161
|
+
* Cross-instance pub/sub messaging
|
|
162
|
+
*/
|
|
163
|
+
export interface StreamConfig {
|
|
164
|
+
/**
|
|
165
|
+
* Stream adapter
|
|
166
|
+
* @default 'memory'
|
|
167
|
+
*/
|
|
168
|
+
adapter?: 'memory' | 'redis' | 'rabbitmq' | 'kafka';
|
|
169
|
+
/**
|
|
170
|
+
* Redis connection (overrides connections.redis if specified)
|
|
171
|
+
*/
|
|
172
|
+
redis?: RedisConfig;
|
|
173
|
+
/**
|
|
174
|
+
* Postgres connection (overrides connections.postgres if specified)
|
|
175
|
+
*/
|
|
176
|
+
postgres?: PostgresConfig;
|
|
177
|
+
/**
|
|
178
|
+
* RabbitMQ connection (overrides connections.rabbitmq if specified)
|
|
179
|
+
*/
|
|
180
|
+
rabbitmq?: RabbitMQConfig;
|
|
181
|
+
/**
|
|
182
|
+
* Kafka connection (overrides connections.kafka if specified)
|
|
183
|
+
*/
|
|
184
|
+
kafka?: KafkaConfig;
|
|
185
|
+
/**
|
|
186
|
+
* Stream-specific options
|
|
187
|
+
*/
|
|
188
|
+
prefix?: string;
|
|
189
|
+
retryAttempts?: number;
|
|
190
|
+
retryDelay?: number;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Flow configuration
|
|
194
|
+
*/
|
|
195
|
+
export interface FlowConfig {
|
|
196
|
+
/**
|
|
197
|
+
* Stall detection configuration
|
|
198
|
+
* Detects and marks flows that have been running without activity for too long
|
|
199
|
+
*/
|
|
200
|
+
stallDetection?: {
|
|
201
|
+
/**
|
|
202
|
+
* Enable stall detection
|
|
203
|
+
* @default true
|
|
204
|
+
*/
|
|
205
|
+
enabled?: boolean;
|
|
206
|
+
/**
|
|
207
|
+
* Time in milliseconds after which a running flow without activity is considered stalled
|
|
208
|
+
* @default 1800000 (30 minutes)
|
|
209
|
+
*/
|
|
210
|
+
stallTimeout?: number;
|
|
211
|
+
/**
|
|
212
|
+
* Interval in milliseconds for periodic stall checks
|
|
213
|
+
* @default 900000 (15 minutes)
|
|
214
|
+
*/
|
|
215
|
+
checkInterval?: number;
|
|
216
|
+
/**
|
|
217
|
+
* Enable periodic background checks
|
|
218
|
+
* Set to false to use only lazy detection (when flows are queried)
|
|
219
|
+
* @default true
|
|
220
|
+
*/
|
|
221
|
+
enablePeriodicCheck?: boolean;
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* State management configuration
|
|
226
|
+
*/
|
|
227
|
+
export interface StateManagementConfig {
|
|
228
|
+
/**
|
|
229
|
+
* Automatic scope/flow ID assignment for state operations
|
|
230
|
+
* - 'always': Always create a new flow ID (recommended for most cases)
|
|
231
|
+
* - 'flow': Only use flow ID if provided in context
|
|
232
|
+
* - 'never': Never scope state to flow IDs
|
|
233
|
+
* @default 'always'
|
|
234
|
+
*/
|
|
235
|
+
autoScope?: 'always' | 'flow' | 'never';
|
|
236
|
+
/**
|
|
237
|
+
* State cleanup strategy
|
|
238
|
+
*/
|
|
239
|
+
cleanup?: {
|
|
240
|
+
/**
|
|
241
|
+
* Cleanup strategy
|
|
242
|
+
* - 'never': State persists indefinitely
|
|
243
|
+
* - 'immediate': Cleanup after each step (not recommended)
|
|
244
|
+
* - 'on-complete': Cleanup when flow completes (recommended)
|
|
245
|
+
* - 'ttl': Automatic expiration via TTL
|
|
246
|
+
* @default 'never'
|
|
247
|
+
*/
|
|
248
|
+
strategy?: 'never' | 'immediate' | 'on-complete' | 'ttl';
|
|
249
|
+
/**
|
|
250
|
+
* TTL in milliseconds for 'ttl' strategy
|
|
251
|
+
* @default 3600000 (1 hour)
|
|
252
|
+
*/
|
|
253
|
+
ttlMs?: number;
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Store adapter configuration (v0.4.1)
|
|
258
|
+
* Three-tier storage: events (NDJSON), documents (JSON), KV (JSON), indices (JSON)
|
|
259
|
+
* Replaces both state and eventStore configs from v0.4.0
|
|
260
|
+
*/
|
|
261
|
+
export interface StoreConfig {
|
|
262
|
+
/**
|
|
263
|
+
* Store adapter
|
|
264
|
+
* @default 'file'
|
|
265
|
+
*/
|
|
266
|
+
adapter?: 'memory' | 'file' | 'redis' | 'postgres';
|
|
267
|
+
/**
|
|
268
|
+
* Redis connection (overrides connections.redis if specified)
|
|
269
|
+
*/
|
|
270
|
+
redis?: RedisConfig;
|
|
271
|
+
/**
|
|
272
|
+
* Postgres connection (overrides connections.postgres if specified)
|
|
273
|
+
*/
|
|
274
|
+
postgres?: PostgresConfig;
|
|
275
|
+
/**
|
|
276
|
+
* File storage configuration (overrides connections.file if specified)
|
|
277
|
+
*/
|
|
278
|
+
file?: FileConfig;
|
|
279
|
+
/**
|
|
280
|
+
* Key prefix/namespace for all store operations
|
|
281
|
+
* @default 'nq'
|
|
282
|
+
*/
|
|
283
|
+
prefix?: string;
|
|
284
|
+
/**
|
|
285
|
+
* State management configuration (KV store behavior)
|
|
286
|
+
*/
|
|
287
|
+
state?: StateManagementConfig;
|
|
288
|
+
/**
|
|
289
|
+
* Event stream TTL in seconds
|
|
290
|
+
* @default 604800 (7 days)
|
|
291
|
+
*/
|
|
292
|
+
eventTTL?: number;
|
|
293
|
+
/**
|
|
294
|
+
* Metadata document TTL in seconds
|
|
295
|
+
* @default 2592000 (30 days)
|
|
296
|
+
*/
|
|
297
|
+
metadataTTL?: number;
|
|
298
|
+
/**
|
|
299
|
+
* KV store TTL in seconds
|
|
300
|
+
*/
|
|
301
|
+
kvTTL?: number;
|
|
302
|
+
/**
|
|
303
|
+
* Index TTL in seconds
|
|
304
|
+
*/
|
|
305
|
+
indexTTL?: number;
|
|
306
|
+
/**
|
|
307
|
+
* Enable compression for stored data
|
|
308
|
+
*/
|
|
309
|
+
compression?: boolean;
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Module options for nvent (v0.4.1+)
|
|
313
|
+
*/
|
|
314
|
+
export interface ModuleOptions {
|
|
315
|
+
/**
|
|
316
|
+
* Directory to scan for function definitions
|
|
317
|
+
* @default 'server/functions'
|
|
318
|
+
*/
|
|
319
|
+
dir?: string;
|
|
320
|
+
/**
|
|
321
|
+
* Enable dev UI
|
|
322
|
+
* @default true in development
|
|
323
|
+
*/
|
|
324
|
+
ui?: boolean;
|
|
325
|
+
/**
|
|
326
|
+
* Debug configuration
|
|
327
|
+
*/
|
|
328
|
+
debug?: Record<string, any>;
|
|
329
|
+
/**
|
|
330
|
+
* Queue adapter configuration (job execution)
|
|
331
|
+
*/
|
|
332
|
+
queue?: QueueConfig;
|
|
333
|
+
/**
|
|
334
|
+
* Stream adapter configuration (pub/sub messaging)
|
|
335
|
+
* @since v0.4.1
|
|
336
|
+
*/
|
|
337
|
+
stream?: StreamConfig;
|
|
338
|
+
/**
|
|
339
|
+
* Store adapter configuration (persistence)
|
|
340
|
+
* Three-tier storage: events, documents, KV, indices
|
|
341
|
+
* @since v0.4.1
|
|
342
|
+
*/
|
|
343
|
+
store?: StoreConfig;
|
|
344
|
+
/**
|
|
345
|
+
* Flow-specific configuration
|
|
346
|
+
* @since v0.4.1
|
|
347
|
+
*/
|
|
348
|
+
flows?: FlowConfig;
|
|
349
|
+
/**
|
|
350
|
+
* Shared connection configurations
|
|
351
|
+
* Used as fallback if adapters don't specify their own connections
|
|
352
|
+
* @since v0.4.1
|
|
353
|
+
*/
|
|
354
|
+
connections?: ConnectionsConfig;
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Runtime config shape for nvent module (v0.4.1+)
|
|
358
|
+
*/
|
|
359
|
+
export interface ModuleConfig {
|
|
360
|
+
debug?: Record<string, any>;
|
|
361
|
+
queue: Required<QueueConfig>;
|
|
362
|
+
stream: Required<StreamConfig>;
|
|
363
|
+
store: Required<StoreConfig>;
|
|
364
|
+
flows: Required<FlowConfig>;
|
|
365
|
+
connections: Required<ConnectionsConfig>;
|
|
366
|
+
rootDir?: string;
|
|
367
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
export interface PublishContext {
|
|
2
|
+
queue?: string;
|
|
3
|
+
jobId?: string;
|
|
4
|
+
/** Flow run ID for flow events */
|
|
5
|
+
flowId?: string;
|
|
6
|
+
/** Trigger ID for trigger events */
|
|
7
|
+
triggerId?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface PublishPayload<T = any> {
|
|
10
|
+
type: string;
|
|
11
|
+
runId: string;
|
|
12
|
+
flowName: string;
|
|
13
|
+
stepName?: string;
|
|
14
|
+
stepId?: string;
|
|
15
|
+
attempt?: number;
|
|
16
|
+
data?: T;
|
|
17
|
+
}
|
|
18
|
+
export type EventType = 'flow.start' | 'flow.completed' | 'flow.failed' | 'flow.cancel' | 'step.started' | 'step.completed' | 'step.failed' | 'step.retry' | 'log' | 'emit' | 'state' | 'flow.stalled';
|
|
19
|
+
export interface BaseEvent {
|
|
20
|
+
id?: string;
|
|
21
|
+
ts?: string;
|
|
22
|
+
type: EventType;
|
|
23
|
+
runId: string;
|
|
24
|
+
flowName: string;
|
|
25
|
+
}
|
|
26
|
+
export interface StepEvent extends BaseEvent {
|
|
27
|
+
stepName: string;
|
|
28
|
+
stepId: string;
|
|
29
|
+
attempt: number;
|
|
30
|
+
}
|
|
31
|
+
export interface FlowStartEvent extends BaseEvent {
|
|
32
|
+
type: 'flow.start';
|
|
33
|
+
data?: {
|
|
34
|
+
input?: any;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export interface FlowCompletedEvent extends BaseEvent {
|
|
38
|
+
type: 'flow.completed';
|
|
39
|
+
data?: {
|
|
40
|
+
result?: any;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
export interface FlowFailedEvent extends BaseEvent {
|
|
44
|
+
type: 'flow.failed';
|
|
45
|
+
data?: {
|
|
46
|
+
error?: string;
|
|
47
|
+
stack?: string;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
export interface FlowCancelEvent extends BaseEvent {
|
|
51
|
+
type: 'flow.cancel';
|
|
52
|
+
data?: {
|
|
53
|
+
canceledAt?: string;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
export interface FlowStalledEvent extends BaseEvent {
|
|
57
|
+
type: 'flow.stalled';
|
|
58
|
+
data?: {
|
|
59
|
+
lastActivityAt?: number;
|
|
60
|
+
stallTimeout?: number;
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
export interface StepStartedEvent extends StepEvent {
|
|
64
|
+
type: 'step.started';
|
|
65
|
+
data?: {
|
|
66
|
+
input?: any;
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
export interface StepCompletedEvent extends StepEvent {
|
|
70
|
+
type: 'step.completed';
|
|
71
|
+
data?: {
|
|
72
|
+
result?: any;
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
export interface StepFailedEvent extends StepEvent {
|
|
76
|
+
type: 'step.failed';
|
|
77
|
+
data?: {
|
|
78
|
+
error?: string;
|
|
79
|
+
stack?: string;
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
export interface StepRetryEvent extends StepEvent {
|
|
83
|
+
type: 'step.retry';
|
|
84
|
+
data?: {
|
|
85
|
+
stepName: string;
|
|
86
|
+
queue: string;
|
|
87
|
+
attempt: number;
|
|
88
|
+
maxAttempts: number;
|
|
89
|
+
nextAttempt: number;
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
export interface LogEvent extends StepEvent {
|
|
93
|
+
type: 'log';
|
|
94
|
+
data: {
|
|
95
|
+
level: 'debug' | 'info' | 'warn' | 'error';
|
|
96
|
+
message: string;
|
|
97
|
+
[key: string]: any;
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
export interface EmitEvent extends StepEvent {
|
|
101
|
+
type: 'emit';
|
|
102
|
+
data: {
|
|
103
|
+
topic: string;
|
|
104
|
+
payload: any;
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
export interface StateEvent extends StepEvent {
|
|
108
|
+
type: 'state';
|
|
109
|
+
data: {
|
|
110
|
+
operation: 'get' | 'set' | 'delete';
|
|
111
|
+
scope?: string;
|
|
112
|
+
key: string;
|
|
113
|
+
value?: any;
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
export type FlowEvent = FlowStartEvent | FlowCompletedEvent | FlowFailedEvent | FlowCancelEvent | FlowStalledEvent | StepStartedEvent | StepCompletedEvent | StepFailedEvent | StepRetryEvent | LogEvent | EmitEvent | StateEvent;
|
|
File without changes
|