nvent 1.0.0-alpha.1 → 1.0.0-alpha.11
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 +263 -2
- package/dist/module.json +1 -1
- package/dist/module.mjs +367 -70
- package/dist/runtime/app/composables/useFunctionCall.d.ts +1 -1
- package/dist/runtime/app/composables/useIii.d.ts +24 -0
- package/dist/runtime/app/composables/useIii.js +9 -0
- package/dist/runtime/app/composables/useIiiStream.d.ts +45 -0
- package/dist/runtime/app/composables/useIiiStream.js +109 -0
- package/dist/runtime/app/plugins/iii.client.d.ts +13 -0
- package/dist/runtime/app/plugins/iii.client.js +9 -0
- package/dist/runtime/nitro/plugins/01.iii-worker.js +50 -0
- package/dist/runtime/nitro/routes/browser-proxy.d.ts +13 -0
- package/dist/runtime/nitro/routes/browser-proxy.js +55 -0
- package/dist/runtime/nitro/routes/stream-proxy.d.ts +2 -2
- package/dist/runtime/nitro/routes/stream-proxy.js +2 -2
- package/dist/runtime/nitro/server.d.ts +14 -0
- package/dist/runtime/nitro/server.js +3 -0
- package/dist/runtime/nitro/utils/browserAuthToken.d.ts +10 -0
- package/dist/runtime/nitro/utils/browserAuthToken.js +32 -0
- package/dist/runtime/nitro/utils/defineFunction.d.ts +63 -258
- package/dist/runtime/nitro/utils/defineFunction.js +12 -221
- package/dist/runtime/nitro/utils/engine.d.ts +11 -0
- package/dist/runtime/nitro/utils/engine.js +79 -17
- package/dist/runtime/nitro/utils/useIii.d.ts +10 -11
- package/dist/runtime/nitro/utils/useIii.js +2 -3
- package/dist/runtime/nitro/utils/workers/node.d.ts +17 -10
- package/dist/runtime/nitro/utils/workers/node.js +25 -51
- package/dist/runtime/nitro/utils/workers/python.js +13 -12
- package/dist/runtime/python/nvent.py +288 -160
- package/dist/runtime/python/worker_runtime.py +141 -44
- package/dist/runtime/virtual.d.ts +35 -0
- package/dist/types.d.mts +2 -0
- package/package.json +12 -9
- package/dist/runtime/app/composables/useNventStream.d.ts +0 -23
- package/dist/runtime/app/composables/useNventStream.js +0 -58
package/dist/module.d.mts
CHANGED
|
@@ -1,4 +1,37 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
|
+
|
|
3
|
+
interface NventExtendedQueueDefinition {
|
|
4
|
+
/** Queue name used by TriggerAction.Enqueue({ queue }) */
|
|
5
|
+
name: string;
|
|
6
|
+
type?: 'standard' | 'fifo';
|
|
7
|
+
concurrency?: number;
|
|
8
|
+
/** Alias of maxRetries */
|
|
9
|
+
retries?: number;
|
|
10
|
+
maxRetries?: number;
|
|
11
|
+
/** Alias of backoffMs */
|
|
12
|
+
backoff?: number;
|
|
13
|
+
backoffMs?: number;
|
|
14
|
+
/** Optional visibility timeout / lease timeout if supported by the engine */
|
|
15
|
+
visibilityTimeoutMs?: number;
|
|
16
|
+
leaseTimeoutMs?: number;
|
|
17
|
+
/** Optional dead-letter / fallback queue names if supported by the engine */
|
|
18
|
+
deadLetterQueue?: string;
|
|
19
|
+
fallbackQueue?: string;
|
|
20
|
+
messageGroupField?: string;
|
|
21
|
+
}
|
|
22
|
+
type NventQueueConfig = {
|
|
23
|
+
type?: 'standard' | 'fifo';
|
|
24
|
+
concurrency?: number;
|
|
25
|
+
retries?: number;
|
|
26
|
+
maxRetries?: number;
|
|
27
|
+
backoff?: number;
|
|
28
|
+
backoffMs?: number;
|
|
29
|
+
visibilityTimeoutMs?: number;
|
|
30
|
+
leaseTimeoutMs?: number;
|
|
31
|
+
deadLetterQueue?: string;
|
|
32
|
+
fallbackQueue?: string;
|
|
33
|
+
messageGroupField?: string;
|
|
34
|
+
};
|
|
2
35
|
|
|
3
36
|
/**
|
|
4
37
|
* nvent module options
|
|
@@ -38,9 +71,13 @@ interface NventIiiOptions {
|
|
|
38
71
|
type: 'kv';
|
|
39
72
|
storeMethod?: 'file_based' | 'in_memory';
|
|
40
73
|
filePath?: string;
|
|
74
|
+
saveIntervalMs?: number;
|
|
41
75
|
} | {
|
|
42
76
|
type: 'redis';
|
|
43
77
|
redisUrl?: string;
|
|
78
|
+
} | {
|
|
79
|
+
type: 'bridge';
|
|
80
|
+
bridgeUrl: string;
|
|
44
81
|
};
|
|
45
82
|
};
|
|
46
83
|
/**
|
|
@@ -52,18 +89,42 @@ interface NventIiiOptions {
|
|
|
52
89
|
type: 'builtin';
|
|
53
90
|
storeMethod?: 'file_based' | 'in_memory';
|
|
54
91
|
filePath?: string;
|
|
92
|
+
saveIntervalMs?: number;
|
|
93
|
+
maxAttempts?: number;
|
|
94
|
+
backoffMs?: number;
|
|
95
|
+
concurrency?: number;
|
|
96
|
+
pollIntervalMs?: number;
|
|
97
|
+
/** Processing order. 'concurrent' (parallel) or 'fifo' (sequential). Default: 'concurrent' */
|
|
98
|
+
mode?: 'concurrent' | 'fifo';
|
|
55
99
|
} | {
|
|
56
100
|
type: 'redis';
|
|
57
101
|
redisUrl?: string;
|
|
58
102
|
} | {
|
|
59
103
|
type: 'rabbitmq';
|
|
60
104
|
amqpUrl?: string;
|
|
105
|
+
maxAttempts?: number;
|
|
106
|
+
prefetchCount?: number;
|
|
107
|
+
/** 'standard' or 'quorum' (HA replicated). Default: 'standard' */
|
|
108
|
+
queueMode?: 'standard' | 'quorum';
|
|
109
|
+
} | {
|
|
110
|
+
type: 'bridge';
|
|
111
|
+
bridgeUrl: string;
|
|
61
112
|
};
|
|
62
113
|
queueConfigs?: Record<string, {
|
|
63
114
|
type?: 'standard' | 'fifo';
|
|
64
115
|
concurrency?: number;
|
|
116
|
+
/** Alias of maxRetries */
|
|
117
|
+
retries?: number;
|
|
65
118
|
maxRetries?: number;
|
|
119
|
+
/** Alias of backoffMs */
|
|
120
|
+
backoff?: number;
|
|
66
121
|
backoffMs?: number;
|
|
122
|
+
/** Optional visibility timeout / lease timeout if supported by the engine */
|
|
123
|
+
visibilityTimeoutMs?: number;
|
|
124
|
+
leaseTimeoutMs?: number;
|
|
125
|
+
/** Optional dead-letter / fallback queue names if supported by the engine */
|
|
126
|
+
deadLetterQueue?: string;
|
|
127
|
+
fallbackQueue?: string;
|
|
67
128
|
/** FIFO only: field in the payload used to group messages */
|
|
68
129
|
messageGroupField?: string;
|
|
69
130
|
}>;
|
|
@@ -72,6 +133,11 @@ interface NventIiiOptions {
|
|
|
72
133
|
cron?: {
|
|
73
134
|
adapter?: {
|
|
74
135
|
type: 'kv';
|
|
136
|
+
lockTtlMs?: number;
|
|
137
|
+
lockIndex?: string;
|
|
138
|
+
storeMethod?: 'file_based' | 'in_memory';
|
|
139
|
+
filePath?: string;
|
|
140
|
+
saveIntervalMs?: number;
|
|
75
141
|
} | {
|
|
76
142
|
type: 'redis';
|
|
77
143
|
redisUrl?: string;
|
|
@@ -85,9 +151,13 @@ interface NventIiiOptions {
|
|
|
85
151
|
type: 'kv';
|
|
86
152
|
storeMethod?: 'file_based' | 'in_memory';
|
|
87
153
|
filePath?: string;
|
|
154
|
+
saveIntervalMs?: number;
|
|
88
155
|
} | {
|
|
89
156
|
type: 'redis';
|
|
90
157
|
redisUrl?: string;
|
|
158
|
+
} | {
|
|
159
|
+
type: 'bridge';
|
|
160
|
+
bridgeUrl: string;
|
|
91
161
|
};
|
|
92
162
|
};
|
|
93
163
|
/** REST API module extra settings */
|
|
@@ -95,6 +165,13 @@ interface NventIiiOptions {
|
|
|
95
165
|
host?: string;
|
|
96
166
|
defaultTimeout?: number;
|
|
97
167
|
concurrencyRequestLimit?: number;
|
|
168
|
+
/** CORS configuration for browser clients */
|
|
169
|
+
cors?: {
|
|
170
|
+
/** Origins allowed to make requests. Use '*' for any, or list specific domains. */
|
|
171
|
+
allowedOrigins?: string[];
|
|
172
|
+
/** HTTP methods permitted for cross-origin requests. */
|
|
173
|
+
allowedMethods?: string[];
|
|
174
|
+
};
|
|
98
175
|
};
|
|
99
176
|
/** OtelModule (observability) configuration */
|
|
100
177
|
observability?: {
|
|
@@ -124,6 +201,36 @@ interface NventIiiOptions {
|
|
|
124
201
|
logsFlushIntervalMs?: number;
|
|
125
202
|
logsSamplingRatio?: number;
|
|
126
203
|
logsConsoleOutput?: boolean;
|
|
204
|
+
/** Advanced sampling rules — override samplingRatio for matched operations. */
|
|
205
|
+
sampling?: {
|
|
206
|
+
default?: number;
|
|
207
|
+
parentBased?: boolean;
|
|
208
|
+
rules?: Array<{
|
|
209
|
+
operation?: string;
|
|
210
|
+
service?: string;
|
|
211
|
+
rate: number;
|
|
212
|
+
}>;
|
|
213
|
+
rateLimit?: {
|
|
214
|
+
maxTracesPerSecond?: number;
|
|
215
|
+
};
|
|
216
|
+
};
|
|
217
|
+
/** Alert rules — trigger a webhook or function when a metric crosses a threshold. */
|
|
218
|
+
alerts?: Array<{
|
|
219
|
+
name: string;
|
|
220
|
+
metric: string;
|
|
221
|
+
threshold: number;
|
|
222
|
+
operator: '>' | '>=' | '<' | '<=' | '==' | '!=';
|
|
223
|
+
windowSeconds: number;
|
|
224
|
+
enabled?: boolean;
|
|
225
|
+
cooldownSeconds?: number;
|
|
226
|
+
action: {
|
|
227
|
+
type: 'webhook';
|
|
228
|
+
url: string;
|
|
229
|
+
} | {
|
|
230
|
+
type: 'function';
|
|
231
|
+
path: string;
|
|
232
|
+
};
|
|
233
|
+
}>;
|
|
127
234
|
level?: 'trace' | 'debug' | 'info' | 'warn' | 'error';
|
|
128
235
|
format?: 'default' | 'json';
|
|
129
236
|
};
|
|
@@ -147,10 +254,104 @@ interface NventIiiOptions {
|
|
|
147
254
|
/** Enable the Flow visualization page */
|
|
148
255
|
flow?: boolean;
|
|
149
256
|
};
|
|
257
|
+
/** PubSub worker — topic-based event fanout across functions. */
|
|
258
|
+
pubsub?: {
|
|
259
|
+
adapter?: {
|
|
260
|
+
type: 'local';
|
|
261
|
+
} | {
|
|
262
|
+
type: 'redis';
|
|
263
|
+
redisUrl?: string;
|
|
264
|
+
};
|
|
265
|
+
};
|
|
266
|
+
/**
|
|
267
|
+
* HTTP Functions worker — enables outbound HTTP calls from the engine.
|
|
268
|
+
* Required for functions registered with HttpInvocationConfig.
|
|
269
|
+
*/
|
|
270
|
+
httpFunctions?: {
|
|
271
|
+
security?: {
|
|
272
|
+
/** URL patterns allowed for outbound requests. Use '*' to allow all. */
|
|
273
|
+
urlAllowlist?: string[];
|
|
274
|
+
/** Block requests to private/internal IP ranges (SSRF prevention). Default: true */
|
|
275
|
+
blockPrivateIps?: boolean;
|
|
276
|
+
/** Require HTTPS for all outbound requests. Default: true */
|
|
277
|
+
requireHttps?: boolean;
|
|
278
|
+
};
|
|
279
|
+
};
|
|
280
|
+
/**
|
|
281
|
+
* Additional iii-worker-manager instance with RBAC.
|
|
282
|
+
* nvent uses this automatically when browser SDK is enabled.
|
|
283
|
+
* Can also be configured manually for custom auth scenarios.
|
|
284
|
+
*/
|
|
285
|
+
workerManager?: {
|
|
286
|
+
rbac?: {
|
|
287
|
+
/** Port for the RBAC worker manager. Default: 49135 */
|
|
288
|
+
port?: number;
|
|
289
|
+
/** Function ID called on every WebSocket upgrade for auth. */
|
|
290
|
+
authFunctionId?: string;
|
|
291
|
+
/** Functions the connecting worker is allowed to invoke (patterns supported). */
|
|
292
|
+
exposeFunctions?: string[];
|
|
293
|
+
/** Function invoked before each handler — enrich or audit requests. */
|
|
294
|
+
middlewareFunctionId?: string;
|
|
295
|
+
/** Allow workers to register their own function handlers. Default: true */
|
|
296
|
+
allowFunctionRegistration?: boolean;
|
|
297
|
+
/** Allow workers to register new trigger types. Default: false */
|
|
298
|
+
allowTriggerTypeRegistration?: boolean;
|
|
299
|
+
/** Prefix prepended to every function the worker registers. */
|
|
300
|
+
functionRegistrationPrefix?: string;
|
|
301
|
+
/** TTL for signed browser auth tokens generated by the Nuxt proxy. Default: 120 */
|
|
302
|
+
tokenTtlSeconds?: number;
|
|
303
|
+
/** Allow browser connections without a custom resolver returning user context. Default: true */
|
|
304
|
+
allowAnonymous?: boolean;
|
|
305
|
+
/** Optional path (relative to project root) to a custom browser auth resolver module. */
|
|
306
|
+
authResolverPath?: string;
|
|
307
|
+
};
|
|
308
|
+
};
|
|
309
|
+
/**
|
|
310
|
+
* Bridge client workers — connects this engine to remote iii instances.
|
|
311
|
+
* Each entry creates an `iii-bridge` worker in the config.
|
|
312
|
+
*/
|
|
313
|
+
bridge?: Array<{
|
|
314
|
+
url: string;
|
|
315
|
+
serviceId: string;
|
|
316
|
+
serviceName?: string;
|
|
317
|
+
expose?: Array<{
|
|
318
|
+
localFunction: string;
|
|
319
|
+
remoteFunction?: string;
|
|
320
|
+
}>;
|
|
321
|
+
forward?: Array<{
|
|
322
|
+
localFunction: string;
|
|
323
|
+
remoteFunction: string;
|
|
324
|
+
timeoutMs?: number;
|
|
325
|
+
}>;
|
|
326
|
+
}>;
|
|
327
|
+
/**
|
|
328
|
+
* Exec workers — spawns external processes alongside the engine.
|
|
329
|
+
* Each entry creates an `iii-exec` worker in the config.
|
|
330
|
+
*/
|
|
331
|
+
exec?: Array<{
|
|
332
|
+
watch?: string[];
|
|
333
|
+
exec: string[];
|
|
334
|
+
}>;
|
|
335
|
+
/** Anonymous usage telemetry. Set enabled: false to opt out. */
|
|
336
|
+
telemetry?: {
|
|
337
|
+
enabled?: boolean;
|
|
338
|
+
apiKey?: string;
|
|
339
|
+
sdkApiKey?: string;
|
|
340
|
+
heartbeatIntervalSecs?: number;
|
|
341
|
+
};
|
|
150
342
|
};
|
|
151
343
|
functions?: {
|
|
152
344
|
/** Directory under server/ where functions are, relative to serverDir (default: 'functions') */
|
|
153
345
|
dir?: string;
|
|
346
|
+
/**
|
|
347
|
+
* Function ID prefix for this layer's functions.
|
|
348
|
+
* Set in a layer's `nuxt.config.ts` to namespace its functions.
|
|
349
|
+
* Priority: this value → `$meta.name` → package.json name → directory name.
|
|
350
|
+
* Set to `''` (empty string) to explicitly opt out of any prefix.
|
|
351
|
+
* Has no effect in the root project (always un-prefixed).
|
|
352
|
+
* Example: 'myorg::auth'
|
|
353
|
+
*/
|
|
354
|
+
prefix?: string;
|
|
154
355
|
python?: {
|
|
155
356
|
/**
|
|
156
357
|
* Path to the Python executable used **in development only** (e.g. a virtualenv).
|
|
@@ -180,6 +381,66 @@ interface NventIiiOptions {
|
|
|
180
381
|
};
|
|
181
382
|
}
|
|
182
383
|
|
|
183
|
-
|
|
384
|
+
interface LayerInfo {
|
|
385
|
+
rootDir: string;
|
|
386
|
+
serverDir: string;
|
|
387
|
+
/**
|
|
388
|
+
* Prefix prepended to every function ID discovered in this layer.
|
|
389
|
+
* Empty string (or undefined) means no prefix — root project convention.
|
|
390
|
+
* e.g. 'auth' → 'login.ts' becomes 'auth::login'
|
|
391
|
+
*/
|
|
392
|
+
prefix?: string;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
interface NventExtendedFunction {
|
|
396
|
+
/** iii function ID (e.g. `fhir::terminology::lookup`) */
|
|
397
|
+
id: string;
|
|
398
|
+
/** Absolute file path, or root-relative path, to a TS/JS function module */
|
|
399
|
+
absPath: string;
|
|
400
|
+
/** Optional human-readable description */
|
|
401
|
+
description?: string;
|
|
402
|
+
}
|
|
403
|
+
interface NventExtendedPythonFunction {
|
|
404
|
+
/** iii function ID (e.g. `fhir::terminology::expand`) */
|
|
405
|
+
id: string;
|
|
406
|
+
/** Absolute file path, or root-relative path, to a .py file */
|
|
407
|
+
absPath: string;
|
|
408
|
+
/** When true, start this function in a dedicated worker process */
|
|
409
|
+
standalone?: boolean;
|
|
410
|
+
}
|
|
411
|
+
interface NventExtendFunctionsHookPayload {
|
|
412
|
+
/** Push extra TS/JS function files to register */
|
|
413
|
+
functions: NventExtendedFunction[];
|
|
414
|
+
/** Push extra Python function files to register */
|
|
415
|
+
pythonFunctions: NventExtendedPythonFunction[];
|
|
416
|
+
/** Nuxt project root */
|
|
417
|
+
rootDir: string;
|
|
418
|
+
/** Layer scan context (same as nvent internal scan) */
|
|
419
|
+
layerInfos: LayerInfo[];
|
|
420
|
+
/** Configured functions dir relative to each layer's server dir */
|
|
421
|
+
functionsDir: string;
|
|
422
|
+
}
|
|
423
|
+
interface NventExtendQueuesHookPayload {
|
|
424
|
+
/** Push extra named queues to register in iii engine config. */
|
|
425
|
+
queues: NventExtendedQueueDefinition[];
|
|
426
|
+
/** Nuxt project root */
|
|
427
|
+
rootDir: string;
|
|
428
|
+
}
|
|
429
|
+
declare module '@nuxt/schema' {
|
|
430
|
+
interface NuxtHooks {
|
|
431
|
+
/**
|
|
432
|
+
* Extend nvent function discovery with additional TS/JS or Python function files.
|
|
433
|
+
* Useful for Nuxt modules that ship their own iii handlers.
|
|
434
|
+
*/
|
|
435
|
+
'nvent:functions:extend': (payload: NventExtendFunctionsHookPayload) => void | Promise<void>;
|
|
436
|
+
/**
|
|
437
|
+
* Extend iii named queue definitions so module-owned workflows can enqueue safely.
|
|
438
|
+
* Duplicate policy: first queue definition wins; later duplicates are ignored with a warning.
|
|
439
|
+
*/
|
|
440
|
+
'nvent:queues:extend': (payload: NventExtendQueuesHookPayload) => void | Promise<void>;
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
declare const _default: _nuxt_schema.NuxtModule<NventIiiOptions, NventIiiOptions, false>;
|
|
184
444
|
|
|
185
445
|
export { _default as default };
|
|
446
|
+
export type { NventExtendFunctionsHookPayload, NventExtendQueuesHookPayload, NventExtendedFunction, NventExtendedPythonFunction, NventExtendedQueueDefinition, NventQueueConfig };
|