@effect/platform-node 4.0.0-beta.7 → 4.0.0-beta.71
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/dist/Mime.d.ts +9 -3
- package/dist/Mime.d.ts.map +1 -1
- package/dist/Mime.js +9 -3
- package/dist/Mime.js.map +1 -1
- package/dist/NodeChildProcessSpawner.d.ts +1 -1
- package/dist/NodeChildProcessSpawner.js +1 -1
- package/dist/NodeClusterHttp.d.ts +49 -7
- package/dist/NodeClusterHttp.d.ts.map +1 -1
- package/dist/NodeClusterHttp.js +20 -10
- package/dist/NodeClusterHttp.js.map +1 -1
- package/dist/NodeClusterSocket.d.ts +57 -11
- package/dist/NodeClusterSocket.d.ts.map +1 -1
- package/dist/NodeClusterSocket.js +57 -11
- package/dist/NodeClusterSocket.js.map +1 -1
- package/dist/NodeCrypto.d.ts +10 -0
- package/dist/NodeCrypto.d.ts.map +1 -0
- package/dist/NodeCrypto.js +22 -0
- package/dist/NodeCrypto.js.map +1 -0
- package/dist/NodeFileSystem.d.ts +4 -2
- package/dist/NodeFileSystem.d.ts.map +1 -1
- package/dist/NodeFileSystem.js +30 -3
- package/dist/NodeFileSystem.js.map +1 -1
- package/dist/NodeHttpClient.d.ts +111 -24
- package/dist/NodeHttpClient.d.ts.map +1 -1
- package/dist/NodeHttpClient.js +133 -28
- package/dist/NodeHttpClient.js.map +1 -1
- package/dist/NodeHttpIncomingMessage.d.ts +43 -9
- package/dist/NodeHttpIncomingMessage.d.ts.map +1 -1
- package/dist/NodeHttpIncomingMessage.js +47 -8
- package/dist/NodeHttpIncomingMessage.js.map +1 -1
- package/dist/NodeHttpPlatform.d.ts +10 -4
- package/dist/NodeHttpPlatform.d.ts.map +1 -1
- package/dist/NodeHttpPlatform.js +34 -7
- package/dist/NodeHttpPlatform.js.map +1 -1
- package/dist/NodeHttpServer.d.ts +56 -16
- package/dist/NodeHttpServer.d.ts.map +1 -1
- package/dist/NodeHttpServer.js +117 -49
- package/dist/NodeHttpServer.js.map +1 -1
- package/dist/NodeHttpServerRequest.d.ts +29 -3
- package/dist/NodeHttpServerRequest.d.ts.map +1 -1
- package/dist/NodeHttpServerRequest.js +9 -2
- package/dist/NodeHttpServerRequest.js.map +1 -1
- package/dist/NodeMultipart.d.ts +47 -4
- package/dist/NodeMultipart.d.ts.map +1 -1
- package/dist/NodeMultipart.js +47 -4
- package/dist/NodeMultipart.js.map +1 -1
- package/dist/NodePath.d.ts +15 -6
- package/dist/NodePath.d.ts.map +1 -1
- package/dist/NodePath.js +43 -7
- package/dist/NodePath.js.map +1 -1
- package/dist/NodeRedis.d.ts +56 -9
- package/dist/NodeRedis.d.ts.map +1 -1
- package/dist/NodeRedis.js +59 -12
- package/dist/NodeRedis.js.map +1 -1
- package/dist/NodeRuntime.d.ts +27 -36
- package/dist/NodeRuntime.d.ts.map +1 -1
- package/dist/NodeRuntime.js +38 -13
- package/dist/NodeRuntime.js.map +1 -1
- package/dist/NodeServices.d.ts +44 -5
- package/dist/NodeServices.d.ts.map +1 -1
- package/dist/NodeServices.js +7 -3
- package/dist/NodeServices.js.map +1 -1
- package/dist/NodeSink.d.ts +2 -2
- package/dist/NodeSink.js +2 -2
- package/dist/NodeSocket.d.ts +18 -3
- package/dist/NodeSocket.d.ts.map +1 -1
- package/dist/NodeSocket.js +51 -4
- package/dist/NodeSocket.js.map +1 -1
- package/dist/NodeSocketServer.d.ts +2 -2
- package/dist/NodeSocketServer.js +2 -2
- package/dist/NodeStdio.d.ts +5 -2
- package/dist/NodeStdio.d.ts.map +1 -1
- package/dist/NodeStdio.js +30 -3
- package/dist/NodeStdio.js.map +1 -1
- package/dist/NodeStream.d.ts +2 -2
- package/dist/NodeStream.js +2 -2
- package/dist/NodeTerminal.d.ts +8 -2
- package/dist/NodeTerminal.d.ts.map +1 -1
- package/dist/NodeTerminal.js +29 -3
- package/dist/NodeTerminal.js.map +1 -1
- package/dist/NodeWorker.d.ts +9 -2
- package/dist/NodeWorker.d.ts.map +1 -1
- package/dist/NodeWorker.js +45 -6
- package/dist/NodeWorker.js.map +1 -1
- package/dist/NodeWorkerRunner.d.ts +5 -1
- package/dist/NodeWorkerRunner.d.ts.map +1 -1
- package/dist/NodeWorkerRunner.js +47 -5
- package/dist/NodeWorkerRunner.js.map +1 -1
- package/dist/Undici.d.ts +16 -3
- package/dist/Undici.d.ts.map +1 -1
- package/dist/Undici.js +16 -3
- package/dist/Undici.js.map +1 -1
- package/dist/index.d.ts +28 -26
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +28 -26
- package/dist/index.js.map +1 -1
- package/package.json +9 -9
- package/src/Mime.ts +10 -3
- package/src/NodeChildProcessSpawner.ts +1 -1
- package/src/NodeClusterHttp.ts +54 -11
- package/src/NodeClusterSocket.ts +57 -11
- package/src/NodeCrypto.ts +24 -0
- package/src/NodeFileSystem.ts +30 -3
- package/src/NodeHttpClient.ts +141 -33
- package/src/NodeHttpIncomingMessage.ts +55 -12
- package/src/NodeHttpPlatform.ts +35 -6
- package/src/NodeHttpServer.ts +139 -53
- package/src/NodeHttpServerRequest.ts +29 -3
- package/src/NodeMultipart.ts +47 -4
- package/src/NodePath.ts +43 -7
- package/src/NodeRedis.ts +61 -14
- package/src/NodeRuntime.ts +56 -37
- package/src/NodeServices.ts +46 -5
- package/src/NodeSink.ts +2 -2
- package/src/NodeSocket.ts +56 -4
- package/src/NodeSocketServer.ts +2 -2
- package/src/NodeStdio.ts +30 -3
- package/src/NodeStream.ts +2 -2
- package/src/NodeTerminal.ts +29 -3
- package/src/NodeWorker.ts +45 -6
- package/src/NodeWorkerRunner.ts +47 -5
- package/src/Undici.ts +16 -3
- package/src/index.ts +29 -26
|
@@ -1,35 +1,69 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Adapter base for exposing Node `http.IncomingMessage` values as Effect HTTP
|
|
3
|
+
* incoming messages.
|
|
4
|
+
*
|
|
5
|
+
* Server requests and Node client responses both arrive as Node readable
|
|
6
|
+
* streams with raw header objects, socket metadata, and one-shot body
|
|
7
|
+
* consumption. This module's `NodeHttpIncomingMessage` class keeps the original
|
|
8
|
+
* Node message available while presenting Effect's `HttpIncomingMessage` shape:
|
|
9
|
+
* typed headers, remote address lookup, stream access, and text, JSON,
|
|
10
|
+
* URL-encoded, and array-buffer body readers.
|
|
11
|
+
*
|
|
12
|
+
* **Mental model**
|
|
13
|
+
*
|
|
14
|
+
* The Node message remains the source of truth. The adapter translates headers
|
|
15
|
+
* and remote address on demand, delegates raw streaming to `NodeStream`, and
|
|
16
|
+
* lets subclasses choose how unknown Node errors are mapped into their HTTP
|
|
17
|
+
* error type.
|
|
18
|
+
*
|
|
19
|
+
* **Gotchas**
|
|
20
|
+
*
|
|
21
|
+
* Node request and response bodies are one-shot streams. The `text` and
|
|
22
|
+
* `arrayBuffer` readers are cached and share decoded values with each other,
|
|
23
|
+
* but direct `stream` access is not cached and can consume the underlying Node
|
|
24
|
+
* stream before a decoder reads it. Body readers honor
|
|
25
|
+
* `HttpIncomingMessage.MaxBodySize`.
|
|
26
|
+
*
|
|
27
|
+
* @since 4.0.0
|
|
3
28
|
*/
|
|
4
29
|
import * as Effect from "effect/Effect";
|
|
5
30
|
import * as Inspectable from "effect/Inspectable";
|
|
31
|
+
import * as Option from "effect/Option";
|
|
32
|
+
import type * as Schema from "effect/Schema";
|
|
6
33
|
import type * as Stream from "effect/Stream";
|
|
7
34
|
import * as Headers from "effect/unstable/http/Headers";
|
|
8
35
|
import * as IncomingMessage from "effect/unstable/http/HttpIncomingMessage";
|
|
9
36
|
import * as UrlParams from "effect/unstable/http/UrlParams";
|
|
10
37
|
import type * as Http from "node:http";
|
|
11
38
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
39
|
+
* Base adapter from Node `IncomingMessage` to Effect HTTP incoming messages,
|
|
40
|
+
* exposing headers, remote address, stream access, and cached text, JSON, URL
|
|
41
|
+
* parameter, and array-buffer body decoders with caller-provided error mapping.
|
|
42
|
+
*
|
|
43
|
+
* @category constructors
|
|
44
|
+
* @since 4.0.0
|
|
14
45
|
*/
|
|
15
46
|
export declare abstract class NodeHttpIncomingMessage<E> extends Inspectable.Class implements IncomingMessage.HttpIncomingMessage<E> {
|
|
16
47
|
/**
|
|
17
|
-
*
|
|
48
|
+
* Marks this value as an HTTP incoming message for runtime guards.
|
|
49
|
+
*
|
|
50
|
+
* @since 4.0.0
|
|
18
51
|
*/
|
|
19
52
|
readonly [IncomingMessage.TypeId]: typeof IncomingMessage.TypeId;
|
|
20
53
|
readonly source: Http.IncomingMessage;
|
|
21
54
|
readonly onError: (error: unknown) => E;
|
|
22
|
-
readonly remoteAddressOverride?: string | undefined;
|
|
23
|
-
constructor(source: Http.IncomingMessage, onError: (error: unknown) => E, remoteAddressOverride?: string);
|
|
55
|
+
readonly remoteAddressOverride?: Option.Option<string> | undefined;
|
|
56
|
+
constructor(source: Http.IncomingMessage, onError: (error: unknown) => E, remoteAddressOverride?: Option.Option<string>);
|
|
24
57
|
get headers(): Headers.Headers;
|
|
25
|
-
get remoteAddress(): string
|
|
58
|
+
get remoteAddress(): Option.Option<string>;
|
|
26
59
|
private textEffect;
|
|
27
60
|
get text(): Effect.Effect<string, E>;
|
|
28
61
|
get textUnsafe(): string;
|
|
29
|
-
get json(): Effect.Effect<
|
|
30
|
-
get jsonUnsafe():
|
|
62
|
+
get json(): Effect.Effect<Schema.Json, E>;
|
|
63
|
+
get jsonUnsafe(): Schema.Json;
|
|
31
64
|
get urlParamsBody(): Effect.Effect<UrlParams.UrlParams, E>;
|
|
32
65
|
get stream(): Stream.Stream<Uint8Array, E>;
|
|
66
|
+
private arrayBufferEffect;
|
|
33
67
|
get arrayBuffer(): Effect.Effect<ArrayBuffer, E>;
|
|
34
68
|
}
|
|
35
69
|
//# sourceMappingURL=NodeHttpIncomingMessage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeHttpIncomingMessage.d.ts","sourceRoot":"","sources":["../src/NodeHttpIncom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I,aAAa,0BAEhB;IAED,OAAO,CAAC,UAAU,CAAsC;IACxD,IAAI,IAAI,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAgBnC;IAED,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED,IAAI,IAAI,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAMxC;IAED,IAAI,UAAU,IAAI,MAAM,CAAC,IAAI,CAE5B;IAED,IAAI,aAAa,IAAI,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,EAAE,CAAC,CAAC,CAMzD;IAED,IAAI,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC,CAKzC;IAED,OAAO,CAAC,iBAAiB,CAA2C;IACpE,IAAI,WAAW,IAAI,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,CAe/C;CACF"}
|
|
@@ -1,19 +1,51 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Adapter base for exposing Node `http.IncomingMessage` values as Effect HTTP
|
|
3
|
+
* incoming messages.
|
|
4
|
+
*
|
|
5
|
+
* Server requests and Node client responses both arrive as Node readable
|
|
6
|
+
* streams with raw header objects, socket metadata, and one-shot body
|
|
7
|
+
* consumption. This module's `NodeHttpIncomingMessage` class keeps the original
|
|
8
|
+
* Node message available while presenting Effect's `HttpIncomingMessage` shape:
|
|
9
|
+
* typed headers, remote address lookup, stream access, and text, JSON,
|
|
10
|
+
* URL-encoded, and array-buffer body readers.
|
|
11
|
+
*
|
|
12
|
+
* **Mental model**
|
|
13
|
+
*
|
|
14
|
+
* The Node message remains the source of truth. The adapter translates headers
|
|
15
|
+
* and remote address on demand, delegates raw streaming to `NodeStream`, and
|
|
16
|
+
* lets subclasses choose how unknown Node errors are mapped into their HTTP
|
|
17
|
+
* error type.
|
|
18
|
+
*
|
|
19
|
+
* **Gotchas**
|
|
20
|
+
*
|
|
21
|
+
* Node request and response bodies are one-shot streams. The `text` and
|
|
22
|
+
* `arrayBuffer` readers are cached and share decoded values with each other,
|
|
23
|
+
* but direct `stream` access is not cached and can consume the underlying Node
|
|
24
|
+
* stream before a decoder reads it. Body readers honor
|
|
25
|
+
* `HttpIncomingMessage.MaxBodySize`.
|
|
26
|
+
*
|
|
27
|
+
* @since 4.0.0
|
|
3
28
|
*/
|
|
4
29
|
import * as Effect from "effect/Effect";
|
|
5
30
|
import * as Inspectable from "effect/Inspectable";
|
|
31
|
+
import * as Option from "effect/Option";
|
|
6
32
|
import * as Headers from "effect/unstable/http/Headers";
|
|
7
33
|
import * as IncomingMessage from "effect/unstable/http/HttpIncomingMessage";
|
|
8
34
|
import * as UrlParams from "effect/unstable/http/UrlParams";
|
|
9
35
|
import * as NodeStream from "./NodeStream.js";
|
|
10
36
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
37
|
+
* Base adapter from Node `IncomingMessage` to Effect HTTP incoming messages,
|
|
38
|
+
* exposing headers, remote address, stream access, and cached text, JSON, URL
|
|
39
|
+
* parameter, and array-buffer body decoders with caller-provided error mapping.
|
|
40
|
+
*
|
|
41
|
+
* @category constructors
|
|
42
|
+
* @since 4.0.0
|
|
13
43
|
*/
|
|
14
44
|
export class NodeHttpIncomingMessage extends Inspectable.Class {
|
|
15
45
|
/**
|
|
16
|
-
*
|
|
46
|
+
* Marks this value as an HTTP incoming message for runtime guards.
|
|
47
|
+
*
|
|
48
|
+
* @since 4.0.0
|
|
17
49
|
*/
|
|
18
50
|
[IncomingMessage.TypeId];
|
|
19
51
|
source;
|
|
@@ -30,17 +62,18 @@ export class NodeHttpIncomingMessage extends Inspectable.Class {
|
|
|
30
62
|
return Headers.fromInput(this.source.headers);
|
|
31
63
|
}
|
|
32
64
|
get remoteAddress() {
|
|
33
|
-
return this.remoteAddressOverride ?? this.source.socket.remoteAddress;
|
|
65
|
+
return this.remoteAddressOverride ?? Option.fromNullishOr(this.source.socket.remoteAddress);
|
|
34
66
|
}
|
|
35
67
|
textEffect;
|
|
36
68
|
get text() {
|
|
37
69
|
if (this.textEffect) {
|
|
38
70
|
return this.textEffect;
|
|
39
71
|
}
|
|
40
|
-
this.textEffect = Effect.runSync(Effect.cached(Effect.flatMap(IncomingMessage.MaxBodySize
|
|
72
|
+
this.textEffect = Effect.runSync(Effect.cached(Effect.flatMap(IncomingMessage.MaxBodySize, maxBodySize => NodeStream.toString(() => this.source, {
|
|
41
73
|
onError: this.onError,
|
|
42
74
|
maxBytes: maxBodySize
|
|
43
75
|
}))));
|
|
76
|
+
this.arrayBufferEffect = Effect.map(this.textEffect, _ => new TextEncoder().encode(_).buffer);
|
|
44
77
|
return this.textEffect;
|
|
45
78
|
}
|
|
46
79
|
get textUnsafe() {
|
|
@@ -67,11 +100,17 @@ export class NodeHttpIncomingMessage extends Inspectable.Class {
|
|
|
67
100
|
onError: this.onError
|
|
68
101
|
});
|
|
69
102
|
}
|
|
103
|
+
arrayBufferEffect;
|
|
70
104
|
get arrayBuffer() {
|
|
71
|
-
|
|
105
|
+
if (this.arrayBufferEffect) {
|
|
106
|
+
return this.arrayBufferEffect;
|
|
107
|
+
}
|
|
108
|
+
this.arrayBufferEffect = Effect.withFiber(fiber => NodeStream.toArrayBuffer(() => this.source, {
|
|
72
109
|
onError: this.onError,
|
|
73
110
|
maxBytes: fiber.getRef(IncomingMessage.MaxBodySize)
|
|
74
|
-
}));
|
|
111
|
+
})).pipe(Effect.cached, Effect.runSync);
|
|
112
|
+
this.textEffect = Effect.map(this.arrayBufferEffect, _ => new TextDecoder().decode(_));
|
|
113
|
+
return this.arrayBufferEffect;
|
|
75
114
|
}
|
|
76
115
|
}
|
|
77
116
|
//# sourceMappingURL=NodeHttpIncomingMessage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeHttpIncomingMessage.js","names":["Effect","Inspectable","Headers","IncomingMessage","UrlParams","NodeStream","NodeHttpIncomingMessage","Class","TypeId","source","onError","remoteAddressOverride","constructor","headers","fromInput","remoteAddress","socket","textEffect","text","runSync","cached","flatMap","MaxBodySize","
|
|
1
|
+
{"version":3,"file":"NodeHttpIncomingMessage.js","names":["Effect","Inspectable","Option","Headers","IncomingMessage","UrlParams","NodeStream","NodeHttpIncomingMessage","Class","TypeId","source","onError","remoteAddressOverride","constructor","headers","fromInput","remoteAddress","fromNullishOr","socket","textEffect","text","runSync","cached","flatMap","MaxBodySize","maxBodySize","toString","maxBytes","arrayBufferEffect","map","_","TextEncoder","encode","buffer","textUnsafe","json","try","JSON","parse","catch","jsonUnsafe","urlParamsBody","URLSearchParams","stream","fromReadable","evaluate","arrayBuffer","withFiber","fiber","toArrayBuffer","getRef","pipe","TextDecoder","decode"],"sources":["../src/NodeHttpIncomingMessage.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,OAAO,KAAKA,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,WAAW,MAAM,oBAAoB;AACjD,OAAO,KAAKC,MAAM,MAAM,eAAe;AAGvC,OAAO,KAAKC,OAAO,MAAM,8BAA8B;AACvD,OAAO,KAAKC,eAAe,MAAM,0CAA0C;AAC3E,OAAO,KAAKC,SAAS,MAAM,gCAAgC;AAE3D,OAAO,KAAKC,UAAU,MAAM,iBAAiB;AAE7C;;;;;;;;AAQA,OAAM,MAAgBC,uBAA2B,SAAQN,WAAW,CAACO,KAAK;EAGxE;;;;;EAKS,CAACJ,eAAe,CAACK,MAAM;EACvBC,MAAM;EACNC,OAAO;EACPC,qBAAqB;EAE9BC,YACEH,MAA4B,EAC5BC,OAA8B,EAC9BC,qBAA6C;IAE7C,KAAK,EAAE;IACP,IAAI,CAACR,eAAe,CAACK,MAAM,CAAC,GAAGL,eAAe,CAACK,MAAM;IACrD,IAAI,CAACC,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACC,OAAO,GAAGA,OAAO;IACtB,IAAI,CAACC,qBAAqB,GAAGA,qBAAqB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ignoreList":[]}
|
|
@@ -3,8 +3,11 @@ import * as EtagImpl from "effect/unstable/http/Etag";
|
|
|
3
3
|
import * as Platform from "effect/unstable/http/HttpPlatform";
|
|
4
4
|
import * as ServerResponse from "effect/unstable/http/HttpServerResponse";
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* Creates the Node `HttpPlatform`, serving file responses from Node readable
|
|
7
|
+
* streams and adding MIME type and content-length headers when needed.
|
|
8
|
+
*
|
|
9
|
+
* @category constructors
|
|
10
|
+
* @since 4.0.0
|
|
8
11
|
*/
|
|
9
12
|
export declare const make: import("effect/Effect").Effect<{
|
|
10
13
|
readonly fileResponse: (path: string, options?: ServerResponse.Options.WithContent & {
|
|
@@ -19,8 +22,11 @@ export declare const make: import("effect/Effect").Effect<{
|
|
|
19
22
|
}) => import("effect/Effect").Effect<ServerResponse.HttpServerResponse>;
|
|
20
23
|
}, never, import("effect/FileSystem").FileSystem | EtagImpl.Generator>;
|
|
21
24
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
25
|
+
* Provides the Node `HttpPlatform` together with the filesystem and ETag
|
|
26
|
+
* services it needs for file responses.
|
|
27
|
+
*
|
|
28
|
+
* @category layers
|
|
29
|
+
* @since 4.0.0
|
|
24
30
|
*/
|
|
25
31
|
export declare const layer: Layer.Layer<Platform.HttpPlatform>;
|
|
26
32
|
//# sourceMappingURL=NodeHttpPlatform.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeHttpPlatform.d.ts","sourceRoot":"","sources":["../src/NodeHttpPlatform.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"NodeHttpPlatform.d.ts","sourceRoot":"","sources":["../src/NodeHttpPlatform.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,QAAQ,MAAM,2BAA2B,CAAA;AAErD,OAAO,KAAK,QAAQ,MAAM,mCAAmC,CAAA;AAC7D,OAAO,KAAK,cAAc,MAAM,yCAAyC,CAAA;AAMzE;;;;;;GAMG;AACH,eAAO,MAAM,IAAI;iDAT+B,CAAC;4BAGI,CAAC;0BAChB,CAAC;uBAEhB,CAAC;;uGAKa,CAAA;4BAED,CAAA;0BAC7B,CAAC;uBAEE,CAAC;;sEAqBT,CAAA;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,YAAY,CAIpD,CAAA"}
|
package/dist/NodeHttpPlatform.js
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Node.js implementation of the Effect HTTP platform service.
|
|
3
|
+
*
|
|
4
|
+
* This module connects the portable `HttpPlatform` file response helpers to
|
|
5
|
+
* Node runtime primitives. It is used by Node HTTP servers and static file
|
|
6
|
+
* handlers when returning local files, public assets, downloads, byte ranges,
|
|
7
|
+
* or Web `File` values as `HttpServerResponse` bodies.
|
|
8
|
+
*
|
|
9
|
+
* Path-based responses are served with `node:fs.createReadStream`; Web `File`
|
|
10
|
+
* responses are bridged with `Readable.fromWeb`. The implementation fills in
|
|
11
|
+
* `content-type` from `Mime`, falls back to `application/octet-stream`, and
|
|
12
|
+
* writes the `content-length` for the selected range or whole file. Node's
|
|
13
|
+
* stream `end` option is inclusive, so the platform converts Effect's half-open
|
|
14
|
+
* range before reading. Empty bodies use an empty readable stream.
|
|
15
|
+
*
|
|
16
|
+
* Provide `layer` at the Node runtime edge when file responses, static serving,
|
|
17
|
+
* or response bodies created from files need real filesystem and ETag support.
|
|
18
|
+
* These responses are raw Node streams, so they are intended for the Node HTTP
|
|
19
|
+
* server adapter; keep files available until the response body has been
|
|
20
|
+
* consumed and prefer the portable `HttpServerResponse` constructors when a
|
|
21
|
+
* response does not depend on Node file or stream behavior.
|
|
22
|
+
*
|
|
23
|
+
* @since 4.0.0
|
|
3
24
|
*/
|
|
4
25
|
import { pipe } from "effect/Function";
|
|
5
26
|
import * as Layer from "effect/Layer";
|
|
@@ -12,14 +33,17 @@ import { Readable } from "node:stream";
|
|
|
12
33
|
import Mime from "./Mime.js";
|
|
13
34
|
import * as NodeFileSystem from "./NodeFileSystem.js";
|
|
14
35
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
36
|
+
* Creates the Node `HttpPlatform`, serving file responses from Node readable
|
|
37
|
+
* streams and adding MIME type and content-length headers when needed.
|
|
38
|
+
*
|
|
39
|
+
* @category constructors
|
|
40
|
+
* @since 4.0.0
|
|
17
41
|
*/
|
|
18
42
|
export const make = /*#__PURE__*/Platform.make({
|
|
19
43
|
fileResponse(path, status, statusText, headers, start, end, contentLength) {
|
|
20
|
-
const stream = Fs.createReadStream(path, {
|
|
44
|
+
const stream = contentLength === 0 ? Readable.from([]) : Fs.createReadStream(path, {
|
|
21
45
|
start,
|
|
22
|
-
end
|
|
46
|
+
end: end === undefined ? undefined : end - 1
|
|
23
47
|
});
|
|
24
48
|
return ServerResponse.raw(stream, {
|
|
25
49
|
headers: {
|
|
@@ -43,8 +67,11 @@ export const make = /*#__PURE__*/Platform.make({
|
|
|
43
67
|
}
|
|
44
68
|
});
|
|
45
69
|
/**
|
|
46
|
-
*
|
|
47
|
-
*
|
|
70
|
+
* Provides the Node `HttpPlatform` together with the filesystem and ETag
|
|
71
|
+
* services it needs for file responses.
|
|
72
|
+
*
|
|
73
|
+
* @category layers
|
|
74
|
+
* @since 4.0.0
|
|
48
75
|
*/
|
|
49
76
|
export const layer = /*#__PURE__*/pipe(/*#__PURE__*/Layer.effect(Platform.HttpPlatform)(make), /*#__PURE__*/Layer.provide(NodeFileSystem.layer), /*#__PURE__*/Layer.provide(EtagImpl.layer));
|
|
50
77
|
//# sourceMappingURL=NodeHttpPlatform.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeHttpPlatform.js","names":["pipe","Layer","EtagImpl","Headers","Platform","ServerResponse","Fs","Readable","Mime","NodeFileSystem","make","fileResponse","path","status","statusText","headers","start","end","contentLength","stream","createReadStream","raw","getType","toString","fileWebResponse","file","_options","fromWeb","merge","fromRecordUnsafe","name","size","layer","effect","HttpPlatform","provide"],"sources":["../src/NodeHttpPlatform.ts"],"sourcesContent":[null],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"NodeHttpPlatform.js","names":["pipe","Layer","EtagImpl","Headers","Platform","ServerResponse","Fs","Readable","Mime","NodeFileSystem","make","fileResponse","path","status","statusText","headers","start","end","contentLength","stream","from","createReadStream","undefined","raw","getType","toString","fileWebResponse","file","_options","fromWeb","merge","fromRecordUnsafe","name","size","layer","effect","HttpPlatform","provide"],"sources":["../src/NodeHttpPlatform.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,SAASA,IAAI,QAAQ,iBAAiB;AACtC,OAAO,KAAKC,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,QAAQ,MAAM,2BAA2B;AACrD,OAAO,KAAKC,OAAO,MAAM,8BAA8B;AACvD,OAAO,KAAKC,QAAQ,MAAM,mCAAmC;AAC7D,OAAO,KAAKC,cAAc,MAAM,yCAAyC;AACzE,OAAO,KAAKC,EAAE,MAAM,SAAS;AAC7B,SAASC,QAAQ,QAAQ,aAAa;AACtC,OAAOC,IAAI,MAAM,WAAW;AAC5B,OAAO,KAAKC,cAAc,MAAM,qBAAqB;AAErD;;;;;;;AAOA,OAAO,MAAMC,IAAI,gBAAGN,QAAQ,CAACM,IAAI,CAAC;EAChCC,YAAYA,CAACC,IAAI,EAAEC,MAAM,EAAEC,UAAU,EAAEC,OAAO,EAAEC,KAAK,EAAEC,GAAG,EAAEC,aAAa;IACvE,MAAMC,MAAM,GAAGD,aAAa,KAAK,CAAC,GAC9BX,QAAQ,CAACa,IAAI,CAAC,EAAE,CAAC,GACjBd,EAAE,CAACe,gBAAgB,CAACT,IAAI,EAAE;MAAEI,KAAK;MAAEC,GAAG,EAAEA,GAAG,K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* as Duration from "effect/Duration";
|
|
2
3
|
import * as Effect from "effect/Effect";
|
|
3
4
|
import type * as FileSystem from "effect/FileSystem";
|
|
4
5
|
import { type LazyArg } from "effect/Function";
|
|
@@ -19,10 +20,17 @@ import type { Duplex } from "node:stream";
|
|
|
19
20
|
import * as NodeServices from "./NodeServices.ts";
|
|
20
21
|
import { NodeWS } from "./NodeSocket.ts";
|
|
21
22
|
/**
|
|
22
|
-
*
|
|
23
|
+
* Creates a scoped `HttpServer` from a Node `http.Server`, starts listening
|
|
24
|
+
* with the supplied options, registers request and upgrade handling, and closes
|
|
25
|
+
* the server during scope finalization with optional graceful-shutdown control.
|
|
26
|
+
*
|
|
23
27
|
* @category constructors
|
|
28
|
+
* @since 4.0.0
|
|
24
29
|
*/
|
|
25
|
-
export declare const make: (evaluate: LazyArg<Http.Server<typeof Http.IncomingMessage, typeof Http.ServerResponse>>, options: Net.ListenOptions
|
|
30
|
+
export declare const make: (evaluate: LazyArg<Http.Server<typeof Http.IncomingMessage, typeof Http.ServerResponse>>, options: Net.ListenOptions & {
|
|
31
|
+
readonly disablePreemptiveShutdown?: boolean | undefined;
|
|
32
|
+
readonly gracefulShutdownTimeout?: Duration.Input | undefined;
|
|
33
|
+
}) => Effect.Effect<{
|
|
26
34
|
readonly serve: {
|
|
27
35
|
<E, R>(effect: Effect.Effect<HttpServerResponse, E, R>): Effect.Effect<void, never, Exclude<R, HttpServerRequest> | Scope.Scope>;
|
|
28
36
|
<E, R, App extends Effect.Effect<HttpServerResponse, any, any>>(effect: Effect.Effect<HttpServerResponse, E, R>, middleware: Middleware.HttpMiddleware.Applied<App, E, R>): Effect.Effect<void, never, Exclude<R, HttpServerRequest> | Scope.Scope>;
|
|
@@ -30,44 +38,76 @@ export declare const make: (evaluate: LazyArg<Http.Server<typeof Http.IncomingMe
|
|
|
30
38
|
readonly address: HttpServer.Address;
|
|
31
39
|
}, ServeError, Scope.Scope>;
|
|
32
40
|
/**
|
|
33
|
-
*
|
|
41
|
+
* Creates a Node `request` event handler for an Effect HTTP application,
|
|
42
|
+
* injecting a `HttpServerRequest` and interrupting the request fiber if the
|
|
43
|
+
* client closes the response before it finishes.
|
|
44
|
+
*
|
|
34
45
|
* @category Handlers
|
|
46
|
+
* @since 4.0.0
|
|
35
47
|
*/
|
|
36
48
|
export declare const makeHandler: <R, E, App extends Effect.Effect<HttpServerResponse, any, any> = Effect.Effect<HttpServerResponse, E, R>>(httpEffect: Effect.Effect<HttpServerResponse, E, R>, options: {
|
|
37
49
|
readonly scope: Scope.Scope;
|
|
38
50
|
readonly middleware?: Middleware.HttpMiddleware.Applied<App, E, R> | undefined;
|
|
39
51
|
}) => Effect.Effect<(nodeRequest: Http.IncomingMessage, nodeResponse: Http.ServerResponse) => void, never, Exclude<Effect.Services<App>, HttpServerRequest | Scope.Scope>>;
|
|
40
52
|
/**
|
|
41
|
-
*
|
|
53
|
+
* Creates a Node `upgrade` event handler for an Effect HTTP application,
|
|
54
|
+
* exposing the upgraded WebSocket as the request's `upgrade` effect and
|
|
55
|
+
* interrupting the request fiber when the socket closes early.
|
|
56
|
+
*
|
|
42
57
|
* @category Handlers
|
|
58
|
+
* @since 4.0.0
|
|
43
59
|
*/
|
|
44
60
|
export declare const makeUpgradeHandler: <R, E, App extends Effect.Effect<HttpServerResponse, any, any> = Effect.Effect<HttpServerResponse, E, R>>(lazyWss: Effect.Effect<NodeWS.WebSocketServer>, httpEffect: Effect.Effect<HttpServerResponse, E, R>, options: {
|
|
45
61
|
readonly scope: Scope.Scope;
|
|
46
62
|
readonly middleware?: Middleware.HttpMiddleware.Applied<App, E, R> | undefined;
|
|
47
63
|
}) => Effect.Effect<(nodeRequest: Http.IncomingMessage, socket: Duplex, head: Buffer) => void, never, Exclude<Effect.Services<App>, HttpServerRequest | Scope.Scope>>;
|
|
48
64
|
/**
|
|
49
|
-
*
|
|
50
|
-
*
|
|
65
|
+
* Provides an `HttpServer` by creating and managing a scoped Node
|
|
66
|
+
* `http.Server` with the supplied listen and shutdown options.
|
|
67
|
+
*
|
|
68
|
+
* @category layers
|
|
69
|
+
* @since 4.0.0
|
|
51
70
|
*/
|
|
52
|
-
export declare const layerServer: (evaluate: LazyArg<Http.Server<typeof Http.IncomingMessage, typeof Http.ServerResponse>>, options: Net.ListenOptions
|
|
71
|
+
export declare const layerServer: (evaluate: LazyArg<Http.Server<typeof Http.IncomingMessage, typeof Http.ServerResponse>>, options: Net.ListenOptions & {
|
|
72
|
+
readonly disablePreemptiveShutdown?: boolean | undefined;
|
|
73
|
+
readonly gracefulShutdownTimeout?: Duration.Input | undefined;
|
|
74
|
+
}) => Layer.Layer<HttpServer.HttpServer, ServeError>;
|
|
53
75
|
/**
|
|
54
|
-
*
|
|
55
|
-
*
|
|
76
|
+
* Provides the Node HTTP support services used by `NodeHttpServer`, including
|
|
77
|
+
* the HTTP platform, ETag generator, and core Node platform services.
|
|
78
|
+
*
|
|
79
|
+
* @category layers
|
|
80
|
+
* @since 4.0.0
|
|
56
81
|
*/
|
|
57
82
|
export declare const layerHttpServices: Layer.Layer<NodeServices.NodeServices | HttpPlatform.HttpPlatform | Etag.Generator>;
|
|
58
83
|
/**
|
|
59
|
-
*
|
|
60
|
-
*
|
|
84
|
+
* Provides a Node `HttpServer` together with the Node HTTP platform, ETag, and
|
|
85
|
+
* core platform services required to serve requests.
|
|
86
|
+
*
|
|
87
|
+
* @category layers
|
|
88
|
+
* @since 4.0.0
|
|
61
89
|
*/
|
|
62
|
-
export declare const layer: (evaluate: LazyArg<Http.Server>, options: Net.ListenOptions
|
|
90
|
+
export declare const layer: (evaluate: LazyArg<Http.Server>, options: Net.ListenOptions & {
|
|
91
|
+
readonly disablePreemptiveShutdown?: boolean | undefined;
|
|
92
|
+
readonly gracefulShutdownTimeout?: Duration.Input | undefined;
|
|
93
|
+
}) => Layer.Layer<HttpServer.HttpServer | NodeServices.NodeServices | HttpPlatform.HttpPlatform | Etag.Generator, ServeError>;
|
|
63
94
|
/**
|
|
64
|
-
*
|
|
65
|
-
*
|
|
95
|
+
* Provides a Node `HttpServer` and HTTP support services, reading the listen
|
|
96
|
+
* and shutdown options from a `Config` value.
|
|
97
|
+
*
|
|
98
|
+
* @category layers
|
|
99
|
+
* @since 4.0.0
|
|
66
100
|
*/
|
|
67
|
-
export declare const layerConfig: (evaluate: LazyArg<Http.Server>, options: Config.Wrap<Net.ListenOptions
|
|
101
|
+
export declare const layerConfig: (evaluate: LazyArg<Http.Server>, options: Config.Wrap<Net.ListenOptions & {
|
|
102
|
+
readonly disablePreemptiveShutdown?: boolean | undefined;
|
|
103
|
+
readonly gracefulShutdownTimeout?: Duration.Input | undefined;
|
|
104
|
+
}>) => Layer.Layer<HttpServer.HttpServer | FileSystem.FileSystem | Path.Path | HttpPlatform.HttpPlatform | Etag.Generator, ServeError | Config.ConfigError>;
|
|
68
105
|
/**
|
|
69
|
-
*
|
|
106
|
+
* Provides a test HTTP server listening on an ephemeral port together with a
|
|
107
|
+
* Fetch-backed `HttpClient` configured for server integration tests.
|
|
108
|
+
*
|
|
70
109
|
* @category Testing
|
|
110
|
+
* @since 4.0.0
|
|
71
111
|
*/
|
|
72
112
|
export declare const layerTest: Layer.Layer<HttpServer.HttpServer | FileSystem.FileSystem | Path.Path | HttpPlatform.HttpPlatform | Etag.Generator | HttpClient, ServeError, never>;
|
|
73
113
|
//# sourceMappingURL=NodeHttpServer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeHttpServer.d.ts","sourceRoot":"","sources":["../src/NodeHttpServer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"NodeHttpServer.d.ts","sourceRoot":"","sources":["../src/NodeHttpServer.ts"],"names":[],"mappings":"AAiCA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAA;AAC3C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,OAAO,KAAK,KAAK,UAAU,MAAM,mBAAmB,CAAA;A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