nvent 0.5.15 → 1.0.0-alpha.2

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.
Files changed (149) hide show
  1. package/dist/module.d.mts +181 -8
  2. package/dist/module.json +1 -1
  3. package/dist/module.mjs +1257 -1196
  4. package/dist/runtime/app/composables/useFunctionCall.d.ts +17 -0
  5. package/dist/runtime/app/composables/useFunctionCall.js +25 -0
  6. package/dist/runtime/app/composables/useNventStream.d.ts +23 -0
  7. package/dist/runtime/app/composables/useNventStream.js +58 -0
  8. package/dist/runtime/nitro/plugins/00.iii-lifecycle.d.ts +19 -0
  9. package/dist/runtime/nitro/plugins/00.iii-lifecycle.js +62 -0
  10. package/dist/runtime/nitro/plugins/01.iii-worker.d.ts +15 -0
  11. package/dist/runtime/nitro/plugins/01.iii-worker.js +91 -0
  12. package/dist/runtime/nitro/routes/stream-proxy.d.ts +17 -0
  13. package/dist/runtime/nitro/routes/stream-proxy.js +45 -0
  14. package/dist/runtime/nitro/utils/console.d.ts +32 -0
  15. package/dist/runtime/nitro/utils/console.js +95 -0
  16. package/dist/runtime/nitro/utils/defineFunction.d.ts +378 -3
  17. package/dist/runtime/nitro/utils/defineFunction.js +224 -4
  18. package/dist/runtime/nitro/utils/engine.d.ts +25 -0
  19. package/dist/runtime/nitro/utils/engine.js +130 -0
  20. package/dist/runtime/nitro/utils/nventDir.d.ts +1 -0
  21. package/dist/runtime/nitro/utils/nventDir.js +20 -0
  22. package/dist/runtime/nitro/utils/useIii.d.ts +23 -0
  23. package/dist/runtime/nitro/utils/useIii.js +14 -0
  24. package/dist/runtime/nitro/utils/workers/node.d.ts +24 -0
  25. package/dist/runtime/nitro/utils/workers/node.js +57 -0
  26. package/dist/runtime/nitro/utils/workers/python.d.ts +67 -0
  27. package/dist/runtime/nitro/utils/workers/python.js +220 -0
  28. package/dist/runtime/python/nvent.py +208 -0
  29. package/dist/runtime/python/worker_runtime.py +659 -0
  30. package/dist/runtime/virtual.d.ts +17 -0
  31. package/dist/types.d.mts +5 -1
  32. package/package.json +11 -14
  33. package/dist/runtime/adapters/base/index.d.ts +0 -6
  34. package/dist/runtime/adapters/base/index.js +0 -1
  35. package/dist/runtime/adapters/base/store-validator.d.ts +0 -48
  36. package/dist/runtime/adapters/base/store-validator.js +0 -147
  37. package/dist/runtime/adapters/builtin/file-queue.d.ts +0 -67
  38. package/dist/runtime/adapters/builtin/file-queue.js +0 -499
  39. package/dist/runtime/adapters/builtin/file-store.d.ts +0 -32
  40. package/dist/runtime/adapters/builtin/file-store.js +0 -206
  41. package/dist/runtime/adapters/builtin/file-stream.d.ts +0 -39
  42. package/dist/runtime/adapters/builtin/file-stream.js +0 -56
  43. package/dist/runtime/adapters/builtin/index.d.ts +0 -10
  44. package/dist/runtime/adapters/builtin/index.js +0 -5
  45. package/dist/runtime/adapters/builtin/memory-queue.d.ts +0 -52
  46. package/dist/runtime/adapters/builtin/memory-queue.js +0 -243
  47. package/dist/runtime/adapters/builtin/memory-store.d.ts +0 -69
  48. package/dist/runtime/adapters/builtin/memory-store.js +0 -357
  49. package/dist/runtime/adapters/builtin/memory-stream.d.ts +0 -21
  50. package/dist/runtime/adapters/builtin/memory-stream.js +0 -56
  51. package/dist/runtime/adapters/factory.d.ts +0 -31
  52. package/dist/runtime/adapters/factory.js +0 -135
  53. package/dist/runtime/adapters/index.d.ts +0 -8
  54. package/dist/runtime/adapters/index.js +0 -3
  55. package/dist/runtime/adapters/interfaces/index.d.ts +0 -11
  56. package/dist/runtime/adapters/interfaces/index.js +0 -3
  57. package/dist/runtime/adapters/interfaces/queue.d.ts +0 -155
  58. package/dist/runtime/adapters/interfaces/queue.js +0 -0
  59. package/dist/runtime/adapters/interfaces/store.d.ts +0 -299
  60. package/dist/runtime/adapters/interfaces/store.js +0 -0
  61. package/dist/runtime/adapters/interfaces/stream.d.ts +0 -62
  62. package/dist/runtime/adapters/interfaces/stream.js +0 -0
  63. package/dist/runtime/adapters/registry.d.ts +0 -85
  64. package/dist/runtime/adapters/registry.js +0 -161
  65. package/dist/runtime/config/index.d.ts +0 -23
  66. package/dist/runtime/config/index.js +0 -200
  67. package/dist/runtime/config/types.d.ts +0 -439
  68. package/dist/runtime/config/types.js +0 -0
  69. package/dist/runtime/events/eventBus.d.ts +0 -20
  70. package/dist/runtime/events/eventBus.js +0 -35
  71. package/dist/runtime/events/types.d.ts +0 -144
  72. package/dist/runtime/events/types.js +0 -0
  73. package/dist/runtime/events/utils/scheduleTrigger.d.ts +0 -8
  74. package/dist/runtime/events/utils/scheduleTrigger.js +0 -71
  75. package/dist/runtime/events/utils/stallDetector.d.ts +0 -83
  76. package/dist/runtime/events/utils/stallDetector.js +0 -318
  77. package/dist/runtime/events/utils/triggerRuntime.d.ts +0 -58
  78. package/dist/runtime/events/utils/triggerRuntime.js +0 -212
  79. package/dist/runtime/events/wiring/flowWiring.d.ts +0 -34
  80. package/dist/runtime/events/wiring/flowWiring.js +0 -1258
  81. package/dist/runtime/events/wiring/registry.d.ts +0 -19
  82. package/dist/runtime/events/wiring/registry.js +0 -43
  83. package/dist/runtime/events/wiring/stateWiring.d.ts +0 -37
  84. package/dist/runtime/events/wiring/stateWiring.js +0 -92
  85. package/dist/runtime/events/wiring/streamWiring.d.ts +0 -36
  86. package/dist/runtime/events/wiring/streamWiring.js +0 -156
  87. package/dist/runtime/events/wiring/triggerWiring.d.ts +0 -21
  88. package/dist/runtime/events/wiring/triggerWiring.js +0 -422
  89. package/dist/runtime/nitro/plugins/00.adapters.d.ts +0 -14
  90. package/dist/runtime/nitro/plugins/00.adapters.js +0 -73
  91. package/dist/runtime/nitro/plugins/01.ws-lifecycle.d.ts +0 -5
  92. package/dist/runtime/nitro/plugins/01.ws-lifecycle.js +0 -69
  93. package/dist/runtime/nitro/plugins/02.workers.d.ts +0 -2
  94. package/dist/runtime/nitro/plugins/02.workers.js +0 -92
  95. package/dist/runtime/nitro/plugins/03.triggers.d.ts +0 -12
  96. package/dist/runtime/nitro/plugins/03.triggers.js +0 -55
  97. package/dist/runtime/nitro/routes/webhook.await.d.ts +0 -23
  98. package/dist/runtime/nitro/routes/webhook.await.js +0 -112
  99. package/dist/runtime/nitro/routes/webhook.trigger.d.ts +0 -86
  100. package/dist/runtime/nitro/routes/webhook.trigger.js +0 -73
  101. package/dist/runtime/nitro/utils/adapters.d.ts +0 -66
  102. package/dist/runtime/nitro/utils/adapters.js +0 -51
  103. package/dist/runtime/nitro/utils/awaitPatterns/event.d.ts +0 -15
  104. package/dist/runtime/nitro/utils/awaitPatterns/event.js +0 -128
  105. package/dist/runtime/nitro/utils/awaitPatterns/index.d.ts +0 -28
  106. package/dist/runtime/nitro/utils/awaitPatterns/index.js +0 -55
  107. package/dist/runtime/nitro/utils/awaitPatterns/schedule.d.ts +0 -16
  108. package/dist/runtime/nitro/utils/awaitPatterns/schedule.js +0 -83
  109. package/dist/runtime/nitro/utils/awaitPatterns/time.d.ts +0 -15
  110. package/dist/runtime/nitro/utils/awaitPatterns/time.js +0 -71
  111. package/dist/runtime/nitro/utils/awaitPatterns/webhook.d.ts +0 -15
  112. package/dist/runtime/nitro/utils/awaitPatterns/webhook.js +0 -128
  113. package/dist/runtime/nitro/utils/defineFunctionConfig.d.ts +0 -378
  114. package/dist/runtime/nitro/utils/defineFunctionConfig.js +0 -3
  115. package/dist/runtime/nitro/utils/defineHooks.d.ts +0 -95
  116. package/dist/runtime/nitro/utils/defineHooks.js +0 -9
  117. package/dist/runtime/nitro/utils/registerAdapter.d.ts +0 -59
  118. package/dist/runtime/nitro/utils/registerAdapter.js +0 -13
  119. package/dist/runtime/nitro/utils/useAwait.d.ts +0 -83
  120. package/dist/runtime/nitro/utils/useAwait.js +0 -169
  121. package/dist/runtime/nitro/utils/useEventManager.d.ts +0 -15
  122. package/dist/runtime/nitro/utils/useEventManager.js +0 -26
  123. package/dist/runtime/nitro/utils/useFlow.d.ts +0 -66
  124. package/dist/runtime/nitro/utils/useFlow.js +0 -310
  125. package/dist/runtime/nitro/utils/useHookRegistry.d.ts +0 -40
  126. package/dist/runtime/nitro/utils/useHookRegistry.js +0 -25
  127. package/dist/runtime/nitro/utils/useNventLogger.d.ts +0 -42
  128. package/dist/runtime/nitro/utils/useNventLogger.js +0 -54
  129. package/dist/runtime/nitro/utils/useRunContext.d.ts +0 -6
  130. package/dist/runtime/nitro/utils/useRunContext.js +0 -102
  131. package/dist/runtime/nitro/utils/useStreamTopics.d.ts +0 -83
  132. package/dist/runtime/nitro/utils/useStreamTopics.js +0 -94
  133. package/dist/runtime/nitro/utils/useTrigger.d.ts +0 -150
  134. package/dist/runtime/nitro/utils/useTrigger.js +0 -311
  135. package/dist/runtime/nitro/utils/wsPeerManager.d.ts +0 -44
  136. package/dist/runtime/nitro/utils/wsPeerManager.js +0 -32
  137. package/dist/runtime/scheduler/index.d.ts +0 -33
  138. package/dist/runtime/scheduler/index.js +0 -42
  139. package/dist/runtime/scheduler/scheduler.d.ts +0 -132
  140. package/dist/runtime/scheduler/scheduler.js +0 -799
  141. package/dist/runtime/scheduler/types.d.ts +0 -122
  142. package/dist/runtime/scheduler/types.js +0 -0
  143. package/dist/runtime/worker/node/runner.d.ts +0 -95
  144. package/dist/runtime/worker/node/runner.js +0 -272
  145. package/dist/runtime/worker/python/get_config.py +0 -64
  146. package/dist/runtime/worker/system/awaitHandlers.d.ts +0 -27
  147. package/dist/runtime/worker/system/awaitHandlers.js +0 -230
  148. package/dist/runtime/worker/system/index.d.ts +0 -24
  149. package/dist/runtime/worker/system/index.js +0 -39
