@fluojs/runtime 1.1.8 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/README.ko.md +292 -21
  2. package/README.md +292 -21
  3. package/dist/abort.d.ts +6 -1
  4. package/dist/abort.d.ts.map +1 -1
  5. package/dist/abort.js +18 -2
  6. package/dist/adapters/internal-request-response-factory.d.ts +1 -1
  7. package/dist/adapters/internal-request-response-factory.d.ts.map +1 -1
  8. package/dist/adapters/internal-request-response-factory.js +1 -1
  9. package/dist/adapters/request-response-factory.d.ts +20 -1
  10. package/dist/adapters/request-response-factory.d.ts.map +1 -1
  11. package/dist/adapters/request-response-factory.js +75 -22
  12. package/dist/bootstrap.d.ts +3 -9
  13. package/dist/bootstrap.d.ts.map +1 -1
  14. package/dist/bootstrap.js +181 -76
  15. package/dist/devtools/contracts.d.ts +3 -135
  16. package/dist/devtools/contracts.d.ts.map +1 -1
  17. package/dist/devtools/index.d.ts +2 -3
  18. package/dist/devtools/index.d.ts.map +1 -1
  19. package/dist/devtools/index.js +1 -2
  20. package/dist/devtools/snapshot.d.ts +1 -1
  21. package/dist/devtools/snapshot.d.ts.map +1 -1
  22. package/dist/devtools/snapshot.js +18 -17
  23. package/dist/devtools/studio-request-observer.d.ts +14 -0
  24. package/dist/devtools/studio-request-observer.d.ts.map +1 -0
  25. package/dist/devtools/studio-request-observer.js +112 -0
  26. package/dist/devtools/studio-runtime-config.d.ts +25 -0
  27. package/dist/devtools/studio-runtime-config.d.ts.map +1 -0
  28. package/dist/devtools/studio-runtime-config.js +59 -0
  29. package/dist/devtools/studio-runtime.d.ts +12 -18
  30. package/dist/devtools/studio-runtime.d.ts.map +1 -1
  31. package/dist/devtools/studio-runtime.js +25 -169
  32. package/dist/errors.d.ts +26 -0
  33. package/dist/errors.d.ts.map +1 -1
  34. package/dist/errors.js +38 -0
  35. package/dist/health/health.d.ts +18 -4
  36. package/dist/health/health.d.ts.map +1 -1
  37. package/dist/health/health.js +5 -2
  38. package/dist/http-adapter-shared.d.ts +1 -1
  39. package/dist/http-adapter-shared.d.ts.map +1 -1
  40. package/dist/http-adapter-shared.js +1 -1
  41. package/dist/index.d.ts +6 -3
  42. package/dist/index.d.ts.map +1 -1
  43. package/dist/index.js +4 -1
  44. package/dist/internal/route-inspection-metadata.d.ts +30 -0
  45. package/dist/internal/route-inspection-metadata.d.ts.map +1 -0
  46. package/dist/internal/route-inspection-metadata.js +68 -0
  47. package/dist/internal.d.ts +6 -1
  48. package/dist/internal.d.ts.map +1 -1
  49. package/dist/internal.js +4 -1
  50. package/dist/module-definition.d.ts +10 -0
  51. package/dist/module-definition.d.ts.map +1 -0
  52. package/dist/module-definition.js +12 -0
  53. package/dist/module-graph.d.ts +42 -1
  54. package/dist/module-graph.d.ts.map +1 -1
  55. package/dist/module-graph.js +112 -16
  56. package/dist/multipart.d.ts +68 -4
  57. package/dist/multipart.d.ts.map +1 -1
  58. package/dist/multipart.js +666 -103
  59. package/dist/platform-component-registry.d.ts +9 -0
  60. package/dist/platform-component-registry.d.ts.map +1 -0
  61. package/dist/platform-component-registry.js +70 -0
  62. package/dist/platform-diagnostic-retention.d.ts +13 -0
  63. package/dist/platform-diagnostic-retention.d.ts.map +1 -0
  64. package/dist/platform-diagnostic-retention.js +43 -0
  65. package/dist/platform-shell-probe-reports.d.ts +8 -0
  66. package/dist/platform-shell-probe-reports.d.ts.map +1 -0
  67. package/dist/platform-shell-probe-reports.js +95 -0
  68. package/dist/platform-shell-probes.d.ts +16 -0
  69. package/dist/platform-shell-probes.d.ts.map +1 -0
  70. package/dist/platform-shell-probes.js +141 -0
  71. package/dist/platform-shell.d.ts +7 -13
  72. package/dist/platform-shell.d.ts.map +1 -1
  73. package/dist/platform-shell.js +58 -310
  74. package/dist/retryable-shutdown.d.ts +7 -0
  75. package/dist/retryable-shutdown.d.ts.map +1 -0
  76. package/dist/retryable-shutdown.js +20 -0
  77. package/dist/route-inspection.d.ts +56 -0
  78. package/dist/route-inspection.d.ts.map +1 -0
  79. package/dist/route-inspection.js +80 -0
  80. package/dist/tokens.d.ts +6 -4
  81. package/dist/tokens.d.ts.map +1 -1
  82. package/dist/tokens.js +5 -0
  83. package/dist/types.d.ts +53 -8
  84. package/dist/types.d.ts.map +1 -1
  85. package/dist/web.d.ts +22 -9
  86. package/dist/web.d.ts.map +1 -1
  87. package/dist/web.js +80 -34
  88. package/package.json +13 -26
  89. package/dist/internal-node.d.ts +0 -2
  90. package/dist/internal-node.d.ts.map +0 -1
  91. package/dist/internal-node.js +0 -1
  92. package/dist/logging/json-logger.d.ts +0 -8
  93. package/dist/logging/json-logger.d.ts.map +0 -1
  94. package/dist/logging/json-logger.js +0 -45
  95. package/dist/logging/logger.d.ts +0 -37
  96. package/dist/logging/logger.d.ts.map +0 -1
  97. package/dist/logging/logger.js +0 -103
  98. package/dist/node/internal-node-compression.d.ts +0 -22
  99. package/dist/node/internal-node-compression.d.ts.map +0 -1
  100. package/dist/node/internal-node-compression.js +0 -84
  101. package/dist/node/internal-node-request.d.ts +0 -162
  102. package/dist/node/internal-node-request.d.ts.map +0 -1
  103. package/dist/node/internal-node-request.js +0 -475
  104. package/dist/node/internal-node-response.d.ts +0 -28
  105. package/dist/node/internal-node-response.d.ts.map +0 -1
  106. package/dist/node/internal-node-response.js +0 -205
  107. package/dist/node/internal-node-shutdown.d.ts +0 -34
  108. package/dist/node/internal-node-shutdown.d.ts.map +0 -1
  109. package/dist/node/internal-node-shutdown.js +0 -83
  110. package/dist/node/internal-node.d.ts +0 -117
  111. package/dist/node/internal-node.d.ts.map +0 -1
  112. package/dist/node/internal-node.js +0 -283
  113. package/dist/node/node-compression.d.ts +0 -2
  114. package/dist/node/node-compression.d.ts.map +0 -1
  115. package/dist/node/node-compression.js +0 -1
  116. package/dist/node/node-request.d.ts +0 -2
  117. package/dist/node/node-request.d.ts.map +0 -1
  118. package/dist/node/node-request.js +0 -1
  119. package/dist/node/node-response.d.ts +0 -2
  120. package/dist/node/node-response.d.ts.map +0 -1
  121. package/dist/node/node-response.js +0 -1
  122. package/dist/node/node-shutdown.d.ts +0 -2
  123. package/dist/node/node-shutdown.d.ts.map +0 -1
  124. package/dist/node/node-shutdown.js +0 -1
  125. package/dist/node/node.d.ts +0 -2
  126. package/dist/node/node.d.ts.map +0 -1
  127. package/dist/node/node.js +0 -1
  128. package/dist/node.d.ts +0 -5
  129. package/dist/node.d.ts.map +0 -1
  130. package/dist/node.js +0 -3
