@effect/platform-node 4.0.0-beta.7 → 4.0.0-beta.70

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 (119) hide show
  1. package/dist/Mime.d.ts +3 -3
  2. package/dist/Mime.js +3 -3
  3. package/dist/NodeChildProcessSpawner.d.ts +1 -1
  4. package/dist/NodeChildProcessSpawner.js +1 -1
  5. package/dist/NodeClusterHttp.d.ts +49 -7
  6. package/dist/NodeClusterHttp.d.ts.map +1 -1
  7. package/dist/NodeClusterHttp.js +20 -10
  8. package/dist/NodeClusterHttp.js.map +1 -1
  9. package/dist/NodeClusterSocket.d.ts +57 -11
  10. package/dist/NodeClusterSocket.d.ts.map +1 -1
  11. package/dist/NodeClusterSocket.js +57 -11
  12. package/dist/NodeClusterSocket.js.map +1 -1
  13. package/dist/NodeCrypto.d.ts +10 -0
  14. package/dist/NodeCrypto.d.ts.map +1 -0
  15. package/dist/NodeCrypto.js +14 -0
  16. package/dist/NodeCrypto.js.map +1 -0
  17. package/dist/NodeFileSystem.d.ts +4 -2
  18. package/dist/NodeFileSystem.d.ts.map +1 -1
  19. package/dist/NodeFileSystem.js +22 -3
  20. package/dist/NodeFileSystem.js.map +1 -1
  21. package/dist/NodeHttpClient.d.ts +102 -24
  22. package/dist/NodeHttpClient.d.ts.map +1 -1
  23. package/dist/NodeHttpClient.js +124 -28
  24. package/dist/NodeHttpClient.js.map +1 -1
  25. package/dist/NodeHttpIncomingMessage.d.ts +30 -9
  26. package/dist/NodeHttpIncomingMessage.d.ts.map +1 -1
  27. package/dist/NodeHttpIncomingMessage.js +34 -8
  28. package/dist/NodeHttpIncomingMessage.js.map +1 -1
  29. package/dist/NodeHttpPlatform.d.ts +10 -4
  30. package/dist/NodeHttpPlatform.d.ts.map +1 -1
  31. package/dist/NodeHttpPlatform.js +34 -7
  32. package/dist/NodeHttpPlatform.js.map +1 -1
  33. package/dist/NodeHttpServer.d.ts +56 -16
  34. package/dist/NodeHttpServer.d.ts.map +1 -1
  35. package/dist/NodeHttpServer.js +117 -49
  36. package/dist/NodeHttpServer.js.map +1 -1
  37. package/dist/NodeHttpServerRequest.d.ts +29 -3
  38. package/dist/NodeHttpServerRequest.d.ts.map +1 -1
  39. package/dist/NodeHttpServerRequest.js +9 -2
  40. package/dist/NodeHttpServerRequest.js.map +1 -1
  41. package/dist/NodeMultipart.d.ts +32 -4
  42. package/dist/NodeMultipart.d.ts.map +1 -1
  43. package/dist/NodeMultipart.js +32 -4
  44. package/dist/NodeMultipart.js.map +1 -1
  45. package/dist/NodePath.d.ts +15 -6
  46. package/dist/NodePath.d.ts.map +1 -1
  47. package/dist/NodePath.js +30 -7
  48. package/dist/NodePath.js.map +1 -1
  49. package/dist/NodeRedis.d.ts +38 -9
  50. package/dist/NodeRedis.d.ts.map +1 -1
  51. package/dist/NodeRedis.js +41 -12
  52. package/dist/NodeRedis.js.map +1 -1
  53. package/dist/NodeRuntime.d.ts +27 -36
  54. package/dist/NodeRuntime.d.ts.map +1 -1
  55. package/dist/NodeRuntime.js +24 -13
  56. package/dist/NodeRuntime.js.map +1 -1
  57. package/dist/NodeServices.d.ts +29 -5
  58. package/dist/NodeServices.d.ts.map +1 -1
  59. package/dist/NodeServices.js +7 -3
  60. package/dist/NodeServices.js.map +1 -1
  61. package/dist/NodeSink.d.ts +2 -2
  62. package/dist/NodeSink.js +2 -2
  63. package/dist/NodeSocket.d.ts +18 -3
  64. package/dist/NodeSocket.d.ts.map +1 -1
  65. package/dist/NodeSocket.js +36 -4
  66. package/dist/NodeSocket.js.map +1 -1
  67. package/dist/NodeSocketServer.d.ts +2 -2
  68. package/dist/NodeSocketServer.js +2 -2
  69. package/dist/NodeStdio.d.ts +5 -2
  70. package/dist/NodeStdio.d.ts.map +1 -1
  71. package/dist/NodeStdio.js +22 -3
  72. package/dist/NodeStdio.js.map +1 -1
  73. package/dist/NodeStream.d.ts +2 -2
  74. package/dist/NodeStream.js +2 -2
  75. package/dist/NodeTerminal.d.ts +8 -2
  76. package/dist/NodeTerminal.d.ts.map +1 -1
  77. package/dist/NodeTerminal.js +19 -3
  78. package/dist/NodeTerminal.js.map +1 -1
  79. package/dist/NodeWorker.d.ts +9 -2
  80. package/dist/NodeWorker.d.ts.map +1 -1
  81. package/dist/NodeWorker.js +31 -6
  82. package/dist/NodeWorker.js.map +1 -1
  83. package/dist/NodeWorkerRunner.d.ts +5 -1
  84. package/dist/NodeWorkerRunner.d.ts.map +1 -1
  85. package/dist/NodeWorkerRunner.js +27 -5
  86. package/dist/NodeWorkerRunner.js.map +1 -1
  87. package/dist/Undici.d.ts +3 -3
  88. package/dist/Undici.js +3 -3
  89. package/dist/index.d.ts +376 -24
  90. package/dist/index.d.ts.map +1 -1
  91. package/dist/index.js +376 -24
  92. package/dist/index.js.map +1 -1
  93. package/package.json +9 -9
  94. package/src/Mime.ts +3 -3
  95. package/src/NodeChildProcessSpawner.ts +1 -1
  96. package/src/NodeClusterHttp.ts +54 -11
  97. package/src/NodeClusterSocket.ts +57 -11
  98. package/src/NodeCrypto.ts +16 -0
  99. package/src/NodeFileSystem.ts +22 -3
  100. package/src/NodeHttpClient.ts +132 -33
  101. package/src/NodeHttpIncomingMessage.ts +42 -12
  102. package/src/NodeHttpPlatform.ts +35 -6
  103. package/src/NodeHttpServer.ts +139 -53
  104. package/src/NodeHttpServerRequest.ts +29 -3
  105. package/src/NodeMultipart.ts +32 -4
  106. package/src/NodePath.ts +30 -7
  107. package/src/NodeRedis.ts +43 -14
  108. package/src/NodeRuntime.ts +42 -37
  109. package/src/NodeServices.ts +31 -5
  110. package/src/NodeSink.ts +2 -2
  111. package/src/NodeSocket.ts +41 -4
  112. package/src/NodeSocketServer.ts +2 -2
  113. package/src/NodeStdio.ts +22 -3
  114. package/src/NodeStream.ts +2 -2
  115. package/src/NodeTerminal.ts +19 -3
  116. package/src/NodeWorker.ts +31 -6
  117. package/src/NodeWorkerRunner.ts +27 -5
  118. package/src/Undici.ts +3 -3
  119. package/src/index.ts +377 -24
