@fluojs/runtime 1.0.0-beta.1 → 1.0.0-beta.2

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/README.ko.md CHANGED
@@ -27,7 +27,7 @@ npm install @fluojs/runtime
27
27
  - **fluo 애플리케이션 부트스트랩**: 모듈을 실행 중인 HTTP 서버나 마이크로서비스로 변환할 때.
28
28
  - **DI 및 라이프사이클 오케스트레이션**: 모듈 그래프 컴파일, 프로바이더 연결 및 애플리케이션 훅(`onModuleInit`, `onApplicationBootstrap`)을 관리할 때.
29
29
  - **독립형 컨텍스트 생성**: HTTP 서버는 필요 없지만 DI가 필요한 CLI 태스크, 마이그레이션 또는 워커를 실행할 때.
30
- - **진단 및 검사**: 기계 읽기 가능한 형태나 Mermaid 기반의 모듈 그래프 토폴로지를 내보낼 때.
30
+ - **진단 및 검사**: CLI 내보내기와 Studio 소유 그래프 보기/렌더링을 위한 기계 읽기 가능한 플랫폼 snapshot을 생산할 때.
31
31
 
32
32
  ## 퀵 스타트
33
33
 
@@ -125,7 +125,9 @@ class UsersModule {}
125
125
  - 요청 바디 파싱은 Web 표준 요청과 Node 기반 요청 모두에서 바이트가 스트리밍되는 동안 `maxBodySize`를 강제합니다.
126
126
  - 멀티파트 파싱은 누적 바디 크기가 설정된 `multipart.maxTotalSize`를 넘으면 즉시 거부되며, 런타임 어댑터는 별도 재정의가 없으면 이 한도를 `maxBodySize`와 동일하게 맞춥니다.
127
127
  - 응답 스트림 백프레셔 헬퍼는 `drain`, `close`, `error` 중 어느 경우에도 `waitForDrain()`을 완료시켜 끊어진 연결에서 스트리밍 작성기가 멈추지 않도록 합니다.
128
+ - 런타임 health 모듈은 bootstrap이 ready로 표시하기 전까지 `/ready`를 HTTP 503과 `starting`으로 보고하며, 애플리케이션/컨텍스트 종료가 시작되는 즉시, 종료 시도가 실패하더라도 다시 `starting`으로 내려갑니다.
128
129
  - 시그널 기반 종료 헬퍼는 bounded drain semantics를 유지하면서 timeout/실패 상황을 로그와 `process.exitCode`로 보고하지만, 최종 프로세스 종료 소유권은 주변 호스트 런타임에 남겨 둡니다.
130
+ - 플랫폼 snapshot 생산은 런타임에 남아 있고, 그래프 보기와 Mermaid 렌더링은 CLI 및 자동화 호출자가 소비하는 Studio 소유 계약입니다.
129
131
 
130
132
  ## 공개 API 개요
131
133
 
@@ -134,6 +136,7 @@ class UsersModule {}
134
136
  - `Application`: `ApplicationContext`를 확장하며 `listen()`, `dispatch()`, `state`를 포함합니다.
135
137
  - `ApplicationContext`: `get<T>(token)`, `close()` 기능을 제공하며 `container`와 `modules`에 접근할 수 있습니다.
136
138
  - `LifecycleHooks`: `OnModuleInit`, `OnApplicationBootstrap`, `OnModuleDestroy`, `OnApplicationShutdown`를 묶는 편의 union 타입입니다.
139
+ - `createHealthModule(options)`: bootstrap 및 shutdown 라이프사이클 전이에 맞춰 readiness marker를 관리하는 런타임 소유 `/health`, `/ready` 모듈 팩토리입니다.
137
140
  - `defineModule(cls, metadata)`: 프로그래밍 방식의 모듈 정의 헬퍼입니다.
138
141
  - `bootstrapApplication(options)`: 저수준 비동기 부트스트랩 함수입니다.
139
142
 