@@ -1,37 +0,0 @@
1
- import type { ApplicationLogger } from '../types.js';
2
- /** Severity threshold accepted by `createConsoleApplicationLogger(...)`. */
3
- export type ConsoleApplicationLoggerLevel = 'debug' | 'error' | 'log' | 'warn';
4
- /** Console formatting mode accepted by `createConsoleApplicationLogger(...)`. */
5
- export type ConsoleApplicationLoggerMode = 'minimal' | 'pretty' | 'silent';
6
- /** Options used to tune the Node console logger without replacing the runtime logger contract. */
7
- export interface ConsoleApplicationLoggerOptions {
8
- /**
9
- * Controls console formatting.
10
- *
11
- * - `pretty` keeps the historical timestamp, pid, level, context, and message format.
12
- * - `minimal` writes only `[fluo] LEVEL [context] message`.
13
- * - `silent` suppresses all logger methods.
14
- */
15
- mode?: ConsoleApplicationLoggerMode;
16
- /** Lowest severity emitted by the logger. Defaults to `debug`, preserving existing output. */
17
- level?: ConsoleApplicationLoggerLevel;
18
- /** Override TTY-aware ANSI color detection. */
19
- color?: boolean;
20
- /** Explicit host color environment passed from the application/bootstrap boundary. */
21
- environment?: ConsoleApplicationLoggerEnvironment;
22
- }
23
- /** Host color environment used by `createConsoleApplicationLogger(...)` without reading globals directly. */
24
- export interface ConsoleApplicationLoggerEnvironment {
25
- /** Whether `NO_COLOR`-style color suppression is enabled. */
26
- noColor?: boolean;
27
- /** `FORCE_COLOR`-style value used to force ANSI color output when truthy. */
28
- forceColor?: string;
29
- }
30
- /**
31
- * Create console application logger.
32
- *
33
- * @param options Console logger mode, severity threshold, and color override.
34
- * @returns The create console application logger result.
35
- */
36
- export declare function createConsoleApplicationLogger(options?: ConsoleApplicationLoggerOptions): ApplicationLogger;
37
- //# sourceMappingURL=logger.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/logging/logger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,4EAA4E;AAC5E,MAAM,MAAM,6BAA6B,GAAG,OAAO,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,CAAC;AAC/E,iFAAiF;AACjF,MAAM,MAAM,4BAA4B,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE3E,kGAAkG;AAClG,MAAM,WAAW,+BAA+B;IAC9C;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,4BAA4B,CAAC;IACpC,8FAA8F;IAC9F,KAAK,CAAC,EAAE,6BAA6B,CAAC;IACtC,+CAA+C;IAC/C,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,sFAAsF;IACtF,WAAW,CAAC,EAAE,mCAAmC,CAAC;CACnD;AAED,6GAA6G;AAC7G,MAAM,WAAW,mCAAmC;IAClD,6DAA6D;IAC7D,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,6EAA6E;IAC7E,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AA+DD;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAAC,OAAO,GAAE,+BAAoC,GAAG,iBAAiB,CA2C/G"}
@@ -1,103 +0,0 @@
1
- /** Severity threshold accepted by `createConsoleApplicationLogger(...)`. */
2
-
3
- /** Console formatting mode accepted by `createConsoleApplicationLogger(...)`. */
4
-
5
- /** Options used to tune the Node console logger without replacing the runtime logger contract. */
6
-
7
- /** Host color environment used by `createConsoleApplicationLogger(...)` without reading globals directly. */
8
-
9
- const RESET = '\u001B[0m';
10
- const BRIGHT_GREEN = '\u001B[32m';
11
- const BRIGHT_RED = '\u001B[31m';
12
- const BRIGHT_YELLOW = '\u001B[33m';
13
- const DIM = '\u001B[2m';
14
- const LEVEL_PRIORITY = {
15
- debug: 10,
16
- log: 20,
17
- warn: 30,
18
- error: 40
19
- };
20
- function colorize(value, color, enabled) {
21
- return enabled ? `${color}${value}${RESET}` : value;
22
- }
23
- function formatLog(level, context, message, color) {
24
- const prefix = colorize('[fluo]', BRIGHT_GREEN, color);
25
- const pid = colorize(String(process.pid), BRIGHT_YELLOW, color);
26
- const timestamp = colorize(new Date().toLocaleString('en-US'), DIM, color);
27
- const levelColor = level === 'ERROR' || level === 'WARN' ? BRIGHT_RED : BRIGHT_GREEN;
28
- const levelLabel = colorize(level, levelColor, color);
29
- const contextLabel = colorize(`[${context}]`, BRIGHT_YELLOW, color);
30
- return `${prefix} ${pid} - ${timestamp} ${levelLabel} ${contextLabel} ${message}`;
31
- }
32
- function formatMinimalLog(level, context, message, color) {
33
- const prefix = colorize('[fluo]', BRIGHT_GREEN, color);
34
- const levelColor = level === 'ERROR' || level === 'WARN' ? BRIGHT_RED : BRIGHT_GREEN;
35
- const levelLabel = colorize(level, levelColor, color);
36
- const contextLabel = colorize(`[${context}]`, BRIGHT_YELLOW, color);
37
- return `${prefix} ${levelLabel} ${contextLabel} ${message}`;
38
- }
39
- function shouldLog(currentLevel, configuredLevel) {
40
- return LEVEL_PRIORITY[currentLevel] >= LEVEL_PRIORITY[configuredLevel];
41
- }
42
- function isForceColorEnabled(value) {
43
- return value !== undefined && value !== '' && value !== '0' && value !== 'false' && value !== 'no' && value !== 'off';
44
- }
45
- function shouldUseColor(stream, environment) {
46
- if (environment.noColor === true) {
47
- return false;
48
- }
49
- if (isForceColorEnabled(environment.forceColor)) {
50
- return true;
51
- }
52
- if (typeof stream.hasColors === 'function') {
53
- return stream.hasColors();
54
- }
55
- return Boolean(stream.isTTY);
56
- }
57
-
58
- /**
59
- * Create console application logger.
60
- *
61
- * @param options Console logger mode, severity threshold, and color override.
62
- * @returns The create console application logger result.
63
- */
64
- export function createConsoleApplicationLogger(options = {}) {
65
- const mode = options.mode ?? 'pretty';
66
- const level = options.level ?? 'debug';
67
- const environment = options.environment ?? {};
68
- const format = mode === 'minimal' ? formatMinimalLog : formatLog;
69
- if (mode === 'silent') {
70
- return {
71
- debug() {},
72
- error() {},
73
- log() {},
74
- warn() {}
75
- };
76
- }
77
- return {
78
- debug(message, context = 'fluo') {
79
- if (shouldLog('debug', level)) {
80
- console.debug(format('DEBUG', context, message, options.color ?? shouldUseColor(process.stdout, environment)));
81
- }
82
- },
83
- error(message, error, context = 'fluo') {
84
- if (!shouldLog('error', level)) {
85
- return;
86
- }
87
- console.error(format('ERROR', context, message, options.color ?? shouldUseColor(process.stderr, environment)));
88
- if (error) {
89
- console.error(error);
90
- }
91
- },
92
- log(message, context = 'fluo') {
93
- if (shouldLog('log', level)) {
94
- console.log(format('LOG', context, message, options.color ?? shouldUseColor(process.stdout, environment)));
95
- }
96
- },
97
- warn(message, context = 'fluo') {
98
- if (shouldLog('warn', level)) {
99
- console.warn(format('WARN', context, message, options.color ?? shouldUseColor(process.stderr, environment)));
100
- }
101
- }
102
- };
103
- }
@@ -1,22 +0,0 @@
1
- import type { ServerResponse } from 'node:http';
2
- import type { FrameworkResponseCompression } from '@fluojs/http';
3
- type Encoding = 'br' | 'gzip' | 'identity';
4
- /**
5
- * Create node response compression.
6
- *
7
- * @param response The response.
8
- * @param acceptEncoding The accept encoding.
9
- * @returns The create node response compression result.
10
- */
11
- export declare function createNodeResponseCompression(response: ServerResponse, acceptEncoding: string | undefined): FrameworkResponseCompression | undefined;
12
- /**
13
- * Compress node response.
14
- *
15
- * @param response The response.
16
- * @param body The body.
17
- * @param encoding The encoding.
18
- * @returns The compress node response result.
19
- */
20
- export declare function compressNodeResponse(response: ServerResponse, body: Uint8Array, encoding: Exclude<Encoding, 'identity'>): Promise<void>;
21
- export {};
22
- //# sourceMappingURL=internal-node-compression.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"internal-node-compression.d.ts","sourceRoot":"","sources":["../../src/node/internal-node-compression.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEhD,OAAO,KAAK,EACV,4BAA4B,EAE7B,MAAM,cAAc,CAAC;AAiBtB,KAAK,QAAQ,GAAG,IAAI,GAAG,MAAM,GAAG,UAAU,CAAC;AAE3C;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAC3C,QAAQ,EAAE,cAAc,EACxB,cAAc,EAAE,MAAM,GAAG,SAAS,GACjC,4BAA4B,GAAG,SAAS,CAqB1C;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,cAAc,EACxB,IAAI,EAAE,UAAU,EAChB,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,UAAU,CAAC,GACtC,OAAO,CAAC,IAAI,CAAC,CAcf"}
@@ -1,84 +0,0 @@
1
- import { createBrotliCompress, createGzip } from 'node:zlib';
2
- const COMPRESS_THRESHOLD = 1024;
3
- const SKIP_CONTENT_TYPES = new Set(['image/', 'audio/', 'video/', 'application/zip', 'application/gzip', 'application/x-bzip', 'application/x-bzip2', 'application/x-xz', 'application/zstd', 'application/octet-stream']);
4
- /**
5
- * Create node response compression.
6
- *
7
- * @param response The response.
8
- * @param acceptEncoding The accept encoding.
9
- * @returns The create node response compression result.
10
- */
11
- export function createNodeResponseCompression(response, acceptEncoding) {
12
- if (!acceptEncoding) {
13
- return undefined;
14
- }
15
- return {
16
- async write(body, options = {}) {
17
- if (body.byteLength < COMPRESS_THRESHOLD || shouldSkipContentType(options.contentType)) {
18
- return false;
19
- }
20
- const encoding = selectEncoding(acceptEncoding);
21
- if (encoding === 'identity') {
22
- return false;
23
- }
24
- await compressNodeResponse(response, body, encoding);
25
- return true;
26
- }
27
- };
28
- }
29
-
30
- /**
31
- * Compress node response.
32
- *
33
- * @param response The response.
34
- * @param body The body.
35
- * @param encoding The encoding.
36
- * @returns The compress node response result.
37
- */
38
- export function compressNodeResponse(response, body, encoding) {
39
- const stream = encoding === 'br' ? createBrotliCompress() : createGzip();
40
- response.setHeader('Content-Encoding', encoding);
41
- response.removeHeader('Content-Length');
42
- return new Promise((resolve, reject) => {
43
- stream.on('error', reject);
44
- stream.pipe(response);
45
- stream.on('finish', resolve);
46
- stream.end(body);
47
- });
48
- }
49
- function shouldSkipContentType(contentType) {
50
- if (!contentType) {
51
- return false;
52
- }
53
- const lower = contentType.toLowerCase();
54
- for (const prefix of SKIP_CONTENT_TYPES) {
55
- if (lower.startsWith(prefix)) {
56
- return true;
57
- }
58
- }
59
- return false;
60
- }
61
- function selectEncoding(acceptEncoding) {
62
- if (!acceptEncoding) {
63
- return 'identity';
64
- }
65
- const entries = acceptEncoding.split(',').map(entry => {
66
- const [enc, qPart] = entry.trim().split(';');
67
- const q = qPart ? parseFloat(qPart.replace('q=', '')) : 1;
68
- return {
69
- enc: enc?.trim() ?? '',
70
- q: Number.isNaN(q) ? 1 : q
71
- };
72
- }).filter(entry => entry.q > 0).sort((a, b) => b.q - a.q);
73
- for (const {
74
- enc
75
- } of entries) {
76
- if (enc === 'br') {
77
- return 'br';
78
- }
79
- if (enc === 'gzip') {
80
- return 'gzip';
81
- }
82
- }
83
- return 'identity';
84
- }
@@ -1,162 +0,0 @@
1
- import type { IncomingHttpHeaders, IncomingMessage, ServerResponse } from 'node:http';
2
- import { PayloadTooLargeException, type FrameworkRequest } from '@fluojs/http';
3
- import { type MultipartOptions } from '../multipart.js';
4
- type MemoizedValue<T> = () => T;
5
- type QueryRecord = Record<string, string | string[] | undefined>;
6
- /**
7
- * Options for creating a deferred framework request shell from a Node-backed adapter.
8
- */
9
- export interface DeferredFrameworkRequestShellOptions<RawRequest> {
10
- cookieHeader?: string | string[] | undefined;
11
- headers?: FrameworkRequest['headers'];
12
- headersFactory?: () => FrameworkRequest['headers'];
13
- materializeBody?: () => Promise<void>;
14
- method?: string;
15
- path: string;
16
- query?: QueryRecord;
17
- queryFactory?: () => QueryRecord;
18
- raw: RawRequest;
19
- requestId?: string;
20
- signal: AbortSignal | (() => AbortSignal);
21
- url: string;
22
- }
23
- /**
24
- * HTTP payload-size error that closes the underlying Node request stream after the response commits.
25
- */
26
- export declare class NodeRequestPayloadTooLargeException extends PayloadTooLargeException {
27
- private readonly request;
28
- constructor(request: IncomingMessage);
29
- prepareResponse(response: ServerResponse): void;
30
- }
31
- /**
32
- * Creates a framework request from a raw Node incoming message.
33
- *
34
- * @param request - Raw Node request carrying headers, URL, and body stream.
35
- * @param signal - Abort signal tied to the response lifecycle.
36
- * @param multipartOptions - Multipart parser options applied to multipart requests.
37
- * @param maxBodySize - Maximum allowed non-multipart body size in bytes.
38
- * @param preserveRawBody - Whether to retain the raw request body bytes.
39
- * @returns The normalized framework request used by the dispatcher.
40
- */
41
- export declare function createFrameworkRequest(request: IncomingMessage, signal: AbortSignal, multipartOptions?: MultipartOptions, maxBodySize?: number, preserveRawBody?: boolean): Promise<FrameworkRequest>;
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 declare function createDeferredFrameworkRequest(request: IncomingMessage, signal: AbortSignal, multipartOptions?: MultipartOptions, maxBodySize?: number, preserveRawBody?: boolean): FrameworkRequest;
53
- /**
54
- * Creates a framework request shell from already-snapshotted Node adapter metadata.
55
- *
56
- * @param options - Raw request, metadata factories, and deferred body materialization hooks.
57
- * @returns A framework request with lazy headers, cookies, query values, and optional body materialization.
58
- */
59
- export declare function createDeferredFrameworkRequestShell<RawRequest>({ cookieHeader, headers, headersFactory, materializeBody, method, path, query, queryFactory, raw, requestId, signal, url, }: DeferredFrameworkRequestShellOptions<RawRequest>): FrameworkRequest;
60
- /**
61
- * Materializes a deferred Node framework request body exactly once.
62
- *
63
- * @param request - Framework request returned by {@link createDeferredFrameworkRequest}.
64
- * @returns A promise that settles after body, rawBody, and files fields are populated when applicable.
65
- */
66
- export declare function materializeFrameworkRequestBody(request: FrameworkRequest): Promise<void>;
67
- /**
68
- * Creates a synchronous memoized value resolver.
69
- *
70
- * @param factory - Function that computes the value on first access.
71
- * @returns A stable resolver that returns the cached value after the first call.
72
- */
73
- export declare function createMemoizedValue<T>(factory: () => T): MemoizedValue<T>;
74
- /**
75
- * Creates an async memoized side-effect resolver.
76
- *
77
- * @param factory - Async function to run at most once.
78
- * @returns A resolver that returns the same in-flight or completed promise for every call.
79
- */
80
- export declare function createMemoizedAsyncValue(factory: () => Promise<void>): () => Promise<void>;
81
- /**
82
- * Creates an abort signal that fires when the Node response closes unexpectedly.
83
- *
84
- * @param response - Raw Node server response associated with the request.
85
- * @returns An abort signal for downstream request cancellation handling.
86
- */
87
- export declare function createRequestSignal(response: ServerResponse): AbortSignal;
88
- /**
89
- * Resolves the request identifier from the preferred inbound headers.
90
- *
91
- * @param headers - Raw Node request headers.
92
- * @returns The request identifier when present.
93
- */
94
- export declare function resolveRequestIdFromHeaders(headers: IncomingHttpHeaders): string | undefined;
95
- /**
96
- * Parses a raw URL search string into the framework query shape.
97
- *
98
- * @param search - Raw search string, with or without a leading question mark.
99
- * @returns Query values where repeated keys become string arrays.
100
- */
101
- export declare function parseQueryParamsFromSearch(search: string): Record<string, string | string[]>;
102
- /**
103
- * Snapshots host-parsed query values when they already match framework semantics.
104
- *
105
- * @param query - Host query object exposed by a Node-backed adapter.
106
- * @returns A cloned query record when all values are strings or string arrays; otherwise `undefined` for raw URL fallback.
107
- */
108
- export declare function snapshotSimpleQueryRecord(query: unknown): QueryRecord | undefined;
109
- /**
110
- * Clones Node request headers into the framework header record shape.
111
- *
112
- * @param headers - Raw Node incoming headers.
113
- * @returns A shallow header snapshot with array values cloned.
114
- */
115
- export declare function cloneRequestHeaders(headers: IncomingHttpHeaders): FrameworkRequest['headers'];
116
- /**
117
- * Clones a single Node header value when it is array-backed.
118
- *
119
- * @param value - Header value to snapshot.
120
- * @returns The original scalar value or a cloned array value.
121
- */
122
- export declare function cloneHeaderValue<T extends string | string[] | undefined>(value: T): T;
123
- /**
124
- * Reads the primary value from a Node header value.
125
- *
126
- * @param headerValue - Header value that may contain multiple entries.
127
- * @returns The first header value when present.
128
- */
129
- export declare function readPrimaryHeaderValue(headerValue: string | string[] | undefined): string | undefined;
130
- /**
131
- * Normalizes a Node content-type header to its primary media type.
132
- *
133
- * @param headerValue - Raw content-type header value.
134
- * @returns Lowercase primary media type without parameters, or `undefined` when absent.
135
- */
136
- export declare function normalizePrimaryContentType(headerValue: string | string[] | undefined): string | undefined;
137
- /**
138
- * Parses a Node cookie header into framework cookie values.
139
- *
140
- * @param cookieHeader - Raw cookie header value or values.
141
- * @returns Cookie name/value pairs with percent-decoded values when possible.
142
- */
143
- export declare function parseCookieHeader(cookieHeader: string | string[] | undefined): Record<string, string>;
144
- /**
145
- * Splits a raw Node request URL into path and search components.
146
- *
147
- * @param rawUrl - Raw request URL, absolute URL, or undefined value from Node.
148
- * @returns The pathname and search string used by framework request matching and query parsing.
149
- */
150
- export declare function splitRawRequestUrl(rawUrl: string | undefined): {
151
- path: string;
152
- search: string;
153
- };
154
- /**
155
- * Resolves a raw Node request URL into an absolute URL string.
156
- *
157
- * @param rawUrl - Raw request URL, absolute URL, or undefined value from Node.
158
- * @returns An absolute URL suitable for Web-standard parsers.
159
- */
160
- export declare function resolveAbsoluteRequestUrl(rawUrl: string | undefined): string;
161
- export {};
162
- //# sourceMappingURL=internal-node-request.d.ts.map
@@ -1 +0,0 @@
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,EA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