@effect/platform-node 4.0.0-beta.77 → 4.0.0-beta.79
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/NodeClusterHttp.d.ts +8 -32
- package/dist/NodeClusterHttp.d.ts.map +1 -1
- package/dist/NodeClusterHttp.js.map +1 -1
- package/dist/NodeClusterSocket.d.ts +7 -27
- package/dist/NodeClusterSocket.d.ts.map +1 -1
- package/dist/NodeClusterSocket.js +7 -27
- package/dist/NodeClusterSocket.js.map +1 -1
- package/dist/NodeFileSystem.d.ts.map +1 -1
- package/dist/NodeFileSystem.js +0 -18
- package/dist/NodeFileSystem.js.map +1 -1
- package/dist/NodeHttpClient.d.ts +4 -31
- package/dist/NodeHttpClient.d.ts.map +1 -1
- package/dist/NodeHttpClient.js +4 -31
- package/dist/NodeHttpClient.js.map +1 -1
- package/dist/NodeHttpIncomingMessage.d.ts +0 -15
- package/dist/NodeHttpIncomingMessage.d.ts.map +1 -1
- package/dist/NodeHttpIncomingMessage.js +0 -15
- package/dist/NodeHttpIncomingMessage.js.map +1 -1
- package/dist/NodeHttpPlatform.d.ts.map +1 -1
- package/dist/NodeHttpPlatform.js +3 -17
- package/dist/NodeHttpPlatform.js.map +1 -1
- package/dist/NodeHttpServer.d.ts.map +1 -1
- package/dist/NodeHttpServer.js +3 -21
- package/dist/NodeHttpServer.js.map +1 -1
- package/dist/NodeHttpServerRequest.d.ts +4 -17
- package/dist/NodeHttpServerRequest.d.ts.map +1 -1
- package/dist/NodeHttpServerRequest.js.map +1 -1
- package/dist/NodeMultipart.d.ts +5 -28
- package/dist/NodeMultipart.d.ts.map +1 -1
- package/dist/NodeMultipart.js +5 -28
- package/dist/NodeMultipart.js.map +1 -1
- package/dist/NodePath.d.ts.map +1 -1
- package/dist/NodePath.js +4 -24
- package/dist/NodePath.js.map +1 -1
- package/dist/NodeRedis.d.ts +4 -33
- package/dist/NodeRedis.d.ts.map +1 -1
- package/dist/NodeRedis.js +4 -33
- package/dist/NodeRedis.js.map +1 -1
- package/dist/NodeRuntime.d.ts.map +1 -1
- package/dist/NodeRuntime.js +5 -26
- package/dist/NodeRuntime.js.map +1 -1
- package/dist/NodeServices.d.ts +5 -30
- package/dist/NodeServices.d.ts.map +1 -1
- package/dist/NodeServices.js.map +1 -1
- package/dist/NodeSocket.d.ts.map +1 -1
- package/dist/NodeSocket.js +5 -29
- package/dist/NodeSocket.js.map +1 -1
- package/dist/NodeStdio.d.ts.map +1 -1
- package/dist/NodeStdio.js +4 -21
- package/dist/NodeStdio.js.map +1 -1
- package/dist/NodeTerminal.d.ts.map +1 -1
- package/dist/NodeTerminal.js +3 -17
- package/dist/NodeTerminal.js.map +1 -1
- package/dist/NodeWorker.d.ts.map +1 -1
- package/dist/NodeWorker.js +6 -29
- package/dist/NodeWorker.js.map +1 -1
- package/dist/NodeWorkerRunner.d.ts.map +1 -1
- package/dist/NodeWorkerRunner.js +5 -34
- package/dist/NodeWorkerRunner.js.map +1 -1
- package/package.json +4 -4
- package/src/NodeClusterHttp.ts +7 -31
- package/src/NodeClusterSocket.ts +7 -27
- package/src/NodeFileSystem.ts +0 -18
- package/src/NodeHttpClient.ts +4 -31
- package/src/NodeHttpIncomingMessage.ts +0 -15
- package/src/NodeHttpPlatform.ts +3 -17
- package/src/NodeHttpServer.ts +3 -21
- package/src/NodeHttpServerRequest.ts +4 -17
- package/src/NodeMultipart.ts +5 -28
- package/src/NodePath.ts +4 -24
- package/src/NodeRedis.ts +4 -33
- package/src/NodeRuntime.ts +5 -26
- package/src/NodeServices.ts +5 -30
- package/src/NodeSocket.ts +5 -29
- package/src/NodeStdio.ts +4 -21
- package/src/NodeTerminal.ts +3 -17
- package/src/NodeWorker.ts +6 -29
- package/src/NodeWorkerRunner.ts +5 -34
package/dist/NodeStdio.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeStdio.js","names":["NodeStdio","layer"],"sources":["../src/NodeStdio.ts"],"sourcesContent":[null],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"NodeStdio.js","names":["NodeStdio","layer"],"sources":["../src/NodeStdio.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;AAUA,OAAO,KAAKA,SAAS,MAAM,wCAAwC;AAInE;;;;;;;AAOA,OAAO,MAAMC,KAAK,GAAuBD,SAAS,CAACC,KAAK","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeTerminal.d.ts","sourceRoot":"","sources":["../src/NodeTerminal.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"NodeTerminal.d.ts","sourceRoot":"","sources":["../src/NodeTerminal.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAE1D;;;;;;GAMG;AACH,eAAO,MAAM,IAAI,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,OAAO,KAAK,MAAM,CAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,CAAqB,CAAA;AAErH;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,QAAQ,CAAsB,CAAA"}
|
package/dist/NodeTerminal.js
CHANGED
|
@@ -1,23 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Node.js implementation of the Effect `Terminal` service.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* **Mental model**
|
|
9
|
-
*
|
|
10
|
-
* `make` acquires a scoped terminal backed by process streams, and `layer`
|
|
11
|
-
* provides that service with the default key sequence for quitting input. When
|
|
12
|
-
* stdin is a TTY, low-level key input temporarily enables raw mode for the
|
|
13
|
-
* lifetime of the scope; finalization restores the previous terminal state.
|
|
14
|
-
*
|
|
15
|
-
* **Gotchas**
|
|
16
|
-
*
|
|
17
|
-
* In non-TTY environments such as CI, pipes, or redirected input, terminal
|
|
18
|
-
* dimensions may be reported as zero and raw-mode key handling is unavailable.
|
|
19
|
-
* For plain stdin/stdout byte streams, use the standard I/O service instead of
|
|
20
|
-
* the interactive terminal service.
|
|
4
|
+
* This module reuses the shared Node terminal implementation. `make` creates a
|
|
5
|
+
* scoped process-backed `Terminal` service, and `layer` provides the default
|
|
6
|
+
* service with the standard quit behavior for key input.
|
|
21
7
|
*
|
|
22
8
|
* @since 4.0.0
|
|
23
9
|
*/
|
package/dist/NodeTerminal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeTerminal.js","names":["NodeTerminal","make","layer"],"sources":["../src/NodeTerminal.ts"],"sourcesContent":[null],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"NodeTerminal.js","names":["NodeTerminal","make","layer"],"sources":["../src/NodeTerminal.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;AASA,OAAO,KAAKA,YAAY,MAAM,2CAA2C;AAMzE;;;;;;;AAOA,OAAO,MAAMC,IAAI,GAAmFD,YAAY,CAACC,IAAI;AAErH;;;;;;;AAOA,OAAO,MAAMC,KAAK,GAAoBF,YAAY,CAACE,KAAK","ignoreList":[]}
|
package/dist/NodeWorker.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeWorker.d.ts","sourceRoot":"","sources":["../src/NodeWorker.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"NodeWorker.d.ts","sourceRoot":"","sources":["../src/NodeWorker.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAErC,OAAO,KAAK,MAAM,MAAM,gCAAgC,CAAA;AAExD,OAAO,KAAK,KAAK,YAAY,MAAM,oBAAoB,CAAA;AACvD,OAAO,KAAK,KAAK,aAAa,MAAM,qBAAqB,CAAA;AAEzD;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,cAAc,CA2E5D,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,GAChB,OAAO,CAAC,EAAE,EAAE,MAAM,KAAK,aAAa,CAAC,MAAM,GAAG,YAAY,CAAC,YAAY,KACtE,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,cAAc,GAAG,MAAM,CAAC,OAAO,CAIlD,CAAA"}
|
package/dist/NodeWorker.js
CHANGED
|
@@ -1,35 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Parent-side Node.js support for Effect workers.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* workers. It supports both `node:worker_threads` workers and IPC-enabled
|
|
6
|
-
* processes, routing messages through Effect's worker protocol
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* `NodeWorker` runs in the parent process. The worker entrypoint should install
|
|
12
|
-
* `NodeWorkerRunner`, which receives parent messages, runs the registered
|
|
13
|
-
* Effect handler, and sends replies back over the same channel. Use `layer`
|
|
14
|
-
* when you want this module to provide both the platform and a `Worker.Spawner`;
|
|
15
|
-
* use `layerPlatform` when the spawner is provided elsewhere.
|
|
16
|
-
*
|
|
17
|
-
* **Common tasks**
|
|
18
|
-
*
|
|
19
|
-
* - Spawn CPU-bound or resource-isolated work in `worker_threads`.
|
|
20
|
-
* - Spawn a child process that was created with an IPC channel.
|
|
21
|
-
* - Share one parent-side worker implementation across both Node transports.
|
|
22
|
-
*
|
|
23
|
-
* **Gotchas**
|
|
24
|
-
*
|
|
25
|
-
* Worker-thread spawners can use `postMessage` transfer lists for values such as
|
|
26
|
-
* `ArrayBuffer` and `MessagePort`; transferring moves ownership, and invalid
|
|
27
|
-
* transfer lists surface as send or receive failures. Child-process spawners
|
|
28
|
-
* must provide an IPC channel, for example via `child_process.fork` or
|
|
29
|
-
* `stdio: "ipc"`; their messages use Node IPC serialization and transfer lists
|
|
30
|
-
* are not forwarded to `ChildProcess.send`. Scope finalization sends the worker
|
|
31
|
-
* close signal and waits for exit before falling back to `terminate()` or
|
|
32
|
-
* `SIGKILL`.
|
|
4
|
+
* `layerPlatform` installs the `WorkerPlatform` used by a Node program that
|
|
5
|
+
* owns workers. It supports both `node:worker_threads` workers and IPC-enabled
|
|
6
|
+
* child processes, routing messages through Effect's worker protocol. `layer`
|
|
7
|
+
* combines that platform with a `Spawner` callback, and the platform asks
|
|
8
|
+
* workers to close on scope finalization before forcefully terminating them on
|
|
9
|
+
* timeout.
|
|
33
10
|
*
|
|
34
11
|
* @since 4.0.0
|
|
35
12
|
*/
|
package/dist/NodeWorker.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeWorker.js","names":["Deferred","Effect","Exit","Layer","Scope","Worker","WorkerError","WorkerReceiveError","layerPlatform","succeed","WorkerPlatform","makePlatform","setup","scope","worker","exitDeferred","makeUnsafe","thing","postMessage","msg","t","kill","terminate","_","send","on","doneUnsafe","void","as","addFinalizer","suspend","await","pipe","timeout","catchCause","sync","listen","deferred","emit","port","message","cause","reason","code","layer","spawn","merge","layerSpawner"],"sources":["../src/NodeWorker.ts"],"sourcesContent":[null],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"NodeWorker.js","names":["Deferred","Effect","Exit","Layer","Scope","Worker","WorkerError","WorkerReceiveError","layerPlatform","succeed","WorkerPlatform","makePlatform","setup","scope","worker","exitDeferred","makeUnsafe","thing","postMessage","msg","t","kill","terminate","_","send","on","doneUnsafe","void","as","addFinalizer","suspend","await","pipe","timeout","catchCause","sync","listen","deferred","emit","port","message","cause","reason","code","layer","spawn","merge","layerSpawner"],"sources":["../src/NodeWorker.ts"],"sourcesContent":[null],"mappings":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,GAAGG;SAChD;OACF,CAAC,CACH;IACH,CAAC,CAAC;IACF,OAAO1C,MAAM,CAAC0B,IAAI;EACpB;CACD,CAAC,CACH;AAED;;;;;;;AAOA,OAAO,MAAMiB,KAAK,GAChBC,KAAuE,IAEvE1C,KAAK,CAAC2C,KAAK,CACTzC,MAAM,CAAC0C,YAAY,CAACF,KAAK,CAAC,EAC1BrC,aAAa,CACd","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeWorkerRunner.d.ts","sourceRoot":"","sources":["../src/NodeWorkerRunner.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"NodeWorkerRunner.d.ts","sourceRoot":"","sources":["../src/NodeWorkerRunner.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAErC,OAAO,KAAK,YAAY,MAAM,sCAAsC,CAAA;AAGpE;;;;;;;GAOG;AACH,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,oBAAoB,CA+E/D,CAAA"}
|
package/dist/NodeWorkerRunner.js
CHANGED
|
@@ -2,40 +2,11 @@
|
|
|
2
2
|
* Node.js runtime support for workers that serve Effect worker requests.
|
|
3
3
|
*
|
|
4
4
|
* `NodeWorkerRunner` supplies the Node implementation of the Effect worker
|
|
5
|
-
* runner platform.
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* `WorkerRunner`,
|
|
9
|
-
*
|
|
10
|
-
* **Mental model**
|
|
11
|
-
*
|
|
12
|
-
* - The parent process creates a worker with the Node worker APIs.
|
|
13
|
-
* - The worker process provides this module's {@link layer} to its runner program.
|
|
14
|
-
* - Startup sends a ready message to the parent, then request messages are
|
|
15
|
-
* dispatched to the registered Effect handler.
|
|
16
|
-
* - Responses are sent with Node `postMessage` for worker threads or
|
|
17
|
-
* `process.send` for child processes.
|
|
18
|
-
* - Shutdown is initiated by the parent protocol and closes or unreferences the
|
|
19
|
-
* parent channel.
|
|
20
|
-
*
|
|
21
|
-
* **Common tasks**
|
|
22
|
-
*
|
|
23
|
-
* - Provide {@link layer} in the worker entrypoint before running `WorkerRunner`.
|
|
24
|
-
* - Host CPU-bound work or isolated Node resources behind the Effect worker protocol.
|
|
25
|
-
* - Return transferable values when using `worker_threads`.
|
|
26
|
-
*
|
|
27
|
-
* **Gotchas**
|
|
28
|
-
*
|
|
29
|
-
* - The runner must start inside an actual worker context; otherwise the layer
|
|
30
|
-
* fails because neither `parentPort` nor `process.send` is available.
|
|
31
|
-
* - Transfer lists only apply to `worker_threads`; child-process IPC uses Node
|
|
32
|
-
* serialization.
|
|
33
|
-
* - Long-running handlers should remain interruptible and keep cleanup in
|
|
34
|
-
* scopes so parent-driven shutdown can release resources.
|
|
35
|
-
*
|
|
36
|
-
* **See also**
|
|
37
|
-
*
|
|
38
|
-
* - {@link layer} for the Node worker runner platform.
|
|
5
|
+
* runner platform. The exported `layer` runs inside a `node:worker_threads`
|
|
6
|
+
* worker through `parentPort`, or inside a child process through
|
|
7
|
+
* `process.send`. It listens for parent messages, runs handlers registered with
|
|
8
|
+
* `WorkerRunner`, sends replies over the same channel, and closes when the
|
|
9
|
+
* parent sends the close message.
|
|
39
10
|
*
|
|
40
11
|
* @since 4.0.0
|
|
41
12
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeWorkerRunner.js","names":["Cause","Deferred","Effect","Exit","Fiber","Layer","WorkerError","WorkerReceiveError","WorkerSpawnError","WorkerRunner","WorkerThreads","layer","succeed","WorkerRunnerPlatform","start","gen","parentPort","process","send","reason","message","sendUnsafe","_portId","transfers","postMessage","_transfers","sync","run","handler","scopedWith","fnUntraced","scope","closeLatch","makeUnsafe","trackFiber","runIn","services","context","runFork","runForkWith","onExit","exit","_tag","hasInterruptsOnly","cause","logError","on","result","isEffect","fiber","addObserver","close","channel","unref","doneUnsafe","void","await"],"sources":["../src/NodeWorkerRunner.ts"],"sourcesContent":[null],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"NodeWorkerRunner.js","names":["Cause","Deferred","Effect","Exit","Fiber","Layer","WorkerError","WorkerReceiveError","WorkerSpawnError","WorkerRunner","WorkerThreads","layer","succeed","WorkerRunnerPlatform","start","gen","parentPort","process","send","reason","message","sendUnsafe","_portId","transfers","postMessage","_transfers","sync","run","handler","scopedWith","fnUntraced","scope","closeLatch","makeUnsafe","trackFiber","runIn","services","context","runFork","runForkWith","onExit","exit","_tag","hasInterruptsOnly","cause","logError","on","result","isEffect","fiber","addObserver","close","channel","unref","doneUnsafe","void","await"],"sources":["../src/NodeWorkerRunner.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;AAYA,OAAO,KAAKA,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,QAAQ,MAAM,iBAAiB;AAC3C,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,IAAI,MAAM,aAAa;AACnC,OAAO,KAAKC,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,KAAK,MAAM,cAAc;AACrC,SAASC,WAAW,EAAEC,kBAAkB,EAAEC,gBAAgB,QAAQ,qCAAqC;AACvG,OAAO,KAAKC,YAAY,MAAM,sCAAsC;AACpE,OAAO,KAAKC,aAAa,MAAM,qBAAqB;AAEpD;;;;;;;;AAQA,OAAO,MAAMC,KAAK,gBAAmDN,KAAK,CAACO,OAAO,CAACH,YAAY,CAACI,oBAAoB,CAAC,CAAC;EACpHC,KAAKA,CAAA;IACH,OAAOZ,MAAM,CAACa,GAAG,CAAC,aAAS;MACzB,IAAI,CAACL,aAAa,CAACM,UAAU,IAAI,CAACC,OAAO,CAACC,IAAI,EAAE;QAC9C,OAAO,OAAO,IAAIZ,WAAW,CAAC;UAC5Ba,MAAM,EAAE,IAAIX,gBAAgB,CAAC;YAAEY,OAAO,EAAE;UAAiB,CAAE;SAC5D,CAAC;MACJ;MAEA,MAAMC,UAAU,GAAGX,aAAa,CAACM,UAAU,GAC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MAAU,CAAE;IAClC,CAAC,CAAC;EACJ;CACD,CAAC","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effect/platform-node",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.0.0-beta.
|
|
4
|
+
"version": "4.0.0-beta.79",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Platform specific implementations for the Node.js runtime",
|
|
7
7
|
"homepage": "https://effect.website",
|
|
@@ -50,18 +50,18 @@
|
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"mime": "^4.1.0",
|
|
52
52
|
"undici": "^8.2.0",
|
|
53
|
-
"@effect/platform-node-shared": "^4.0.0-beta.
|
|
53
|
+
"@effect/platform-node-shared": "^4.0.0-beta.79"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"ioredis": "^5.7.0",
|
|
57
|
-
"effect": "^4.0.0-beta.
|
|
57
|
+
"effect": "^4.0.0-beta.79"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@testcontainers/mysql": "^11.14.0",
|
|
61
61
|
"@testcontainers/postgresql": "^11.14.0",
|
|
62
62
|
"@testcontainers/redis": "^11.14.0",
|
|
63
63
|
"@types/node": "^25.7.0",
|
|
64
|
-
"effect": "^4.0.0-beta.
|
|
64
|
+
"effect": "^4.0.0-beta.79"
|
|
65
65
|
},
|
|
66
66
|
"scripts": {
|
|
67
67
|
"codegen": "effect-utils codegen",
|
package/src/NodeClusterHttp.ts
CHANGED
|
@@ -1,36 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* transports for Effect Cluster runners. It wires `HttpRunner` to the Node HTTP
|
|
4
|
-
* server, supplies Undici and WebSocket client protocols, and builds a complete
|
|
5
|
-
* sharding layer with serialization, runner health, runner storage, and message
|
|
6
|
-
* storage.
|
|
2
|
+
* Node.js HTTP and WebSocket layers for Effect Cluster runners.
|
|
7
3
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* - Use SQL-backed storage for durable multi-process clusters, `local` storage
|
|
15
|
-
* for short-lived development, or `byo` storage when the deployment owns the
|
|
16
|
-
* persistence boundary
|
|
17
|
-
* - Check runner health with protocol pings or Kubernetes pod readiness through
|
|
18
|
-
* {@link layerK8sHttpClient}
|
|
19
|
-
*
|
|
20
|
-
* **Gotchas**
|
|
21
|
-
*
|
|
22
|
-
* - `runnerAddress` is the host and port advertised to other runners; set
|
|
23
|
-
* `runnerListenAddress` when the local bind address differs from the
|
|
24
|
-
* externally reachable address
|
|
25
|
-
* - The HTTP and WebSocket transports serve runner RPCs at the default
|
|
26
|
-
* `HttpRunner` route, so proxies and load balancers must preserve the path
|
|
27
|
-
* and allow WebSocket upgrades when `transport` is `"websocket"`
|
|
28
|
-
* - `clientOnly` does not start an HTTP server or receive shard assignments
|
|
29
|
-
* - SQL storage is the default; `local` storage is in-memory/noop and `byo`
|
|
30
|
-
* requires the surrounding application to provide both runner and message
|
|
31
|
-
* storage services
|
|
32
|
-
* - Ping health checks use the selected transport and serialization, so route,
|
|
33
|
-
* port, proxy, or codec mismatches can make a runner appear unhealthy
|
|
4
|
+
* The main `layer` builds a sharding layer for HTTP or WebSocket transport,
|
|
5
|
+
* choosing serialization, runner health checks, runner storage, message
|
|
6
|
+
* storage, and optional client-only mode from the supplied options.
|
|
7
|
+
* `layerHttpServer` provides the Node HTTP server used by cluster runners, and
|
|
8
|
+
* this module re-exports the Kubernetes HTTP client layer used by runner health
|
|
9
|
+
* checks.
|
|
34
10
|
*
|
|
35
11
|
* @since 4.0.0
|
|
36
12
|
*/
|
package/src/NodeClusterSocket.ts
CHANGED
|
@@ -1,32 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* Effect Cluster runners. It wires `SocketRunner` to Node TCP sockets, supplies
|
|
4
|
-
* RPC client and server protocol layers, and builds a complete sharding layer
|
|
5
|
-
* with serialization, runner health, runner storage, and message storage.
|
|
2
|
+
* Node.js socket layers for Effect Cluster runners.
|
|
6
3
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* -
|
|
10
|
-
*
|
|
11
|
-
* -
|
|
12
|
-
*
|
|
13
|
-
* - Use SQL-backed storage for durable multi-process clusters, `local` storage
|
|
14
|
-
* for short-lived development, or `byo` storage when the deployment owns the
|
|
15
|
-
* persistence boundary
|
|
16
|
-
* - Check runner health with socket pings or Kubernetes pod readiness through
|
|
17
|
-
* {@link layerK8sHttpClient}
|
|
18
|
-
*
|
|
19
|
-
* **Gotchas**
|
|
20
|
-
*
|
|
21
|
-
* - `runnerAddress` is the host and port advertised to other runners; set
|
|
22
|
-
* `runnerListenAddress` when the local bind address differs from the
|
|
23
|
-
* externally reachable address
|
|
24
|
-
* - The socket transport is point-to-point RPC, not cluster gossip: runner
|
|
25
|
-
* membership, shard ownership, and persisted delivery are coordinated through
|
|
26
|
-
* `RunnerStorage`, `MessageStorage`, and `RunnerHealth`
|
|
27
|
-
* - `clientOnly` does not start a socket server or receive shard assignments
|
|
28
|
-
* - Ping health checks use the same socket protocol, so unreachable ports,
|
|
29
|
-
* firewalls, or serialization mismatches can make a runner appear unhealthy
|
|
4
|
+
* The main `layer` builds a sharding layer for socket transport, choosing
|
|
5
|
+
* serialization, runner health checks, runner storage, message storage, and
|
|
6
|
+
* optional client-only mode from the supplied options. This module also
|
|
7
|
+
* re-exports the shared socket client and server protocol layers, and provides
|
|
8
|
+
* Kubernetes-aware Undici dispatcher and HTTP client layers for runner health
|
|
9
|
+
* checks.
|
|
30
10
|
*
|
|
31
11
|
* @since 4.0.0
|
|
32
12
|
*/
|
package/src/NodeFileSystem.ts
CHANGED
|
@@ -6,24 +6,6 @@
|
|
|
6
6
|
* links, temporary paths, and path watching. Effects still call the service from
|
|
7
7
|
* `effect/FileSystem`; this module only chooses the Node implementation.
|
|
8
8
|
*
|
|
9
|
-
* **Mental model**
|
|
10
|
-
*
|
|
11
|
-
* Provide `NodeFileSystem.layer` at the process boundary when filesystem
|
|
12
|
-
* effects should touch the host filesystem. Use `NodeServices.layer` instead
|
|
13
|
-
* when the same program also needs the standard Node path, stdio, terminal,
|
|
14
|
-
* crypto, and child process services. Tests that need isolation can provide a
|
|
15
|
-
* different `FileSystem` layer without changing the code that performs the
|
|
16
|
-
* reads and writes.
|
|
17
|
-
*
|
|
18
|
-
* **Gotchas**
|
|
19
|
-
*
|
|
20
|
-
* Paths are interpreted by Node, so relative paths resolve against the current
|
|
21
|
-
* working directory and platform-specific path rules apply. Filesystem failures
|
|
22
|
-
* are reported through Effect platform errors rather than thrown exceptions.
|
|
23
|
-
* File watching uses `FileSystem.WatchBackend` when one is available; otherwise
|
|
24
|
-
* it follows `node:fs.watch`, whose recursive support, event batching, and
|
|
25
|
-
* reported path names vary across operating systems.
|
|
26
|
-
*
|
|
27
9
|
* @since 4.0.0
|
|
28
10
|
*/
|
|
29
11
|
import * as NodeFileSystem from "@effect/platform-node-shared/NodeFileSystem"
|
package/src/NodeHttpClient.ts
CHANGED
|
@@ -2,37 +2,10 @@
|
|
|
2
2
|
* Node.js implementations of the Effect `HttpClient`.
|
|
3
3
|
*
|
|
4
4
|
* This module supplies Node runtime backends for the platform-independent
|
|
5
|
-
* Effect HTTP client API. It re-exports the fetch-based
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* **Mental model**
|
|
10
|
-
*
|
|
11
|
-
* All backends provide the same `HttpClient` service, so application code can
|
|
12
|
-
* depend on the Effect HTTP client interface while the layer chooses the Node
|
|
13
|
-
* implementation. The difference is where request execution and connection
|
|
14
|
-
* ownership live: fetch uses `globalThis.fetch`, Undici sends through a
|
|
15
|
-
* `Dispatcher`, and the `node:http` backend sends through scoped HTTP and HTTPS
|
|
16
|
-
* agents.
|
|
17
|
-
*
|
|
18
|
-
* **Common tasks**
|
|
19
|
-
*
|
|
20
|
-
* Use `layerFetch` when the built-in fetch implementation is enough. Use
|
|
21
|
-
* `layerUndici` for a scoped Undici `Agent`, or `layerUndiciNoDispatcher` when
|
|
22
|
-
* the caller provides the `Dispatcher` service, including the process-global
|
|
23
|
-
* dispatcher from `dispatcherLayerGlobal`. Use `layerNodeHttp` or
|
|
24
|
-
* `layerAgentOptions` when TLS, proxy, keep-alive, socket, or other native
|
|
25
|
-
* Node agent options must be configured directly.
|
|
26
|
-
*
|
|
27
|
-
* **Gotchas**
|
|
28
|
-
*
|
|
29
|
-
* Fetch, Undici, and `node:http` are not exact substitutes. They differ in
|
|
30
|
-
* dispatcher and agent hooks, request body support, abort behavior, upgrade
|
|
31
|
-
* support, and response body readers. Scoped layers destroy the agents or
|
|
32
|
-
* dispatchers they create when the layer scope ends; `dispatcherLayerGlobal`
|
|
33
|
-
* intentionally does not own or destroy Undici's process-global dispatcher.
|
|
34
|
-
* Body read failures are reported as `HttpClientError` decode or transport
|
|
35
|
-
* errors.
|
|
5
|
+
* Effect HTTP client API. It re-exports the fetch-based `Fetch`, `RequestInit`,
|
|
6
|
+
* and `layerFetch` APIs, defines an Undici-backed client with dispatcher
|
|
7
|
+
* services and request options, and defines a lower-level `node:http` /
|
|
8
|
+
* `node:https` client with scoped HTTP agent layers.
|
|
36
9
|
*
|
|
37
10
|
* @since 4.0.0
|
|
38
11
|
*/
|
|
@@ -9,21 +9,6 @@
|
|
|
9
9
|
* typed headers, remote address lookup, stream access, and text, JSON,
|
|
10
10
|
* URL-encoded, and array-buffer body readers.
|
|
11
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
12
|
* @since 4.0.0
|
|
28
13
|
*/
|
|
29
14
|
import * as Effect from "effect/Effect"
|
package/src/NodeHttpPlatform.ts
CHANGED
|
@@ -2,23 +2,9 @@
|
|
|
2
2
|
* Node.js implementation of the Effect HTTP platform service.
|
|
3
3
|
*
|
|
4
4
|
* This module connects the portable `HttpPlatform` file response helpers to
|
|
5
|
-
* Node runtime primitives. It
|
|
6
|
-
*
|
|
7
|
-
*
|
|
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.
|
|
5
|
+
* Node runtime primitives. It serves local files through Node readable streams,
|
|
6
|
+
* supports byte ranges, converts Web `File` values to readable streams, and
|
|
7
|
+
* fills in content type and content length headers when needed.
|
|
22
8
|
*
|
|
23
9
|
* @since 4.0.0
|
|
24
10
|
*/
|
package/src/NodeHttpServer.ts
CHANGED
|
@@ -6,27 +6,9 @@
|
|
|
6
6
|
* `listen` options, converts `request` events into `HttpServerRequest` values,
|
|
7
7
|
* writes `HttpServerResponse` bodies through Node's `ServerResponse`, and
|
|
8
8
|
* handles `upgrade` events by exposing the upgraded socket through
|
|
9
|
-
* `HttpServerRequest.upgrade`.
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* or {@link layerConfig}, embedding request or upgrade handlers into an
|
|
13
|
-
* existing Node server with {@link makeHandler} and {@link makeUpgradeHandler},
|
|
14
|
-
* and using {@link layerTest} for integration tests that need an ephemeral
|
|
15
|
-
* listening port and a client pointed at it.
|
|
16
|
-
*
|
|
17
|
-
* Listen options are passed directly to Node, so host, port, backlog, and Unix
|
|
18
|
-
* socket path behavior follow `node:http`. The server begins listening when the
|
|
19
|
-
* `HttpServer` is acquired, and handlers are installed when `serve` is run.
|
|
20
|
-
* Request fibers are interrupted with `ClientAbort` when the client disconnects
|
|
21
|
-
* before a response finishes. WebSocket support only applies to Node `upgrade`
|
|
22
|
-
* requests, and ordinary HTTP requests fail if their application attempts to use
|
|
23
|
-
* `HttpServerRequest.upgrade`.
|
|
24
|
-
*
|
|
25
|
-
* Scope ownership is important: the server is closed when the acquiring scope
|
|
26
|
-
* finalizes, while each `serve` call installs its own request and upgrade
|
|
27
|
-
* listeners and removes them on finalization. Unless preemptive shutdown is
|
|
28
|
-
* disabled, finalizing a serve scope also starts a graceful server close, using
|
|
29
|
-
* the configured timeout or the default timeout.
|
|
9
|
+
* `HttpServerRequest.upgrade`. It also exports request and upgrade handler
|
|
10
|
+
* constructors plus layers for the server alone, HTTP support services, the
|
|
11
|
+
* combined server, configurable options, and tests.
|
|
30
12
|
*
|
|
31
13
|
* @since 4.0.0
|
|
32
14
|
*/
|
|
@@ -1,22 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Accessors for the Node.js objects
|
|
3
|
-
* `HttpServerRequest`.
|
|
4
|
-
*
|
|
5
|
-
* Use this module at interop boundaries when an Effect HTTP handler needs the
|
|
6
|
-
* original `http.IncomingMessage` or `http.ServerResponse` for APIs that are
|
|
7
|
-
* specific to Node, such as existing middleware, socket inspection, raw stream
|
|
8
|
-
* piping, or response customization that cannot be expressed with the portable
|
|
9
|
-
* `HttpServerRequest` and `HttpServerResponse` interfaces.
|
|
2
|
+
* Accessors for the Node.js objects behind an Effect HTTP server request.
|
|
10
3
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* also Node's one-shot readable stream, so avoid mixing raw stream consumption
|
|
15
|
-
* with Effect body, multipart, or stream helpers unless ownership of the body
|
|
16
|
-
* is clear. The returned response is the Node response owned by the platform
|
|
17
|
-
* server; writing to it directly bypasses the usual Effect response writer and
|
|
18
|
-
* must be coordinated carefully to avoid duplicate writes. Upgrade requests may
|
|
19
|
-
* create that response lazily when it is first requested.
|
|
4
|
+
* `toIncomingMessage` returns the underlying Node `http.IncomingMessage`.
|
|
5
|
+
* `toServerResponse` returns the underlying Node `http.ServerResponse`,
|
|
6
|
+
* evaluating the stored response thunk when the response was created lazily.
|
|
20
7
|
*
|
|
21
8
|
* @since 4.0.0
|
|
22
9
|
*/
|
package/src/NodeMultipart.ts
CHANGED
|
@@ -2,34 +2,11 @@
|
|
|
2
2
|
* Node.js multipart parsing for HTTP `multipart/form-data` request bodies.
|
|
3
3
|
*
|
|
4
4
|
* `NodeMultipart` adapts a Node `Readable` plus incoming HTTP headers into
|
|
5
|
-
* Effect's shared multipart model. It can expose form parts as a stream
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* **Mental model**
|
|
11
|
-
*
|
|
12
|
-
* Multipart request bodies are one-shot byte streams. {@link stream} parses the
|
|
13
|
-
* body as it arrives: fields are decoded to strings and file parts keep their
|
|
14
|
-
* underlying Node readable stream. {@link persisted} consumes the same kind of
|
|
15
|
-
* body, builds a `Multipart.Persisted` record, and ties temporary upload files
|
|
16
|
-
* to the surrounding `Scope`.
|
|
17
|
-
*
|
|
18
|
-
* **Common tasks**
|
|
19
|
-
*
|
|
20
|
-
* - Use {@link stream} when a route validates fields while piping file uploads
|
|
21
|
-
* to storage.
|
|
22
|
-
* - Use {@link persisted} when a route needs a complete form value with scoped
|
|
23
|
-
* temporary files.
|
|
24
|
-
* - Use {@link fileToReadable} when a downstream Node library expects a
|
|
25
|
-
* `Readable`.
|
|
26
|
-
*
|
|
27
|
-
* **Gotchas**
|
|
28
|
-
*
|
|
29
|
-
* Consume a request body with only one parser. File parts must be drained,
|
|
30
|
-
* piped, or persisted so the request can finish reading. `contentEffect` loads
|
|
31
|
-
* an uploaded file into memory, so reserve it for small files. Client-supplied
|
|
32
|
-
* filenames are metadata, not trusted filesystem paths.
|
|
5
|
+
* Effect's shared multipart model. It can expose form parts as a stream or
|
|
6
|
+
* collect a complete persisted form by writing file uploads to scoped temporary
|
|
7
|
+
* files through the current `FileSystem` and `Path` services. `fileToReadable`
|
|
8
|
+
* returns the underlying Node readable stream for file parts produced by this
|
|
9
|
+
* parser.
|
|
33
10
|
*
|
|
34
11
|
* @since 4.0.0
|
|
35
12
|
*/
|
package/src/NodePath.ts
CHANGED
|
@@ -1,30 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Node.js layers for Effect's `Path` service.
|
|
3
3
|
*
|
|
4
|
-
* This module
|
|
5
|
-
* platform-independent `Path` service
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* **Mental model**
|
|
10
|
-
*
|
|
11
|
-
* `Path` is a syntactic service: it manipulates strings and `file:` URLs. It
|
|
12
|
-
* does not read the filesystem, check permissions, or validate that paths
|
|
13
|
-
* exist. The selected layer decides which separator, drive-letter, UNC, and URL
|
|
14
|
-
* conversion rules are used.
|
|
15
|
-
*
|
|
16
|
-
* **Common tasks**
|
|
17
|
-
*
|
|
18
|
-
* Use `layer` for host-platform Node semantics, `layerPosix` for stable POSIX
|
|
19
|
-
* behavior, and `layerWin32` for stable Windows behavior. `NodeServices.layer`
|
|
20
|
-
* already includes `layer`, so import this module directly when a program wants
|
|
21
|
-
* only path support or a platform-specific variant.
|
|
22
|
-
*
|
|
23
|
-
* **Gotchas**
|
|
24
|
-
*
|
|
25
|
-
* Results that are correct on one platform may not be portable to another.
|
|
26
|
-
* `fromFileUrl` and `toFileUrl` use Node's `node:url` conversion rules and
|
|
27
|
-
* report invalid conversions as `BadArgument` failures.
|
|
4
|
+
* This module provides the default, POSIX, and Windows variants of the
|
|
5
|
+
* platform-independent `Path` service by reusing the shared Node path
|
|
6
|
+
* implementation. The provided path services include Node file URL conversion
|
|
7
|
+
* behavior.
|
|
28
8
|
*
|
|
29
9
|
* @since 4.0.0
|
|
30
10
|
*/
|
package/src/NodeRedis.ts
CHANGED
|
@@ -2,39 +2,10 @@
|
|
|
2
2
|
* Node.js Redis integration backed by `ioredis`.
|
|
3
3
|
*
|
|
4
4
|
* This module creates a scoped `ioredis` client and exposes it in two forms:
|
|
5
|
-
* the generic `Redis` service
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* **Mental model**
|
|
10
|
-
*
|
|
11
|
-
* - {@link layer} creates one `ioredis` client from explicit client options
|
|
12
|
-
* - {@link layerConfig} reads the same options from `Config`
|
|
13
|
-
* - Building the layer opens the client, and closing the layer scope calls
|
|
14
|
-
* `quit`
|
|
15
|
-
* - The generic `Redis` service sends command strings through `client.call`
|
|
16
|
-
* - {@link NodeRedis} exposes the raw client plus `use`, which maps promise
|
|
17
|
-
* failures into `RedisError`
|
|
18
|
-
*
|
|
19
|
-
* **Common tasks**
|
|
20
|
-
*
|
|
21
|
-
* - Provide Redis-backed persistence, persisted queues, or distributed rate
|
|
22
|
-
* limiting in Node.js
|
|
23
|
-
* - Configure connection, TLS, database, retry, and reconnect behavior with
|
|
24
|
-
* standard `ioredis` options
|
|
25
|
-
* - Run custom Redis commands through {@link NodeRedis} when the generic
|
|
26
|
-
* `Redis` service does not cover the command shape you need
|
|
27
|
-
*
|
|
28
|
-
* **Gotchas**
|
|
29
|
-
*
|
|
30
|
-
* - Install the layer at the lifetime you want for the connection; a short
|
|
31
|
-
* scope opens and closes a Redis client for that scope
|
|
32
|
-
* - Persistence and rate limiter stores create their own keys and Lua scripts
|
|
33
|
-
* on top of this service, so choose stable prefixes and store ids
|
|
34
|
-
* - Persisted values may fail to decode after schema changes; plan migrations
|
|
35
|
-
* or cleanup for long-lived Redis data
|
|
36
|
-
* - Avoid unbounded high-cardinality rate-limit keys unless another process or
|
|
37
|
-
* key policy bounds their lifetime
|
|
5
|
+
* the generic `Redis` service and the {@link NodeRedis} service for direct
|
|
6
|
+
* access to the underlying client. `layer` accepts ioredis options directly,
|
|
7
|
+
* while `layerConfig` reads them from Effect config. Both layers close the
|
|
8
|
+
* client when the layer scope ends.
|
|
38
9
|
*
|
|
39
10
|
* @since 4.0.0
|
|
40
11
|
*/
|