package/src/index.ts CHANGED
@@ -1,127 +1,480 @@
1
1
  /**
2
- * @since 1.0.0
2
+ * @since 4.0.0
3
3
  */
4
4
 
5
5
  // @barrel: Auto-generated exports. Do not edit manually.
6
6
 
7
7
  /**
8
- * @since 1.0.0
8
+ * @since 4.0.0
9
9
  */
10
10
  export * as Mime from "./Mime.ts"
11
11
 
12
12
  /**
13
13
  * Node.js implementation of `ChildProcessSpawner`.
14
14
  *
15
- * @since 1.0.0
15
+ * @since 4.0.0
16
16
  */
17
17
  export * as NodeChildProcessSpawner from "./NodeChildProcessSpawner.ts"
18
18
 
19
19
  /**
20
- * @since 1.0.0
20
+ * The `NodeClusterHttp` module provides the Node.js HTTP and WebSocket
21
+ * transports for Effect Cluster runners. It wires `HttpRunner` to the Node HTTP
22
+ * server, supplies Undici and WebSocket client protocols, and builds a complete
23
+ * sharding layer with serialization, runner health, runner storage, and message
24
+ * storage.
25
+ *
26
+ * **Common tasks**
27
+ *
28
+ * - Run a Node process as a cluster runner over HTTP or WebSocket with
29
+ * {@link layer}
30
+ * - Connect a client-only process to an existing HTTP cluster without starting
31
+ * a runner server
32
+ * - Use SQL-backed storage for durable multi-process clusters, `local` storage
33
+ * for short-lived development, or `byo` storage when the deployment owns the
34
+ * persistence boundary
35
+ * - Check runner health with protocol pings or Kubernetes pod readiness through
36
+ * {@link layerK8sHttpClient}
37
+ *
38
+ * **Gotchas**
39
+ *
40
+ * - `runnerAddress` is the host and port advertised to other runners; set
41
+ * `runnerListenAddress` when the local bind address differs from the
42
+ * externally reachable address
43
+ * - The HTTP and WebSocket transports serve runner RPCs at the default
44
+ * `HttpRunner` route, so proxies and load balancers must preserve the path
45
+ * and allow WebSocket upgrades when `transport` is `"websocket"`
46
+ * - `clientOnly` does not start an HTTP server or receive shard assignments
47
+ * - SQL storage is the default; `local` storage is in-memory/noop and `byo`
48
+ * requires the surrounding application to provide both runner and message
49
+ * storage services
50
+ * - Ping health checks use the selected transport and serialization, so route,
51
+ * port, proxy, or codec mismatches can make a runner appear unhealthy
52
+ *
53
+ * @since 4.0.0
21
54
  */
