@fluojs/runtime 1.0.0-beta.2 → 1.0.0-beta.3
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 +7 -0
- package/README.md +7 -0
- package/dist/adapters/request-response-factory.d.ts +9 -0
- package/dist/adapters/request-response-factory.d.ts.map +1 -1
- package/dist/adapters/request-response-factory.js +11 -0
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +220 -46
- package/dist/module-graph.d.ts.map +1 -1
- package/dist/module-graph.js +17 -7
- package/dist/node/internal-node-request.d.ts +21 -0
- package/dist/node/internal-node-request.d.ts.map +1 -1
- package/dist/node/internal-node-request.js +84 -30
- package/dist/node/internal-node.d.ts.map +1 -1
- package/dist/node/internal-node.js +5 -2
- package/dist/node/node-request.d.ts +1 -1
- package/dist/node/node-request.d.ts.map +1 -1
- package/dist/node/node-request.js +1 -1
- package/dist/platform-shell.d.ts +4 -0
- package/dist/platform-shell.d.ts.map +1 -1
- package/dist/platform-shell.js +72 -20
- package/dist/types.d.ts +9 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/web.d.ts.map +1 -1
- package/dist/web.js +90 -29
- package/package.json +6 -6
package/README.ko.md
CHANGED
|
@@ -123,6 +123,13 @@ class UsersModule {}
|
|
|
123
123
|
## 동작 계약
|
|
124
124
|
|
|
125
125
|
- 요청 바디 파싱은 Web 표준 요청과 Node 기반 요청 모두에서 바이트가 스트리밍되는 동안 `maxBodySize`를 강제합니다.
|
|
126
|
+
- Node 기반 및 Web 표준 요청 wrapper는 바디 파싱 전에 저비용 요청 metadata를 snapshot으로 고정한 뒤 dispatch 경계에서 `body`/`rawBody`를 한 번 materialize하므로 userland는 계속 동기 parsed 값을 관찰합니다.
|
|
127
|
+
- Node 기반 쿠키/쿼리 값과 Web 표준 헤더는 요청 wrapper가 생성되는 시점에 snapshot으로 고정된 뒤 요청별로 lazy하게 normalize되고 memoize됩니다. 이후 upstream 객체가 변경되어도 `FrameworkRequest` view는 바뀌지 않습니다.
|
|
128
|
+
- `ApplicationContext.get()`과 `Application.get()`은 bootstrap 시점에 알려진 직접 root singleton class/factory provider 조회만 memoize하며, alias, request, transient, 종료 이후, multi-provider, `container.override()` 해석 의미는 그대로 유지합니다.
|
|
129
|
+
- `multi: true` provider token은 context cache에 memoize되지 않습니다. 각 `get()` 호출은 DI로 위임되어 컨테이너가 새로운 contribution 배열을 조립하며, 각 contribution 자체는 해당 provider scope에 따라 재사용됩니다.
|
|
130
|
+
- `duplicateProviderPolicy`가 `warn` 또는 `ignore`일 때 context cache 적격성과 lifecycle hook 실행은 bootstrap이 선택한 effective winning provider를 기준으로 결정됩니다. stale losing provider는 cache entry나 lifecycle hook을 만들지 않습니다.
|
|
131
|
+
- 애플리케이션 또는 컨텍스트 bootstrap이 런타임 리소스나 lifecycle instance 생성 이후 실패하면 fluo는 readiness를 초기화하고, 등록된 runtime cleanup callback을 실행하며, 그 시점까지 해석된 instance의 shutdown hook을 `bootstrap-failed`로 호출하고, 컨테이너를 dispose하고, cleanup 실패를 로그로 남긴 뒤 원래 bootstrap error를 다시 던집니다.
|
|
132
|
+
- Bootstrap은 독립적인 singleton lifecycle provider를 병렬로 해석한 뒤 lifecycle hook은 결정적인 provider 순서대로 실행합니다.
|
|
126
133
|
- 멀티파트 파싱은 누적 바디 크기가 설정된 `multipart.maxTotalSize`를 넘으면 즉시 거부되며, 런타임 어댑터는 별도 재정의가 없으면 이 한도를 `maxBodySize`와 동일하게 맞춥니다.
|
|
127
134
|
- 응답 스트림 백프레셔 헬퍼는 `drain`, `close`, `error` 중 어느 경우에도 `waitForDrain()`을 완료시켜 끊어진 연결에서 스트리밍 작성기가 멈추지 않도록 합니다.
|
|
128
135
|
- 런타임 health 모듈은 bootstrap이 ready로 표시하기 전까지 `/ready`를 HTTP 503과 `starting`으로 보고하며, 애플리케이션/컨텍스트 종료가 시작되는 즉시, 종료 시도가 실패하더라도 다시 `starting`으로 내려갑니다.
|
package/README.md
CHANGED
|
@@ -123,6 +123,13 @@ class UsersModule {}
|
|
|
123
123
|
## Behavioral Contracts
|
|
124
124
|
|
|
125
125
|
- Request body parsing enforces `maxBodySize` while bytes are still streaming for both Web-standard and Node-backed requests.
|
|
126
|
+
- Node-backed and Web-standard request wrappers snapshot cheap request metadata before body parsing, then materialize `body`/`rawBody` once at the dispatch boundary so userland continues to observe synchronous parsed values.
|
|
127
|
+
- Node-backed cookies/query values and Web-standard headers are snapshotted when the request wrapper is created, then lazily normalized and memoized per request; later upstream object mutations do not change the `FrameworkRequest` view.
|
|
128
|
+
- `ApplicationContext.get()` and `Application.get()` memoize only direct root singleton class/factory provider lookups known at bootstrap, while preserving alias, request, transient, post-close, multi-provider, and `container.override()` resolution semantics.
|
|
129
|
+
- `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.
|
|
130
|
+
- 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.
|
|
131
|
+
- 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.
|
|
132
|
+
- Bootstrap resolves independent singleton lifecycle providers concurrently, then runs lifecycle hooks in deterministic provider order.
|
|
126
133
|
- 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
134
|
- Response stream backpressure helpers settle `waitForDrain()` on `drain`, `close`, or `error` so streaming writers do not hang on dead connections.
|
|
128
135
|
- 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.
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import type { Dispatcher, FrameworkRequest, FrameworkResponse } from '@fluojs/http';
|
|
2
|
+
/** Request/response factory seam used by shared HTTP adapter dispatch helpers. */
|
|
2
3
|
export interface RequestResponseFactory<RawRequest, RawResponse, Response extends FrameworkResponse = FrameworkResponse> {
|
|
3
4
|
createRequest(rawRequest: RawRequest, signal: AbortSignal): Promise<FrameworkRequest>;
|
|
4
5
|
createRequestSignal(rawResponse: RawResponse): AbortSignal;
|
|
5
6
|
createResponse(rawResponse: RawResponse, rawRequest: RawRequest): Response;
|
|
7
|
+
materializeRequest?(request: FrameworkRequest): Promise<void>;
|
|
6
8
|
resolveRequestId(rawRequest: RawRequest): string | undefined;
|
|
7
9
|
writeErrorResponse(error: unknown, response: Response, requestId?: string): Promise<void>;
|
|
8
10
|
}
|
|
11
|
+
/** Options for dispatching one raw platform request through a request/response factory. */
|
|
9
12
|
export interface DispatchWithRequestResponseFactoryOptions<RawRequest, RawResponse, Response extends FrameworkResponse = FrameworkResponse> {
|
|
10
13
|
dispatcher?: Dispatcher;
|
|
11
14
|
dispatcherNotReadyMessage: string;
|
|
@@ -13,5 +16,11 @@ export interface DispatchWithRequestResponseFactoryOptions<RawRequest, RawRespon
|
|
|
13
16
|
rawRequest: RawRequest;
|
|
14
17
|
rawResponse: RawResponse;
|
|
15
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Dispatches one raw platform request through the shared request/response factory lifecycle.
|
|
21
|
+
*
|
|
22
|
+
* @param options - Factory, dispatcher, and raw platform request/response values for one dispatch.
|
|
23
|
+
* @returns The framework response after dispatch, error serialization, or default finalization.
|
|
24
|
+
*/
|
|
16
25
|
export declare function dispatchWithRequestResponseFactory<RawRequest, RawResponse, Response extends FrameworkResponse = FrameworkResponse>({ dispatcher, dispatcherNotReadyMessage, factory, rawRequest, rawResponse, }: DispatchWithRequestResponseFactoryOptions<RawRequest, RawResponse, Response>): Promise<Response>;
|
|
17
26
|
//# sourceMappingURL=request-response-factory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"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iBAAiB,EACtD,EACA,UAAU,EACV,yBAAyB,EACzB,OAAO,EACP,UAAU,EACV,WAAW,GACZ,EAAE,yCAAyC,CAAC,UAAU,EAAE,WAAW,EAAE,QAAQ,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CA2BlG"}
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
/** Request/response factory seam used by shared HTTP adapter dispatch helpers. */
|
|
2
|
+
|
|
3
|
+
/** Options for dispatching one raw platform request through a request/response factory. */
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Dispatches one raw platform request through the shared request/response factory lifecycle.
|
|
7
|
+
*
|
|
8
|
+
* @param options - Factory, dispatcher, and raw platform request/response values for one dispatch.
|
|
9
|
+
* @returns The framework response after dispatch, error serialization, or default finalization.
|
|
10
|
+
*/
|
|
1
11
|
export async function dispatchWithRequestResponseFactory({
|
|
2
12
|
dispatcher,
|
|
3
13
|
dispatcherNotReadyMessage,
|
|
@@ -9,6 +19,7 @@ export async function dispatchWithRequestResponseFactory({
|
|
|
9
19
|
const signal = factory.createRequestSignal(rawResponse);
|
|
10
20
|
try {
|
|
11
21
|
const frameworkRequest = await factory.createRequest(rawRequest, signal);
|
|
22
|
+
await factory.materializeRequest?.(frameworkRequest);
|
|
12
23
|
if (!dispatcher) {
|
|
13
24
|
throw new Error(dispatcherNotReadyMessage);
|
|
14
25
|
}
|
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,
|
|
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,EAKX,MAAM,YAAY,CAAC;AA2apB;;;;;;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;AA4pBD;;;;;;;GAOG;AACH,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,2BAA2B,GAAG,OAAO,CAAC,WAAW,CAAC,CAqHrG;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;IAoG9B;;;;;;;;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
|
@@ -6,7 +6,7 @@ import { createDispatcher, createHandlerMapping } from '@fluojs/http';
|
|
|
6
6
|
import { DuplicateProviderError } from './errors.js';
|
|
7
7
|
import { createBootstrapTimingDiagnostics } from './health/diagnostics.js';
|
|
8
8
|
import { createConsoleApplicationLogger } from './logging/logger.js';
|
|
9
|
-
import { compileModuleGraph,
|
|
9
|
+
import { compileModuleGraph, providerToken } from './module-graph.js';
|
|
10
10
|
import { createRuntimePlatformShell } from './platform-shell.js';
|
|
11
11
|
import { APPLICATION_LOGGER, COMPILED_MODULES, HTTP_APPLICATION_ADAPTER, PLATFORM_SHELL, RUNTIME_CONTAINER } from './tokens.js';
|
|
12
12
|
const DEFAULT_MICROSERVICE_TOKEN = Symbol.for('fluo.microservices.service');
|
|
@@ -158,44 +158,115 @@ function createDuplicateProviderMessage(token, moduleName, existingModuleName) {
|
|
|
158
158
|
const tokenLabel = typeof token === 'function' ? token.name || '<anonymous>' : String(token);
|
|
159
159
|
return `Duplicate provider token "${tokenLabel}" registered in module "${moduleName}". Previously registered in module "${existingModuleName}".`;
|
|
160
160
|
}
|
|
161
|
-
function
|
|
162
|
-
const
|
|
161
|
+
function createDuplicateRuntimeProviderMessage(token) {
|
|
162
|
+
const tokenLabel = typeof token === 'function' ? token.name || '<anonymous>' : String(token);
|
|
163
|
+
return `Duplicate runtime provider token "${tokenLabel}" registered.`;
|
|
164
|
+
}
|
|
165
|
+
function handleDuplicateProvider(token, moduleName, existingModuleName, policy, logger) {
|
|
166
|
+
const message = createDuplicateProviderMessage(token, moduleName, existingModuleName);
|
|
167
|
+
if (policy === 'throw') {
|
|
168
|
+
throw new DuplicateProviderError(message, {
|
|
169
|
+
module: moduleName,
|
|
170
|
+
token,
|
|
171
|
+
phase: 'provider registration',
|
|
172
|
+
hint: `Remove the duplicate registration from one of the modules, use container.override() for intentional replacements, or set duplicateProviderPolicy to 'warn' or 'ignore'.`
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
if (policy === 'warn') {
|
|
176
|
+
logger?.warn(message, 'BootstrapModule');
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
function handleDuplicateRuntimeProvider(token, policy, logger) {
|
|
180
|
+
const message = createDuplicateRuntimeProviderMessage(token);
|
|
181
|
+
if (policy === 'throw') {
|
|
182
|
+
throw new DuplicateProviderError(message, {
|
|
183
|
+
module: '<runtime>',
|
|
184
|
+
token,
|
|
185
|
+
phase: 'provider registration',
|
|
186
|
+
hint: `Remove the duplicate runtime provider registration, use container.override() after bootstrap for intentional replacements, or set duplicateProviderPolicy to 'warn' or 'ignore'.`
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
if (policy === 'warn') {
|
|
190
|
+
logger?.warn(message, 'BootstrapModule');
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
function selectEffectiveBootstrapProviders(modules, runtimeProviders, rootModule, policy, logger) {
|
|
194
|
+
const selectedRuntimeProviderIndexes = new Map();
|
|
195
|
+
const selectedModuleProviderIndexes = new Map();
|
|
196
|
+
const runtimeMultiTokens = new Set();
|
|
197
|
+
const runtimeSingleTokens = new Set();
|
|
198
|
+
const runtimeProviderEntries = [];
|
|
199
|
+
const moduleProviderEntries = [];
|
|
163
200
|
for (const runtimeProvider of runtimeProviders ?? []) {
|
|
164
201
|
const token = providerToken(runtimeProvider);
|
|
165
|
-
|
|
202
|
+
const multi = isMultiProvider(runtimeProvider);
|
|
203
|
+
const existingRuntimeProviderIndex = selectedRuntimeProviderIndexes.get(token);
|
|
204
|
+
if (multi) {
|
|
205
|
+
runtimeMultiTokens.add(token);
|
|
206
|
+
} else {
|
|
207
|
+
runtimeSingleTokens.add(token);
|
|
208
|
+
}
|
|
209
|
+
if (!multi && existingRuntimeProviderIndex !== undefined) {
|
|
210
|
+
handleDuplicateRuntimeProvider(token, policy, logger);
|
|
211
|
+
}
|
|
212
|
+
runtimeProviderEntries.push({
|
|
166
213
|
moduleName: '<runtime>',
|
|
167
214
|
provider: runtimeProvider,
|
|
168
215
|
source: 'runtime',
|
|
169
216
|
token
|
|
170
217
|
});
|
|
218
|
+
if (!multi) {
|
|
219
|
+
selectedRuntimeProviderIndexes.set(token, runtimeProviderEntries.length - 1);
|
|
220
|
+
}
|
|
171
221
|
}
|
|
172
222
|
for (const compiledModule of modules) {
|
|
173
223
|
for (const provider of compiledModule.definition.providers ?? []) {
|
|
174
224
|
const token = providerToken(provider);
|
|
175
|
-
const
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
module: compiledModule.type.name,
|
|
181
|
-
token,
|
|
182
|
-
phase: 'provider registration',
|
|
183
|
-
hint: `Remove the duplicate registration from one of the modules, use container.override() for intentional replacements, or set duplicateProviderPolicy to 'warn' or 'ignore'.`
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
if (policy === 'warn') {
|
|
187
|
-
logger?.warn(message, 'BootstrapModule');
|
|
188
|
-
}
|
|
225
|
+
const multi = isMultiProvider(provider);
|
|
226
|
+
const existingModuleProviderIndex = selectedModuleProviderIndexes.get(token);
|
|
227
|
+
const existing = existingModuleProviderIndex === undefined ? undefined : moduleProviderEntries[existingModuleProviderIndex];
|
|
228
|
+
if (!multi && existing && existing.source === 'module') {
|
|
229
|
+
handleDuplicateProvider(token, compiledModule.type.name, existing.moduleName, policy, logger);
|
|
189
230
|
}
|
|
190
|
-
|
|
231
|
+
const entry = {
|
|
191
232
|
moduleName: compiledModule.type.name,
|
|
233
|
+
moduleType: compiledModule.type,
|
|
192
234
|
provider,
|
|
193
235
|
source: 'module',
|
|
194
236
|
token
|
|
195
|
-
}
|
|
237
|
+
};
|
|
238
|
+
moduleProviderEntries.push(entry);
|
|
239
|
+
if (!multi) {
|
|
240
|
+
selectedModuleProviderIndexes.set(token, moduleProviderEntries.length - 1);
|
|
241
|
+
}
|
|
196
242
|
}
|
|
197
243
|
}
|
|
198
|
-
|
|
244
|
+
const selectedModuleProviderIndexesSet = new Set(selectedModuleProviderIndexes.values());
|
|
245
|
+
const selectedRuntimeProviderIndexesSet = new Set(selectedRuntimeProviderIndexes.values());
|
|
246
|
+
const moduleProviders = [];
|
|
247
|
+
const rootModuleProviders = [];
|
|
248
|
+
const effectiveRuntimeProviders = runtimeProviderEntries.filter((entry, index) => isMultiProvider(entry.provider) || selectedRuntimeProviderIndexesSet.has(index)).map(entry => entry.provider);
|
|
249
|
+
moduleProviderEntries.forEach((entry, index) => {
|
|
250
|
+
const multi = isMultiProvider(entry.provider);
|
|
251
|
+
if (entry.source !== 'module' || !multi && !selectedModuleProviderIndexesSet.has(index)) {
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
if (runtimeSingleTokens.has(entry.token) || runtimeMultiTokens.has(entry.token) && !multi) {
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
moduleProviders.push(entry.provider);
|
|
258
|
+
if (entry.moduleType === rootModule) {
|
|
259
|
+
rootModuleProviders.push(entry.provider);
|
|
260
|
+
}
|
|
261
|
+
});
|
|
262
|
+
return {
|
|
263
|
+
moduleProviders,
|
|
264
|
+
rootModuleProviders,
|
|
265
|
+
runtimeProviders: effectiveRuntimeProviders
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
function isMultiProvider(provider) {
|
|
269
|
+
return typeof provider === 'object' && provider !== null && 'multi' in provider && provider.multi === true;
|
|
199
270
|
}
|
|
200
271
|
function registerControllers(container, modules) {
|
|
201
272
|
for (const compiledModule of modules) {
|
|
@@ -253,18 +324,18 @@ export function bootstrapModule(rootModule, options = {}) {
|
|
|
253
324
|
const container = new Container();
|
|
254
325
|
const policy = options.duplicateProviderPolicy ?? 'warn';
|
|
255
326
|
const runtimeProviders = options.providers ?? [];
|
|
256
|
-
const
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
container.register(...runtimeProviders);
|
|
327
|
+
const effectiveProviders = selectEffectiveBootstrapProviders(modules, runtimeProviders, rootModule, policy, options.logger);
|
|
328
|
+
if (effectiveProviders.runtimeProviders.length > 0) {
|
|
329
|
+
container.register(...effectiveProviders.runtimeProviders);
|
|
260
330
|
}
|
|
261
|
-
if (moduleProviders.length > 0) {
|
|
262
|
-
container.register(...moduleProviders);
|
|
331
|
+
if (effectiveProviders.moduleProviders.length > 0) {
|
|
332
|
+
container.register(...effectiveProviders.moduleProviders);
|
|
263
333
|
}
|
|
264
334
|
registerControllers(container, modules);
|
|
265
335
|
registerModuleMiddleware(container, modules);
|
|
266
336
|
return {
|
|
267
337
|
container,
|
|
338
|
+
effectiveProviders,
|
|
268
339
|
modules,
|
|
269
340
|
rootModule
|
|
270
341
|
};
|
|
@@ -277,9 +348,10 @@ class FluoApplication {
|
|
|
277
348
|
applicationState = 'bootstrapped';
|
|
278
349
|
closed = false;
|
|
279
350
|
closingPromise;
|
|
351
|
+
contextResolutionCache = new Map();
|
|
280
352
|
lifecycleInstances;
|
|
281
353
|
connectedMicroservices = [];
|
|
282
|
-
constructor(container, modules, rootModule, dispatcher, bootstrapTiming, adapter, hasHttpAdapter, platformShell, lifecycleInstances, logger, runtimeCleanup) {
|
|
354
|
+
constructor(container, modules, rootModule, dispatcher, bootstrapTiming, adapter, hasHttpAdapter, platformShell, lifecycleInstances, logger, runtimeCleanup, contextCacheableTokens) {
|
|
283
355
|
this.container = container;
|
|
284
356
|
this.modules = modules;
|
|
285
357
|
this.rootModule = rootModule;
|
|
@@ -290,13 +362,18 @@ class FluoApplication {
|
|
|
290
362
|
this.platformShell = platformShell;
|
|
291
363
|
this.logger = logger;
|
|
292
364
|
this.runtimeCleanup = runtimeCleanup;
|
|
365
|
+
this.contextCacheableTokens = contextCacheableTokens;
|
|
293
366
|
this.lifecycleInstances = lifecycleInstances;
|
|
367
|
+
installContextCacheInvalidation(this.container, this.contextResolutionCache, this.contextCacheableTokens);
|
|
294
368
|
}
|
|
295
369
|
get state() {
|
|
296
370
|
return this.applicationState;
|
|
297
371
|
}
|
|
298
372
|
async get(token) {
|
|
299
|
-
|
|
373
|
+
if (this.closed) {
|
|
374
|
+
return this.container.resolve(token);
|
|
375
|
+
}
|
|
376
|
+
return resolveContextToken(this.container, token, this.contextCacheableTokens, this.contextResolutionCache);
|
|
300
377
|
}
|
|
301
378
|
|
|
302
379
|
/**
|
|
@@ -383,16 +460,22 @@ class FluoApplication {
|
|
|
383
460
|
class FluoApplicationContext {
|
|
384
461
|
closed = false;
|
|
385
462
|
closingPromise;
|
|
386
|
-
|
|
463
|
+
contextResolutionCache = new Map();
|
|
464
|
+
constructor(container, modules, rootModule, bootstrapTiming, lifecycleInstances, runtimeCleanup, contextCacheableTokens) {
|
|
387
465
|
this.container = container;
|
|
388
466
|
this.modules = modules;
|
|
389
467
|
this.rootModule = rootModule;
|
|
390
468
|
this.bootstrapTiming = bootstrapTiming;
|
|
391
469
|
this.lifecycleInstances = lifecycleInstances;
|
|
392
470
|
this.runtimeCleanup = runtimeCleanup;
|
|
471
|
+
this.contextCacheableTokens = contextCacheableTokens;
|
|
472
|
+
installContextCacheInvalidation(this.container, this.contextResolutionCache, this.contextCacheableTokens);
|
|
393
473
|
}
|
|
394
474
|
async get(token) {
|
|
395
|
-
|
|
475
|
+
if (this.closed) {
|
|
476
|
+
return this.container.resolve(token);
|
|
477
|
+
}
|
|
478
|
+
return resolveContextToken(this.container, token, this.contextCacheableTokens, this.contextResolutionCache);
|
|
396
479
|
}
|
|
397
480
|
async close(signal) {
|
|
398
481
|
if (this.closed) {
|
|
@@ -492,22 +575,113 @@ class FluoMicroserviceApplication {
|
|
|
492
575
|
/**
|
|
493
576
|
* lifecycle hook이 있는 singleton provider 인스턴스를 미리 해석해 둔다.
|
|
494
577
|
*/
|
|
495
|
-
async function resolveLifecycleInstances(container, providers) {
|
|
496
|
-
const
|
|
578
|
+
async function resolveLifecycleInstances(container, providers, resolvedInstances = []) {
|
|
579
|
+
const lifecycleEntries = [];
|
|
497
580
|
const seen = new Set();
|
|
498
581
|
for (const provider of providers) {
|
|
499
|
-
const scope = providerScope(provider);
|
|
500
|
-
if (scope === 'request' || scope === 'transient') {
|
|
501
|
-
continue;
|
|
502
|
-
}
|
|
503
582
|
const token = providerToken(provider);
|
|
504
583
|
if (seen.has(token)) {
|
|
505
584
|
continue;
|
|
506
585
|
}
|
|
586
|
+
if (isHookBearingValueProvider(provider)) {
|
|
587
|
+
seen.add(token);
|
|
588
|
+
lifecycleEntries.push({
|
|
589
|
+
token,
|
|
590
|
+
useValue: provider.useValue
|
|
591
|
+
});
|
|
592
|
+
continue;
|
|
593
|
+
}
|
|
594
|
+
if (!isDirectSingletonContextProvider(provider)) {
|
|
595
|
+
continue;
|
|
596
|
+
}
|
|
507
597
|
seen.add(token);
|
|
508
|
-
|
|
598
|
+
lifecycleEntries.push({
|
|
599
|
+
token
|
|
600
|
+
});
|
|
601
|
+
}
|
|
602
|
+
const resolutionResults = await Promise.allSettled(lifecycleEntries.map(entry => entry.useValue ?? container.resolve(entry.token)));
|
|
603
|
+
let resolutionError;
|
|
604
|
+
let hasResolutionError = false;
|
|
605
|
+
for (const result of resolutionResults) {
|
|
606
|
+
if (result.status === 'fulfilled') {
|
|
607
|
+
resolvedInstances.push(result.value);
|
|
608
|
+
continue;
|
|
609
|
+
}
|
|
610
|
+
if (!hasResolutionError) {
|
|
611
|
+
resolutionError = result.reason;
|
|
612
|
+
hasResolutionError = true;
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
if (hasResolutionError) {
|
|
616
|
+
throw resolutionError;
|
|
509
617
|
}
|
|
510
|
-
return
|
|
618
|
+
return resolvedInstances;
|
|
619
|
+
}
|
|
620
|
+
function createContextCacheableTokenSet(effectiveProviders, runtimeTokens) {
|
|
621
|
+
const cacheableTokens = new Set(runtimeTokens);
|
|
622
|
+
for (const provider of effectiveProviders.runtimeProviders) {
|
|
623
|
+
if (!isDirectSingletonContextProvider(provider)) {
|
|
624
|
+
continue;
|
|
625
|
+
}
|
|
626
|
+
cacheableTokens.add(providerToken(provider));
|
|
627
|
+
}
|
|
628
|
+
for (const provider of effectiveProviders.rootModuleProviders) {
|
|
629
|
+
if (!isDirectSingletonContextProvider(provider)) {
|
|
630
|
+
continue;
|
|
631
|
+
}
|
|
632
|
+
cacheableTokens.add(providerToken(provider));
|
|
633
|
+
}
|
|
634
|
+
return cacheableTokens;
|
|
635
|
+
}
|
|
636
|
+
function isDirectSingletonContextProvider(provider) {
|
|
637
|
+
if (isMultiProvider(provider)) {
|
|
638
|
+
return false;
|
|
639
|
+
}
|
|
640
|
+
if (typeof provider === 'function') {
|
|
641
|
+
return providerScope(provider) === 'singleton';
|
|
642
|
+
}
|
|
643
|
+
if ('useExisting' in provider || 'useValue' in provider) {
|
|
644
|
+
return false;
|
|
645
|
+
}
|
|
646
|
+
return providerScope(provider) === 'singleton';
|
|
647
|
+
}
|
|
648
|
+
function isHookBearingValueProvider(provider) {
|
|
649
|
+
return typeof provider === 'object' && provider !== null && 'useValue' in provider && hasLifecycleHook(provider.useValue);
|
|
650
|
+
}
|
|
651
|
+
function hasLifecycleHook(value) {
|
|
652
|
+
return isOnModuleInit(value) || isOnApplicationBootstrap(value) || isOnModuleDestroy(value) || isOnApplicationShutdown(value);
|
|
653
|
+
}
|
|
654
|
+
function installContextCacheInvalidation(container, cache, cacheableTokens) {
|
|
655
|
+
const cacheInvalidatingContainer = container;
|
|
656
|
+
const override = cacheInvalidatingContainer.override.bind(container);
|
|
657
|
+
cacheInvalidatingContainer.override = (...providers) => {
|
|
658
|
+
const result = override(...providers);
|
|
659
|
+
cache.clear();
|
|
660
|
+
for (const provider of providers) {
|
|
661
|
+
const token = providerToken(provider);
|
|
662
|
+
if (isDirectSingletonContextProvider(provider)) {
|
|
663
|
+
cacheableTokens.add(token);
|
|
664
|
+
} else {
|
|
665
|
+
cacheableTokens.delete(token);
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
return result;
|
|
669
|
+
};
|
|
670
|
+
}
|
|
671
|
+
async function resolveContextToken(container, token, cacheableTokens, cache) {
|
|
672
|
+
if (!cacheableTokens.has(token)) {
|
|
673
|
+
return container.resolve(token);
|
|
674
|
+
}
|
|
675
|
+
const cached = cache.get(token);
|
|
676
|
+
if (cached) {
|
|
677
|
+
return cached;
|
|
678
|
+
}
|
|
679
|
+
const resolution = container.resolve(token).catch(error => {
|
|
680
|
+
cache.delete(token);
|
|
681
|
+
throw error;
|
|
682
|
+
});
|
|
683
|
+
cache.set(token, resolution);
|
|
684
|
+
return resolution;
|
|
511
685
|
}
|
|
512
686
|
|
|
513
687
|
/**
|
|
@@ -604,9 +778,9 @@ function registerRuntimeApplicationContextTokens(bootstrapped, platformShell) {
|
|
|
604
778
|
useValue: platformShell
|
|
605
779
|
});
|
|
606
780
|
}
|
|
607
|
-
async function resolveBootstrapLifecycleInstances(bootstrapped,
|
|
608
|
-
const lifecycleProviders = [...runtimeProviders, ...bootstrapped.
|
|
609
|
-
return resolveLifecycleInstances(bootstrapped.container, lifecycleProviders);
|
|
781
|
+
async function resolveBootstrapLifecycleInstances(bootstrapped, resolvedInstances) {
|
|
782
|
+
const lifecycleProviders = [...bootstrapped.effectiveProviders.runtimeProviders, ...bootstrapped.effectiveProviders.moduleProviders];
|
|
783
|
+
return resolveLifecycleInstances(bootstrapped.container, lifecycleProviders, resolvedInstances);
|
|
610
784
|
}
|
|
611
785
|
async function runBootstrapLifecycle(modules, lifecycleInstances, logger, platformShell) {
|
|
612
786
|
resetReadinessState(modules);
|
|
@@ -696,7 +870,7 @@ export async function bootstrapApplication(options) {
|
|
|
696
870
|
bootstrappedContainer = bootstrapped.container;
|
|
697
871
|
bootstrappedModules = bootstrapped.modules;
|
|
698
872
|
const resolveLifecycleStart = timingEnabled ? runtimePerformance.now() : 0;
|
|
699
|
-
lifecycleInstances = await resolveBootstrapLifecycleInstances(bootstrapped,
|
|
873
|
+
lifecycleInstances = await resolveBootstrapLifecycleInstances(bootstrapped, lifecycleInstances);
|
|
700
874
|
lifecycleInstances.push({
|
|
701
875
|
onModuleDestroy() {
|
|
702
876
|
return platformShell.stop();
|
|
@@ -725,7 +899,7 @@ export async function bootstrapApplication(options) {
|
|
|
725
899
|
});
|
|
726
900
|
}
|
|
727
901
|
const bootstrapTiming = timingEnabled ? createBootstrapTimingDiagnostics(timingPhases, runtimePerformance.now() - timingStart) : undefined;
|
|
728
|
-
return new FluoApplication(bootstrapped.container, bootstrapped.modules, options.rootModule, dispatcher, bootstrapTiming, adapter, hasHttpAdapter, platformShell, lifecycleInstances, logger, runtimeCleanup);
|
|
902
|
+
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]));
|
|
729
903
|
} catch (error) {
|
|
730
904
|
logger.error('Failed to bootstrap the fluo application. Check the error below for what failed and how to fix it.', error, 'FluoFactory');
|
|
731
905
|
await runBootstrapFailureCleanup({
|
|
@@ -804,7 +978,7 @@ export class FluoFactory {
|
|
|
804
978
|
bootstrappedContainer = bootstrapped.container;
|
|
805
979
|
bootstrappedModules = bootstrapped.modules;
|
|
806
980
|
const resolveLifecycleStart = timingEnabled ? runtimePerformance.now() : 0;
|
|
807
|
-
lifecycleInstances = await resolveBootstrapLifecycleInstances(bootstrapped,
|
|
981
|
+
lifecycleInstances = await resolveBootstrapLifecycleInstances(bootstrapped, lifecycleInstances);
|
|
808
982
|
lifecycleInstances.push({
|
|
809
983
|
onModuleDestroy() {
|
|
810
984
|
return platformShell.stop();
|
|
@@ -825,7 +999,7 @@ export class FluoFactory {
|
|
|
825
999
|
});
|
|
826
1000
|
}
|
|
827
1001
|
const bootstrapTiming = timingEnabled ? createBootstrapTimingDiagnostics(timingPhases, runtimePerformance.now() - timingStart) : undefined;
|
|
828
|
-
return new FluoApplicationContext(bootstrapped.container, bootstrapped.modules, rootModule, bootstrapTiming, lifecycleInstances, runtimeCleanup);
|
|
1002
|
+
return new FluoApplicationContext(bootstrapped.container, bootstrapped.modules, rootModule, bootstrapTiming, lifecycleInstances, runtimeCleanup, createContextCacheableTokenSet(bootstrapped.effectiveProviders, [RUNTIME_CONTAINER, COMPILED_MODULES, PLATFORM_SHELL]));
|
|
829
1003
|
} catch (error) {
|
|
830
1004
|
logger.error('Failed to bootstrap application context. Check the error below for what failed and how to fix it.', error, 'FluoFactory');
|
|
831
1005
|
await runBootstrapFailureCleanup({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-graph.d.ts","sourceRoot":"","sources":["../src/module-graph.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAK1C,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAoB,UAAU,EAAE,MAAM,YAAY,CAAC;AAEvG;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,QAAQ,GAAG,KAAK,CAMvD;AAyDD;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,GAAE,QAAQ,EAAO,GAAG,GAAG,CAAC,KAAK,CAAC,CAE5E;
|
|
1
|
+
{"version":3,"file":"module-graph.d.ts","sourceRoot":"","sources":["../src/module-graph.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAK1C,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAoB,UAAU,EAAE,MAAM,YAAY,CAAC;AAEvG;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,QAAQ,GAAG,KAAK,CAMvD;AAyDD;;;;;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,CASjH"}
|
package/dist/module-graph.js
CHANGED
|
@@ -132,7 +132,9 @@ function compileModule(moduleType, runtimeProviderTokens, compiled = new Map(),
|
|
|
132
132
|
const compiledModule = {
|
|
133
133
|
type: moduleType,
|
|
134
134
|
definition,
|
|
135
|
+
accessibleTokens: new Set(),
|
|
135
136
|
exportedTokens: new Set(),
|
|
137
|
+
importedExportedTokens: new Set(),
|
|
136
138
|
providerTokens
|
|
137
139
|
};
|
|
138
140
|
compiled.set(moduleType, compiledModule);
|
|
@@ -154,11 +156,21 @@ function resolveImportedModules(compiledModule, compiledByType) {
|
|
|
154
156
|
});
|
|
155
157
|
}
|
|
156
158
|
function createImportedExportedTokenSet(importedModules) {
|
|
157
|
-
|
|
159
|
+
const importedExportedTokens = new Set();
|
|
160
|
+
for (const importedModule of importedModules) {
|
|
161
|
+
for (const token of importedModule.exportedTokens) {
|
|
162
|
+
importedExportedTokens.add(token);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return importedExportedTokens;
|
|
158
166
|
}
|
|
159
167
|
function createAccessibleTokenSet(runtimeProviderTokens, moduleProviderTokens, importedExportedTokens, globalExportedTokens) {
|
|
160
168
|
return new Set([...runtimeProviderTokens, ...moduleProviderTokens, ...importedExportedTokens, ...globalExportedTokens]);
|
|
161
169
|
}
|
|
170
|
+
function memoizeAccessibleTokenSet(compiledModule, importedModules, runtimeProviderTokens, globalExportedTokens) {
|
|
171
|
+
compiledModule.importedExportedTokens = createImportedExportedTokenSet(importedModules);
|
|
172
|
+
compiledModule.accessibleTokens = createAccessibleTokenSet(runtimeProviderTokens, compiledModule.providerTokens, compiledModule.importedExportedTokens, globalExportedTokens);
|
|
173
|
+
}
|
|
162
174
|
function validateProviderVisibility(compiledModule, scope, accessibleTokens) {
|
|
163
175
|
for (const provider of compiledModule.definition.providers ?? []) {
|
|
164
176
|
validateProviderInjectionMetadata(provider, scope);
|
|
@@ -222,12 +234,10 @@ function validateCompiledModules(modules, runtimeProviders, runtimeProviderToken
|
|
|
222
234
|
}
|
|
223
235
|
for (const compiledModule of modules) {
|
|
224
236
|
const scope = `module ${compiledModule.type.name}`;
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
validateControllerVisibility(compiledModule, scope, accessibleTokens);
|
|
230
|
-
compiledModule.exportedTokens = createExportedTokenSet(compiledModule, importedExportedTokens);
|
|
237
|
+
memoizeAccessibleTokenSet(compiledModule, resolveImportedModules(compiledModule, compiledByType), runtimeProviderTokens, globalExportedTokens);
|
|
238
|
+
validateProviderVisibility(compiledModule, scope, compiledModule.accessibleTokens);
|
|
239
|
+
validateControllerVisibility(compiledModule, scope, compiledModule.accessibleTokens);
|
|
240
|
+
compiledModule.exportedTokens = createExportedTokenSet(compiledModule, compiledModule.importedExportedTokens);
|
|
231
241
|
}
|
|
232
242
|
}
|
|
233
243
|
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { IncomingHttpHeaders, IncomingMessage, ServerResponse } from 'node:http';
|
|
2
2
|
import { PayloadTooLargeException, type FrameworkRequest } from '@fluojs/http';
|
|
3
3
|
import { type MultipartOptions } from '../multipart.js';
|
|
4
|
+
/**
|
|
5
|
+
* HTTP payload-size error that closes the underlying Node request stream after the response commits.
|
|
6
|
+
*/
|
|
4
7
|
export declare class NodeRequestPayloadTooLargeException extends PayloadTooLargeException {
|
|
5
8
|
private readonly request;
|
|
6
9
|
constructor(request: IncomingMessage);
|
|
@@ -17,6 +20,24 @@ export declare class NodeRequestPayloadTooLargeException extends PayloadTooLarge
|
|
|
17
20
|
* @returns The normalized framework request used by the dispatcher.
|
|
18
21
|
*/
|
|
19
22
|
export declare function createFrameworkRequest(request: IncomingMessage, signal: AbortSignal, multipartOptions?: MultipartOptions, maxBodySize?: number, preserveRawBody?: boolean): Promise<FrameworkRequest>;
|
|
23
|
+
/**
|
|
24
|
+
* Creates the cheap Node framework request shell before consuming the body stream.
|
|
25
|
+
*
|
|
26
|
+
* @param request - Raw Node request carrying headers, URL, and body stream.
|
|
27
|
+
* @param signal - Abort signal tied to the response lifecycle.
|
|
28
|
+
* @param multipartOptions - Multipart parser options applied when materializing multipart requests.
|
|
29
|
+
* @param maxBodySize - Maximum allowed non-multipart body size in bytes.
|
|
30
|
+
* @param preserveRawBody - Whether materialization should retain raw request body bytes.
|
|
31
|
+
* @returns The framework request shell with metadata snapshotted and body materialization deferred.
|
|
32
|
+
*/
|
|
33
|
+
export declare function createDeferredFrameworkRequest(request: IncomingMessage, signal: AbortSignal, multipartOptions?: MultipartOptions, maxBodySize?: number, preserveRawBody?: boolean): FrameworkRequest;
|
|
34
|
+
/**
|
|
35
|
+
* Materializes a deferred Node framework request body exactly once.
|
|
36
|
+
*
|
|
37
|
+
* @param request - Framework request returned by {@link createDeferredFrameworkRequest}.
|
|
38
|
+
* @returns A promise that settles after body, rawBody, and files fields are populated when applicable.
|
|
39
|
+
*/
|
|
40
|
+
export declare function materializeFrameworkRequestBody(request: FrameworkRequest): Promise<void>;
|
|
20
41
|
/**
|
|
21
42
|
* Creates an abort signal that fires when the Node response closes unexpectedly.
|
|
22
43
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal-node-request.d.ts","sourceRoot":"","sources":["../../src/node/internal-node-request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,eAAe,EACf,cAAc,EACf,MAAM,WAAW,CAAC;AAInB,OAAO,EAEL,wBAAwB,EACxB,KAAK,gBAAgB,EACtB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAEL,KAAK,gBAAgB,EAEtB,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"internal-node-request.d.ts","sourceRoot":"","sources":["../../src/node/internal-node-request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,eAAe,EACf,cAAc,EACf,MAAM,WAAW,CAAC;AAInB,OAAO,EAEL,wBAAwB,EACxB,KAAK,gBAAgB,EACtB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAEL,KAAK,gBAAgB,EAEtB,MAAM,iBAAiB,CAAC;AAUzB;;GAEG;AACH,qBAAa,mCAAoC,SAAQ,wBAAwB;IACnE,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,eAAe;IAIrD,eAAe,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI;CAahD;AAED;;;;;;;;;GASG;AACH,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,eAAe,EACxB,MAAM,EAAE,WAAW,EACnB,gBAAgB,CAAC,EAAE,gBAAgB,EACnC,WAAW,SAAkB,EAC7B,eAAe,UAAQ,GACtB,OAAO,CAAC,gBAAgB,CAAC,CAW3B;AAED;;;;;;;;;GASG;AACH,wBAAgB,8BAA8B,CAC5C,OAAO,EAAE,eAAe,EACxB,MAAM,EAAE,WAAW,EACnB,gBAAgB,CAAC,EAAE,gBAAgB,EACnC,WAAW,SAAkB,EAC7B,eAAe,UAAQ,GACtB,gBAAgB,CAsDlB;AAED;;;;;GAKG;AACH,wBAAsB,+BAA+B,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAG9F;AAyBD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,cAAc,GAAG,WAAW,CAezE;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,mBAAmB,GAAG,MAAM,GAAG,SAAS,CAG5F"}
|
|
@@ -2,6 +2,9 @@ import { Readable } from 'node:stream';
|
|
|
2
2
|
import { URL } from 'node:url';
|
|
3
3
|
import { BadRequestException, PayloadTooLargeException } from '@fluojs/http';
|
|
4
4
|
import { parseMultipart } from '../multipart.js';
|
|
5
|
+
/**
|
|
6
|
+
* HTTP payload-size error that closes the underlying Node request stream after the response commits.
|
|
7
|
+
*/
|
|
5
8
|
export class NodeRequestPayloadTooLargeException extends PayloadTooLargeException {
|
|
6
9
|
constructor(request) {
|
|
7
10
|
super('Request body exceeds the size limit.');
|
|
@@ -31,51 +34,99 @@ export class NodeRequestPayloadTooLargeException extends PayloadTooLargeExceptio
|
|
|
31
34
|
* @returns The normalized framework request used by the dispatcher.
|
|
32
35
|
*/
|
|
33
36
|
export async function createFrameworkRequest(request, signal, multipartOptions, maxBodySize = 1 * 1024 * 1024, preserveRawBody = false) {
|
|
37
|
+
const frameworkRequest = createDeferredFrameworkRequest(request, signal, multipartOptions, maxBodySize, preserveRawBody);
|
|
38
|
+
await materializeFrameworkRequestBody(frameworkRequest);
|
|
39
|
+
return frameworkRequest;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Creates the cheap Node framework request shell before consuming the body stream.
|
|
44
|
+
*
|
|
45
|
+
* @param request - Raw Node request carrying headers, URL, and body stream.
|
|
46
|
+
* @param signal - Abort signal tied to the response lifecycle.
|
|
47
|
+
* @param multipartOptions - Multipart parser options applied when materializing multipart requests.
|
|
48
|
+
* @param maxBodySize - Maximum allowed non-multipart body size in bytes.
|
|
49
|
+
* @param preserveRawBody - Whether materialization should retain raw request body bytes.
|
|
50
|
+
* @returns The framework request shell with metadata snapshotted and body materialization deferred.
|
|
51
|
+
*/
|
|
52
|
+
export function createDeferredFrameworkRequest(request, signal, multipartOptions, maxBodySize = 1 * 1024 * 1024, preserveRawBody = false) {
|
|
34
53
|
const url = new URL(request.url ?? '/', 'http://localhost');
|
|
35
54
|
const headers = cloneRequestHeaders(request.headers);
|
|
55
|
+
const cookieHeader = cloneHeaderValue(headers.cookie);
|
|
56
|
+
const searchParams = new URLSearchParams(url.searchParams);
|
|
57
|
+
const cookies = createMemoizedValue(() => parseCookieHeader(cookieHeader));
|
|
58
|
+
const query = createMemoizedValue(() => parseQueryParams(searchParams));
|
|
36
59
|
const contentType = readPrimaryHeaderValue(headers['content-type']);
|
|
37
60
|
const isMultipart = typeof contentType === 'string' && contentType.includes('multipart/form-data');
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
} else {
|
|
61
|
+
const materializeBody = createMemoizedAsyncValue(async () => {
|
|
62
|
+
if (isMultipart) {
|
|
63
|
+
const result = await parseMultipart({
|
|
64
|
+
body: Readable.toWeb(request),
|
|
65
|
+
headers,
|
|
66
|
+
method: request.method,
|
|
67
|
+
url: url.toString()
|
|
68
|
+
}, {
|
|
69
|
+
...multipartOptions,
|
|
70
|
+
maxTotalSize: multipartOptions?.maxTotalSize ?? maxBodySize
|
|
71
|
+
});
|
|
72
|
+
frameworkRequest.body = result.fields;
|
|
73
|
+
frameworkRequest.files = result.files;
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
54
76
|
const bodyResult = await readRequestBody(request, headers['content-type'], maxBodySize, preserveRawBody);
|
|
55
|
-
body = bodyResult.body;
|
|
56
|
-
|
|
57
|
-
|
|
77
|
+
frameworkRequest.body = bodyResult.body;
|
|
78
|
+
if (bodyResult.rawBody) {
|
|
79
|
+
frameworkRequest.rawBody = bodyResult.rawBody;
|
|
80
|
+
}
|
|
81
|
+
});
|
|
58
82
|
const frameworkRequest = {
|
|
59
|
-
|
|
60
|
-
|
|
83
|
+
get cookies() {
|
|
84
|
+
return cookies();
|
|
85
|
+
},
|
|
61
86
|
headers,
|
|
62
87
|
method: request.method ?? 'GET',
|
|
63
88
|
params: {},
|
|
64
89
|
path: url.pathname,
|
|
65
|
-
query
|
|
90
|
+
get query() {
|
|
91
|
+
return query();
|
|
92
|
+
},
|
|
66
93
|
raw: request,
|
|
67
94
|
signal,
|
|
68
|
-
url: url.pathname + url.search
|
|
95
|
+
url: url.pathname + url.search,
|
|
96
|
+
materializeBody
|
|
69
97
|
};
|
|
70
|
-
if (files) {
|
|
71
|
-
frameworkRequest.files = files;
|
|
72
|
-
}
|
|
73
|
-
if (rawBody) {
|
|
74
|
-
frameworkRequest.rawBody = rawBody;
|
|
75
|
-
}
|
|
76
98
|
return frameworkRequest;
|
|
77
99
|
}
|
|
78
100
|
|
|
101
|
+
/**
|
|
102
|
+
* Materializes a deferred Node framework request body exactly once.
|
|
103
|
+
*
|
|
104
|
+
* @param request - Framework request returned by {@link createDeferredFrameworkRequest}.
|
|
105
|
+
* @returns A promise that settles after body, rawBody, and files fields are populated when applicable.
|
|
106
|
+
*/
|
|
107
|
+
export async function materializeFrameworkRequestBody(request) {
|
|
108
|
+
await request.materializeBody?.();
|
|
109
|
+
delete request.materializeBody;
|
|
110
|
+
}
|
|
111
|
+
function createMemoizedValue(factory) {
|
|
112
|
+
let initialized = false;
|
|
113
|
+
let value;
|
|
114
|
+
return () => {
|
|
115
|
+
if (!initialized) {
|
|
116
|
+
value = factory();
|
|
117
|
+
initialized = true;
|
|
118
|
+
}
|
|
119
|
+
return value;
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
function createMemoizedAsyncValue(factory) {
|
|
123
|
+
let promise;
|
|
124
|
+
return () => {
|
|
125
|
+
promise ??= factory();
|
|
126
|
+
return promise;
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
|
|
79
130
|
/**
|
|
80
131
|
* Creates an abort signal that fires when the Node response closes unexpectedly.
|
|
81
132
|
*
|
|
@@ -124,9 +175,12 @@ function parseQueryParams(searchParams) {
|
|
|
124
175
|
return query;
|
|
125
176
|
}
|
|
126
177
|
function cloneRequestHeaders(headers) {
|
|
127
|
-
const clonedEntries = Object.entries(headers).map(([name, value]) => [name,
|
|
178
|
+
const clonedEntries = Object.entries(headers).map(([name, value]) => [name, cloneHeaderValue(value)]);
|
|
128
179
|
return Object.fromEntries(clonedEntries);
|
|
129
180
|
}
|
|
181
|
+
function cloneHeaderValue(value) {
|
|
182
|
+
return Array.isArray(value) ? [...value] : value;
|
|
183
|
+
}
|
|
130
184
|
function readPrimaryHeaderValue(headerValue) {
|
|
131
185
|
if (Array.isArray(headerValue)) {
|
|
132
186
|
return headerValue[0];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal-node.d.ts","sourceRoot":"","sources":["../../src/node/internal-node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,IAAI,gB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C;IAU7C,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;YAad,aAAa;CAY5B;AAiDD,wBAAgB,qBAAqB,CAAC,OAAO,GAAE,sBAA2B,EAAE,WAAW,UAAQ,EAAE,gBAAgB,CAAC,EAAE,gBAAgB,GAAG,sBAAsB,CAa5J;AAED,wBAAsB,wBAAwB,CAC5C,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,+BAA+B,GACvC,OAAO,CAAC,WAAW,CAAC,CAMtB;AAED,wBAAsB,kBAAkB,CACtC,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,yBAAyB,GACjC,OAAO,CAAC,WAAW,CAAC,CAQtB;AAED,OAAO,EACL,oBAAoB,EACpB,6BAA6B,EAC7B,oCAAoC,EACpC,0BAA0B,EAC1B,uBAAuB,GACxB,CAAC"}
|
|
@@ -3,7 +3,7 @@ import { createServer as createHttpsServer } from 'node:https';
|
|
|
3
3
|
import { createServerBackedHttpAdapterRealtimeCapability } from '@fluojs/http';
|
|
4
4
|
import { bootstrapHttpAdapterApplication, runHttpAdapterApplication } from '../http-adapter-shared.js';
|
|
5
5
|
import { createNodeResponseCompression, compressNodeResponse } from './internal-node-compression.js';
|
|
6
|
-
import {
|
|
6
|
+
import { createDeferredFrameworkRequest, NodeRequestPayloadTooLargeException, createRequestSignal, materializeFrameworkRequestBody, resolveRequestIdFromHeaders } from './internal-node-request.js';
|
|
7
7
|
import { createFrameworkResponse, writeNodeAdapterErrorResponse } from './internal-node-response.js';
|
|
8
8
|
import { createNodeShutdownSignalRegistration, defaultNodeShutdownSignals, registerShutdownSignals } from './internal-node-shutdown.js';
|
|
9
9
|
import { dispatchWithRequestResponseFactory } from '../adapters/request-response-factory.js';
|
|
@@ -75,7 +75,10 @@ export class NodeHttpApplicationAdapter {
|
|
|
75
75
|
function createNodeRequestResponseFactory(compression, multipartOptions, maxBodySize, preserveRawBody) {
|
|
76
76
|
return {
|
|
77
77
|
async createRequest(request, signal) {
|
|
78
|
-
return
|
|
78
|
+
return createDeferredFrameworkRequest(request, signal, multipartOptions, maxBodySize, preserveRawBody);
|
|
79
|
+
},
|
|
80
|
+
materializeRequest(request) {
|
|
81
|
+
return materializeFrameworkRequestBody(request);
|
|
79
82
|
},
|
|
80
83
|
createRequestSignal(response) {
|
|
81
84
|
return createRequestSignal(response);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { createFrameworkRequest, createRequestSignal, resolveRequestIdFromHeaders, } from './internal-node-request.js';
|
|
1
|
+
export { createDeferredFrameworkRequest, createFrameworkRequest, createRequestSignal, materializeFrameworkRequestBody, resolveRequestIdFromHeaders, } from './internal-node-request.js';
|
|
2
2
|
//# sourceMappingURL=node-request.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-request.d.ts","sourceRoot":"","sources":["../../src/node/node-request.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,2BAA2B,GAC5B,MAAM,4BAA4B,CAAC"}
|
|
1
|
+
{"version":3,"file":"node-request.d.ts","sourceRoot":"","sources":["../../src/node/node-request.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,8BAA8B,EAC9B,sBAAsB,EACtB,mBAAmB,EACnB,+BAA+B,EAC/B,2BAA2B,GAC5B,MAAM,4BAA4B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { createFrameworkRequest, createRequestSignal, resolveRequestIdFromHeaders } from './internal-node-request.js';
|
|
1
|
+
export { createDeferredFrameworkRequest, createFrameworkRequest, createRequestSignal, materializeFrameworkRequestBody, resolveRequestIdFromHeaders } from './internal-node-request.js';
|
package/dist/platform-shell.d.ts
CHANGED
|
@@ -28,6 +28,10 @@ export declare class RuntimePlatformShell implements PlatformShell {
|
|
|
28
28
|
ready(): Promise<PlatformReadinessReport>;
|
|
29
29
|
health(): Promise<PlatformHealthReport>;
|
|
30
30
|
snapshot(): Promise<PlatformShellSnapshot>;
|
|
31
|
+
private collectSnapshotProbe;
|
|
32
|
+
private collectComponentSnapshot;
|
|
33
|
+
private collectComponentReadiness;
|
|
34
|
+
private collectComponentHealth;
|
|
31
35
|
assertCriticalReadiness(): Promise<void>;
|
|
32
36
|
private validateIdentityAndDependencies;
|
|
33
37
|
private validateComponents;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform-shell.d.ts","sourceRoot":"","sources":["../src/platform-shell.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,iBAAiB,EACjB,sBAAsB,EAGtB,oBAAoB,EACpB,uBAAuB,EACvB,aAAa,EACb,qBAAqB,EAGtB,MAAM,wBAAwB,CAAC;AAEhC,UAAU,2BAA2B;IACnC,SAAS,EAAE,iBAAiB,CAAC;IAC7B,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;CACjC;
|
|
1
|
+
{"version":3,"file":"platform-shell.d.ts","sourceRoot":"","sources":["../src/platform-shell.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,iBAAiB,EACjB,sBAAsB,EAGtB,oBAAoB,EACpB,uBAAuB,EACvB,aAAa,EACb,qBAAqB,EAGtB,MAAM,wBAAwB,CAAC;AAEhC,UAAU,2BAA2B;IACnC,SAAS,EAAE,iBAAiB,CAAC;IAC7B,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;CACjC;AAwID;;;GAGG;AACH,qBAAa,oBAAqB,YAAW,aAAa;IAO5C,OAAO,CAAC,QAAQ,CAAC,oBAAoB;IANjD,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,iBAAiB,CAAqC;IAC9D,OAAO,CAAC,yBAAyB,CAAqC;IACtE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAiC;gBAEhC,oBAAoB,EAAE,2BAA2B,EAAE;IAEhF;;;;;OAKG;IACH,MAAM,CAAC,UAAU,CAAC,UAAU,EAAE,SAAS,sBAAsB,EAAE,GAAG,SAAS,GAAG,oBAAoB;IAIlG,uBAAuB,IAAI,OAAO;IAI5B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAiDtB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAmBrB,KAAK,IAAI,OAAO,CAAC,uBAAuB,CAAC;IA2BzC,MAAM,IAAI,OAAO,CAAC,oBAAoB,CAAC;IAyBvC,QAAQ,IAAI,OAAO,CAAC,qBAAqB,CAAC;YAuBlC,oBAAoB;IAmBlC,OAAO,CAAC,wBAAwB;YAuClB,yBAAyB;YAmBzB,sBAAsB;IAkB9B,uBAAuB,IAAI,OAAO,CAAC,IAAI,CAAC;IAU9C,OAAO,CAAC,+BAA+B;YAgCzB,kBAAkB;IA4BhC,OAAO,CAAC,iBAAiB;YAsCX,qBAAqB;CAgBpC;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,UAAU,EAAE,SAAS,sBAAsB,EAAE,GAAG,SAAS,GAAG,oBAAoB,CAE1H"}
|
package/dist/platform-shell.js
CHANGED
|
@@ -96,7 +96,6 @@ function normalizeSnapshot(snapshot, component, dependencies) {
|
|
|
96
96
|
kind: component.kind
|
|
97
97
|
};
|
|
98
98
|
}
|
|
99
|
-
|
|
100
99
|
/**
|
|
101
100
|
* A runtime implementation of the {@link PlatformShell} that manages the lifecycle
|
|
102
101
|
* of registered platform components, including dependency ordering and diagnostics.
|
|
@@ -219,15 +218,41 @@ export class RuntimePlatformShell {
|
|
|
219
218
|
if (!this.hasRegisteredComponents()) {
|
|
220
219
|
return createEmptyShellSnapshot([...this.diagnostics]);
|
|
221
220
|
}
|
|
222
|
-
const
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
221
|
+
const probeResults = await Promise.all(this.registeredComponents.map(registration => this.collectSnapshotProbe(registration)));
|
|
222
|
+
const components = probeResults.map(result => result.snapshot);
|
|
223
|
+
const readiness = aggregateReadiness(probeResults.map(result => result.readiness));
|
|
224
|
+
const health = aggregateHealth(probeResults.map(result => result.health));
|
|
225
|
+
const diagnostics = probeResults.flatMap(result => result.diagnostics);
|
|
226
|
+
this.diagnostics.push(...diagnostics);
|
|
227
|
+
return {
|
|
228
|
+
components,
|
|
229
|
+
diagnostics: [...this.diagnostics],
|
|
230
|
+
generatedAt: new Date().toISOString(),
|
|
231
|
+
health,
|
|
232
|
+
readiness
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
async collectSnapshotProbe(registration) {
|
|
236
|
+
const [snapshot, readiness, health] = await Promise.all([this.collectComponentSnapshot(registration), this.collectComponentReadiness(registration), this.collectComponentHealth(registration)]);
|
|
237
|
+
return {
|
|
238
|
+
diagnostics: [...snapshot.diagnostics, ...readiness.diagnostics, ...health.diagnostics],
|
|
239
|
+
health: health.health,
|
|
240
|
+
readiness: readiness.readiness,
|
|
241
|
+
snapshot: snapshot.snapshot
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
collectComponentSnapshot(registration) {
|
|
245
|
+
try {
|
|
246
|
+
const snapshot = registration.component.snapshot();
|
|
247
|
+
return {
|
|
248
|
+
diagnostics: [],
|
|
249
|
+
snapshot: normalizeSnapshot(snapshot, registration.component, registration.dependencies)
|
|
250
|
+
};
|
|
251
|
+
} catch (error) {
|
|
252
|
+
const issue = createUnknownFailureIssue(registration.component.id, 'snapshot', error);
|
|
253
|
+
return {
|
|
254
|
+
diagnostics: [issue],
|
|
255
|
+
snapshot: {
|
|
231
256
|
dependencies: [...registration.dependencies],
|
|
232
257
|
details: {},
|
|
233
258
|
health: {
|
|
@@ -250,17 +275,44 @@ export class RuntimePlatformShell {
|
|
|
250
275
|
namespace: 'fluo.platform',
|
|
251
276
|
tags: {}
|
|
252
277
|
}
|
|
253
|
-
}
|
|
254
|
-
}
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
async collectComponentReadiness(registration) {
|
|
283
|
+
try {
|
|
284
|
+
return {
|
|
285
|
+
diagnostics: [],
|
|
286
|
+
readiness: await registration.component.ready()
|
|
287
|
+
};
|
|
288
|
+
} catch (error) {
|
|
289
|
+
const issue = createUnknownFailureIssue(registration.component.id, 'ready', error);
|
|
290
|
+
return {
|
|
291
|
+
diagnostics: [issue],
|
|
292
|
+
readiness: {
|
|
293
|
+
critical: true,
|
|
294
|
+
reason: issue.cause,
|
|
295
|
+
status: 'not-ready'
|
|
296
|
+
}
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
async collectComponentHealth(registration) {
|
|
301
|
+
try {
|
|
302
|
+
return {
|
|
303
|
+
diagnostics: [],
|
|
304
|
+
health: await registration.component.health()
|
|
305
|
+
};
|
|
306
|
+
} catch (error) {
|
|
307
|
+
const issue = createUnknownFailureIssue(registration.component.id, 'health', error);
|
|
308
|
+
return {
|
|
309
|
+
diagnostics: [issue],
|
|
310
|
+
health: {
|
|
311
|
+
reason: issue.cause,
|
|
312
|
+
status: 'unhealthy'
|
|
313
|
+
}
|
|
314
|
+
};
|
|
255
315
|
}
|
|
256
|
-
const [readiness, health] = await Promise.all([this.ready(), this.health()]);
|
|
257
|
-
return {
|
|
258
|
-
components,
|
|
259
|
-
diagnostics: [...this.diagnostics],
|
|
260
|
-
generatedAt: new Date().toISOString(),
|
|
261
|
-
health,
|
|
262
|
-
readiness
|
|
263
|
-
};
|
|
264
316
|
}
|
|
265
317
|
async assertCriticalReadiness() {
|
|
266
318
|
const readiness = await this.ready();
|
package/dist/types.d.ts
CHANGED
|
@@ -29,12 +29,21 @@ export interface BootstrapModuleOptions {
|
|
|
29
29
|
export interface CompiledModule {
|
|
30
30
|
type: ModuleType;
|
|
31
31
|
definition: ModuleDefinition;
|
|
32
|
+
accessibleTokens: Set<Token>;
|
|
32
33
|
exportedTokens: Set<Token>;
|
|
34
|
+
importedExportedTokens: Set<Token>;
|
|
33
35
|
providerTokens: Set<Token>;
|
|
34
36
|
}
|
|
37
|
+
/** Provider declarations that actually win runtime bootstrap registration after duplicate-policy selection. */
|
|
38
|
+
export interface BootstrapEffectiveProviders {
|
|
39
|
+
moduleProviders: Provider[];
|
|
40
|
+
rootModuleProviders: Provider[];
|
|
41
|
+
runtimeProviders: Provider[];
|
|
42
|
+
}
|
|
35
43
|
/** Result returned by low-level bootstrap compilation helpers. */
|
|
36
44
|
export interface BootstrapResult {
|
|
37
45
|
container: Container;
|
|
46
|
+
effectiveProviders: BootstrapEffectiveProviders;
|
|
38
47
|
modules: CompiledModule[];
|
|
39
48
|
rootModule: ModuleType;
|
|
40
49
|
}
|
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,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,KAAK,EACV,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EACjB,sBAAsB,EACtB,eAAe,EACf,cAAc,EACd,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAErE,+EAA+E;AAC/E,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG;IAAE,UAAU,CAAC,EAAE,gBAAgB,CAAA;CAAE,CAAC;AACzE,yEAAyE;AACzE,MAAM,MAAM,cAAc,GAAG,WAAW,CAAC;AAEzC,iFAAiF;AACjF,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC;IACvB,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;IACvB,WAAW,CAAC,EAAE,cAAc,EAAE,CAAC;IAC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,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACjF"}
|
package/dist/web.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.d.ts","sourceRoot":"","sources":["../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACvB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAEL,KAAK,sBAAsB,EAC5B,MAAM,wCAAwC,CAAC;AAEhD,OAAO,QAAQ,cAAc,CAAC;IAC5B,UAAU,gBAAgB;QACxB,KAAK,CAAC,EAAE,YAAY,EAAE,CAAC;QACvB,OAAO,CAAC,EAAE,UAAU,CAAC;KACtB;CACF;AAOD;;GAEG;AACH,MAAM,WAAW,sCAAsC;IACrD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,yBAA0B,SAAQ,sCAAsC;IACvF,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAqB,SAAQ,iBAAiB;IAC7D,UAAU,IAAI,QAAQ,CAAC;CACxB;AAED,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"web.d.ts","sourceRoot":"","sources":["../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACvB,MAAM,cAAc,CAAC;AAEtB,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C,CAW3B"}
|
package/dist/web.js
CHANGED
|
@@ -152,7 +152,10 @@ class MutableWebFrameworkResponse {
|
|
|
152
152
|
export function createWebRequestResponseFactory(options = {}) {
|
|
153
153
|
return {
|
|
154
154
|
async createRequest(request, signal) {
|
|
155
|
-
return
|
|
155
|
+
return createDeferredWebFrameworkRequest(request, signal, options.multipart, options.maxBodySize ?? DEFAULT_MAX_BODY_SIZE, options.rawBody ?? false);
|
|
156
|
+
},
|
|
157
|
+
materializeRequest(request) {
|
|
158
|
+
return materializeWebFrameworkRequestBody(request);
|
|
156
159
|
},
|
|
157
160
|
createRequestSignal(signal) {
|
|
158
161
|
return signal ?? new AbortController().signal;
|
|
@@ -204,45 +207,103 @@ export async function dispatchWebRequest({
|
|
|
204
207
|
* @returns The normalized framework request used by the dispatcher.
|
|
205
208
|
*/
|
|
206
209
|
export async function createWebFrameworkRequest(request, signal, multipartOptions, maxBodySize = DEFAULT_MAX_BODY_SIZE, preserveRawBody = false) {
|
|
210
|
+
const frameworkRequest = createDeferredWebFrameworkRequest(request, signal, multipartOptions, maxBodySize, preserveRawBody);
|
|
211
|
+
await materializeWebFrameworkRequestBody(frameworkRequest);
|
|
212
|
+
return frameworkRequest;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Creates the cheap Web framework request shell before consuming the body stream.
|
|
217
|
+
*
|
|
218
|
+
* @param request - Native Web request to normalize.
|
|
219
|
+
* @param signal - Abort signal propagated to the framework request.
|
|
220
|
+
* @param multipartOptions - Multipart parser options applied when materializing multipart requests.
|
|
221
|
+
* @param maxBodySize - Maximum allowed non-multipart body size in bytes.
|
|
222
|
+
* @param preserveRawBody - Whether materialization should retain raw request body bytes.
|
|
223
|
+
* @returns The framework request shell with metadata snapshotted and body materialization deferred.
|
|
224
|
+
*/
|
|
225
|
+
function createDeferredWebFrameworkRequest(request, signal, multipartOptions, maxBodySize = DEFAULT_MAX_BODY_SIZE, preserveRawBody = false) {
|
|
207
226
|
const url = new URL(request.url);
|
|
208
|
-
const
|
|
227
|
+
const headerEntries = Array.from(request.headers.entries());
|
|
228
|
+
const method = request.method;
|
|
229
|
+
const cookieHeader = request.headers.get('cookie') ?? undefined;
|
|
230
|
+
const searchParams = new URLSearchParams(url.searchParams);
|
|
231
|
+
const headers = createMemoizedValue(() => cloneWebHeaders(headerEntries));
|
|
232
|
+
const cookies = createMemoizedValue(() => parseCookieHeader(cookieHeader));
|
|
233
|
+
const query = createMemoizedValue(() => parseQueryParams(searchParams));
|
|
209
234
|
const contentType = request.headers.get('content-type') ?? undefined;
|
|
210
235
|
const isMultipart = typeof contentType === 'string' && contentType.includes('multipart/form-data');
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
236
|
+
const materializeBody = createMemoizedAsyncValue(async () => {
|
|
237
|
+
if (isMultipart) {
|
|
238
|
+
const materializedRequest = request.clone();
|
|
239
|
+
const result = await parseMultipart({
|
|
240
|
+
body: materializedRequest.body,
|
|
241
|
+
headers: new Headers(headerEntries),
|
|
242
|
+
method,
|
|
243
|
+
url: url.toString()
|
|
244
|
+
}, {
|
|
245
|
+
...multipartOptions,
|
|
246
|
+
maxTotalSize: multipartOptions?.maxTotalSize ?? maxBodySize
|
|
247
|
+
});
|
|
248
|
+
frameworkRequest.body = result.fields;
|
|
249
|
+
frameworkRequest.files = result.files;
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
222
252
|
const bodyResult = await readWebRequestBody(request.clone(), contentType, maxBodySize, preserveRawBody);
|
|
223
|
-
body = bodyResult.body;
|
|
224
|
-
|
|
225
|
-
|
|
253
|
+
frameworkRequest.body = bodyResult.body;
|
|
254
|
+
if (bodyResult.rawBody) {
|
|
255
|
+
frameworkRequest.rawBody = bodyResult.rawBody;
|
|
256
|
+
}
|
|
257
|
+
});
|
|
226
258
|
const frameworkRequest = {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
259
|
+
get cookies() {
|
|
260
|
+
return cookies();
|
|
261
|
+
},
|
|
262
|
+
get headers() {
|
|
263
|
+
return headers();
|
|
264
|
+
},
|
|
265
|
+
method,
|
|
231
266
|
params: {},
|
|
232
267
|
path: url.pathname,
|
|
233
|
-
query
|
|
268
|
+
get query() {
|
|
269
|
+
return query();
|
|
270
|
+
},
|
|
234
271
|
raw: request,
|
|
235
272
|
signal,
|
|
236
|
-
url: url.pathname + url.search
|
|
273
|
+
url: url.pathname + url.search,
|
|
274
|
+
materializeBody
|
|
237
275
|
};
|
|
238
|
-
if (files) {
|
|
239
|
-
frameworkRequest.files = files;
|
|
240
|
-
}
|
|
241
|
-
if (rawBody) {
|
|
242
|
-
frameworkRequest.rawBody = rawBody;
|
|
243
|
-
}
|
|
244
276
|
return frameworkRequest;
|
|
245
277
|
}
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Materializes a deferred Web framework request body exactly once.
|
|
281
|
+
*
|
|
282
|
+
* @param request - Framework request returned by {@link createDeferredWebFrameworkRequest}.
|
|
283
|
+
* @returns A promise that settles after body, rawBody, and files fields are populated when applicable.
|
|
284
|
+
*/
|
|
285
|
+
async function materializeWebFrameworkRequestBody(request) {
|
|
286
|
+
await request.materializeBody?.();
|
|
287
|
+
delete request.materializeBody;
|
|
288
|
+
}
|
|
289
|
+
function createMemoizedValue(factory) {
|
|
290
|
+
let initialized = false;
|
|
291
|
+
let value;
|
|
292
|
+
return () => {
|
|
293
|
+
if (!initialized) {
|
|
294
|
+
value = factory();
|
|
295
|
+
initialized = true;
|
|
296
|
+
}
|
|
297
|
+
return value;
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
function createMemoizedAsyncValue(factory) {
|
|
301
|
+
let promise;
|
|
302
|
+
return () => {
|
|
303
|
+
promise ??= factory();
|
|
304
|
+
return promise;
|
|
305
|
+
};
|
|
306
|
+
}
|
|
246
307
|
function parseQueryParams(searchParams) {
|
|
247
308
|
const query = {};
|
|
248
309
|
for (const [key, value] of searchParams.entries()) {
|
|
@@ -261,7 +322,7 @@ function parseQueryParams(searchParams) {
|
|
|
261
322
|
}
|
|
262
323
|
function cloneWebHeaders(headers) {
|
|
263
324
|
const clonedHeaders = {};
|
|
264
|
-
for (const [name, value] of headers
|
|
325
|
+
for (const [name, value] of headers) {
|
|
265
326
|
clonedHeaders[name] = value;
|
|
266
327
|
}
|
|
267
328
|
return clonedHeaders;
|
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.3",
|
|
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.
|
|
73
|
-
"@fluojs/http": "^1.0.0-beta.
|
|
70
|
+
"@fluojs/config": "^1.0.0-beta.3",
|
|
71
|
+
"@fluojs/core": "^1.0.0-beta.2",
|
|
72
|
+
"@fluojs/di": "^1.0.0-beta.3",
|
|
73
|
+
"@fluojs/http": "^1.0.0-beta.2"
|
|
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.3"
|
|
78
78
|
},
|
|
79
79
|
"scripts": {
|
|
80
80
|
"prebuild": "node ../../tooling/scripts/clean-dist.mjs",
|