the-moby-effect 1.48.0 → 1.48.2
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/cjs/Callbacks.js.map +1 -1
- package/dist/cjs/DindEngine.js.map +1 -1
- package/dist/cjs/DockerEngine.js +1 -1
- package/dist/cjs/DockerEngine.js.map +1 -1
- package/dist/cjs/MobyConnection.js.map +1 -1
- package/dist/cjs/MobyDemux.js +301 -66
- package/dist/cjs/MobyDemux.js.map +1 -1
- package/dist/cjs/MobyPlatforms.js +3 -3
- package/dist/cjs/MobyPlatforms.js.map +1 -1
- package/dist/cjs/internal/convey/sinks.js.map +1 -1
- package/dist/cjs/internal/demux/compressed.js +1 -4
- package/dist/cjs/internal/demux/compressed.js.map +1 -1
- package/dist/cjs/internal/demux/demux.js.map +1 -1
- package/dist/cjs/internal/demux/fan.js +1 -4
- package/dist/cjs/internal/demux/fan.js.map +1 -1
- package/dist/cjs/internal/demux/hijack.js +4 -44
- package/dist/cjs/internal/demux/hijack.js.map +1 -1
- package/dist/cjs/internal/demux/multiplexed.js +22 -97
- package/dist/cjs/internal/demux/multiplexed.js.map +1 -1
- package/dist/cjs/internal/demux/pack.js +1 -4
- package/dist/cjs/internal/demux/pack.js.map +1 -1
- package/dist/cjs/internal/demux/raw.js +27 -115
- package/dist/cjs/internal/demux/raw.js.map +1 -1
- package/dist/cjs/internal/demux/stdio.js +2 -30
- package/dist/cjs/internal/demux/stdio.js.map +1 -1
- package/dist/cjs/internal/endpoints/configs.js.map +1 -1
- package/dist/cjs/internal/endpoints/containers.js +3 -4
- package/dist/cjs/internal/endpoints/containers.js.map +1 -1
- package/dist/cjs/internal/endpoints/distribution.js.map +1 -1
- package/dist/cjs/internal/endpoints/execs.js +2 -2
- package/dist/cjs/internal/endpoints/execs.js.map +1 -1
- package/dist/cjs/internal/endpoints/images.js.map +1 -1
- package/dist/cjs/internal/endpoints/networks.js.map +1 -1
- package/dist/cjs/internal/endpoints/nodes.js.map +1 -1
- package/dist/cjs/internal/endpoints/plugins.js.map +1 -1
- package/dist/cjs/internal/endpoints/secrets.js.map +1 -1
- package/dist/cjs/internal/endpoints/services.js.map +1 -1
- package/dist/cjs/internal/endpoints/session.js.map +1 -1
- package/dist/cjs/internal/endpoints/swarm.js.map +1 -1
- package/dist/cjs/internal/endpoints/system.js.map +1 -1
- package/dist/cjs/internal/endpoints/tasks.js.map +1 -1
- package/dist/cjs/internal/endpoints/volumes.js.map +1 -1
- package/dist/cjs/internal/engines/dind.js.map +1 -1
- package/dist/cjs/internal/engines/docker.js +32 -36
- package/dist/cjs/internal/engines/docker.js.map +1 -1
- package/dist/cjs/internal/engines/dockerCompose.js +1 -1
- package/dist/cjs/internal/engines/dockerCompose.js.map +1 -1
- package/dist/cjs/internal/platforms/agnostic.js +6 -6
- package/dist/cjs/internal/platforms/agnostic.js.map +1 -1
- package/dist/cjs/internal/platforms/fetch.js +1 -1
- package/dist/cjs/internal/platforms/fetch.js.map +1 -1
- package/dist/cjs/internal/platforms/node.js +1 -1
- package/dist/cjs/internal/platforms/node.js.map +1 -1
- package/dist/cjs/internal/platforms/undici.js +1 -1
- package/dist/cjs/internal/platforms/undici.js.map +1 -1
- package/dist/cjs/internal/platforms/web.js +1 -1
- package/dist/cjs/internal/platforms/web.js.map +1 -1
- package/dist/cjs/internal/schemas/cidrBlock.js.map +1 -1
- package/dist/dts/Callbacks.d.ts +6 -6
- package/dist/dts/Callbacks.d.ts.map +1 -1
- package/dist/dts/DindEngine.d.ts +1 -1
- package/dist/dts/DindEngine.d.ts.map +1 -1
- package/dist/dts/DockerEngine.d.ts +14 -14
- package/dist/dts/DockerEngine.d.ts.map +1 -1
- package/dist/dts/MobyConnection.d.ts +3 -3
- package/dist/dts/MobyConnection.d.ts.map +1 -1
- package/dist/dts/MobyDemux.d.ts +631 -12
- package/dist/dts/MobyDemux.d.ts.map +1 -1
- package/dist/dts/MobyPlatforms.d.ts +3 -5
- package/dist/dts/MobyPlatforms.d.ts.map +1 -1
- package/dist/dts/Promises.d.ts +3 -3
- package/dist/dts/internal/blobs/constants.d.ts +5 -1
- package/dist/dts/internal/blobs/constants.d.ts.map +1 -1
- package/dist/dts/internal/demux/compressed.d.ts +1 -10
- package/dist/dts/internal/demux/compressed.d.ts.map +1 -1
- package/dist/dts/internal/demux/demux.d.ts +2 -3
- package/dist/dts/internal/demux/demux.d.ts.map +1 -1
- package/dist/dts/internal/demux/fan.d.ts +1 -25
- package/dist/dts/internal/demux/fan.d.ts.map +1 -1
- package/dist/dts/internal/demux/hijack.d.ts +1 -53
- package/dist/dts/internal/demux/hijack.d.ts.map +1 -1
- package/dist/dts/internal/demux/multiplexed.d.ts +1 -217
- package/dist/dts/internal/demux/multiplexed.d.ts.map +1 -1
- package/dist/dts/internal/demux/pack.d.ts +1 -16
- package/dist/dts/internal/demux/pack.d.ts.map +1 -1
- package/dist/dts/internal/demux/raw.d.ts +1 -364
- package/dist/dts/internal/demux/raw.d.ts.map +1 -1
- package/dist/dts/internal/demux/stdio.d.ts +0 -44
- package/dist/dts/internal/demux/stdio.d.ts.map +1 -1
- package/dist/dts/internal/endpoints/configs.d.ts +4 -4
- package/dist/dts/internal/endpoints/configs.d.ts.map +1 -1
- package/dist/dts/internal/endpoints/containers.d.ts +7 -8
- package/dist/dts/internal/endpoints/containers.d.ts.map +1 -1
- package/dist/dts/internal/endpoints/distribution.d.ts +4 -4
- package/dist/dts/internal/endpoints/distribution.d.ts.map +1 -1
- package/dist/dts/internal/endpoints/execs.d.ts +7 -8
- package/dist/dts/internal/endpoints/execs.d.ts.map +1 -1
- package/dist/dts/internal/endpoints/images.d.ts +4 -4
- package/dist/dts/internal/endpoints/images.d.ts.map +1 -1
- package/dist/dts/internal/endpoints/networks.d.ts +4 -4
- package/dist/dts/internal/endpoints/networks.d.ts.map +1 -1
- package/dist/dts/internal/endpoints/nodes.d.ts +4 -4
- package/dist/dts/internal/endpoints/nodes.d.ts.map +1 -1
- package/dist/dts/internal/endpoints/plugins.d.ts +5 -5
- package/dist/dts/internal/endpoints/plugins.d.ts.map +1 -1
- package/dist/dts/internal/endpoints/secrets.d.ts +4 -4
- package/dist/dts/internal/endpoints/secrets.d.ts.map +1 -1
- package/dist/dts/internal/endpoints/services.d.ts +4 -4
- package/dist/dts/internal/endpoints/services.d.ts.map +1 -1
- package/dist/dts/internal/endpoints/session.d.ts +3 -3
- package/dist/dts/internal/endpoints/session.d.ts.map +1 -1
- package/dist/dts/internal/endpoints/swarm.d.ts +4 -4
- package/dist/dts/internal/endpoints/swarm.d.ts.map +1 -1
- package/dist/dts/internal/endpoints/system.d.ts +4 -4
- package/dist/dts/internal/endpoints/system.d.ts.map +1 -1
- package/dist/dts/internal/endpoints/tasks.d.ts +3 -3
- package/dist/dts/internal/endpoints/tasks.d.ts.map +1 -1
- package/dist/dts/internal/endpoints/volumes.d.ts +4 -4
- package/dist/dts/internal/endpoints/volumes.d.ts.map +1 -1
- package/dist/dts/internal/generated/ContainerCreateRequest.generated.d.ts +3 -3
- package/dist/dts/internal/generated/ContainerHostConfig.generated.d.ts +3 -3
- package/dist/dts/internal/generated/ContainerPathStat.generated.d.ts +2 -2
- package/dist/dts/internal/generated/PluginPrivilege.generated.d.ts +2 -2
- package/dist/dts/internal/generated/SystemRuntimeWithStatus.generated.d.ts +2 -2
- package/dist/dts/internal/schemas/cidrBlock.d.ts +2 -2
- package/dist/dts/internal/schemas/cidrBlock.d.ts.map +1 -1
- package/dist/esm/Callbacks.js.map +1 -1
- package/dist/esm/DindEngine.js.map +1 -1
- package/dist/esm/DockerEngine.js +1 -1
- package/dist/esm/DockerEngine.js.map +1 -1
- package/dist/esm/MobyConnection.js.map +1 -1
- package/dist/esm/MobyDemux.js +292 -12
- package/dist/esm/MobyDemux.js.map +1 -1
- package/dist/esm/MobyPlatforms.js +2 -3
- package/dist/esm/MobyPlatforms.js.map +1 -1
- package/dist/esm/internal/convey/sinks.js.map +1 -1
- package/dist/esm/internal/demux/compressed.js +1 -4
- package/dist/esm/internal/demux/compressed.js.map +1 -1
- package/dist/esm/internal/demux/demux.js.map +1 -1
- package/dist/esm/internal/demux/fan.js +1 -4
- package/dist/esm/internal/demux/fan.js.map +1 -1
- package/dist/esm/internal/demux/hijack.js +4 -44
- package/dist/esm/internal/demux/hijack.js.map +1 -1
- package/dist/esm/internal/demux/multiplexed.js +22 -97
- package/dist/esm/internal/demux/multiplexed.js.map +1 -1
- package/dist/esm/internal/demux/pack.js +1 -4
- package/dist/esm/internal/demux/pack.js.map +1 -1
- package/dist/esm/internal/demux/raw.js +24 -112
- package/dist/esm/internal/demux/raw.js.map +1 -1
- package/dist/esm/internal/demux/stdio.js +2 -30
- package/dist/esm/internal/demux/stdio.js.map +1 -1
- package/dist/esm/internal/endpoints/configs.js.map +1 -1
- package/dist/esm/internal/endpoints/containers.js +3 -4
- package/dist/esm/internal/endpoints/containers.js.map +1 -1
- package/dist/esm/internal/endpoints/distribution.js.map +1 -1
- package/dist/esm/internal/endpoints/execs.js +2 -2
- package/dist/esm/internal/endpoints/execs.js.map +1 -1
- package/dist/esm/internal/endpoints/images.js.map +1 -1
- package/dist/esm/internal/endpoints/networks.js.map +1 -1
- package/dist/esm/internal/endpoints/nodes.js.map +1 -1
- package/dist/esm/internal/endpoints/plugins.js.map +1 -1
- package/dist/esm/internal/endpoints/secrets.js.map +1 -1
- package/dist/esm/internal/endpoints/services.js.map +1 -1
- package/dist/esm/internal/endpoints/session.js.map +1 -1
- package/dist/esm/internal/endpoints/swarm.js.map +1 -1
- package/dist/esm/internal/endpoints/system.js.map +1 -1
- package/dist/esm/internal/endpoints/tasks.js.map +1 -1
- package/dist/esm/internal/endpoints/volumes.js.map +1 -1
- package/dist/esm/internal/engines/dind.js.map +1 -1
- package/dist/esm/internal/engines/docker.js +32 -36
- package/dist/esm/internal/engines/docker.js.map +1 -1
- package/dist/esm/internal/engines/dockerCompose.js +1 -1
- package/dist/esm/internal/engines/dockerCompose.js.map +1 -1
- package/dist/esm/internal/platforms/agnostic.js +3 -3
- package/dist/esm/internal/platforms/agnostic.js.map +1 -1
- package/dist/esm/internal/platforms/fetch.js +1 -1
- package/dist/esm/internal/platforms/fetch.js.map +1 -1
- package/dist/esm/internal/platforms/needs.js +1 -0
- package/dist/esm/internal/platforms/needs.js.map +1 -1
- package/dist/esm/internal/platforms/node.js +1 -1
- package/dist/esm/internal/platforms/node.js.map +1 -1
- package/dist/esm/internal/platforms/undici.js +1 -1
- package/dist/esm/internal/platforms/undici.js.map +1 -1
- package/dist/esm/internal/platforms/web.js +1 -1
- package/dist/esm/internal/platforms/web.js.map +1 -1
- package/dist/esm/internal/schemas/cidrBlock.js.map +1 -1
- package/package.json +23 -12
- package/src/Callbacks.ts +4 -4
- package/src/DindEngine.ts +1 -2
- package/src/DockerEngine.ts +25 -27
- package/src/MobyConnection.ts +3 -4
- package/src/MobyDemux.ts +749 -12
- package/src/MobyPlatforms.ts +11 -5
- package/src/internal/blobs/constants.ts +4 -1
- package/src/internal/convey/sinks.ts +1 -2
- package/src/internal/demux/compressed.ts +6 -19
- package/src/internal/demux/demux.ts +6 -10
- package/src/internal/demux/fan.ts +16 -25
- package/src/internal/demux/hijack.ts +11 -50
- package/src/internal/demux/multiplexed.ts +55 -205
- package/src/internal/demux/pack.ts +9 -16
- package/src/internal/demux/raw.ts +66 -336
- package/src/internal/demux/stdio.ts +7 -39
- package/src/internal/endpoints/configs.ts +5 -4
- package/src/internal/endpoints/containers.ts +10 -11
- package/src/internal/endpoints/distribution.ts +5 -4
- package/src/internal/endpoints/execs.ts +18 -11
- package/src/internal/endpoints/images.ts +5 -4
- package/src/internal/endpoints/networks.ts +5 -4
- package/src/internal/endpoints/nodes.ts +5 -4
- package/src/internal/endpoints/plugins.ts +6 -5
- package/src/internal/endpoints/secrets.ts +5 -4
- package/src/internal/endpoints/services.ts +5 -4
- package/src/internal/endpoints/session.ts +4 -3
- package/src/internal/endpoints/swarm.ts +5 -4
- package/src/internal/endpoints/system.ts +5 -4
- package/src/internal/endpoints/tasks.ts +4 -3
- package/src/internal/endpoints/volumes.ts +5 -4
- package/src/internal/engines/dind.ts +3 -4
- package/src/internal/engines/docker.ts +23 -32
- package/src/internal/engines/dockerCompose.ts +2 -2
- package/src/internal/platforms/agnostic.ts +3 -3
- package/src/internal/platforms/fetch.ts +1 -1
- package/src/internal/platforms/needs.ts +2 -0
- package/src/internal/platforms/node.ts +1 -1
- package/src/internal/platforms/undici.ts +1 -1
- package/src/internal/platforms/web.ts +1 -1
- package/src/internal/schemas/cidrBlock.ts +2 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type * as HttpClientResponse from "@effect/platform/HttpClientResponse";
|
|
2
2
|
import type * as Chunk from "effect/Chunk";
|
|
3
3
|
import type * as Scope from "effect/Scope";
|
|
4
|
+
import type * as MobyDemux from "../../MobyDemux.js";
|
|
4
5
|
|
|
5
6
|
import * as Socket from "@effect/platform/Socket";
|
|
6
7
|
import * as Channel from "effect/Channel";
|
|
@@ -11,289 +12,74 @@ import * as Predicate from "effect/Predicate";
|
|
|
11
12
|
import * as Sink from "effect/Sink";
|
|
12
13
|
import * as Stream from "effect/Stream";
|
|
13
14
|
import * as Tuple from "effect/Tuple";
|
|
15
|
+
import * as internalCompressed from "./compressed.js";
|
|
14
16
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @since 1.0.0
|
|
19
|
-
* @category Types
|
|
20
|
-
*/
|
|
17
|
+
/** @internal */
|
|
21
18
|
export const RawContentType = "application/vnd.docker.raw-stream" as const;
|
|
22
19
|
|
|
23
|
-
/**
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* @since 1.0.0
|
|
37
|
-
* @category Type ids
|
|
38
|
-
*/
|
|
39
|
-
export const RawChannelTypeId: unique symbol = Symbol.for("the-moby-effect/demux/RawChannel") as RawChannelTypeId;
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* @since 1.0.0
|
|
43
|
-
* @category Type ids
|
|
44
|
-
*/
|
|
45
|
-
export type RawChannelTypeId = typeof RawChannelTypeId;
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* When the TTY setting is enabled in POST /containers/create, the stream is not
|
|
49
|
-
* multiplexed. The data exchanged over the hijacked connection is simply the
|
|
50
|
-
* raw data from the process PTY and client's stdin.
|
|
51
|
-
*
|
|
52
|
-
* Note for Leo: This exists because the input error type "IE" might not be
|
|
53
|
-
* known at the time of converting the Socket to a Channel.
|
|
54
|
-
*
|
|
55
|
-
* @since 1.0.0
|
|
56
|
-
* @category Branded Types
|
|
57
|
-
*/
|
|
58
|
-
export interface RawSocket extends Pipeable.Pipeable {
|
|
59
|
-
readonly "content-type": typeof RawContentType;
|
|
60
|
-
readonly [RawSocketTypeId]: typeof RawSocketTypeId;
|
|
61
|
-
readonly underlying: Socket.Socket;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* When the TTY setting is enabled in POST /containers/create, the stream is not
|
|
66
|
-
* multiplexed. The data exchanged over the hijacked connection is simply the
|
|
67
|
-
* raw data from the process PTY and client's stdin.
|
|
68
|
-
*
|
|
69
|
-
* Note for Leo: This exists because there is no way to convert from a Channel
|
|
70
|
-
* to a Socket. In fact, with my current effect knowledge, I believe it is
|
|
71
|
-
* impossible to implement. This is still needed though for the pack and fan
|
|
72
|
-
* implementations which seek to return these types.
|
|
73
|
-
*
|
|
74
|
-
* @since 1.0.0
|
|
75
|
-
* @category Branded Types
|
|
76
|
-
*/
|
|
77
|
-
export interface RawChannel<IE = unknown, OE = Socket.SocketError, R = never> extends Pipeable.Pipeable {
|
|
78
|
-
readonly "content-type": typeof RawContentType;
|
|
79
|
-
readonly [RawChannelTypeId]: typeof RawChannelTypeId;
|
|
80
|
-
readonly underlying: Channel.Channel<
|
|
81
|
-
Chunk.Chunk<Uint8Array>,
|
|
82
|
-
Chunk.Chunk<string | Uint8Array | Socket.CloseEvent>,
|
|
83
|
-
IE | OE,
|
|
84
|
-
IE,
|
|
85
|
-
void,
|
|
86
|
-
unknown,
|
|
87
|
-
R
|
|
88
|
-
>;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* @since 1.0.0
|
|
93
|
-
* @category Types
|
|
94
|
-
*/
|
|
95
|
-
export type EitherRawInput<IE, OE, R> = RawSocket | RawChannel<IE, OE, R>;
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* @since 1.0.0
|
|
99
|
-
* @category Types
|
|
100
|
-
*/
|
|
101
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
102
|
-
export type AnyRawInput = EitherRawInput<any, any, any>;
|
|
103
|
-
/* eslint-enable @typescript-eslint/no-explicit-any */
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* @since 1.0.0
|
|
107
|
-
* @category Types
|
|
108
|
-
*/
|
|
109
|
-
export type HomogeneousStdioRawSocketInput =
|
|
110
|
-
| { stdin: RawSocket; stdout?: never; stderr?: never }
|
|
111
|
-
| { stdin?: never; stdout: RawSocket; stderr?: never }
|
|
112
|
-
| { stdin?: never; stdout?: never; stderr: RawSocket }
|
|
113
|
-
| { stdin: RawSocket; stdout: RawSocket; stderr?: never }
|
|
114
|
-
| { stdin: RawSocket; stdout?: never; stderr: RawSocket }
|
|
115
|
-
| { stdin?: never; stdout: RawSocket; stderr: RawSocket }
|
|
116
|
-
| { stdin: RawSocket; stdout: RawSocket; stderr: RawSocket };
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* @since 1.0.0
|
|
120
|
-
* @category Types
|
|
121
|
-
*/
|
|
122
|
-
export type HomogeneousStdioRawChannelInput<IE1, IE2, IE3, OE1, OE2, OE3, R1, R2, R3> =
|
|
123
|
-
| { stdin: RawChannel<IE1, OE1, R1>; stdout?: never; stderr?: never }
|
|
124
|
-
| { stdin?: never; stdout: RawChannel<IE2, OE2, R2>; stderr?: never }
|
|
125
|
-
| { stdin?: never; stdout?: never; stderr: RawChannel<IE3, OE3, R3> }
|
|
126
|
-
| { stdin: RawChannel<IE1, OE1, R1>; stdout: RawChannel<IE2, OE2, R2>; stderr?: never }
|
|
127
|
-
| { stdin: RawChannel<IE1, OE1, R1>; stdout?: never; stderr: RawChannel<IE3, OE3, R3> }
|
|
128
|
-
| { stdin?: never; stdout: RawChannel<IE2, OE2, R2>; stderr: RawChannel<IE3, OE3, R3> }
|
|
129
|
-
| { stdin: RawChannel<IE1, OE1, R1>; stdout: RawChannel<IE2, OE2, R2>; stderr: RawChannel<IE3, OE3, R3> };
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* @since 1.0.0
|
|
133
|
-
* @category Types
|
|
134
|
-
*/
|
|
135
|
-
export type HeterogeneousStdioRawInput<IE1, IE2, IE3, OE1, OE2, OE3, R1, R2, R3> =
|
|
136
|
-
| { stdin: EitherRawInput<IE1, OE1, R1>; stdout?: never; stderr?: never }
|
|
137
|
-
| { stdin?: never; stdout: EitherRawInput<IE2, OE2, R2>; stderr?: never }
|
|
138
|
-
| { stdin?: never; stdout?: never; stderr: EitherRawInput<IE3, OE3, R3> }
|
|
139
|
-
| { stdin: EitherRawInput<IE1, OE1, R1>; stdout: EitherRawInput<IE2, OE2, R2>; stderr?: never }
|
|
140
|
-
| { stdin: EitherRawInput<IE1, OE1, R1>; stdout?: never; stderr: EitherRawInput<IE3, OE3, R3> }
|
|
141
|
-
| { stdin?: never; stdout: EitherRawInput<IE2, OE2, R2>; stderr: EitherRawInput<IE3, OE3, R3> }
|
|
142
|
-
| {
|
|
143
|
-
stdin: EitherRawInput<IE1, OE1, R1>;
|
|
144
|
-
stdout: EitherRawInput<IE2, OE2, R2>;
|
|
145
|
-
stderr: EitherRawInput<IE3, OE3, R3>;
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* @since 1.0.0
|
|
150
|
-
* @category Types
|
|
151
|
-
*/
|
|
152
|
-
export type HeterogeneousStdioTupledRawInput<
|
|
153
|
-
A1,
|
|
154
|
-
A2,
|
|
155
|
-
L1,
|
|
156
|
-
L2,
|
|
157
|
-
E1,
|
|
158
|
-
E2,
|
|
159
|
-
E3,
|
|
160
|
-
R1,
|
|
161
|
-
R2,
|
|
162
|
-
R3,
|
|
163
|
-
IE1,
|
|
164
|
-
IE2,
|
|
165
|
-
IE3,
|
|
166
|
-
OE1,
|
|
167
|
-
OE2,
|
|
168
|
-
OE3,
|
|
169
|
-
R4,
|
|
170
|
-
R5,
|
|
171
|
-
R6,
|
|
172
|
-
> =
|
|
173
|
-
| {
|
|
174
|
-
stdin: readonly [
|
|
175
|
-
Stream.Stream<string | Uint8Array | Socket.CloseEvent, E1, R1>,
|
|
176
|
-
EitherRawInput<E1 | IE1, OE1, R4>,
|
|
177
|
-
];
|
|
178
|
-
stdout?: never;
|
|
179
|
-
stderr?: never;
|
|
180
|
-
}
|
|
181
|
-
| {
|
|
182
|
-
stdin?: never;
|
|
183
|
-
stdout: readonly [EitherRawInput<IE2, OE2, R5>, Sink.Sink<A1, string, L1, E2, R2>];
|
|
184
|
-
stderr?: never;
|
|
185
|
-
}
|
|
186
|
-
| {
|
|
187
|
-
stdin?: never;
|
|
188
|
-
stdout?: never;
|
|
189
|
-
stderr: readonly [EitherRawInput<IE3, OE3, R6>, Sink.Sink<A2, string, L2, E3, R3>];
|
|
190
|
-
}
|
|
191
|
-
| {
|
|
192
|
-
stdin: readonly [
|
|
193
|
-
Stream.Stream<string | Uint8Array | Socket.CloseEvent, E1, R1>,
|
|
194
|
-
EitherRawInput<E1 | IE1, OE1, R4>,
|
|
195
|
-
];
|
|
196
|
-
stdout: readonly [EitherRawInput<IE2, OE2, R5>, Sink.Sink<A1, string, L1, E2, R2>];
|
|
197
|
-
stderr?: never;
|
|
198
|
-
}
|
|
199
|
-
| {
|
|
200
|
-
stdin: readonly [
|
|
201
|
-
Stream.Stream<string | Uint8Array | Socket.CloseEvent, E1, R1>,
|
|
202
|
-
EitherRawInput<E1 | IE1, OE1, R4>,
|
|
203
|
-
];
|
|
204
|
-
stdout?: never;
|
|
205
|
-
stderr: readonly [EitherRawInput<IE3, OE3, R6>, Sink.Sink<A2, string, L2, E3, R3>];
|
|
206
|
-
}
|
|
207
|
-
| {
|
|
208
|
-
stdin?: never;
|
|
209
|
-
stdout: readonly [EitherRawInput<IE2, OE2, R5>, Sink.Sink<A1, string, L1, E2, R2>];
|
|
210
|
-
stderr: readonly [EitherRawInput<IE3, OE3, R6>, Sink.Sink<A2, string, L2, E3, R3>];
|
|
211
|
-
}
|
|
212
|
-
| {
|
|
213
|
-
stdin: readonly [
|
|
214
|
-
Stream.Stream<string | Uint8Array | Socket.CloseEvent, E1, R1>,
|
|
215
|
-
EitherRawInput<E1 | IE1, OE1, R4>,
|
|
216
|
-
];
|
|
217
|
-
stdout: readonly [EitherRawInput<IE2, OE2, R5>, Sink.Sink<A1, string, L1, E2, R2>];
|
|
218
|
-
stderr: readonly [EitherRawInput<IE3, OE3, R6>, Sink.Sink<A2, string, L2, E3, R3>];
|
|
219
|
-
};
|
|
220
|
-
|
|
221
|
-
/**
|
|
222
|
-
* @since 1.0.0
|
|
223
|
-
* @category Constructors
|
|
224
|
-
*/
|
|
225
|
-
export const makeRawSocket = (underlying: Socket.Socket): RawSocket => ({
|
|
20
|
+
/** @internal */
|
|
21
|
+
export const RawSocketTypeId: MobyDemux.RawSocketTypeId = Symbol.for(
|
|
22
|
+
"the-moby-effect/demux/RawSocket"
|
|
23
|
+
) as MobyDemux.RawSocketTypeId;
|
|
24
|
+
|
|
25
|
+
/** @internal */
|
|
26
|
+
export const RawChannelTypeId: MobyDemux.RawChannelTypeId = Symbol.for(
|
|
27
|
+
"the-moby-effect/demux/RawChannel"
|
|
28
|
+
) as MobyDemux.RawChannelTypeId;
|
|
29
|
+
|
|
30
|
+
/** @internal */
|
|
31
|
+
export const makeRawSocket = (underlying: Socket.Socket): MobyDemux.RawSocket => ({
|
|
226
32
|
underlying,
|
|
227
33
|
"content-type": RawContentType,
|
|
228
34
|
[RawSocketTypeId]: RawSocketTypeId,
|
|
229
35
|
pipe() {
|
|
230
|
-
// eslint-disable-next-line prefer-rest-params
|
|
231
36
|
return Pipeable.pipeArguments(this, arguments);
|
|
232
37
|
},
|
|
233
38
|
});
|
|
234
39
|
|
|
235
|
-
/**
|
|
236
|
-
* @since 1.0.0
|
|
237
|
-
* @category Constructors
|
|
238
|
-
*/
|
|
40
|
+
/** @internal */
|
|
239
41
|
export const makeRawChannel = <IE = unknown, OE = Socket.SocketError, R = never>(
|
|
240
42
|
underlying: Channel.Channel<
|
|
241
43
|
Chunk.Chunk<Uint8Array>,
|
|
242
44
|
Chunk.Chunk<string | Uint8Array | Socket.CloseEvent>,
|
|
243
|
-
|
|
45
|
+
OE,
|
|
244
46
|
IE,
|
|
245
47
|
void,
|
|
246
48
|
unknown,
|
|
247
49
|
R
|
|
248
50
|
>
|
|
249
|
-
): RawChannel<IE, OE, R> => ({
|
|
51
|
+
): MobyDemux.RawChannel<IE, IE | OE, R> => ({
|
|
250
52
|
underlying,
|
|
251
53
|
"content-type": RawContentType,
|
|
252
54
|
[RawChannelTypeId]: RawChannelTypeId,
|
|
253
55
|
pipe() {
|
|
254
|
-
// eslint-disable-next-line prefer-rest-params
|
|
255
56
|
return Pipeable.pipeArguments(this, arguments);
|
|
256
57
|
},
|
|
257
58
|
});
|
|
258
59
|
|
|
259
|
-
/**
|
|
260
|
-
|
|
261
|
-
* @category Predicates
|
|
262
|
-
*/
|
|
263
|
-
export const isRawSocket = (u: unknown): u is RawSocket => Predicate.hasProperty(u, RawSocketTypeId);
|
|
60
|
+
/** @internal */
|
|
61
|
+
export const isRawSocket = (u: unknown): u is MobyDemux.RawSocket => Predicate.hasProperty(u, RawSocketTypeId);
|
|
264
62
|
|
|
265
|
-
/**
|
|
266
|
-
* @since 1.0.0
|
|
267
|
-
* @category Predicates
|
|
268
|
-
*/
|
|
63
|
+
/** @internal */
|
|
269
64
|
export const isRawChannel = <IE = unknown, OE = Socket.SocketError, R = never>(
|
|
270
65
|
u: unknown
|
|
271
|
-
): u is RawChannel<IE, OE, R> => Predicate.hasProperty(u, RawChannelTypeId);
|
|
66
|
+
): u is MobyDemux.RawChannel<IE, IE | OE, R> => Predicate.hasProperty(u, RawChannelTypeId);
|
|
272
67
|
|
|
273
|
-
/**
|
|
274
|
-
* @since 1.0.0
|
|
275
|
-
* @category Predicates
|
|
276
|
-
*/
|
|
68
|
+
/** @internal */
|
|
277
69
|
export const responseIsRawResponse = (response: HttpClientResponse.HttpClientResponse): boolean =>
|
|
278
70
|
response.headers["content-type"] === RawContentType;
|
|
279
71
|
|
|
280
|
-
/**
|
|
281
|
-
* @since 1.0.0
|
|
282
|
-
* @category Conversions
|
|
283
|
-
*/
|
|
72
|
+
/** @internal */
|
|
284
73
|
export const asRawChannel = <IE = never, OE = Socket.SocketError, R = never>(
|
|
285
|
-
input: EitherRawInput<IE, OE, R>
|
|
286
|
-
): RawChannel<IE, OE, R> =>
|
|
74
|
+
input: MobyDemux.EitherRawInput<IE, OE, R>
|
|
75
|
+
): MobyDemux.RawChannel<IE, OE, R> =>
|
|
287
76
|
isRawSocket(input)
|
|
288
|
-
? (makeRawChannel(Socket.toChannel<IE>(input.underlying)) as unknown as RawChannel<IE, OE, R>)
|
|
289
|
-
: (input as RawChannel<IE, OE, R>);
|
|
77
|
+
? (makeRawChannel(Socket.toChannel<IE>(input.underlying)) as unknown as MobyDemux.RawChannel<IE, OE, R>)
|
|
78
|
+
: (input as MobyDemux.RawChannel<IE, OE, R>);
|
|
290
79
|
|
|
291
|
-
/**
|
|
292
|
-
* @since 1.0.0
|
|
293
|
-
* @category Conversions
|
|
294
|
-
*/
|
|
80
|
+
/** @internal */
|
|
295
81
|
export const rawToStream = <IE = never, OE = Socket.SocketError, R = never>(
|
|
296
|
-
input: EitherRawInput<IE, OE, R>
|
|
82
|
+
input: MobyDemux.EitherRawInput<IE, OE, R>
|
|
297
83
|
): Stream.Stream<Uint8Array, IE | OE, R> =>
|
|
298
84
|
Channel.toStream(
|
|
299
85
|
asRawChannel(input).underlying as Channel.Channel<
|
|
@@ -307,46 +93,29 @@ export const rawToStream = <IE = never, OE = Socket.SocketError, R = never>(
|
|
|
307
93
|
>
|
|
308
94
|
);
|
|
309
95
|
|
|
310
|
-
/**
|
|
311
|
-
* @since 1.0.0
|
|
312
|
-
* @category Conversions
|
|
313
|
-
*/
|
|
96
|
+
/** @internal */
|
|
314
97
|
export const rawToSink = <IE = never, OE = Socket.SocketError, R = never>(
|
|
315
|
-
input: EitherRawInput<IE, OE, R>
|
|
98
|
+
input: MobyDemux.EitherRawInput<IE, OE, R>
|
|
316
99
|
): Sink.Sink<void, string | Uint8Array | Socket.CloseEvent, Uint8Array, IE | OE, R> =>
|
|
317
100
|
Channel.toSink(asRawChannel(input).underlying);
|
|
318
101
|
|
|
319
|
-
/**
|
|
320
|
-
* @since 1.0.0
|
|
321
|
-
* @category Conversions
|
|
322
|
-
*/
|
|
102
|
+
/** @internal */
|
|
323
103
|
export const rawFromStreamWith =
|
|
324
104
|
<IE>() =>
|
|
325
|
-
<E, R>(input: Stream.Stream<Uint8Array, IE | E, R>): RawChannel<IE, E, R> =>
|
|
326
|
-
makeRawChannel<IE, E, R>(Stream.toChannel(input));
|
|
327
|
-
|
|
328
|
-
/**
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
rawFromStreamWith<unknown>()(input);
|
|
334
|
-
|
|
335
|
-
/**
|
|
336
|
-
* @since 1.0.0
|
|
337
|
-
* @category Conversions
|
|
338
|
-
*/
|
|
105
|
+
<E, R>(input: Stream.Stream<Uint8Array, IE | E, R>): MobyDemux.RawChannel<IE, IE | E, R> =>
|
|
106
|
+
makeRawChannel<IE, IE | E, R>(Stream.toChannel(input));
|
|
107
|
+
|
|
108
|
+
/** @internal */
|
|
109
|
+
export const rawFromStream = <E, R>(input: Stream.Stream<Uint8Array, E, R>): MobyDemux.RawChannel<never, E, R> =>
|
|
110
|
+
rawFromStreamWith<never>()(input);
|
|
111
|
+
|
|
112
|
+
/** @internal */
|
|
339
113
|
export const rawFromSink = <E, R>(
|
|
340
114
|
input: Sink.Sink<void, string | Uint8Array | Socket.CloseEvent, Uint8Array, E, R>
|
|
341
|
-
): RawChannel<never, E, R> => makeRawChannel<never, E, R>(Sink.toChannel(input));
|
|
342
|
-
|
|
343
|
-
/**
|
|
344
|
-
|
|
345
|
-
*
|
|
346
|
-
* @since 1.0.0
|
|
347
|
-
* @category Interleave
|
|
348
|
-
*/
|
|
349
|
-
export const interleaveToStream = <
|
|
115
|
+
): MobyDemux.RawChannel<never, E, R> => makeRawChannel<never, E, R>(Sink.toChannel(input));
|
|
116
|
+
|
|
117
|
+
/** @internal */
|
|
118
|
+
export const interleaveRaw = <
|
|
350
119
|
IE1 = never,
|
|
351
120
|
IE2 = never,
|
|
352
121
|
OE1 = Socket.SocketError,
|
|
@@ -354,19 +123,14 @@ export const interleaveToStream = <
|
|
|
354
123
|
R1 = never,
|
|
355
124
|
R2 = never,
|
|
356
125
|
>(
|
|
357
|
-
stdout: EitherRawInput<IE1, OE1, R1>,
|
|
358
|
-
stderr: EitherRawInput<IE2, OE2, R2>
|
|
126
|
+
stdout: MobyDemux.EitherRawInput<IE1, OE1, R1>,
|
|
127
|
+
stderr: MobyDemux.EitherRawInput<IE2, OE2, R2>
|
|
359
128
|
): Stream.Stream<Uint8Array, IE1 | IE2 | OE1 | OE2, R1 | R2> => {
|
|
360
129
|
return Stream.interleave(rawToStream(stdout), rawToStream(stderr));
|
|
361
130
|
};
|
|
362
131
|
|
|
363
|
-
/**
|
|
364
|
-
|
|
365
|
-
*
|
|
366
|
-
* @since 1.0.0
|
|
367
|
-
* @category Merging
|
|
368
|
-
*/
|
|
369
|
-
export const mergeToTaggedStream = <
|
|
132
|
+
/** @internal */
|
|
133
|
+
export const mergeRawToTaggedStream = <
|
|
370
134
|
IE1 = never,
|
|
371
135
|
IE2 = never,
|
|
372
136
|
OE1 = Socket.SocketError,
|
|
@@ -374,8 +138,8 @@ export const mergeToTaggedStream = <
|
|
|
374
138
|
R1 = never,
|
|
375
139
|
R2 = never,
|
|
376
140
|
>(
|
|
377
|
-
stdout: EitherRawInput<IE1, OE1, R1>,
|
|
378
|
-
stderr: EitherRawInput<IE2, OE2, R2>,
|
|
141
|
+
stdout: MobyDemux.EitherRawInput<IE1, OE1, R1>,
|
|
142
|
+
stderr: MobyDemux.EitherRawInput<IE2, OE2, R2>,
|
|
379
143
|
options?: { bufferSize?: number | undefined } | undefined
|
|
380
144
|
): Stream.Stream<
|
|
381
145
|
{ _tag: "stdout"; value: Uint8Array } | { _tag: "stderr"; value: Uint8Array },
|
|
@@ -393,14 +157,7 @@ export const mergeToTaggedStream = <
|
|
|
393
157
|
} as const
|
|
394
158
|
);
|
|
395
159
|
|
|
396
|
-
/**
|
|
397
|
-
* Demux a raw socket. When given a raw socket of the remote process's pty,
|
|
398
|
-
* there is no way to differentiate between stdout and stderr so they are
|
|
399
|
-
* combined on the same sink.
|
|
400
|
-
*
|
|
401
|
-
* @since 1.0.0
|
|
402
|
-
* @category Demux
|
|
403
|
-
*/
|
|
160
|
+
/** @internal */
|
|
404
161
|
export const demuxRawToSingleSink = Function.dual<
|
|
405
162
|
// Data-last signature.
|
|
406
163
|
<A1, L1, E1, E2, R1, R2>(
|
|
@@ -408,7 +165,7 @@ export const demuxRawToSingleSink = Function.dual<
|
|
|
408
165
|
sink: Sink.Sink<A1, string, L1, E2, R2>,
|
|
409
166
|
options?: { encoding?: string | undefined } | undefined
|
|
410
167
|
) => <IE = never, OE = Socket.SocketError, R3 = never>(
|
|
411
|
-
socket: EitherRawInput<E1 | IE, OE, R3>
|
|
168
|
+
socket: MobyDemux.EitherRawInput<E1 | IE, OE, R3>
|
|
412
169
|
) => Effect.Effect<
|
|
413
170
|
A1,
|
|
414
171
|
E1 | E2 | IE | OE,
|
|
@@ -416,7 +173,7 @@ export const demuxRawToSingleSink = Function.dual<
|
|
|
416
173
|
>,
|
|
417
174
|
// Data-first signature.
|
|
418
175
|
<A1, L1, E1, E2, R1, R2, IE = never, OE = Socket.SocketError, R3 = never>(
|
|
419
|
-
socket: EitherRawInput<E1 | IE, OE, R3>,
|
|
176
|
+
socket: MobyDemux.EitherRawInput<E1 | IE, OE, R3>,
|
|
420
177
|
source: Stream.Stream<string | Uint8Array | Socket.CloseEvent, E1, R1>,
|
|
421
178
|
sink: Sink.Sink<A1, string, L1, E2, R2>,
|
|
422
179
|
options?: { encoding?: string | undefined } | undefined
|
|
@@ -436,16 +193,7 @@ export const demuxRawToSingleSink = Function.dual<
|
|
|
436
193
|
)
|
|
437
194
|
);
|
|
438
195
|
|
|
439
|
-
/**
|
|
440
|
-
* Demux multiple raw sockets, created from multiple container attach requests.
|
|
441
|
-
* If no options are provided for a given stream, it will be ignored. This is
|
|
442
|
-
* really just an Effect.all wrapper around {@link demuxRawSingleSink}.
|
|
443
|
-
*
|
|
444
|
-
* To demux a single raw socket, you should use {@link demuxRawSingleSink}
|
|
445
|
-
*
|
|
446
|
-
* @since 1.0.0
|
|
447
|
-
* @category Demux
|
|
448
|
-
*/
|
|
196
|
+
/** @internal */
|
|
449
197
|
export const demuxStdioRawTupled: <
|
|
450
198
|
A1 = void,
|
|
451
199
|
A2 = void,
|
|
@@ -467,7 +215,7 @@ export const demuxStdioRawTupled: <
|
|
|
467
215
|
R5 = never,
|
|
468
216
|
R6 = never,
|
|
469
217
|
>(
|
|
470
|
-
sockets: HeterogeneousStdioTupledRawInput<
|
|
218
|
+
sockets: MobyDemux.HeterogeneousStdioTupledRawInput<
|
|
471
219
|
A1,
|
|
472
220
|
A2,
|
|
473
221
|
L1,
|
|
@@ -490,7 +238,7 @@ export const demuxStdioRawTupled: <
|
|
|
490
238
|
>,
|
|
491
239
|
options?: { encoding?: string | undefined } | undefined
|
|
492
240
|
) => Effect.Effect<
|
|
493
|
-
CompressedDemuxOutput<A1, A2>,
|
|
241
|
+
MobyDemux.CompressedDemuxOutput<A1, A2>,
|
|
494
242
|
E1 | E2 | E3 | IE1 | IE2 | IE3 | OE1 | OE2 | OE3,
|
|
495
243
|
| Exclude<R1, Scope.Scope>
|
|
496
244
|
| Exclude<R2, Scope.Scope>
|
|
@@ -524,16 +272,7 @@ export const demuxStdioRawTupled: <
|
|
|
524
272
|
);
|
|
525
273
|
});
|
|
526
274
|
|
|
527
|
-
/**
|
|
528
|
-
* Demux multiple raw sockets, created from multiple container attach requests.
|
|
529
|
-
* If no options are provided for a given stream, it will be ignored. This is
|
|
530
|
-
* really just an Effect.all wrapper around {@link demuxRawSingleSink}.
|
|
531
|
-
*
|
|
532
|
-
* To demux a single raw socket, you should use {@link demuxRawSingleSink}
|
|
533
|
-
*
|
|
534
|
-
* @since 1.0.0
|
|
535
|
-
* @category Demux
|
|
536
|
-
*/
|
|
275
|
+
/** @internal */
|
|
537
276
|
export const demuxStdioRawToSingleSink = Function.dual<
|
|
538
277
|
// Single sink, data-last signature.
|
|
539
278
|
<A1, L1, E1, E2, R1, R2>(
|
|
@@ -551,7 +290,7 @@ export const demuxStdioRawToSingleSink = Function.dual<
|
|
|
551
290
|
R4 = never,
|
|
552
291
|
R5 = never,
|
|
553
292
|
>(
|
|
554
|
-
sockets: HeterogeneousStdioRawInput<IE1 | E1, IE2, IE3, OE1, OE2, OE3, R3, R4, R5>
|
|
293
|
+
sockets: MobyDemux.HeterogeneousStdioRawInput<IE1 | E1, IE2, IE3, OE1, OE2, OE3, R3, R4, R5>
|
|
555
294
|
) => Effect.Effect<
|
|
556
295
|
A1,
|
|
557
296
|
E1 | E2 | IE1 | IE2 | IE3 | OE1 | OE2 | OE3,
|
|
@@ -579,7 +318,7 @@ export const demuxStdioRawToSingleSink = Function.dual<
|
|
|
579
318
|
R4 = never,
|
|
580
319
|
R5 = never,
|
|
581
320
|
>(
|
|
582
|
-
sockets: HeterogeneousStdioRawInput<IE1 | E1, IE2, IE3, OE1, OE2, OE3, R3, R4, R5>,
|
|
321
|
+
sockets: MobyDemux.HeterogeneousStdioRawInput<IE1 | E1, IE2, IE3, OE1, OE2, OE3, R3, R4, R5>,
|
|
583
322
|
source: Stream.Stream<string | Uint8Array | Socket.CloseEvent, E1, R1>,
|
|
584
323
|
sink: Sink.Sink<A1, string, L1, E2, R2>,
|
|
585
324
|
options?: { encoding?: string | undefined } | undefined
|
|
@@ -615,16 +354,7 @@ export const demuxStdioRawToSingleSink = Function.dual<
|
|
|
615
354
|
})
|
|
616
355
|
);
|
|
617
356
|
|
|
618
|
-
/**
|
|
619
|
-
* Demux multiple raw sockets, created from multiple container attach requests.
|
|
620
|
-
* If no options are provided for a given stream, it will be ignored. This is
|
|
621
|
-
* really just an Effect.all wrapper around {@link demuxRawSingleSink}.
|
|
622
|
-
*
|
|
623
|
-
* To demux a single raw socket, you should use {@link demuxRawSingleSink}
|
|
624
|
-
*
|
|
625
|
-
* @since 1.0.0
|
|
626
|
-
* @category Demux
|
|
627
|
-
*/
|
|
357
|
+
/** @internal */
|
|
628
358
|
export const demuxStdioRawToSeparateSinks = Function.dual<
|
|
629
359
|
// Multiple sinks, data-last signature.
|
|
630
360
|
<A1, A2, L1, L2, E1, E2, E3, R1, R2, R3>(
|
|
@@ -645,9 +375,9 @@ export const demuxStdioRawToSeparateSinks = Function.dual<
|
|
|
645
375
|
R5 = never,
|
|
646
376
|
R6 = never,
|
|
647
377
|
>(
|
|
648
|
-
sockets: HeterogeneousStdioRawInput<IE1 | E1, IE2, IE3, OE1, OE2, OE3, R4, R5, R6>
|
|
378
|
+
sockets: MobyDemux.HeterogeneousStdioRawInput<IE1 | E1, IE2, IE3, OE1, OE2, OE3, R4, R5, R6>
|
|
649
379
|
) => Effect.Effect<
|
|
650
|
-
CompressedDemuxOutput<A1, A2>,
|
|
380
|
+
MobyDemux.CompressedDemuxOutput<A1, A2>,
|
|
651
381
|
E1 | E2 | E3 | IE1 | IE2 | IE3 | OE1 | OE2 | OE3,
|
|
652
382
|
| Exclude<R1, Scope.Scope>
|
|
653
383
|
| Exclude<R2, Scope.Scope>
|
|
@@ -678,7 +408,7 @@ export const demuxStdioRawToSeparateSinks = Function.dual<
|
|
|
678
408
|
R5 = never,
|
|
679
409
|
R6 = never,
|
|
680
410
|
>(
|
|
681
|
-
sockets: HeterogeneousStdioRawInput<IE1 | E1, IE2, IE3, OE1, OE2, OE3, R4, R5, R6>,
|
|
411
|
+
sockets: MobyDemux.HeterogeneousStdioRawInput<IE1 | E1, IE2, IE3, OE1, OE2, OE3, R4, R5, R6>,
|
|
682
412
|
io: {
|
|
683
413
|
stdin: Stream.Stream<string | Uint8Array | Socket.CloseEvent, E1, R1>;
|
|
684
414
|
stdout: Sink.Sink<A1, string, L1, E2, R2>;
|
|
@@ -686,7 +416,7 @@ export const demuxStdioRawToSeparateSinks = Function.dual<
|
|
|
686
416
|
},
|
|
687
417
|
options?: { encoding?: string | undefined } | undefined
|
|
688
418
|
) => Effect.Effect<
|
|
689
|
-
CompressedDemuxOutput<A1, A2>,
|
|
419
|
+
MobyDemux.CompressedDemuxOutput<A1, A2>,
|
|
690
420
|
E1 | E2 | E3 | IE1 | IE2 | IE3 | OE1 | OE2 | OE3,
|
|
691
421
|
| Exclude<R1, Scope.Scope>
|
|
692
422
|
| Exclude<R2, Scope.Scope>
|
|
@@ -714,7 +444,7 @@ export const demuxStdioRawToSeparateSinks = Function.dual<
|
|
|
714
444
|
|
|
715
445
|
return yield* Effect.map(
|
|
716
446
|
Effect.all({ ranStdin: runStdin, ranStdout: runStdout, ranStderr: runStderr }, { concurrency: 3 }),
|
|
717
|
-
({ ranStderr, ranStdout }) => compressDemuxOutput(Tuple.make(ranStdout, ranStderr))
|
|
447
|
+
({ ranStderr, ranStdout }) => internalCompressed.compressDemuxOutput(Tuple.make(ranStdout, ranStderr))
|
|
718
448
|
);
|
|
719
449
|
})
|
|
720
450
|
);
|
|
@@ -3,19 +3,15 @@ import type * as Channel from "effect/Channel";
|
|
|
3
3
|
import type * as Chunk from "effect/Chunk";
|
|
4
4
|
import type * as ParseResult from "effect/ParseResult";
|
|
5
5
|
import type * as Scope from "effect/Scope";
|
|
6
|
+
import type * as Stream from "effect/Stream";
|
|
7
|
+
import type * as MobyDemux from "../../MobyDemux.js";
|
|
6
8
|
|
|
7
9
|
import * as Console from "effect/Console";
|
|
8
10
|
import * as Data from "effect/Data";
|
|
9
11
|
import * as Effect from "effect/Effect";
|
|
10
12
|
import * as Sink from "effect/Sink";
|
|
11
|
-
import * as Stream from "effect/Stream";
|
|
12
13
|
|
|
13
|
-
import {
|
|
14
|
-
asMultiplexedChannel,
|
|
15
|
-
demuxMultiplexedToSeparateSinks,
|
|
16
|
-
EitherMultiplexedInput,
|
|
17
|
-
makeMultiplexedChannel,
|
|
18
|
-
} from "./multiplexed.js";
|
|
14
|
+
import { asMultiplexedChannel, demuxMultiplexedToSeparateSinks, makeMultiplexedChannel } from "./multiplexed.js";
|
|
19
15
|
|
|
20
16
|
/**
|
|
21
17
|
* @since 1.0.0
|
|
@@ -35,24 +31,9 @@ export class StdoutError extends Data.TaggedError("StdoutError")<{ message: stri
|
|
|
35
31
|
*/
|
|
36
32
|
export class StderrError extends Data.TaggedError("StderrError")<{ message: string; cause: unknown }> {}
|
|
37
33
|
|
|
38
|
-
/**
|
|
39
|
-
* Demux either a raw stream socket or a multiplexed stream socket from stdin to
|
|
40
|
-
* stdout and stderr. If given a raw stream socket, then stdout and stderr will
|
|
41
|
-
* be combined on the same sink. If given a multiplexed stream socket, then
|
|
42
|
-
* stdout and stderr will be forwarded to different sinks. If given multiple raw
|
|
43
|
-
* stream sockets, then you can provide different individual sockets for stdin,
|
|
44
|
-
* stdout, and stderr.
|
|
45
|
-
*
|
|
46
|
-
* If you are looking for a way to demux to the console instead of stdin,
|
|
47
|
-
* stdout, and stderr then see {@link demuxSocketWithInputToConsole}. Since we
|
|
48
|
-
* are interacting with stdin, stdout, and stderr this function dynamically
|
|
49
|
-
* imports the `@effect/platform-node` package.
|
|
50
|
-
*
|
|
51
|
-
* @since 1.0.0
|
|
52
|
-
* @category DemuxStdio
|
|
53
|
-
*/
|
|
34
|
+
/** @internal */
|
|
54
35
|
export const demuxFromStdinToStdoutAndStderr = <IE = never, OE = Socket.SocketError, R = never>(
|
|
55
|
-
sockets: EitherMultiplexedInput<IE, OE, R>,
|
|
36
|
+
sockets: MobyDemux.EitherMultiplexedInput<IE, OE, R>,
|
|
56
37
|
options?: { bufferSize?: number | undefined; encoding?: string | undefined } | undefined
|
|
57
38
|
): Effect.Effect<
|
|
58
39
|
void,
|
|
@@ -100,22 +81,9 @@ export const demuxFromStdinToStdoutAndStderr = <IE = never, OE = Socket.SocketEr
|
|
|
100
81
|
}
|
|
101
82
|
);
|
|
102
83
|
|
|
103
|
-
/**
|
|
104
|
-
* Demux either a raw stream socket or a multiplexed stream socket to the
|
|
105
|
-
* console. If given a raw stream socket, then stdout and stderr will be
|
|
106
|
-
* combined on the same sink. If given a multiplexed stream socket, then stdout
|
|
107
|
-
* and stderr will be forwarded to different sinks. If given multiple raw stream
|
|
108
|
-
* sockets, then you can provide different individual sockets for stdin, stdout,
|
|
109
|
-
* and stderr.
|
|
110
|
-
*
|
|
111
|
-
* If you are looking for a way to demux to stdin, stdout, and stderr instead of
|
|
112
|
-
* the console then see {@link demuxSocketFromStdinToStdoutAndStderr}.
|
|
113
|
-
*
|
|
114
|
-
* @since 1.0.0
|
|
115
|
-
* @category DemuxStdio
|
|
116
|
-
*/
|
|
84
|
+
/** @internal */
|
|
117
85
|
export const demuxWithInputToConsole = <E, R1, IE = never, OE = Socket.SocketError, R2 = never>(
|
|
118
|
-
sockets: EitherMultiplexedInput<E | IE, OE, R2>,
|
|
86
|
+
sockets: MobyDemux.EitherMultiplexedInput<E | IE, OE, R2>,
|
|
119
87
|
input: Stream.Stream<string | Uint8Array, E, R1>,
|
|
120
88
|
options?: { bufferSize?: number | undefined; encoding?: string | undefined } | undefined
|
|
121
89
|
): Effect.Effect<void, E | IE | OE | ParseResult.ParseError, Exclude<R1, Scope.Scope> | Exclude<R2, Scope.Scope>> =>
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
+
import type * as HttpBody from "@effect/platform/HttpBody";
|
|
2
|
+
import type * as HttpClientError from "@effect/platform/HttpClientError";
|
|
3
|
+
import type * as Layer from "effect/Layer";
|
|
4
|
+
import type * as ParseResult from "effect/ParseResult";
|
|
5
|
+
|
|
1
6
|
import * as PlatformError from "@effect/platform/Error";
|
|
2
|
-
import * as HttpBody from "@effect/platform/HttpBody";
|
|
3
7
|
import * as HttpClient from "@effect/platform/HttpClient";
|
|
4
|
-
import * as HttpClientError from "@effect/platform/HttpClientError";
|
|
5
8
|
import * as HttpClientRequest from "@effect/platform/HttpClientRequest";
|
|
6
9
|
import * as HttpClientResponse from "@effect/platform/HttpClientResponse";
|
|
7
10
|
import * as Effect from "effect/Effect";
|
|
8
11
|
import * as Function from "effect/Function";
|
|
9
|
-
import * as Layer from "effect/Layer";
|
|
10
12
|
import * as Option from "effect/Option";
|
|
11
|
-
import * as ParseResult from "effect/ParseResult";
|
|
12
13
|
import * as Predicate from "effect/Predicate";
|
|
13
14
|
import * as Schema from "effect/Schema";
|
|
14
15
|
import * as Tuple from "effect/Tuple";
|