22
55
  export * as NodeClusterHttp from "./NodeClusterHttp.ts"
23
56
 
24
57
  /**
25
- * @since 1.0.0
58
+ * The `NodeClusterSocket` module provides the Node.js socket transport for
59
+ * Effect Cluster runners. It wires `SocketRunner` to Node TCP sockets, supplies
60
+ * RPC client and server protocol layers, and builds a complete sharding layer
61
+ * with serialization, runner health, runner storage, and message storage.
62
+ *
63
+ * **Common tasks**
64
+ *
65
+ * - Run a Node process as a cluster runner over raw TCP sockets with
66
+ * {@link layer}
67
+ * - Connect a client-only process to an existing socket cluster without
68
+ * starting a runner server
69
+ * - Use SQL-backed storage for durable multi-process clusters, `local` storage
70
+ * for short-lived development, or `byo` storage when the deployment owns the
71
+ * persistence boundary
72
+ * - Check runner health with socket pings or Kubernetes pod readiness through
73
+ * {@link layerK8sHttpClient}
74
+ *
75
+ * **Gotchas**
76
+ *
77
+ * - `runnerAddress` is the host and port advertised to other runners; set
78
+ * `runnerListenAddress` when the local bind address differs from the
79
+ * externally reachable address
80
+ * - The socket transport is point-to-point RPC, not cluster gossip: runner
81
+ * membership, shard ownership, and persisted delivery are coordinated through
82
+ * `RunnerStorage`, `MessageStorage`, and `RunnerHealth`
83
+ * - `clientOnly` does not start a socket server or receive shard assignments
84
+ * - Ping health checks use the same socket protocol, so unreachable ports,
85
+ * firewalls, or serialization mismatches can make a runner appear unhealthy
86
+ *
87
+ * @since 4.0.0
26
88
  */
27
89
  export * as NodeClusterSocket from "./NodeClusterSocket.ts"
28
90
 
29
91
  /**
92
+ * Node.js platform Crypto service layer.
93
+ *
30
94
  * @since 1.0.0
31
95
  */
