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.
- package/dist/module.d.mts +181 -8
- package/dist/module.json +1 -1
- package/dist/module.mjs +1257 -1196
- package/dist/runtime/app/composables/useFunctionCall.d.ts +17 -0
- package/dist/runtime/app/composables/useFunctionCall.js +25 -0
- package/dist/runtime/app/composables/useNventStream.d.ts +23 -0
- package/dist/runtime/app/composables/useNventStream.js +58 -0
- package/dist/runtime/nitro/plugins/00.iii-lifecycle.d.ts +19 -0
- package/dist/runtime/nitro/plugins/00.iii-lifecycle.js +62 -0
- package/dist/runtime/nitro/plugins/01.iii-worker.d.ts +15 -0
- package/dist/runtime/nitro/plugins/01.iii-worker.js +91 -0
- package/dist/runtime/nitro/routes/stream-proxy.d.ts +17 -0
- package/dist/runtime/nitro/routes/stream-proxy.js +45 -0
- package/dist/runtime/nitro/utils/console.d.ts +32 -0
- package/dist/runtime/nitro/utils/console.js +95 -0
- package/dist/runtime/nitro/utils/defineFunction.d.ts +378 -3
- package/dist/runtime/nitro/utils/defineFunction.js +224 -4
- package/dist/runtime/nitro/utils/engine.d.ts +25 -0
- package/dist/runtime/nitro/utils/engine.js +130 -0
- package/dist/runtime/nitro/utils/nventDir.d.ts +1 -0
- package/dist/runtime/nitro/utils/nventDir.js +20 -0
- package/dist/runtime/nitro/utils/useIii.d.ts +23 -0
- package/dist/runtime/nitro/utils/useIii.js +14 -0
- package/dist/runtime/nitro/utils/workers/node.d.ts +24 -0
- package/dist/runtime/nitro/utils/workers/node.js +57 -0
- package/dist/runtime/nitro/utils/workers/python.d.ts +67 -0
- package/dist/runtime/nitro/utils/workers/python.js +220 -0
- package/dist/runtime/python/nvent.py +208 -0
- package/dist/runtime/python/worker_runtime.py +659 -0
- package/dist/runtime/virtual.d.ts +17 -0
- package/dist/types.d.mts +5 -1
- package/package.json +11 -14
- package/dist/runtime/adapters/base/index.d.ts +0 -6
- package/dist/runtime/adapters/base/index.js +0 -1
- package/dist/runtime/adapters/base/store-validator.d.ts +0 -48
- package/dist/runtime/adapters/base/store-validator.js +0 -147
- package/dist/runtime/adapters/builtin/file-queue.d.ts +0 -67
- package/dist/runtime/adapters/builtin/file-queue.js +0 -499
- package/dist/runtime/adapters/builtin/file-store.d.ts +0 -32
- package/dist/runtime/adapters/builtin/file-store.js +0 -206
- package/dist/runtime/adapters/builtin/file-stream.d.ts +0 -39
- package/dist/runtime/adapters/builtin/file-stream.js +0 -56
- package/dist/runtime/adapters/builtin/index.d.ts +0 -10
- package/dist/runtime/adapters/builtin/index.js +0 -5
- package/dist/runtime/adapters/builtin/memory-queue.d.ts +0 -52
- package/dist/runtime/adapters/builtin/memory-queue.js +0 -243
- package/dist/runtime/adapters/builtin/memory-store.d.ts +0 -69
- package/dist/runtime/adapters/builtin/memory-store.js +0 -357
- package/dist/runtime/adapters/builtin/memory-stream.d.ts +0 -21
- package/dist/runtime/adapters/builtin/memory-stream.js +0 -56
- package/dist/runtime/adapters/factory.d.ts +0 -31
- package/dist/runtime/adapters/factory.js +0 -135
- package/dist/runtime/adapters/index.d.ts +0 -8
- package/dist/runtime/adapters/index.js +0 -3
- package/dist/runtime/adapters/interfaces/index.d.ts +0 -11
- package/dist/runtime/adapters/interfaces/index.js +0 -3
- package/dist/runtime/adapters/interfaces/queue.d.ts +0 -155
- package/dist/runtime/adapters/interfaces/queue.js +0 -0
- package/dist/runtime/adapters/interfaces/store.d.ts +0 -299
- package/dist/runtime/adapters/interfaces/store.js +0 -0
- package/dist/runtime/adapters/interfaces/stream.d.ts +0 -62
- package/dist/runtime/adapters/interfaces/stream.js +0 -0
- package/dist/runtime/adapters/registry.d.ts +0 -85
- package/dist/runtime/adapters/registry.js +0 -161
- package/dist/runtime/config/index.d.ts +0 -23
- package/dist/runtime/config/index.js +0 -200
- package/dist/runtime/config/types.d.ts +0 -439
- package/dist/runtime/config/types.js +0 -0
- package/dist/runtime/events/eventBus.d.ts +0 -20
- package/dist/runtime/events/eventBus.js +0 -35
- package/dist/runtime/events/types.d.ts +0 -144
- package/dist/runtime/events/types.js +0 -0
- package/dist/runtime/events/utils/scheduleTrigger.d.ts +0 -8
- package/dist/runtime/events/utils/scheduleTrigger.js +0 -71
- package/dist/runtime/events/utils/stallDetector.d.ts +0 -83
- package/dist/runtime/events/utils/stallDetector.js +0 -318
- package/dist/runtime/events/utils/triggerRuntime.d.ts +0 -58
- package/dist/runtime/events/utils/triggerRuntime.js +0 -212
- package/dist/runtime/events/wiring/flowWiring.d.ts +0 -34
- package/dist/runtime/events/wiring/flowWiring.js +0 -1258
- package/dist/runtime/events/wiring/registry.d.ts +0 -19
- package/dist/runtime/events/wiring/registry.js +0 -43
- package/dist/runtime/events/wiring/stateWiring.d.ts +0 -37
- package/dist/runtime/events/wiring/stateWiring.js +0 -92
- package/dist/runtime/events/wiring/streamWiring.d.ts +0 -36
- package/dist/runtime/events/wiring/streamWiring.js +0 -156
- package/dist/runtime/events/wiring/triggerWiring.d.ts +0 -21
- package/dist/runtime/events/wiring/triggerWiring.js +0 -422
- package/dist/runtime/nitro/plugins/00.adapters.d.ts +0 -14
- package/dist/runtime/nitro/plugins/00.adapters.js +0 -73
- package/dist/runtime/nitro/plugins/01.ws-lifecycle.d.ts +0 -5
- package/dist/runtime/nitro/plugins/01.ws-lifecycle.js +0 -69
- package/dist/runtime/nitro/plugins/02.workers.d.ts +0 -2
- package/dist/runtime/nitro/plugins/02.workers.js +0 -92
- package/dist/runtime/nitro/plugins/03.triggers.d.ts +0 -12
- package/dist/runtime/nitro/plugins/03.triggers.js +0 -55
- package/dist/runtime/nitro/routes/webhook.await.d.ts +0 -23
- package/dist/runtime/nitro/routes/webhook.await.js +0 -112
- package/dist/runtime/nitro/routes/webhook.trigger.d.ts +0 -86
- package/dist/runtime/nitro/routes/webhook.trigger.js +0 -73
- package/dist/runtime/nitro/utils/adapters.d.ts +0 -66
- package/dist/runtime/nitro/utils/adapters.js +0 -51
- package/dist/runtime/nitro/utils/awaitPatterns/event.d.ts +0 -15
- package/dist/runtime/nitro/utils/awaitPatterns/event.js +0 -128
- package/dist/runtime/nitro/utils/awaitPatterns/index.d.ts +0 -28
- package/dist/runtime/nitro/utils/awaitPatterns/index.js +0 -55
- package/dist/runtime/nitro/utils/awaitPatterns/schedule.d.ts +0 -16
- package/dist/runtime/nitro/utils/awaitPatterns/schedule.js +0 -83
- package/dist/runtime/nitro/utils/awaitPatterns/time.d.ts +0 -15
- package/dist/runtime/nitro/utils/awaitPatterns/time.js +0 -71
- package/dist/runtime/nitro/utils/awaitPatterns/webhook.d.ts +0 -15
- package/dist/runtime/nitro/utils/awaitPatterns/webhook.js +0 -128
- package/dist/runtime/nitro/utils/defineFunctionConfig.d.ts +0 -378
- package/dist/runtime/nitro/utils/defineFunctionConfig.js +0 -3
- package/dist/runtime/nitro/utils/defineHooks.d.ts +0 -95
- package/dist/runtime/nitro/utils/defineHooks.js +0 -9
- package/dist/runtime/nitro/utils/registerAdapter.d.ts +0 -59
- package/dist/runtime/nitro/utils/registerAdapter.js +0 -13
- package/dist/runtime/nitro/utils/useAwait.d.ts +0 -83
- package/dist/runtime/nitro/utils/useAwait.js +0 -169
- package/dist/runtime/nitro/utils/useEventManager.d.ts +0 -15
- package/dist/runtime/nitro/utils/useEventManager.js +0 -26
- package/dist/runtime/nitro/utils/useFlow.d.ts +0 -66
- package/dist/runtime/nitro/utils/useFlow.js +0 -310
- package/dist/runtime/nitro/utils/useHookRegistry.d.ts +0 -40
- package/dist/runtime/nitro/utils/useHookRegistry.js +0 -25
- package/dist/runtime/nitro/utils/useNventLogger.d.ts +0 -42
- package/dist/runtime/nitro/utils/useNventLogger.js +0 -54
- package/dist/runtime/nitro/utils/useRunContext.d.ts +0 -6
- package/dist/runtime/nitro/utils/useRunContext.js +0 -102
- package/dist/runtime/nitro/utils/useStreamTopics.d.ts +0 -83
- package/dist/runtime/nitro/utils/useStreamTopics.js +0 -94
- package/dist/runtime/nitro/utils/useTrigger.d.ts +0 -150
- package/dist/runtime/nitro/utils/useTrigger.js +0 -311
- package/dist/runtime/nitro/utils/wsPeerManager.d.ts +0 -44
- package/dist/runtime/nitro/utils/wsPeerManager.js +0 -32
- package/dist/runtime/scheduler/index.d.ts +0 -33
- package/dist/runtime/scheduler/index.js +0 -42
- package/dist/runtime/scheduler/scheduler.d.ts +0 -132
- package/dist/runtime/scheduler/scheduler.js +0 -799
- package/dist/runtime/scheduler/types.d.ts +0 -122
- package/dist/runtime/scheduler/types.js +0 -0
- package/dist/runtime/worker/node/runner.d.ts +0 -95
- package/dist/runtime/worker/node/runner.js +0 -272
- package/dist/runtime/worker/python/get_config.py +0 -64
- package/dist/runtime/worker/system/awaitHandlers.d.ts +0 -27
- package/dist/runtime/worker/system/awaitHandlers.js +0 -230
- package/dist/runtime/worker/system/index.d.ts +0 -24
- package/dist/runtime/worker/system/index.js +0 -39
|
@@ -1,378 +0,0 @@
|
|
|
1
|
-
export type FlowRole = 'entry' | 'step';
|
|
2
|
-
/**
|
|
3
|
-
* Trigger definition for inline trigger registration
|
|
4
|
-
* Can be defined in function config alongside subscription
|
|
5
|
-
*/
|
|
6
|
-
export interface TriggerDefinition {
|
|
7
|
-
/**
|
|
8
|
-
* Unique trigger name (e.g., 'manual.approve-order')
|
|
9
|
-
*/
|
|
10
|
-
name: string;
|
|
11
|
-
/**
|
|
12
|
-
* Trigger type
|
|
13
|
-
*/
|
|
14
|
-
type: 'event' | 'webhook' | 'schedule' | 'manual';
|
|
15
|
-
/**
|
|
16
|
-
* Trigger scope: 'flow' for entry triggers, 'await' for await patterns
|
|
17
|
-
*/
|
|
18
|
-
scope?: 'flow' | 'await';
|
|
19
|
-
/**
|
|
20
|
-
* Human-readable display name
|
|
21
|
-
*/
|
|
22
|
-
displayName?: string;
|
|
23
|
-
/**
|
|
24
|
-
* Description of what this trigger does
|
|
25
|
-
*/
|
|
26
|
-
description?: string;
|
|
27
|
-
/**
|
|
28
|
-
* Expected flows that should subscribe to this trigger (for validation)
|
|
29
|
-
*/
|
|
30
|
-
expectedSubscribers?: string[];
|
|
31
|
-
/**
|
|
32
|
-
* Webhook-specific configuration
|
|
33
|
-
*/
|
|
34
|
-
webhook?: {
|
|
35
|
-
/**
|
|
36
|
-
* URL path for webhook (e.g., '/api/webhooks/stripe')
|
|
37
|
-
*/
|
|
38
|
-
path: string;
|
|
39
|
-
/**
|
|
40
|
-
* HTTP method
|
|
41
|
-
*/
|
|
42
|
-
method?: 'GET' | 'POST' | 'PUT' | 'DELETE';
|
|
43
|
-
/**
|
|
44
|
-
* Authentication configuration
|
|
45
|
-
*/
|
|
46
|
-
auth?: any;
|
|
47
|
-
};
|
|
48
|
-
/**
|
|
49
|
-
* Schedule-specific configuration
|
|
50
|
-
*/
|
|
51
|
-
schedule?: {
|
|
52
|
-
/**
|
|
53
|
-
* Cron expression (e.g., '0 9 * * *' for 9 AM daily)
|
|
54
|
-
*/
|
|
55
|
-
cron: string;
|
|
56
|
-
/**
|
|
57
|
-
* Timezone for cron expression
|
|
58
|
-
*/
|
|
59
|
-
timezone?: string;
|
|
60
|
-
/**
|
|
61
|
-
* Whether schedule is enabled
|
|
62
|
-
*/
|
|
63
|
-
enabled?: boolean;
|
|
64
|
-
};
|
|
65
|
-
/**
|
|
66
|
-
* Additional configuration options
|
|
67
|
-
*/
|
|
68
|
-
config?: Record<string, any>;
|
|
69
|
-
}
|
|
70
|
-
export interface FlowConfig {
|
|
71
|
-
/**
|
|
72
|
-
* One or more flow names this step belongs to.
|
|
73
|
-
* A single worker step can participate in multiple flows.
|
|
74
|
-
*/
|
|
75
|
-
name: string | string[];
|
|
76
|
-
/**
|
|
77
|
-
* Role of this step in the flow.
|
|
78
|
-
*/
|
|
79
|
-
role: FlowRole;
|
|
80
|
-
/**
|
|
81
|
-
* Logical step name (used as job name and event kind on start).
|
|
82
|
-
*/
|
|
83
|
-
step: string;
|
|
84
|
-
/**
|
|
85
|
-
* Event kinds this step emits (e.g., `${step}.completed`).
|
|
86
|
-
*/
|
|
87
|
-
emits?: string[];
|
|
88
|
-
/**
|
|
89
|
-
* Event kinds this step subscribes to; can be a single string or an array.
|
|
90
|
-
* The compiler normalizes this to `string[]` under `subscribes`.
|
|
91
|
-
*/
|
|
92
|
-
subscribes?: string | string[];
|
|
93
|
-
/**
|
|
94
|
-
* Entry trigger configuration (v0.5)
|
|
95
|
-
* Define and/or subscribe to triggers to start flow runs
|
|
96
|
-
*/
|
|
97
|
-
triggers?: {
|
|
98
|
-
/**
|
|
99
|
-
* Define a new trigger inline (optional)
|
|
100
|
-
* If provided, this trigger will be registered at build time
|
|
101
|
-
*/
|
|
102
|
-
define?: TriggerDefinition;
|
|
103
|
-
/**
|
|
104
|
-
* Array of trigger names to subscribe to
|
|
105
|
-
* Can include the defined trigger or external triggers
|
|
106
|
-
*/
|
|
107
|
-
subscribe: string[];
|
|
108
|
-
/**
|
|
109
|
-
* Trigger mode: 'auto' (immediate) or 'manual' (requires approval)
|
|
110
|
-
*/
|
|
111
|
-
mode?: 'auto' | 'manual';
|
|
112
|
-
};
|
|
113
|
-
/**
|
|
114
|
-
* Step execution timeout in milliseconds (v0.5.1)
|
|
115
|
-
* Overrides global flow.stepTimeout and queue.defaultJobOptions.timeout for this specific step
|
|
116
|
-
*
|
|
117
|
-
* @example 600000 // 10 minutes
|
|
118
|
-
* @example 3600000 // 1 hour
|
|
119
|
-
*/
|
|
120
|
-
stepTimeout?: number;
|
|
121
|
-
/**
|
|
122
|
-
* Await pattern: Wait BEFORE step execution (v0.5)
|
|
123
|
-
* Step won't execute until trigger fires
|
|
124
|
-
*/
|
|
125
|
-
awaitBefore?: AwaitConfig;
|
|
126
|
-
/**
|
|
127
|
-
* Await pattern: Wait AFTER step execution (v0.5)
|
|
128
|
-
* Next steps won't trigger until trigger fires
|
|
129
|
-
*/
|
|
130
|
-
awaitAfter?: AwaitConfig;
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Await configuration (run-scoped triggers)
|
|
134
|
-
*
|
|
135
|
-
* Pauses flow execution until a specific condition is met. Can be used with:
|
|
136
|
-
* - `awaitBefore`: Wait before step execution starts
|
|
137
|
-
* - `awaitAfter`: Wait after step completes before triggering next steps
|
|
138
|
-
*
|
|
139
|
-
* Declared in config, no functions allowed (AST-parsed at build time)
|
|
140
|
-
*/
|
|
141
|
-
export interface AwaitConfig {
|
|
142
|
-
/**
|
|
143
|
-
* Type of trigger to wait for
|
|
144
|
-
* - `webhook`: Wait for HTTP request to specific endpoint
|
|
145
|
-
* - `event`: Wait for custom event with optional data matching
|
|
146
|
-
* - `schedule`: Wait until specific cron schedule time
|
|
147
|
-
* - `time`: Wait for fixed time delay
|
|
148
|
-
*/
|
|
149
|
-
type: 'webhook' | 'event' | 'schedule' | 'time';
|
|
150
|
-
/**
|
|
151
|
-
* URL path for webhook trigger (supports template variables)
|
|
152
|
-
*
|
|
153
|
-
* Only used when `type: 'webhook'`
|
|
154
|
-
*
|
|
155
|
-
* Template variables available:
|
|
156
|
-
* - `{runId}`: Current flow run ID
|
|
157
|
-
* - `{stepId}`: Current step execution ID
|
|
158
|
-
*
|
|
159
|
-
* @example '/webhooks/approve/{runId}'
|
|
160
|
-
* @example '/api/confirm/{stepId}'
|
|
161
|
-
*/
|
|
162
|
-
path?: string;
|
|
163
|
-
/**
|
|
164
|
-
* HTTP method for webhook endpoint
|
|
165
|
-
*
|
|
166
|
-
* Only used when `type: 'webhook'`
|
|
167
|
-
*
|
|
168
|
-
* @default 'POST'
|
|
169
|
-
*/
|
|
170
|
-
method?: 'GET' | 'POST' | 'PUT' | 'DELETE';
|
|
171
|
-
/**
|
|
172
|
-
* Event name to wait for
|
|
173
|
-
*
|
|
174
|
-
* Only used when `type: 'event'`
|
|
175
|
-
*
|
|
176
|
-
* @example 'payment.completed'
|
|
177
|
-
* @example 'order.shipped'
|
|
178
|
-
*/
|
|
179
|
-
event?: string;
|
|
180
|
-
/**
|
|
181
|
-
* Key to match between event data and step output
|
|
182
|
-
*
|
|
183
|
-
* Only used when `type: 'event'`
|
|
184
|
-
*
|
|
185
|
-
* Matches incoming event data against step output data.
|
|
186
|
-
* Supports nested paths using dot notation.
|
|
187
|
-
*
|
|
188
|
-
* @example 'orderId' - matches event.orderId === stepOutput.orderId
|
|
189
|
-
* @example 'order.id' - matches event.order.id === stepOutput.order.id
|
|
190
|
-
*/
|
|
191
|
-
filterKey?: string;
|
|
192
|
-
/**
|
|
193
|
-
* Cron expression defining when to trigger (one-time schedule)
|
|
194
|
-
*
|
|
195
|
-
* Only used when `type: 'schedule'`
|
|
196
|
-
*
|
|
197
|
-
* Note: This is a one-time trigger, not recurring. The next occurrence
|
|
198
|
-
* of the cron expression after step completion will trigger continuation.
|
|
199
|
-
*
|
|
200
|
-
* @example '0 9 * * *' - 9 AM daily (triggers at next 9 AM occurrence)
|
|
201
|
-
* @example '0 0 * * MON' - Midnight every Monday
|
|
202
|
-
*/
|
|
203
|
-
cron?: string;
|
|
204
|
-
/**
|
|
205
|
-
* Timezone for cron expression evaluation
|
|
206
|
-
*
|
|
207
|
-
* Only used when `type: 'schedule'`
|
|
208
|
-
*
|
|
209
|
-
* @example 'America/New_York'
|
|
210
|
-
* @example 'Europe/Berlin'
|
|
211
|
-
* @default 'UTC'
|
|
212
|
-
*/
|
|
213
|
-
timezone?: string;
|
|
214
|
-
/**
|
|
215
|
-
* Fixed delay in milliseconds before continuation
|
|
216
|
-
*
|
|
217
|
-
* Only used when `type: 'time'`
|
|
218
|
-
*
|
|
219
|
-
* @example 60000 - 1 minute
|
|
220
|
-
* @example 3600000 - 1 hour
|
|
221
|
-
*/
|
|
222
|
-
delay?: number;
|
|
223
|
-
/**
|
|
224
|
-
* Maximum wait time in milliseconds before timeout
|
|
225
|
-
*
|
|
226
|
-
* Applies to all trigger types. If the trigger doesn't fire within
|
|
227
|
-
* this duration, the timeout action will be taken.
|
|
228
|
-
*
|
|
229
|
-
* @example 86400000 - 24 hours
|
|
230
|
-
* @example 604800000 - 7 days
|
|
231
|
-
*/
|
|
232
|
-
timeout?: number;
|
|
233
|
-
/**
|
|
234
|
-
* Action to take when timeout is reached
|
|
235
|
-
*
|
|
236
|
-
* - `fail`: Mark step/flow as failed
|
|
237
|
-
* - `continue`: Continue flow execution anyway
|
|
238
|
-
* - `retry`: Retry waiting (reset timeout)
|
|
239
|
-
*
|
|
240
|
-
* @default 'fail'
|
|
241
|
-
*/
|
|
242
|
-
timeoutAction?: 'fail' | 'continue' | 'retry';
|
|
243
|
-
}
|
|
244
|
-
export interface QueueJobDefaults {
|
|
245
|
-
/**
|
|
246
|
-
* Number of retry attempts for failed jobs.
|
|
247
|
-
* BullMQ: attempts, PGBoss: retryLimit
|
|
248
|
-
*/
|
|
249
|
-
attempts?: number;
|
|
250
|
-
/**
|
|
251
|
-
* Backoff strategy for retries.
|
|
252
|
-
* BullMQ: backoff, PGBoss: retryBackoff + exponentialBackoff
|
|
253
|
-
*/
|
|
254
|
-
backoff?: number | {
|
|
255
|
-
type: 'fixed' | 'exponential';
|
|
256
|
-
delay: number;
|
|
257
|
-
};
|
|
258
|
-
/**
|
|
259
|
-
* Delay in milliseconds before the job is processed.
|
|
260
|
-
* BullMQ: delay, PGBoss: startAfter
|
|
261
|
-
*/
|
|
262
|
-
delay?: number;
|
|
263
|
-
/**
|
|
264
|
-
* Job priority (higher number = higher priority).
|
|
265
|
-
* BullMQ: priority, PGBoss: priority
|
|
266
|
-
*/
|
|
267
|
-
priority?: number;
|
|
268
|
-
/**
|
|
269
|
-
* Job timeout in milliseconds.
|
|
270
|
-
* BullMQ: timeout, PGBoss: expireInSeconds (converted)
|
|
271
|
-
*/
|
|
272
|
-
timeout?: number;
|
|
273
|
-
/**
|
|
274
|
-
* Process jobs in LIFO (Last In First Out) order.
|
|
275
|
-
* BullMQ: lifo, PGBoss: not supported
|
|
276
|
-
*/
|
|
277
|
-
lifo?: boolean;
|
|
278
|
-
/**
|
|
279
|
-
* Remove job from queue when completed.
|
|
280
|
-
* BullMQ: removeOnComplete, PGBoss: deleteAfterSeconds
|
|
281
|
-
*/
|
|
282
|
-
removeOnComplete?: boolean | number;
|
|
283
|
-
/**
|
|
284
|
-
* Remove job from queue when failed.
|
|
285
|
-
* BullMQ: removeOnFail, PGBoss: deleteAfterSeconds
|
|
286
|
-
*/
|
|
287
|
-
removeOnFail?: boolean | number;
|
|
288
|
-
/**
|
|
289
|
-
* Repeatable job configuration.
|
|
290
|
-
* BullMQ: repeat, PGBoss: schedule pattern
|
|
291
|
-
*/
|
|
292
|
-
repeat?: {
|
|
293
|
-
cron?: string;
|
|
294
|
-
every?: number;
|
|
295
|
-
limit?: number;
|
|
296
|
-
tz?: string;
|
|
297
|
-
};
|
|
298
|
-
}
|
|
299
|
-
export interface QueueConfig {
|
|
300
|
-
/**
|
|
301
|
-
* Queue name. If not provided, the filename will be used.
|
|
302
|
-
*/
|
|
303
|
-
name?: string;
|
|
304
|
-
/**
|
|
305
|
-
* Default options for jobs enqueued to this queue.
|
|
306
|
-
*/
|
|
307
|
-
defaultJobOptions?: QueueJobDefaults;
|
|
308
|
-
/**
|
|
309
|
-
* Prefix for queue keys in Redis/storage.
|
|
310
|
-
* BullMQ: prefix, PGBoss: schema
|
|
311
|
-
*/
|
|
312
|
-
prefix?: string;
|
|
313
|
-
/**
|
|
314
|
-
* Rate limiting configuration.
|
|
315
|
-
* BullMQ: limiter, PGBoss: teamSize + teamConcurrency (partial)
|
|
316
|
-
*/
|
|
317
|
-
limiter?: {
|
|
318
|
-
/**
|
|
319
|
-
* Maximum number of jobs to process in the duration window.
|
|
320
|
-
*/
|
|
321
|
-
max?: number;
|
|
322
|
-
/**
|
|
323
|
-
* Duration of the rate limit window in milliseconds.
|
|
324
|
-
*/
|
|
325
|
-
duration?: number;
|
|
326
|
-
/**
|
|
327
|
-
* Group key for rate limiting (optional).
|
|
328
|
-
* BullMQ only: allows per-group rate limiting
|
|
329
|
-
*/
|
|
330
|
-
groupKey?: string;
|
|
331
|
-
};
|
|
332
|
-
}
|
|
333
|
-
export interface WorkerConfig {
|
|
334
|
-
/**
|
|
335
|
-
* Number of jobs to process concurrently.
|
|
336
|
-
* BullMQ: concurrency, PGBoss: teamSize
|
|
337
|
-
*/
|
|
338
|
-
concurrency?: number;
|
|
339
|
-
/**
|
|
340
|
-
* Lock duration in milliseconds.
|
|
341
|
-
* BullMQ: lockDuration, PGBoss: newJobCheckInterval (similar concept)
|
|
342
|
-
*/
|
|
343
|
-
lockDurationMs?: number;
|
|
344
|
-
/**
|
|
345
|
-
* Maximum number of times a job can be stalled before being failed.
|
|
346
|
-
* BullMQ: maxStalledCount, PGBoss: not directly supported
|
|
347
|
-
*/
|
|
348
|
-
maxStalledCount?: number;
|
|
349
|
-
/**
|
|
350
|
-
* Delay in milliseconds before processing jobs after queue is drained.
|
|
351
|
-
* BullMQ: drainDelay, PGBoss: not directly supported
|
|
352
|
-
*/
|
|
353
|
-
drainDelayMs?: number;
|
|
354
|
-
/**
|
|
355
|
-
* Automatically run worker on startup.
|
|
356
|
-
* BullMQ: autorun, PGBoss: workers start automatically
|
|
357
|
-
*/
|
|
358
|
-
autorun?: boolean;
|
|
359
|
-
/**
|
|
360
|
-
* Polling interval in milliseconds for checking new jobs.
|
|
361
|
-
* PGBoss: newJobCheckInterval, BullMQ: uses blocking wait
|
|
362
|
-
*/
|
|
363
|
-
pollingIntervalMs?: number;
|
|
364
|
-
}
|
|
365
|
-
export interface QueueWorkerConfig {
|
|
366
|
-
queue?: QueueConfig;
|
|
367
|
-
flow?: FlowConfig;
|
|
368
|
-
worker?: WorkerConfig;
|
|
369
|
-
}
|
|
370
|
-
export type DefineFunctionConfig = <T extends QueueWorkerConfig>(cfg: T) => T;
|
|
371
|
-
export declare const defineFunctionConfig: DefineFunctionConfig;
|
|
372
|
-
/**
|
|
373
|
-
* Helper for defining trigger configurations inline
|
|
374
|
-
* This is just a type helper, actual value is the same as defineFunctionConfig
|
|
375
|
-
*/
|
|
376
|
-
export type DefineTriggerConfig = <T extends TriggerDefinition>(cfg: T) => T;
|
|
377
|
-
export declare const defineTriggerConfig: DefineTriggerConfig;
|
|
378
|
-
export default defineFunctionConfig;
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Type-safe hook definitions for await patterns
|
|
3
|
-
* v0.5 - Await Integration
|
|
4
|
-
*/
|
|
5
|
-
import type { RunContext } from '../../worker/node/runner.js';
|
|
6
|
-
export type AwaitType = 'webhook' | 'event' | 'schedule' | 'time';
|
|
7
|
-
/**
|
|
8
|
-
* Hook data types specific to each await type
|
|
9
|
-
*/
|
|
10
|
-
export interface WebhookHookData {
|
|
11
|
-
webhookUrl: string;
|
|
12
|
-
}
|
|
13
|
-
export interface EventHookData {
|
|
14
|
-
eventName: string;
|
|
15
|
-
}
|
|
16
|
-
export interface ScheduleHookData {
|
|
17
|
-
cronExpression: string;
|
|
18
|
-
nextOccurrence: Date;
|
|
19
|
-
}
|
|
20
|
-
export interface TimeHookData {
|
|
21
|
-
delayMs: number;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Conditional type to get the correct hook data based on await type
|
|
25
|
-
*/
|
|
26
|
-
export type HookDataForAwaitType<T extends AwaitType> = T extends 'webhook' ? WebhookHookData : T extends 'event' ? EventHookData : T extends 'schedule' ? ScheduleHookData : T extends 'time' ? TimeHookData : never;
|
|
27
|
-
export interface AwaitRegisterContext<T extends AwaitType = AwaitType> extends Pick<RunContext, 'flowId' | 'flowName' | 'stepName' | 'logger' | 'state'> {
|
|
28
|
-
awaitType: T;
|
|
29
|
-
awaitConfig: any;
|
|
30
|
-
position: 'before' | 'after';
|
|
31
|
-
}
|
|
32
|
-
export interface AwaitResolveContext<T extends AwaitType = AwaitType> extends Pick<RunContext, 'flowId' | 'flowName' | 'stepName' | 'logger' | 'state'> {
|
|
33
|
-
awaitType: T;
|
|
34
|
-
resolvedData: any;
|
|
35
|
-
position: 'before' | 'after';
|
|
36
|
-
}
|
|
37
|
-
export interface AwaitTimeoutContext<T extends AwaitType = AwaitType> extends Pick<RunContext, 'flowId' | 'flowName' | 'stepName' | 'logger' | 'state'> {
|
|
38
|
-
awaitType: T;
|
|
39
|
-
timeoutAction: 'fail' | 'continue' | 'retry';
|
|
40
|
-
position: 'before' | 'after';
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Define onAwaitRegister hook with proper types
|
|
44
|
-
* Called when an await pattern is registered (before handler execution or after completion)
|
|
45
|
-
*
|
|
46
|
-
* @example
|
|
47
|
-
* // Webhook example
|
|
48
|
-
* export const onAwaitRegister = defineAwaitRegisterHook(async (hookData, stepData, ctx) => {
|
|
49
|
-
* // hookData.webhookUrl is typed correctly for webhook awaits
|
|
50
|
-
* await sendEmail({
|
|
51
|
-
* to: stepData.reviewerEmail,
|
|
52
|
-
* subject: 'Approval Required',
|
|
53
|
-
* approveUrl: hookData.webhookUrl
|
|
54
|
-
* })
|
|
55
|
-
* })
|
|
56
|
-
*
|
|
57
|
-
* // Event example
|
|
58
|
-
* export const onAwaitRegister = defineAwaitRegisterHook(async (hookData, stepData, ctx) => {
|
|
59
|
-
* // hookData.eventName is available for event awaits
|
|
60
|
-
* console.log(`Waiting for event: ${hookData.eventName}`)
|
|
61
|
-
* })
|
|
62
|
-
*/
|
|
63
|
-
export declare function defineAwaitRegisterHook<T extends AwaitType = AwaitType>(hook: (hookData: HookDataForAwaitType<T>, stepData: any, ctx: AwaitRegisterContext<T>) => Promise<void>): (hookData: HookDataForAwaitType<T>, stepData: any, ctx: AwaitRegisterContext<T>) => Promise<void>;
|
|
64
|
-
/**
|
|
65
|
-
* Define onAwaitResolve hook with proper types
|
|
66
|
-
* Called when an await pattern is resolved (external trigger fired)
|
|
67
|
-
*
|
|
68
|
-
* @example
|
|
69
|
-
* export const onAwaitResolve = defineAwaitResolveHook(async (resolvedData, stepData, ctx) => {
|
|
70
|
-
* ctx.logger.log('info', 'Approval received', { approved: resolvedData.approved })
|
|
71
|
-
*
|
|
72
|
-
* // Update external system
|
|
73
|
-
* await updateTicketStatus(stepData.ticketId, resolvedData.approved ? 'approved' : 'rejected')
|
|
74
|
-
* })
|
|
75
|
-
*/
|
|
76
|
-
export declare function defineAwaitResolveHook<T extends AwaitType = AwaitType>(hook: (resolvedData: any, stepData: any, ctx: AwaitResolveContext<T>) => Promise<void>): (resolvedData: any, stepData: any, ctx: AwaitResolveContext<T>) => Promise<void>;
|
|
77
|
-
/**
|
|
78
|
-
* Define onAwaitTimeout hook with proper types
|
|
79
|
-
* Called when an await pattern times out (timeout exceeded without resolution)
|
|
80
|
-
*
|
|
81
|
-
* @example
|
|
82
|
-
* export const onAwaitTimeout = defineAwaitTimeoutHook(async (stepData, ctx) => {
|
|
83
|
-
* ctx.logger.log('warn', 'Approval request timed out', {
|
|
84
|
-
* action: ctx.timeoutAction
|
|
85
|
-
* })
|
|
86
|
-
*
|
|
87
|
-
* // Send timeout notification
|
|
88
|
-
* await sendEmail({
|
|
89
|
-
* to: stepData.reviewerEmail,
|
|
90
|
-
* subject: 'Approval Request Expired',
|
|
91
|
-
* message: 'The approval request was not completed in time'
|
|
92
|
-
* })
|
|
93
|
-
* })
|
|
94
|
-
*/
|
|
95
|
-
export declare function defineAwaitTimeoutHook<T extends AwaitType = AwaitType>(hook: (stepData: any, ctx: AwaitTimeoutContext<T>) => Promise<void>): (stepData: any, ctx: AwaitTimeoutContext<T>) => Promise<void>;
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Adapter Registration Utilities
|
|
3
|
-
*
|
|
4
|
-
* Used by external adapter modules to register their adapters with nvent
|
|
5
|
-
*/
|
|
6
|
-
import type { QueueAdapter } from '../../adapters/interfaces/queue.js';
|
|
7
|
-
import type { StreamAdapter } from '../../adapters/interfaces/stream.js';
|
|
8
|
-
import type { StoreAdapter } from '../../adapters/interfaces/store.js';
|
|
9
|
-
/**
|
|
10
|
-
* Register a queue adapter
|
|
11
|
-
*
|
|
12
|
-
* Called by external adapter modules (e.g., @nvent/adapter-queue-redis)
|
|
13
|
-
* to register their adapter implementation.
|
|
14
|
-
*
|
|
15
|
-
* @param name - Adapter name (e.g., 'redis', 'postgres', 'rabbitmq')
|
|
16
|
-
* @param adapter - QueueAdapter implementation
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* import { registerQueueAdapter } from '#imports'
|
|
20
|
-
* import { RedisQueueAdapter } from './adapter'
|
|
21
|
-
*
|
|
22
|
-
* const adapter = new RedisQueueAdapter({ connection })
|
|
23
|
-
* registerQueueAdapter('redis', adapter)
|
|
24
|
-
*/
|
|
25
|
-
export declare function registerQueueAdapter(name: string, adapter: QueueAdapter): void;
|
|
26
|
-
/**
|
|
27
|
-
* Register a stream adapter
|
|
28
|
-
*
|
|
29
|
-
* Called by external adapter modules (e.g., @nvent/adapter-stream-redis)
|
|
30
|
-
* to register their adapter implementation.
|
|
31
|
-
*
|
|
32
|
-
* @param name - Adapter name (e.g., 'redis', 'rabbitmq', 'kafka')
|
|
33
|
-
* @param adapter - StreamAdapter implementation
|
|
34
|
-
*
|
|
35
|
-
* @example
|
|
36
|
-
* import { registerStreamAdapter } from '#imports'
|
|
37
|
-
* import { RedisStreamAdapter } from './adapter'
|
|
38
|
-
*
|
|
39
|
-
* const adapter = new RedisStreamAdapter({ connection })
|
|
40
|
-
* registerStreamAdapter('redis', adapter)
|
|
41
|
-
*/
|
|
42
|
-
export declare function registerStreamAdapter(name: string, adapter: StreamAdapter): void;
|
|
43
|
-
/**
|
|
44
|
-
* Register a store adapter
|
|
45
|
-
*
|
|
46
|
-
* Called by external adapter modules (e.g., @nvent/adapter-store-redis)
|
|
47
|
-
* to register their adapter implementation.
|
|
48
|
-
*
|
|
49
|
-
* @param name - Adapter name (e.g., 'redis', 'postgres')
|
|
50
|
-
* @param adapter - StoreAdapter implementation
|
|
51
|
-
*
|
|
52
|
-
* @example
|
|
53
|
-
* import { registerStoreAdapter } from '#imports'
|
|
54
|
-
* import { RedisStoreAdapter } from './adapter'
|
|
55
|
-
*
|
|
56
|
-
* const adapter = new RedisStoreAdapter({ connection })
|
|
57
|
-
* registerStoreAdapter('redis', adapter)
|
|
58
|
-
*/
|
|
59
|
-
export declare function registerStoreAdapter(name: string, adapter: StoreAdapter): void;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { useAdapterRegistry } from "../../adapters/registry.js";
|
|
2
|
-
export function registerQueueAdapter(name, adapter) {
|
|
3
|
-
const registry = useAdapterRegistry();
|
|
4
|
-
registry.registerQueue(name, adapter);
|
|
5
|
-
}
|
|
6
|
-
export function registerStreamAdapter(name, adapter) {
|
|
7
|
-
const registry = useAdapterRegistry();
|
|
8
|
-
registry.registerStream(name, adapter);
|
|
9
|
-
}
|
|
10
|
-
export function registerStoreAdapter(name, adapter) {
|
|
11
|
-
const registry = useAdapterRegistry();
|
|
12
|
-
registry.registerStore(name, adapter);
|
|
13
|
-
}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import type { AwaitConfig } from '../../../registry/types.js';
|
|
2
|
-
import { registerAwaitPattern, resolveAwaitPattern, registerWebhookAwait, resolveWebhookAwait, registerEventAwait, resolveEventAwait, registerScheduleAwait, resolveScheduleAwait, registerTimeAwait, resolveTimeAwait } from './awaitPatterns/index.js';
|
|
3
|
-
/**
|
|
4
|
-
* Get default timeout values for await patterns from runtime config
|
|
5
|
-
* These are configurable via module options and used throughout the system
|
|
6
|
-
* Exported for use by await pattern implementations
|
|
7
|
-
*/
|
|
8
|
-
export declare function useAwaitDefaults(): {
|
|
9
|
-
webhookTimeout: any;
|
|
10
|
-
eventTimeout: any;
|
|
11
|
-
timeTimeout: any;
|
|
12
|
-
scheduleTimeout: any;
|
|
13
|
-
timeoutAction: any;
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* Await pattern composable
|
|
17
|
-
* Provides unified API for managing await patterns in flows
|
|
18
|
-
* Separate from useTrigger which handles entry triggers (manual, webhook, schedule, event)
|
|
19
|
-
*/
|
|
20
|
-
export declare function useAwait(): {
|
|
21
|
-
/**
|
|
22
|
-
* Register an await pattern based on config type
|
|
23
|
-
* Automatically routes to appropriate implementation
|
|
24
|
-
*/
|
|
25
|
-
register: typeof registerAwaitPattern;
|
|
26
|
-
/**
|
|
27
|
-
* Resolve an await pattern by type
|
|
28
|
-
*/
|
|
29
|
-
resolve: typeof resolveAwaitPattern;
|
|
30
|
-
/**
|
|
31
|
-
* Direct access to specific await pattern implementations
|
|
32
|
-
*/
|
|
33
|
-
webhook: {
|
|
34
|
-
register: typeof registerWebhookAwait;
|
|
35
|
-
resolve: typeof resolveWebhookAwait;
|
|
36
|
-
};
|
|
37
|
-
event: {
|
|
38
|
-
register: typeof registerEventAwait;
|
|
39
|
-
resolve: typeof resolveEventAwait;
|
|
40
|
-
};
|
|
41
|
-
schedule: {
|
|
42
|
-
register: typeof registerScheduleAwait;
|
|
43
|
-
resolve: typeof resolveScheduleAwait;
|
|
44
|
-
};
|
|
45
|
-
time: {
|
|
46
|
-
register: typeof registerTimeAwait;
|
|
47
|
-
resolve: typeof resolveTimeAwait;
|
|
48
|
-
};
|
|
49
|
-
/**
|
|
50
|
-
* Query methods for await state
|
|
51
|
-
*/
|
|
52
|
-
/**
|
|
53
|
-
* Get await state for a specific flow run and step
|
|
54
|
-
*/
|
|
55
|
-
getAwaitState(flowName: string, runId: string, stepName?: string): Promise<any>;
|
|
56
|
-
/**
|
|
57
|
-
* Check if a step is currently awaiting
|
|
58
|
-
*/
|
|
59
|
-
isAwaiting(flowName: string, runId: string, stepName: string): Promise<boolean>;
|
|
60
|
-
/**
|
|
61
|
-
* Get all active awaits across all flows
|
|
62
|
-
*/
|
|
63
|
-
getAllActiveAwaits(flowName?: string): Promise<{
|
|
64
|
-
flowName: string;
|
|
65
|
-
runId: string;
|
|
66
|
-
stepName: string;
|
|
67
|
-
awaitType: string;
|
|
68
|
-
position: "before" | "after";
|
|
69
|
-
registeredAt: string;
|
|
70
|
-
}[]>;
|
|
71
|
-
/**
|
|
72
|
-
* Get await history for a specific flow run from stream
|
|
73
|
-
*/
|
|
74
|
-
getAwaitHistory(runId: string, opts?: {
|
|
75
|
-
limit?: number;
|
|
76
|
-
stepName?: string;
|
|
77
|
-
}): Promise<any>;
|
|
78
|
-
/**
|
|
79
|
-
* Cancel/timeout an active await
|
|
80
|
-
*/
|
|
81
|
-
timeoutAwait(flowName: string, runId: string, stepName: string, reason?: string): Promise<void>;
|
|
82
|
-
};
|
|
83
|
-
export type { AwaitConfig };
|