@effect/platform-node-shared 4.0.0-beta.70 → 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/NodeChildProcessSpawner.d.ts +15 -1
- package/dist/NodeChildProcessSpawner.d.ts.map +1 -1
- package/dist/NodeChildProcessSpawner.js.map +1 -1
- package/dist/NodeClusterSocket.d.ts.map +1 -1
- package/dist/NodeClusterSocket.js +27 -14
- package/dist/NodeClusterSocket.js.map +1 -1
- package/dist/NodeCrypto.d.ts +21 -1
- package/dist/NodeCrypto.d.ts.map +1 -1
- package/dist/NodeCrypto.js +21 -1
- package/dist/NodeCrypto.js.map +1 -1
- package/dist/NodeFileSystem.d.ts.map +1 -1
- package/dist/NodeFileSystem.js +25 -12
- package/dist/NodeFileSystem.js.map +1 -1
- package/dist/NodePath.d.ts.map +1 -1
- package/dist/NodePath.js +20 -11
- package/dist/NodePath.js.map +1 -1
- package/dist/NodeRuntime.d.ts +28 -16
- package/dist/NodeRuntime.d.ts.map +1 -1
- package/dist/NodeRuntime.js.map +1 -1
- package/dist/NodeSink.d.ts +25 -10
- package/dist/NodeSink.d.ts.map +1 -1
- package/dist/NodeSink.js.map +1 -1
- package/dist/NodeSocket.d.ts +21 -11
- package/dist/NodeSocket.d.ts.map +1 -1
- package/dist/NodeSocket.js.map +1 -1
- package/dist/NodeSocketServer.d.ts.map +1 -1
- package/dist/NodeSocketServer.js.map +1 -1
- package/dist/NodeStdio.d.ts.map +1 -1
- package/dist/NodeStdio.js +27 -12
- package/dist/NodeStdio.js.map +1 -1
- package/dist/NodeStream.d.ts +24 -15
- package/dist/NodeStream.d.ts.map +1 -1
- package/dist/NodeStream.js +22 -13
- package/dist/NodeStream.js.map +1 -1
- package/dist/NodeTerminal.d.ts.map +1 -1
- package/dist/NodeTerminal.js.map +1 -1
- package/dist/index.d.ts +0 -168
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -168
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/NodeChildProcessSpawner.ts +15 -1
- package/src/NodeClusterSocket.ts +27 -14
- package/src/NodeCrypto.ts +21 -1
- package/src/NodeFileSystem.ts +25 -12
- package/src/NodePath.ts +20 -11
- package/src/NodeRuntime.ts +26 -14
- package/src/NodeSink.ts +25 -10
- package/src/NodeSocket.ts +21 -11
- package/src/NodeSocketServer.ts +32 -14
- package/src/NodeStdio.ts +27 -12
- package/src/NodeStream.ts +22 -13
- package/src/NodeTerminal.ts +23 -10
- package/src/index.ts +0 -168
package/src/NodePath.ts
CHANGED
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Node-backed provider for Effect's `Path` service.
|
|
3
3
|
*
|
|
4
|
-
* This module
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* This module turns Node's `node:path` and `node:url` APIs into `Layer`s for
|
|
5
|
+
* programs that depend on `Path`. Use it when code should receive path
|
|
6
|
+
* operations from the Effect environment instead of importing `node:path`
|
|
7
|
+
* directly, including configuration loading, filesystem composition, and file
|
|
8
|
+
* URL conversion.
|
|
8
9
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
10
|
+
* **Mental model**
|
|
11
|
+
*
|
|
12
|
+
* `layer` follows the platform semantics of the current Node runtime. The
|
|
13
|
+
* `layerPosix` and `layerWin32` variants pin the syntax rules to POSIX or
|
|
14
|
+
* Windows, which is useful for deterministic parsing, formatting, and tests.
|
|
15
|
+
* All three layers include `fromFileUrl` and `toFileUrl` behavior backed by
|
|
16
|
+
* Node's URL conversion functions.
|
|
17
|
+
*
|
|
18
|
+
* **Gotchas**
|
|
19
|
+
*
|
|
20
|
+
* Path operations are syntactic: they normalize separators, roots, drive
|
|
21
|
+
* letters, UNC segments, extensions, and relative segments without checking the
|
|
22
|
+
* filesystem. File URL conversion follows Node's validation and encoding
|
|
23
|
+
* rules, and invalid conversions fail with `BadArgument`.
|
|
15
24
|
*
|
|
16
25
|
* @since 4.0.0
|
|
17
26
|
*/
|
package/src/NodeRuntime.ts
CHANGED
|
@@ -1,20 +1,32 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* process entry points.
|
|
2
|
+
* Node-compatible process runner for Effect programs.
|
|
4
3
|
*
|
|
5
|
-
* This module provides the
|
|
6
|
-
* Node-compatible platform packages.
|
|
7
|
-
*
|
|
8
|
-
*
|
|
4
|
+
* This module provides the shared `runMain` implementation used by
|
|
5
|
+
* Node-compatible platform packages. Use it at the outer edge of a CLI, script,
|
|
6
|
+
* worker, server, or test harness when a single Effect should become the main
|
|
7
|
+
* fiber for the process while still following Node signal and exit-code
|
|
8
|
+
* conventions.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
10
|
+
* **Mental model**
|
|
11
|
+
*
|
|
12
|
+
* `runMain` starts the supplied Effect as the process root. While that fiber is
|
|
13
|
+
* running, `SIGINT` and `SIGTERM` are translated into fiber interruption so
|
|
14
|
+
* scoped resources and finalizers get a chance to run. After the fiber exits,
|
|
15
|
+
* the signal listeners are removed and the configured teardown decides the
|
|
16
|
+
* process exit code.
|
|
17
|
+
*
|
|
18
|
+
* **Common tasks**
|
|
19
|
+
*
|
|
20
|
+
* - Launch a command-line program or long-running service from an Effect.
|
|
21
|
+
* - Share the same main-runner behavior across Node-compatible packages.
|
|
22
|
+
* - Customize teardown or runtime error reporting with the `runMain` options.
|
|
23
|
+
*
|
|
24
|
+
* **Gotchas**
|
|
25
|
+
*
|
|
26
|
+
* Clean success lets the Node event loop drain naturally instead of forcing
|
|
27
|
+
* `process.exit(0)`. Signal-triggered interruption or a non-zero teardown code
|
|
28
|
+
* calls `process.exit`, so long-lived handles should be acquired in Effect
|
|
29
|
+
* scopes and released by finalizers.
|
|
18
30
|
*
|
|
19
31
|
* @since 4.0.0
|
|
20
32
|
*/
|
package/src/NodeSink.ts
CHANGED
|
@@ -1,20 +1,35 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Sink adapters for writing Effect stream chunks into Node writable streams.
|
|
3
3
|
*
|
|
4
|
-
* This module is
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
4
|
+
* This module is the writable-stream boundary for Node APIs: push Effect
|
|
5
|
+
* `Stream` or `Channel` chunks into file streams, HTTP request or response
|
|
6
|
+
* bodies, process stdio, sockets, and transform inputs such as compression or
|
|
7
|
+
* encryption streams. It exposes a `Sink` constructor for ordinary stream
|
|
8
|
+
* pipelines plus lower-level `Channel` and pull helpers used by other Node
|
|
9
|
+
* stream adapters.
|
|
10
10
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
11
|
+
* **Mental model**
|
|
12
|
+
*
|
|
13
|
+
* {@link fromWritable} builds a `Sink` for normal stream pipelines.
|
|
14
|
+
* {@link fromWritableChannel} exposes the same bridge as a `Channel`, and
|
|
15
|
+
* {@link pullIntoWritable} is the lower-level loop for adapters that already
|
|
16
|
+
* have a pull and a Node writable. All three write chunks in order and follow
|
|
17
|
+
* Node writable backpressure.
|
|
18
|
+
*
|
|
19
|
+
* **Common tasks**
|
|
20
|
+
*
|
|
21
|
+
* Use {@link fromWritable} to pipe an Effect stream into a Node destination.
|
|
22
|
+
* Use {@link fromWritableChannel} when composing at the `Channel` level. Use
|
|
23
|
+
* {@link pullIntoWritable} inside custom Node stream adapters that need direct
|
|
24
|
+
* control over the upstream pull.
|
|
25
|
+
*
|
|
26
|
+
* **Gotchas**
|
|
27
|
+
*
|
|
28
|
+
* When `write` returns `false`, pulling pauses until `drain` so upstream
|
|
13
29
|
* producers do not overrun the writable buffer. Writable `error` events are
|
|
14
30
|
* mapped through `onError`, and the writable is ended and awaited via `finish`
|
|
15
31
|
* when upstream completes unless `endOnDone` is `false`. Use `endOnDone: false`
|
|
16
|
-
* for externally owned or long-lived writables
|
|
17
|
-
* Node's untyped errors meaningful for the calling Effect workflow.
|
|
32
|
+
* for externally owned or long-lived writables.
|
|
18
33
|
*
|
|
19
34
|
* @since 4.0.0
|
|
20
35
|
*/
|
package/src/NodeSocket.ts
CHANGED
|
@@ -1,17 +1,27 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* other Node `Duplex` streams to Effect's `Socket.Socket` interface.
|
|
2
|
+
* Node socket adapters for Effect sockets.
|
|
4
3
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* are translated into `SocketError` values.
|
|
4
|
+
* This module opens `node:net` connections or wraps existing Node `Duplex`
|
|
5
|
+
* streams and presents them as `Socket.Socket` values, socket channels, or
|
|
6
|
+
* layers. It is the low-level bridge for TCP clients, Unix domain socket
|
|
7
|
+
* clients, and protocols that already expose a Node duplex stream.
|
|
10
8
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
9
|
+
* **Mental model**
|
|
10
|
+
*
|
|
11
|
+
* A socket acquired here is scoped. `makeNet` dials with
|
|
12
|
+
* `net.createConnection`, `fromDuplex` adapts any duplex returned by an Effect,
|
|
13
|
+
* `makeNetChannel` exposes the socket as a `Channel`, and `layerNet` provides
|
|
14
|
+
* it through the Effect environment. While a socket handler is running,
|
|
15
|
+
* `NetSocket` gives access to the underlying Node `net.Socket` for cases that
|
|
16
|
+
* need Node-specific operations.
|
|
17
|
+
*
|
|
18
|
+
* **Gotchas**
|
|
19
|
+
*
|
|
20
|
+
* `openTimeout` only limits opening the connection. Writes complete when Node
|
|
21
|
+
* accepts or flushes a chunk, close events are translated to `SocketError`
|
|
22
|
+
* values, and finalizers close or destroy the stream when the surrounding scope
|
|
23
|
+
* ends. Unix socket paths are supplied through `NetConnectOpts.path`, so use
|
|
24
|
+
* the same platform path rules as Node.
|
|
15
25
|
*
|
|
16
26
|
* @since 4.0.0
|
|
17
27
|
*/
|
package/src/NodeSocketServer.ts
CHANGED
|
@@ -1,20 +1,38 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* `ws` WebSocket servers as Effect `SocketServer.SocketServer` services.
|
|
2
|
+
* Node socket server adapters for Effect's unstable socket server API.
|
|
4
3
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
4
|
+
* This module turns `node:net` TCP or Unix-domain servers and `ws` WebSocket
|
|
5
|
+
* servers into scoped `SocketServer.SocketServer` services. Use the TCP
|
|
6
|
+
* constructors when handlers should receive a `Socket.Socket` backed by a Node
|
|
7
|
+
* `net.Socket`; use the WebSocket constructors when handlers should receive a
|
|
8
|
+
* `Socket.Socket` backed by `ws` and have access to the per-connection
|
|
9
|
+
* WebSocket and `IncomingMessage` services.
|
|
11
10
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
11
|
+
* **Mental model**
|
|
12
|
+
*
|
|
13
|
+
* Calling {@link make} or {@link makeWebSocket} starts the underlying server in
|
|
14
|
+
* the current scope and returns the bound address. `run` installs the
|
|
15
|
+
* connection handler for that server, forks each accepted connection into a
|
|
16
|
+
* child scope, and closes those fibers when `run` finalizes. Connections
|
|
17
|
+
* accepted before `run` is installed are queued and then handed to the handler.
|
|
18
|
+
*
|
|
19
|
+
* **Common tasks**
|
|
20
|
+
*
|
|
21
|
+
* - Bind TCP ports or Unix socket paths with {@link make} or {@link layer}.
|
|
22
|
+
* - Expose `ws` WebSocket endpoints with {@link makeWebSocket} or
|
|
23
|
+
* {@link layerWebSocket}.
|
|
24
|
+
* - Read the returned `address` after binding port `0` or a wildcard host.
|
|
25
|
+
* - Inspect `NodeSocket.NetSocket`, `Socket.WebSocket`, or
|
|
26
|
+
* {@link IncomingMessage} from handler context when lower-level details are
|
|
27
|
+
* needed.
|
|
28
|
+
*
|
|
29
|
+
* **Gotchas**
|
|
30
|
+
*
|
|
31
|
+
* A constructor listens before it returns, so open errors fail construction
|
|
32
|
+
* rather than the first `run`. The server lifetime belongs to the scope that
|
|
33
|
+
* created it, while each `run` call owns its connection fibers. WebSocket
|
|
34
|
+
* handlers run with the `ws` connection and Node request in context, but TCP
|
|
35
|
+
* handlers expose only the underlying Node socket context.
|
|
18
36
|
*
|
|
19
37
|
* @since 4.0.0
|
|
20
38
|
*/
|
package/src/NodeStdio.ts
CHANGED
|
@@ -1,19 +1,34 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Shared Node.js implementation of the Effect `Stdio` service.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* for CLIs, scripts, command runners, test harnesses,
|
|
9
|
-
* process-oriented programs
|
|
4
|
+
* `NodeStdio` provides {@link Stdio.Stdio} from the current Node process. The
|
|
5
|
+
* exported {@link layer} reads command-line arguments from `process.argv`,
|
|
6
|
+
* consumes input from `process.stdin`, and writes normal and error output to
|
|
7
|
+
* `process.stdout` and `process.stderr`. It is the shared implementation used
|
|
8
|
+
* by Node platform packages for CLIs, scripts, command runners, test harnesses,
|
|
9
|
+
* and other process-oriented programs.
|
|
10
10
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
11
|
+
* **Mental model**
|
|
12
|
+
*
|
|
13
|
+
* Application code should depend on `Stdio`; this module decides that the
|
|
14
|
+
* backing resources are the global Node process handles. The layer does not
|
|
15
|
+
* create new streams and does not claim exclusive ownership of the existing
|
|
16
|
+
* ones.
|
|
17
|
+
*
|
|
18
|
+
* **Common tasks**
|
|
19
|
+
*
|
|
20
|
+
* Use {@link layer} when an Effect program needs process arguments, stdin,
|
|
21
|
+
* stdout, or stderr through the service environment. Pair it with terminal
|
|
22
|
+
* services when the same program also needs line editing, raw key input, or
|
|
23
|
+
* terminal dimensions.
|
|
24
|
+
*
|
|
25
|
+
* **Gotchas**
|
|
26
|
+
*
|
|
27
|
+
* Process stdio streams are shared with the rest of the Node process. This
|
|
28
|
+
* layer leaves stdin open and does not end stdout or stderr by default, avoiding
|
|
29
|
+
* accidental closure of handles that other code may still use. The streams may
|
|
30
|
+
* be pipes, files, or TTYs; terminal-specific behavior such as raw mode, echo,
|
|
31
|
+
* color detection, and cursor movement belongs with terminal APIs.
|
|
17
32
|
*
|
|
18
33
|
* @since 4.0.0
|
|
19
34
|
*/
|
package/src/NodeStream.ts
CHANGED
|
@@ -1,19 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Adapters between Node streams and Effect streams, channels, and readables.
|
|
3
3
|
*
|
|
4
|
-
* This module
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
4
|
+
* This module is the stream boundary for Node APIs: wrap `Readable` or
|
|
5
|
+
* `Duplex` values as Effect `Stream`s and `Channel`s, pipe an Effect stream
|
|
6
|
+
* through a Node duplex transform, expose an Effect `Stream` back to Node as a
|
|
7
|
+
* `Readable`, or collect bounded readable payloads into strings, array
|
|
8
|
+
* buffers, and `Uint8Array`s. Common sources include files, HTTP bodies, child
|
|
9
|
+
* process stdio, sockets, and compression or crypto transforms.
|
|
10
10
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
11
|
+
* **Mental model**
|
|
12
|
+
*
|
|
13
|
+
* Read adapters pull from Node's readable side into Effect. Duplex adapters
|
|
14
|
+
* write upstream Effect chunks to Node while reading transformed chunks back.
|
|
15
|
+
* `toReadable` runs an Effect stream from the caller's context, while
|
|
16
|
+
* `toReadableNever` is for streams that need no services.
|
|
17
|
+
*
|
|
18
|
+
* **Gotchas**
|
|
19
|
+
*
|
|
20
|
+
* Node backpressure is preserved: writes pause until `drain` before more input
|
|
21
|
+
* is pulled. Readables are destroyed on scope finalization by default, and
|
|
22
|
+
* duplex writable sides are ended when upstream completes unless configured
|
|
23
|
+
* otherwise. For externally owned or long-lived streams, choose `closeOnDone`
|
|
24
|
+
* and `endOnDone` deliberately; for collection helpers, set `maxBytes` when
|
|
25
|
+
* input size is not already bounded.
|
|
17
26
|
*
|
|
18
27
|
* @since 4.0.0
|
|
19
28
|
*/
|
package/src/NodeTerminal.ts
CHANGED
|
@@ -1,17 +1,30 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Shared Node.js implementation of Effect's `Terminal` service.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* process
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* dimensions, or prompt output.
|
|
4
|
+
* `NodeTerminal` adapts Node's `readline` APIs plus the current process'
|
|
5
|
+
* `stdin` and `stdout` streams into {@link Terminal.Terminal}. It is the shared
|
|
6
|
+
* process-backed terminal used by Node platform packages for prompts, REPLs,
|
|
7
|
+
* command-line tools, and interactive programs that need line input, key input,
|
|
8
|
+
* terminal dimensions, or display output.
|
|
10
9
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
10
|
+
* **Mental model**
|
|
11
|
+
*
|
|
12
|
+
* {@link make} creates a scoped terminal around the global process streams, and
|
|
13
|
+
* {@link layer} provides that terminal with the default quit behavior for key
|
|
14
|
+
* input. While the scope is active, the module owns the Node `readline`
|
|
15
|
+
* interface it created; it does not own the process streams themselves.
|
|
16
|
+
*
|
|
17
|
+
* **Common tasks**
|
|
18
|
+
*
|
|
19
|
+
* Use {@link make} when a custom `shouldQuit` predicate should decide when key
|
|
20
|
+
* input ends. Use {@link layer} when Ctrl+C and Ctrl+D should end the key-input
|
|
21
|
+
* stream. For plain byte-oriented stdin/stdout access, use the `Stdio` service
|
|
22
|
+
* instead.
|
|
23
|
+
*
|
|
24
|
+
* **Gotchas**
|
|
25
|
+
*
|
|
26
|
+
* When stdin is a TTY, raw mode is enabled while the scoped terminal is active
|
|
27
|
+
* and restored on release. Raw mode changes how keys are delivered and can
|
|
15
28
|
* affect other code reading stdin. In non-TTY environments such as pipes,
|
|
16
29
|
* redirected input, or CI, raw mode is unavailable, keypress behavior is
|
|
17
30
|
* limited, and stdout dimensions may be reported as zero.
|
package/src/index.ts
CHANGED
|
@@ -5,229 +5,61 @@
|
|
|
5
5
|
// @barrel: Auto-generated exports. Do not edit manually.
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* Node.js implementation of `ChildProcessSpawner`.
|
|
9
|
-
*
|
|
10
8
|
* @since 4.0.0
|
|
11
9
|
*/
|
|
12
10
|
export * as NodeChildProcessSpawner from "./NodeChildProcessSpawner.ts"
|
|
13
11
|
|
|
14
12
|
/**
|
|
15
|
-
* Node TCP socket integration for Effect Cluster runner communication.
|
|
16
|
-
*
|
|
17
|
-
* This module provides the shared Node layers used by socket-based cluster
|
|
18
|
-
* transports: a client protocol that opens TCP sockets to runner addresses and
|
|
19
|
-
* a socket server that listens for incoming runner RPC traffic. It is useful
|
|
20
|
-
* when wiring Node or Node-compatible cluster runners, sharing the same socket
|
|
21
|
-
* implementation across platform packages, or building tests and deployments
|
|
22
|
-
* that need direct runner-to-runner RPC over TCP rather than HTTP.
|
|
23
|
-
*
|
|
24
|
-
* Cluster runners must advertise an address that peers can reach while the
|
|
25
|
-
* server may listen on a different address via `runnerListenAddress`, which is
|
|
26
|
-
* common behind containers, port mappings, or Kubernetes services. Serialization
|
|
27
|
-
* is supplied by the surrounding layer, and gossip, shard discovery, health
|
|
28
|
-
* checks, and storage-backed delivery are coordinated by the cluster services
|
|
29
|
-
* that use this transport. Keep those responsibilities separate when debugging:
|
|
30
|
-
* a reachable socket does not by itself guarantee that runner membership,
|
|
31
|
-
* shard ownership, or persisted message notification is current.
|
|
32
|
-
*
|
|
33
13
|
* @since 4.0.0
|
|
34
14
|
*/
|
|
35
15
|
export * as NodeClusterSocket from "./NodeClusterSocket.ts"
|
|
36
16
|
|
|
37
17
|
/**
|
|
38
|
-
* Node.js implementation of the Crypto service.
|
|
39
|
-
*
|
|
40
18
|
* @since 1.0.0
|
|
41
19
|
*/
|
|
42
20
|
export * as NodeCrypto from "./NodeCrypto.ts"
|
|
43
21
|
|
|
44
22
|
/**
|
|
45
|
-
* Shared Node-compatible implementation of Effect's `FileSystem` service.
|
|
46
|
-
*
|
|
47
|
-
* This module adapts Node's `node:fs`, `node:os`, and `node:path` APIs into a
|
|
48
|
-
* layer that can be provided to Effect programs running on Node-compatible
|
|
49
|
-
* runtimes. It is used by platform packages to provide file and directory I/O,
|
|
50
|
-
* permissions, links, metadata, temporary files and directories, and file
|
|
51
|
-
* watching through the `FileSystem` service.
|
|
52
|
-
*
|
|
53
|
-
* Paths are passed to Node filesystem APIs, so relative paths are resolved by
|
|
54
|
-
* the current working directory and platform path rules still apply. Node
|
|
55
|
-
* filesystem failures are translated into `PlatformError` values, while invalid
|
|
56
|
-
* arguments become `BadArgument` failures. Open files are scoped resources with
|
|
57
|
-
* tracked read and write positions; append mode lets the operating system choose
|
|
58
|
-
* the write offset. File watching is exposed as a stream and follows
|
|
59
|
-
* `node:fs.watch` semantics unless a `WatchBackend` is provided, so recursive
|
|
60
|
-
* support, event coalescing, and reported paths can vary by runtime and
|
|
61
|
-
* platform.
|
|
62
|
-
*
|
|
63
23
|
* @since 4.0.0
|
|
64
24
|
*/
|
|
65
25
|
export * as NodeFileSystem from "./NodeFileSystem.ts"
|
|
66
26
|
|
|
67
27
|
/**
|
|
68
|
-
* Shared Node-compatible implementation of Effect's `Path` service.
|
|
69
|
-
*
|
|
70
|
-
* This module adapts Node's `node:path` and `node:url` APIs into layers that
|
|
71
|
-
* can be provided to Effect programs needing path manipulation, such as
|
|
72
|
-
* resolving configuration files, building file system locations, parsing
|
|
73
|
-
* names and extensions, or converting between file paths and `file:` URLs.
|
|
74
|
-
*
|
|
75
|
-
* The default layer follows the host platform semantics exposed by
|
|
76
|
-
* `node:path`, while `layerPosix` and `layerWin32` provide stable POSIX or
|
|
77
|
-
* Windows behavior regardless of the current runtime. Path operations are
|
|
78
|
-
* syntactic and do not check whether files exist; separators, drive letters,
|
|
79
|
-
* UNC paths, and URL encoding rules can also differ by platform. Invalid
|
|
80
|
-
* file URL conversions are reported through `BadArgument`.
|
|
81
|
-
*
|
|
82
28
|
* @since 4.0.0
|
|
83
29
|
*/
|
|
84
30
|
export * as NodePath from "./NodePath.ts"
|
|
85
31
|
|
|
86
32
|
/**
|
|
87
|
-
* Shared runtime helpers for running Effect programs as Node-compatible
|
|
88
|
-
* process entry points.
|
|
89
|
-
*
|
|
90
|
-
* This module provides the common `runMain` implementation used by
|
|
91
|
-
* Node-compatible platform packages. It is intended for CLIs, scripts,
|
|
92
|
-
* workers, servers, and other process-oriented programs that should run an
|
|
93
|
-
* Effect as their main fiber while still following Node process conventions.
|
|
94
|
-
*
|
|
95
|
-
* The runner installs `SIGINT` and `SIGTERM` handlers for the lifetime of the
|
|
96
|
-
* main fiber, translating those process signals into fiber interruption so
|
|
97
|
-
* Effect finalizers and the configured teardown can run. When the fiber exits,
|
|
98
|
-
* the signal listeners are removed and teardown determines the exit code. Clean
|
|
99
|
-
* success lets the Node event loop drain naturally instead of forcing
|
|
100
|
-
* `process.exit(0)`, while signal-triggered or non-zero exits call
|
|
101
|
-
* `process.exit` after teardown, so long-running resources should be modeled
|
|
102
|
-
* in the Effect scope and finalized explicitly.
|
|
103
|
-
*
|
|
104
33
|
* @since 4.0.0
|
|
105
34
|
*/
|
|
106
35
|
export * as NodeRuntime from "./NodeRuntime.ts"
|
|
107
36
|
|
|
108
37
|
/**
|
|
109
|
-
* Sink adapters for writing Effect stream chunks into Node writable streams.
|
|
110
|
-
*
|
|
111
|
-
* This module is used at the boundary where Effect `Stream`s or `Channel`s need
|
|
112
|
-
* to push data into Node's writable side: file streams, HTTP request or
|
|
113
|
-
* response bodies, process stdio, sockets, and transform inputs such as
|
|
114
|
-
* compression or encryption streams. It exposes both a `Sink` constructor for
|
|
115
|
-
* ordinary stream pipelines and lower-level `Channel` and pull helpers used by
|
|
116
|
-
* other Node stream adapters.
|
|
117
|
-
*
|
|
118
|
-
* The implementation follows Node writable semantics. Chunks are written in
|
|
119
|
-
* order; when `write` returns `false`, pulling pauses until `drain` so upstream
|
|
120
|
-
* producers do not overrun the writable buffer. Writable `error` events are
|
|
121
|
-
* mapped through `onError`, and the writable is ended and awaited via `finish`
|
|
122
|
-
* when upstream completes unless `endOnDone` is `false`. Use `endOnDone: false`
|
|
123
|
-
* for externally owned or long-lived writables, and make sure `onError` keeps
|
|
124
|
-
* Node's untyped errors meaningful for the calling Effect workflow.
|
|
125
|
-
*
|
|
126
38
|
* @since 4.0.0
|
|
127
39
|
*/
|
|
128
40
|
export * as NodeSink from "./NodeSink.ts"
|
|
129
41
|
|
|
130
42
|
/**
|
|
131
|
-
* Shared Node socket constructors for adapting `node:net` connections and
|
|
132
|
-
* other Node `Duplex` streams to Effect's `Socket.Socket` interface.
|
|
133
|
-
*
|
|
134
|
-
* Use this module when building TCP clients, Unix domain socket clients, or
|
|
135
|
-
* higher-level protocols that already expose a Node `Duplex`. Connections are
|
|
136
|
-
* scoped, so finalizers close or destroy the underlying stream, open timeouts
|
|
137
|
-
* are reported as socket open errors, and Node read, write, and close events
|
|
138
|
-
* are translated into `SocketError` values.
|
|
139
|
-
*
|
|
140
|
-
* Node sockets have a few operational details worth keeping in mind: Unix
|
|
141
|
-
* socket paths are supplied through `NetConnectOpts.path`, writes complete only
|
|
142
|
-
* after Node accepts or flushes the chunk, and abnormal close events are
|
|
143
|
-
* surfaced as close errors while normal remote ends complete the socket run.
|
|
144
|
-
*
|
|
145
43
|
* @since 4.0.0
|
|
146
44
|
*/
|
|
147
45
|
export * as NodeSocket from "./NodeSocket.ts"
|
|
148
46
|
|
|
149
47
|
/**
|
|
150
|
-
* Shared Node socket server constructors for exposing `node:net` servers and
|
|
151
|
-
* `ws` WebSocket servers as Effect `SocketServer.SocketServer` services.
|
|
152
|
-
*
|
|
153
|
-
* Use this module when implementing TCP services, Unix domain socket services,
|
|
154
|
-
* WebSocket endpoints, or higher-level protocols such as RPC transports that
|
|
155
|
-
* need to accept incoming connections through Effect's socket APIs. TCP
|
|
156
|
-
* connections are adapted through `NodeSocket.fromDuplex`, while WebSocket
|
|
157
|
-
* handlers also receive the underlying `WebSocket` and Node `IncomingMessage`
|
|
158
|
-
* in their fiber context.
|
|
159
|
-
*
|
|
160
|
-
* The server starts listening before the constructor returns, and the exported
|
|
161
|
-
* `address` is derived from the actual Node server after binding. Prefer that
|
|
162
|
-
* address when using port `0`, wildcard hosts, or Unix socket paths. Incoming
|
|
163
|
-
* connections accepted before `run` is installed are queued and then handed to
|
|
164
|
-
* the handler, each `run` call owns the scope for its connection fibers, and
|
|
165
|
-
* the enclosing scope closes the underlying Node server.
|
|
166
|
-
*
|
|
167
48
|
* @since 4.0.0
|
|
168
49
|
*/
|
|
169
50
|
export * as NodeSocketServer from "./NodeSocketServer.ts"
|
|
170
51
|
|
|
171
52
|
/**
|
|
172
|
-
* Shared Node.js implementation of the Effect `Stdio` service.
|
|
173
|
-
*
|
|
174
|
-
* This module builds the `Stdio` layer used by Node platform packages by
|
|
175
|
-
* wiring the service to the current process: command-line arguments come from
|
|
176
|
-
* `process.argv`, input is read from `process.stdin`, and output and error
|
|
177
|
-
* output are written to `process.stdout` and `process.stderr`. It is intended
|
|
178
|
-
* for CLIs, scripts, command runners, test harnesses, and other
|
|
179
|
-
* process-oriented programs that need standard I/O through Effect services.
|
|
180
|
-
*
|
|
181
|
-
* The process stdio streams are global resources owned by Node. This layer
|
|
182
|
-
* leaves stdin open and does not end stdout or stderr by default, avoiding
|
|
183
|
-
* accidental closure of handles other code in the process may still use. Those
|
|
184
|
-
* streams may be pipes, files, or TTYs; interactive terminal behavior such as
|
|
185
|
-
* raw mode, echo, colors, and cursor movement should be coordinated with the
|
|
186
|
-
* terminal APIs instead of assuming this layer has exclusive control.
|
|
187
|
-
*
|
|
188
53
|
* @since 4.0.0
|
|
189
54
|
*/
|
|
190
55
|
export * as NodeStdio from "./NodeStdio.ts"
|
|
191
56
|
|
|
192
57
|
/**
|
|
193
|
-
* Interoperability between Node streams and Effect streams and channels.
|
|
194
|
-
*
|
|
195
|
-
* This module adapts `Readable` and `Duplex` instances at the boundary with
|
|
196
|
-
* Node APIs: wrapping sources such as files, HTTP responses, child process
|
|
197
|
-
* output, and compression transforms as Effect `Stream`s or `Channel`s, piping
|
|
198
|
-
* Effect streams through Node duplex transforms, exposing an Effect `Stream`
|
|
199
|
-
* back to Node as a `Readable`, and collecting small readable payloads into
|
|
200
|
-
* strings or binary buffers.
|
|
201
|
-
*
|
|
202
|
-
* The adapters preserve the Node stream semantics that matter for production
|
|
203
|
-
* code. Writes wait for `drain` when a writable side applies backpressure,
|
|
204
|
-
* readable streams are destroyed on scope finalization by default, and stream
|
|
205
|
-
* failures are routed through `onError` or `Cause.UnknownError`. For long-lived
|
|
206
|
-
* or externally owned streams, pass `closeOnDone` or `endOnDone` carefully, and
|
|
207
|
-
* use `maxBytes` on collection helpers to avoid buffering unbounded input.
|
|
208
|
-
*
|
|
209
58
|
* @since 4.0.0
|
|
210
59
|
*/
|
|
211
60
|
export * as NodeStream from "./NodeStream.ts"
|
|
212
61
|
|
|
213
62
|
/**
|
|
214
|
-
* Shared Node.js implementation of Effect's `Terminal` service.
|
|
215
|
-
*
|
|
216
|
-
* This module is the process-backed terminal implementation used by Node
|
|
217
|
-
* platform packages. It adapts Node's `readline` APIs and the current
|
|
218
|
-
* process' `stdin` and `stdout` streams into a `Terminal`, making it suitable
|
|
219
|
-
* for CLIs, REPLs, prompts, full-screen terminal programs, and other
|
|
220
|
-
* command-line tools that need line input, keypress input, terminal
|
|
221
|
-
* dimensions, or prompt output.
|
|
222
|
-
*
|
|
223
|
-
* The implementation works with global process streams, so callers should
|
|
224
|
-
* acquire it with a scope or provide `layer` to ensure cleanup. When `stdin`
|
|
225
|
-
* is a TTY, raw mode is enabled while the scoped readline interface is active
|
|
226
|
-
* and restored on release; raw mode changes how keys are delivered and can
|
|
227
|
-
* affect other code reading stdin. In non-TTY environments such as pipes,
|
|
228
|
-
* redirected input, or CI, raw mode is unavailable, keypress behavior is
|
|
229
|
-
* limited, and stdout dimensions may be reported as zero.
|
|
230
|
-
*
|
|
231
63
|
* @since 4.0.0
|
|
232
64
|
*/
|
|
233
65
|
export * as NodeTerminal from "./NodeTerminal.ts"
|