96
+ export * as NodeCrypto from "./NodeCrypto.ts"
97
+
98
+ /**
99
+ * Provides the Node.js `FileSystem` layer for Effect programs.
100
+ *
101
+ * Use this module when a Node application, CLI, script, or test needs to
102
+ * satisfy the `FileSystem` service with real filesystem access for reading and
103
+ * writing files, creating directories and temporary files, inspecting metadata,
104
+ * managing links, or watching paths for changes.
105
+ *
106
+ * This module only exposes the Node-backed layer; filesystem operations are
107
+ * accessed through the `FileSystem` service from `effect/FileSystem`. Provide
108
+ * `NodeFileSystem.layer` at the edge of the program, or use
109
+ * `NodeServices.layer` when you also want the standard Node path, stdio,
110
+ * terminal, and child process services. The implementation is shared with
111
+ * other Node-compatible platform packages, so optional services such as
112
+ * `FileSystem.WatchBackend` are honored when present; otherwise file watching
113
+ * follows Node's `node:fs.watch` behavior. Paths are interpreted by Node, so
114
+ * relative paths use the current working directory and platform path rules.
115
+ *
116
+ * @since 4.0.0
117
+ */
32
118
  export * as NodeFileSystem from "./NodeFileSystem.ts"
33
119
 
34
120
  /**
35
- * @since 1.0.0
121
+ * Node.js implementations of the Effect `HttpClient`.
122
+ *
123
+ * This module provides the Node-specific layers and constructors for sending
124
+ * Effect HTTP client requests. It re-exports the fetch-based client for
125
+ * programs that want to use `globalThis.fetch`, provides an Undici-backed
126
+ * client for applications that need Undici dispatcher control, and provides a
127
+ * lower-level `node:http` / `node:https` client for integrations that need
128
+ * native Node agent configuration.
129
+ *
130
+ * Use these clients in server-side applications, CLIs, tests, and integrations
131
+ * where requests should participate in Effect resource management, interruption,
132
+ * streaming, and typed transport / decode errors. The Undici path sends each
133
+ * request through the current `Dispatcher`; `layerUndici` owns a scoped
134
+ * `Agent`, while `dispatcherLayerGlobal` uses Undici's process-global dispatcher
135
+ * without destroying it. The `node:http` path uses separate scoped HTTP and
136
+ * HTTPS agents, making it the right choice when native agent options such as
137
+ * TLS, proxy, keep-alive, or socket behavior need to be configured directly.
138
+ *
139
+ * The backends are not completely interchangeable. Fetch, Undici, and
140
+ * `node:http` expose different agent and dispatcher hooks, body implementations,
141
+ * abort behavior, upgrade support, and response body readers. This module
142
+ * converts Effect request bodies to the selected runtime representation:
143
+ * streams remain streaming, `FormData` may contribute generated content headers,
144
+ * and body read failures are reported as `HttpClientError` decode or transport
145
+ * errors.
146
+ *
147
+ * @since 4.0.0
36
148
  */
37
149
  export * as NodeHttpClient from "./NodeHttpClient.ts"
38
150
 
39
151
  /**
40
- * @since 1.0.0
152
+ * Utilities for adapting Node `http.IncomingMessage` values to the Effect HTTP
153
+ * incoming message interface used by the platform Node server and client
154
+ * implementations.
155
+ *
156
+ * This module is useful when code needs to keep access to Node's request or
157
+ * response object while also exposing Effect's typed headers, remote address,
158
+ * body decoders, and stream interface. The body helpers consume Node's readable
159
+ * stream, cache decoded text and array-buffer results, and honor the
160
+ * `HttpIncomingMessage.MaxBodySize` fiber ref. Prefer a single body access
161
+ * strategy per message: raw `stream` access is not cached, and Node request
162
+ * bodies cannot be replayed once the underlying stream has been consumed.
163
+ *
164
+ * @since 4.0.0
41
165
  */
42
166
  export * as NodeHttpIncomingMessage from "./NodeHttpIncomingMessage.ts"
43
167
 
