nvent 1.0.0-alpha.1 → 1.0.0-alpha.4
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 +158 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +210 -57
- 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 +22 -0
- package/dist/runtime/app/composables/{useNventStream.js → useIiiStream.js} +4 -9
- 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 +1 -1
- package/dist/runtime/nitro/routes/stream-proxy.js +1 -1
- 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/package.json +9 -8
- package/dist/runtime/app/composables/useNventStream.d.ts +0 -23
package/dist/module.d.mts
CHANGED
|
@@ -38,9 +38,13 @@ interface NventIiiOptions {
|
|
|
38
38
|
type: 'kv';
|
|
39
39
|
storeMethod?: 'file_based' | 'in_memory';
|
|
40
40
|
filePath?: string;
|
|
41
|
+
saveIntervalMs?: number;
|
|
41
42
|
} | {
|
|
42
43
|
type: 'redis';
|
|
43
44
|
redisUrl?: string;
|
|
45
|
+
} | {
|
|
46
|
+
type: 'bridge';
|
|
47
|
+
bridgeUrl: string;
|
|
44
48
|
};
|
|
45
49
|
};
|
|
46
50
|
/**
|
|
@@ -52,12 +56,26 @@ interface NventIiiOptions {
|
|
|
52
56
|
type: 'builtin';
|
|
53
57
|
storeMethod?: 'file_based' | 'in_memory';
|
|
54
58
|
filePath?: string;
|
|
59
|
+
saveIntervalMs?: number;
|
|
60
|
+
maxAttempts?: number;
|
|
61
|
+
backoffMs?: number;
|
|
62
|
+
concurrency?: number;
|
|
63
|
+
pollIntervalMs?: number;
|
|
64
|
+
/** Processing order. 'concurrent' (parallel) or 'fifo' (sequential). Default: 'concurrent' */
|
|
65
|
+
mode?: 'concurrent' | 'fifo';
|
|
55
66
|
} | {
|
|
56
67
|
type: 'redis';
|
|
57
68
|
redisUrl?: string;
|
|
58
69
|
} | {
|
|
59
70
|
type: 'rabbitmq';
|
|
60
71
|
amqpUrl?: string;
|
|
72
|
+
maxAttempts?: number;
|
|
73
|
+
prefetchCount?: number;
|
|
74
|
+
/** 'standard' or 'quorum' (HA replicated). Default: 'standard' */
|
|
75
|
+
queueMode?: 'standard' | 'quorum';
|
|
76
|
+
} | {
|
|
77
|
+
type: 'bridge';
|
|
78
|
+
bridgeUrl: string;
|
|
61
79
|
};
|
|
62
80
|
queueConfigs?: Record<string, {
|
|
63
81
|
type?: 'standard' | 'fifo';
|
|
@@ -72,6 +90,11 @@ interface NventIiiOptions {
|
|
|
72
90
|
cron?: {
|
|
73
91
|
adapter?: {
|
|
74
92
|
type: 'kv';
|
|
93
|
+
lockTtlMs?: number;
|
|
94
|
+
lockIndex?: string;
|
|
95
|
+
storeMethod?: 'file_based' | 'in_memory';
|
|
96
|
+
filePath?: string;
|
|
97
|
+
saveIntervalMs?: number;
|
|
75
98
|
} | {
|
|
76
99
|
type: 'redis';
|
|
77
100
|
redisUrl?: string;
|
|
@@ -85,9 +108,13 @@ interface NventIiiOptions {
|
|
|
85
108
|
type: 'kv';
|
|
86
109
|
storeMethod?: 'file_based' | 'in_memory';
|
|
87
110
|
filePath?: string;
|
|
111
|
+
saveIntervalMs?: number;
|
|
88
112
|
} | {
|
|
89
113
|
type: 'redis';
|
|
90
114
|
redisUrl?: string;
|
|
115
|
+
} | {
|
|
116
|
+
type: 'bridge';
|
|
117
|
+
bridgeUrl: string;
|
|
91
118
|
};
|
|
92
119
|
};
|
|
93
120
|
/** REST API module extra settings */
|
|
@@ -95,6 +122,13 @@ interface NventIiiOptions {
|
|
|
95
122
|
host?: string;
|
|
96
123
|
defaultTimeout?: number;
|
|
97
124
|
concurrencyRequestLimit?: number;
|
|
125
|
+
/** CORS configuration for browser clients */
|
|
126
|
+
cors?: {
|
|
127
|
+
/** Origins allowed to make requests. Use '*' for any, or list specific domains. */
|
|
128
|
+
allowedOrigins?: string[];
|
|
129
|
+
/** HTTP methods permitted for cross-origin requests. */
|
|
130
|
+
allowedMethods?: string[];
|
|
131
|
+
};
|
|
98
132
|
};
|
|
99
133
|
/** OtelModule (observability) configuration */
|
|
100
134
|
observability?: {
|
|
@@ -124,6 +158,36 @@ interface NventIiiOptions {
|
|
|
124
158
|
logsFlushIntervalMs?: number;
|
|
125
159
|
logsSamplingRatio?: number;
|
|
126
160
|
logsConsoleOutput?: boolean;
|
|
161
|
+
/** Advanced sampling rules — override samplingRatio for matched operations. */
|
|
162
|
+
sampling?: {
|
|
163
|
+
default?: number;
|
|
164
|
+
parentBased?: boolean;
|
|
165
|
+
rules?: Array<{
|
|
166
|
+
operation?: string;
|
|
167
|
+
service?: string;
|
|
168
|
+
rate: number;
|
|
169
|
+
}>;
|
|
170
|
+
rateLimit?: {
|
|
171
|
+
maxTracesPerSecond?: number;
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
/** Alert rules — trigger a webhook or function when a metric crosses a threshold. */
|
|
175
|
+
alerts?: Array<{
|
|
176
|
+
name: string;
|
|
177
|
+
metric: string;
|
|
178
|
+
threshold: number;
|
|
179
|
+
operator: '>' | '>=' | '<' | '<=' | '==' | '!=';
|
|
180
|
+
windowSeconds: number;
|
|
181
|
+
enabled?: boolean;
|
|
182
|
+
cooldownSeconds?: number;
|
|
183
|
+
action: {
|
|
184
|
+
type: 'webhook';
|
|
185
|
+
url: string;
|
|
186
|
+
} | {
|
|
187
|
+
type: 'function';
|
|
188
|
+
path: string;
|
|
189
|
+
};
|
|
190
|
+
}>;
|
|
127
191
|
level?: 'trace' | 'debug' | 'info' | 'warn' | 'error';
|
|
128
192
|
format?: 'default' | 'json';
|
|
129
193
|
};
|
|
@@ -147,10 +211,104 @@ interface NventIiiOptions {
|
|
|
147
211
|
/** Enable the Flow visualization page */
|
|
148
212
|
flow?: boolean;
|
|
149
213
|
};
|
|
214
|
+
/** PubSub worker — topic-based event fanout across functions. */
|
|
215
|
+
pubsub?: {
|
|
216
|
+
adapter?: {
|
|
217
|
+
type: 'local';
|
|
218
|
+
} | {
|
|
219
|
+
type: 'redis';
|
|
220
|
+
redisUrl?: string;
|
|
221
|
+
};
|
|
222
|
+
};
|
|
223
|
+
/**
|
|
224
|
+
* HTTP Functions worker — enables outbound HTTP calls from the engine.
|
|
225
|
+
* Required for functions registered with HttpInvocationConfig.
|
|
226
|
+
*/
|
|
227
|
+
httpFunctions?: {
|
|
228
|
+
security?: {
|
|
229
|
+
/** URL patterns allowed for outbound requests. Use '*' to allow all. */
|
|
230
|
+
urlAllowlist?: string[];
|
|
231
|
+
/** Block requests to private/internal IP ranges (SSRF prevention). Default: true */
|
|
232
|
+
blockPrivateIps?: boolean;
|
|
233
|
+
/** Require HTTPS for all outbound requests. Default: true */
|
|
234
|
+
requireHttps?: boolean;
|
|
235
|
+
};
|
|
236
|
+
};
|
|
237
|
+
/**
|
|
238
|
+
* Additional iii-worker-manager instance with RBAC.
|
|
239
|
+
* nvent uses this automatically when browser SDK is enabled.
|
|
240
|
+
* Can also be configured manually for custom auth scenarios.
|
|
241
|
+
*/
|
|
242
|
+
workerManager?: {
|
|
243
|
+
rbac?: {
|
|
244
|
+
/** Port for the RBAC worker manager. Default: 49135 */
|
|
245
|
+
port?: number;
|
|
246
|
+
/** Function ID called on every WebSocket upgrade for auth. */
|
|
247
|
+
authFunctionId?: string;
|
|
248
|
+
/** Functions the connecting worker is allowed to invoke (patterns supported). */
|
|
249
|
+
exposeFunctions?: string[];
|
|
250
|
+
/** Function invoked before each handler — enrich or audit requests. */
|
|
251
|
+
middlewareFunctionId?: string;
|
|
252
|
+
/** Allow workers to register their own function handlers. Default: true */
|
|
253
|
+
allowFunctionRegistration?: boolean;
|
|
254
|
+
/** Allow workers to register new trigger types. Default: false */
|
|
255
|
+
allowTriggerTypeRegistration?: boolean;
|
|
256
|
+
/** Prefix prepended to every function the worker registers. */
|
|
257
|
+
functionRegistrationPrefix?: string;
|
|
258
|
+
/** TTL for signed browser auth tokens generated by the Nuxt proxy. Default: 120 */
|
|
259
|
+
tokenTtlSeconds?: number;
|
|
260
|
+
/** Allow browser connections without a custom resolver returning user context. Default: true */
|
|
261
|
+
allowAnonymous?: boolean;
|
|
262
|
+
/** Optional path (relative to project root) to a custom browser auth resolver module. */
|
|
263
|
+
authResolverPath?: string;
|
|
264
|
+
};
|
|
265
|
+
};
|
|
266
|
+
/**
|
|
267
|
+
* Bridge client workers — connects this engine to remote iii instances.
|
|
268
|
+
* Each entry creates an `iii-bridge` worker in the config.
|
|
269
|
+
*/
|
|
270
|
+
bridge?: Array<{
|
|
271
|
+
url: string;
|
|
272
|
+
serviceId: string;
|
|
273
|
+
serviceName?: string;
|
|
274
|
+
expose?: Array<{
|
|
275
|
+
localFunction: string;
|
|
276
|
+
remoteFunction?: string;
|
|
277
|
+
}>;
|
|
278
|
+
forward?: Array<{
|
|
279
|
+
localFunction: string;
|
|
280
|
+
remoteFunction: string;
|
|
281
|
+
timeoutMs?: number;
|
|
282
|
+
}>;
|
|
283
|
+
}>;
|
|
284
|
+
/**
|
|
285
|
+
* Exec workers — spawns external processes alongside the engine.
|
|
286
|
+
* Each entry creates an `iii-exec` worker in the config.
|
|
287
|
+
*/
|
|
288
|
+
exec?: Array<{
|
|
289
|
+
watch?: string[];
|
|
290
|
+
exec: string[];
|
|
291
|
+
}>;
|
|
292
|
+
/** Anonymous usage telemetry. Set enabled: false to opt out. */
|
|
293
|
+
telemetry?: {
|
|
294
|
+
enabled?: boolean;
|
|
295
|
+
apiKey?: string;
|
|
296
|
+
sdkApiKey?: string;
|
|
297
|
+
heartbeatIntervalSecs?: number;
|
|
298
|
+
};
|
|
150
299
|
};
|
|
151
300
|
functions?: {
|
|
152
301
|
/** Directory under server/ where functions are, relative to serverDir (default: 'functions') */
|
|
153
302
|
dir?: string;
|
|
303
|
+
/**
|
|
304
|
+
* Function ID prefix for this layer's functions.
|
|
305
|
+
* Set in a layer's `nuxt.config.ts` to namespace its functions.
|
|
306
|
+
* Priority: this value → `$meta.name` → package.json name → directory name.
|
|
307
|
+
* Set to `''` (empty string) to explicitly opt out of any prefix.
|
|
308
|
+
* Has no effect in the root project (always un-prefixed).
|
|
309
|
+
* Example: 'myorg::auth'
|
|
310
|
+
*/
|
|
311
|
+
prefix?: string;
|
|
154
312
|
python?: {
|
|
155
313
|
/**
|
|
156
314
|
* Path to the Python executable used **in development only** (e.g. a virtualenv).
|