@fluojs/runtime 1.0.0-beta.11 → 1.0.0-beta.12
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 +9 -4
- package/README.md +9 -4
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +83 -18
- package/dist/health/diagnostics.d.ts.map +1 -1
- package/dist/health/diagnostics.js +4 -4
- package/dist/health/health.d.ts +1 -1
- package/dist/health/health.d.ts.map +1 -1
- package/dist/health/health.js +1 -1
- package/dist/http-adapter-shared.d.ts.map +1 -1
- package/dist/http-adapter-shared.js +31 -4
- package/dist/internal/core-metadata.d.ts +84 -0
- package/dist/internal/core-metadata.d.ts.map +1 -0
- package/dist/internal/core-metadata.js +83 -0
- package/dist/internal/http-runtime.d.ts +5 -0
- package/dist/internal/http-runtime.d.ts.map +1 -0
- package/dist/internal/http-runtime.js +4 -0
- package/dist/internal.d.ts +1 -1
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +1 -1
- package/dist/module-graph.d.ts +1 -1
- package/dist/module-graph.d.ts.map +1 -1
- package/dist/module-graph.js +5 -5
- package/dist/tokens.d.ts +5 -0
- package/dist/tokens.d.ts.map +1 -1
- package/dist/tokens.js +6 -1
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/web.js +3 -3
- package/package.json +5 -5
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 task, script 또는 worker를 실행할 때.
|
|
30
|
-
- **진단 및 검사**: CLI
|
|
30
|
+
- **진단 및 검사**: CLI 내보내기를 위한 기계 읽기 가능한 플랫폼 snapshot과 diagnostic issue를 생산하되, 그래프 보기와 Mermaid 표현은 Studio에 맡길 때.
|
|
31
31
|
|
|
32
32
|
## 퀵 스타트
|
|
33
33
|
|
|
@@ -130,6 +130,9 @@ class UsersModule {}
|
|
|
130
130
|
- `multi: true` provider token은 context cache에 memoize되지 않습니다. 각 `get()` 호출은 DI로 위임되어 컨테이너가 새로운 contribution 배열을 조립하며, 각 contribution 자체는 해당 provider scope에 따라 재사용됩니다.
|
|
131
131
|
- `duplicateProviderPolicy`가 `warn` 또는 `ignore`일 때 context cache 적격성과 lifecycle hook 실행은 bootstrap이 선택한 effective winning provider를 기준으로 결정됩니다. stale losing provider는 cache entry나 lifecycle hook을 만들지 않습니다.
|
|
132
132
|
- 애플리케이션 또는 컨텍스트 bootstrap이 런타임 리소스나 lifecycle instance 생성 이후 실패하면 fluo는 readiness를 초기화하고, 등록된 runtime cleanup callback을 실행하며, 그 시점까지 해석된 instance의 shutdown hook을 `bootstrap-failed`로 호출하고, 컨테이너를 dispose하고, cleanup 실패를 로그로 남긴 뒤 원래 bootstrap error를 다시 던집니다.
|
|
133
|
+
- `Application.listen()`과 microservice `listen()`은 shutdown과 직렬화됩니다. 겹치는 startup 호출은 같은 in-flight startup을 공유하고, shutdown은 진행 중인 startup이 끝날 때까지 기다리며, shutdown과 경합한 startup은 close 시작 이후 shell을 다시 `ready`로 전이할 수 없습니다.
|
|
134
|
+
- 종료 시그널 등록 실패는 사용자가 관찰할 수 있습니다. `runNodeApplication(...)`, `bootstrapNodeApplication(...)`, adapter 소유 runtime helper는 이미 시작된 애플리케이션을 `bootstrap-failed`로 닫고, close 실패가 있으면 별도로 로그로 남기며, 원래 registration error로 reject합니다.
|
|
135
|
+
- 종료 시그널 등록 해제 실패는 애플리케이션 close를 건너뛰지 않습니다. `app.close()`는 항상 adapter shutdown, lifecycle hook, runtime cleanup callback, container dispose까지 계속 진행합니다. close 자체가 성공하면 unregistration error로 reject하고, close도 실패하면 두 실패를 모두 담은 aggregate로 reject합니다.
|
|
133
136
|
- 연결된 microservice는 부모 `Application`이 소유하는 child입니다. `startAllMicroservices()`는 순차적으로 시작하며 이후 child 시작이 실패하면 이미 시작된 child를 `bootstrap-failed`로 rollback하고, `Application.close(signal)`은 부모 lifecycle hook, adapter 종료, container dispose보다 먼저 연결된 child를 닫습니다.
|
|
134
137
|
- `FluoFactory.createMicroservice()`는 cleanup이 실패해도 원래 bootstrap/runtime 해석 오류를 보존하고 cleanup 실패는 별도로 로그로 남깁니다.
|
|
135
138
|
- Bootstrap은 독립적인 singleton lifecycle provider를 병렬로 해석한 뒤 lifecycle hook은 결정적인 provider 순서대로 실행합니다.
|
|
@@ -137,8 +140,9 @@ class UsersModule {}
|
|
|
137
140
|
- `createNodeHttpAdapter(...)`, `bootstrapNodeApplication(...)`, `runNodeApplication(...)`는 `maxBodySize`를 0 이상의 정수 바이트 수로만 받으며, 값이 잘못되면 어댑터 생성/부트스트랩 단계에서 즉시 실패합니다.
|
|
138
141
|
- 응답 스트림 백프레셔 헬퍼는 `drain`, `close`, `error` 중 어느 경우에도 `waitForDrain()`을 완료시켜 끊어진 연결에서 스트리밍 작성기가 멈추지 않도록 합니다.
|
|
139
142
|
- 런타임 health 모듈은 bootstrap이 ready로 표시하기 전까지 `/ready`를 HTTP 503과 `starting`으로 보고하며, 애플리케이션/컨텍스트 종료가 시작되는 즉시, 종료 시도가 실패하더라도 다시 `starting`으로 내려갑니다.
|
|
143
|
+
- 런타임 health module readiness check는 현재 `RequestContext`를 받으므로, public integration이 internal runtime token을 import하지 않고도 runtime-exposed status provider를 해석할 수 있습니다.
|
|
140
144
|
- 시그널 기반 종료 헬퍼는 bounded drain semantics를 유지하면서 timeout/실패 상황을 로그와 `process.exitCode`로 보고하지만, 최종 프로세스 종료 소유권은 주변 호스트 런타임에 남겨 둡니다.
|
|
141
|
-
- 플랫폼 snapshot 생산은 런타임에 남아 있고, 그래프
|
|
145
|
+
- 플랫폼 snapshot 및 diagnostic issue 생산은 런타임에 남아 있고, 그래프 보기, filtering 표현, Mermaid 렌더링은 CLI 및 자동화 호출자가 소비하는 Studio 소유 계약입니다.
|
|
142
146
|
- 모듈 그래프 컴파일 결과 캐시는 `moduleGraphCache: true`를 통한 opt-in입니다. 캐시 항목은 root module identity, runtime provider, validation token, core metadata version, compile algorithm version으로 식별되며, 성공한 컴파일만 저장하고 호출자 mutation이 이후 bootstrap을 오염시키지 않도록 격리된 그래프 복사본을 반환합니다.
|
|
143
147
|
|
|
144
148
|
## 공개 API 개요
|
|
@@ -150,10 +154,11 @@ class UsersModule {}
|
|
|
150
154
|
- `LifecycleHooks`: `OnModuleInit`, `OnApplicationBootstrap`, `OnModuleDestroy`, `OnApplicationShutdown`를 묶는 편의 union 타입입니다.
|
|
151
155
|
- `HealthModule.forRoot(options)`: bootstrap 및 shutdown 라이프사이클 전이에 맞춰 readiness marker를 관리하는 런타임 소유 `/health`, `/ready` 모듈 파사드입니다.
|
|
152
156
|
- `createHealthModule(options)`: 같은 런타임 health module 계약을 위한 deprecated compatibility helper입니다. 애플리케이션-facing module import에서는 `HealthModule.forRoot(...)`를 우선 사용하세요.
|
|
157
|
+
- `ReadinessCheck`: runtime health module이 사용하는 function type입니다. Check는 `/ready` request context를 받고 boolean 또는 promise를 반환합니다.
|
|
153
158
|
- `defineModule(cls, metadata)`: 프로그래밍 방식의 모듈 정의 헬퍼입니다.
|
|
154
159
|
- `bootstrapApplication(options)`: 저수준 비동기 부트스트랩 함수입니다.
|
|
155
160
|
- `bootstrapModule(...)`: 저수준 module graph bootstrap helper입니다.
|
|
156
|
-
- `createBootstrapTimingDiagnostics(...)`, `createRuntimeDiagnosticsGraph(...)`: CLI/support tooling을 위한 runtime diagnostics helper입니다.
|
|
161
|
+
- `createBootstrapTimingDiagnostics(...)`, `createRuntimeDiagnosticsGraph(...)`: CLI/support tooling을 위한 runtime 소유 diagnostics snapshot helper입니다. 이 helper들은 기계 읽기 가능한 데이터를 생산하며, Studio가 viewer parsing, graph presentation, Mermaid rendering을 소유합니다.
|
|
157
162
|
- `createRequestAbortContext(...)`, `trackActiveRequestTransaction(...)`, `untrackActiveRequestTransaction(...)`: runtime-aware integration이 사용하는 request abort 및 active transaction helper입니다.
|
|
158
163
|
|
|
159
164
|
## 플랫폼 전용 서브경로
|
|
@@ -215,7 +220,7 @@ const jsonLogger = createJsonApplicationLogger();
|
|
|
215
220
|
- [@fluojs/di](../di): 의존성 주입(DI) 컨테이너 구현체.
|
|
216
221
|
- [@fluojs/http](../http): HTTP 라우팅, 컨트롤러 및 디스패처.
|
|
217
222
|
- [@fluojs/platform-nodejs](../platform-nodejs): 공식 Node.js HTTP 어댑터.
|
|
218
|
-
- [@fluojs/studio](../studio): 런타임이 생산한 snapshot
|
|
223
|
+
- [@fluojs/studio](../studio): 런타임이 생산한 snapshot과 diagnostic issue를 위한 viewer, filtering, rendering helper.
|
|
219
224
|
|
|
220
225
|
## 예제 소스
|
|
221
226
|
|
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, scripts, or workers that need DI but not an HTTP server.
|
|
30
|
-
- **Diagnostic Inspection**: Produce machine-readable platform snapshots for CLI export
|
|
30
|
+
- **Diagnostic Inspection**: Produce machine-readable platform snapshots and diagnostic issues for CLI export while leaving graph viewing and Mermaid presentation to Studio.
|
|
31
31
|
|
|
32
32
|
## Quick Start
|
|
33
33
|
|
|
@@ -130,6 +130,9 @@ class UsersModule {}
|
|
|
130
130
|
- `multi: true` provider tokens are not context-cache memoized: each `get()` call delegates to DI so the container can assemble a fresh contribution array while still reusing each contribution according to its own provider scope.
|
|
131
131
|
- When `duplicateProviderPolicy` is `warn` or `ignore`, context-cache eligibility and lifecycle hook execution are based on the effective winning provider selected by bootstrap; stale losing providers do not seed cache entries or lifecycle hooks.
|
|
132
132
|
- If application or context bootstrap fails after runtime resources or lifecycle instances have been created, fluo resets readiness, runs registered runtime cleanup callbacks, invokes shutdown hooks for instances resolved so far with `bootstrap-failed`, disposes the container, logs cleanup failures, and rethrows the original bootstrap error.
|
|
133
|
+
- `Application.listen()` and microservice `listen()` are serialized with shutdown: overlapping startup calls share the same in-flight startup, shutdown waits for in-flight startup to settle, and a startup that races with shutdown cannot transition the shell back to `ready` after close begins.
|
|
134
|
+
- Shutdown signal registration failures are user-observable: `runNodeApplication(...)`, `bootstrapNodeApplication(...)`, and adapter-owned runtime helpers close the already-started application with `bootstrap-failed`, log any close failure separately, and reject with the original registration error.
|
|
135
|
+
- Shutdown signal unregistration failures do not skip application close: `app.close()` always continues through adapter shutdown, lifecycle hooks, runtime cleanup callbacks, and container disposal; if close otherwise succeeds it rejects with the unregistration error, and if close also fails it rejects with an aggregate containing both failures.
|
|
133
136
|
- Connected microservices are owned children of their parent `Application`: `startAllMicroservices()` starts them sequentially and rolls back already-started children with `bootstrap-failed` if a later child fails, while `Application.close(signal)` closes connected children before parent lifecycle hooks, adapter shutdown, and container disposal.
|
|
134
137
|
- `FluoFactory.createMicroservice()` preserves the original bootstrap/runtime-resolution error when cleanup fails and logs cleanup failures separately.
|
|
135
138
|
- Bootstrap resolves independent singleton lifecycle providers concurrently, then runs lifecycle hooks in deterministic provider order.
|
|
@@ -137,8 +140,9 @@ class UsersModule {}
|
|
|
137
140
|
- `createNodeHttpAdapter(...)`, `bootstrapNodeApplication(...)`, and `runNodeApplication(...)` accept `maxBodySize` only as a non-negative integer byte count and fail fast during adapter creation/bootstrap when the value is invalid.
|
|
138
141
|
- Response stream backpressure helpers settle `waitForDrain()` on `drain`, `close`, or `error` so streaming writers do not hang on dead connections.
|
|
139
142
|
- 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.
|
|
143
|
+
- Runtime health module readiness checks receive the current `RequestContext`, allowing public integrations to resolve runtime-exposed status providers without importing internal runtime tokens.
|
|
140
144
|
- 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.
|
|
141
|
-
- Platform snapshot production
|
|
145
|
+
- Platform snapshot and diagnostic issue production stay in runtime; graph viewing, filtering presentation, and Mermaid rendering are Studio-owned contracts consumed by CLI and automation callers.
|
|
142
146
|
- Module graph compile-result caching is opt-in through `moduleGraphCache: true`; it keys entries by root module identity, runtime providers, validation tokens, core metadata versions, and the compile algorithm version, caches only successful compilations, and returns isolated graph copies so caller mutations cannot poison later bootstraps.
|
|
143
147
|
|
|
144
148
|
## Public API Overview
|
|
@@ -150,10 +154,11 @@ class UsersModule {}
|
|
|
150
154
|
- `LifecycleHooks`: Convenience union covering `OnModuleInit`, `OnApplicationBootstrap`, `OnModuleDestroy`, and `OnApplicationShutdown`.
|
|
151
155
|
- `HealthModule.forRoot(options)`: Runtime-owned `/health` and `/ready` module facade whose readiness marker follows bootstrap and shutdown lifecycle transitions.
|
|
152
156
|
- `createHealthModule(options)`: Deprecated compatibility helper for the same runtime health module contract; prefer `HealthModule.forRoot(...)` in application-facing module imports.
|
|
157
|
+
- `ReadinessCheck`: Function type used by runtime health modules. Checks receive the `/ready` request context and return a boolean or promise.
|
|
153
158
|
- `defineModule(cls, metadata)`: Programmatic module definition helper.
|
|
154
159
|
- `bootstrapApplication(options)`: Lower-level async bootstrap function.
|
|
155
160
|
- `bootstrapModule(...)`: Lower-level module graph bootstrap helper.
|
|
156
|
-
- `createBootstrapTimingDiagnostics(...)`, `createRuntimeDiagnosticsGraph(...)`: Runtime diagnostics helpers for CLI/support tooling.
|
|
161
|
+
- `createBootstrapTimingDiagnostics(...)`, `createRuntimeDiagnosticsGraph(...)`: Runtime-owned diagnostics snapshot helpers for CLI/support tooling. They produce machine-readable data; Studio owns viewer parsing, graph presentation, and Mermaid rendering.
|
|
157
162
|
- `createRequestAbortContext(...)`, `trackActiveRequestTransaction(...)`, `untrackActiveRequestTransaction(...)`: Request abort and active transaction helpers used by runtime-aware integrations.
|
|
158
163
|
|
|
159
164
|
## Platform-Specific Subpaths
|
|
@@ -215,7 +220,7 @@ Lower-level Node compression internals stay behind the `@fluojs/runtime/internal
|
|
|
215
220
|
- [@fluojs/di](../di): Dependency injection container implementation.
|
|
216
221
|
- [@fluojs/http](../http): HTTP routing, controllers, and dispatcher.
|
|
217
222
|
- [@fluojs/platform-nodejs](../platform-nodejs): Official Node.js HTTP adapter.
|
|
218
|
-
- [@fluojs/studio](../studio): Viewer and rendering helpers for runtime-produced snapshots.
|
|
223
|
+
- [@fluojs/studio](../studio): Viewer, filtering, and rendering helpers for runtime-produced snapshots and diagnostic issues.
|
|
219
224
|
|
|
220
225
|
## Example Sources
|
|
221
226
|
|
package/dist/bootstrap.d.ts.map
CHANGED
|
@@ -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,EAGf,wBAAwB,EACxB,+BAA+B,EAC/B,yBAAyB,EAEzB,gBAAgB,EAChB,UAAU,
|
|
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,EAGf,wBAAwB,EACxB,+BAA+B,EAC/B,yBAAyB,EAEzB,gBAAgB,EAChB,UAAU,EAMX,MAAM,YAAY,CAAC;AAqcpB;;;;;;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,CA+B7G;AA0zBD;;;;;;;GAOG;AACH,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,2BAA2B,GAAG,OAAO,CAAC,WAAW,CAAC,CAsHrG;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;IAqG9B;;;;;;;;OAQG;WACU,kBAAkB,CAC7B,UAAU,EAAE,UAAU,EACtB,OAAO,GAAE,yBAA8B,GACtC,OAAO,CAAC,uBAAuB,CAAC;CA+BpC;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,WAAW,oBAAc,CAAC"}
|
package/dist/bootstrap.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { Container } from '@fluojs/di';
|
|
2
|
-
import { DefaultBinder } from '@fluojs/http/internal';
|
|
3
2
|
import { InvariantError } from '@fluojs/core';
|
|
4
|
-
import { defineModuleMetadata, getClassDiMetadata } from '@fluojs/core/internal';
|
|
5
3
|
import { createDispatcher, createHandlerMapping } from '@fluojs/http';
|
|
6
4
|
import { DuplicateProviderError } from './errors.js';
|
|
7
5
|
import { createBootstrapTimingDiagnostics } from './health/diagnostics.js';
|
|
6
|
+
import { defineRuntimeModuleMetadata, getRuntimeClassDiMetadata } from './internal/core-metadata.js';
|
|
7
|
+
import { RuntimeDefaultBinder } from './internal/http-runtime.js';
|
|
8
8
|
import { createConsoleApplicationLogger } from './logging/logger.js';
|
|
9
9
|
import { compileModuleGraph, providerToken } from './module-graph.js';
|
|
10
10
|
import { createRuntimePlatformShell } from './platform-shell.js';
|
|
11
|
-
import { APPLICATION_LOGGER, COMPILED_MODULES, HTTP_APPLICATION_ADAPTER, PLATFORM_SHELL, RUNTIME_CONTAINER } from './tokens.js';
|
|
11
|
+
import { APPLICATION_LOGGER, COMPILED_MODULES, HTTP_APPLICATION_ADAPTER, PLATFORM_SHELL, RUNTIME_CLEANUP_REGISTRATION, RUNTIME_CONTAINER } from './tokens.js';
|
|
12
12
|
const DEFAULT_MICROSERVICE_TOKEN = Symbol.for('fluo.microservices.service');
|
|
13
13
|
const runtimePerformance = globalThis.performance;
|
|
14
14
|
async function runExceptionFilters(filters, error, request, response, requestId) {
|
|
@@ -26,16 +26,16 @@ async function runExceptionFilters(filters, error, request, response, requestId)
|
|
|
26
26
|
}
|
|
27
27
|
function providerScope(provider) {
|
|
28
28
|
if (typeof provider === 'function') {
|
|
29
|
-
return
|
|
29
|
+
return getRuntimeClassDiMetadata(provider)?.scope ?? 'singleton';
|
|
30
30
|
}
|
|
31
31
|
if ('useValue' in provider) {
|
|
32
32
|
return 'singleton';
|
|
33
33
|
}
|
|
34
34
|
if ('useClass' in provider) {
|
|
35
|
-
return provider.scope ??
|
|
35
|
+
return provider.scope ?? getRuntimeClassDiMetadata(provider.useClass)?.scope ?? 'singleton';
|
|
36
36
|
}
|
|
37
37
|
if ('useFactory' in provider) {
|
|
38
|
-
return provider.scope ?? (provider.resolverClass ?
|
|
38
|
+
return provider.scope ?? (provider.resolverClass ? getRuntimeClassDiMetadata(provider.resolverClass)?.scope : undefined) ?? 'singleton';
|
|
39
39
|
}
|
|
40
40
|
return 'singleton';
|
|
41
41
|
}
|
|
@@ -65,6 +65,17 @@ async function runCleanupCallbacks(cleanups) {
|
|
|
65
65
|
}
|
|
66
66
|
return errors;
|
|
67
67
|
}
|
|
68
|
+
function createRuntimeCleanupRegistration(cleanups) {
|
|
69
|
+
return cleanup => {
|
|
70
|
+
cleanups.push(cleanup);
|
|
71
|
+
return () => {
|
|
72
|
+
const index = cleanups.indexOf(cleanup);
|
|
73
|
+
if (index >= 0) {
|
|
74
|
+
cleanups.splice(index, 1);
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
}
|
|
68
79
|
async function closeRuntimeResources(options) {
|
|
69
80
|
const errors = [];
|
|
70
81
|
resetReadinessState(options.modules);
|
|
@@ -315,7 +326,7 @@ function registerModuleMiddleware(container, modules) {
|
|
|
315
326
|
* @returns The same `moduleType` reference for fluent helper composition.
|
|
316
327
|
*/
|
|
317
328
|
export function defineModule(moduleType, definition) {
|
|
318
|
-
|
|
329
|
+
defineRuntimeModuleMetadata(moduleType, definition);
|
|
319
330
|
return moduleType;
|
|
320
331
|
}
|
|
321
332
|
|
|
@@ -357,6 +368,7 @@ class FluoApplication {
|
|
|
357
368
|
applicationState = 'bootstrapped';
|
|
358
369
|
closed = false;
|
|
359
370
|
closingPromise;
|
|
371
|
+
listenPromise;
|
|
360
372
|
contextResolutionCache = new Map();
|
|
361
373
|
lifecycleInstances;
|
|
362
374
|
connectedMicroservices = [];
|
|
@@ -443,12 +455,27 @@ class FluoApplication {
|
|
|
443
455
|
* 준비 검사를 통과한 뒤 어댑터에 바인딩을 위임하고 상태를 `ready`로 전이한다.
|
|
444
456
|
*/
|
|
445
457
|
async listen() {
|
|
446
|
-
if (this.applicationState === 'closed') {
|
|
458
|
+
if (this.closed || this.closingPromise || this.applicationState === 'closed') {
|
|
447
459
|
throw new InvariantError('Application cannot listen after it has been closed.');
|
|
448
460
|
}
|
|
449
461
|
if (this.applicationState === 'ready') {
|
|
450
462
|
return;
|
|
451
463
|
}
|
|
464
|
+
if (this.listenPromise) {
|
|
465
|
+
await this.listenPromise;
|
|
466
|
+
return;
|
|
467
|
+
}
|
|
468
|
+
this.listenPromise = this.startListening();
|
|
469
|
+
try {
|
|
470
|
+
await this.listenPromise;
|
|
471
|
+
} finally {
|
|
472
|
+
this.listenPromise = undefined;
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
async startListening() {
|
|
476
|
+
if (this.closed || this.closingPromise || this.applicationState === 'closed') {
|
|
477
|
+
throw new InvariantError('Application cannot listen after it has been closed.');
|
|
478
|
+
}
|
|
452
479
|
if (!this.hasHttpAdapter) {
|
|
453
480
|
throw new InvariantError('Application cannot listen without an HTTP adapter. Provide options.adapter for HTTP startup, or use createApplicationContext() for adapterless DI-only bootstrap.');
|
|
454
481
|
}
|
|
@@ -459,6 +486,9 @@ class FluoApplication {
|
|
|
459
486
|
this.logger.error('Failed to start the HTTP adapter.', error, 'FluoApplication');
|
|
460
487
|
throw error;
|
|
461
488
|
}
|
|
489
|
+
if (this.closed || this.closingPromise) {
|
|
490
|
+
throw new InvariantError('Application startup was interrupted by shutdown.');
|
|
491
|
+
}
|
|
462
492
|
this.applicationState = 'ready';
|
|
463
493
|
this.logger.log('fluo application successfully started.', 'FluoApplication');
|
|
464
494
|
}
|
|
@@ -479,6 +509,11 @@ class FluoApplication {
|
|
|
479
509
|
}
|
|
480
510
|
this.closingPromise = (async () => {
|
|
481
511
|
const errors = [];
|
|
512
|
+
if (this.listenPromise) {
|
|
513
|
+
try {
|
|
514
|
+
await this.listenPromise;
|
|
515
|
+
} catch {}
|
|
516
|
+
}
|
|
482
517
|
try {
|
|
483
518
|
await this.closeConnectedMicroservices(signal);
|
|
484
519
|
} catch (error) {
|
|
@@ -559,6 +594,7 @@ class FluoApplicationContext {
|
|
|
559
594
|
class FluoMicroserviceApplication {
|
|
560
595
|
closed = false;
|
|
561
596
|
closingPromise;
|
|
597
|
+
listenPromise;
|
|
562
598
|
microserviceState = 'bootstrapped';
|
|
563
599
|
constructor(context, logger, runtime, closeContextOnClose) {
|
|
564
600
|
this.context = context;
|
|
@@ -582,13 +618,31 @@ class FluoMicroserviceApplication {
|
|
|
582
618
|
return this.context.get(token);
|
|
583
619
|
}
|
|
584
620
|
async listen() {
|
|
585
|
-
if (this.microserviceState === 'closed') {
|
|
621
|
+
if (this.closed || this.closingPromise || this.microserviceState === 'closed') {
|
|
586
622
|
throw new InvariantError('Microservice cannot listen after it has been closed.');
|
|
587
623
|
}
|
|
588
624
|
if (this.microserviceState === 'ready') {
|
|
589
625
|
return;
|
|
590
626
|
}
|
|
627
|
+
if (this.listenPromise) {
|
|
628
|
+
await this.listenPromise;
|
|
629
|
+
return;
|
|
630
|
+
}
|
|
631
|
+
this.listenPromise = this.startListening();
|
|
632
|
+
try {
|
|
633
|
+
await this.listenPromise;
|
|
634
|
+
} finally {
|
|
635
|
+
this.listenPromise = undefined;
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
async startListening() {
|
|
639
|
+
if (this.closed || this.closingPromise || this.microserviceState === 'closed') {
|
|
640
|
+
throw new InvariantError('Microservice cannot listen after it has been closed.');
|
|
641
|
+
}
|
|
591
642
|
await this.runtime.listen();
|
|
643
|
+
if (this.closed || this.closingPromise) {
|
|
644
|
+
throw new InvariantError('Microservice startup was interrupted by shutdown.');
|
|
645
|
+
}
|
|
592
646
|
this.microserviceState = 'ready';
|
|
593
647
|
this.logger.log('fluo microservice successfully started.', 'FluoFactory');
|
|
594
648
|
}
|
|
@@ -613,6 +667,11 @@ class FluoMicroserviceApplication {
|
|
|
613
667
|
return;
|
|
614
668
|
}
|
|
615
669
|
this.closingPromise = (async () => {
|
|
670
|
+
if (this.listenPromise) {
|
|
671
|
+
try {
|
|
672
|
+
await this.listenPromise;
|
|
673
|
+
} catch {}
|
|
674
|
+
}
|
|
616
675
|
if (this.closeContextOnClose) {
|
|
617
676
|
const errors = [];
|
|
618
677
|
try {
|
|
@@ -825,13 +884,16 @@ function createRuntimeProviders(options, logger) {
|
|
|
825
884
|
useValue: logger
|
|
826
885
|
}];
|
|
827
886
|
}
|
|
828
|
-
function registerRuntimeBootstrapTokens(bootstrapped, adapter, platformShell) {
|
|
887
|
+
function registerRuntimeBootstrapTokens(bootstrapped, adapter, platformShell, runtimeCleanup) {
|
|
829
888
|
registerRuntimeContextTokens(bootstrapped, {
|
|
830
889
|
provide: HTTP_APPLICATION_ADAPTER,
|
|
831
890
|
useValue: adapter
|
|
832
891
|
}, {
|
|
833
892
|
provide: PLATFORM_SHELL,
|
|
834
893
|
useValue: platformShell
|
|
894
|
+
}, {
|
|
895
|
+
provide: RUNTIME_CLEANUP_REGISTRATION,
|
|
896
|
+
useValue: createRuntimeCleanupRegistration(runtimeCleanup)
|
|
835
897
|
});
|
|
836
898
|
}
|
|
837
899
|
function registerRuntimeContextTokens(bootstrapped, ...providers) {
|
|
@@ -843,10 +905,13 @@ function registerRuntimeContextTokens(bootstrapped, ...providers) {
|
|
|
843
905
|
useValue: bootstrapped.modules
|
|
844
906
|
});
|
|
845
907
|
}
|
|
846
|
-
function registerRuntimeApplicationContextTokens(bootstrapped, platformShell) {
|
|
908
|
+
function registerRuntimeApplicationContextTokens(bootstrapped, platformShell, runtimeCleanup) {
|
|
847
909
|
registerRuntimeContextTokens(bootstrapped, {
|
|
848
910
|
provide: PLATFORM_SHELL,
|
|
849
911
|
useValue: platformShell
|
|
912
|
+
}, {
|
|
913
|
+
provide: RUNTIME_CLEANUP_REGISTRATION,
|
|
914
|
+
useValue: createRuntimeCleanupRegistration(runtimeCleanup)
|
|
850
915
|
});
|
|
851
916
|
}
|
|
852
917
|
async function resolveBootstrapLifecycleInstances(bootstrapped, resolvedInstances) {
|
|
@@ -880,7 +945,7 @@ function createRuntimeDispatcherOptions(bootstrapped, options, handlerMapping, e
|
|
|
880
945
|
rootContainer: bootstrapped.container
|
|
881
946
|
};
|
|
882
947
|
if (converters.length > 0) {
|
|
883
|
-
dispatcherOptions.binder = new
|
|
948
|
+
dispatcherOptions.binder = new RuntimeDefaultBinder(converters);
|
|
884
949
|
}
|
|
885
950
|
if (errorHandler) {
|
|
886
951
|
dispatcherOptions.onError = errorHandler;
|
|
@@ -929,7 +994,7 @@ export async function bootstrapApplication(options) {
|
|
|
929
994
|
logger,
|
|
930
995
|
moduleGraphCache: options.moduleGraphCache,
|
|
931
996
|
providers: runtimeProviders,
|
|
932
|
-
validationTokens: [RUNTIME_CONTAINER, COMPILED_MODULES, HTTP_APPLICATION_ADAPTER]
|
|
997
|
+
validationTokens: [RUNTIME_CONTAINER, COMPILED_MODULES, HTTP_APPLICATION_ADAPTER, RUNTIME_CLEANUP_REGISTRATION]
|
|
933
998
|
});
|
|
934
999
|
if (timingEnabled) {
|
|
935
1000
|
timingPhases.push({
|
|
@@ -938,7 +1003,7 @@ export async function bootstrapApplication(options) {
|
|
|
938
1003
|
});
|
|
939
1004
|
}
|
|
940
1005
|
const registerTokensStart = timingEnabled ? runtimePerformance.now() : 0;
|
|
941
|
-
registerRuntimeBootstrapTokens(bootstrapped, adapter, platformShell);
|
|
1006
|
+
registerRuntimeBootstrapTokens(bootstrapped, adapter, platformShell, runtimeCleanup);
|
|
942
1007
|
if (timingEnabled) {
|
|
943
1008
|
timingPhases.push({
|
|
944
1009
|
durationMs: runtimePerformance.now() - registerTokensStart,
|
|
@@ -977,7 +1042,7 @@ export async function bootstrapApplication(options) {
|
|
|
977
1042
|
});
|
|
978
1043
|
}
|
|
979
1044
|
const bootstrapTiming = timingEnabled ? createBootstrapTimingDiagnostics(timingPhases, runtimePerformance.now() - timingStart) : undefined;
|
|
980
|
-
return new FluoApplication(bootstrapped.container, bootstrapped.modules, options.rootModule, dispatcher, bootstrapTiming, adapter, hasHttpAdapter, platformShell, lifecycleInstances, logger, runtimeCleanup, createContextCacheableTokenSet(bootstrapped.effectiveProviders, [RUNTIME_CONTAINER, COMPILED_MODULES, HTTP_APPLICATION_ADAPTER, PLATFORM_SHELL]));
|
|
1045
|
+
return new FluoApplication(bootstrapped.container, bootstrapped.modules, options.rootModule, dispatcher, bootstrapTiming, adapter, hasHttpAdapter, platformShell, lifecycleInstances, logger, runtimeCleanup, createContextCacheableTokenSet(bootstrapped.effectiveProviders, [RUNTIME_CONTAINER, COMPILED_MODULES, HTTP_APPLICATION_ADAPTER, PLATFORM_SHELL, RUNTIME_CLEANUP_REGISTRATION]));
|
|
981
1046
|
} catch (error) {
|
|
982
1047
|
logger.error('Failed to bootstrap the fluo application. Check the error below for what failed and how to fix it.', error, 'FluoFactory');
|
|
983
1048
|
await runBootstrapFailureCleanup({
|
|
@@ -1038,7 +1103,7 @@ export class FluoFactory {
|
|
|
1038
1103
|
logger,
|
|
1039
1104
|
moduleGraphCache: options.moduleGraphCache,
|
|
1040
1105
|
providers: runtimeProviders,
|
|
1041
|
-
validationTokens: [RUNTIME_CONTAINER, COMPILED_MODULES]
|
|
1106
|
+
validationTokens: [RUNTIME_CONTAINER, COMPILED_MODULES, RUNTIME_CLEANUP_REGISTRATION]
|
|
1042
1107
|
});
|
|
1043
1108
|
if (timingEnabled) {
|
|
1044
1109
|
timingPhases.push({
|
|
@@ -1047,7 +1112,7 @@ export class FluoFactory {
|
|
|
1047
1112
|
});
|
|
1048
1113
|
}
|
|
1049
1114
|
const registerTokensStart = timingEnabled ? runtimePerformance.now() : 0;
|
|
1050
|
-
registerRuntimeApplicationContextTokens(bootstrapped, platformShell);
|
|
1115
|
+
registerRuntimeApplicationContextTokens(bootstrapped, platformShell, runtimeCleanup);
|
|
1051
1116
|
if (timingEnabled) {
|
|
1052
1117
|
timingPhases.push({
|
|
1053
1118
|
durationMs: runtimePerformance.now() - registerTokensStart,
|
|
@@ -1078,7 +1143,7 @@ export class FluoFactory {
|
|
|
1078
1143
|
});
|
|
1079
1144
|
}
|
|
1080
1145
|
const bootstrapTiming = timingEnabled ? createBootstrapTimingDiagnostics(timingPhases, runtimePerformance.now() - timingStart) : undefined;
|
|
1081
|
-
return new FluoApplicationContext(bootstrapped.container, bootstrapped.modules, rootModule, bootstrapTiming, lifecycleInstances, runtimeCleanup, createContextCacheableTokenSet(bootstrapped.effectiveProviders, [RUNTIME_CONTAINER, COMPILED_MODULES, PLATFORM_SHELL]));
|
|
1146
|
+
return new FluoApplicationContext(bootstrapped.container, bootstrapped.modules, rootModule, bootstrapTiming, lifecycleInstances, runtimeCleanup, createContextCacheableTokenSet(bootstrapped.effectiveProviders, [RUNTIME_CONTAINER, COMPILED_MODULES, PLATFORM_SHELL, RUNTIME_CLEANUP_REGISTRATION]));
|
|
1082
1147
|
} catch (error) {
|
|
1083
1148
|
logger.error('Failed to bootstrap application context. Check the error below for what failed and how to fix it.', error, 'FluoFactory');
|
|
1084
1149
|
await runBootstrapFailureCleanup({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../../src/health/diagnostics.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../../src/health/diagnostics.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAY,KAAK,EAAE,MAAM,YAAY,CAAC;AAGlD,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9D;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,CAAC,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,wBAAwB,EAAE,CAAC;IACpC,aAAa,EAAE,+BAA+B,CAAC;CAChD;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,SAAS,EAAE,0BAA0B,EAAE,CAAC;IACxC,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,UAAU,CAAC;IACjD,KAAK,EAAE,KAAK,CAAC;IACb,KAAK,EAAE,OAAO,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@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getRuntimeClassDiMetadata } from '../internal/core-metadata.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Describes the runtime diagnostics graph contract.
|
|
@@ -56,16 +56,16 @@ function providerShape(provider) {
|
|
|
56
56
|
}
|
|
57
57
|
function providerScope(provider) {
|
|
58
58
|
if (typeof provider === 'function') {
|
|
59
|
-
return
|
|
59
|
+
return getRuntimeClassDiMetadata(provider)?.scope ?? 'singleton';
|
|
60
60
|
}
|
|
61
61
|
if ('useValue' in provider || 'useExisting' in provider) {
|
|
62
62
|
return 'singleton';
|
|
63
63
|
}
|
|
64
64
|
if ('useFactory' in provider) {
|
|
65
|
-
return provider.scope ?? (provider.resolverClass ?
|
|
65
|
+
return provider.scope ?? (provider.resolverClass ? getRuntimeClassDiMetadata(provider.resolverClass)?.scope : undefined) ?? 'singleton';
|
|
66
66
|
}
|
|
67
67
|
if ('useClass' in provider) {
|
|
68
|
-
return provider.scope ??
|
|
68
|
+
return provider.scope ?? getRuntimeClassDiMetadata(provider.useClass)?.scope ?? 'singleton';
|
|
69
69
|
}
|
|
70
70
|
return 'singleton';
|
|
71
71
|
}
|
package/dist/health/health.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ export interface HealthModuleOptions {
|
|
|
28
28
|
/**
|
|
29
29
|
* Defines the readiness check type.
|
|
30
30
|
*/
|
|
31
|
-
export type ReadinessCheck = () => boolean | Promise<boolean>;
|
|
31
|
+
export type ReadinessCheck = (ctx: import('@fluojs/http').RequestContext) => boolean | Promise<boolean>;
|
|
32
32
|
/**
|
|
33
33
|
* Runtime health module facade for application module imports.
|
|
34
34
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"health.d.ts","sourceRoot":"","sources":["../../src/health/health.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C;;GAEG;AACH,MAAM,WA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,OAAO,cAAc,EAAE,cAAc,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAkFxG;;GAEG;AACH,qBAAa,YAAY;IACvB;;;;;OAKG;IACH,MAAM,CAAC,OAAO,CAAC,OAAO,GAAE,mBAAwB,GAAG,UAAU;CAG9D;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,mBAAwB,GAAG,UAAU,CAEhF"}
|
package/dist/health/health.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-adapter-shared.d.ts","sourceRoot":"","sources":["../src/http-adapter-shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,WAAW,EAEhB,KAAK,sBAAsB,EAE3B,KAAK,cAAc,EAEnB,KAAK,sBAAsB,EAC5B,MAAM,cAAc,CAAC;AAItB,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAEvG;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,WAAW,CAAC;AAE3E;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,wDAAwD;IACxD,UAAU,EAAE,MAAM,CAAC;IACnB,4CAA4C;IAC5C,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,0CAA0C;IAC1C,IAAI,CAAC,EAAE,oBAAoB,CAAC;IAC5B,2CAA2C;IAC3C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gEAAgE;IAChE,mBAAmB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,6DAA6D;IAC7D,UAAU,CAAC,EAAE,cAAc,EAAE,CAAC;IAC9B,qCAAqC;IACrC,eAAe,CAAC,EAAE,KAAK,GAAG,sBAAsB,CAAC;CAClD;AAED;;GAEG;AACH,MAAM,WAAW,sCACf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AC,CAAC;AAEzB,KAAK,6BAA6B,GAAG,sBAAsB,GAAG;IAC5D,eAAe,IAAI,uBAAuB,CAAC;CAC5C,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAsB,+BAA+B,CACnD,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,sCAAsC,EAC/C,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,WAAW,CAAC,CAQtB;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,4BAA4B,GAAG,cAAc,EAAE,CAkBnG;AAED;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,uBAAuB,GAAG,MAAM,CAItF;AAED;;;;;;;;GAQG;AACH,wBAAsB,yBAAyB,CAC7C,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,gCAAgC,EACzC,OAAO,EAAE,6BAA6B,GACrC,OAAO,CAAC,WAAW,CAAC,CA+EtB"}
|
|
@@ -106,15 +106,42 @@ export async function runHttpAdapterApplication(rootModule, options, adapter) {
|
|
|
106
106
|
}
|
|
107
107
|
throw error;
|
|
108
108
|
}
|
|
109
|
-
|
|
109
|
+
let unregisterShutdownSignals;
|
|
110
|
+
try {
|
|
111
|
+
unregisterShutdownSignals = options.shutdownRegistration?.(app, logger, options.forceExitTimeoutMs) ?? (() => {});
|
|
112
|
+
} catch (error) {
|
|
113
|
+
logger.error('Failed to register shutdown signals.', error, 'FluoFactory');
|
|
114
|
+
try {
|
|
115
|
+
await app.close('bootstrap-failed');
|
|
116
|
+
} catch (closeError) {
|
|
117
|
+
logger.error('Failed to close application after shutdown registration failure.', closeError, 'FluoFactory');
|
|
118
|
+
}
|
|
119
|
+
throw error;
|
|
120
|
+
}
|
|
110
121
|
const close = app.close.bind(app);
|
|
111
122
|
let shutdownSignalsUnregistered = false;
|
|
112
123
|
app.close = async signal => {
|
|
124
|
+
let unregisterError;
|
|
113
125
|
if (!shutdownSignalsUnregistered) {
|
|
114
|
-
|
|
115
|
-
|
|
126
|
+
try {
|
|
127
|
+
unregisterShutdownSignals();
|
|
128
|
+
} catch (error) {
|
|
129
|
+
unregisterError = error;
|
|
130
|
+
} finally {
|
|
131
|
+
shutdownSignalsUnregistered = true;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
try {
|
|
135
|
+
await close(signal);
|
|
136
|
+
} catch (closeError) {
|
|
137
|
+
if (unregisterError) {
|
|
138
|
+
throw new AggregateError([unregisterError, closeError], 'Application close failed during shutdown signal cleanup.');
|
|
139
|
+
}
|
|
140
|
+
throw closeError;
|
|
141
|
+
}
|
|
142
|
+
if (unregisterError) {
|
|
143
|
+
throw unregisterError;
|
|
116
144
|
}
|
|
117
|
-
await close(signal);
|
|
118
145
|
};
|
|
119
146
|
return app;
|
|
120
147
|
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { Token } from '@fluojs/core';
|
|
2
|
+
import type { Scope } from '@fluojs/di';
|
|
3
|
+
import type { ModuleDefinition } from '../types.js';
|
|
4
|
+
/** Runtime-local view of DI forward references consumed by module graph compilation. */
|
|
5
|
+
export type RuntimeForwardRef = {
|
|
6
|
+
__forwardRef__: true;
|
|
7
|
+
forwardRef: () => Token;
|
|
8
|
+
};
|
|
9
|
+
/** Runtime-local view of optional DI tokens consumed by module graph compilation. */
|
|
10
|
+
export type RuntimeOptionalToken = {
|
|
11
|
+
__optional__: true;
|
|
12
|
+
token: Token;
|
|
13
|
+
};
|
|
14
|
+
/** Runtime-local union for DI dependency metadata consumed by module graph compilation. */
|
|
15
|
+
export type RuntimeInjectionToken = Token | RuntimeForwardRef | RuntimeOptionalToken;
|
|
16
|
+
/** Runtime-local class DI metadata view used for provider scope and dependency validation. */
|
|
17
|
+
export interface RuntimeClassDiMetadata {
|
|
18
|
+
inject?: readonly RuntimeInjectionToken[];
|
|
19
|
+
scope?: Scope;
|
|
20
|
+
}
|
|
21
|
+
/** Runtime-local writable class DI metadata shape used by explicit metadata-version tests. */
|
|
22
|
+
export interface RuntimeWritableClassDiMetadata {
|
|
23
|
+
inject?: Token[];
|
|
24
|
+
scope?: Scope;
|
|
25
|
+
}
|
|
26
|
+
/** Runtime-local module metadata view used while compiling application module graphs. */
|
|
27
|
+
export type RuntimeModuleMetadata = Pick<ModuleDefinition, 'controllers' | 'exports' | 'global' | 'imports' | 'middleware' | 'providers'>;
|
|
28
|
+
/** Runtime-local writable module metadata shape used by decorators, tests, and dynamic module normalization. */
|
|
29
|
+
export interface RuntimeWritableModuleMetadata {
|
|
30
|
+
controllers?: unknown[];
|
|
31
|
+
exports?: unknown[];
|
|
32
|
+
global?: boolean;
|
|
33
|
+
imports?: unknown[];
|
|
34
|
+
middleware?: unknown[];
|
|
35
|
+
providers?: unknown[];
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Writes runtime-visible module metadata through the runtime-owned core metadata seam.
|
|
39
|
+
*
|
|
40
|
+
* @param target Module constructor that should receive the metadata snapshot.
|
|
41
|
+
* @param metadata Module metadata used by decorators, tests, or dynamic module normalization.
|
|
42
|
+
*/
|
|
43
|
+
export declare function defineRuntimeModuleMetadata(target: Function, metadata: RuntimeWritableModuleMetadata): void;
|
|
44
|
+
/**
|
|
45
|
+
* Writes runtime-visible class DI metadata through the runtime-owned core metadata seam.
|
|
46
|
+
*
|
|
47
|
+
* @param target Class constructor that should receive DI metadata.
|
|
48
|
+
* @param metadata DI metadata used by explicit runtime metadata-version tests.
|
|
49
|
+
*/
|
|
50
|
+
export declare function defineRuntimeClassDiMetadata(target: Function, metadata: RuntimeWritableClassDiMetadata): void;
|
|
51
|
+
/**
|
|
52
|
+
* Reads runtime-visible class DI metadata without spreading peer internal imports.
|
|
53
|
+
*
|
|
54
|
+
* @param target Class constructor whose effective DI metadata should be read.
|
|
55
|
+
* @returns The effective class DI metadata when present.
|
|
56
|
+
*/
|
|
57
|
+
export declare function getRuntimeClassDiMetadata(target: Function): RuntimeClassDiMetadata | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* Reads own runtime-visible class DI metadata without inherited metadata fallback.
|
|
60
|
+
*
|
|
61
|
+
* @param target Class constructor whose own DI metadata should be read.
|
|
62
|
+
* @returns The own class DI metadata when present.
|
|
63
|
+
*/
|
|
64
|
+
export declare function getOwnRuntimeClassDiMetadata(target: Function): RuntimeClassDiMetadata | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* Reads the current module metadata version for runtime compile-cache keys.
|
|
67
|
+
*
|
|
68
|
+
* @returns Monotonic module metadata version maintained by the core metadata store.
|
|
69
|
+
*/
|
|
70
|
+
export declare function getRuntimeModuleMetadataVersion(): number;
|
|
71
|
+
/**
|
|
72
|
+
* Reads the current class DI metadata version for runtime compile-cache keys.
|
|
73
|
+
*
|
|
74
|
+
* @returns Monotonic class DI metadata version maintained by the core metadata store.
|
|
75
|
+
*/
|
|
76
|
+
export declare function getRuntimeClassDiMetadataVersion(): number;
|
|
77
|
+
/**
|
|
78
|
+
* Reads runtime-visible module metadata during graph compilation.
|
|
79
|
+
*
|
|
80
|
+
* @param target Module constructor whose metadata should be read.
|
|
81
|
+
* @returns Module metadata normalized by the core metadata store.
|
|
82
|
+
*/
|
|
83
|
+
export declare function getRuntimeModuleMetadata(target: Function): RuntimeModuleMetadata;
|
|
84
|
+
//# sourceMappingURL=core-metadata.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core-metadata.d.ts","sourceRoot":"","sources":["../../src/internal/core-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAU1C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,wFAAwF;AACxF,MAAM,MAAM,iBAAiB,GAAG;IAAE,cAAc,EAAE,IAAI,CAAC;IAAC,UAAU,EAAE,MAAM,KAAK,CAAA;CAAE,CAAC;AAClF,qFAAqF;AACrF,MAAM,MAA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AA4B,CAAC,MAAM,EAAE,QAAQ,GAAG,sBAAsB,GAAG,SAAS,CAEjG;AAED;;;;GAIG;AACH,wBAAgB,+BAA+B,IAAI,MAAM,CAExD;AAED;;;;GAIG;AACH,wBAAgB,gCAAgC,IAAI,MAAM,CAEzD;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,QAAQ,GAAG,qBAAqB,CAEhF"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { defineClassDiMetadata as definePeerClassDiMetadata, defineModuleMetadata as definePeerModuleMetadata, getClassDiMetadata as getPeerClassDiMetadata, getClassDiMetadataVersion as getPeerClassDiMetadataVersion, getModuleMetadata as getPeerModuleMetadata, getModuleMetadataVersion as getPeerModuleMetadataVersion, getOwnClassDiMetadata as getPeerOwnClassDiMetadata } from '@fluojs/core/internal';
|
|
2
|
+
|
|
3
|
+
/** Runtime-local view of DI forward references consumed by module graph compilation. */
|
|
4
|
+
|
|
5
|
+
/** Runtime-local view of optional DI tokens consumed by module graph compilation. */
|
|
6
|
+
|
|
7
|
+
/** Runtime-local union for DI dependency metadata consumed by module graph compilation. */
|
|
8
|
+
|
|
9
|
+
/** Runtime-local class DI metadata view used for provider scope and dependency validation. */
|
|
10
|
+
|
|
11
|
+
/** Runtime-local writable class DI metadata shape used by explicit metadata-version tests. */
|
|
12
|
+
|
|
13
|
+
/** Runtime-local module metadata view used while compiling application module graphs. */
|
|
14
|
+
|
|
15
|
+
/** Runtime-local writable module metadata shape used by decorators, tests, and dynamic module normalization. */
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Writes runtime-visible module metadata through the runtime-owned core metadata seam.
|
|
19
|
+
*
|
|
20
|
+
* @param target Module constructor that should receive the metadata snapshot.
|
|
21
|
+
* @param metadata Module metadata used by decorators, tests, or dynamic module normalization.
|
|
22
|
+
*/
|
|
23
|
+
export function defineRuntimeModuleMetadata(target, metadata) {
|
|
24
|
+
definePeerModuleMetadata(target, metadata);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Writes runtime-visible class DI metadata through the runtime-owned core metadata seam.
|
|
29
|
+
*
|
|
30
|
+
* @param target Class constructor that should receive DI metadata.
|
|
31
|
+
* @param metadata DI metadata used by explicit runtime metadata-version tests.
|
|
32
|
+
*/
|
|
33
|
+
export function defineRuntimeClassDiMetadata(target, metadata) {
|
|
34
|
+
definePeerClassDiMetadata(target, metadata);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Reads runtime-visible class DI metadata without spreading peer internal imports.
|
|
39
|
+
*
|
|
40
|
+
* @param target Class constructor whose effective DI metadata should be read.
|
|
41
|
+
* @returns The effective class DI metadata when present.
|
|
42
|
+
*/
|
|
43
|
+
export function getRuntimeClassDiMetadata(target) {
|
|
44
|
+
return getPeerClassDiMetadata(target);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Reads own runtime-visible class DI metadata without inherited metadata fallback.
|
|
49
|
+
*
|
|
50
|
+
* @param target Class constructor whose own DI metadata should be read.
|
|
51
|
+
* @returns The own class DI metadata when present.
|
|
52
|
+
*/
|
|
53
|
+
export function getOwnRuntimeClassDiMetadata(target) {
|
|
54
|
+
return getPeerOwnClassDiMetadata(target);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Reads the current module metadata version for runtime compile-cache keys.
|
|
59
|
+
*
|
|
60
|
+
* @returns Monotonic module metadata version maintained by the core metadata store.
|
|
61
|
+
*/
|
|
62
|
+
export function getRuntimeModuleMetadataVersion() {
|
|
63
|
+
return getPeerModuleMetadataVersion();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Reads the current class DI metadata version for runtime compile-cache keys.
|
|
68
|
+
*
|
|
69
|
+
* @returns Monotonic class DI metadata version maintained by the core metadata store.
|
|
70
|
+
*/
|
|
71
|
+
export function getRuntimeClassDiMetadataVersion() {
|
|
72
|
+
return getPeerClassDiMetadataVersion();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Reads runtime-visible module metadata during graph compilation.
|
|
77
|
+
*
|
|
78
|
+
* @param target Module constructor whose metadata should be read.
|
|
79
|
+
* @returns Module metadata normalized by the core metadata store.
|
|
80
|
+
*/
|
|
81
|
+
export function getRuntimeModuleMetadata(target) {
|
|
82
|
+
return getPeerModuleMetadata(target);
|
|
83
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { DefaultBinder } from '@fluojs/http/internal';
|
|
2
|
+
import { attachFrameworkRequestNativeRouteHandoff, consumeRawRequestNativeRouteHandoff } from '@fluojs/http/internal';
|
|
3
|
+
export { DefaultBinder as RuntimeDefaultBinder };
|
|
4
|
+
export { attachFrameworkRequestNativeRouteHandoff as attachRuntimeFrameworkRequestNativeRouteHandoff, consumeRawRequestNativeRouteHandoff as consumeRuntimeRawRequestNativeRouteHandoff, };
|
|
5
|
+
//# sourceMappingURL=http-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-runtime.d.ts","sourceRoot":"","sources":["../../src/internal/http-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EACL,wCAAwC,EACxC,mCAAmC,EACpC,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,aAAa,IAAI,oBAAoB,EAAE,CAAC;AACjD,OAAO,EACL,wCAAwC,IAAI,+CAA+C,EAC3F,mCAAmC,IAAI,0CAA0C,GAClF,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { DefaultBinder } from '@fluojs/http/internal';
|
|
2
|
+
import { attachFrameworkRequestNativeRouteHandoff, consumeRawRequestNativeRouteHandoff } from '@fluojs/http/internal';
|
|
3
|
+
export { DefaultBinder as RuntimeDefaultBinder };
|
|
4
|
+
export { attachFrameworkRequestNativeRouteHandoff as attachRuntimeFrameworkRequestNativeRouteHandoff, consumeRawRequestNativeRouteHandoff as consumeRuntimeRawRequestNativeRouteHandoff };
|
package/dist/internal.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { APPLICATION_LOGGER, COMPILED_MODULES, HTTP_APPLICATION_ADAPTER, PLATFORM_SHELL, RUNTIME_CONTAINER, } from './tokens.js';
|
|
1
|
+
export { APPLICATION_LOGGER, COMPILED_MODULES, HTTP_APPLICATION_ADAPTER, PLATFORM_SHELL, RUNTIME_CONTAINER, RUNTIME_CLEANUP_REGISTRATION, } from './tokens.js';
|
|
2
2
|
//# sourceMappingURL=internal.d.ts.map
|
package/dist/internal.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,wBAAwB,EACxB,cAAc,EACd,iBAAiB,
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,wBAAwB,EACxB,cAAc,EACd,iBAAiB,EACjB,4BAA4B,GAC7B,MAAM,aAAa,CAAC"}
|
package/dist/internal.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { APPLICATION_LOGGER, COMPILED_MODULES, HTTP_APPLICATION_ADAPTER, PLATFORM_SHELL, RUNTIME_CONTAINER } from './tokens.js';
|
|
1
|
+
export { APPLICATION_LOGGER, COMPILED_MODULES, HTTP_APPLICATION_ADAPTER, PLATFORM_SHELL, RUNTIME_CONTAINER, RUNTIME_CLEANUP_REGISTRATION } from './tokens.js';
|
package/dist/module-graph.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Provider } from '@fluojs/di';
|
|
2
1
|
import type { Token } from '@fluojs/core';
|
|
2
|
+
import type { Provider } from '@fluojs/di';
|
|
3
3
|
import type { BootstrapModuleOptions, CompiledModule, ModuleType } from './types.js';
|
|
4
4
|
/**
|
|
5
5
|
* Returns the public token represented by a provider declaration.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-graph.d.ts","sourceRoot":"","sources":["../src/module-graph.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"module-graph.d.ts","sourceRoot":"","sources":["../src/module-graph.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAY3C,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAoB,UAAU,EAAE,MAAM,YAAY,CAAC;AAEvG;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,QAAQ,GAAG,KAAK,CAMvD;AAiBD,yFAAyF;AACzF,wBAAgB,sCAAsC,IAAI,IAAI,CAE7D;AAED;;;;GAIG;AACH,wBAAgB,wCAAwC,IAAI,MAAM,CAEjE;AAgFD;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,GAAE,sBAA2B,GAAG,MAAM,CAY9G;AAiRD;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,GAAE,QAAQ,EAAO,GAAG,GAAG,CAAC,KAAK,CAAC,CAE5E;AA8UD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,GAAE,sBAA2B,GAAG,cAAc,EAAE,CA4BjH"}
|
package/dist/module-graph.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getRuntimeClassDiMetadata, getRuntimeClassDiMetadataVersion, getOwnRuntimeClassDiMetadata, getRuntimeModuleMetadata, getRuntimeModuleMetadataVersion } from './internal/core-metadata.js';
|
|
2
2
|
import { ModuleGraphError, ModuleInjectionMetadataError, ModuleVisibilityError } from './errors.js';
|
|
3
3
|
/**
|
|
4
4
|
* Returns the public token represented by a provider declaration.
|
|
@@ -98,7 +98,7 @@ function describeProviderForCacheKey(provider) {
|
|
|
98
98
|
export function createModuleGraphCacheKey(rootModule, options = {}) {
|
|
99
99
|
const runtimeProviders = (options.providers ?? []).map(describeProviderForCacheKey).join('|');
|
|
100
100
|
const validationTokens = (options.validationTokens ?? []).map(describeTokenForCacheKey).join('|');
|
|
101
|
-
return [`root:${describeTokenForCacheKey(rootModule)}`, `module:${
|
|
101
|
+
return [`root:${describeTokenForCacheKey(rootModule)}`, `module:${getRuntimeModuleMetadataVersion()}`, `class-di:${getRuntimeClassDiMetadataVersion()}`, `algorithm:${MODULE_GRAPH_COMPILE_ALGORITHM_VERSION}`, `runtime:${runtimeProviders}`, `validation:${validationTokens}`].join(';');
|
|
102
102
|
}
|
|
103
103
|
function cloneModuleDefinition(definition) {
|
|
104
104
|
return {
|
|
@@ -287,7 +287,7 @@ function createModuleGraphCacheSnapshot(modules) {
|
|
|
287
287
|
return Object.freeze(cloneCompiledModules(modules).map(compiledModule => freezeCompiledModule(compiledModule)));
|
|
288
288
|
}
|
|
289
289
|
function getEffectiveClassDiMetadata(target) {
|
|
290
|
-
const metadata =
|
|
290
|
+
const metadata = getRuntimeClassDiMetadata(target);
|
|
291
291
|
if (!metadata) {
|
|
292
292
|
return undefined;
|
|
293
293
|
}
|
|
@@ -335,7 +335,7 @@ function mergeRuntimeTokenSets(providers = [], validationTokens = []) {
|
|
|
335
335
|
return new Set([...createRuntimeTokenSet(providers), ...validationTokens]);
|
|
336
336
|
}
|
|
337
337
|
function requiredConstructorParameters(target) {
|
|
338
|
-
if (
|
|
338
|
+
if (getOwnRuntimeClassDiMetadata(target)?.inject !== undefined) {
|
|
339
339
|
return 0;
|
|
340
340
|
}
|
|
341
341
|
return target.length;
|
|
@@ -398,7 +398,7 @@ function compileModule(moduleType, runtimeProviderTokens, compiled = new Map(),
|
|
|
398
398
|
});
|
|
399
399
|
}
|
|
400
400
|
visiting.add(moduleType);
|
|
401
|
-
const definition = normalizeModuleDefinition(
|
|
401
|
+
const definition = normalizeModuleDefinition(getRuntimeModuleMetadata(moduleType));
|
|
402
402
|
for (const imported of definition.imports ?? []) {
|
|
403
403
|
compileModule(imported, runtimeProviderTokens, compiled, visiting, ordered);
|
|
404
404
|
}
|
package/dist/tokens.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { Container } from '@fluojs/di';
|
|
|
3
3
|
import type { HttpApplicationAdapter } from '@fluojs/http';
|
|
4
4
|
import type { ApplicationLogger } from './types.js';
|
|
5
5
|
import type { CompiledModule } from './types.js';
|
|
6
|
+
import type { RuntimeCleanupRegistration } from './types.js';
|
|
6
7
|
import type { PlatformShell } from './platform-contract.js';
|
|
7
8
|
/**
|
|
8
9
|
* Injection token for the application logger.
|
|
@@ -24,4 +25,8 @@ export declare const HTTP_APPLICATION_ADAPTER: Token<HttpApplicationAdapter>;
|
|
|
24
25
|
* Injection token for the platform shell.
|
|
25
26
|
*/
|
|
26
27
|
export declare const PLATFORM_SHELL: Token<PlatformShell>;
|
|
28
|
+
/**
|
|
29
|
+
* Internal injection token for registering runtime-owned cleanup callbacks.
|
|
30
|
+
*/
|
|
31
|
+
export declare const RUNTIME_CLEANUP_REGISTRATION: Token<RuntimeCleanupRegistration>;
|
|
27
32
|
//# sourceMappingURL=tokens.d.ts.map
|
package/dist/tokens.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAA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BAAgB,EAAE,KAAK,CAAC,SAAS,cAAc,EAAE,CAA8B,CAAC;AAE7F;;GAEG;AACH,eAAO,MAAM,wBAAwB,EAAE,KAAK,CAAC,sBAAsB,CAAsC,CAAC;AAE1G;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,aAAa,CAA4B,CAAC;AAE7E;;GAEG;AACH,eAAO,MAAM,4BAA4B,EAAE,KAAK,CAAC,0BAA0B,CAA0C,CAAC"}
|
package/dist/tokens.js
CHANGED
|
@@ -21,4 +21,9 @@ export const HTTP_APPLICATION_ADAPTER = Symbol('HTTP_APPLICATION_ADAPTER');
|
|
|
21
21
|
/**
|
|
22
22
|
* Injection token for the platform shell.
|
|
23
23
|
*/
|
|
24
|
-
export const PLATFORM_SHELL = Symbol('PLATFORM_SHELL');
|
|
24
|
+
export const PLATFORM_SHELL = Symbol('PLATFORM_SHELL');
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Internal injection token for registering runtime-owned cleanup callbacks.
|
|
28
|
+
*/
|
|
29
|
+
export const RUNTIME_CLEANUP_REGISTRATION = Symbol('RUNTIME_CLEANUP_REGISTRATION');
|
package/dist/types.d.ts
CHANGED
|
@@ -81,6 +81,8 @@ export interface ApplicationLogger {
|
|
|
81
81
|
log(message: string, context?: string): void;
|
|
82
82
|
warn(message: string, context?: string): void;
|
|
83
83
|
}
|
|
84
|
+
/** Registers runtime-owned cleanup callbacks that must run during bootstrap failure or shutdown. */
|
|
85
|
+
export type RuntimeCleanupRegistration = (cleanup: () => void) => () => void;
|
|
84
86
|
/** Runtime-visible application states for HTTP and microservice shells. */
|
|
85
87
|
export type ApplicationState = 'bootstrapped' | 'ready' | 'closed';
|
|
86
88
|
/**
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAA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CAAC,IAAI,CAAC,CAAC;IACvC,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACxB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAED,8EAA8E;AAC9E,MAAM,WAAW,uBAAwB,SAAQ,kBAAkB;IACjE,QAAQ,CAAC,KAAK,EAAE,gBAAgB,CAAC;IAEjC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvD,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACxB,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACjF"}
|
package/dist/web.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BadRequestException, createErrorResponse, HttpException, InternalServerErrorException, PayloadTooLargeException } from '@fluojs/http';
|
|
2
|
-
import {
|
|
2
|
+
import { attachRuntimeFrameworkRequestNativeRouteHandoff, consumeRuntimeRawRequestNativeRouteHandoff } from './internal/http-runtime.js';
|
|
3
3
|
import { parseMultipart } from './multipart.js';
|
|
4
4
|
import { dispatchWithRequestResponseFactory } from './adapters/request-response-factory.js';
|
|
5
5
|
const DEFAULT_MAX_BODY_SIZE = 1 * 1024 * 1024;
|
|
@@ -296,8 +296,8 @@ function createDeferredWebFrameworkRequest(request, signal, multipartOptions, ma
|
|
|
296
296
|
if (!hasRequestBody) {
|
|
297
297
|
frameworkRequest.body = undefined;
|
|
298
298
|
}
|
|
299
|
-
const nativeRouteHandoff =
|
|
300
|
-
return nativeRouteHandoff ?
|
|
299
|
+
const nativeRouteHandoff = consumeRuntimeRawRequestNativeRouteHandoff(request);
|
|
300
|
+
return nativeRouteHandoff ? attachRuntimeFrameworkRequestNativeRouteHandoff(frameworkRequest, nativeRouteHandoff) : frameworkRequest;
|
|
301
301
|
}
|
|
302
302
|
function createRequestWithSnapshotMetadata(request, url, method, headers) {
|
|
303
303
|
const init = {
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"module-graph",
|
|
10
10
|
"orchestration"
|
|
11
11
|
],
|
|
12
|
-
"version": "1.0.0-beta.
|
|
12
|
+
"version": "1.0.0-beta.12",
|
|
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.
|
|
71
|
-
"@fluojs/core": "^1.0.0-beta.
|
|
72
|
-
"@fluojs/di": "^1.0.0-beta.
|
|
70
|
+
"@fluojs/config": "^1.0.0-beta.8",
|
|
71
|
+
"@fluojs/core": "^1.0.0-beta.5",
|
|
72
|
+
"@fluojs/di": "^1.0.0-beta.7",
|
|
73
73
|
"@fluojs/http": "^1.0.0-beta.10"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
76
|
"vitest": "^3.2.4",
|
|
77
|
-
"@fluojs/serialization": "^1.0.0-beta.
|
|
77
|
+
"@fluojs/serialization": "^1.0.0-beta.6"
|
|
78
78
|
},
|
|
79
79
|
"scripts": {
|
|
80
80
|
"prebuild": "node ../../tooling/scripts/clean-dist.mjs",
|