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
package/dist/module.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { dirname, join, extname, relative } from 'node:path';
|
|
2
|
-
import { useLogger, defineNuxtModule, createResolver,
|
|
2
|
+
import { useLogger, defineNuxtModule, createResolver, addTemplate, addTypeTemplate, addServerPlugin, addServerHandler, addServerImports, updateTemplates } from '@nuxt/kit';
|
|
3
3
|
import defu from 'defu';
|
|
4
4
|
import { existsSync, realpathSync } from 'node:fs';
|
|
5
5
|
import { globby } from 'globby';
|
|
@@ -10,6 +10,7 @@ import { spawn } from 'node:child_process';
|
|
|
10
10
|
import chokidar from 'chokidar';
|
|
11
11
|
import { join as join$1 } from 'pathe';
|
|
12
12
|
import { debounce } from 'perfect-debounce';
|
|
13
|
+
import { normalizeModuleOptions, getRedisStorageConfig, toRuntimeConfig } from '../dist/runtime/config/index.js';
|
|
13
14
|
|
|
14
15
|
async function loadJsConfig(absPath) {
|
|
15
16
|
const cacheBust = `?t=${Date.now()}`;
|
|
@@ -29,7 +30,10 @@ async function loadJsConfig(absPath) {
|
|
|
29
30
|
role: flowCfg.role,
|
|
30
31
|
step: flowCfg.step,
|
|
31
32
|
emits: flowCfg.emits,
|
|
32
|
-
subscribes
|
|
33
|
+
subscribes,
|
|
34
|
+
triggers: flowCfg.triggers,
|
|
35
|
+
awaitBefore: flowCfg.awaitBefore,
|
|
36
|
+
awaitAfter: flowCfg.awaitAfter
|
|
33
37
|
};
|
|
34
38
|
}
|
|
35
39
|
}
|
|
@@ -41,7 +45,8 @@ async function loadJsConfig(absPath) {
|
|
|
41
45
|
} : void 0;
|
|
42
46
|
const workerCfg = cfg?.worker && typeof cfg.worker === "object" ? { ...cfg.worker } : void 0;
|
|
43
47
|
const hasDefaultExport = !!(mod && mod.default);
|
|
44
|
-
|
|
48
|
+
const hasHooks = !!(mod && typeof mod.onAwaitRegister === "function" || mod && typeof mod.onAwaitResolve === "function");
|
|
49
|
+
return { queueName, flow, runtype, queue: queueCfg, worker: workerCfg, hasDefaultExport, hasHooks };
|
|
45
50
|
}
|
|
46
51
|
|
|
47
52
|
async function loadTsConfig(absPath) {
|
|
@@ -68,7 +73,10 @@ async function loadTsConfig(absPath) {
|
|
|
68
73
|
role: flowCfg.role,
|
|
69
74
|
step: flowCfg.step,
|
|
70
75
|
emits: flowCfg.emits,
|
|
71
|
-
subscribes
|
|
76
|
+
subscribes,
|
|
77
|
+
triggers: flowCfg.triggers,
|
|
78
|
+
awaitBefore: flowCfg.awaitBefore,
|
|
79
|
+
awaitAfter: flowCfg.awaitAfter
|
|
72
80
|
};
|
|
73
81
|
}
|
|
74
82
|
}
|
|
@@ -79,7 +87,8 @@ async function loadTsConfig(absPath) {
|
|
|
79
87
|
limiter: cfg.queue.limiter
|
|
80
88
|
} : void 0;
|
|
81
89
|
const workerCfg = cfg?.worker && typeof cfg.worker === "object" ? { ...cfg.worker } : void 0;
|
|
82
|
-
|
|
90
|
+
const hasHooks = !!(mod.exports.onAwaitRegister || mod.exports.onAwaitResolve);
|
|
91
|
+
return { queueName, flow, runtype, queue: queueCfg, worker: workerCfg, hasDefaultExport, hasHooks };
|
|
83
92
|
} catch (error) {
|
|
84
93
|
throw new Error(`Failed to parse config from ${absPath}: ${error}`);
|
|
85
94
|
}
|
|
@@ -127,7 +136,7 @@ function astToValue(node) {
|
|
|
127
136
|
|
|
128
137
|
async function loadPyConfig(absPath, logger) {
|
|
129
138
|
const moduleDir = dirname(fileURLToPath(import.meta.url));
|
|
130
|
-
const helper = join(moduleDir, "..", "..", "runtime", "python", "get_config.py");
|
|
139
|
+
const helper = join(moduleDir, "..", "..", "runtime", "worker", "python", "get_config.py");
|
|
131
140
|
let pyConfig;
|
|
132
141
|
if (existsSync(helper)) {
|
|
133
142
|
pyConfig = await new Promise((resolve) => {
|
|
@@ -174,7 +183,10 @@ async function loadPyConfig(absPath, logger) {
|
|
|
174
183
|
role: flowCfg.role,
|
|
175
184
|
step: flowCfg.step,
|
|
176
185
|
emits: flowCfg.emits,
|
|
177
|
-
subscribes
|
|
186
|
+
subscribes,
|
|
187
|
+
triggers: flowCfg.triggers,
|
|
188
|
+
awaitBefore: flowCfg.awaitBefore,
|
|
189
|
+
awaitAfter: flowCfg.awaitAfter
|
|
178
190
|
};
|
|
179
191
|
}
|
|
180
192
|
}
|
|
@@ -182,13 +194,13 @@ async function loadPyConfig(absPath, logger) {
|
|
|
182
194
|
return { queueName, flow, hasDefaultExport: true };
|
|
183
195
|
}
|
|
184
196
|
|
|
185
|
-
async function scanWorkers(layers,
|
|
197
|
+
async function scanWorkers(layers, functionsDir = "functions") {
|
|
186
198
|
const logger = useLogger();
|
|
187
199
|
const workerByVirtualPath = /* @__PURE__ */ new Map();
|
|
188
200
|
const seenFiles = /* @__PURE__ */ new Set();
|
|
189
201
|
const flowSources = [];
|
|
190
202
|
for (const layer of layers) {
|
|
191
|
-
const base = join(layer.serverDir,
|
|
203
|
+
const base = join(layer.serverDir, functionsDir);
|
|
192
204
|
if (!existsSync(base)) continue;
|
|
193
205
|
const files = await globby("**/*.{ts,js,mjs,cjs,mts,cts,py}", { cwd: base, dot: false });
|
|
194
206
|
for (const rel of files) {
|
|
@@ -216,6 +228,7 @@ async function scanWorkers(layers, queuesDir = "queues") {
|
|
|
216
228
|
queueName = String(meta.queue?.name || meta.queueName || (id.split("/").pop() || id));
|
|
217
229
|
workerByVirtualPath.set(virtualPath, {
|
|
218
230
|
id,
|
|
231
|
+
name: queueName,
|
|
219
232
|
kind,
|
|
220
233
|
filePath: virtualPath,
|
|
221
234
|
absPath: abs,
|
|
@@ -239,6 +252,7 @@ async function scanWorkers(layers, queuesDir = "queues") {
|
|
|
239
252
|
queueName = String(meta.queue?.name || meta.queueName || (id.split("/").pop() || id));
|
|
240
253
|
workerByVirtualPath.set(virtualPath, {
|
|
241
254
|
id,
|
|
255
|
+
name: queueName,
|
|
242
256
|
kind,
|
|
243
257
|
filePath: virtualPath,
|
|
244
258
|
absPath: abs,
|
|
@@ -262,6 +276,7 @@ async function scanWorkers(layers, queuesDir = "queues") {
|
|
|
262
276
|
queueName = String(meta.queue?.name || meta.queueName || (id.split("/").pop() || id));
|
|
263
277
|
workerByVirtualPath.set(virtualPath, {
|
|
264
278
|
id,
|
|
279
|
+
name: queueName,
|
|
265
280
|
kind,
|
|
266
281
|
filePath: virtualPath,
|
|
267
282
|
absPath: abs,
|
|
@@ -314,20 +329,41 @@ function buildFlows(flowSources) {
|
|
|
314
329
|
const key = `${flowId}:${f.role}:${mainStep}`;
|
|
315
330
|
if (!seenFlowKeys.has(key)) {
|
|
316
331
|
seenFlowKeys.add(key);
|
|
317
|
-
bucket.entry = {
|
|
332
|
+
bucket.entry = {
|
|
333
|
+
step: mainStep,
|
|
334
|
+
queue,
|
|
335
|
+
workerId: id,
|
|
336
|
+
emits: f.emits,
|
|
337
|
+
awaitBefore: f.awaitBefore,
|
|
338
|
+
awaitAfter: f.awaitAfter
|
|
339
|
+
};
|
|
318
340
|
}
|
|
319
341
|
for (const s of steps.slice(1)) {
|
|
320
342
|
const skey = `${flowId}:step:${s}`;
|
|
321
343
|
if (seenFlowKeys.has(skey)) continue;
|
|
322
344
|
seenFlowKeys.add(skey);
|
|
323
|
-
bucket.steps[s] = {
|
|
345
|
+
bucket.steps[s] = {
|
|
346
|
+
queue,
|
|
347
|
+
workerId: id,
|
|
348
|
+
subscribes: f.subscribes,
|
|
349
|
+
emits: f.emits,
|
|
350
|
+
awaitBefore: f.awaitBefore,
|
|
351
|
+
awaitAfter: f.awaitAfter
|
|
352
|
+
};
|
|
324
353
|
}
|
|
325
354
|
} else {
|
|
326
355
|
for (const s of steps) {
|
|
327
356
|
const skey = `${flowId}:${f.role}:${s}`;
|
|
328
357
|
if (seenFlowKeys.has(skey)) continue;
|
|
329
358
|
seenFlowKeys.add(skey);
|
|
330
|
-
bucket.steps[s] = {
|
|
359
|
+
bucket.steps[s] = {
|
|
360
|
+
queue,
|
|
361
|
+
workerId: id,
|
|
362
|
+
subscribes: f.subscribes,
|
|
363
|
+
emits: f.emits,
|
|
364
|
+
awaitBefore: f.awaitBefore,
|
|
365
|
+
awaitAfter: f.awaitAfter
|
|
366
|
+
};
|
|
331
367
|
}
|
|
332
368
|
}
|
|
333
369
|
if (f.subscribes) {
|
|
@@ -484,6 +520,46 @@ function findTriggeredSteps(stepName, step, allSteps) {
|
|
|
484
520
|
}
|
|
485
521
|
return Array.from(triggered);
|
|
486
522
|
}
|
|
523
|
+
function getStepAwaitTimeout(step) {
|
|
524
|
+
let timeout = 0;
|
|
525
|
+
if (step.awaitBefore?.timeout) timeout += step.awaitBefore.timeout;
|
|
526
|
+
if (step.awaitAfter?.timeout) timeout += step.awaitAfter.timeout;
|
|
527
|
+
return timeout;
|
|
528
|
+
}
|
|
529
|
+
function calculateFlowStallTimeout(steps, levels) {
|
|
530
|
+
const DEFAULT_STALL_TIMEOUT = 30 * 60 * 1e3;
|
|
531
|
+
const MIN_BUFFER = 5 * 60 * 1e3;
|
|
532
|
+
const BUFFER_PERCENTAGE = 0.1;
|
|
533
|
+
const levelTimeouts = [];
|
|
534
|
+
let awaitCount = 0;
|
|
535
|
+
for (const levelSteps of levels) {
|
|
536
|
+
let maxLevelTimeout = 0;
|
|
537
|
+
for (const stepName of levelSteps) {
|
|
538
|
+
const step = steps[stepName];
|
|
539
|
+
if (!step) continue;
|
|
540
|
+
const stepTimeout = getStepAwaitTimeout(step);
|
|
541
|
+
if (stepTimeout > 0) {
|
|
542
|
+
awaitCount++;
|
|
543
|
+
maxLevelTimeout = Math.max(maxLevelTimeout, stepTimeout);
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
if (maxLevelTimeout > 0) {
|
|
547
|
+
levelTimeouts.push(maxLevelTimeout);
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
if (levelTimeouts.length === 0) {
|
|
551
|
+
return DEFAULT_STALL_TIMEOUT;
|
|
552
|
+
}
|
|
553
|
+
const totalAwaitTimeout = levelTimeouts.reduce((sum, timeout) => sum + timeout, 0);
|
|
554
|
+
const buffer = Math.max(totalAwaitTimeout * BUFFER_PERCENTAGE, MIN_BUFFER);
|
|
555
|
+
const calculatedTimeout = totalAwaitTimeout + buffer;
|
|
556
|
+
if (calculatedTimeout > DEFAULT_STALL_TIMEOUT * 2) {
|
|
557
|
+
console.log(
|
|
558
|
+
`[flow-analyzer] Flow has ${awaitCount} await patterns across ${levelTimeouts.length} levels, calculated stall timeout: ${calculatedTimeout / 1e3}s (total await time: ${totalAwaitTimeout / 1e3}s, level timeouts: [${levelTimeouts.map((t) => `${t / 1e3}s`).join(", ")}])`
|
|
559
|
+
);
|
|
560
|
+
}
|
|
561
|
+
return calculatedTimeout;
|
|
562
|
+
}
|
|
487
563
|
function analyzeFlow(flow) {
|
|
488
564
|
const entryStepName = flow.entry?.step;
|
|
489
565
|
const steps = flow.steps || {};
|
|
@@ -491,12 +567,14 @@ function analyzeFlow(flow) {
|
|
|
491
567
|
const levels = calculateLevels(entryStepName, dependencies);
|
|
492
568
|
const analyzedSteps = {};
|
|
493
569
|
for (const [stepName, step] of Object.entries(steps)) {
|
|
570
|
+
const hasAwaitPattern = !!(step.awaitBefore || step.awaitAfter);
|
|
494
571
|
analyzedSteps[stepName] = {
|
|
495
572
|
...step,
|
|
496
573
|
name: stepName,
|
|
497
574
|
dependsOn: dependencies[stepName] || [],
|
|
498
575
|
triggers: findTriggeredSteps(stepName, step, steps),
|
|
499
|
-
level: levels[stepName] ?? 1
|
|
576
|
+
level: levels[stepName] ?? 1,
|
|
577
|
+
hasAwaitPattern
|
|
500
578
|
};
|
|
501
579
|
}
|
|
502
580
|
const maxLevel = Math.max(0, ...Object.values(levels));
|
|
@@ -507,12 +585,28 @@ function analyzeFlow(flow) {
|
|
|
507
585
|
levelArray.push(stepName);
|
|
508
586
|
}
|
|
509
587
|
}
|
|
588
|
+
const stallTimeout = calculateFlowStallTimeout(analyzedSteps, levelGroups);
|
|
589
|
+
const awaitSteps = Object.values(analyzedSteps).filter((s) => s.hasAwaitPattern);
|
|
590
|
+
const totalTimeout = awaitSteps.reduce((sum, s) => {
|
|
591
|
+
let stepTimeout = 0;
|
|
592
|
+
if (s.awaitBefore?.timeout) stepTimeout += s.awaitBefore.timeout;
|
|
593
|
+
if (s.awaitAfter?.timeout) stepTimeout += s.awaitAfter.timeout;
|
|
594
|
+
return sum + stepTimeout;
|
|
595
|
+
}, 0);
|
|
596
|
+
const awaitPatterns = awaitSteps.length > 0 ? {
|
|
597
|
+
steps: awaitSteps.map((s) => s.name),
|
|
598
|
+
beforeCount: awaitSteps.filter((s) => s.awaitBefore).length,
|
|
599
|
+
afterCount: awaitSteps.filter((s) => s.awaitAfter).length,
|
|
600
|
+
totalTimeout
|
|
601
|
+
} : void 0;
|
|
510
602
|
return {
|
|
511
603
|
id: flow.id,
|
|
512
604
|
entry: flow.entry,
|
|
513
605
|
steps: analyzedSteps,
|
|
514
606
|
levels: levelGroups,
|
|
515
|
-
maxLevel
|
|
607
|
+
maxLevel,
|
|
608
|
+
stallTimeout,
|
|
609
|
+
awaitPatterns
|
|
516
610
|
};
|
|
517
611
|
}
|
|
518
612
|
|
|
@@ -528,7 +622,7 @@ async function compileRegistryFromServerWorkers(layers, queuesDir = "queues", de
|
|
|
528
622
|
return compiled;
|
|
529
623
|
}
|
|
530
624
|
|
|
531
|
-
const logger = useLogger("
|
|
625
|
+
const logger = useLogger("nvent");
|
|
532
626
|
function watchQueueFiles(options) {
|
|
533
627
|
const { nuxt, layerInfos, queuesDir, onRefresh } = options;
|
|
534
628
|
const dirsToWatch = layerInfos.map((layer) => {
|
|
@@ -590,13 +684,73 @@ function watchQueueFiles(options) {
|
|
|
590
684
|
return watcher;
|
|
591
685
|
}
|
|
592
686
|
|
|
687
|
+
function analyzeTriggerDefinitions(workers) {
|
|
688
|
+
const triggers = [];
|
|
689
|
+
const seenTriggers = /* @__PURE__ */ new Set();
|
|
690
|
+
for (const worker of workers) {
|
|
691
|
+
const triggerDef = worker.flow?.triggers?.define;
|
|
692
|
+
if (!triggerDef) continue;
|
|
693
|
+
if (seenTriggers.has(triggerDef.name)) continue;
|
|
694
|
+
seenTriggers.add(triggerDef.name);
|
|
695
|
+
triggers.push({
|
|
696
|
+
name: triggerDef.name,
|
|
697
|
+
type: triggerDef.type,
|
|
698
|
+
scope: triggerDef.scope || "flow",
|
|
699
|
+
displayName: triggerDef.displayName,
|
|
700
|
+
description: triggerDef.description,
|
|
701
|
+
source: `function:${worker.name}`,
|
|
702
|
+
expectedSubscribers: triggerDef.expectedSubscribers,
|
|
703
|
+
webhook: triggerDef.webhook,
|
|
704
|
+
schedule: triggerDef.schedule,
|
|
705
|
+
config: triggerDef.config,
|
|
706
|
+
registeredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
707
|
+
registeredBy: "code"
|
|
708
|
+
});
|
|
709
|
+
}
|
|
710
|
+
return triggers;
|
|
711
|
+
}
|
|
712
|
+
function analyzeTriggerSubscriptions(workers) {
|
|
713
|
+
const subscriptions = [];
|
|
714
|
+
for (const worker of workers) {
|
|
715
|
+
if (!worker.flow?.triggers?.subscribe) continue;
|
|
716
|
+
const flowNames = Array.isArray(worker.flow.names) ? worker.flow.names : [worker.flow.names];
|
|
717
|
+
for (const flowName of flowNames) {
|
|
718
|
+
for (const triggerName of worker.flow.triggers.subscribe) {
|
|
719
|
+
subscriptions.push({
|
|
720
|
+
triggerName,
|
|
721
|
+
flowName,
|
|
722
|
+
mode: worker.flow.triggers.mode || "auto",
|
|
723
|
+
source: "config",
|
|
724
|
+
registeredAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
725
|
+
});
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
return subscriptions;
|
|
730
|
+
}
|
|
731
|
+
function buildTriggerIndex(subscriptions) {
|
|
732
|
+
const triggerToFlows = /* @__PURE__ */ new Map();
|
|
733
|
+
const flowToTriggers = /* @__PURE__ */ new Map();
|
|
734
|
+
for (const sub of subscriptions) {
|
|
735
|
+
if (!triggerToFlows.has(sub.triggerName)) {
|
|
736
|
+
triggerToFlows.set(sub.triggerName, /* @__PURE__ */ new Set());
|
|
737
|
+
}
|
|
738
|
+
triggerToFlows.get(sub.triggerName).add(sub.flowName);
|
|
739
|
+
if (!flowToTriggers.has(sub.flowName)) {
|
|
740
|
+
flowToTriggers.set(sub.flowName, /* @__PURE__ */ new Set());
|
|
741
|
+
}
|
|
742
|
+
flowToTriggers.get(sub.flowName).add(sub.triggerName);
|
|
743
|
+
}
|
|
744
|
+
return { triggerToFlows, flowToTriggers };
|
|
745
|
+
}
|
|
746
|
+
|
|
593
747
|
function generateRegistryTemplate(registry) {
|
|
594
|
-
return `// auto-generated by
|
|
748
|
+
return `// auto-generated by nvent
|
|
595
749
|
export const registry = ${JSON.stringify(registry, null, 2)};
|
|
596
750
|
|
|
597
|
-
export const
|
|
751
|
+
export const useFunctionRegistry = () => registry;
|
|
598
752
|
|
|
599
|
-
export default
|
|
753
|
+
export default useFunctionRegistry;
|
|
600
754
|
`;
|
|
601
755
|
}
|
|
602
756
|
function generateHandlersTemplate(registry) {
|
|
@@ -605,16 +759,18 @@ function generateHandlersTemplate(registry) {
|
|
|
605
759
|
const entries = [];
|
|
606
760
|
regWorkers.filter((w) => w?.kind === "ts" && (w?.runtype ? w.runtype !== "task" : registry?.runner?.ts?.isolate !== "task")).forEach((w, i) => {
|
|
607
761
|
const varName = `h${i}`;
|
|
762
|
+
const moduleVar = `m${i}`;
|
|
608
763
|
const src = w && (w.absPath || w.abs || w.cwd && w.file && join(w.cwd, w.file) || w.entry || w.path) || "";
|
|
609
764
|
if (!src) return;
|
|
610
765
|
const importPath = String(src);
|
|
611
766
|
lines.push(`import ${varName} from '${importPath}'`);
|
|
767
|
+
lines.push(`import * as ${moduleVar} from '${importPath}'`);
|
|
612
768
|
const queue = String(w?.queue?.name || `w${i}`);
|
|
613
769
|
const id = String(w?.id || `w${i}`);
|
|
614
770
|
const absPath = importPath;
|
|
615
|
-
entries.push(`{ queue: '${queue}', id: '${id}', absPath: '${absPath}', handler: ${varName} }`);
|
|
771
|
+
entries.push(`{ queue: '${queue}', id: '${id}', absPath: '${absPath}', handler: ${varName}, module: ${moduleVar} }`);
|
|
616
772
|
});
|
|
617
|
-
return `// auto-generated by
|
|
773
|
+
return `// auto-generated by nvent
|
|
618
774
|
${lines.join("\n")}
|
|
619
775
|
|
|
620
776
|
export const handlers = [
|
|
@@ -672,11 +828,13 @@ function generateAnalyzedFlowsTemplate(registry) {
|
|
|
672
828
|
analyzed: {
|
|
673
829
|
levels: analyzed.levels,
|
|
674
830
|
maxLevel: analyzed.maxLevel,
|
|
831
|
+
stallTimeout: analyzed.stallTimeout,
|
|
832
|
+
awaitPatterns: analyzed.awaitPatterns,
|
|
675
833
|
steps: analyzed.steps
|
|
676
834
|
}
|
|
677
835
|
};
|
|
678
836
|
});
|
|
679
|
-
return `// auto-generated by
|
|
837
|
+
return `// auto-generated by nvent
|
|
680
838
|
export const analyzedFlows = ${JSON.stringify(analyzedFlows, null, 2)};
|
|
681
839
|
|
|
682
840
|
export const useAnalyzedFlows = () => analyzedFlows;
|
|
@@ -684,145 +842,240 @@ export const useAnalyzedFlows = () => analyzedFlows;
|
|
|
684
842
|
export default useAnalyzedFlows;
|
|
685
843
|
`;
|
|
686
844
|
}
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
const
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
redis: {
|
|
696
|
-
host: "127.0.0.1",
|
|
697
|
-
port: 6379
|
|
698
|
-
},
|
|
699
|
-
defaultConfig: {
|
|
700
|
-
// Queue options
|
|
701
|
-
prefix: "nq",
|
|
702
|
-
defaultJobOptions: {},
|
|
703
|
-
// Worker options
|
|
704
|
-
worker: {
|
|
705
|
-
concurrency: 2,
|
|
706
|
-
autorun: true
|
|
707
|
-
}
|
|
708
|
-
}
|
|
709
|
-
},
|
|
710
|
-
state: {
|
|
711
|
-
adapter: "redis",
|
|
712
|
-
namespace: "nq",
|
|
713
|
-
autoScope: "always",
|
|
714
|
-
cleanup: {
|
|
715
|
-
strategy: "never"
|
|
716
|
-
},
|
|
717
|
-
redis: {
|
|
718
|
-
host: "127.0.0.1",
|
|
719
|
-
port: 6379
|
|
720
|
-
}
|
|
721
|
-
},
|
|
722
|
-
eventStore: {
|
|
723
|
-
adapter: "memory",
|
|
724
|
-
options: {
|
|
725
|
-
file: {
|
|
726
|
-
dir: ".data/nq-events",
|
|
727
|
-
ext: ".ndjson",
|
|
728
|
-
pollMs: 1e3
|
|
729
|
-
}
|
|
730
|
-
},
|
|
731
|
-
retention: {
|
|
732
|
-
eventTTL: 604800,
|
|
733
|
-
// 7 days
|
|
734
|
-
metadataTTL: 2592e3
|
|
735
|
-
// 30 days
|
|
736
|
-
}
|
|
737
|
-
}
|
|
738
|
-
};
|
|
739
|
-
if (options.store) {
|
|
740
|
-
const storeConfig = expandStoreShortcut(options.store);
|
|
741
|
-
return defu(options, storeConfig, defaults);
|
|
742
|
-
}
|
|
743
|
-
return defu(options, defaults);
|
|
744
|
-
}
|
|
745
|
-
function expandStoreShortcut(store) {
|
|
746
|
-
if (!store) return {};
|
|
747
|
-
const storeAdapter = store.adapter;
|
|
748
|
-
if (storeAdapter === "redis") {
|
|
749
|
-
const redisConfig = store.redis || {
|
|
750
|
-
host: "127.0.0.1",
|
|
751
|
-
port: 6379
|
|
752
|
-
};
|
|
753
|
-
return {
|
|
754
|
-
queue: {
|
|
755
|
-
adapter: "redis",
|
|
756
|
-
redis: redisConfig,
|
|
757
|
-
defaultConfig: {}
|
|
758
|
-
},
|
|
759
|
-
state: {
|
|
760
|
-
adapter: "redis",
|
|
761
|
-
namespace: "nq",
|
|
762
|
-
autoScope: "always",
|
|
763
|
-
cleanup: { strategy: "never" },
|
|
764
|
-
redis: redisConfig
|
|
765
|
-
},
|
|
766
|
-
eventStore: {
|
|
767
|
-
adapter: "redis",
|
|
768
|
-
redis: redisConfig
|
|
769
|
-
}
|
|
770
|
-
};
|
|
845
|
+
function generateTriggerRegistryTemplate(registry) {
|
|
846
|
+
const workers = registry?.workers || [];
|
|
847
|
+
const triggers = analyzeTriggerDefinitions(workers);
|
|
848
|
+
const subscriptions = analyzeTriggerSubscriptions(workers);
|
|
849
|
+
const index = buildTriggerIndex(subscriptions);
|
|
850
|
+
const triggerToFlows = {};
|
|
851
|
+
for (const [trigger, subs] of index.triggerToFlows.entries()) {
|
|
852
|
+
triggerToFlows[trigger] = Array.from(subs);
|
|
771
853
|
}
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
};
|
|
776
|
-
return {
|
|
777
|
-
queue: {
|
|
778
|
-
adapter: "postgres",
|
|
779
|
-
postgres: postgresConfig,
|
|
780
|
-
defaultConfig: {}
|
|
781
|
-
},
|
|
782
|
-
state: {
|
|
783
|
-
adapter: "postgres",
|
|
784
|
-
postgres: postgresConfig
|
|
785
|
-
},
|
|
786
|
-
eventStore: {
|
|
787
|
-
adapter: "postgres",
|
|
788
|
-
postgres: postgresConfig
|
|
789
|
-
}
|
|
790
|
-
};
|
|
854
|
+
const flowToTriggers = {};
|
|
855
|
+
for (const [flow, triggers2] of index.flowToTriggers.entries()) {
|
|
856
|
+
flowToTriggers[flow] = Array.from(triggers2);
|
|
791
857
|
}
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
eventStore: normalizedOptions.eventStore
|
|
858
|
+
const triggerRegistry = {
|
|
859
|
+
triggers,
|
|
860
|
+
subscriptions,
|
|
861
|
+
index: {
|
|
862
|
+
triggerToFlows,
|
|
863
|
+
flowToTriggers
|
|
864
|
+
},
|
|
865
|
+
compiledAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
801
866
|
};
|
|
867
|
+
return `// auto-generated by nvent
|
|
868
|
+
export const triggerRegistry = ${JSON.stringify(triggerRegistry, null, 2)};
|
|
869
|
+
|
|
870
|
+
export const useTriggerRegistry = () => triggerRegistry;
|
|
871
|
+
|
|
872
|
+
export default useTriggerRegistry;
|
|
873
|
+
`;
|
|
802
874
|
}
|
|
803
|
-
function
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
875
|
+
function generateAdapterTypesTemplate(resolverFn) {
|
|
876
|
+
return `// Auto-generated adapter type definitions
|
|
877
|
+
// External adapter packages can import these types
|
|
878
|
+
|
|
879
|
+
// Queue Adapter
|
|
880
|
+
export type {
|
|
881
|
+
QueueAdapter,
|
|
882
|
+
JobInput,
|
|
883
|
+
Job,
|
|
884
|
+
JobsQuery,
|
|
885
|
+
JobOptions,
|
|
886
|
+
JobState,
|
|
887
|
+
ScheduleOptions,
|
|
888
|
+
JobCounts,
|
|
889
|
+
QueueEvent,
|
|
890
|
+
WorkerHandler,
|
|
891
|
+
WorkerContext,
|
|
892
|
+
WorkerOptions,
|
|
893
|
+
} from ${JSON.stringify(resolverFn("./runtime/adapters/interfaces/queue"))}
|
|
894
|
+
|
|
895
|
+
// Stream Adapter
|
|
896
|
+
export type {
|
|
897
|
+
StreamAdapter,
|
|
898
|
+
StreamEvent,
|
|
899
|
+
SubscribeOptions,
|
|
900
|
+
SubscriptionHandle,
|
|
901
|
+
} from ${JSON.stringify(resolverFn("./runtime/adapters/interfaces/stream"))}
|
|
902
|
+
|
|
903
|
+
// Store Adapter
|
|
904
|
+
export type {
|
|
905
|
+
StoreAdapter,
|
|
906
|
+
EventRecord,
|
|
907
|
+
EventReadOptions,
|
|
908
|
+
EventSubscription,
|
|
909
|
+
ListOptions,
|
|
910
|
+
} from ${JSON.stringify(resolverFn("./runtime/adapters/interfaces/store"))}
|
|
911
|
+
|
|
912
|
+
// Event Types
|
|
913
|
+
export type {
|
|
914
|
+
EventType,
|
|
915
|
+
BaseEvent,
|
|
916
|
+
StepEvent,
|
|
917
|
+
FlowStartEvent,
|
|
918
|
+
FlowCompletedEvent,
|
|
919
|
+
FlowFailedEvent,
|
|
920
|
+
FlowCancelEvent,
|
|
921
|
+
FlowStalledEvent,
|
|
922
|
+
StepStartedEvent,
|
|
923
|
+
StepCompletedEvent,
|
|
924
|
+
StepFailedEvent,
|
|
925
|
+
StepRetryEvent,
|
|
926
|
+
LogEvent,
|
|
927
|
+
EmitEvent,
|
|
928
|
+
StateEvent,
|
|
929
|
+
FlowEvent,
|
|
930
|
+
} from ${JSON.stringify(resolverFn("./runtime/events/types"))}
|
|
931
|
+
|
|
932
|
+
// Adapter Registry
|
|
933
|
+
export type { AdapterRegistry } from ${JSON.stringify(resolverFn("./runtime/adapters/registry"))}`;
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
function getServerImports(resolverFn, buildDir) {
|
|
937
|
+
return [
|
|
938
|
+
// Generated templates
|
|
939
|
+
{
|
|
940
|
+
name: "useFunctionRegistry",
|
|
941
|
+
as: "$useFunctionRegistry",
|
|
942
|
+
from: resolverFn(buildDir + "/function-registry")
|
|
943
|
+
},
|
|
944
|
+
{
|
|
945
|
+
name: "useWorkerHandlers",
|
|
946
|
+
as: "$useWorkerHandlers",
|
|
947
|
+
from: resolverFn(buildDir + "/worker-handlers")
|
|
948
|
+
},
|
|
949
|
+
{
|
|
950
|
+
name: "useAnalyzedFlows",
|
|
951
|
+
as: "$useAnalyzedFlows",
|
|
952
|
+
from: resolverFn(buildDir + "/analyzed-flows")
|
|
953
|
+
},
|
|
954
|
+
{
|
|
955
|
+
name: "useTriggerRegistry",
|
|
956
|
+
as: "$useTriggerRegistry",
|
|
957
|
+
from: resolverFn(buildDir + "/trigger-registry")
|
|
958
|
+
},
|
|
959
|
+
// Core utilities for user code
|
|
960
|
+
{
|
|
961
|
+
name: "defineFunctionConfig",
|
|
962
|
+
from: resolverFn("./runtime/nitro/utils/defineFunctionConfig")
|
|
963
|
+
},
|
|
964
|
+
{
|
|
965
|
+
name: "defineFunction",
|
|
966
|
+
from: resolverFn("./runtime/nitro/utils/defineFunction")
|
|
967
|
+
},
|
|
968
|
+
// Composables users may need in server code
|
|
969
|
+
{
|
|
970
|
+
name: "useEventManager",
|
|
971
|
+
from: resolverFn("./runtime/nitro/utils/useEventManager")
|
|
972
|
+
},
|
|
973
|
+
{
|
|
974
|
+
name: "usePeerManager",
|
|
975
|
+
from: resolverFn("./runtime/nitro/utils/wsPeerManager")
|
|
976
|
+
},
|
|
977
|
+
{
|
|
978
|
+
name: "useNventLogger",
|
|
979
|
+
from: resolverFn("./runtime/nitro/utils/useNventLogger")
|
|
980
|
+
},
|
|
981
|
+
{
|
|
982
|
+
name: "useHookRegistry",
|
|
983
|
+
from: resolverFn("./runtime/nitro/utils/useHookRegistry")
|
|
984
|
+
},
|
|
985
|
+
{
|
|
986
|
+
name: "useAwait",
|
|
987
|
+
from: resolverFn("./runtime/nitro/utils/useAwait")
|
|
988
|
+
},
|
|
989
|
+
{
|
|
990
|
+
name: "useRunContext",
|
|
991
|
+
from: resolverFn("./runtime/nitro/utils/useRunContext")
|
|
992
|
+
},
|
|
993
|
+
{
|
|
994
|
+
name: "defineAwaitRegisterHook",
|
|
995
|
+
from: resolverFn("./runtime/nitro/utils/defineHooks")
|
|
996
|
+
},
|
|
997
|
+
{
|
|
998
|
+
name: "defineAwaitResolveHook",
|
|
999
|
+
from: resolverFn("./runtime/nitro/utils/defineHooks")
|
|
1000
|
+
},
|
|
1001
|
+
// Adapter composables
|
|
1002
|
+
{
|
|
1003
|
+
name: "useQueueAdapter",
|
|
1004
|
+
from: resolverFn("./runtime/nitro/utils/adapters")
|
|
1005
|
+
},
|
|
1006
|
+
{
|
|
1007
|
+
name: "useStoreAdapter",
|
|
1008
|
+
from: resolverFn("./runtime/nitro/utils/adapters")
|
|
1009
|
+
},
|
|
1010
|
+
{
|
|
1011
|
+
name: "useStreamAdapter",
|
|
1012
|
+
from: resolverFn("./runtime/nitro/utils/adapters")
|
|
1013
|
+
},
|
|
1014
|
+
{
|
|
1015
|
+
name: "useStateAdapter",
|
|
1016
|
+
from: resolverFn("./runtime/nitro/utils/adapters")
|
|
1017
|
+
},
|
|
1018
|
+
{
|
|
1019
|
+
name: "getAdapters",
|
|
1020
|
+
from: resolverFn("./runtime/nitro/utils/adapters")
|
|
1021
|
+
},
|
|
1022
|
+
{
|
|
1023
|
+
name: "setAdapters",
|
|
1024
|
+
from: resolverFn("./runtime/nitro/utils/adapters")
|
|
1025
|
+
},
|
|
1026
|
+
// Runtime utilities
|
|
1027
|
+
{
|
|
1028
|
+
name: "useStreamTopics",
|
|
1029
|
+
from: resolverFn("./runtime/nitro/utils/useStreamTopics")
|
|
1030
|
+
},
|
|
1031
|
+
{
|
|
1032
|
+
name: "useTrigger",
|
|
1033
|
+
from: resolverFn("./runtime/nitro/utils/useTrigger")
|
|
1034
|
+
},
|
|
1035
|
+
{
|
|
1036
|
+
name: "useFlow",
|
|
1037
|
+
from: resolverFn("./runtime/nitro/utils/useFlow")
|
|
1038
|
+
},
|
|
1039
|
+
// Scheduler
|
|
1040
|
+
{
|
|
1041
|
+
name: "useScheduler",
|
|
1042
|
+
from: resolverFn("./runtime/scheduler")
|
|
1043
|
+
},
|
|
1044
|
+
{
|
|
1045
|
+
name: "initializeScheduler",
|
|
1046
|
+
from: resolverFn("./runtime/scheduler")
|
|
1047
|
+
},
|
|
1048
|
+
{
|
|
1049
|
+
name: "shutdownScheduler",
|
|
1050
|
+
from: resolverFn("./runtime/scheduler")
|
|
1051
|
+
},
|
|
1052
|
+
// Adapter registration utilities for external modules
|
|
1053
|
+
{
|
|
1054
|
+
name: "registerQueueAdapter",
|
|
1055
|
+
from: resolverFn("./runtime/nitro/utils/registerAdapter")
|
|
1056
|
+
},
|
|
1057
|
+
{
|
|
1058
|
+
name: "registerStreamAdapter",
|
|
1059
|
+
from: resolverFn("./runtime/nitro/utils/registerAdapter")
|
|
1060
|
+
},
|
|
1061
|
+
{
|
|
1062
|
+
name: "registerStoreAdapter",
|
|
1063
|
+
from: resolverFn("./runtime/nitro/utils/registerAdapter")
|
|
1064
|
+
},
|
|
1065
|
+
// Adapter base utilities for external adapter packages
|
|
1066
|
+
{
|
|
1067
|
+
name: "createStoreValidator",
|
|
1068
|
+
from: resolverFn("./runtime/adapters/base/store-validator")
|
|
1069
|
+
}
|
|
1070
|
+
];
|
|
818
1071
|
}
|
|
819
1072
|
|
|
820
1073
|
const meta = {
|
|
821
|
-
name: "
|
|
822
|
-
version: "0.1",
|
|
823
|
-
configKey: "
|
|
1074
|
+
name: "nvent",
|
|
1075
|
+
version: "0.4.1",
|
|
1076
|
+
configKey: "nvent"
|
|
824
1077
|
};
|
|
825
|
-
const module = defineNuxtModule({
|
|
1078
|
+
const module$1 = defineNuxtModule().with({
|
|
826
1079
|
meta,
|
|
827
1080
|
defaults: {},
|
|
828
1081
|
moduleDependencies: {
|
|
@@ -832,30 +1085,9 @@ const module = defineNuxtModule({
|
|
|
832
1085
|
},
|
|
833
1086
|
async setup(options, nuxt) {
|
|
834
1087
|
const { resolve } = createResolver(import.meta.url);
|
|
835
|
-
const
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
addImportsDir(resolve("./runtime/app/composables"));
|
|
839
|
-
if (config.ui) {
|
|
840
|
-
nuxt.options.css = nuxt.options.css || [];
|
|
841
|
-
nuxt.options.css.push(resolve("./runtime/app/assets/vueflow.css"));
|
|
842
|
-
addPlugin({
|
|
843
|
-
src: resolve("./runtime/app/plugins/vueflow.client"),
|
|
844
|
-
mode: "client"
|
|
845
|
-
});
|
|
846
|
-
addComponentsDir({
|
|
847
|
-
path: resolve("./runtime/app/components"),
|
|
848
|
-
prefix: "Queue"
|
|
849
|
-
});
|
|
850
|
-
addComponent({
|
|
851
|
-
name: "QueueApp",
|
|
852
|
-
filePath: resolve("./runtime/app/pages/index.vue"),
|
|
853
|
-
global: true
|
|
854
|
-
});
|
|
855
|
-
}
|
|
856
|
-
nuxt.options.vite.optimizeDeps = defu(nuxt.options.vite.optimizeDeps, {
|
|
857
|
-
include: ["vanilla-jsoneditor"]
|
|
858
|
-
});
|
|
1088
|
+
const userConfig = nuxt.options[meta.configKey] || {};
|
|
1089
|
+
const mergedOptions = { ...userConfig, ...options };
|
|
1090
|
+
const config = normalizeModuleOptions(mergedOptions);
|
|
859
1091
|
nuxt.hook("nitro:config", (nitro) => {
|
|
860
1092
|
const redisConfig = getRedisStorageConfig(config);
|
|
861
1093
|
nitro.storage = defu(nitro.storage || {}, {
|
|
@@ -870,37 +1102,35 @@ const module = defineNuxtModule({
|
|
|
870
1102
|
});
|
|
871
1103
|
});
|
|
872
1104
|
const runtimeConfig = nuxt.options.runtimeConfig;
|
|
873
|
-
runtimeConfig.
|
|
874
|
-
if (!runtimeConfig.
|
|
875
|
-
runtimeConfig.
|
|
1105
|
+
runtimeConfig.nvent = defu(runtimeConfig.nvent || {}, toRuntimeConfig(config));
|
|
1106
|
+
if (!runtimeConfig.nvent) runtimeConfig.nvent = {};
|
|
1107
|
+
runtimeConfig.nvent.rootDir = nuxt.options.rootDir;
|
|
876
1108
|
const layerInfos = nuxt.options._layers.map((l) => ({
|
|
877
1109
|
rootDir: l.config.rootDir,
|
|
878
1110
|
serverDir: l.config?.serverDir || join(l.config.rootDir, "server")
|
|
879
1111
|
}));
|
|
880
|
-
const { worker
|
|
1112
|
+
const { worker, ...queueOptions } = config.queue;
|
|
881
1113
|
const defaultConfigs = {
|
|
882
1114
|
queue: queueOptions,
|
|
883
|
-
worker
|
|
1115
|
+
worker
|
|
884
1116
|
};
|
|
885
|
-
const compiledRegistry = await compileRegistryFromServerWorkers(layerInfos, config.dir || "
|
|
1117
|
+
const compiledRegistry = await compileRegistryFromServerWorkers(layerInfos, config.dir || "functions", defaultConfigs);
|
|
886
1118
|
const compiledWithMeta = defu(compiledRegistry, {
|
|
887
1119
|
version: 1,
|
|
888
1120
|
compiledAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
889
1121
|
provider: { name: config.queue.adapter === "postgres" ? "pgboss" : "bullmq" },
|
|
890
1122
|
logger: { name: "console", level: "info" },
|
|
891
|
-
state: config.state,
|
|
892
|
-
eventStore: config.eventStore,
|
|
893
1123
|
runner: { ts: { isolate: "inprocess" }, py: { enabled: false, cmd: "python3", importMode: "file" } },
|
|
894
|
-
workers: [],
|
|
895
1124
|
flows: {},
|
|
896
1125
|
eventIndex: {}
|
|
897
1126
|
});
|
|
898
1127
|
const compiledSnapshot = JSON.parse(JSON.stringify(compiledWithMeta));
|
|
899
1128
|
let lastCompiledRegistry = compiledSnapshot;
|
|
900
|
-
const REGISTRY_TEMPLATE = "
|
|
1129
|
+
const REGISTRY_TEMPLATE = "function-registry.mjs";
|
|
901
1130
|
const HANDLERS_TEMPLATE = "worker-handlers.mjs";
|
|
902
1131
|
const ANALYZED_FLOWS_TEMPLATE = "analyzed-flows.mjs";
|
|
903
|
-
|
|
1132
|
+
const TRIGGER_REGISTRY_TEMPLATE = "trigger-registry.mjs";
|
|
1133
|
+
for (const templateName of [REGISTRY_TEMPLATE, HANDLERS_TEMPLATE, ANALYZED_FLOWS_TEMPLATE, TRIGGER_REGISTRY_TEMPLATE]) {
|
|
904
1134
|
const templatePath = resolve(nuxt.options.buildDir, templateName);
|
|
905
1135
|
nuxt.options.build.transpile.push(templatePath);
|
|
906
1136
|
}
|
|
@@ -919,101 +1149,65 @@ const module = defineNuxtModule({
|
|
|
919
1149
|
write: true,
|
|
920
1150
|
getContents: () => generateAnalyzedFlowsTemplate(lastCompiledRegistry)
|
|
921
1151
|
});
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
name: "defineQueueWorker",
|
|
946
|
-
from: resolve("./runtime/server-utils/utils/defineQueueWorker")
|
|
947
|
-
},
|
|
948
|
-
// Composables users may need in server code
|
|
949
|
-
{
|
|
950
|
-
name: "useQueue",
|
|
951
|
-
from: resolve("./runtime/server-utils/utils/useQueue")
|
|
952
|
-
},
|
|
953
|
-
{
|
|
954
|
-
name: "useFlowEngine",
|
|
955
|
-
from: resolve("./runtime/server-utils/utils/useFlowEngine")
|
|
956
|
-
},
|
|
957
|
-
{
|
|
958
|
-
name: "useEventStore",
|
|
959
|
-
from: resolve("./runtime/server-utils/utils/useEventStore")
|
|
960
|
-
},
|
|
961
|
-
{
|
|
962
|
-
name: "useLogs",
|
|
963
|
-
from: resolve("./runtime/server-utils/utils/useLogs")
|
|
964
|
-
},
|
|
965
|
-
{
|
|
966
|
-
name: "useEventManager",
|
|
967
|
-
from: resolve("./runtime/server-utils/utils/useEventManager")
|
|
968
|
-
},
|
|
969
|
-
{
|
|
970
|
-
name: "usePeerManager",
|
|
971
|
-
from: resolve("./runtime/server-utils/utils/wsPeerManager")
|
|
972
|
-
},
|
|
973
|
-
{
|
|
974
|
-
name: "useNventLogger",
|
|
975
|
-
from: resolve("./runtime/server-utils/utils/useNventLogger")
|
|
976
|
-
}
|
|
977
|
-
]);
|
|
1152
|
+
addTemplate({
|
|
1153
|
+
filename: TRIGGER_REGISTRY_TEMPLATE,
|
|
1154
|
+
write: true,
|
|
1155
|
+
getContents: () => generateTriggerRegistryTemplate(lastCompiledRegistry)
|
|
1156
|
+
});
|
|
1157
|
+
addTypeTemplate({
|
|
1158
|
+
filename: "types/nvent-adapters.d.ts",
|
|
1159
|
+
getContents: () => generateAdapterTypesTemplate(resolve)
|
|
1160
|
+
});
|
|
1161
|
+
nuxt.options.alias["#nvent/adapters"] = resolve(nuxt.options.buildDir, "types/nvent-adapters");
|
|
1162
|
+
addServerPlugin(resolve("./runtime/nitro/plugins/00.adapters"));
|
|
1163
|
+
addServerPlugin(resolve("./runtime/nitro/plugins/01.ws-lifecycle"));
|
|
1164
|
+
addServerPlugin(resolve("./runtime/nitro/plugins/02.workers"));
|
|
1165
|
+
addServerPlugin(resolve("./runtime/nitro/plugins/03.triggers"));
|
|
1166
|
+
addServerHandler({
|
|
1167
|
+
route: "/api/_webhook/await/:flowName/:runId/:stepName",
|
|
1168
|
+
handler: resolve("./runtime/nitro/routes/webhook.await")
|
|
1169
|
+
});
|
|
1170
|
+
addServerHandler({
|
|
1171
|
+
route: "/api/_webhook/trigger/:triggerName",
|
|
1172
|
+
handler: resolve("./runtime/nitro/routes/webhook.trigger")
|
|
1173
|
+
});
|
|
1174
|
+
addServerImports(getServerImports(resolve, nuxt.options.buildDir));
|
|
978
1175
|
const refreshRegistry = async (reason, changedPath) => {
|
|
979
|
-
const
|
|
980
|
-
const updatedRegistry = await compileRegistryFromServerWorkers(layerInfos,
|
|
1176
|
+
const functionsDir = config.dir || "functions";
|
|
1177
|
+
const updatedRegistry = await compileRegistryFromServerWorkers(layerInfos, functionsDir, defaultConfigs);
|
|
981
1178
|
lastCompiledRegistry = JSON.parse(JSON.stringify(defu(updatedRegistry, {
|
|
982
1179
|
version: 1,
|
|
983
1180
|
compiledAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
984
1181
|
provider: { name: config.queue.adapter === "postgres" ? "pgboss" : "bullmq" },
|
|
985
1182
|
logger: { name: "console", level: "info" },
|
|
986
|
-
state: config.state,
|
|
987
|
-
eventStore: config.eventStore,
|
|
988
1183
|
runner: { ts: { isolate: "inprocess" }, py: { enabled: false, cmd: "python3", importMode: "file" } },
|
|
989
|
-
workers: [],
|
|
990
1184
|
flows: {},
|
|
991
1185
|
eventIndex: {}
|
|
992
1186
|
})));
|
|
993
|
-
console.log(`[
|
|
994
|
-
console.log(`[
|
|
995
|
-
console.log(`[
|
|
1187
|
+
console.log(`[nvent] registry refreshed (${reason})`, changedPath || "");
|
|
1188
|
+
console.log(`[nvent] new registry has ${lastCompiledRegistry.workers?.length || 0} workers`);
|
|
1189
|
+
console.log(`[nvent] new registry compiled at: ${lastCompiledRegistry.compiledAt}`);
|
|
996
1190
|
await updateTemplates({
|
|
997
1191
|
filter: (template) => {
|
|
998
|
-
const match = template.filename === REGISTRY_TEMPLATE || template.filename === HANDLERS_TEMPLATE || template.filename === ANALYZED_FLOWS_TEMPLATE;
|
|
1192
|
+
const match = template.filename === REGISTRY_TEMPLATE || template.filename === HANDLERS_TEMPLATE || template.filename === ANALYZED_FLOWS_TEMPLATE || template.filename === TRIGGER_REGISTRY_TEMPLATE;
|
|
999
1193
|
if (match) {
|
|
1000
|
-
console.log(`[
|
|
1194
|
+
console.log(`[nvent] updating template: ${template.filename}`);
|
|
1001
1195
|
}
|
|
1002
1196
|
return match;
|
|
1003
1197
|
}
|
|
1004
1198
|
});
|
|
1005
|
-
console.log(`[
|
|
1199
|
+
console.log(`[nvent] templates updated`);
|
|
1006
1200
|
};
|
|
1007
1201
|
if (nuxt.options.dev) {
|
|
1008
|
-
const
|
|
1202
|
+
const functionsDir = config.dir || "functions";
|
|
1009
1203
|
watchQueueFiles({
|
|
1010
1204
|
nuxt,
|
|
1011
1205
|
layerInfos,
|
|
1012
|
-
queuesDir:
|
|
1206
|
+
queuesDir: functionsDir,
|
|
1013
1207
|
onRefresh: refreshRegistry
|
|
1014
1208
|
});
|
|
1015
1209
|
}
|
|
1016
1210
|
}
|
|
1017
1211
|
});
|
|
1018
1212
|
|
|
1019
|
-
export { module as default };
|
|
1213
|
+
export { module$1 as default };
|