@morojs/moro 1.8.8 → 1.8.10
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/core/cluster/thread-cluster.d.ts +178 -0
- package/dist/core/cluster/thread-cluster.js +389 -0
- package/dist/core/cluster/thread-cluster.js.map +1 -0
- package/dist/core/framework.js.map +1 -1
- package/dist/core/http/moro-engine-server.d.ts +29 -1
- package/dist/core/http/moro-engine-server.js +375 -68
- package/dist/core/http/moro-engine-server.js.map +1 -1
- package/dist/core/http/utils/compression.js +12 -6
- package/dist/core/http/utils/compression.js.map +1 -1
- package/dist/core/http/utils/uws-worker-clustering.js +10 -6
- package/dist/core/http/utils/uws-worker-clustering.js.map +1 -1
- package/dist/core/http/uws-http-server.d.ts +1 -0
- package/dist/core/http/uws-http-server.js +105 -22
- package/dist/core/http/uws-http-server.js.map +1 -1
- package/dist/core/jobs/leader-election.js +16 -5
- package/dist/core/jobs/leader-election.js.map +1 -1
- package/dist/core/networking/websocket-manager.js +4 -2
- package/dist/core/networking/websocket-manager.js.map +1 -1
- package/dist/core/routing/unified-router.js +60 -29
- package/dist/core/routing/unified-router.js.map +1 -1
- package/dist/core/runtime/node-adapter.d.ts +1 -1
- package/dist/core/runtime/node-adapter.js.map +1 -1
- package/dist/core/utilities/builtin.d.ts +1 -0
- package/dist/core/utilities/builtin.js +25 -0
- package/dist/core/utilities/builtin.js.map +1 -0
- package/dist/core/utilities/package-utils.d.ts +28 -3
- package/dist/core/utilities/package-utils.js +24 -12
- package/dist/core/utilities/package-utils.js.map +1 -1
- package/dist/core/workers/worker-manager.js +4 -3
- package/dist/core/workers/worker-manager.js.map +1 -1
- package/dist/moro.d.ts +5 -0
- package/dist/moro.js +364 -204
- package/dist/moro.js.map +1 -1
- package/dist/types/http.d.ts +1 -1
- package/dist/types/http.js.map +1 -1
- package/package.json +1 -1
package/dist/types/http.d.ts
CHANGED
package/dist/types/http.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/types/http.ts"],"names":[],"mappings":"","sourcesContent":["// HTTP Server Types\nimport { IncomingMessage, ServerResponse } from 'http';\n\nexport interface HttpRequest extends IncomingMessage {\n params: Record<string, string>;\n query: Record<string, string>;\n body: any;\n path: string;\n headers: Record<string, string>;\n ip: string;\n requestId: string;\n cookies?: Record<string, string>;\n /** Signed cookies whose signature verified; requires a cookie middleware secret. */\n signedCookies?: Record<string, string>;\n files?: Record<string, any>;\n\n // Per-request typed context (pass data between middlewares without monkey-patching req)\n context: Record<string, any>;\n\n // Express-compatible helpers\n get(name: string): string | undefined;\n header(name: string): string | undefined;\n is(type: string): boolean;\n accepts(types?: string | string[]): string | false;\n acceptsLanguages(langs?: string | string[]): string | false;\n hostname: string;\n protocol: string;\n secure: boolean;\n xhr: boolean;\n originalUrl: string;\n ips: string[];\n subdomains: string[];\n\n [key: string]: any;\n}\n\nexport interface CookieOptions {\n maxAge?: number;\n expires?: Date;\n httpOnly?: boolean;\n secure?: boolean;\n sameSite?: 'strict' | 'lax' | 'none';\n domain?: string;\n path?: string;\n // Security options\n signed?: boolean; // Sign the value; needs a cookie middleware secret\n critical?: boolean; // Mark as critical for security (throws on late set)\n throwOnLateSet?: boolean; // Force throw if headers already sent\n}\n\nexport interface ResponseState {\n headersSent: boolean;\n statusCode: number;\n headers: Record<string, any>;\n finished: boolean;\n writable: boolean;\n}\n\nexport interface MoroResponseMethods {\n json(data: any): void;\n status(code: number): HttpResponse;\n send(data: string | Buffer): void;\n cookie(name: string, value: string, options?: CookieOptions): HttpResponse;\n clearCookie(name: string, options?: CookieOptions): HttpResponse;\n redirect(url: string, status?: number): void;\n sendFile(filePath: string): Promise<void>;\n render?(template: string, data?: any): Promise<void>;\n\n // Per-response typed state bag (Express-compatible res.locals)\n locals: Record<string, any>;\n\n // Express-compatible response helpers\n set(\n field: string | Record<string, string | string[] | number>,\n value?: string | string[] | number\n ): HttpResponse;\n get(field: string): string | number | string[] | undefined;\n append(field: string, value: string | string[]): HttpResponse;\n type(contentType: string): HttpResponse;\n sendStatus(code: number): void;\n location(url: string): HttpResponse;\n vary(field: string | string[]): HttpResponse;\n links(links: Record<string, string>): HttpResponse;\n attachment(filename?: string): HttpResponse;\n download(filePath: string, filename?: string): Promise<void>;\n format(handlers: Record<string, () => any | Promise<any>>): void;\n\n // Header management utilities\n hasHeader(name: string): boolean;\n setBulkHeaders(headers: Record<string, string | number>): HttpResponse;\n appendHeader(name: string, value: string | string[]): HttpResponse;\n\n // Response state utilities\n canSetHeaders(): boolean;\n getResponseState(): ResponseState;\n\n // Standardized response helpers\n success<T = any>(data: T, message?: string): void;\n error(error: string, code?: string, message?: string): void;\n\n // Common HTTP error helpers (automatically set status code)\n unauthorized(message?: string): void;\n forbidden(message?: string): void;\n notFound(resource?: string): void;\n badRequest(message?: string): void;\n conflict(message: string): void;\n internalError(message?: string): void;\n validationError(errors: Array<{ field: string; message: string; code?: string }>): void;\n rateLimited(retryAfter?: number): void;\n\n // Common success patterns\n created<T = any>(data: T, location?: string): void;\n noContent(): void;\n paginated<T = any>(\n data: T[],\n pagination: {\n page: number;\n limit: number;\n total: number;\n }\n ): void;\n}\n\nexport type HttpResponse = ServerResponse & MoroResponseMethods;\n\nexport type HttpHandler = (req: HttpRequest, res: HttpResponse) => Promise<void> | void;\nexport type Middleware = (\n req: HttpRequest,\n res: HttpResponse,\n next: () => void\n) => Promise<void> | void;\nexport type MiddlewareFunction = (\n req: HttpRequest,\n res: HttpResponse,\n next: () => void\n) => void | Promise<void>;\n\n// Internal router types\nexport interface RouteEntry {\n method: string;\n path: string;\n pattern: RegExp;\n paramNames: string[];\n handler: HttpHandler;\n middleware: Middleware[];\n}\n\nexport interface RouteDefinition {\n method: string;\n path: string;\n pattern: RegExp;\n paramNames: string[];\n handler: HttpHandler;\n middleware: Middleware[];\n}\n"]}
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/types/http.ts"],"names":[],"mappings":"","sourcesContent":["// HTTP Server Types\nimport type { IncomingMessage, ServerResponse } from 'http';\n\nexport interface HttpRequest extends IncomingMessage {\n params: Record<string, string>;\n query: Record<string, string>;\n body: any;\n path: string;\n headers: Record<string, string>;\n ip: string;\n requestId: string;\n cookies?: Record<string, string>;\n /** Signed cookies whose signature verified; requires a cookie middleware secret. */\n signedCookies?: Record<string, string>;\n files?: Record<string, any>;\n\n // Per-request typed context (pass data between middlewares without monkey-patching req)\n context: Record<string, any>;\n\n // Express-compatible helpers\n get(name: string): string | undefined;\n header(name: string): string | undefined;\n is(type: string): boolean;\n accepts(types?: string | string[]): string | false;\n acceptsLanguages(langs?: string | string[]): string | false;\n hostname: string;\n protocol: string;\n secure: boolean;\n xhr: boolean;\n originalUrl: string;\n ips: string[];\n subdomains: string[];\n\n [key: string]: any;\n}\n\nexport interface CookieOptions {\n maxAge?: number;\n expires?: Date;\n httpOnly?: boolean;\n secure?: boolean;\n sameSite?: 'strict' | 'lax' | 'none';\n domain?: string;\n path?: string;\n // Security options\n signed?: boolean; // Sign the value; needs a cookie middleware secret\n critical?: boolean; // Mark as critical for security (throws on late set)\n throwOnLateSet?: boolean; // Force throw if headers already sent\n}\n\nexport interface ResponseState {\n headersSent: boolean;\n statusCode: number;\n headers: Record<string, any>;\n finished: boolean;\n writable: boolean;\n}\n\nexport interface MoroResponseMethods {\n json(data: any): void;\n status(code: number): HttpResponse;\n send(data: string | Buffer): void;\n cookie(name: string, value: string, options?: CookieOptions): HttpResponse;\n clearCookie(name: string, options?: CookieOptions): HttpResponse;\n redirect(url: string, status?: number): void;\n sendFile(filePath: string): Promise<void>;\n render?(template: string, data?: any): Promise<void>;\n\n // Per-response typed state bag (Express-compatible res.locals)\n locals: Record<string, any>;\n\n // Express-compatible response helpers\n set(\n field: string | Record<string, string | string[] | number>,\n value?: string | string[] | number\n ): HttpResponse;\n get(field: string): string | number | string[] | undefined;\n append(field: string, value: string | string[]): HttpResponse;\n type(contentType: string): HttpResponse;\n sendStatus(code: number): void;\n location(url: string): HttpResponse;\n vary(field: string | string[]): HttpResponse;\n links(links: Record<string, string>): HttpResponse;\n attachment(filename?: string): HttpResponse;\n download(filePath: string, filename?: string): Promise<void>;\n format(handlers: Record<string, () => any | Promise<any>>): void;\n\n // Header management utilities\n hasHeader(name: string): boolean;\n setBulkHeaders(headers: Record<string, string | number>): HttpResponse;\n appendHeader(name: string, value: string | string[]): HttpResponse;\n\n // Response state utilities\n canSetHeaders(): boolean;\n getResponseState(): ResponseState;\n\n // Standardized response helpers\n success<T = any>(data: T, message?: string): void;\n error(error: string, code?: string, message?: string): void;\n\n // Common HTTP error helpers (automatically set status code)\n unauthorized(message?: string): void;\n forbidden(message?: string): void;\n notFound(resource?: string): void;\n badRequest(message?: string): void;\n conflict(message: string): void;\n internalError(message?: string): void;\n validationError(errors: Array<{ field: string; message: string; code?: string }>): void;\n rateLimited(retryAfter?: number): void;\n\n // Common success patterns\n created<T = any>(data: T, location?: string): void;\n noContent(): void;\n paginated<T = any>(\n data: T[],\n pagination: {\n page: number;\n limit: number;\n total: number;\n }\n ): void;\n}\n\nexport type HttpResponse = ServerResponse & MoroResponseMethods;\n\nexport type HttpHandler = (req: HttpRequest, res: HttpResponse) => Promise<void> | void;\nexport type Middleware = (\n req: HttpRequest,\n res: HttpResponse,\n next: () => void\n) => Promise<void> | void;\nexport type MiddlewareFunction = (\n req: HttpRequest,\n res: HttpResponse,\n next: () => void\n) => void | Promise<void>;\n\n// Internal router types\nexport interface RouteEntry {\n method: string;\n path: string;\n pattern: RegExp;\n paramNames: string[];\n handler: HttpHandler;\n middleware: Middleware[];\n}\n\nexport interface RouteDefinition {\n method: string;\n path: string;\n pattern: RegExp;\n paramNames: string[];\n handler: HttpHandler;\n middleware: Middleware[];\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morojs/moro",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.10",
|
|
4
4
|
"description": "High-performance Node.js framework with intelligent routing, automatic middleware ordering, enterprise authentication (Better Auth), type-safe validation, and functional architecture",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|