@morojs/moro 1.7.29 → 1.8.0

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 (67) hide show
  1. package/README.md +89 -37
  2. package/dist/core/config/config-sources.js +114 -2
  3. package/dist/core/config/config-sources.js.map +1 -1
  4. package/dist/core/config/config-validator.js +187 -5
  5. package/dist/core/config/config-validator.js.map +1 -1
  6. package/dist/core/config/schema.js +31 -3
  7. package/dist/core/config/schema.js.map +1 -1
  8. package/dist/core/framework.d.ts +41 -2
  9. package/dist/core/framework.js +338 -73
  10. package/dist/core/framework.js.map +1 -1
  11. package/dist/core/http/http-server.d.ts +21 -22
  12. package/dist/core/http/http-server.js +268 -226
  13. package/dist/core/http/http-server.js.map +1 -1
  14. package/dist/core/http/http2-server.d.ts +6 -16
  15. package/dist/core/http/http2-server.js +14 -79
  16. package/dist/core/http/http2-server.js.map +1 -1
  17. package/dist/core/http/index.d.ts +1 -0
  18. package/dist/core/http/index.js +3 -0
  19. package/dist/core/http/index.js.map +1 -1
  20. package/dist/core/http/moro-engine-server.d.ts +263 -0
  21. package/dist/core/http/moro-engine-server.js +1939 -0
  22. package/dist/core/http/moro-engine-server.js.map +1 -0
  23. package/dist/core/http/utils/compression.d.ts +47 -0
  24. package/dist/core/http/utils/compression.js +132 -0
  25. package/dist/core/http/utils/compression.js.map +1 -0
  26. package/dist/core/http/utils/lazy-event-emitter.d.ts +11 -0
  27. package/dist/core/http/utils/lazy-event-emitter.js +69 -0
  28. package/dist/core/http/utils/lazy-event-emitter.js.map +1 -0
  29. package/dist/core/http/utils/multipart-parser.d.ts +32 -0
  30. package/dist/core/http/utils/multipart-parser.js +211 -0
  31. package/dist/core/http/utils/multipart-parser.js.map +1 -0
  32. package/dist/core/http/utils/query-parser.d.ts +1 -0
  33. package/dist/core/http/utils/query-parser.js +44 -0
  34. package/dist/core/http/utils/query-parser.js.map +1 -0
  35. package/dist/core/http/utils/size.d.ts +33 -0
  36. package/dist/core/http/utils/size.js +37 -0
  37. package/dist/core/http/utils/size.js.map +1 -0
  38. package/dist/core/http/utils/ssl-config.d.ts +69 -0
  39. package/dist/core/http/utils/ssl-config.js +116 -0
  40. package/dist/core/http/utils/ssl-config.js.map +1 -0
  41. package/dist/core/http/utils/uws-worker-clustering.js +8 -2
  42. package/dist/core/http/utils/uws-worker-clustering.js.map +1 -1
  43. package/dist/core/http/uws-http-server.d.ts +24 -3
  44. package/dist/core/http/uws-http-server.js +386 -65
  45. package/dist/core/http/uws-http-server.js.map +1 -1
  46. package/dist/core/middleware/built-in/compression/core.d.ts +3 -0
  47. package/dist/core/middleware/built-in/compression/core.js +28 -34
  48. package/dist/core/middleware/built-in/compression/core.js.map +1 -1
  49. package/dist/core/networking/adapters/engine-adapter.d.ts +23 -0
  50. package/dist/core/networking/adapters/engine-adapter.js +365 -0
  51. package/dist/core/networking/adapters/engine-adapter.js.map +1 -0
  52. package/dist/core/networking/adapters/index.d.ts +1 -0
  53. package/dist/core/networking/adapters/index.js +1 -0
  54. package/dist/core/networking/adapters/index.js.map +1 -1
  55. package/dist/core/networking/adapters/uws-adapter.js +26 -15
  56. package/dist/core/networking/adapters/uws-adapter.js.map +1 -1
  57. package/dist/core/utilities/package-utils.d.ts +68 -0
  58. package/dist/core/utilities/package-utils.js +198 -1
  59. package/dist/core/utilities/package-utils.js.map +1 -1
  60. package/dist/index.d.ts +1 -1
  61. package/dist/index.js +1 -1
  62. package/dist/index.js.map +1 -1
  63. package/dist/moro.d.ts +2 -0
  64. package/dist/moro.js +63 -21
  65. package/dist/moro.js.map +1 -1
  66. package/dist/types/config.d.ts +90 -5
  67. package/package.json +4 -1