44
168
  /**
45
- * @since 1.0.0
169
+ * Node.js implementation of the Effect HTTP platform service.
170
+ *
171
+ * This module connects the portable `HttpPlatform` file response helpers to
172
+ * Node runtime primitives. It is used by Node HTTP servers and static file
173
+ * handlers when returning local files, public assets, downloads, byte ranges,
174
+ * or Web `File` values as `HttpServerResponse` bodies.
175
+ *
176
+ * Path-based responses are served with `node:fs.createReadStream`; Web `File`
177
+ * responses are bridged with `Readable.fromWeb`. The implementation fills in
178
+ * `content-type` from `Mime`, falls back to `application/octet-stream`, and
179
+ * writes the `content-length` for the selected range or whole file. Node's
180
+ * stream `end` option is inclusive, so the platform converts Effect's half-open
181
+ * range before reading. Empty bodies use an empty readable stream.
182
+ *
183
+ * Provide `layer` at the Node runtime edge when file responses, static serving,
184
+ * or response bodies created from files need real filesystem and ETag support.
185
+ * These responses are raw Node streams, so they are intended for the Node HTTP
186
+ * server adapter; keep files available until the response body has been
187
+ * consumed and prefer the portable `HttpServerResponse` constructors when a
188
+ * response does not depend on Node file or stream behavior.
189
+ *
190
+ * @since 4.0.0
46
191
  */
47
192
  export * as NodeHttpPlatform from "./NodeHttpPlatform.ts"
48
193
 
49
194
  /**
50
- * @since 1.0.0
195
+ * Node.js implementation of the Effect `HttpServer`.
196
+ *
197
+ * This module adapts a supplied Node `http.Server` into Effect's
198
+ * platform-independent HTTP server service. It starts the server with Node
199
+ * `listen` options, converts `request` events into `HttpServerRequest` values,
200
+ * writes `HttpServerResponse` bodies through Node's `ServerResponse`, and
201
+ * handles `upgrade` events by exposing the upgraded socket through
202
+ * `HttpServerRequest.upgrade`.
203
+ *
204
+ * Common use cases include serving an Effect HTTP application with {@link layer}
205
+ * or {@link layerConfig}, embedding request or upgrade handlers into an
206
+ * existing Node server with {@link makeHandler} and {@link makeUpgradeHandler},
207
+ * and using {@link layerTest} for integration tests that need an ephemeral
208
+ * listening port and a client pointed at it.
209
+ *
210
+ * Listen options are passed directly to Node, so host, port, backlog, and Unix
211
+ * socket path behavior follow `node:http`. The server begins listening when the
212
+ * `HttpServer` is acquired, and handlers are installed when `serve` is run.
213
+ * Request fibers are interrupted with `ClientAbort` when the client disconnects
214
+ * before a response finishes. WebSocket support only applies to Node `upgrade`
215
+ * requests, and ordinary HTTP requests fail if their application attempts to use
216
+ * `HttpServerRequest.upgrade`.
217
+ *
218
+ * Scope ownership is important: the server is closed when the acquiring scope
219
+ * finalizes, while each `serve` call installs its own request and upgrade
220
+ * listeners and removes them on finalization. Unless preemptive shutdown is
221
+ * disabled, finalizing a serve scope also starts a graceful server close, using
222
+ * the configured timeout or the default timeout.
223
+ *
224
+ * @since 4.0.0
51
225
  */
52
226
  export * as NodeHttpServer from "./NodeHttpServer.ts"
53
227
 
54
228
  /**
55
- * @since 1.0.0
229
+ * Accessors for the Node.js objects backing a platform Node
230
+ * `HttpServerRequest`.
231
+ *
232
+ * Use this module at interop boundaries when an Effect HTTP handler needs the
233
+ * original `http.IncomingMessage` or `http.ServerResponse` for APIs that are
234
+ * specific to Node, such as existing middleware, socket inspection, raw stream
235
+ * piping, or response customization that cannot be expressed with the portable
236
+ * `HttpServerRequest` and `HttpServerResponse` interfaces.
237
+ *
238
+ * The returned request is the original Node request supplied to the server. It
239
+ * does not reflect Effect request overrides made by middleware, such as a
240
+ * rewritten URL, adjusted headers, or a substituted remote address. Its body is
241
+ * also Node's one-shot readable stream, so avoid mixing raw stream consumption
242
+ * with Effect body, multipart, or stream helpers unless ownership of the body
243
+ * is clear. The returned response is the Node response owned by the platform
244
+ * server; writing to it directly bypasses the usual Effect response writer and
245
+ * must be coordinated carefully to avoid duplicate writes. Upgrade requests may
246
+ * create that response lazily when it is first requested.
247
+ *
248
+ * @since 4.0.0
56
249
  */