@@ -174,6 +177,7 @@ import {
174
177
  - [@fluojs/di](../di): 의존성 주입(DI) 컨테이너 구현체.
175
178
  - [@fluojs/http](../http): HTTP 라우팅, 컨트롤러 및 디스패처.
176
179
  - [@fluojs/platform-nodejs](../platform-nodejs): 공식 Node.js HTTP 어댑터.
180
+ - [@fluojs/studio](../studio): 런타임이 생산한 snapshot을 위한 뷰어 및 렌더링 헬퍼.
177
181
 
178
182
  ## 예제 소스
179
183
 
package/README.md CHANGED
@@ -27,7 +27,7 @@ Use this package when you need to:
27
27
  - **Bootstrap a fluo application**: Convert your modules into a running HTTP server or microservice.
28
28
  - **Orchestrate DI and Lifecycle**: Manage module-graph compilation, provider wiring, and application hooks (`onModuleInit`, `onApplicationBootstrap`).
29
29
  - **Create Standalone Contexts**: Run CLI tasks, migrations, or workers that need DI but not an HTTP server.
30
- - **Diagnostic Inspection**: Export machine-readable or Mermaid-based module graph topology.
30
+ - **Diagnostic Inspection**: Produce machine-readable platform snapshots for CLI export and Studio-owned graph viewing/rendering.
31
31
 
32
32
  ## Quick Start
33
33
 
@@ -125,7 +125,9 @@ class UsersModule {}
125
125
  - Request body parsing enforces `maxBodySize` while bytes are still streaming for both Web-standard and Node-backed requests.
126
126
  - Multipart parsing rejects payloads when the cumulative body size exceeds the configured `multipart.maxTotalSize`; runtime adapters default that limit to `maxBodySize` unless you override it.
127
127
  - Response stream backpressure helpers settle `waitForDrain()` on `drain`, `close`, or `error` so streaming writers do not hang on dead connections.
128
+ - Runtime health modules report `/ready` as `starting` with HTTP 503 until bootstrap marks them ready, and they return to `starting` as soon as application/context shutdown begins, including failed shutdown attempts.
128
129
  - Signal-driven shutdown helpers preserve bounded drain semantics, log timeout/failure conditions, and set `process.exitCode` when shutdown does not finish cleanly, but they leave final process termination ownership to the surrounding host runtime.
130
+ - Platform snapshot production stays in runtime; graph viewing and Mermaid rendering are Studio-owned contracts consumed by CLI and automation callers.
129
131
 
130
132
  ## Public API Overview
131
133
 
@@ -134,6 +136,7 @@ class UsersModule {}
134
136
  - `Application`: Extends `ApplicationContext` with `listen()`, `dispatch()`, and `state`.
135
137
  - `ApplicationContext`: Provides `get<T>(token)`, `close()`, and access to `container` and `modules`.
136
138
  - `LifecycleHooks`: Convenience union covering `OnModuleInit`, `OnApplicationBootstrap`, `OnModuleDestroy`, and `OnApplicationShutdown`.
139
+ - `createHealthModule(options)`: Runtime-owned `/health` and `/ready` module factory whose readiness marker follows bootstrap and shutdown lifecycle transitions.
137
140
  - `defineModule(cls, metadata)`: Programmatic module definition helper.
138
141
  - `bootstrapApplication(options)`: Lower-level async bootstrap function.
139
142
 
@@ -174,6 +177,7 @@ Lower-level Node compression internals stay behind the `@fluojs/runtime/internal
174
177
  - [@fluojs/di](../di): Dependency injection container implementation.
175
178
  - [@fluojs/http](../http): HTTP routing, controllers, and dispatcher.
176
179
  - [@fluojs/platform-nodejs](../platform-nodejs): Official Node.js HTTP adapter.
180
+ - [@fluojs/studio](../studio): Viewer and rendering helpers for runtime-produced snapshots.
177
181
 
178
182
  ## Example Sources
179
183
 
@@ -1 +1 @@
1
- {"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../src/bootstrap.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EACV,kBAAkB,EAClB,WAAW,EAEX,uBAAuB,EAGvB,2BAA2B,EAC3B,sBAAsB,EACtB,eAAe,EAEf,wBAAwB,EACxB,+BAA+B,EAC/B,yBAAyB,EAEzB,gBAAgB,EAChB,UAAU,EAKX,MAAM,YAAY,CAAC;AAoTpB;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,UAAU,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,EAAE,gBAAgB,GAAG,CAAC,CAIjG;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,GAAE,sBAA2B,GAAG,eAAe,CA0B7G;AAkgBD;;;;;;;GAOG;AACH,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,2BAA2B,GAAG,OAAO,CAAC,WAAW,CAAC,CA8GrG;AAED;;GAEG;AACH,qBAAa,WAAW;IACtB;;;;;;;OAOG;WACU,MAAM,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,GAAE,wBAA6B,GAAG,OAAO,CAAC,WAAW,CAAC;IAOzG;;;;;;;OAOG;WACU,wBAAwB,CACnC,UAAU,EAAE,UAAU,EACtB,OAAO,GAAE,+BAAoC,GAC5C,OAAO,CAAC,kBAAkB,CAAC;IA6F9B;;;;;;;;OAQG;WACU,kBAAkB,CAC7B,UAAU,EAAE,UAAU,EACtB,OAAO,GAAE,yBAA8B,GACtC,OAAO,CAAC,uBAAuB,CAAC;CAuBpC;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,WAAW,oBAAc,CAAC"}
1
+ {"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../src/bootstrap.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EACV,kBAAkB,EAClB,WAAW,EAEX,uBAAuB,EAGvB,2BAA2B,EAC3B,sBAAsB,EACtB,eAAe,EAEf,wBAAwB,EACxB,+BAA+B,EAC/B,yBAAyB,EAEzB,gBAAgB,EAChB,UAAU,EAKX,MAAM,YAAY,CAAC;AA0TpB;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,UAAU,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,EAAE,gBAAgB,GAAG,CAAC,CAIjG;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,GAAE,sBAA2B,GAAG,eAAe,CA0B7G;AAogBD;;;;;;;GAOG;AACH,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,2BAA2B,GAAG,OAAO,CAAC,WAAW,CAAC,CAiHrG;AAED;;GAEG;AACH,qBAAa,WAAW;IACtB;;;;;;;OAOG;WACU,MAAM,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,GAAE,wBAA6B,GAAG,OAAO,CAAC,WAAW,CAAC;IAOzG;;;;;;;OAOG;WACU,wBAAwB,CACnC,UAAU,EAAE,UAAU,EACtB,OAAO,GAAE,+BAAoC,GAC5C,OAAO,CAAC,kBAAkB,CAAC;IAgG9B;;;;;;;;OAQG;WACU,kBAAkB,CAC7B,UAAU,EAAE,UAAU,EACtB,OAAO,GAAE,yBAA8B,GACtC,OAAO,CAAC,uBAAuB,CAAC;CAuBpC;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,WAAW,oBAAc,CAAC"}
package/dist/bootstrap.js CHANGED
@@ -67,6 +67,7 @@ async function runCleanupCallbacks(cleanups) {
67
67
  }
68
68
  async function closeRuntimeResources(options) {
69
69
  const errors = [];
70
+ resetReadinessState(options.modules);
70
71
  errors.push(...(await runCleanupCallbacks(options.runtimeCleanup)));
71
72
  try {
72
73
  await runShutdownHooks(options.lifecycleInstances, options.signal);
@@ -91,6 +92,7 @@ async function closeRuntimeResources(options) {
91
92
  }
92
93
  async function runBootstrapFailureCleanup(options) {
93
94
  const errors = [];
95
+ resetReadinessState(options.modules);
94
96
  errors.push(...(await runCleanupCallbacks(options.runtimeCleanup)));
95
97
  if (options.lifecycleInstances.length > 0) {
96
98
  try {
@@ -363,6 +365,7 @@ class FluoApplication {
363
365
  adapter: this.adapter,
364
366
  container: this.container,
365
367
  lifecycleInstances: this.lifecycleInstances,
368
+ modules: this.modules,
366
369
  runtimeCleanup: this.runtimeCleanup,
367
370
  signal
368
371
  });
@@ -403,6 +406,7 @@ class FluoApplicationContext {
403
406
  await closeRuntimeResources({
404
407
  container: this.container,
405
408
  lifecycleInstances: this.lifecycleInstances,
409
+ modules: this.modules,
406
410
  runtimeCleanup: this.runtimeCleanup,
407
411
  signal
408
412
  });
@@ -654,6 +658,7 @@ export async function bootstrapApplication(options) {
654
658
  const logger = options.logger ?? createConsoleApplicationLogger();
655
659
  let lifecycleInstances = [];
656
660
  let bootstrappedContainer;
661
+ let bootstrappedModules = [];
657
662
  const hasHttpAdapter = options.adapter !== undefined;
658
663
  const adapter = options.adapter ?? {
659
664
  async close() {},
@@ -689,6 +694,7 @@ export async function bootstrapApplication(options) {
689
694
  });
690
695
  }
691
696
  bootstrappedContainer = bootstrapped.container;
697
+ bootstrappedModules = bootstrapped.modules;
692
698
  const resolveLifecycleStart = timingEnabled ? runtimePerformance.now() : 0;
693
699
  lifecycleInstances = await resolveBootstrapLifecycleInstances(bootstrapped, runtimeProviders);
694
700
  lifecycleInstances.push({
@@ -726,6 +732,7 @@ export async function bootstrapApplication(options) {
726
732
  container: bootstrappedContainer,
727
733
  lifecycleInstances,
728
734
  logger,
735
+ modules: bootstrappedModules,
729
736
  runtimeCleanup,
730
737
  scope: 'application'
731
738
  });
@@ -764,6 +771,7 @@ export class FluoFactory {
764
771
  const logger = options.logger ?? createConsoleApplicationLogger();
765
772
  let lifecycleInstances = [];
766
773
  let bootstrappedContainer;
774
+ let bootstrappedModules = [];
767
775
  const runtimeCleanup = [];
768
776
  const platformShell = createRuntimePlatformShell(options.platform?.components);
769
777
  const timingEnabled = options.diagnostics?.timing === true;
@@ -794,6 +802,7 @@ export class FluoFactory {
794
802
  });
795
803
  }
796
804
  bootstrappedContainer = bootstrapped.container;
805
+ bootstrappedModules = bootstrapped.modules;
797
806
  const resolveLifecycleStart = timingEnabled ? runtimePerformance.now() : 0;
798
807
  lifecycleInstances = await resolveBootstrapLifecycleInstances(bootstrapped, runtimeProviders);
799
808
  lifecycleInstances.push({
@@ -823,6 +832,7 @@ export class FluoFactory {
823
832
  container: bootstrappedContainer,
824
833
  lifecycleInstances,
825
834
  logger,
835
+ modules: bootstrappedModules,
826
836
  runtimeCleanup,
827
837
  scope: 'application context'
828
838
  });
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "module-graph",
10
10
  "orchestration"
11
11
  ],
12
- "version": "1.0.0-beta.1",
12
+ "version": "1.0.0-beta.2",
13
13
  "private": false,
14
14
  "license": "MIT",
15
15
  "repository": {
@@ -67,14 +67,14 @@
67
67
  "dist"
68
68
  ],
69
69
  "dependencies": {
70
+ "@fluojs/config": "^1.0.0-beta.2",
70
71
  "@fluojs/core": "^1.0.0-beta.1",
71
- "@fluojs/config": "^1.0.0-beta.1",
72
- "@fluojs/di": "^1.0.0-beta.1",
72
+ "@fluojs/di": "^1.0.0-beta.2",
73
73
  "@fluojs/http": "^1.0.0-beta.1"
74
74
  },
75
75
  "devDependencies": {
76
76
  "vitest": "^3.2.4",
77
- "@fluojs/serialization": "^1.0.0-beta.1"
77
+ "@fluojs/serialization": "^1.0.0-beta.2"
78
78
  },
79
79
  "scripts": {
80
80
  "prebuild": "node ../../tooling/scripts/clean-dist.mjs",