@@ -1,4 +1,7 @@
1
1
  import { HttpRequest, HttpResponse, Middleware } from '../../types/http.js';
2
+ import { LazyEventEmitter } from './utils/lazy-event-emitter.js';
3
+ import type { HttpRuntimeLimits } from './utils/size.js';
4
+ import { type CompressionSettings } from './utils/compression.js';
2
5
  /**
3
6
  * Prototype-based request object for the uWS adapter.
4
7
  *
@@ -8,7 +11,7 @@ import { HttpRequest, HttpResponse, Middleware } from '../../types/http.js';
8
11
  * so `materialize()` MUST be called before any `await` - it snapshots the
9
12
  * headers and detaches the native reference.
10
13
  */
11
- export declare class UwsRequest {
14
+ export declare class UwsRequest extends LazyEventEmitter {
12
15
  method: string;
13
16
  path: string;
14
17
  url: string;
@@ -23,7 +26,12 @@ export declare class UwsRequest {
23
26
  _cookies: Record<string, string> | undefined;
24
27
  _context: Record<string, any> | undefined;
25
28
  _requestId: string | undefined;
29
+ _socket: any;
26
30
  constructor(server: UWebSocketsHttpServer, uwsReq: any, method: string, url: string, queryString: string);
31
+ get socket(): any;
32
+ set socket(value: any);
33
+ get connection(): any;
34
+ set connection(value: any);
27
35
  /** Snapshot uWS-backed data and detach the native request. Idempotent.
28
36
  * Must be called before returning control to the event loop if the
29
37
  * request object outlives the synchronous route callback. */
@@ -58,6 +66,8 @@ export declare class UwsRequest {
58
66
  export declare class UWebSocketsHttpServer {
59
67
  private app;
60
68
  private uws;
69
+ private _limits?;
70
+ private multipartLimits?;
61
71
  private listenSocket;
62
72
  private globalMiddleware;
63
73
  private logger;
@@ -82,10 +92,19 @@ export declare class UWebSocketsHttpServer {
82
92
  ssl?: {
83
93
  key_file_name?: string;
84
94
  cert_file_name?: string;
95
+ ca_file_name?: string;
85
96
  passphrase?: string;
86
- };
97
+ } | null;
98
+ /** True when a TLS config was given but only as inline PEM (uWS needs
99
+ * file paths); triggers a clear error instead of a silent plain boot. */
100
+ sslInlineOnly?: boolean;
101
+ limits?: HttpRuntimeLimits;
87
102
  maxBodySize?: number;
88
103
  maxUploadSize?: number;
104
+ /** Preloaded native engine module (from loadNativeEngine) - avoids a
105
+ * second resolution and keeps load failures at the framework's
106
+ * synchronous preflight instead of surfacing at listen() */
107
+ engineModule?: any;
89
108
  });
90
109
  setRouterHandler(fn: (req: HttpRequest, res: HttpResponse) => boolean | Promise<boolean>): void;
91
110
  setNativeRouteProvider(provider: () => Array<{
@@ -110,7 +129,9 @@ export declare class UWebSocketsHttpServer {
110
129
  use(middleware: Middleware): void;
111
130
  setRequestTracking(enabled: boolean): void;
112
131
  setHookManager(hookManager: any): void;
113
- configurePerformance(_config: any): void;
132
+ /** @internal buffered-response compression settings (read at init). */
133
+ _compression: CompressionSettings;
134
+ configurePerformance(config: any): void;
114
135
  listen(port: number, callback?: () => void): void;
115
136
  listen(port: number, host: string, callback?: () => void): void;
116
137
  close(callback?: (error?: Error) => void): void;