57
250
  export * as NodeHttpServerRequest from "./NodeHttpServerRequest.ts"
58
251
 
59
252
  /**
60
- * @since 1.0.0
253
+ * Node-specific helpers for parsing HTTP `multipart/form-data` request bodies.
254
+ *
255
+ * This module adapts a Node `Readable` request body plus its incoming headers
256
+ * into the shared `Multipart` model. Use `stream` when an HTTP server route
257
+ * wants to handle form fields and uploaded files incrementally, for example API
258
+ * endpoints that validate text fields while piping file parts to storage. Use
259
+ * `persisted` when the whole form should be collected into a record and uploaded
260
+ * files should be written into scoped temporary files through the current
261
+ * `FileSystem` and `Path` services.
262
+ *
263
+ * Node request bodies are one-shot streams, so consume either `stream` or
264
+ * `persisted`, and make sure file parts are drained, piped, or otherwise
265
+ * deliberately handled. `contentEffect` loads a file into memory and should be
266
+ * reserved for small uploads. Persisted paths live only for the surrounding
267
+ * `Scope`, and filenames supplied by clients should be treated as metadata, not
268
+ * trusted filesystem paths.
269
+ *
270
+ * @since 4.0.0
61
271
  */
62
272
  export * as NodeMultipart from "./NodeMultipart.ts"
63
273
 
64
274
  /**
65
- * @since 1.0.0
275
+ * Node.js layers for Effect's `Path` service.
276
+ *
277
+ * Use this module when an Effect program running on Node needs path operations
278
+ * from the `Path` service, such as joining and normalizing filesystem
279
+ * locations, resolving configuration or static asset paths, working with CLI
280
+ * path arguments, or converting between file paths and `file:` URLs.
281
+ *
282
+ * `layer` follows the host platform's `node:path` semantics. Use `layerPosix`
283
+ * or `layerWin32` when code needs stable POSIX or Windows behavior regardless
284
+ * of the operating system. These layers provide only path manipulation; they do
285
+ * not read the filesystem or validate that paths exist. `NodeServices.layer`
286
+ * already includes the default Node path layer, so provide this module directly
287
+ * when you want the narrower service or one of the platform-specific variants.
288
+ *
289
+ * @since 4.0.0
66
290
  */
67
291
  export * as NodePath from "./NodePath.ts"
68
292
 
69
293
  /**
70
- * @since 1.0.0
294
+ * Node.js Redis integration backed by `ioredis`.
295
+ *
296
+ * This module provides scoped layers that create an `ioredis` client and expose
297
+ * both the low-level `Redis` service used by Effect persistence modules and the
298
+ * `NodeRedis` service for direct access to the underlying client. It is useful
299
+ * for Node applications that want Redis-backed persistence, persisted queues,
300
+ * distributed rate limiting, or custom Redis commands alongside the Effect
301
+ * services that build on Redis.
302
+ *
303
+ * The client is acquired when the layer is built and closed with `quit` when
304
+ * the layer scope ends, so install the layer at the lifetime you want for the
305
+ * connection and pass `ioredis` options, or `layerConfig`, for connection,
306
+ * TLS, database, retry, and reconnect settings. Persistence and rate limiter
307
+ * stores build their own keys and Lua scripts on top of this service; choose
308
+ * stable prefixes and store ids to avoid collisions, account for persisted
309
+ * values that may fail to decode after schema changes, and avoid unbounded
310
+ * high-cardinality rate-limit keys unless you have a cleanup or bounding
311
+ * strategy.
312
+ *
313
+ * @since 4.0.0
71
314
  */
72
315
  export * as NodeRedis from "./NodeRedis.ts"
73
316
 
