@miiajs/core 0.1.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.
- package/LICENSE +21 -0
- package/README.md +57 -0
- package/dist/app/app.d.ts +106 -0
- package/dist/app/app.d.ts.map +1 -0
- package/dist/app/app.js +449 -0
- package/dist/app/app.js.map +1 -0
- package/dist/app/index.d.ts +3 -0
- package/dist/app/index.d.ts.map +1 -0
- package/dist/app/index.js +2 -0
- package/dist/app/index.js.map +1 -0
- package/dist/app/module-loader.d.ts +16 -0
- package/dist/app/module-loader.d.ts.map +1 -0
- package/dist/app/module-loader.js +107 -0
- package/dist/app/module-loader.js.map +1 -0
- package/dist/app/router-explorer.d.ts +12 -0
- package/dist/app/router-explorer.d.ts.map +1 -0
- package/dist/app/router-explorer.js +76 -0
- package/dist/app/router-explorer.js.map +1 -0
- package/dist/app/routes-resolver.d.ts +11 -0
- package/dist/app/routes-resolver.d.ts.map +1 -0
- package/dist/app/routes-resolver.js +24 -0
- package/dist/app/routes-resolver.js.map +1 -0
- package/dist/cors.d.ts +22 -0
- package/dist/cors.d.ts.map +1 -0
- package/dist/cors.js +48 -0
- package/dist/cors.js.map +1 -0
- package/dist/decorators/apply-decorators.d.ts +19 -0
- package/dist/decorators/apply-decorators.d.ts.map +1 -0
- package/dist/decorators/apply-decorators.js +27 -0
- package/dist/decorators/apply-decorators.js.map +1 -0
- package/dist/decorators/class.d.ts +9 -0
- package/dist/decorators/class.d.ts.map +1 -0
- package/dist/decorators/class.js +15 -0
- package/dist/decorators/class.js.map +1 -0
- package/dist/decorators/create-decorator.d.ts +6 -0
- package/dist/decorators/create-decorator.d.ts.map +1 -0
- package/dist/decorators/create-decorator.js +31 -0
- package/dist/decorators/create-decorator.js.map +1 -0
- package/dist/decorators/http.d.ts +8 -0
- package/dist/decorators/http.d.ts.map +1 -0
- package/dist/decorators/http.js +24 -0
- package/dist/decorators/http.js.map +1 -0
- package/dist/decorators/index.d.ts +9 -0
- package/dist/decorators/index.d.ts.map +1 -0
- package/dist/decorators/index.js +7 -0
- package/dist/decorators/index.js.map +1 -0
- package/dist/decorators/metadata.d.ts +29 -0
- package/dist/decorators/metadata.d.ts.map +1 -0
- package/dist/decorators/metadata.js +40 -0
- package/dist/decorators/metadata.js.map +1 -0
- package/dist/decorators/middleware.d.ts +9 -0
- package/dist/decorators/middleware.d.ts.map +1 -0
- package/dist/decorators/middleware.js +82 -0
- package/dist/decorators/middleware.js.map +1 -0
- package/dist/di-container.d.ts +52 -0
- package/dist/di-container.d.ts.map +1 -0
- package/dist/di-container.js +177 -0
- package/dist/di-container.js.map +1 -0
- package/dist/discovery/discovery-service.d.ts +63 -0
- package/dist/discovery/discovery-service.d.ts.map +1 -0
- package/dist/discovery/discovery-service.js +65 -0
- package/dist/discovery/discovery-service.js.map +1 -0
- package/dist/discovery/index.d.ts +3 -0
- package/dist/discovery/index.d.ts.map +1 -0
- package/dist/discovery/index.js +2 -0
- package/dist/discovery/index.js.map +1 -0
- package/dist/exceptions.d.ts +28 -0
- package/dist/exceptions.d.ts.map +1 -0
- package/dist/exceptions.js +67 -0
- package/dist/exceptions.js.map +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +31 -0
- package/dist/index.js.map +1 -0
- package/dist/logger.d.ts +43 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +123 -0
- package/dist/logger.js.map +1 -0
- package/dist/middleware.d.ts +4 -0
- package/dist/middleware.d.ts.map +1 -0
- package/dist/middleware.js +36 -0
- package/dist/middleware.js.map +1 -0
- package/dist/polyfill.d.ts +2 -0
- package/dist/polyfill.d.ts.map +1 -0
- package/dist/polyfill.js +6 -0
- package/dist/polyfill.js.map +1 -0
- package/dist/resolver.d.ts +36 -0
- package/dist/resolver.d.ts.map +1 -0
- package/dist/resolver.js +42 -0
- package/dist/resolver.js.map +1 -0
- package/dist/response.d.ts +19 -0
- package/dist/response.d.ts.map +1 -0
- package/dist/response.js +62 -0
- package/dist/response.js.map +1 -0
- package/dist/router.d.ts +35 -0
- package/dist/router.d.ts.map +1 -0
- package/dist/router.js +160 -0
- package/dist/router.js.map +1 -0
- package/dist/testing/index.d.ts +2 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +2 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/test-app.d.ts +22 -0
- package/dist/testing/test-app.d.ts.map +1 -0
- package/dist/testing/test-app.js +76 -0
- package/dist/testing/test-app.js.map +1 -0
- package/dist/types.d.ts +85 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +3 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/join-paths.d.ts +2 -0
- package/dist/utils/join-paths.d.ts.map +1 -0
- package/dist/utils/join-paths.js +7 -0
- package/dist/utils/join-paths.js.map +1 -0
- package/dist/utils/resolve-options.d.ts +32 -0
- package/dist/utils/resolve-options.d.ts.map +1 -0
- package/dist/utils/resolve-options.js +10 -0
- package/dist/utils/resolve-options.js.map +1 -0
- package/package.json +57 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ruslan Matiushev
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# MiiaJS
|
|
2
|
+
|
|
3
|
+
The lightweight, decorator-driven HTTP framework for TypeScript.
|
|
4
|
+
|
|
5
|
+
Build structured, type-safe APIs with decorators, dependency injection, and middleware. Deploy to any runtime - Bun, Deno, Node.js, serverless, or edge.
|
|
6
|
+
|
|
7
|
+
## Why MiiaJS?
|
|
8
|
+
|
|
9
|
+
- **TC39 Native Decorators** - no `reflect-metadata`, no experimental TypeScript flags
|
|
10
|
+
- **Web Standards** - built on the `Request`/`Response` API, no proprietary abstractions
|
|
11
|
+
- **Multi-Runtime** - runs on Bun, Deno, Node.js, Cloudflare Workers, AWS Lambda
|
|
12
|
+
- **Koa-style Middleware** - clean onion model replaces interceptors, pipes, and filters
|
|
13
|
+
- **Flat DI** - per-app container with `inject()` function, no global singletons
|
|
14
|
+
- **ESM-only** - ES2025 target, `nodenext` module resolution
|
|
15
|
+
|
|
16
|
+
## Performance
|
|
17
|
+
|
|
18
|
+
Up to **19% faster** than Hono | Up to **40% faster** than NestJS+Fastify \*
|
|
19
|
+
|
|
20
|
+
> \* Realistic API benchmarks on Bun. Results vary by runtime. [See full benchmarks →](https://miiajs.com/benchmarks)
|
|
21
|
+
|
|
22
|
+
## Ecosystem
|
|
23
|
+
|
|
24
|
+
| Package | Description |
|
|
25
|
+
| --- | --- |
|
|
26
|
+
| `@miiajs/core` | DI, decorators, router, middleware, exceptions |
|
|
27
|
+
| `@miiajs/config` | ConfigModule, ConfigService, validated env |
|
|
28
|
+
| `@miiajs/serve-static` | Static file serving with Range, ETag, charset, SPA fallback |
|
|
29
|
+
| `@miiajs/cli` | Dev server, build, start, type checking, project scaffolding |
|
|
30
|
+
| `@miiajs/node-server` | Node.js HTTP server adapter |
|
|
31
|
+
| `@miiajs/uws-server` | uWebSockets.js HTTP server adapter |
|
|
32
|
+
| `@miiajs/auth` | Strategy primitives, AuthGuard, token extractors |
|
|
33
|
+
| `@miiajs/jwt` | Injectable JWT sign/verify service (jose wrapper) |
|
|
34
|
+
| `@miiajs/messaging` | Decorator-driven message bus, retry, DLQ, idempotency, named buses |
|
|
35
|
+
| `@miiajs/messaging-redis` | Redis Streams transport for `@miiajs/messaging` |
|
|
36
|
+
| `@miiajs/drizzle` | Drizzle ORM integration (PostgreSQL, MySQL, SQLite) |
|
|
37
|
+
| `@miiajs/mongoose` | MongoDB integration via Mongoose with injectable models |
|
|
38
|
+
| `@miiajs/papr` | MongoDB integration via Papr |
|
|
39
|
+
| `@miiajs/swagger` | OpenAPI 3.1 spec generation, Swagger UI |
|
|
40
|
+
|
|
41
|
+
## Quick start
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npx @miiajs/cli new my-app
|
|
45
|
+
cd my-app
|
|
46
|
+
npm run dev
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Documentation
|
|
50
|
+
|
|
51
|
+
Full documentation, guides, and API reference:
|
|
52
|
+
|
|
53
|
+
**[miiajs.com/docs](https://miiajs.com/docs)**
|
|
54
|
+
|
|
55
|
+
## License
|
|
56
|
+
|
|
57
|
+
MIT
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import type { LoggerConfig, LoggerService } from '../logger.js';
|
|
2
|
+
import type { ConfiguredModule, Constructor, Guard, HttpMethod, ListenAdapter, Middleware, RequestContext } from '../types.js';
|
|
3
|
+
export interface MiiaOptions {
|
|
4
|
+
logger?: LoggerService | LoggerConfig | false;
|
|
5
|
+
/**
|
|
6
|
+
* Register process signal handlers that gracefully call `destroy()` when
|
|
7
|
+
* the process receives SIGTERM/SIGINT/SIGHUP. Registered on first `listen()`
|
|
8
|
+
* call (not in the constructor) so embedded `app.fetch` use cases (e.g. for
|
|
9
|
+
* serverless) do not pick up global handlers.
|
|
10
|
+
*
|
|
11
|
+
* - `true` (default) - register handlers for `['SIGTERM', 'SIGINT', 'SIGHUP']`
|
|
12
|
+
* - `false` - do not register; user is responsible for calling `destroy()`
|
|
13
|
+
* - `NodeJS.Signals[]` - custom subset of signals (empty array is equivalent
|
|
14
|
+
* to `false` - no signals registered)
|
|
15
|
+
*
|
|
16
|
+
* On signal: logs `Received <signal>, shutting down gracefully...`,
|
|
17
|
+
* awaits `destroy()`, exits with code 0 (or 1 if destroy throws).
|
|
18
|
+
* Concurrent signals are guarded - only the first one initiates shutdown.
|
|
19
|
+
*
|
|
20
|
+
* Notes:
|
|
21
|
+
* - `process.exit(0)` after `destroy()` cancels non-awaited timers and any
|
|
22
|
+
* remaining open handles. Acceptable trade-off for deterministic exit.
|
|
23
|
+
* - Pressing Ctrl+C twice: the first SIGINT triggers Miia shutdown, after
|
|
24
|
+
* which the handler is gone (`process.once`); the second SIGINT goes to
|
|
25
|
+
* the OS default action (process kill). This is conventional Unix
|
|
26
|
+
* behaviour, not a bug.
|
|
27
|
+
* - Existing user `process.on('SIGTERM', ...)` listeners co-exist with
|
|
28
|
+
* Miia's; both fire on signal. Pass `shutdownHooks: false` to opt out
|
|
29
|
+
* if you fully manage shutdown yourself.
|
|
30
|
+
* - Windows: SIGHUP is not supported. The default array filters it out
|
|
31
|
+
* silently on win32; SIGTERM/SIGINT still active.
|
|
32
|
+
* - `TestApp` does not call `listen()`, so handlers are never registered
|
|
33
|
+
* in tests - safe by construction.
|
|
34
|
+
* - Multi-Miia (multiple instances in one process): all instances receive
|
|
35
|
+
* the signal and start their own `destroy()` concurrently. The first to
|
|
36
|
+
* reach `process.exit(0)` terminates the process; others' cleanup may
|
|
37
|
+
* be interrupted mid-flight. Pass `shutdownHooks: false` on secondary
|
|
38
|
+
* instances and have the primary tear them down manually before its
|
|
39
|
+
* own `destroy()`.
|
|
40
|
+
*/
|
|
41
|
+
shutdownHooks?: boolean | NodeJS.Signals[];
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Top-level application entry point.
|
|
45
|
+
*
|
|
46
|
+
* **Graceful shutdown.** When `listen()` is called, Miia registers SIGTERM,
|
|
47
|
+
* SIGINT, and SIGHUP handlers that gracefully call `destroy()` and
|
|
48
|
+
* `process.exit(0)`. This ensures `onDestroy` lifecycle hooks (database
|
|
49
|
+
* disconnects, broker cleanup, drain) run on Ctrl+C and on container
|
|
50
|
+
* orchestrator stops (K8s, Docker, systemd).
|
|
51
|
+
*
|
|
52
|
+
* For embedded use cases (serverless via `app.fetch`, multi-Miia processes,
|
|
53
|
+
* custom bootstrap), opt out via `new Miia({ shutdownHooks: false })` and
|
|
54
|
+
* call `destroy()` manually. `TestApp` does not register handlers because
|
|
55
|
+
* it never calls `listen()`.
|
|
56
|
+
*
|
|
57
|
+
* See `MiiaOptions.shutdownHooks` for full behavioural details.
|
|
58
|
+
*/
|
|
59
|
+
export declare class Miia {
|
|
60
|
+
private container;
|
|
61
|
+
private router;
|
|
62
|
+
private globalMiddlewares;
|
|
63
|
+
private globalGuards;
|
|
64
|
+
private moduleLoader;
|
|
65
|
+
private initialized;
|
|
66
|
+
private initPromise?;
|
|
67
|
+
private compiled;
|
|
68
|
+
private compiledGlobalPipeline?;
|
|
69
|
+
private closeServer?;
|
|
70
|
+
private logger;
|
|
71
|
+
private shutdownHooksOption;
|
|
72
|
+
private shutdownHandlersRegistered;
|
|
73
|
+
private shutdownInProgress;
|
|
74
|
+
/**
|
|
75
|
+
* Tracks listeners we registered so destroy() can `process.off()` them
|
|
76
|
+
* symmetrically. Without this, every Miia instance that calls listen()
|
|
77
|
+
* leaks 3 process listeners (SIGTERM/SIGINT/SIGHUP) - test runs add up
|
|
78
|
+
* fast and Node will warn MaxListenersExceededWarning after ~10 tests.
|
|
79
|
+
*/
|
|
80
|
+
private registeredShutdownHandlers;
|
|
81
|
+
constructor(options?: MiiaOptions);
|
|
82
|
+
use(...middlewares: Middleware[]): this;
|
|
83
|
+
useGuard(...guards: Guard[]): this;
|
|
84
|
+
register(...modules: (Constructor | ConfiguredModule)[]): this;
|
|
85
|
+
addRoute(method: HttpMethod, path: string, handler: (ctx: RequestContext) => unknown, middlewares?: Middleware[]): this;
|
|
86
|
+
get<T>(token: Constructor<T> | string): T;
|
|
87
|
+
fetch: (req: Request) => Response | Promise<Response>;
|
|
88
|
+
init(): Promise<void>;
|
|
89
|
+
private doInit;
|
|
90
|
+
listen(port: number): Promise<void>;
|
|
91
|
+
listen(port: number, hostname: string): Promise<void>;
|
|
92
|
+
listen(port: number, adapter: ListenAdapter): Promise<void>;
|
|
93
|
+
listen(port: number, hostname: string, adapter: ListenAdapter): Promise<void>;
|
|
94
|
+
destroy(): Promise<void>;
|
|
95
|
+
private registerShutdownHandlers;
|
|
96
|
+
private initAndFetch;
|
|
97
|
+
private finalizeResponse;
|
|
98
|
+
private handleWithPipeline;
|
|
99
|
+
private handleWithGlobalPipeline;
|
|
100
|
+
private finalizePipelineResult;
|
|
101
|
+
private compilePipelines;
|
|
102
|
+
private createContext;
|
|
103
|
+
private isLoggerService;
|
|
104
|
+
private handleError;
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=app.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../src/app/app.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAG/D,OAAO,KAAK,EAEV,gBAAgB,EAChB,WAAW,EAC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E,UAAU,EAAO,GAC7B,IAAI;IAMP,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,MAAM,GAAG,CAAC;IAIzC,KAAK,GAAI,KAAK,OAAO,KAAG,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAiEnD;IAEK,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;YAKb,MAAM;IAOpB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IACnC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IACrD,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAC3D,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAqCvE,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAgB9B,OAAO,CAAC,wBAAwB;YA2ClB,YAAY;IAO1B,OAAO,CAAC,gBAAgB;YA2BV,kBAAkB;YAiBlB,wBAAwB;IAoCtC,OAAO,CAAC,sBAAsB;IA4B9B,OAAO,CAAC,gBAAgB;IAgBxB,OAAO,CAAC,aAAa;IAuCrB,OAAO,CAAC,eAAe;IAIvB,OAAO,CAAC,WAAW;CAuBpB"}
|
package/dist/app/app.js
ADDED
|
@@ -0,0 +1,449 @@
|
|
|
1
|
+
import { Container } from '../di-container.js';
|
|
2
|
+
import { DiscoveryService } from '../discovery/discovery-service.js';
|
|
3
|
+
import { Router } from '../router.js';
|
|
4
|
+
import { compose, guardToMiddleware } from '../middleware.js';
|
|
5
|
+
import { ResponseBuilder } from '../response.js';
|
|
6
|
+
import { Resolver } from '../resolver.js';
|
|
7
|
+
import { HttpException, InternalServerException, NotFoundException } from '../exceptions.js';
|
|
8
|
+
import { ConsoleLogger, Logger } from '../logger.js';
|
|
9
|
+
import { ModuleLoader } from './module-loader.js';
|
|
10
|
+
const JSON_RESPONSE_INIT = Object.freeze({
|
|
11
|
+
status: 200,
|
|
12
|
+
headers: Object.freeze({ 'Content-Type': 'application/json' }),
|
|
13
|
+
});
|
|
14
|
+
// Stripped from merged headers on the error path: stale values would mis-describe
|
|
15
|
+
// the fresh JSON error envelope and cause clients to mis-parse or hang.
|
|
16
|
+
const BODY_HEADERS_TO_STRIP = ['content-type', 'content-length', 'content-encoding', 'transfer-encoding'];
|
|
17
|
+
// ─── Miia Application ───────────────────────────────────────
|
|
18
|
+
/**
|
|
19
|
+
* Top-level application entry point.
|
|
20
|
+
*
|
|
21
|
+
* **Graceful shutdown.** When `listen()` is called, Miia registers SIGTERM,
|
|
22
|
+
* SIGINT, and SIGHUP handlers that gracefully call `destroy()` and
|
|
23
|
+
* `process.exit(0)`. This ensures `onDestroy` lifecycle hooks (database
|
|
24
|
+
* disconnects, broker cleanup, drain) run on Ctrl+C and on container
|
|
25
|
+
* orchestrator stops (K8s, Docker, systemd).
|
|
26
|
+
*
|
|
27
|
+
* For embedded use cases (serverless via `app.fetch`, multi-Miia processes,
|
|
28
|
+
* custom bootstrap), opt out via `new Miia({ shutdownHooks: false })` and
|
|
29
|
+
* call `destroy()` manually. `TestApp` does not register handlers because
|
|
30
|
+
* it never calls `listen()`.
|
|
31
|
+
*
|
|
32
|
+
* See `MiiaOptions.shutdownHooks` for full behavioural details.
|
|
33
|
+
*/
|
|
34
|
+
export class Miia {
|
|
35
|
+
container = new Container();
|
|
36
|
+
router = new Router();
|
|
37
|
+
globalMiddlewares = [];
|
|
38
|
+
globalGuards = [];
|
|
39
|
+
moduleLoader;
|
|
40
|
+
initialized = false;
|
|
41
|
+
initPromise;
|
|
42
|
+
compiled = false;
|
|
43
|
+
compiledGlobalPipeline;
|
|
44
|
+
closeServer;
|
|
45
|
+
logger;
|
|
46
|
+
shutdownHooksOption;
|
|
47
|
+
shutdownHandlersRegistered = false;
|
|
48
|
+
shutdownInProgress = false;
|
|
49
|
+
/**
|
|
50
|
+
* Tracks listeners we registered so destroy() can `process.off()` them
|
|
51
|
+
* symmetrically. Without this, every Miia instance that calls listen()
|
|
52
|
+
* leaks 3 process listeners (SIGTERM/SIGINT/SIGHUP) - test runs add up
|
|
53
|
+
* fast and Node will warn MaxListenersExceededWarning after ~10 tests.
|
|
54
|
+
*/
|
|
55
|
+
registeredShutdownHandlers = [];
|
|
56
|
+
constructor(options) {
|
|
57
|
+
if (options?.logger === false) {
|
|
58
|
+
Logger.setLogger({
|
|
59
|
+
log() { },
|
|
60
|
+
error() { },
|
|
61
|
+
warn() { },
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
else if (options?.logger) {
|
|
65
|
+
Logger.setLogger(this.isLoggerService(options.logger) ? options.logger : new ConsoleLogger(options.logger));
|
|
66
|
+
}
|
|
67
|
+
this.logger = new Logger('App');
|
|
68
|
+
this.shutdownHooksOption = options?.shutdownHooks ?? true;
|
|
69
|
+
this.moduleLoader = new ModuleLoader(this.router, this.container);
|
|
70
|
+
// Auto-register DiscoveryService so any provider can inject it without
|
|
71
|
+
// explicit module registration. Factory closure captures `this.container`
|
|
72
|
+
// - keeps Container encapsulated (not self-injectable).
|
|
73
|
+
this.container.register(DiscoveryService, () => new DiscoveryService(this.container), 'singleton');
|
|
74
|
+
// Expose Router via DI so providers can programmatically register routes
|
|
75
|
+
// (e.g. @miiajs/swagger does this inside onReady()).
|
|
76
|
+
this.container.register(Router, () => this.router, 'singleton');
|
|
77
|
+
// Public DI introspection API. Read-only wrapper over Container so user
|
|
78
|
+
// code can inspect provider registration without exposing register/destroy.
|
|
79
|
+
this.container.register(Resolver, () => new Resolver(this.container), 'singleton');
|
|
80
|
+
}
|
|
81
|
+
use(...middlewares) {
|
|
82
|
+
this.globalMiddlewares.push(...middlewares);
|
|
83
|
+
this.compiled = false;
|
|
84
|
+
return this;
|
|
85
|
+
}
|
|
86
|
+
useGuard(...guards) {
|
|
87
|
+
this.globalGuards.push(...guards);
|
|
88
|
+
this.compiled = false;
|
|
89
|
+
return this;
|
|
90
|
+
}
|
|
91
|
+
register(...modules) {
|
|
92
|
+
this.moduleLoader.load(...modules);
|
|
93
|
+
this.compiled = false;
|
|
94
|
+
return this;
|
|
95
|
+
}
|
|
96
|
+
addRoute(method, path, handler, middlewares = []) {
|
|
97
|
+
this.router.add(method, path, handler, { middlewares });
|
|
98
|
+
this.compiled = false;
|
|
99
|
+
return this;
|
|
100
|
+
}
|
|
101
|
+
get(token) {
|
|
102
|
+
return this.container.resolve(token);
|
|
103
|
+
}
|
|
104
|
+
fetch = (req) => {
|
|
105
|
+
if (!this.initialized)
|
|
106
|
+
return this.initAndFetch(req);
|
|
107
|
+
if (!this.compiled)
|
|
108
|
+
this.compilePipelines();
|
|
109
|
+
const r = req;
|
|
110
|
+
let pathname, search;
|
|
111
|
+
if (r._pathname !== undefined) {
|
|
112
|
+
pathname = r._pathname;
|
|
113
|
+
search = r._search ?? '';
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
const parsed = fastUrlParse(req.url);
|
|
117
|
+
pathname = parsed.pathname;
|
|
118
|
+
search = parsed.search;
|
|
119
|
+
}
|
|
120
|
+
const ctx = this.createContext(req, search);
|
|
121
|
+
// Slow path: global middleware wraps router.match + per-route pipeline + handler.
|
|
122
|
+
// Errors (including NotFoundException from router) bubble through the onion so
|
|
123
|
+
// global middleware can observe them via try/catch around `await next()`.
|
|
124
|
+
if (this.compiledGlobalPipeline !== undefined) {
|
|
125
|
+
return this.handleWithGlobalPipeline(this.compiledGlobalPipeline, pathname, ctx, req);
|
|
126
|
+
}
|
|
127
|
+
const matched = this.router.match(req.method, pathname);
|
|
128
|
+
if (!matched) {
|
|
129
|
+
return this.handleError(new NotFoundException(`Cannot ${req.method} ${pathname}`), req);
|
|
130
|
+
}
|
|
131
|
+
ctx.params = matched.params;
|
|
132
|
+
// Has per-route middleware → async path
|
|
133
|
+
if (matched.compiledPipeline) {
|
|
134
|
+
return this.handleWithPipeline(matched, ctx, req);
|
|
135
|
+
}
|
|
136
|
+
// Sync fast path - no global pipeline, no per-route pipeline
|
|
137
|
+
try {
|
|
138
|
+
const result = matched.handler(ctx);
|
|
139
|
+
if (result instanceof Promise) {
|
|
140
|
+
return result
|
|
141
|
+
.then((value) => {
|
|
142
|
+
if (value != null && !(value instanceof Response) && !ctx.res._modified && req.method !== 'HEAD') {
|
|
143
|
+
return new Response(JSON.stringify(value), JSON_RESPONSE_INIT);
|
|
144
|
+
}
|
|
145
|
+
return this.finalizeResponse(value, ctx, req);
|
|
146
|
+
})
|
|
147
|
+
.catch((error) => this.handleError(error, req, ctx))
|
|
148
|
+
.finally(() => this.container.clearRequestScope());
|
|
149
|
+
}
|
|
150
|
+
// Inline JSON fast path
|
|
151
|
+
if (result != null && !(result instanceof Response) && !ctx.res._modified && req.method !== 'HEAD') {
|
|
152
|
+
this.container.clearRequestScope();
|
|
153
|
+
return new Response(JSON.stringify(result), JSON_RESPONSE_INIT);
|
|
154
|
+
}
|
|
155
|
+
const response = this.finalizeResponse(result, ctx, req);
|
|
156
|
+
this.container.clearRequestScope();
|
|
157
|
+
return response;
|
|
158
|
+
}
|
|
159
|
+
catch (error) {
|
|
160
|
+
this.container.clearRequestScope();
|
|
161
|
+
return this.handleError(error, req, ctx);
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
async init() {
|
|
165
|
+
if (this.initialized)
|
|
166
|
+
return;
|
|
167
|
+
return (this.initPromise ??= this.doInit());
|
|
168
|
+
}
|
|
169
|
+
async doInit() {
|
|
170
|
+
await this.container.initAll();
|
|
171
|
+
this.compilePipelines();
|
|
172
|
+
await this.container.bootstrapAll();
|
|
173
|
+
this.initialized = true;
|
|
174
|
+
}
|
|
175
|
+
async listen(port, hostnameOrAdapter, adapter) {
|
|
176
|
+
const hostname = typeof hostnameOrAdapter === 'string' ? hostnameOrAdapter : '0.0.0.0';
|
|
177
|
+
const cb = typeof hostnameOrAdapter === 'function' ? hostnameOrAdapter : adapter;
|
|
178
|
+
await this.init();
|
|
179
|
+
try {
|
|
180
|
+
if (cb) {
|
|
181
|
+
const result = await cb({ port, hostname, fetch: this.fetch, logger: this.logger });
|
|
182
|
+
if (result && typeof result.close === 'function') {
|
|
183
|
+
this.closeServer = () => result.close();
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
else if ('Bun' in globalThis) {
|
|
187
|
+
const server = globalThis.Bun.serve({ fetch: this.fetch, port, hostname });
|
|
188
|
+
this.closeServer = () => server.stop();
|
|
189
|
+
}
|
|
190
|
+
else if ('Deno' in globalThis) {
|
|
191
|
+
const server = globalThis.Deno.serve({ port, hostname, onListen: () => { } }, this.fetch);
|
|
192
|
+
this.closeServer = () => server.shutdown();
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
throw new Error('No runtime detected. Pass a server adapter to listen():\n' +
|
|
196
|
+
"import { serve } from '@miiajs/node-server'\n" +
|
|
197
|
+
'await app.listen(3000, serve)');
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
catch (error) {
|
|
201
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
202
|
+
this.logger.error(`Failed to start server on port ${port}: ${message}`);
|
|
203
|
+
throw error;
|
|
204
|
+
}
|
|
205
|
+
this.logger.log(`Listening on http://${hostname}:${port}`);
|
|
206
|
+
this.registerShutdownHandlers();
|
|
207
|
+
}
|
|
208
|
+
async destroy() {
|
|
209
|
+
// Unregister signal listeners we added so repeated listen()+destroy() in
|
|
210
|
+
// tests does not leak. Idempotent - no-op if registerShutdownHandlers
|
|
211
|
+
// was never called or shutdownHooks: false.
|
|
212
|
+
for (const { signal, listener } of this.registeredShutdownHandlers) {
|
|
213
|
+
process.off(signal, listener);
|
|
214
|
+
}
|
|
215
|
+
this.registeredShutdownHandlers = [];
|
|
216
|
+
// Allow re-registration on subsequent listen() (rare reload patterns).
|
|
217
|
+
this.shutdownHandlersRegistered = false;
|
|
218
|
+
await this.closeServer?.();
|
|
219
|
+
await this.container.destroyAll();
|
|
220
|
+
this.logger.log('Shutdown complete');
|
|
221
|
+
}
|
|
222
|
+
registerShutdownHandlers() {
|
|
223
|
+
if (this.shutdownHandlersRegistered)
|
|
224
|
+
return;
|
|
225
|
+
if (this.shutdownHooksOption === false)
|
|
226
|
+
return;
|
|
227
|
+
const requested = Array.isArray(this.shutdownHooksOption)
|
|
228
|
+
? this.shutdownHooksOption
|
|
229
|
+
: ['SIGTERM', 'SIGINT', 'SIGHUP'];
|
|
230
|
+
// Filter platform-incompatible signals. SIGHUP is not supported on Windows
|
|
231
|
+
// and process.once('SIGHUP', ...) emits a runtime warning there. Skip
|
|
232
|
+
// silently rather than warn or throw - users on Windows still get
|
|
233
|
+
// SIGTERM/SIGINT coverage from the default array.
|
|
234
|
+
const signals = requested.filter((sig) => {
|
|
235
|
+
if (process.platform === 'win32' && sig === 'SIGHUP')
|
|
236
|
+
return false;
|
|
237
|
+
return true;
|
|
238
|
+
});
|
|
239
|
+
if (signals.length === 0)
|
|
240
|
+
return;
|
|
241
|
+
this.shutdownHandlersRegistered = true;
|
|
242
|
+
const handler = async (signal) => {
|
|
243
|
+
if (this.shutdownInProgress)
|
|
244
|
+
return;
|
|
245
|
+
this.shutdownInProgress = true;
|
|
246
|
+
this.logger.log(`Received ${signal}, shutting down gracefully...`);
|
|
247
|
+
try {
|
|
248
|
+
await this.destroy();
|
|
249
|
+
process.exit(0);
|
|
250
|
+
}
|
|
251
|
+
catch (err) {
|
|
252
|
+
this.logger.error(`Shutdown failed: ${err instanceof Error ? (err.stack ?? err.message) : String(err)}`);
|
|
253
|
+
process.exit(1);
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
for (const signal of signals) {
|
|
257
|
+
const listener = () => {
|
|
258
|
+
void handler(signal);
|
|
259
|
+
};
|
|
260
|
+
process.once(signal, listener);
|
|
261
|
+
this.registeredShutdownHandlers.push({ signal, listener });
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
async initAndFetch(req) {
|
|
265
|
+
await this.init();
|
|
266
|
+
return this.fetch(req);
|
|
267
|
+
}
|
|
268
|
+
// ─── Private ─────────────────────────────────────────────────
|
|
269
|
+
finalizeResponse(result, ctx, req) {
|
|
270
|
+
if (result instanceof Response) {
|
|
271
|
+
if (req.method === 'HEAD') {
|
|
272
|
+
return new Response(null, { status: result.status, headers: result.headers });
|
|
273
|
+
}
|
|
274
|
+
return result;
|
|
275
|
+
}
|
|
276
|
+
if (req.method === 'HEAD') {
|
|
277
|
+
if (result != null && !ctx.res.getHeaders().has('content-type')) {
|
|
278
|
+
ctx.res.header('Content-Type', 'application/json');
|
|
279
|
+
}
|
|
280
|
+
return new Response(null, {
|
|
281
|
+
status: ctx.res.getStatus(),
|
|
282
|
+
headers: ctx.res.getHeaders(),
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
if (result != null) {
|
|
286
|
+
if (!ctx.res.getHeaders().has('content-type')) {
|
|
287
|
+
ctx.res.json(result);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
return ctx.res.build();
|
|
291
|
+
}
|
|
292
|
+
async handleWithPipeline(matched, ctx, req) {
|
|
293
|
+
try {
|
|
294
|
+
let rawResult = undefined;
|
|
295
|
+
await matched.compiledPipeline(ctx, async () => {
|
|
296
|
+
const result = matched.handler(ctx);
|
|
297
|
+
rawResult = result instanceof Promise ? await result : result;
|
|
298
|
+
});
|
|
299
|
+
return this.finalizePipelineResult(rawResult, ctx, req);
|
|
300
|
+
}
|
|
301
|
+
catch (error) {
|
|
302
|
+
return this.handleError(error, req, ctx);
|
|
303
|
+
}
|
|
304
|
+
finally {
|
|
305
|
+
this.container.clearRequestScope();
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
async handleWithGlobalPipeline(globalPipeline, pathname, ctx, req) {
|
|
309
|
+
let rawResult = undefined;
|
|
310
|
+
try {
|
|
311
|
+
await globalPipeline(ctx, async () => {
|
|
312
|
+
const matched = this.router.match(req.method, pathname);
|
|
313
|
+
if (!matched)
|
|
314
|
+
throw new NotFoundException(`Cannot ${req.method} ${pathname}`);
|
|
315
|
+
ctx.params = matched.params;
|
|
316
|
+
if (matched.compiledPipeline) {
|
|
317
|
+
await matched.compiledPipeline(ctx, async () => {
|
|
318
|
+
const result = matched.handler(ctx);
|
|
319
|
+
rawResult = result instanceof Promise ? await result : result;
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
else {
|
|
323
|
+
const result = matched.handler(ctx);
|
|
324
|
+
rawResult = result instanceof Promise ? await result : result;
|
|
325
|
+
}
|
|
326
|
+
});
|
|
327
|
+
return this.finalizePipelineResult(rawResult, ctx, req);
|
|
328
|
+
}
|
|
329
|
+
catch (error) {
|
|
330
|
+
return this.handleError(error, req, ctx);
|
|
331
|
+
}
|
|
332
|
+
finally {
|
|
333
|
+
this.container.clearRequestScope();
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
// Shared tail for both handleWithPipeline and handleWithGlobalPipeline.
|
|
337
|
+
// Pure - does NOT touch the container (lifecycle owned by the caller's finally).
|
|
338
|
+
finalizePipelineResult(rawResult, ctx, req) {
|
|
339
|
+
// Response returned directly by handler
|
|
340
|
+
if (rawResult instanceof Response) {
|
|
341
|
+
if (req.method === 'HEAD') {
|
|
342
|
+
return new Response(null, { status: rawResult.status, headers: rawResult.headers });
|
|
343
|
+
}
|
|
344
|
+
return rawResult;
|
|
345
|
+
}
|
|
346
|
+
// Fast path: middleware didn't touch response, handler returned data
|
|
347
|
+
if (rawResult != null && !ctx.res._modified && req.method !== 'HEAD') {
|
|
348
|
+
return new Response(JSON.stringify(rawResult), JSON_RESPONSE_INIT);
|
|
349
|
+
}
|
|
350
|
+
// Normal path: middleware modified response (or handler returned null/undefined)
|
|
351
|
+
if (rawResult != null && !ctx.res.getHeaders().has('content-type')) {
|
|
352
|
+
ctx.res.json(rawResult);
|
|
353
|
+
}
|
|
354
|
+
if (req.method === 'HEAD') {
|
|
355
|
+
return new Response(null, {
|
|
356
|
+
status: ctx.res.getStatus(),
|
|
357
|
+
headers: ctx.res.getHeaders(),
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
return ctx.res.build();
|
|
361
|
+
}
|
|
362
|
+
compilePipelines() {
|
|
363
|
+
this.compiledGlobalPipeline = this.globalMiddlewares.length > 0 ? compose(this.globalMiddlewares) : undefined;
|
|
364
|
+
const globalGuards = this.globalGuards.map((guardCtor) => {
|
|
365
|
+
if (!this.container.has(guardCtor)) {
|
|
366
|
+
this.container.register(guardCtor, () => new guardCtor(), 'singleton');
|
|
367
|
+
}
|
|
368
|
+
const instance = this.container.resolve(guardCtor);
|
|
369
|
+
const middleware = guardToMiddleware((ctx) => instance.canActivate(ctx));
|
|
370
|
+
return { guardClass: guardCtor, middleware };
|
|
371
|
+
});
|
|
372
|
+
this.router.compileAll(globalGuards);
|
|
373
|
+
this.compiled = true;
|
|
374
|
+
}
|
|
375
|
+
createContext(req, search) {
|
|
376
|
+
let _query = null;
|
|
377
|
+
let _rawQuery = null;
|
|
378
|
+
let _jsonPromise = null;
|
|
379
|
+
let _textPromise = null;
|
|
380
|
+
return {
|
|
381
|
+
req,
|
|
382
|
+
res: new ResponseBuilder(),
|
|
383
|
+
params: {},
|
|
384
|
+
get query() {
|
|
385
|
+
if (_query === null) {
|
|
386
|
+
_rawQuery ??= new URLSearchParams(search);
|
|
387
|
+
_query = Object.fromEntries(_rawQuery);
|
|
388
|
+
}
|
|
389
|
+
return _query;
|
|
390
|
+
},
|
|
391
|
+
set query(v) {
|
|
392
|
+
_query = v;
|
|
393
|
+
},
|
|
394
|
+
get rawQuery() {
|
|
395
|
+
_rawQuery ??= new URLSearchParams(search);
|
|
396
|
+
return _rawQuery;
|
|
397
|
+
},
|
|
398
|
+
set rawQuery(v) {
|
|
399
|
+
_rawQuery = v;
|
|
400
|
+
},
|
|
401
|
+
json() {
|
|
402
|
+
return (_jsonPromise ??= req.json());
|
|
403
|
+
},
|
|
404
|
+
text() {
|
|
405
|
+
return (_textPromise ??= req.text());
|
|
406
|
+
},
|
|
407
|
+
_setBody(value) {
|
|
408
|
+
_jsonPromise = Promise.resolve(value);
|
|
409
|
+
},
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
isLoggerService(value) {
|
|
413
|
+
return typeof value.log === 'function';
|
|
414
|
+
}
|
|
415
|
+
handleError(error, req, ctx) {
|
|
416
|
+
let httpError;
|
|
417
|
+
if (error instanceof HttpException) {
|
|
418
|
+
httpError = error;
|
|
419
|
+
}
|
|
420
|
+
else {
|
|
421
|
+
this.logger.error('Unhandled error', error instanceof Error ? error.stack : String(error), 'RequestHandler');
|
|
422
|
+
httpError = new InternalServerException();
|
|
423
|
+
}
|
|
424
|
+
// Preserve middleware-set headers (CORS, X-Request-Id, tracing, Set-Cookie, ...)
|
|
425
|
+
// Defensive copy - ResponseBuilder.getHeaders() returns the internal ref via ensureHeaders().
|
|
426
|
+
const headers = new Headers(ctx?.res.getHeaders());
|
|
427
|
+
for (const name of BODY_HEADERS_TO_STRIP)
|
|
428
|
+
headers.delete(name);
|
|
429
|
+
headers.set('Content-Type', 'application/json');
|
|
430
|
+
const body = req?.method === 'HEAD' ? null : JSON.stringify(httpError.toJSON());
|
|
431
|
+
return new Response(body, {
|
|
432
|
+
status: httpError.statusCode,
|
|
433
|
+
headers,
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
/** Lightweight URL parse for HTTP request URLs (always have pathname, never have fragment) */
|
|
438
|
+
function fastUrlParse(url) {
|
|
439
|
+
const pathStart = url.indexOf('/', url.indexOf('//') + 2);
|
|
440
|
+
const searchStart = url.indexOf('?', pathStart);
|
|
441
|
+
if (searchStart === -1) {
|
|
442
|
+
return { pathname: url.substring(pathStart), search: '' };
|
|
443
|
+
}
|
|
444
|
+
return {
|
|
445
|
+
pathname: url.substring(pathStart, searchStart),
|
|
446
|
+
search: url.substring(searchStart + 1),
|
|
447
|
+
};
|
|
448
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