@effect/platform-node 0.0.0-snapshot-c0ae728e57df2c572ea803e1bb7121088cd67b49
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/Http/Platform/package.json +6 -0
- package/Http/Server/package.json +6 -0
- package/Http/ServerRequest/package.json +6 -0
- package/LICENSE +21 -0
- package/NodeCommandExecutor/package.json +6 -0
- package/NodeContext/package.json +6 -0
- package/NodeFileSystem/package.json +6 -0
- package/NodeHttpClient/package.json +6 -0
- package/NodeHttpServer/package.json +6 -0
- package/NodeKeyValueStore/package.json +6 -0
- package/NodePath/package.json +6 -0
- package/NodeRuntime/package.json +6 -0
- package/NodeSink/package.json +6 -0
- package/NodeStream/package.json +6 -0
- package/NodeTerminal/package.json +6 -0
- package/NodeWorker/package.json +6 -0
- package/NodeWorkerRunner/package.json +6 -0
- package/README.md +64 -0
- package/dist/cjs/Http/Platform.js +43 -0
- package/dist/cjs/Http/Platform.js.map +1 -0
- package/dist/cjs/Http/Server.js +58 -0
- package/dist/cjs/Http/Server.js.map +1 -0
- package/dist/cjs/Http/ServerRequest.js +38 -0
- package/dist/cjs/Http/ServerRequest.js.map +1 -0
- package/dist/cjs/NodeCommandExecutor.js +42 -0
- package/dist/cjs/NodeCommandExecutor.js.map +1 -0
- package/dist/cjs/NodeContext.js +48 -0
- package/dist/cjs/NodeContext.js.map +1 -0
- package/dist/cjs/NodeFileSystem.js +42 -0
- package/dist/cjs/NodeFileSystem.js.map +1 -0
- package/dist/cjs/NodeHttpClient.js +73 -0
- package/dist/cjs/NodeHttpClient.js.map +1 -0
- package/dist/cjs/NodeHttpServer.js +40 -0
- package/dist/cjs/NodeHttpServer.js.map +1 -0
- package/dist/cjs/NodeKeyValueStore.js +42 -0
- package/dist/cjs/NodeKeyValueStore.js.map +1 -0
- package/dist/cjs/NodePath.js +52 -0
- package/dist/cjs/NodePath.js.map +1 -0
- package/dist/cjs/NodeRuntime.js +42 -0
- package/dist/cjs/NodeRuntime.js.map +1 -0
- package/dist/cjs/NodeSink.js +17 -0
- package/dist/cjs/NodeSink.js.map +1 -0
- package/dist/cjs/NodeStream.js +17 -0
- package/dist/cjs/NodeStream.js.map +1 -0
- package/dist/cjs/NodeTerminal.js +47 -0
- package/dist/cjs/NodeTerminal.js.map +1 -0
- package/dist/cjs/NodeWorker.js +63 -0
- package/dist/cjs/NodeWorker.js.map +1 -0
- package/dist/cjs/NodeWorkerRunner.js +48 -0
- package/dist/cjs/NodeWorkerRunner.js.map +1 -0
- package/dist/cjs/index.js +58 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/internal/http/client.js +216 -0
- package/dist/cjs/internal/http/client.js.map +1 -0
- package/dist/cjs/internal/http/incomingMessage.js +91 -0
- package/dist/cjs/internal/http/incomingMessage.js.map +1 -0
- package/dist/cjs/internal/http/platform.js +77 -0
- package/dist/cjs/internal/http/platform.js.map +1 -0
- package/dist/cjs/internal/http/server.js +270 -0
- package/dist/cjs/internal/http/server.js.map +1 -0
- package/dist/cjs/internal/worker.js +89 -0
- package/dist/cjs/internal/worker.js.map +1 -0
- package/dist/cjs/internal/workerRunner.js +85 -0
- package/dist/cjs/internal/workerRunner.js.map +1 -0
- package/dist/dts/Http/Platform.d.ts +19 -0
- package/dist/dts/Http/Platform.d.ts.map +1 -0
- package/dist/dts/Http/Server.d.ts +50 -0
- package/dist/dts/Http/Server.d.ts.map +1 -0
- package/dist/dts/Http/ServerRequest.d.ts +12 -0
- package/dist/dts/Http/ServerRequest.d.ts.map +1 -0
- package/dist/dts/NodeCommandExecutor.d.ts +9 -0
- package/dist/dts/NodeCommandExecutor.d.ts.map +1 -0
- package/dist/dts/NodeContext.d.ts +17 -0
- package/dist/dts/NodeContext.d.ts.map +1 -0
- package/dist/dts/NodeFileSystem.d.ts +8 -0
- package/dist/dts/NodeFileSystem.d.ts.map +1 -0
- package/dist/dts/NodeHttpClient.d.ts +67 -0
- package/dist/dts/NodeHttpClient.d.ts.map +1 -0
- package/dist/dts/NodeHttpServer.d.ts +37 -0
- package/dist/dts/NodeHttpServer.d.ts.map +1 -0
- package/dist/dts/NodeKeyValueStore.d.ts +9 -0
- package/dist/dts/NodeKeyValueStore.d.ts.map +1 -0
- package/dist/dts/NodePath.d.ts +21 -0
- package/dist/dts/NodePath.d.ts.map +1 -0
- package/dist/dts/NodeRuntime.d.ts +7 -0
- package/dist/dts/NodeRuntime.d.ts.map +1 -0
- package/dist/dts/NodeSink.d.ts +8 -0
- package/dist/dts/NodeSink.d.ts.map +1 -0
- package/dist/dts/NodeStream.d.ts +8 -0
- package/dist/dts/NodeStream.d.ts.map +1 -0
- package/dist/dts/NodeTerminal.d.ts +15 -0
- package/dist/dts/NodeTerminal.d.ts.map +1 -0
- package/dist/dts/NodeWorker.d.ts +42 -0
- package/dist/dts/NodeWorker.d.ts.map +1 -0
- package/dist/dts/NodeWorkerRunner.d.ts +24 -0
- package/dist/dts/NodeWorkerRunner.d.ts.map +1 -0
- package/dist/dts/index.d.ts +53 -0
- package/dist/dts/index.d.ts.map +1 -0
- package/dist/dts/internal/http/client.d.ts +2 -0
- package/dist/dts/internal/http/client.d.ts.map +1 -0
- package/dist/dts/internal/http/incomingMessage.d.ts +2 -0
- package/dist/dts/internal/http/incomingMessage.d.ts.map +1 -0
- package/dist/dts/internal/http/platform.d.ts +2 -0
- package/dist/dts/internal/http/platform.d.ts.map +1 -0
- package/dist/dts/internal/http/server.d.ts +2 -0
- package/dist/dts/internal/http/server.d.ts.map +1 -0
- package/dist/dts/internal/worker.d.ts +2 -0
- package/dist/dts/internal/worker.d.ts.map +1 -0
- package/dist/dts/internal/workerRunner.d.ts +2 -0
- package/dist/dts/internal/workerRunner.d.ts.map +1 -0
- package/dist/esm/Http/Platform.js +12 -0
- package/dist/esm/Http/Platform.js.map +1 -0
- package/dist/esm/Http/Server.js +27 -0
- package/dist/esm/Http/Server.js.map +1 -0
- package/dist/esm/Http/ServerRequest.js +7 -0
- package/dist/esm/Http/ServerRequest.js.map +1 -0
- package/dist/esm/NodeCommandExecutor.js +10 -0
- package/dist/esm/NodeCommandExecutor.js.map +1 -0
- package/dist/esm/NodeContext.js +16 -0
- package/dist/esm/NodeContext.js.map +1 -0
- package/dist/esm/NodeFileSystem.js +10 -0
- package/dist/esm/NodeFileSystem.js.map +1 -0
- package/dist/esm/NodeHttpClient.js +42 -0
- package/dist/esm/NodeHttpClient.js.map +1 -0
- package/dist/esm/NodeHttpServer.js +37 -0
- package/dist/esm/NodeHttpServer.js.map +1 -0
- package/dist/esm/NodeKeyValueStore.js +10 -0
- package/dist/esm/NodeKeyValueStore.js.map +1 -0
- package/dist/esm/NodePath.js +20 -0
- package/dist/esm/NodePath.js.map +1 -0
- package/dist/esm/NodeRuntime.js +10 -0
- package/dist/esm/NodeRuntime.js.map +1 -0
- package/dist/esm/NodeSink.js +8 -0
- package/dist/esm/NodeSink.js.map +1 -0
- package/dist/esm/NodeStream.js +8 -0
- package/dist/esm/NodeStream.js.map +1 -0
- package/dist/esm/NodeTerminal.js +15 -0
- package/dist/esm/NodeTerminal.js.map +1 -0
- package/dist/esm/NodeWorker.js +32 -0
- package/dist/esm/NodeWorker.js.map +1 -0
- package/dist/esm/NodeWorkerRunner.js +17 -0
- package/dist/esm/NodeWorkerRunner.js.map +1 -0
- package/dist/esm/index.js +53 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/internal/http/client.js +183 -0
- package/dist/esm/internal/http/client.js.map +1 -0
- package/dist/esm/internal/http/incomingMessage.js +59 -0
- package/dist/esm/internal/http/incomingMessage.js.map +1 -0
- package/dist/esm/internal/http/platform.js +41 -0
- package/dist/esm/internal/http/platform.js.map +1 -0
- package/dist/esm/internal/http/server.js +233 -0
- package/dist/esm/internal/http/server.js.map +1 -0
- package/dist/esm/internal/worker.js +58 -0
- package/dist/esm/internal/worker.js.map +1 -0
- package/dist/esm/internal/workerRunner.js +52 -0
- package/dist/esm/internal/workerRunner.js.map +1 -0
- package/dist/esm/package.json +4 -0
- package/package.json +162 -0
- package/src/Http/Platform.ts +21 -0
- package/src/Http/Server.ts +86 -0
- package/src/Http/ServerRequest.ts +12 -0
- package/src/NodeCommandExecutor.ts +13 -0
- package/src/NodeContext.ts +40 -0
- package/src/NodeFileSystem.ts +12 -0
- package/src/NodeHttpClient.ts +76 -0
- package/src/NodeHttpServer.ts +38 -0
- package/src/NodeKeyValueStore.ts +15 -0
- package/src/NodePath.ts +25 -0
- package/src/NodeRuntime.ts +11 -0
- package/src/NodeSink.ts +8 -0
- package/src/NodeStream.ts +8 -0
- package/src/NodeTerminal.ts +20 -0
- package/src/NodeWorker.ts +58 -0
- package/src/NodeWorkerRunner.ts +38 -0
- package/src/index.ts +64 -0
- package/src/internal/http/client.ts +258 -0
- package/src/internal/http/incomingMessage.ts +81 -0
- package/src/internal/http/platform.ts +46 -0
- package/src/internal/http/server.ts +375 -0
- package/src/internal/worker.ts +74 -0
- package/src/internal/workerRunner.ts +74 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @since 1.0.0
|
|
3
|
+
*/
|
|
4
|
+
import type * as ServerRequest from "@effect/platform/Http/ServerRequest"
|
|
5
|
+
import type * as Http from "node:http"
|
|
6
|
+
import * as internal from "../internal/http/server.js"
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @category conversions
|
|
10
|
+
* @since 1.0.0
|
|
11
|
+
*/
|
|
12
|
+
export const toIncomingMessage: (self: ServerRequest.ServerRequest) => Http.IncomingMessage = internal.requestSource
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @since 1.0.0
|
|
3
|
+
*/
|
|
4
|
+
import * as NodeCommandExecutor from "@effect/platform-node-shared/NodeCommandExecutor"
|
|
5
|
+
import type { CommandExecutor } from "@effect/platform/CommandExecutor"
|
|
6
|
+
import type { FileSystem } from "@effect/platform/FileSystem"
|
|
7
|
+
import type { Layer } from "effect/Layer"
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @since 1.0.0
|
|
11
|
+
* @category layer
|
|
12
|
+
*/
|
|
13
|
+
export const layer: Layer<CommandExecutor, never, FileSystem> = NodeCommandExecutor.layer
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @since 1.0.0
|
|
3
|
+
*/
|
|
4
|
+
import * as NodeCommandExecutor from "@effect/platform-node-shared/NodeCommandExecutor"
|
|
5
|
+
import * as NodeFileSystem from "@effect/platform-node-shared/NodeFileSystem"
|
|
6
|
+
import * as NodePath from "@effect/platform-node-shared/NodePath"
|
|
7
|
+
import * as NodeTerminal from "@effect/platform-node-shared/NodeTerminal"
|
|
8
|
+
import type * as CommandExecutor from "@effect/platform/CommandExecutor"
|
|
9
|
+
import type * as FileSystem from "@effect/platform/FileSystem"
|
|
10
|
+
import type * as Path from "@effect/platform/Path"
|
|
11
|
+
import type * as Terminal from "@effect/platform/Terminal"
|
|
12
|
+
import type * as Worker from "@effect/platform/Worker"
|
|
13
|
+
import { pipe } from "effect/Function"
|
|
14
|
+
import * as Layer from "effect/Layer"
|
|
15
|
+
import * as NodeWorker from "./NodeWorker.js"
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @since 1.0.0
|
|
19
|
+
* @category models
|
|
20
|
+
*/
|
|
21
|
+
export type NodeContext =
|
|
22
|
+
| CommandExecutor.CommandExecutor
|
|
23
|
+
| FileSystem.FileSystem
|
|
24
|
+
| Path.Path
|
|
25
|
+
| Terminal.Terminal
|
|
26
|
+
| Worker.WorkerManager
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @since 1.0.0
|
|
30
|
+
* @category layer
|
|
31
|
+
*/
|
|
32
|
+
export const layer: Layer.Layer<NodeContext> = pipe(
|
|
33
|
+
Layer.mergeAll(
|
|
34
|
+
NodePath.layer,
|
|
35
|
+
NodeCommandExecutor.layer,
|
|
36
|
+
NodeTerminal.layer,
|
|
37
|
+
NodeWorker.layerManager
|
|
38
|
+
),
|
|
39
|
+
Layer.provideMerge(NodeFileSystem.layer)
|
|
40
|
+
)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @since 1.0.0
|
|
3
|
+
*/
|
|
4
|
+
import * as NodeFileSystem from "@effect/platform-node-shared/NodeFileSystem"
|
|
5
|
+
import type { FileSystem } from "@effect/platform/FileSystem"
|
|
6
|
+
import type { Layer } from "effect/Layer"
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @since 1.0.0
|
|
10
|
+
* @category layer
|
|
11
|
+
*/
|
|
12
|
+
export const layer: Layer<FileSystem> = NodeFileSystem.layer
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @since 1.0.0
|
|
3
|
+
*/
|
|
4
|
+
import type * as Client from "@effect/platform/Http/Client"
|
|
5
|
+
import type * as Context from "effect/Context"
|
|
6
|
+
import type * as Effect from "effect/Effect"
|
|
7
|
+
import type * as Layer from "effect/Layer"
|
|
8
|
+
import type * as Scope from "effect/Scope"
|
|
9
|
+
import type * as Http from "node:http"
|
|
10
|
+
import type * as Https from "node:https"
|
|
11
|
+
import * as internal from "./internal/http/client.js"
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @since 1.0.0
|
|
15
|
+
* @category agent
|
|
16
|
+
*/
|
|
17
|
+
export const HttpAgentTypeId: unique symbol = internal.HttpAgentTypeId
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @since 1.0.0
|
|
21
|
+
* @category agent
|
|
22
|
+
*/
|
|
23
|
+
export type HttpAgentTypeId = typeof HttpAgentTypeId
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @since 1.0.0
|
|
27
|
+
* @category agent
|
|
28
|
+
*/
|
|
29
|
+
export interface HttpAgent {
|
|
30
|
+
readonly [HttpAgentTypeId]: typeof HttpAgentTypeId
|
|
31
|
+
readonly http: Http.Agent
|
|
32
|
+
readonly https: Https.Agent
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @since 1.0.0
|
|
37
|
+
* @category agent
|
|
38
|
+
*/
|
|
39
|
+
export const HttpAgent: Context.Tag<HttpAgent, HttpAgent> = internal.HttpAgent
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @since 1.0.0
|
|
43
|
+
* @category agent
|
|
44
|
+
*/
|
|
45
|
+
export const makeAgent: (options?: Https.AgentOptions) => Effect.Effect<HttpAgent, never, Scope.Scope> =
|
|
46
|
+
internal.makeAgent
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* @since 1.0.0
|
|
50
|
+
* @category agent
|
|
51
|
+
*/
|
|
52
|
+
export const agentLayer: Layer.Layer<HttpAgent> = internal.agentLayer
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* @since 1.0.0
|
|
56
|
+
* @category agent
|
|
57
|
+
*/
|
|
58
|
+
export const makeAgentLayer: (options?: Https.AgentOptions) => Layer.Layer<HttpAgent> = internal.makeAgentLayer
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* @since 1.0.0
|
|
62
|
+
* @category constructors
|
|
63
|
+
*/
|
|
64
|
+
export const make: Effect.Effect<Client.Client.Default, never, HttpAgent> = internal.make
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* @since 1.0.0
|
|
68
|
+
* @category layers
|
|
69
|
+
*/
|
|
70
|
+
export const layer: Layer.Layer<Client.Client.Default> = internal.layer
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* @since 1.0.0
|
|
74
|
+
* @category layers
|
|
75
|
+
*/
|
|
76
|
+
export const layerWithoutAgent: Layer.Layer<Client.Client.Default, never, HttpAgent> = internal.layerWithoutAgent
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @since 1.0.0
|
|
3
|
+
*/
|
|
4
|
+
import * as etag from "@effect/platform-node-shared/Http/Etag"
|
|
5
|
+
import * as multipart from "@effect/platform-node-shared/Http/Multipart"
|
|
6
|
+
import * as server from "./Http/Server.js"
|
|
7
|
+
import * as request from "./Http/ServerRequest.js"
|
|
8
|
+
|
|
9
|
+
export {
|
|
10
|
+
/**
|
|
11
|
+
* @since 1.0.0
|
|
12
|
+
*
|
|
13
|
+
* - Docs: [Http/Etag](https://effect-ts.github.io/platform/platform-node-shared/Http/Etag.ts.html)
|
|
14
|
+
* - Module: `@effect/platform-node-shared/Http/Etag`
|
|
15
|
+
*/
|
|
16
|
+
etag,
|
|
17
|
+
/**
|
|
18
|
+
* @since 1.0.0
|
|
19
|
+
*
|
|
20
|
+
* - Docs: [Http/Multipart](https://effect-ts.github.io/platform/platform-node-shared/Http/Multipart.ts.html)
|
|
21
|
+
* - Module: `@effect/platform-node-shared/Http/Multipart`
|
|
22
|
+
*/
|
|
23
|
+
multipart,
|
|
24
|
+
/**
|
|
25
|
+
* @since 1.0.0
|
|
26
|
+
*
|
|
27
|
+
* - Docs: [Http/ServerRequest](https://effect-ts.github.io/platform/platform-node/Http/ServerRequest.ts.html)
|
|
28
|
+
* - Module: `@effect/platform-node/Http/ServerRequest`
|
|
29
|
+
*/
|
|
30
|
+
request,
|
|
31
|
+
/**
|
|
32
|
+
* @since 1.0.0
|
|
33
|
+
*
|
|
34
|
+
* - Docs: [Http/Server](https://effect-ts.github.io/platform/platform-node/Http/Server.ts.html)
|
|
35
|
+
* - Module: `@effect/platform-node/Http/Server`
|
|
36
|
+
*/
|
|
37
|
+
server
|
|
38
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @since 1.0.0
|
|
3
|
+
*/
|
|
4
|
+
import * as KVSN from "@effect/platform-node-shared/NodeKeyValueStore"
|
|
5
|
+
import type * as PlatformError from "@effect/platform/Error"
|
|
6
|
+
import type * as KeyValueStore from "@effect/platform/KeyValueStore"
|
|
7
|
+
import type * as Layer from "effect/Layer"
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @since 1.0.0
|
|
11
|
+
* @category layers
|
|
12
|
+
*/
|
|
13
|
+
export const layerFileSystem: (
|
|
14
|
+
directory: string
|
|
15
|
+
) => Layer.Layer<KeyValueStore.KeyValueStore, PlatformError.PlatformError> = KVSN.layerFileSystem
|
package/src/NodePath.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @since 1.0.0
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as NodePath from "@effect/platform-node-shared/NodePath"
|
|
6
|
+
import type { Path } from "@effect/platform/Path"
|
|
7
|
+
import type { Layer } from "effect/Layer"
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @since 1.0.0
|
|
11
|
+
* @category layer
|
|
12
|
+
*/
|
|
13
|
+
export const layer: Layer<Path> = NodePath.layer
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @since 1.0.0
|
|
17
|
+
* @category layer
|
|
18
|
+
*/
|
|
19
|
+
export const layerPosix: Layer<Path> = NodePath.layerPosix
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @since 1.0.0
|
|
23
|
+
* @category layer
|
|
24
|
+
*/
|
|
25
|
+
export const layerWin32: Layer<Path> = NodePath.layerWin32
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @since 1.0.0
|
|
3
|
+
*/
|
|
4
|
+
import * as NodeRuntime from "@effect/platform-node-shared/NodeRuntime"
|
|
5
|
+
import type { RunMain } from "@effect/platform/Runtime"
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @since 1.0.0
|
|
9
|
+
* @category runtime
|
|
10
|
+
*/
|
|
11
|
+
export const runMain: RunMain = NodeRuntime.runMain
|
package/src/NodeSink.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @since 1.0.0
|
|
3
|
+
*/
|
|
4
|
+
import * as NodeTerminal from "@effect/platform-node-shared/NodeTerminal"
|
|
5
|
+
import type { Terminal, UserInput } from "@effect/platform/Terminal"
|
|
6
|
+
import type { Effect } from "effect/Effect"
|
|
7
|
+
import type { Layer } from "effect/Layer"
|
|
8
|
+
import type { Scope } from "effect/Scope"
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @since 1.0.0
|
|
12
|
+
* @category constructors
|
|
13
|
+
*/
|
|
14
|
+
export const make: (shouldQuit?: (input: UserInput) => boolean) => Effect<Terminal, never, Scope> = NodeTerminal.make
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @since 1.0.0
|
|
18
|
+
* @category layer
|
|
19
|
+
*/
|
|
20
|
+
export const layer: Layer<Terminal> = NodeTerminal.layer
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @since 1.0.0
|
|
3
|
+
*/
|
|
4
|
+
import type * as Worker from "@effect/platform/Worker"
|
|
5
|
+
import type * as Schema from "@effect/schema/Schema"
|
|
6
|
+
import type * as Context from "effect/Context"
|
|
7
|
+
import type * as Effect from "effect/Effect"
|
|
8
|
+
import type * as Layer from "effect/Layer"
|
|
9
|
+
import type * as Scope from "effect/Scope"
|
|
10
|
+
import type * as WorkerThreads from "node:worker_threads"
|
|
11
|
+
import * as internal from "./internal/worker.js"
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @since 1.0.0
|
|
15
|
+
* @category constructors
|
|
16
|
+
*/
|
|
17
|
+
export const makePool: <I, E, O>(
|
|
18
|
+
options: Worker.WorkerPool.Options<I, WorkerThreads.Worker>
|
|
19
|
+
) => Effect.Effect<Worker.WorkerPool<I, E, O>, never, Worker.WorkerManager | Scope.Scope> = internal.makePool
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @since 1.0.0
|
|
23
|
+
* @category constructors
|
|
24
|
+
*/
|
|
25
|
+
export const makePoolLayer: <Tag, I, E, O>(
|
|
26
|
+
tag: Context.Tag<Tag, Worker.WorkerPool<I, E, O>>,
|
|
27
|
+
options: Worker.WorkerPool.Options<I, WorkerThreads.Worker>
|
|
28
|
+
) => Layer.Layer<Tag> = internal.makePoolLayer
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @since 1.0.0
|
|
32
|
+
* @category constructors
|
|
33
|
+
*/
|
|
34
|
+
export const makePoolSerialized: <I extends Schema.TaggedRequest.Any>(
|
|
35
|
+
options: Worker.SerializedWorkerPool.Options<I, WorkerThreads.Worker>
|
|
36
|
+
) => Effect.Effect<Worker.SerializedWorkerPool<I>, never, Worker.WorkerManager | Scope.Scope> =
|
|
37
|
+
internal.makePoolSerialized
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @since 1.0.0
|
|
41
|
+
* @category constructors
|
|
42
|
+
*/
|
|
43
|
+
export const makePoolSerializedLayer: <Tag, I extends Schema.TaggedRequest.Any>(
|
|
44
|
+
tag: Context.Tag<Tag, Worker.SerializedWorkerPool<I>>,
|
|
45
|
+
options: Worker.SerializedWorkerPool.Options<I, WorkerThreads.Worker>
|
|
46
|
+
) => Layer.Layer<Tag> = internal.makePoolSerializedLayer
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* @since 1.0.0
|
|
50
|
+
* @category layers
|
|
51
|
+
*/
|
|
52
|
+
export const layerManager: Layer.Layer<Worker.WorkerManager> = internal.layerManager
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* @since 1.0.0
|
|
56
|
+
* @category layers
|
|
57
|
+
*/
|
|
58
|
+
export const layerWorker: Layer.Layer<Worker.PlatformWorker> = internal.layerWorker
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @since 1.0.0
|
|
3
|
+
*/
|
|
4
|
+
import type { WorkerError } from "@effect/platform/WorkerError"
|
|
5
|
+
import type * as Runner from "@effect/platform/WorkerRunner"
|
|
6
|
+
import type * as Schema from "@effect/schema/Schema"
|
|
7
|
+
import type * as Layer from "effect/Layer"
|
|
8
|
+
import type * as Stream from "effect/Stream"
|
|
9
|
+
import * as internal from "./internal/workerRunner.js"
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @since 1.0.0
|
|
13
|
+
* @category layers
|
|
14
|
+
*/
|
|
15
|
+
export const layerPlatform: Layer.Layer<Runner.PlatformRunner> = internal.layerPlatform
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @since 1.0.0
|
|
19
|
+
* @category layers
|
|
20
|
+
*/
|
|
21
|
+
export const layer: <I, R, E, O>(
|
|
22
|
+
process: (request: I) => Stream.Stream<O, E, R>,
|
|
23
|
+
options?: Runner.Runner.Options<I, E, O> | undefined
|
|
24
|
+
) => Layer.Layer<never, WorkerError, R> = internal.layer
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @since 1.0.0
|
|
28
|
+
* @category layers
|
|
29
|
+
*/
|
|
30
|
+
export const layerSerialized: <
|
|
31
|
+
A extends Schema.TaggedRequest.Any,
|
|
32
|
+
I,
|
|
33
|
+
R,
|
|
34
|
+
Handlers extends Runner.SerializedRunner.Handlers<A>
|
|
35
|
+
>(
|
|
36
|
+
schema: Schema.Schema<A, I, R>,
|
|
37
|
+
handlers: Handlers
|
|
38
|
+
) => Layer.Layer<never, WorkerError, R | Runner.SerializedRunner.HandlersContext<Handlers>> = internal.layerSerialized
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @since 1.0.0
|
|
3
|
+
*/
|
|
4
|
+
export * as NodeCommandExecutor from "./NodeCommandExecutor.js"
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @since 1.0.0
|
|
8
|
+
*/
|
|
9
|
+
export * as NodeContext from "./NodeContext.js"
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @since 1.0.0
|
|
13
|
+
*/
|
|
14
|
+
export * as NodeFileSystem from "./NodeFileSystem.js"
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @since 1.0.0
|
|
18
|
+
*/
|
|
19
|
+
export * as NodeHttpClient from "./NodeHttpClient.js"
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @since 1.0.0
|
|
23
|
+
*/
|
|
24
|
+
export * as NodeHttpServer from "./NodeHttpServer.js"
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @since 1.0.0
|
|
28
|
+
*/
|
|
29
|
+
export * as NodeKeyValueStore from "./NodeKeyValueStore.js"
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @since 1.0.0
|
|
33
|
+
*/
|
|
34
|
+
export * as NodePath from "./NodePath.js"
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @since 1.0.0
|
|
38
|
+
*/
|
|
39
|
+
export * as NodeRuntime from "./NodeRuntime.js"
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @since 1.0.0
|
|
43
|
+
*/
|
|
44
|
+
export * as NodeSink from "./NodeSink.js"
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* @since 1.0.0
|
|
48
|
+
*/
|
|
49
|
+
export * as NodeStream from "./NodeStream.js"
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* @since 1.0.0
|
|
53
|
+
*/
|
|
54
|
+
export * as NodeTerminal from "./NodeTerminal.js"
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* @since 1.0.0
|
|
58
|
+
*/
|
|
59
|
+
export * as NodeWorker from "./NodeWorker.js"
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* @since 1.0.0
|
|
63
|
+
*/
|
|
64
|
+
export * as NodeWorkerRunner from "./NodeWorkerRunner.js"
|