@fluojs/platform-express 1.0.0-beta.6 → 1.0.0-beta.7

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 (3) hide show
  1. package/README.ko.md +10 -2
  2. package/README.md +11 -2
  3. package/package.json +4 -4
package/README.ko.md CHANGED
@@ -39,6 +39,8 @@ const app = await fluoFactory.create(AppModule, {
39
39
  await app.listen();
40
40
  ```
41
41
 
42
+ `createExpressAdapter()`는 기본 port로 `3000`을 사용하며 `process.env.PORT`를 읽지 않습니다. 잘못된 explicit port 값은 adapter setup 중 throw됩니다.
43
+
42
44
  ## 주요 패턴
43
45
 
44
46
  ### 스트리밍 응답 처리 (SSE)
@@ -56,7 +58,7 @@ async streamEvents(@Res() res: FrameworkResponse) {
56
58
  ```
57
59
 
58
60
  ### 바디 파싱 및 멀티파트
59
- `rawBody` 멀티파트 form-data 파싱을 즉시 사용할 있습니다. 어댑터를 직접 생성할 때는 멀티파트 제한을 두 번째 인자로 전달하고, `bootstrapExpressApplication(...)` 및 `runExpressApplication(...)`에서는 같은 설정을 `options.multipart` 아래에 전달하면 됩니다. `multipart.maxTotalSize`를 지정하지 않으면 `maxBodySize`가 기본 총 멀티파트 payload 제한으로 사용되어 HTTP 어댑터 간 바디 크기 제한 동작이 portable하게 유지됩니다.
61
+ `rawBody` 보존은 opt-in(`rawBody: true`)이며 multipart request는 `rawBody`를 노출하지 않습니다. 어댑터를 직접 생성할 때는 멀티파트 제한을 두 번째 인자로 전달하고, `bootstrapExpressApplication(...)` 및 `runExpressApplication(...)`에서는 같은 설정을 `options.multipart` 아래에 전달하면 됩니다. `multipart.maxTotalSize`를 지정하지 않으면 `maxBodySize`가 기본 총 멀티파트 payload 제한으로 사용되어 HTTP 어댑터 간 바디 크기 제한 동작이 portable하게 유지됩니다.
60
62
 
61
63
  ```typescript
62
64
  const adapter = createExpressAdapter(
@@ -71,7 +73,7 @@ const adapter = createExpressAdapter(
71
73
  ```
72
74
 
73
75
  ### 안전한 fallback을 포함한 Native Route Registration
74
- 이제 어댑터는 의미 보존이 가능한 명시적 HTTP 메서드 라우트를 Express Router에 사전 등록하면서도, 실제 요청 처리는 계속 공유 fluo dispatcher를 통해 수행합니다.
76
+ 어댑터는 의미 보존이 가능한 명시적 `GET`, `POST`, `PUT`, `PATCH`, `DELETE`, `HEAD` route를 Express Router에 사전 등록하면서도, 실제 요청 처리는 계속 공유 fluo dispatcher를 통해 수행합니다.
75
77
 
76
78
  의미 보존이 가능한 unversioned route에서는 Express가 미리 고른 descriptor와 params를 공유 dispatcher에 전달하므로 singleton-safe handler는 dispatcher fast path에서 완료될 수 있고 그 밖의 handler는 duplicate route matching 없이 fallback되며, guards, interceptors, observers, body parsing, raw body 캡처, SSE, 오류 응답은 기존과 같은 framework-owned 실행 경로를 유지합니다.
77
79
 
@@ -87,13 +89,19 @@ const adapter = createExpressAdapter(
87
89
  - **경로 정규화 parity**: duplicate slash 변형처럼 Express Router와 fluo의 정규화 방식이 다를 수 있는 요청도 fallback dispatch를 통해 fluo의 normalized route contract를 유지합니다.
88
90
  - **버저닝 parity**: Express Router가 최초 path match를 하더라도 header/media-type/custom version 선택은 계속 dispatcher가 최종 결정합니다.
89
91
  - **Middleware rewrite parity**: App middleware가 method/path를 rewrite하면 native handoff는 무효화되고 rewrite된 요청을 기준으로 다시 매칭합니다.
92
+ - **응답 serialization parity**: String response는 기본적으로 `text/plain`, object/array는 JSON, binary payload는 `application/octet-stream`으로 serialize되며 `set-cookie` 값은 병합됩니다.
93
+ - **Startup과 shutdown**: 어댑터는 HTTP/HTTPS startup, retry option에 따른 `EADDRINUSE` 재시도, close 시 socket drain, shutdown timeout 이후 force-close를 지원합니다.
90
94
 
91
95
  ## 공개 API 개요
92
96
 
93
97
  - `createExpressAdapter(options)`: Express HTTP 어댑터를 위한 팩토리입니다.
94
98
  - `bootstrapExpressApplication(module, options)`: 수동 제어를 위한 고급 부트스트랩 헬퍼입니다.
95
99
  - `runExpressApplication(module, options)`: 시그널 연결을 포함한 빠른 시작을 위한 호환 헬퍼입니다. timeout/실패 시에는 해당 상태를 로그와 `process.exitCode`로 보고하고, 최종 프로세스 종료는 주변 호스트에 맡깁니다.
100
+ - `isExpressMultipartTooLargeError(error)`: adapter error shape 전반에서 multipart limit 감지를 정규화합니다.
96
101
  - `ExpressHttpApplicationAdapter`: 핵심 어댑터 구현 클래스입니다.
102
+ - Option type: `ExpressAdapterOptions`, `BootstrapExpressApplicationOptions`, `RunExpressApplicationOptions`, `CorsInput`, `ExpressApplicationSignal`.
103
+
104
+ `createExpressAdapter(options, multipartOptions?)`는 `host`, `https`, `maxBodySize`, `port`, `rawBody`, `retryDelayMs`, `retryLimit`, `shutdownTimeoutMs`를 지원합니다. `bootstrapExpressApplication(...)`과 `runExpressApplication(...)`은 `cors`, `globalPrefix`, `globalPrefixExclude`, `logger`, `middleware`, `multipart`, `securityHeaders`, `forceExitTimeoutMs`, `shutdownSignals`도 받습니다.
97
105
 
98
106
  ## 관련 패키지
99
107
 
package/README.md CHANGED
@@ -39,6 +39,8 @@ const app = await fluoFactory.create(AppModule, {
39
39
  await app.listen();
40
40
  ```
41
41
 
42
+ `createExpressAdapter()` defaults to port `3000` and does not read `process.env.PORT`; invalid explicit port values throw during adapter setup.
43
+
42
44
  ## Common Patterns
43
45
 
44
46
  ### Handling Streaming Responses (SSE)
@@ -56,7 +58,7 @@ async streamEvents(@Res() res: FrameworkResponse) {
56
58
  ```
57
59
 
58
60
  ### Body Parsing and Multipart
59
- The adapter handles `rawBody` and multipart form-data parsing out of the box. When you construct the adapter directly, pass multipart limits as the second argument. `bootstrapExpressApplication(...)` and `runExpressApplication(...)` accept the same multipart settings under `options.multipart`. When `multipart.maxTotalSize` is not set, `maxBodySize` becomes the default total multipart payload cap so body-size limits stay portable across HTTP adapters.
61
+ `rawBody` preservation is opt-in (`rawBody: true`), and multipart requests do not expose `rawBody`. When you construct the adapter directly, pass multipart limits as the second argument. `bootstrapExpressApplication(...)` and `runExpressApplication(...)` accept the same multipart settings under `options.multipart`. When `multipart.maxTotalSize` is not set, `maxBodySize` becomes the default total multipart payload cap so body-size limits stay portable across HTTP adapters.
60
62
 
61
63
  ```typescript
62
64
  const adapter = createExpressAdapter(
@@ -71,7 +73,7 @@ const adapter = createExpressAdapter(
71
73
  ```
72
74
 
73
75
  ### Native Route Registration with Safe Fallback
74
- The adapter now pre-registers semantically safe Express Router handlers for explicit HTTP methods and still dispatches those requests through the shared fluo dispatcher.
76
+ The adapter pre-registers semantically safe Express Router handlers for explicit `GET`, `POST`, `PUT`, `PATCH`, `DELETE`, and `HEAD` routes and still dispatches those requests through the shared fluo dispatcher.
75
77
 
76
78
  For semantically safe unversioned routes, Express hands the pre-matched descriptor and params to the shared dispatcher so eligible singleton-safe handlers can complete on the dispatcher fast path and other handlers can fall back without duplicate route matching, while guards, interceptors, observers, body parsing, raw body capture, SSE, and error responses stay on the same framework-owned execution path.
77
79
 
@@ -86,13 +88,20 @@ To avoid changing documented fluo semantics, overlapping same-shape param routes
86
88
  - **OPTIONS ownership parity**: The adapter prevents Express Router from auto-answering `OPTIONS` for native routes, so unsupported methods still fall through to fluo dispatcher semantics and `@All(...)` handlers can continue to own `OPTIONS` when defined.
87
89
  - **Path normalization parity**: Requests that Express Router does not normalize the same way as fluo, such as duplicate-slash variants, still resolve through fallback dispatch so fluo's normalized route contract is preserved.
88
90
  - **Versioning parity**: Header/media-type/custom version selection remains dispatcher-owned even when Express Router handles the initial path match.
91
+ - **Middleware rewrite parity**: App middleware that rewrites method or path invalidates native handoff and rematches the rewritten request.
92
+ - **Response serialization parity**: String responses default to `text/plain`, objects/arrays serialize as JSON, binary payloads default to `application/octet-stream`, and `set-cookie` values are merged.
93
+ - **Startup and shutdown**: The adapter supports HTTP/HTTPS startup, retries `EADDRINUSE` according to retry options, drains sockets on close, and can force-close connections after shutdown timeout.
89
94
 
90
95
  ## Public API Overview
91
96
 
92
97
  - `createExpressAdapter(options)`: Factory for the Express HTTP adapter.
93
98
  - `bootstrapExpressApplication(module, options)`: Advanced bootstrap helper for manual control.
94
99
  - `runExpressApplication(module, options)`: Compatibility helper for quick startup with signal wiring. On timeout/failure it reports the condition through logging and `process.exitCode`, while leaving final process termination to the surrounding host.
100
+ - `isExpressMultipartTooLargeError(error)`: Normalizes multipart limit detection across adapter error shapes.
95
101
  - `ExpressHttpApplicationAdapter`: The core adapter implementation class.
102
+ - Option types: `ExpressAdapterOptions`, `BootstrapExpressApplicationOptions`, `RunExpressApplicationOptions`, `CorsInput`, `ExpressApplicationSignal`.
103
+
104
+ `createExpressAdapter(options, multipartOptions?)` supports `host`, `https`, `maxBodySize`, `port`, `rawBody`, `retryDelayMs`, `retryLimit`, and `shutdownTimeoutMs`. `bootstrapExpressApplication(...)` and `runExpressApplication(...)` also accept `cors`, `globalPrefix`, `globalPrefixExclude`, `logger`, `middleware`, `multipart`, `securityHeaders`, `forceExitTimeoutMs`, and `shutdownSignals`.
96
105
 
97
106
  ## Related Packages
98
107
 
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "platform",
9
9
  "server"
10
10
  ],
11
- "version": "1.0.0-beta.6",
11
+ "version": "1.0.0-beta.7",
12
12
  "private": false,
13
13
  "license": "MIT",
14
14
  "repository": {
@@ -36,13 +36,13 @@
36
36
  ],
37
37
  "dependencies": {
38
38
  "express": "^5.1.0",
39
- "@fluojs/http": "^1.0.0-beta.7",
40
- "@fluojs/runtime": "^1.0.0-beta.8"
39
+ "@fluojs/http": "^1.0.0-beta.10",
40
+ "@fluojs/runtime": "^1.0.0-beta.12"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/express": "^5.0.3",
44
44
  "vitest": "^3.2.4",
45
- "@fluojs/di": "^1.0.0-beta.5"
45
+ "@fluojs/di": "^1.0.0-beta.7"
46
46
  },
47
47
  "scripts": {
48
48
  "prebuild": "node ../../tooling/scripts/clean-dist.mjs",