74
317
  /**
75
- * @since 1.0.0
318
+ * Node.js entry-point helpers for running Effect programs.
319
+ *
320
+ * This module exposes `runMain`, the Node runtime launcher used at the edge of
321
+ * CLI tools, scripts, servers, and worker processes. It runs an already
322
+ * self-contained Effect as the process main program, with built-in error
323
+ * reporting and Node signal handling.
324
+ *
325
+ * `NodeRuntime` does not provide application services by itself. Provide any
326
+ * required layers, such as `NodeServices.layer` or narrower service-specific
327
+ * layers, before passing the effect to `runMain`. On `SIGINT` or `SIGTERM`,
328
+ * the main fiber is interrupted so scoped resources and finalizers can shut
329
+ * down; keep long-running work attached to that scope and avoid finalizers that
330
+ * never complete, otherwise process shutdown can be delayed.
331
+ *
332
+ * @since 4.0.0
76
333
  */
77
334
  export * as NodeRuntime from "./NodeRuntime.ts"
78
335
 
79
336
  /**
80
- * @since 1.0.0
337
+ * Provides the aggregate Node platform services layer for applications that run
338
+ * on the Node.js runtime.
339
+ *
340
+ * This module is useful when an application needs the standard Node-backed
341
+ * implementations of filesystem access, path operations, stdio, terminal
342
+ * interaction, and child process spawning from a single layer. Provide
343
+ * `NodeServices.layer` near the edge of a program to satisfy effects that read
344
+ * or write files, resolve paths, interact with stdin/stdout/stderr or a
345
+ * terminal, or launch subprocesses.
346
+ *
347
+ * The layer only supplies the runtime services listed by `NodeServices`; it does
348
+ * not provide unrelated platform services such as HTTP clients or servers.
349
+ * Libraries should continue to depend on the individual service tags they use,
350
+ * while applications, CLIs, and tests can choose this layer or narrower
351
+ * service-specific layers depending on how much of the Node runtime they want to
352
+ * expose.
353
+ *
354
+ * @since 4.0.0
81
355
  */
82
356
  export * as NodeServices from "./NodeServices.ts"
83
357
 
84
358
  /**
85
- * @since 1.0.0
359
+ * @since 4.0.0
86
360
  */
87
361
  export * as NodeSink from "./NodeSink.ts"
88
362
 
89
363
  /**
90
- * @since 1.0.0
364
+ * Node platform socket entry point for Effect sockets backed by Node streams
365
+ * and WebSocket implementations.
366
+ *
367
+ * This module re-exports the shared Node socket constructors for TCP clients,
368
+ * Unix domain socket clients, and adapters from existing Node `Duplex` streams,
369
+ * then adds Node-specific WebSocket constructor layers. Use it when connecting
370
+ * to raw socket protocols, wiring RPC transports over TCP or Unix sockets, or
371
+ * opening WebSocket clients in Node.
372
+ *
373
+ * TCP and Unix socket behavior comes from the shared Node layer: Unix sockets
374
+ * are selected with `NetConnectOpts.path`, scoped sockets close or destroy the
375
+ * underlying stream on finalization, and Node open, read, write, and close
376
+ * events are translated into `SocketError` values. For WebSockets,
377
+ * `layerWebSocketConstructor` prefers `globalThis.WebSocket` when available
378
+ * and falls back to `ws`; use `layerWebSocketConstructorWS` when you need the
379
+ * `ws` implementation consistently across Node versions.
380
+ *
381
+ * @since 4.0.0
91
382
  */
92
383
  export * as NodeSocket from "./NodeSocket.ts"
93
384
 
94
385
  /**
95
- * @since 1.0.0
386
+ * @since 4.0.0
96
387
  */
97
388
  export * as NodeSocketServer from "./NodeSocketServer.ts"
98
389
 
99
390
  /**
100
- * @since 1.0.0
391
+ * Node.js implementation of the Effect `Stdio` service.
392
+ *
393
+ * This module exposes a layer that connects `Stdio` to the current process:
394
+ * command-line arguments come from `process.argv`, input is read from
395
+ * `process.stdin`, and output and error output write to `process.stdout` and
396
+ * `process.stderr`. It is intended for CLIs, scripts, command runners, and
397
+ * other process-oriented programs that need standard input and output through
398
+ * Effect services.
399
+ *
400
+ * The underlying streams are owned by the Node process. The layer keeps stdin
401
+ * open and does not end stdout or stderr when a stream finishes, which avoids
402
+ * closing global process handles that other code may still use. Be mindful that
403
+ * stdio may be a pipe, file, or TTY, so terminal-specific behavior such as raw
404
+ * mode, echo, colors, and cursor control should be handled with the terminal
405
+ * APIs instead of assuming an interactive console.
406
+ *
407
+ * @since 4.0.0
101
408
  */
