@fluojs/runtime 1.1.1 → 1.1.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 +8 -0
- package/README.md +8 -0
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +41 -19
- package/dist/devtools/contracts.d.ts +138 -0
- package/dist/devtools/contracts.d.ts.map +1 -0
- package/dist/devtools/contracts.js +1 -0
- package/dist/devtools/index.d.ts +4 -0
- package/dist/devtools/index.d.ts.map +1 -0
- package/dist/devtools/index.js +2 -0
- package/dist/devtools/snapshot.d.ts +39 -0
- package/dist/devtools/snapshot.d.ts.map +1 -0
- package/dist/devtools/snapshot.js +345 -0
- package/dist/devtools/studio-runtime.d.ts +96 -0
- package/dist/devtools/studio-runtime.d.ts.map +1 -0
- package/dist/devtools/studio-runtime.js +335 -0
- package/dist/http-adapter-shared.js +3 -3
- package/dist/logging/default-logger.d.ts +8 -0
- package/dist/logging/default-logger.d.ts.map +1 -0
- package/dist/logging/default-logger.js +28 -0
- package/dist/node/internal-node.d.ts.map +1 -1
- package/dist/node/internal-node.js +8 -1
- package/package.json +3 -3
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
import { createStudioLiveSnapshot, handlerToStudioRouteDescriptor } from './snapshot.js';
|
|
2
|
+
const runtimePerformance = globalThis.performance ?? {
|
|
3
|
+
now: () => Date.now()
|
|
4
|
+
};
|
|
5
|
+
const processStart = runtimePerformance.now();
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Describes Studio Devtools Runtime Transport data used by the Studio devtool.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Describes Studio Devtools Runtime Options data used by the Studio devtool.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Describes Studio Bootstrap Snapshot Input data used by the Studio devtool.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Describes Studio Devtools Config data used by the Studio devtool.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
function isEnabled(value) {
|
|
24
|
+
return value === '1' || value === 'true' || value === 'yes';
|
|
25
|
+
}
|
|
26
|
+
function createEpoch() {
|
|
27
|
+
if (typeof globalThis.crypto?.randomUUID === 'function') {
|
|
28
|
+
return globalThis.crypto.randomUUID();
|
|
29
|
+
}
|
|
30
|
+
return `epoch-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;
|
|
31
|
+
}
|
|
32
|
+
function createAppId() {
|
|
33
|
+
return `app-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;
|
|
34
|
+
}
|
|
35
|
+
function createRequestId() {
|
|
36
|
+
return `req-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;
|
|
37
|
+
}
|
|
38
|
+
function normalizeRuntime(value) {
|
|
39
|
+
if (value === 'node' || value === 'bun' || value === 'deno' || value === 'worker') {
|
|
40
|
+
return value;
|
|
41
|
+
}
|
|
42
|
+
return 'node';
|
|
43
|
+
}
|
|
44
|
+
function isRecord(value) {
|
|
45
|
+
return typeof value === 'object' && value !== null;
|
|
46
|
+
}
|
|
47
|
+
function resolveEndpoint(env) {
|
|
48
|
+
if (env.FLUO_STUDIO_ENDPOINT) {
|
|
49
|
+
return env.FLUO_STUDIO_ENDPOINT;
|
|
50
|
+
}
|
|
51
|
+
if (!env.FLUO_STUDIO_URL) {
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
try {
|
|
55
|
+
return new URL('/api/runtime/events', env.FLUO_STUDIO_URL).toString();
|
|
56
|
+
} catch {
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function toErrorPayload(error) {
|
|
61
|
+
if (error instanceof Error) {
|
|
62
|
+
return {
|
|
63
|
+
message: error.message,
|
|
64
|
+
name: error.name
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
message: String(error)
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function sanitizeRequestUrl(value) {
|
|
72
|
+
try {
|
|
73
|
+
const parsed = new URL(value, 'http://fluo.local');
|
|
74
|
+
return parsed.pathname || '/';
|
|
75
|
+
} catch {
|
|
76
|
+
return value.split('#', 1)[0]?.split('?', 1)[0] || value;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
function traceToPayload(trace, statusCode) {
|
|
80
|
+
const payload = {
|
|
81
|
+
method: trace.method,
|
|
82
|
+
path: trace.path,
|
|
83
|
+
requestId: trace.requestId,
|
|
84
|
+
startedAt: trace.startedAt,
|
|
85
|
+
status: trace.status,
|
|
86
|
+
url: trace.url
|
|
87
|
+
};
|
|
88
|
+
if (trace.handler) {
|
|
89
|
+
const route = handlerToStudioRouteDescriptor(trace.handler);
|
|
90
|
+
payload.controller = route.controller;
|
|
91
|
+
payload.handler = route.handler;
|
|
92
|
+
payload.routeId = route.id;
|
|
93
|
+
}
|
|
94
|
+
if (trace.error) {
|
|
95
|
+
payload.error = trace.error;
|
|
96
|
+
}
|
|
97
|
+
if (statusCode !== undefined) {
|
|
98
|
+
payload.statusCode = statusCode;
|
|
99
|
+
}
|
|
100
|
+
if (trace.status === 'succeeded' || trace.status === 'failed' || trace.status === 'finished') {
|
|
101
|
+
payload.finishedAt = new Date().toISOString();
|
|
102
|
+
payload.durationMs = Number((runtimePerformance.now() - trace.startMs).toFixed(3));
|
|
103
|
+
}
|
|
104
|
+
return payload;
|
|
105
|
+
}
|
|
106
|
+
class FetchStudioTransport {
|
|
107
|
+
constructor(endpoint, token) {
|
|
108
|
+
this.endpoint = endpoint;
|
|
109
|
+
this.token = token;
|
|
110
|
+
}
|
|
111
|
+
async publish(event) {
|
|
112
|
+
await globalThis.fetch(this.endpoint, {
|
|
113
|
+
body: JSON.stringify(event),
|
|
114
|
+
headers: {
|
|
115
|
+
authorization: `Bearer ${this.token}`,
|
|
116
|
+
'content-type': 'application/json'
|
|
117
|
+
},
|
|
118
|
+
method: 'POST'
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
class StudioRequestObserver {
|
|
123
|
+
traces = new WeakMap();
|
|
124
|
+
constructor(runtime) {
|
|
125
|
+
this.runtime = runtime;
|
|
126
|
+
}
|
|
127
|
+
onRequestStart(context) {
|
|
128
|
+
const request = context.requestContext.request;
|
|
129
|
+
const requestId = request.requestId ?? (typeof request.headers['x-request-id'] === 'string' ? request.headers['x-request-id'] : undefined) ?? createRequestId();
|
|
130
|
+
const trace = {
|
|
131
|
+
method: request.method,
|
|
132
|
+
path: request.path,
|
|
133
|
+
requestId,
|
|
134
|
+
startedAt: new Date().toISOString(),
|
|
135
|
+
startMs: runtimePerformance.now(),
|
|
136
|
+
status: 'started',
|
|
137
|
+
url: sanitizeRequestUrl(request.url)
|
|
138
|
+
};
|
|
139
|
+
this.traces.set(context.requestContext, trace);
|
|
140
|
+
this.runtime.publish('request', traceToPayload(trace));
|
|
141
|
+
}
|
|
142
|
+
onHandlerMatched(context) {
|
|
143
|
+
const trace = this.ensureTrace(context);
|
|
144
|
+
trace.handler = context.handler;
|
|
145
|
+
trace.status = 'matched';
|
|
146
|
+
this.runtime.publish('request', traceToPayload(trace));
|
|
147
|
+
}
|
|
148
|
+
onRequestSuccess(context) {
|
|
149
|
+
const trace = this.ensureTrace(context);
|
|
150
|
+
trace.handler = context.handler ?? trace.handler;
|
|
151
|
+
trace.status = 'succeeded';
|
|
152
|
+
}
|
|
153
|
+
onRequestError(context, error) {
|
|
154
|
+
const trace = this.ensureTrace(context);
|
|
155
|
+
trace.handler = context.handler ?? trace.handler;
|
|
156
|
+
trace.error = toErrorPayload(error);
|
|
157
|
+
trace.status = 'failed';
|
|
158
|
+
this.runtime.publish('request', traceToPayload(trace, context.requestContext.response.statusCode));
|
|
159
|
+
}
|
|
160
|
+
onRequestFinish(context) {
|
|
161
|
+
const trace = this.ensureTrace(context);
|
|
162
|
+
trace.handler = context.handler ?? trace.handler;
|
|
163
|
+
if (trace.status !== 'failed' && trace.status !== 'succeeded') {
|
|
164
|
+
trace.status = 'finished';
|
|
165
|
+
}
|
|
166
|
+
this.runtime.publish('request', traceToPayload(trace, context.requestContext.response.statusCode));
|
|
167
|
+
}
|
|
168
|
+
ensureTrace(context) {
|
|
169
|
+
const existing = this.traces.get(context.requestContext);
|
|
170
|
+
if (existing) {
|
|
171
|
+
return existing;
|
|
172
|
+
}
|
|
173
|
+
const request = context.requestContext.request;
|
|
174
|
+
const trace = {
|
|
175
|
+
method: request.method,
|
|
176
|
+
path: request.path,
|
|
177
|
+
requestId: request.requestId ?? createRequestId(),
|
|
178
|
+
startedAt: new Date().toISOString(),
|
|
179
|
+
startMs: runtimePerformance.now(),
|
|
180
|
+
status: 'started',
|
|
181
|
+
url: sanitizeRequestUrl(request.url)
|
|
182
|
+
};
|
|
183
|
+
this.traces.set(context.requestContext, trace);
|
|
184
|
+
return trace;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/** Process-local runtime bridge used only when Studio env injection is present. */
|
|
189
|
+
export class StudioDevtoolsRuntime {
|
|
190
|
+
epoch;
|
|
191
|
+
observer = new StudioRequestObserver(this);
|
|
192
|
+
sequence = 0;
|
|
193
|
+
constructor(options) {
|
|
194
|
+
this.options = options;
|
|
195
|
+
this.epoch = options.epoch ?? createEpoch();
|
|
196
|
+
}
|
|
197
|
+
get appId() {
|
|
198
|
+
return this.options.appId;
|
|
199
|
+
}
|
|
200
|
+
get requestObserver() {
|
|
201
|
+
return this.observer;
|
|
202
|
+
}
|
|
203
|
+
publish(type, payload) {
|
|
204
|
+
this.sequence += 1;
|
|
205
|
+
const event = {
|
|
206
|
+
emittedAt: new Date().toISOString(),
|
|
207
|
+
epoch: this.epoch,
|
|
208
|
+
eventId: `${this.epoch}:${String(this.sequence)}`,
|
|
209
|
+
payload,
|
|
210
|
+
sequence: this.sequence,
|
|
211
|
+
source: {
|
|
212
|
+
appId: this.options.appId,
|
|
213
|
+
runtime: this.options.runtime ?? 'node'
|
|
214
|
+
},
|
|
215
|
+
type,
|
|
216
|
+
version: 1
|
|
217
|
+
};
|
|
218
|
+
void Promise.resolve(this.options.transport.publish(event)).catch(() => undefined);
|
|
219
|
+
}
|
|
220
|
+
publishBootstrapSnapshot(input) {
|
|
221
|
+
const snapshot = createStudioLiveSnapshot({
|
|
222
|
+
appId: this.options.appId,
|
|
223
|
+
diagnostics: input.diagnostics,
|
|
224
|
+
modules: input.modules,
|
|
225
|
+
rootModule: input.rootModule,
|
|
226
|
+
routes: input.routes,
|
|
227
|
+
timing: input.timing
|
|
228
|
+
});
|
|
229
|
+
if (input.timing) {
|
|
230
|
+
this.publish('timing', input.timing);
|
|
231
|
+
}
|
|
232
|
+
this.publish('snapshot', snapshot);
|
|
233
|
+
}
|
|
234
|
+
close() {
|
|
235
|
+
this.publish('heartbeat', {
|
|
236
|
+
uptimeMs: Number((runtimePerformance.now() - processStart).toFixed(3))
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
const STUDIO_DEVTOOLS_GLOBAL_CONFIG_KEY = '__FLUO_STUDIO_DEVTOOLS_CONFIG__';
|
|
241
|
+
function isStudioDevtoolsConfig(value) {
|
|
242
|
+
if (!isRecord(value)) {
|
|
243
|
+
return false;
|
|
244
|
+
}
|
|
245
|
+
return value.FLUO_STUDIO === undefined || typeof value.FLUO_STUDIO === 'string';
|
|
246
|
+
}
|
|
247
|
+
function readInjectedStudioDevtoolsConfig() {
|
|
248
|
+
const value = globalThis[STUDIO_DEVTOOLS_GLOBAL_CONFIG_KEY];
|
|
249
|
+
return isStudioDevtoolsConfig(value) ? value : undefined;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Creates the Studio runtime bridge from explicit CLI-injected config.
|
|
254
|
+
* Returns `undefined` unless Studio is explicitly enabled and a token-protected endpoint is present.
|
|
255
|
+
*
|
|
256
|
+
* @param config Explicit Studio config injected by the application boundary.
|
|
257
|
+
* @returns Studio runtime bridge, or `undefined` when Studio is disabled or incomplete.
|
|
258
|
+
*/
|
|
259
|
+
export function createStudioDevtoolsRuntimeFromConfig(config = readInjectedStudioDevtoolsConfig()) {
|
|
260
|
+
if (!config || !isEnabled(config.FLUO_STUDIO)) {
|
|
261
|
+
return undefined;
|
|
262
|
+
}
|
|
263
|
+
const endpoint = resolveEndpoint(config);
|
|
264
|
+
if (!endpoint || !config.FLUO_STUDIO_TOKEN || typeof globalThis.fetch !== 'function') {
|
|
265
|
+
return undefined;
|
|
266
|
+
}
|
|
267
|
+
const epoch = config.FLUO_STUDIO_EPOCH ?? createEpoch();
|
|
268
|
+
return new StudioDevtoolsRuntime({
|
|
269
|
+
appId: config.FLUO_STUDIO_APP_ID ?? createAppId(),
|
|
270
|
+
epoch,
|
|
271
|
+
runtime: normalizeRuntime(config.FLUO_STUDIO_RUNTIME),
|
|
272
|
+
transport: new FetchStudioTransport(endpoint, config.FLUO_STUDIO_TOKEN)
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Compatibility helper for callers that already resolved env values at their application boundary.
|
|
278
|
+
*
|
|
279
|
+
* @param env Explicit Studio config resolved outside runtime package source.
|
|
280
|
+
* @returns Studio runtime bridge, or `undefined` when Studio is disabled or incomplete.
|
|
281
|
+
*/
|
|
282
|
+
export function createStudioDevtoolsRuntimeFromEnv(env) {
|
|
283
|
+
return createStudioDevtoolsRuntimeFromConfig(env);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Provides apply Studio Devtools Application Options behavior for the Studio devtool.
|
|
288
|
+
*
|
|
289
|
+
* @param options options value used by apply Studio Devtools Application Options.
|
|
290
|
+
* @param runtime runtime value used by apply Studio Devtools Application Options.
|
|
291
|
+
* @returns The apply Studio Devtools Application Options result.
|
|
292
|
+
*/
|
|
293
|
+
export function applyStudioDevtoolsApplicationOptions(options, runtime) {
|
|
294
|
+
if (!runtime) {
|
|
295
|
+
return options;
|
|
296
|
+
}
|
|
297
|
+
return {
|
|
298
|
+
...options,
|
|
299
|
+
diagnostics: {
|
|
300
|
+
...options.diagnostics,
|
|
301
|
+
timing: true
|
|
302
|
+
},
|
|
303
|
+
observers: [...(options.observers ?? []), runtime.requestObserver]
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Provides apply Studio Devtools Context Options behavior for the Studio devtool.
|
|
309
|
+
*
|
|
310
|
+
* @param options options value used by apply Studio Devtools Context Options.
|
|
311
|
+
* @param runtime runtime value used by apply Studio Devtools Context Options.
|
|
312
|
+
* @returns The apply Studio Devtools Context Options result.
|
|
313
|
+
*/
|
|
314
|
+
export function applyStudioDevtoolsContextOptions(options, runtime) {
|
|
315
|
+
if (!runtime) {
|
|
316
|
+
return options;
|
|
317
|
+
}
|
|
318
|
+
return {
|
|
319
|
+
...options,
|
|
320
|
+
diagnostics: {
|
|
321
|
+
...options.diagnostics,
|
|
322
|
+
timing: true
|
|
323
|
+
}
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Provides publish Studio Bootstrap Snapshot behavior for the Studio devtool.
|
|
329
|
+
*
|
|
330
|
+
* @param runtime runtime value used by publish Studio Bootstrap Snapshot.
|
|
331
|
+
* @param input input value used by publish Studio Bootstrap Snapshot.
|
|
332
|
+
*/
|
|
333
|
+
export function publishStudioBootstrapSnapshot(runtime, input) {
|
|
334
|
+
runtime?.publishBootstrapSnapshot(input);
|
|
335
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createCorsMiddleware, createErrorResponse, createSecurityHeadersMiddleware, matchRoutePattern, normalizeRoutePattern, NotFoundException } from '@fluojs/http';
|
|
2
2
|
import { bootstrapApplication } from './bootstrap.js';
|
|
3
|
-
import {
|
|
3
|
+
import { createDefaultApplicationLogger } from './logging/default-logger.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Input type for configuring CORS in an HTTP adapter.
|
|
@@ -38,7 +38,7 @@ export async function bootstrapHttpAdapterApplication(rootModule, options, adapt
|
|
|
38
38
|
return bootstrapApplication({
|
|
39
39
|
...options,
|
|
40
40
|
adapter,
|
|
41
|
-
logger: options.logger ??
|
|
41
|
+
logger: options.logger ?? createDefaultApplicationLogger(),
|
|
42
42
|
middleware: createHttpAdapterMiddleware(options),
|
|
43
43
|
rootModule
|
|
44
44
|
});
|
|
@@ -84,7 +84,7 @@ export function formatHttpAdapterListenMessage(target) {
|
|
|
84
84
|
* @returns A promise that resolves to the running application instance.
|
|
85
85
|
*/
|
|
86
86
|
export async function runHttpAdapterApplication(rootModule, options, adapter) {
|
|
87
|
-
const logger = options.logger ??
|
|
87
|
+
const logger = options.logger ?? createDefaultApplicationLogger();
|
|
88
88
|
const app = await bootstrapApplication({
|
|
89
89
|
...options,
|
|
90
90
|
adapter,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ApplicationLogger } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Creates the transport-neutral runtime logger used by default root bootstrap flows.
|
|
4
|
+
*
|
|
5
|
+
* @returns Application logger that writes through `console` without Node-only process metadata.
|
|
6
|
+
*/
|
|
7
|
+
export declare function createDefaultApplicationLogger(): ApplicationLogger;
|
|
8
|
+
//# sourceMappingURL=default-logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-logger.d.ts","sourceRoot":"","sources":["../../src/logging/default-logger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAMrD;;;;GAIG;AACH,wBAAgB,8BAA8B,IAAI,iBAAiB,CAmBlE"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
function formatDefaultLog(level, context, message) {
|
|
2
|
+
return `[fluo] ${level} [${context}] ${message}`;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Creates the transport-neutral runtime logger used by default root bootstrap flows.
|
|
7
|
+
*
|
|
8
|
+
* @returns Application logger that writes through `console` without Node-only process metadata.
|
|
9
|
+
*/
|
|
10
|
+
export function createDefaultApplicationLogger() {
|
|
11
|
+
return {
|
|
12
|
+
debug(message, context = 'fluo') {
|
|
13
|
+
console.debug(formatDefaultLog('DEBUG', context, message));
|
|
14
|
+
},
|
|
15
|
+
error(message, error, context = 'fluo') {
|
|
16
|
+
console.error(formatDefaultLog('ERROR', context, message));
|
|
17
|
+
if (error) {
|
|
18
|
+
console.error(error);
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
log(message, context = 'fluo') {
|
|
22
|
+
console.log(formatDefaultLog('LOG', context, message));
|
|
23
|
+
},
|
|
24
|
+
warn(message, context = 'fluo') {
|
|
25
|
+
console.warn(formatDefaultLog('WARN', context, message));
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal-node.d.ts","sourceRoot":"","sources":["../../src/node/internal-node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,IAAI,gBAAgB,EAA6C,MAAM,WAAW,CAAC;AACxG,OAAO,EAAE,YAAY,IAAI,iBAAiB,EAAE,KAAK,aAAa,IAAI,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAGzG,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,sBAAsB,EAC3B,KAAK,cAAc,EACnB,KAAK,sBAAsB,EAC5B,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"internal-node.d.ts","sourceRoot":"","sources":["../../src/node/internal-node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,IAAI,gBAAgB,EAA6C,MAAM,WAAW,CAAC;AACxG,OAAO,EAAE,YAAY,IAAI,iBAAiB,EAAE,KAAK,aAAa,IAAI,kBAAkB,EAAE,MAAM,YAAY,C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,yBAAyB,GACjC,OAAO,CAAC,WAAW,CAAC,CAUtB;AAED,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,EACpB,mCAAmC,EACnC,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,EACnB,6BAA6B,EAC7B,oCAAoC,EACpC,0BAA0B,EAC1B,2BAA2B,EAC3B,iBAAiB,EACjB,0BAA0B,EAC1B,sBAAsB,EACtB,uBAAuB,EACvB,yBAAyB,EACzB,2BAA2B,EAC3B,yBAAyB,EACzB,kBAAkB,GACnB,CAAC"}
|
|
@@ -2,6 +2,7 @@ import { createServer as createHttpServer } from 'node:http';
|
|
|
2
2
|
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
|
+
import { createConsoleApplicationLogger } from '../logging/logger.js';
|
|
5
6
|
import { createNodeResponseCompression, compressNodeResponse } from './internal-node-compression.js';
|
|
6
7
|
import { cloneHeaderValue, cloneRequestHeaders, createDeferredFrameworkRequestShell, createDeferredFrameworkRequest, createMemoizedAsyncValue, createMemoizedValue, NodeRequestPayloadTooLargeException, normalizePrimaryContentType, parseCookieHeader, parseQueryParamsFromSearch, createRequestSignal, materializeFrameworkRequestBody, readPrimaryHeaderValue, resolveAbsoluteRequestUrl, resolveRequestIdFromHeaders, snapshotSimpleQueryRecord, splitRawRequestUrl } from './internal-node-request.js';
|
|
7
8
|
import { createFrameworkResponse, writeNodeAdapterErrorResponse } from './internal-node-response.js';
|
|
@@ -144,7 +145,11 @@ export function createNodeHttpAdapter(options = {}, compression = false, multipa
|
|
|
144
145
|
* @returns The bootstrap node application result.
|
|
145
146
|
*/
|
|
146
147
|
export async function bootstrapNodeApplication(rootModule, options) {
|
|
147
|
-
|
|
148
|
+
const logger = options.logger ?? createConsoleApplicationLogger();
|
|
149
|
+
return bootstrapHttpAdapterApplication(rootModule, {
|
|
150
|
+
...options,
|
|
151
|
+
logger
|
|
152
|
+
}, createNodeHttpAdapter(options, options.compression ?? false, options.multipart));
|
|
148
153
|
}
|
|
149
154
|
|
|
150
155
|
/**
|
|
@@ -155,9 +160,11 @@ export async function bootstrapNodeApplication(rootModule, options) {
|
|
|
155
160
|
* @returns The run node application result.
|
|
156
161
|
*/
|
|
157
162
|
export async function runNodeApplication(rootModule, options) {
|
|
163
|
+
const logger = options.logger ?? createConsoleApplicationLogger();
|
|
158
164
|
const adapter = createNodeHttpAdapter(options, options.compression ?? false, options.multipart);
|
|
159
165
|
return runHttpAdapterApplication(rootModule, {
|
|
160
166
|
...options,
|
|
167
|
+
logger,
|
|
161
168
|
shutdownRegistration: createNodeShutdownSignalRegistration(options.shutdownSignals ?? defaultNodeShutdownSignals())
|
|
162
169
|
}, adapter);
|
|
163
170
|
}
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"module-graph",
|
|
10
10
|
"orchestration"
|
|
11
11
|
],
|
|
12
|
-
"version": "1.1.
|
|
12
|
+
"version": "1.1.3",
|
|
13
13
|
"private": false,
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"repository": {
|
|
@@ -68,13 +68,13 @@
|
|
|
68
68
|
],
|
|
69
69
|
"dependencies": {
|
|
70
70
|
"@fluojs/config": "^1.0.2",
|
|
71
|
-
"@fluojs/core": "^1.0.3",
|
|
72
71
|
"@fluojs/di": "^1.0.3",
|
|
72
|
+
"@fluojs/core": "^1.0.3",
|
|
73
73
|
"@fluojs/http": "^1.1.0"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
76
|
"vitest": "^3.2.4",
|
|
77
|
-
"@fluojs/serialization": "^1.0.
|
|
77
|
+
"@fluojs/serialization": "^1.0.4"
|
|
78
78
|
},
|
|
79
79
|
"scripts": {
|
|
80
80
|
"prebuild": "node ../../tooling/scripts/clean-dist.mjs",
|