@@ -1,19 +0,0 @@
1
- export interface Wiring {
2
- start(): void | Promise<void>;
3
- stop(): void | Promise<void>;
4
- }
5
- export interface WiringRegistryOptions {
6
- /**
7
- * Stream wiring options
8
- */
9
- streamWiring?: {
10
- enabled?: boolean;
11
- };
12
- /**
13
- * State wiring options
14
- */
15
- stateWiring?: {
16
- strategy?: 'never' | 'on-complete' | 'immediate' | 'ttl';
17
- };
18
- }
19
- export declare function createWiringRegistry(opts?: WiringRegistryOptions): Wiring;
@@ -1,43 +0,0 @@
1
- import { createFlowWiring } from "./flowWiring.js";
2
- import { createStreamWiring } from "./streamWiring.js";
3
- import { createStateWiring } from "./stateWiring.js";
4
- import { createTriggerWiring } from "./triggerWiring.js";
5
- const WIRING_KEY = "__nvent_wiring__";
6
- export function createWiringRegistry(opts) {
7
- const existingWiring = globalThis[WIRING_KEY];
8
- if (existingWiring) {
9
- return existingWiring;
10
- }
11
- const wirings = [
12
- // 1. Flow orchestration (persistence, completion tracking, step triggering)
13
- createFlowWiring(),
14
- // 2. Stream wiring (publish persisted events to UI clients)
15
- createStreamWiring(opts?.streamWiring || {
16
- enabled: true
17
- }),
18
- // 3. State wiring (automatic state cleanup)
19
- createStateWiring(opts?.stateWiring),
20
- // 4. Trigger wiring (v0.5: trigger.fired, await.registered, await.resolved)
21
- createTriggerWiring()
22
- ];
23
- let started = false;
24
- const wiring = {
25
- async start() {
26
- if (started) return;
27
- started = true;
28
- for (const w of wirings) await w.start();
29
- },
30
- async stop() {
31
- for (const w of wirings) {
32
- try {
33
- await w.stop();
34
- } catch {
35
- }
36
- }
37
- started = false;
38
- globalThis[WIRING_KEY] = null;
39
- }
40
- };
41
- globalThis[WIRING_KEY] = wiring;
42
- return wiring;
43
- }
@@ -1,37 +0,0 @@
1
- /**
2
- * State Wiring - Automatic cleanup of flow state
3
- *
4
- * Subscribes to the local event bus (single source of truth) and handles
5
- * automatic cleanup of flow state based on configuration strategy.
6
- *
7
- * Cleanup strategies:
8
- * - 'never': State persists indefinitely (default)
9
- * - 'on-complete': Cleanup when flow completes (recommended)
10
- * - 'immediate': Cleanup after each step (not recommended)
11
- * - 'ttl': State expires automatically via TTL (handled by storage provider)
12
- *
13
- * Benefits:
14
- * - Single source of truth (event bus)
15
- * - Configurable cleanup strategies
16
- * - Clear separation of concerns
17
- */
18
- export interface StateWiringOptions {
19
- /**
20
- * Cleanup strategy
21
- * - 'never': State persists indefinitely
22
- * - 'on-complete': Cleanup when flow completes (recommended)
23
- * - 'immediate': Cleanup after each step
24
- * - 'ttl': State expires automatically via TTL
25
- * Default: 'never'
26
- */
27
- strategy?: 'never' | 'on-complete' | 'immediate' | 'ttl';
28
- }
29
- /**
30
- * Create state wiring
31
- *
32
- * Subscribes to event bus and handles state cleanup based on configuration
33
- */
34
- export declare function createStateWiring(opts?: StateWiringOptions): {
35
- start: () => void;
36
- stop: () => void;
37
- };
@@ -1,92 +0,0 @@
1
- import { getEventBus } from "../eventBus.js";
2
- import { useNventLogger, useStateAdapter, useRuntimeConfig } from "#imports";
3
- export function createStateWiring(opts) {
4
- let strategy = opts?.strategy;
5
- if (!strategy) {
6
- try {
7
- const rc = useRuntimeConfig();
8
- strategy = rc?.nvent?.store?.state?.cleanup?.strategy || "never";
9
- } catch {
10
- strategy = "never";
11
- }
12
- }
13
- const bus = getEventBus();
14
- const unsubs = [];
15
- let wired = false;
16
- function start() {
17
- if (wired) return;
18
- wired = true;
19
- if (strategy === "never" || strategy === "ttl") {
20
- return;
21
- }
22
- const logger = useNventLogger("state-wiring");
23
- const stateAdapter = useStateAdapter();
24
- logger.info("Starting state wiring", { strategy });
25
- if (strategy === "on-complete") {
26
- const cleanupFlowState = async (event, reason) => {
27
- const flowId = event.runId;
28
- if (!flowId) return;
29
- try {
30
- const pattern = `flow:${flowId}:*`;
31
- const deletedCount = await stateAdapter.clear(pattern);
32
- if (deletedCount > 0) {
33
- logger.info(`Cleaned up state after ${reason}`, {
34
- flowId,
35
- deletedCount
36
- });
37
- }
38
- } catch (error) {
39
- logger.error(`Error cleaning up state after ${reason}`, {
40
- flowId,
41
- error: error?.message
42
- });
43
- }
44
- };
45
- const handleFlowCompleted = (event) => cleanupFlowState(event, "flow completion");
46
- const handleFlowFailed = (event) => cleanupFlowState(event, "flow failure");
47
- const handleFlowCanceled = (event) => cleanupFlowState(event, "flow cancellation");
48
- const handleFlowStalled = (event) => cleanupFlowState(event, "flow stall");
49
- unsubs.push(bus.onType("flow.completed", handleFlowCompleted));
50
- unsubs.push(bus.onType("flow.failed", handleFlowFailed));
51
- unsubs.push(bus.onType("flow.cancel", handleFlowCanceled));
52
- unsubs.push(bus.onType("flow.stalled", handleFlowStalled));
53
- logger.debug("State cleanup enabled: on-complete (includes stalled and canceled)");
54
- } else if (strategy === "immediate") {
55
- const handleStepCompleted = async (event) => {
56
- const flowId = event.runId;
57
- if (!flowId) return;
58
- try {
59
- const pattern = `flow:${flowId}:*`;
60
- const deletedCount = await stateAdapter.clear(pattern);
61
- if (deletedCount > 0) {
62
- logger.info("Cleaned up state after step completion", {
63
- flowId,
64
- stepName: event.stepName,
65
- deletedCount
66
- });
67
- }
68
- } catch (error) {
69
- logger.error("Error cleaning up state after step", {
70
- flowId,
71
- error: error?.message
72
- });
73
- }
74
- };
75
- unsubs.push(bus.onType("step.completed", handleStepCompleted));
76
- logger.debug("State cleanup enabled: immediate");
77
- }
78
- logger.info("State wiring started");
79
- }
80
- function stop() {
81
- const logger = useNventLogger("state-wiring");
82
- for (const unsub of unsubs.splice(0)) {
83
- try {
84
- unsub();
85
- } catch {
86
- }
87
- }
88
- wired = false;
89
- logger.debug("State wiring stopped");
90
- }
91
- return { start, stop };
92
- }
@@ -1,36 +0,0 @@
1
- /**
2
- * Stream Wiring - Bridge event bus to StreamAdapter for real-time UI updates
3
- *
4
- * Architecture:
5
- * 1. Event Bus - Single source of truth for all events (in-memory)
6
- * 2. StreamWiring - Bridges persisted events to stream topics (this file)
7
- * 3. StreamAdapter - Pub/sub for real-time distribution (Redis/Memory)
8
- * 4. WebSocket handlers - Subscribe to topics and send to clients
9
- *
10
- * Flow:
11
- * Event Bus → StreamWiring → StreamAdapter → WebSocket → UI
12
- *
13
- * Stream Topics (defined in useStreamTopics):
14
- * - stream:flow:events:{runId} - Flow events for specific run
15
- * - stream:flow:stats - Flow statistics updates
16
- * - stream:trigger:events:{triggerName} - Trigger events
17
- * - stream:trigger:stats - Trigger statistics updates
18
- *
19
- * Only publishes persisted events (with id/ts) to avoid duplicates
20
- */
21
- export interface StreamWiringOptions {
22
- /**
23
- * Enable client messages (WebSocket/SSE)
24
- * Default: true
25
- */
26
- enabled?: boolean;
27
- }
28
- /**
29
- * Create stream wiring
30
- *
31
- * Subscribes to event bus and publishes persisted events to UI clients
32
- */
33
- export declare function createStreamWiring(opts?: StreamWiringOptions): {
34
- start: () => void;
35
- stop: () => void;
36
- };
@@ -1,156 +0,0 @@
1
- import { getEventBus } from "../eventBus.js";
2
- import { useNventLogger, useStreamAdapter, useStreamTopics } from "#imports";
3
- export function createStreamWiring(opts = {}) {
4
- const {
5
- enabled = true
6
- } = opts;
7
- const bus = getEventBus();
8
- const unsubs = [];
9
- let wired = false;
10
- function start() {
11
- if (wired) return;
12
- wired = true;
13
- if (!enabled) return;
14
- const logger = useNventLogger("stream-wiring");
15
- const stream = useStreamAdapter();
16
- const { StreamTopics } = useStreamTopics();
17
- logger.info("Starting stream wiring for UI clients");
18
- const handleFlowEvent = async (e) => {
19
- if (!e.id || !e.ts) return;
20
- const runId = e.runId;
21
- if (!runId) return;
22
- try {
23
- const topic = StreamTopics.flowEvents(runId);
24
- await stream.publish(topic, {
25
- type: "flow.event",
26
- data: {
27
- event: {
28
- id: e.id,
29
- ts: e.ts,
30
- type: e.type,
31
- runId: e.runId,
32
- flowName: e.flowName,
33
- // Include step-specific fields for UI
34
- stepName: e.stepName,
35
- stepId: e.stepId,
36
- attempt: e.attempt,
37
- data: e.data
38
- }
39
- },
40
- timestamp: Date.now()
41
- });
42
- logger.debug("Published flow event to stream", { type: e.type, runId });
43
- } catch (err) {
44
- logger.error("Failed to publish flow event to stream", {
45
- error: err?.message
46
- });
47
- }
48
- };
49
- const handleTriggerEvent = async (e) => {
50
- if (!e.id || !e.ts) return;
51
- const triggerName = e.triggerName;
52
- if (!triggerName) return;
53
- try {
54
- const topic = StreamTopics.triggerEvents(triggerName);
55
- await stream.publish(topic, {
56
- type: "trigger.event",
57
- data: {
58
- event: {
59
- id: e.id,
60
- ts: e.ts,
61
- type: e.type,
62
- triggerName,
63
- data: e.data
64
- }
65
- },
66
- timestamp: Date.now()
67
- });
68
- logger.debug("Published trigger event to stream", {
69
- triggerName,
70
- type: e.type,
71
- id: e.id
72
- });
73
- } catch (err) {
74
- logger.error("Failed to publish trigger event to stream", {
75
- triggerName,
76
- type: e.type,
77
- error: err?.message
78
- });
79
- }
80
- };
81
- const flowEventTypes = [
82
- "flow.start",
83
- "flow.completed",
84
- "flow.failed",
85
- "flow.cancel",
86
- "step.started",
87
- "step.completed",
88
- "step.failed",
89
- "step.retry",
90
- "await.registered",
91
- "await.resolved",
92
- "await.timeout",
93
- "log",
94
- "emit"
95
- ];
96
- const triggerEventTypes = [
97
- "trigger.registered",
98
- "trigger.updated",
99
- "trigger.deleted",
100
- "trigger.fired",
101
- "subscription.added",
102
- "subscription.removed"
103
- ];
104
- const handleFlowStatsUpdate = async (e) => {
105
- try {
106
- const topic = StreamTopics.flowStats();
107
- await stream.publish(topic, {
108
- id: e.flowName,
109
- metadata: e.metadata
110
- });
111
- logger.debug("Published flow stats to stream", { flowName: e.flowName });
112
- } catch (err) {
113
- logger.error("Failed to publish flow stats to stream", {
114
- flowName: e.flowName,
115
- error: err?.message
116
- });
117
- }
118
- };
119
- const handleTriggerStatsUpdate = async (e) => {
120
- try {
121
- const topic = StreamTopics.triggerStats();
122
- await stream.publish(topic, {
123
- id: e.triggerName,
124
- metadata: e.metadata
125
- });
126
- logger.debug("Published trigger stats to stream", { triggerName: e.triggerName });
127
- } catch (err) {
128
- logger.error("Failed to publish trigger stats to stream", {
129
- triggerName: e.triggerName,
130
- error: err?.message
131
- });
132
- }
133
- };
134
- for (const type of flowEventTypes) {
135
- unsubs.push(bus.onType(type, handleFlowEvent));
136
- }
137
- for (const type of triggerEventTypes) {
138
- unsubs.push(bus.onType(type, handleTriggerEvent));
139
- }
140
- unsubs.push(bus.onType("flow.stats.updated", handleFlowStatsUpdate));
141
- unsubs.push(bus.onType("trigger.stats.updated", handleTriggerStatsUpdate));
142
- logger.info("Stream wiring started - listening for persisted flow and trigger events");
143
- }
144
- function stop() {
145
- const logger = useNventLogger("stream-wiring");
146
- for (const unsub of unsubs.splice(0)) {
147
- try {
148
- unsub();
149
- } catch {
150
- }
151
- }
152
- wired = false;
153
- logger.debug("Stream wiring stopped");
154
- }
155
- return { start, stop };
156
- }
@@ -1,21 +0,0 @@
1
- import type { TriggerFiredEvent } from '../types.js';
2
- /**
3
- * Create trigger event wiring
4
- * Listens to trigger.fired events and starts subscribed flows
5
- * Handles await.registered and await.resolved events
6
- */
7
- export declare function createTriggerWiring(): {
8
- start: () => Promise<void>;
9
- stop: () => void;
10
- };
11
- /**
12
- * Handle trigger.fired event
13
- * Starts all subscribed flows (auto mode) or queues them (manual mode)
14
- * Returns list of flows that were started for stream metadata
15
- */
16
- export declare function handleTriggerFired(event: TriggerFiredEvent): Promise<string[]>;
17
- /**
18
- * Start a flow from a trigger event
19
- * Enqueues the entry step and publishes flow.start event
20
- */
21
- export declare function startFlowFromTrigger(flowName: string, triggerName: string, triggerData: any): Promise<void>;