@morojs/engine 1.1.7 → 1.1.9
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/index.d.ts +40 -0
- package/index.js +3 -0
- package/index.mjs +3 -0
- package/package.json +8 -8
package/index.d.ts
CHANGED
|
@@ -25,8 +25,14 @@ export interface EngineCapabilities {
|
|
|
25
25
|
/** Explicit TLS cipher/group policy is parsed:
|
|
26
26
|
* ServeOptions.ssl.ciphers, ciphersuites, and ecdhCurve. */
|
|
27
27
|
tlsPolicy: boolean;
|
|
28
|
+
/** updateSsl() is available: the certificate/key (and policy) of a TLS
|
|
29
|
+
* server can be replaced for new handshakes without a restart. */
|
|
30
|
+
tlsReload: boolean;
|
|
28
31
|
/** setStaticRoute() / clearStaticRoutes() are available. */
|
|
29
32
|
staticRoutes: boolean;
|
|
33
|
+
/** setParamRoute() / clearParamRoutes() are available: a route with one
|
|
34
|
+
* variable path segment, echoed as the body, answered inside the engine. */
|
|
35
|
+
paramRoutes: boolean;
|
|
30
36
|
/** prepareResponse() / releaseTemplates() / respondPrepared() /
|
|
31
37
|
* respondPreparedEmpty() / writeHeadPrepared() / endWith() are available. */
|
|
32
38
|
responseTemplates: boolean;
|
|
@@ -283,6 +289,14 @@ export function close(serverId: number): void;
|
|
|
283
289
|
/** Stop accepting new connections while existing ones keep being served —
|
|
284
290
|
* the drain phase of a graceful shutdown. Idempotent. */
|
|
285
291
|
export function stopListening(serverId: number): void;
|
|
292
|
+
/** Replace the TLS certificate/key (and cipher policy) used for every
|
|
293
|
+
* handshake from now on, without restarting the listener (feature-detect via
|
|
294
|
+
* probe().capabilities.tlsReload). `ssl` is the full ServeOptions.ssl shape,
|
|
295
|
+
* not a diff; ticketKeys carry over when omitted so session resumption
|
|
296
|
+
* survives a rotation. Established connections keep the context they
|
|
297
|
+
* handshaked with. Throws (leaving the current context in place) on invalid
|
|
298
|
+
* material, and for a server that was not started with ssl. */
|
|
299
|
+
export function updateSsl(serverId: number, ssl: NonNullable<ServeOptions['ssl']>): void;
|
|
286
300
|
|
|
287
301
|
// ---- per-request accessors (valid until the response ends / aborts) ----
|
|
288
302
|
export function getMethod(reqId: number): string | undefined;
|
|
@@ -344,6 +358,29 @@ export function setStaticRoute(
|
|
|
344
358
|
/** Drop every static route registered on this server. */
|
|
345
359
|
export function clearStaticRoutes(serverId: number): void;
|
|
346
360
|
|
|
361
|
+
// ---- Parameter routes ----
|
|
362
|
+
/** Register a route with ONE variable path segment whose body IS that
|
|
363
|
+
* segment, answered entirely inside the engine like a static route:
|
|
364
|
+
* `/user/:id` is prefix "/user/" and suffix ""; `/files/:name.json` is
|
|
365
|
+
* prefix "/files/" and suffix ".json". The segment must be non-empty and
|
|
366
|
+
* contain no '/', so `/user/` and `/user/1/2` still reach onRequest. It is
|
|
367
|
+
* written as it is on the wire, undecoded (uWS's writeParameterValue does
|
|
368
|
+
* the same); a route that needs decoding stays a JS route. The header block
|
|
369
|
+
* is materialised once, so the reply is byte-identical to
|
|
370
|
+
* respond(status, headersFlat, segment). Only an exact method match
|
|
371
|
+
* short-circuits; re-registering (method, prefix, suffix) replaces it.
|
|
372
|
+
* Feature-detect via probe().capabilities.paramRoutes. */
|
|
373
|
+
export function setParamRoute(
|
|
374
|
+
serverId: number,
|
|
375
|
+
method: number,
|
|
376
|
+
prefix: string,
|
|
377
|
+
suffix: string,
|
|
378
|
+
status?: number,
|
|
379
|
+
headersFlat?: string[] | null
|
|
380
|
+
): void;
|
|
381
|
+
/** Drop every parameter route registered on this server. */
|
|
382
|
+
export function clearParamRoutes(serverId: number): void;
|
|
383
|
+
|
|
347
384
|
// ---- Prepared response templates ----
|
|
348
385
|
/** Materialise status + headers ONCE (the same header builder respond() uses,
|
|
349
386
|
* so the wire bytes are identical) and get back a template id to replay per
|
|
@@ -395,6 +432,7 @@ declare const engine: {
|
|
|
395
432
|
listen: typeof listen;
|
|
396
433
|
close: typeof close;
|
|
397
434
|
stopListening: typeof stopListening;
|
|
435
|
+
updateSsl: typeof updateSsl;
|
|
398
436
|
getMethod: typeof getMethod;
|
|
399
437
|
getBatchBuffers: typeof getBatchBuffers;
|
|
400
438
|
getPath: typeof getPath;
|
|
@@ -410,6 +448,8 @@ declare const engine: {
|
|
|
410
448
|
end: typeof end;
|
|
411
449
|
setStaticRoute: typeof setStaticRoute;
|
|
412
450
|
clearStaticRoutes: typeof clearStaticRoutes;
|
|
451
|
+
setParamRoute: typeof setParamRoute;
|
|
452
|
+
clearParamRoutes: typeof clearParamRoutes;
|
|
413
453
|
prepareResponse: typeof prepareResponse;
|
|
414
454
|
releaseTemplates: typeof releaseTemplates;
|
|
415
455
|
respondPrepared: typeof respondPrepared;
|
package/index.js
CHANGED
|
@@ -153,6 +153,7 @@ const NATIVE_API = new Set([
|
|
|
153
153
|
'listen',
|
|
154
154
|
'close',
|
|
155
155
|
'stopListening',
|
|
156
|
+
'updateSsl',
|
|
156
157
|
'getMethod',
|
|
157
158
|
'getBatchBuffers',
|
|
158
159
|
'getPath',
|
|
@@ -168,6 +169,8 @@ const NATIVE_API = new Set([
|
|
|
168
169
|
'end',
|
|
169
170
|
'setStaticRoute',
|
|
170
171
|
'clearStaticRoutes',
|
|
172
|
+
'setParamRoute',
|
|
173
|
+
'clearParamRoutes',
|
|
171
174
|
'prepareResponse',
|
|
172
175
|
'releaseTemplates',
|
|
173
176
|
'respondPrepared',
|
package/index.mjs
CHANGED
|
@@ -30,6 +30,7 @@ export let serve = (...a) => (serve = engine.serve)(...a);
|
|
|
30
30
|
export let listen = (...a) => (listen = engine.listen)(...a);
|
|
31
31
|
export let close = (...a) => (close = engine.close)(...a);
|
|
32
32
|
export let stopListening = (...a) => (stopListening = engine.stopListening)(...a);
|
|
33
|
+
export let updateSsl = (...a) => (updateSsl = engine.updateSsl)(...a);
|
|
33
34
|
export let getMethod = (...a) => (getMethod = engine.getMethod)(...a);
|
|
34
35
|
export let getBatchBuffers = (...a) => (getBatchBuffers = engine.getBatchBuffers)(...a);
|
|
35
36
|
export let getPath = (...a) => (getPath = engine.getPath)(...a);
|
|
@@ -45,6 +46,8 @@ export let write = (...a) => (write = engine.write)(...a);
|
|
|
45
46
|
export let end = (...a) => (end = engine.end)(...a);
|
|
46
47
|
export let setStaticRoute = (...a) => (setStaticRoute = engine.setStaticRoute)(...a);
|
|
47
48
|
export let clearStaticRoutes = (...a) => (clearStaticRoutes = engine.clearStaticRoutes)(...a);
|
|
49
|
+
export let setParamRoute = (...a) => (setParamRoute = engine.setParamRoute)(...a);
|
|
50
|
+
export let clearParamRoutes = (...a) => (clearParamRoutes = engine.clearParamRoutes)(...a);
|
|
48
51
|
export let prepareResponse = (...a) => (prepareResponse = engine.prepareResponse)(...a);
|
|
49
52
|
export let releaseTemplates = (...a) => (releaseTemplates = engine.releaseTemplates)(...a);
|
|
50
53
|
export let respondPrepared = (...a) => (respondPrepared = engine.respondPrepared)(...a);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morojs/engine",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.9",
|
|
4
4
|
"description": "MoroJS native HTTP engine - Moro-authored C++ core with per-platform prebuilt binaries and automatic Node.js fallback in MoroJS",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "CM Ventures Inc.",
|
|
@@ -38,13 +38,13 @@
|
|
|
38
38
|
"provenance": true
|
|
39
39
|
},
|
|
40
40
|
"optionalDependencies": {
|
|
41
|
-
"@morojs/engine-darwin-arm64": "1.1.
|
|
42
|
-
"@morojs/engine-darwin-x64": "1.1.
|
|
43
|
-
"@morojs/engine-linux-x64-gnu": "1.1.
|
|
44
|
-
"@morojs/engine-linux-arm64-gnu": "1.1.
|
|
45
|
-
"@morojs/engine-linux-x64-musl": "1.1.
|
|
46
|
-
"@morojs/engine-linux-arm64-musl": "1.1.
|
|
47
|
-
"@morojs/engine-win32-x64": "1.1.
|
|
41
|
+
"@morojs/engine-darwin-arm64": "1.1.9",
|
|
42
|
+
"@morojs/engine-darwin-x64": "1.1.9",
|
|
43
|
+
"@morojs/engine-linux-x64-gnu": "1.1.9",
|
|
44
|
+
"@morojs/engine-linux-arm64-gnu": "1.1.9",
|
|
45
|
+
"@morojs/engine-linux-x64-musl": "1.1.9",
|
|
46
|
+
"@morojs/engine-linux-arm64-musl": "1.1.9",
|
|
47
|
+
"@morojs/engine-win32-x64": "1.1.9"
|
|
48
48
|
},
|
|
49
49
|
"keywords": [
|
|
50
50
|
"morojs",
|