102
409
  export * as NodeStdio from "./NodeStdio.ts"
103
410
 
104
411
  /**
105
- * @since 1.0.0
412
+ * @since 4.0.0
106
413
  */
107
414
  export * as NodeStream from "./NodeStream.ts"
108
415
 
109
416
  /**
110
- * @since 1.0.0
417
+ * Provides the Node.js `Terminal` service for interactive command-line
418
+ * programs, prompts, and tools that need to read lines, react to key presses,
419
+ * write to stdout, or inspect terminal dimensions.
420
+ *
421
+ * The implementation is backed by the current process' stdin and stdout. When
422
+ * stdin is a TTY, key input temporarily enables raw mode for the scope of the
423
+ * service, so callers should acquire it with a scope or use the provided layer
424
+ * to ensure terminal state is restored. In non-TTY environments, terminal
425
+ * dimensions may be reported as zero and raw-mode key handling is unavailable.
426
+ *
427
+ * @since 4.0.0
111
428
  */
112
429
  export * as NodeTerminal from "./NodeTerminal.ts"
113
430
 
114
431
  /**
115
- * @since 1.0.0
432
+ * Parent-side Node.js support for Effect workers.
433
+ *
434
+ * This module provides the `WorkerPlatform` used by Node programs that spawn
435
+ * and communicate with `node:worker_threads` workers or IPC-enabled child
436
+ * processes through Effect's worker protocol. Pair it with `NodeWorkerRunner`
437
+ * in the worker entrypoint when building worker-backed RPC clients, offloading
438
+ * CPU-bound work, isolating Node resources, or hosting services that should
439
+ * exchange typed messages with the parent process.
440
+ *
441
+ * Worker-thread spawners can use `postMessage` transfer lists for values such
442
+ * as `ArrayBuffer` and `MessagePort`, but transferring moves ownership and
443
+ * invalid transfer lists surface as worker send or receive failures.
444
+ * Child-process spawners must provide an IPC channel, for example via
445
+ * `child_process.fork` or `stdio: "ipc"`; their messages use Node IPC
446
+ * serialization and this module does not forward transfer lists to
447
+ * `ChildProcess.send`. Scope finalization sends the worker close signal and
448
+ * waits for exit before falling back to `terminate()` or `SIGKILL`.
449
+ *
450
+ * @since 4.0.0
116
451
  */
117
452
  export * as NodeWorker from "./NodeWorker.ts"
118
453
 
119
454
  /**
120
- * @since 1.0.0
455
+ * Runtime support for Effect workers that are executed by Node.js.
456
+ *
457
+ * This module is intended to be installed in the program running inside a
458
+ * `node:worker_threads` worker or an IPC-enabled child process. It provides the
459
+ * `WorkerRunnerPlatform` used by `WorkerRunner` to receive request messages
460
+ * from the parent, run the registered Effect handler, and send responses back
461
+ * over the parent channel.
462
+ *
463
+ * Use it when the parent side is created with `NodeWorker` and the worker code
464
+ * needs to perform CPU-bound work, isolate Node resources, or host services that
465
+ * should communicate through the Effect worker protocol. The runner must be
466
+ * started from an actual worker context: `parentPort` is required for worker
467
+ * threads, while child processes must be spawned with an IPC channel so
468
+ * `process.send` is available. Transfer lists only apply to worker-thread
469
+ * `postMessage`; child-process messages go through Node IPC serialization.
470
+ * Shutdown is coordinated by the parent message protocol, so long-running
471
+ * handlers should remain interruptible and keep resource cleanup in scopes.
472
+ *
473
+ * @since 4.0.0
121
474
  */
122
475
  export * as NodeWorkerRunner from "./NodeWorkerRunner.ts"
123
476
 
124
477
  /**
125
- * @since 1.0.0
478
+ * @since 4.0.0
126
479
  */
127
480
  export * as Undici from "./Undici.ts"