the-moby-effect 1.48.0 → 1.48.1
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 +12 -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
package/src/MobyDemux.ts
CHANGED
|
@@ -4,20 +4,757 @@
|
|
|
4
4
|
* @since 1.0.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
import type * as HttpClientResponse from "@effect/platform/HttpClientResponse";
|
|
8
|
+
import type * as Socket from "@effect/platform/Socket";
|
|
9
|
+
import type * as Channel from "effect/Channel";
|
|
10
|
+
import type * as Chunk from "effect/Chunk";
|
|
11
|
+
import type * as Effect from "effect/Effect";
|
|
12
|
+
import type * as ParseResult from "effect/ParseResult";
|
|
13
|
+
import type * as Pipeable from "effect/Pipeable";
|
|
14
|
+
import type * as Scope from "effect/Scope";
|
|
15
|
+
import type * as Sink from "effect/Sink";
|
|
16
|
+
import type * as Stream from "effect/Stream";
|
|
9
17
|
|
|
10
|
-
|
|
11
|
-
|
|
18
|
+
import * as internal from "./internal/demux/demux.js";
|
|
19
|
+
import * as internalFan from "./internal/demux/fan.js";
|
|
20
|
+
import * as internalHijack from "./internal/demux/hijack.js";
|
|
21
|
+
import * as internalMultiplexed from "./internal/demux/multiplexed.js";
|
|
22
|
+
import * as internalPack from "./internal/demux/pack.js";
|
|
23
|
+
import * as internalRaw from "./internal/demux/raw.js";
|
|
24
|
+
import * as internalStdio from "./internal/demux/stdio.js";
|
|
12
25
|
|
|
13
|
-
/**
|
|
14
|
-
|
|
26
|
+
/**
|
|
27
|
+
* @since 1.0.0
|
|
28
|
+
* @category Types
|
|
29
|
+
*/
|
|
30
|
+
export const RawContentType: "application/vnd.docker.raw-stream" = internalRaw.RawContentType;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @since 1.0.0
|
|
34
|
+
* @category Types
|
|
35
|
+
*/
|
|
36
|
+
export const MultiplexedContentType: "application/vnd.docker.multiplexed-stream" =
|
|
37
|
+
internalMultiplexed.MultiplexedContentType;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @since 1.0.0
|
|
41
|
+
* @category Type ids
|
|
42
|
+
*/
|
|
43
|
+
export const RawSocketTypeId: unique symbol = internalRaw.RawSocketTypeId;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* @since 1.0.0
|
|
47
|
+
* @category Type ids
|
|
48
|
+
*/
|
|
49
|
+
export type RawSocketTypeId = typeof RawSocketTypeId;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* @since 1.0.0
|
|
53
|
+
* @category Type ids
|
|
54
|
+
*/
|
|
55
|
+
export const RawChannelTypeId: unique symbol = internalRaw.RawChannelTypeId;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* @since 1.0.0
|
|
59
|
+
* @category Type ids
|
|
60
|
+
*/
|
|
61
|
+
export type RawChannelTypeId = typeof RawChannelTypeId;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* @since 1.0.0
|
|
65
|
+
* @category Type ids
|
|
66
|
+
*/
|
|
67
|
+
export const MultiplexedSocketTypeId: unique symbol = internalMultiplexed.MultiplexedSocketTypeId;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* @since 1.0.0
|
|
71
|
+
* @category Type ids
|
|
72
|
+
*/
|
|
73
|
+
export type MultiplexedSocketTypeId = typeof MultiplexedSocketTypeId;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* @since 1.0.0
|
|
77
|
+
* @category Type ids
|
|
78
|
+
*/
|
|
79
|
+
export const MultiplexedChannelTypeId: unique symbol = internalMultiplexed.MultiplexedChannelTypeId;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* @since 1.0.0
|
|
83
|
+
* @category Type ids
|
|
84
|
+
*/
|
|
85
|
+
export type MultiplexedChannelTypeId = typeof MultiplexedChannelTypeId;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* When the TTY setting is enabled in POST /containers/create, the stream is not
|
|
89
|
+
* multiplexed. The data exchanged over the hijacked connection is simply the
|
|
90
|
+
* raw data from the process PTY and client's stdin.
|
|
91
|
+
*
|
|
92
|
+
* Note for Leo: This exists because the input error type "IE" might not be
|
|
93
|
+
* known at the time of converting the Socket to a Channel.
|
|
94
|
+
*
|
|
95
|
+
* @since 1.0.0
|
|
96
|
+
* @category Branded Types
|
|
97
|
+
*/
|
|
98
|
+
export interface RawSocket extends Pipeable.Pipeable {
|
|
99
|
+
readonly "content-type": typeof RawContentType;
|
|
100
|
+
readonly [RawSocketTypeId]: typeof RawSocketTypeId;
|
|
101
|
+
readonly underlying: Socket.Socket;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* When the TTY setting is enabled in POST /containers/create, the stream is not
|
|
106
|
+
* multiplexed. The data exchanged over the hijacked connection is simply the
|
|
107
|
+
* raw data from the process PTY and client's stdin.
|
|
108
|
+
*
|
|
109
|
+
* Note for Leo: This exists because there is no way to convert from a Channel
|
|
110
|
+
* to a Socket. In fact, with my current effect knowledge, I believe it is
|
|
111
|
+
* impossible to implement. This is still needed though for the pack and fan
|
|
112
|
+
* implementations which seek to return these types.
|
|
113
|
+
*
|
|
114
|
+
* @since 1.0.0
|
|
115
|
+
* @category Branded Types
|
|
116
|
+
*/
|
|
117
|
+
export interface RawChannel<in IE = unknown, out OE = Socket.SocketError, out R = never> extends Pipeable.Pipeable {
|
|
118
|
+
readonly "content-type": typeof RawContentType;
|
|
119
|
+
readonly [RawChannelTypeId]: typeof RawChannelTypeId;
|
|
120
|
+
readonly underlying: Channel.Channel<
|
|
121
|
+
Chunk.Chunk<Uint8Array>,
|
|
122
|
+
Chunk.Chunk<string | Uint8Array | Socket.CloseEvent>,
|
|
123
|
+
OE,
|
|
124
|
+
IE,
|
|
125
|
+
void,
|
|
126
|
+
unknown,
|
|
127
|
+
R
|
|
128
|
+
>;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* When the TTY setting is disabled in POST /containers/create, the HTTP
|
|
133
|
+
* Content-Type header is set to application/vnd.docker.multiplexed-stream and
|
|
134
|
+
* the stream over the hijacked connected is multiplexed to separate out stdout
|
|
135
|
+
* and stderr. The stream consists of a series of frames, each containing a
|
|
136
|
+
* header and a payload.
|
|
137
|
+
*
|
|
138
|
+
* Note for Leo: This exists because the input error type "IE" might not be
|
|
139
|
+
* known at the time of converting the Socket to a Channel.
|
|
140
|
+
*
|
|
141
|
+
* @since 1.0.0
|
|
142
|
+
* @category Branded Types
|
|
143
|
+
*/
|
|
144
|
+
export interface MultiplexedSocket extends Pipeable.Pipeable {
|
|
145
|
+
readonly "content-type": typeof MultiplexedContentType;
|
|
146
|
+
readonly [MultiplexedSocketTypeId]: MultiplexedSocketTypeId;
|
|
147
|
+
readonly underlying: Socket.Socket;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* When the TTY setting is disabled in POST /containers/create, the HTTP
|
|
152
|
+
* Content-Type header is set to application/vnd.docker.multiplexed-stream and
|
|
153
|
+
* the stream over the hijacked connected is multiplexed to separate out stdout
|
|
154
|
+
* and stderr. The stream consists of a series of frames, each containing a
|
|
155
|
+
* header and a payload.
|
|
156
|
+
*
|
|
157
|
+
* Note for Leo: This exists because there is no way to convert from a Channel
|
|
158
|
+
* to a Socket. In fact, with my current effect knowledge, I believe it is
|
|
159
|
+
* impossible to implement. This is still needed though for the pack and fan
|
|
160
|
+
* implementations which seek to return these types.
|
|
161
|
+
*
|
|
162
|
+
* @since 1.0.0
|
|
163
|
+
* @category Branded Types
|
|
164
|
+
*/
|
|
165
|
+
export interface MultiplexedChannel<in IE = unknown, out OE = Socket.SocketError, out R = never>
|
|
166
|
+
extends Pipeable.Pipeable {
|
|
167
|
+
readonly "content-type": typeof MultiplexedContentType;
|
|
168
|
+
readonly [MultiplexedChannelTypeId]: MultiplexedChannelTypeId;
|
|
169
|
+
readonly underlying: Channel.Channel<
|
|
170
|
+
Chunk.Chunk<Uint8Array>,
|
|
171
|
+
Chunk.Chunk<string | Uint8Array | Socket.CloseEvent>,
|
|
172
|
+
OE,
|
|
173
|
+
IE,
|
|
174
|
+
void,
|
|
175
|
+
unknown,
|
|
176
|
+
R
|
|
177
|
+
>;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* @since 1.0.0
|
|
182
|
+
* @category Types
|
|
183
|
+
*/
|
|
184
|
+
export type EitherRawInput<IE, OE, R> = RawSocket | RawChannel<IE, OE, R>;
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* @since 1.0.0
|
|
188
|
+
* @category Types
|
|
189
|
+
*/
|
|
190
|
+
|
|
191
|
+
export type AnyRawInput = EitherRawInput<any, any, any>;
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* @since 1.0.0
|
|
195
|
+
* @category Types
|
|
196
|
+
*/
|
|
197
|
+
export type EitherMultiplexedInput<IE, OE, R> = MultiplexedSocket | MultiplexedChannel<IE, OE, R>;
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* @since 1.0.0
|
|
201
|
+
* @category Types
|
|
202
|
+
*/
|
|
203
|
+
export type AnyMultiplexedInput = EitherMultiplexedInput<any, any, any>;
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* @since 1.0.0
|
|
207
|
+
* @category Types
|
|
208
|
+
*/
|
|
209
|
+
export type HomogeneousStdioRawSocketInput =
|
|
210
|
+
| { stdin: RawSocket; stdout?: never; stderr?: never }
|
|
211
|
+
| { stdin?: never; stdout: RawSocket; stderr?: never }
|
|
212
|
+
| { stdin?: never; stdout?: never; stderr: RawSocket }
|
|
213
|
+
| { stdin: RawSocket; stdout: RawSocket; stderr?: never }
|
|
214
|
+
| { stdin: RawSocket; stdout?: never; stderr: RawSocket }
|
|
215
|
+
| { stdin?: never; stdout: RawSocket; stderr: RawSocket }
|
|
216
|
+
| { stdin: RawSocket; stdout: RawSocket; stderr: RawSocket };
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* @since 1.0.0
|
|
220
|
+
* @category Types
|
|
221
|
+
*/
|
|
222
|
+
export type HomogeneousStdioRawChannelInput<IE1, IE2, IE3, OE1, OE2, OE3, R1, R2, R3> =
|
|
223
|
+
| { stdin: RawChannel<IE1, OE1, R1>; stdout?: never; stderr?: never }
|
|
224
|
+
| { stdin?: never; stdout: RawChannel<IE2, OE2, R2>; stderr?: never }
|
|
225
|
+
| { stdin?: never; stdout?: never; stderr: RawChannel<IE3, OE3, R3> }
|
|
226
|
+
| { stdin: RawChannel<IE1, OE1, R1>; stdout: RawChannel<IE2, OE2, R2>; stderr?: never }
|
|
227
|
+
| { stdin: RawChannel<IE1, OE1, R1>; stdout?: never; stderr: RawChannel<IE3, OE3, R3> }
|
|
228
|
+
| { stdin?: never; stdout: RawChannel<IE2, OE2, R2>; stderr: RawChannel<IE3, OE3, R3> }
|
|
229
|
+
| { stdin: RawChannel<IE1, OE1, R1>; stdout: RawChannel<IE2, OE2, R2>; stderr: RawChannel<IE3, OE3, R3> };
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* @since 1.0.0
|
|
233
|
+
* @category Types
|
|
234
|
+
*/
|
|
235
|
+
export type HeterogeneousStdioRawInput<IE1, IE2, IE3, OE1, OE2, OE3, R1, R2, R3> =
|
|
236
|
+
| { stdin: EitherRawInput<IE1, OE1, R1>; stdout?: never; stderr?: never }
|
|
237
|
+
| { stdin?: never; stdout: EitherRawInput<IE2, OE2, R2>; stderr?: never }
|
|
238
|
+
| { stdin?: never; stdout?: never; stderr: EitherRawInput<IE3, OE3, R3> }
|
|
239
|
+
| { stdin: EitherRawInput<IE1, OE1, R1>; stdout: EitherRawInput<IE2, OE2, R2>; stderr?: never }
|
|
240
|
+
| { stdin: EitherRawInput<IE1, OE1, R1>; stdout?: never; stderr: EitherRawInput<IE3, OE3, R3> }
|
|
241
|
+
| { stdin?: never; stdout: EitherRawInput<IE2, OE2, R2>; stderr: EitherRawInput<IE3, OE3, R3> }
|
|
242
|
+
| {
|
|
243
|
+
stdin: EitherRawInput<IE1, OE1, R1>;
|
|
244
|
+
stdout: EitherRawInput<IE2, OE2, R2>;
|
|
245
|
+
stderr: EitherRawInput<IE3, OE3, R3>;
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* @since 1.0.0
|
|
250
|
+
* @category Types
|
|
251
|
+
*/
|
|
252
|
+
export type HeterogeneousStdioTupledRawInput<
|
|
253
|
+
A1,
|
|
254
|
+
A2,
|
|
255
|
+
L1,
|
|
256
|
+
L2,
|
|
257
|
+
E1,
|
|
258
|
+
E2,
|
|
259
|
+
E3,
|
|
260
|
+
R1,
|
|
261
|
+
R2,
|
|
262
|
+
R3,
|
|
263
|
+
IE1,
|
|
264
|
+
IE2,
|
|
265
|
+
IE3,
|
|
266
|
+
OE1,
|
|
267
|
+
OE2,
|
|
268
|
+
OE3,
|
|
269
|
+
R4,
|
|
270
|
+
R5,
|
|
271
|
+
R6,
|
|
272
|
+
> =
|
|
273
|
+
| {
|
|
274
|
+
stdin: readonly [
|
|
275
|
+
Stream.Stream<string | Uint8Array | Socket.CloseEvent, E1, R1>,
|
|
276
|
+
EitherRawInput<E1 | IE1, OE1, R4>,
|
|
277
|
+
];
|
|
278
|
+
stdout?: never;
|
|
279
|
+
stderr?: never;
|
|
280
|
+
}
|
|
281
|
+
| {
|
|
282
|
+
stdin?: never;
|
|
283
|
+
stdout: readonly [EitherRawInput<IE2, OE2, R5>, Sink.Sink<A1, string, L1, E2, R2>];
|
|
284
|
+
stderr?: never;
|
|
285
|
+
}
|
|
286
|
+
| {
|
|
287
|
+
stdin?: never;
|
|
288
|
+
stdout?: never;
|
|
289
|
+
stderr: readonly [EitherRawInput<IE3, OE3, R6>, Sink.Sink<A2, string, L2, E3, R3>];
|
|
290
|
+
}
|
|
291
|
+
| {
|
|
292
|
+
stdin: readonly [
|
|
293
|
+
Stream.Stream<string | Uint8Array | Socket.CloseEvent, E1, R1>,
|
|
294
|
+
EitherRawInput<E1 | IE1, OE1, R4>,
|
|
295
|
+
];
|
|
296
|
+
stdout: readonly [EitherRawInput<IE2, OE2, R5>, Sink.Sink<A1, string, L1, E2, R2>];
|
|
297
|
+
stderr?: never;
|
|
298
|
+
}
|
|
299
|
+
| {
|
|
300
|
+
stdin: readonly [
|
|
301
|
+
Stream.Stream<string | Uint8Array | Socket.CloseEvent, E1, R1>,
|
|
302
|
+
EitherRawInput<E1 | IE1, OE1, R4>,
|
|
303
|
+
];
|
|
304
|
+
stdout?: never;
|
|
305
|
+
stderr: readonly [EitherRawInput<IE3, OE3, R6>, Sink.Sink<A2, string, L2, E3, R3>];
|
|
306
|
+
}
|
|
307
|
+
| {
|
|
308
|
+
stdin?: never;
|
|
309
|
+
stdout: readonly [EitherRawInput<IE2, OE2, R5>, Sink.Sink<A1, string, L1, E2, R2>];
|
|
310
|
+
stderr: readonly [EitherRawInput<IE3, OE3, R6>, Sink.Sink<A2, string, L2, E3, R3>];
|
|
311
|
+
}
|
|
312
|
+
| {
|
|
313
|
+
stdin: readonly [
|
|
314
|
+
Stream.Stream<string | Uint8Array | Socket.CloseEvent, E1, R1>,
|
|
315
|
+
EitherRawInput<E1 | IE1, OE1, R4>,
|
|
316
|
+
];
|
|
317
|
+
stdout: readonly [EitherRawInput<IE2, OE2, R5>, Sink.Sink<A1, string, L1, E2, R2>];
|
|
318
|
+
stderr: readonly [EitherRawInput<IE3, OE3, R6>, Sink.Sink<A2, string, L2, E3, R3>];
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* @since 1.0.0
|
|
323
|
+
* @category Types
|
|
324
|
+
*/
|
|
325
|
+
export type CompressedDemuxOutput<A1, A2> = A1 extends undefined | void
|
|
326
|
+
? A2 extends undefined | void
|
|
327
|
+
? void
|
|
328
|
+
: readonly [stdout: undefined, stderr: A2]
|
|
329
|
+
: A2 extends undefined | void
|
|
330
|
+
? readonly [stdout: A1, stderr: undefined]
|
|
331
|
+
: readonly [stdout: A1, stderr: A2];
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* @since 1.0.0
|
|
335
|
+
* @category Constructors
|
|
336
|
+
*/
|
|
337
|
+
export const makeRawSocket: (underlying: Socket.Socket) => RawSocket = internalRaw.makeRawSocket;
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* @since 1.0.0
|
|
341
|
+
* @category Constructors
|
|
342
|
+
*/
|
|
343
|
+
export const makeRawChannel: <IE = unknown, OE = Socket.SocketError, R = never>(
|
|
344
|
+
underlying: Channel.Channel<
|
|
345
|
+
Chunk.Chunk<Uint8Array>,
|
|
346
|
+
Chunk.Chunk<string | Uint8Array | Socket.CloseEvent>,
|
|
347
|
+
OE,
|
|
348
|
+
IE,
|
|
349
|
+
void,
|
|
350
|
+
unknown,
|
|
351
|
+
R
|
|
352
|
+
>
|
|
353
|
+
) => RawChannel<IE, IE | OE, R> = internalRaw.makeRawChannel;
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* @since 1.0.0
|
|
357
|
+
* @category Constructors
|
|
358
|
+
*/
|
|
359
|
+
export const makeMultiplexedSocket: (underlying: Socket.Socket) => MultiplexedSocket =
|
|
360
|
+
internalMultiplexed.makeMultiplexedSocket;
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* @since 1.0.0
|
|
364
|
+
* @category Constructors
|
|
365
|
+
*/
|
|
366
|
+
export const makeMultiplexedChannel: <IE = unknown, OE = Socket.SocketError, R = never>(
|
|
367
|
+
underlying: Channel.Channel<
|
|
368
|
+
Chunk.Chunk<Uint8Array>,
|
|
369
|
+
Chunk.Chunk<string | Uint8Array | Socket.CloseEvent>,
|
|
370
|
+
OE,
|
|
371
|
+
IE,
|
|
372
|
+
void,
|
|
373
|
+
unknown,
|
|
374
|
+
R
|
|
375
|
+
>
|
|
376
|
+
) => MultiplexedChannel<IE, IE | OE, R> = internalMultiplexed.makeMultiplexedChannel;
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* @since 1.0.0
|
|
380
|
+
* @category Predicates
|
|
381
|
+
*/
|
|
382
|
+
export const isRawSocket: (u: unknown) => u is RawSocket = internalRaw.isRawSocket;
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* @since 1.0.0
|
|
386
|
+
* @category Predicates
|
|
387
|
+
*/
|
|
388
|
+
export const isRawChannel: <IE = unknown, OE = Socket.SocketError, R = never>(
|
|
389
|
+
u: unknown
|
|
390
|
+
) => u is RawChannel<IE, IE | OE, R> = internalRaw.isRawChannel;
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* @since 1.0.0
|
|
394
|
+
* @category Predicates
|
|
395
|
+
*/
|
|
396
|
+
export const isMultiplexedSocket: (u: unknown) => u is MultiplexedSocket = internalMultiplexed.isMultiplexedSocket;
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* @since 1.0.0
|
|
400
|
+
* @category Predicates
|
|
401
|
+
*/
|
|
402
|
+
export const isMultiplexedChannel: <IE = unknown, OE = Socket.SocketError, R = never>(
|
|
403
|
+
u: unknown
|
|
404
|
+
) => u is MultiplexedChannel<IE, IE | OE, R> = internalMultiplexed.isMultiplexedChannel;
|
|
15
405
|
|
|
16
|
-
/**
|
|
17
|
-
|
|
406
|
+
/**
|
|
407
|
+
* @since 1.0.0
|
|
408
|
+
* @category Predicates
|
|
409
|
+
*/
|
|
410
|
+
export const responseIsRawResponse: (response: HttpClientResponse.HttpClientResponse) => boolean =
|
|
411
|
+
internalRaw.responseIsRawResponse;
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* @since 1.0.0
|
|
415
|
+
* @category Predicates
|
|
416
|
+
*/
|
|
417
|
+
export const responseIsMultiplexedResponse: (response: HttpClientResponse.HttpClientResponse) => boolean =
|
|
418
|
+
internalMultiplexed.responseIsMultiplexedResponse;
|
|
419
|
+
|
|
420
|
+
/**
|
|
421
|
+
* Hijacks an http response into a socket.
|
|
422
|
+
*
|
|
423
|
+
* FIXME: this function relies on a hack to expose the underlying tcp socket
|
|
424
|
+
* from the http client response. This will only work in NodeJs, not tested in
|
|
425
|
+
* Bun/Deno yet, and will never work in the browser.
|
|
426
|
+
*
|
|
427
|
+
* @since 1.0.0
|
|
428
|
+
* @category Transformations
|
|
429
|
+
*/
|
|
430
|
+
export const hijackResponseUnsafe: (
|
|
431
|
+
response: HttpClientResponse.HttpClientResponse
|
|
432
|
+
) => Effect.Effect<Socket.Socket, Socket.SocketError, never> = internalHijack.hijackResponseUnsafe;
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* Transforms an http response into a multiplexed stream socket or a raw stream
|
|
436
|
+
* socket. If the response is neither a multiplexed stream socket nor a raw or
|
|
437
|
+
* can not be transformed, then an error will be returned.
|
|
438
|
+
*
|
|
439
|
+
* FIXME: this function relies on a hack to expose the underlying tcp socket
|
|
440
|
+
* from the http client response. This will only work in NodeJs, not tested in
|
|
441
|
+
* Bun/Deno yet, and will never work in the browser.
|
|
442
|
+
*
|
|
443
|
+
* @since 1.0.0
|
|
444
|
+
* @category Predicates
|
|
445
|
+
*/
|
|
446
|
+
export const responseToStreamingSocketOrFailUnsafe: (
|
|
447
|
+
response: HttpClientResponse.HttpClientResponse
|
|
448
|
+
) => Effect.Effect<RawSocket | MultiplexedSocket, Socket.SocketError, never> =
|
|
449
|
+
internalHijack.responseToStreamingSocketOrFailUnsafe;
|
|
450
|
+
|
|
451
|
+
/**
|
|
452
|
+
* @since 1.0.0
|
|
453
|
+
* @category Conversions
|
|
454
|
+
*/
|
|
455
|
+
export const asRawChannel: <IE = never, OE = Socket.SocketError, R = never>(
|
|
456
|
+
input: EitherRawInput<IE, OE, R>
|
|
457
|
+
) => RawChannel<IE, OE, R> = internalRaw.asRawChannel;
|
|
458
|
+
|
|
459
|
+
/**
|
|
460
|
+
* @since 1.0.0
|
|
461
|
+
* @category Conversions
|
|
462
|
+
*/
|
|
463
|
+
export const asMultiplexedChannel: <IE = never, OE = Socket.SocketError, R = never>(
|
|
464
|
+
input: EitherMultiplexedInput<IE, OE, R>
|
|
465
|
+
) => MultiplexedChannel<IE, OE, R> = internalMultiplexed.asMultiplexedChannel;
|
|
466
|
+
|
|
467
|
+
/**
|
|
468
|
+
* @since 1.0.0
|
|
469
|
+
* @category Conversions
|
|
470
|
+
*/
|
|
471
|
+
export const rawToStream: <IE = never, OE = Socket.SocketError, R = never>(
|
|
472
|
+
input: EitherRawInput<IE, OE, R>
|
|
473
|
+
) => Stream.Stream<Uint8Array, IE | OE, R> = internalRaw.rawToStream;
|
|
474
|
+
|
|
475
|
+
/**
|
|
476
|
+
* @since 1.0.0
|
|
477
|
+
* @category Conversions
|
|
478
|
+
*/
|
|
479
|
+
export const multiplexedToStream: <IE = never, OE = Socket.SocketError, R = never>(
|
|
480
|
+
input: EitherMultiplexedInput<IE, OE, R>
|
|
481
|
+
) => Stream.Stream<Uint8Array, IE | OE, R> = internalMultiplexed.multiplexedToStream;
|
|
482
|
+
|
|
483
|
+
/**
|
|
484
|
+
* @since 1.0.0
|
|
485
|
+
* @category Conversions
|
|
486
|
+
*/
|
|
487
|
+
export const rawToSink: <IE = never, OE = Socket.SocketError, R = never>(
|
|
488
|
+
input: EitherRawInput<IE, OE, R>
|
|
489
|
+
) => Sink.Sink<void, string | Uint8Array | Socket.CloseEvent, Uint8Array, IE | OE, R> = internalRaw.rawToSink;
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
* @since 1.0.0
|
|
493
|
+
* @category Conversions
|
|
494
|
+
*/
|
|
495
|
+
export const multiplexedToSink: <IE = never, OE = Socket.SocketError, R = never>(
|
|
496
|
+
input: EitherMultiplexedInput<IE, OE, R>
|
|
497
|
+
) => Sink.Sink<void, string | Uint8Array | Socket.CloseEvent, Uint8Array, IE | OE, R> =
|
|
498
|
+
internalMultiplexed.multiplexedToSink;
|
|
499
|
+
|
|
500
|
+
/**
|
|
501
|
+
* @since 1.0.0
|
|
502
|
+
* @category Conversions
|
|
503
|
+
*/
|
|
504
|
+
export const rawFromStreamWith: <IE>() => <E, R>(
|
|
505
|
+
input: Stream.Stream<Uint8Array, IE | E, R>
|
|
506
|
+
) => RawChannel<IE, IE | E, R> = internalRaw.rawFromStreamWith;
|
|
507
|
+
|
|
508
|
+
/**
|
|
509
|
+
* @since 1.0.0
|
|
510
|
+
* @category Conversions
|
|
511
|
+
*/
|
|
512
|
+
export const multiplexedFromStreamWith: <IE>() => <E, R>(
|
|
513
|
+
input: Stream.Stream<Uint8Array, IE | E, R>
|
|
514
|
+
) => MultiplexedChannel<IE, IE | E, R> = internalMultiplexed.multiplexedFromStreamWith;
|
|
515
|
+
|
|
516
|
+
/**
|
|
517
|
+
* @since 1.0.0
|
|
518
|
+
* @category Conversions
|
|
519
|
+
*/
|
|
520
|
+
export const rawFromStream: <E, R>(input: Stream.Stream<Uint8Array, E, R>) => RawChannel<never, E, R> =
|
|
521
|
+
internalRaw.rawFromStream;
|
|
522
|
+
|
|
523
|
+
/**
|
|
524
|
+
* @since 1.0.0
|
|
525
|
+
* @category Conversions
|
|
526
|
+
*/
|
|
527
|
+
export const multiplexedFromStream: <E, R>(input: Stream.Stream<Uint8Array, E, R>) => MultiplexedChannel<never, E, R> =
|
|
528
|
+
internalMultiplexed.multiplexedFromStream;
|
|
529
|
+
|
|
530
|
+
/**
|
|
531
|
+
* @since 1.0.0
|
|
532
|
+
* @category Conversions
|
|
533
|
+
*/
|
|
534
|
+
export const rawFromSink: <E, R>(
|
|
535
|
+
input: Sink.Sink<void, string | Uint8Array | Socket.CloseEvent, Uint8Array, E, R>
|
|
536
|
+
) => RawChannel<never, E, R> = internalRaw.rawFromSink;
|
|
537
|
+
|
|
538
|
+
/**
|
|
539
|
+
* @since 1.0.0
|
|
540
|
+
* @category Conversions
|
|
541
|
+
*/
|
|
542
|
+
export const multiplexedFromSink: <E, R>(
|
|
543
|
+
input: Sink.Sink<void, string | Uint8Array | Socket.CloseEvent, Uint8Array, E, R>
|
|
544
|
+
) => MultiplexedChannel<never, E, R> = internalMultiplexed.multiplexedFromSink;
|
|
545
|
+
|
|
546
|
+
/**
|
|
547
|
+
* @since 1.0.0
|
|
548
|
+
* @category Conversions
|
|
549
|
+
*/
|
|
550
|
+
export const interleaveRaw: <
|
|
551
|
+
IE1 = never,
|
|
552
|
+
IE2 = never,
|
|
553
|
+
OE1 = Socket.SocketError,
|
|
554
|
+
OE2 = Socket.SocketError,
|
|
555
|
+
R1 = never,
|
|
556
|
+
R2 = never,
|
|
557
|
+
>(
|
|
558
|
+
stdout: EitherRawInput<IE1, OE1, R1>,
|
|
559
|
+
stderr: EitherRawInput<IE2, OE2, R2>
|
|
560
|
+
) => Stream.Stream<Uint8Array, IE1 | IE2 | OE1 | OE2, R1 | R2> = internalRaw.interleaveRaw;
|
|
561
|
+
|
|
562
|
+
/**
|
|
563
|
+
* @since 1.0.0
|
|
564
|
+
* @category Conversions
|
|
565
|
+
*/
|
|
566
|
+
export const mergeRawToTaggedStream: <
|
|
567
|
+
IE1 = never,
|
|
568
|
+
IE2 = never,
|
|
569
|
+
OE1 = Socket.SocketError,
|
|
570
|
+
OE2 = Socket.SocketError,
|
|
571
|
+
R1 = never,
|
|
572
|
+
R2 = never,
|
|
573
|
+
>(
|
|
574
|
+
stdout: EitherRawInput<IE1, OE1, R1>,
|
|
575
|
+
stderr: EitherRawInput<IE2, OE2, R2>,
|
|
576
|
+
options?:
|
|
577
|
+
| {
|
|
578
|
+
bufferSize?: number | undefined;
|
|
579
|
+
}
|
|
580
|
+
| undefined
|
|
581
|
+
) => Stream.Stream<
|
|
582
|
+
| {
|
|
583
|
+
_tag: "stdout";
|
|
584
|
+
value: Uint8Array;
|
|
585
|
+
}
|
|
586
|
+
| {
|
|
587
|
+
_tag: "stderr";
|
|
588
|
+
value: Uint8Array;
|
|
589
|
+
},
|
|
590
|
+
IE1 | IE2 | OE1 | OE2,
|
|
591
|
+
R1 | R2
|
|
592
|
+
> = internalRaw.mergeRawToTaggedStream;
|
|
593
|
+
|
|
594
|
+
/**
|
|
595
|
+
* Demux a raw socket. When given a raw socket of the remote process's pty,
|
|
596
|
+
* there is no way to differentiate between stdout and stderr so they are
|
|
597
|
+
* combined on the same sink.
|
|
598
|
+
*
|
|
599
|
+
* @since 1.0.0
|
|
600
|
+
* @category Demux
|
|
601
|
+
*/
|
|
602
|
+
export const demuxRawToSingleSink = internalRaw.demuxRawToSingleSink;
|
|
603
|
+
|
|
604
|
+
/**
|
|
605
|
+
* Demux multiple raw sockets, created from multiple container attach requests.
|
|
606
|
+
* If no options are provided for a given stream, it will be ignored. This is
|
|
607
|
+
* really just an Effect.all wrapper around {@link demuxRawSingleSink}.
|
|
608
|
+
*
|
|
609
|
+
* To demux a single raw socket, you should use {@link demuxRawSingleSink}
|
|
610
|
+
*
|
|
611
|
+
* @since 1.0.0
|
|
612
|
+
* @category Demux
|
|
613
|
+
*/
|
|
614
|
+
export const demuxStdioRawTupled = internalRaw.demuxStdioRawTupled;
|
|
615
|
+
|
|
616
|
+
/**
|
|
617
|
+
* Demux multiple raw sockets, created from multiple container attach requests.
|
|
618
|
+
* If no options are provided for a given stream, it will be ignored. This is
|
|
619
|
+
* really just an Effect.all wrapper around {@link demuxRawSingleSink}.
|
|
620
|
+
*
|
|
621
|
+
* To demux a single raw socket, you should use {@link demuxRawSingleSink}
|
|
622
|
+
*
|
|
623
|
+
* @since 1.0.0
|
|
624
|
+
* @category Demux
|
|
625
|
+
*/
|
|
626
|
+
export const demuxStdioRawToSingleSink = internalRaw.demuxStdioRawToSingleSink;
|
|
627
|
+
|
|
628
|
+
/**
|
|
629
|
+
* Demux multiple raw sockets, created from multiple container attach requests.
|
|
630
|
+
* If no options are provided for a given stream, it will be ignored. This is
|
|
631
|
+
* really just an Effect.all wrapper around {@link demuxRawSingleSink}.
|
|
632
|
+
*
|
|
633
|
+
* To demux a single raw socket, you should use {@link demuxRawSingleSink}
|
|
634
|
+
*
|
|
635
|
+
* @since 1.0.0
|
|
636
|
+
* @category Demux
|
|
637
|
+
*/
|
|
638
|
+
export const demuxStdioRawToSeparateSinks = internalRaw.demuxStdioRawToSeparateSinks;
|
|
639
|
+
|
|
640
|
+
/**
|
|
641
|
+
* Demux a multiplexed socket, all output goes to a single sink.
|
|
642
|
+
*
|
|
643
|
+
* @since 1.0.0
|
|
644
|
+
* @category Demux
|
|
645
|
+
*/
|
|
646
|
+
export const demuxMultiplexedToSingleSink = internalMultiplexed.demuxMultiplexedToSingleSink;
|
|
18
647
|
|
|
19
|
-
/**
|
|
20
|
-
|
|
648
|
+
/**
|
|
649
|
+
* Demux a multiplexed socket. When given a multiplexed socket, we must parse
|
|
650
|
+
* the chunks by headers and then forward each chunk based on its datatype to
|
|
651
|
+
* the correct sink.
|
|
652
|
+
*
|
|
653
|
+
* When partitioning the stream into stdout and stderr, the first sink may
|
|
654
|
+
* advance by up to bufferSize elements further than the slower one. The default
|
|
655
|
+
* bufferSize is 16.
|
|
656
|
+
*
|
|
657
|
+
* @since 1.0.0
|
|
658
|
+
* @category Demux
|
|
659
|
+
*/
|
|
660
|
+
export const demuxMultiplexedToSeparateSinks = internalMultiplexed.demuxMultiplexedToSeparateSinks;
|
|
21
661
|
|
|
22
|
-
/**
|
|
23
|
-
|
|
662
|
+
/**
|
|
663
|
+
* Demux either a raw socket or a multiplexed socket to a single sink.
|
|
664
|
+
*
|
|
665
|
+
* @since 1.0.0
|
|
666
|
+
* @category Demux
|
|
667
|
+
*/
|
|
668
|
+
export const demuxToSingleSink: {
|
|
669
|
+
// Data-last signature.
|
|
670
|
+
<A1, L1, E1, E2, R1, R2>(
|
|
671
|
+
source: Stream.Stream<string | Uint8Array, E1, R1>,
|
|
672
|
+
sink: Sink.Sink<A1, string, L1, E2, R2>,
|
|
673
|
+
options?: { encoding?: string | undefined } | undefined
|
|
674
|
+
): <IE = never, OE = Socket.SocketError, R3 = never>(
|
|
675
|
+
sockets: EitherRawInput<E1 | IE, OE, R3> | EitherMultiplexedInput<E1 | IE, OE, R3>
|
|
676
|
+
) => Effect.Effect<
|
|
677
|
+
A1,
|
|
678
|
+
E1 | E2 | IE | OE | ParseResult.ParseError,
|
|
679
|
+
Exclude<R1, Scope.Scope> | Exclude<R2, Scope.Scope> | Exclude<R3, Scope.Scope>
|
|
680
|
+
>;
|
|
681
|
+
// Data-first signature.
|
|
682
|
+
<A1, L1, E1, E2, R1, R2, IE = never, OE = Socket.SocketError, R3 = never>(
|
|
683
|
+
sockets: EitherRawInput<E1 | IE, OE, R3> | EitherMultiplexedInput<E1 | IE, OE, R3>,
|
|
684
|
+
source: Stream.Stream<string | Uint8Array, E1, R1>,
|
|
685
|
+
sink: Sink.Sink<A1, string, L1, E2, R2>,
|
|
686
|
+
options?: { encoding?: string | undefined } | undefined
|
|
687
|
+
): Effect.Effect<
|
|
688
|
+
A1,
|
|
689
|
+
E1 | E2 | IE | OE | ParseResult.ParseError,
|
|
690
|
+
Exclude<R1, Scope.Scope> | Exclude<R2, Scope.Scope> | Exclude<R3, Scope.Scope>
|
|
691
|
+
>;
|
|
692
|
+
} = internal.demuxToSingleSink;
|
|
693
|
+
|
|
694
|
+
/**
|
|
695
|
+
* @since 1.0.0
|
|
696
|
+
* @category Packing
|
|
697
|
+
*/
|
|
698
|
+
export const pack = internalPack.pack;
|
|
699
|
+
|
|
700
|
+
/**
|
|
701
|
+
* @since 1.0.0
|
|
702
|
+
* @category Fanning
|
|
703
|
+
*/
|
|
704
|
+
export const fan = internalFan.fan;
|
|
705
|
+
|
|
706
|
+
/**
|
|
707
|
+
* Demux either a raw stream socket or a multiplexed stream socket to the
|
|
708
|
+
* console. If given a raw stream socket, then stdout and stderr will be
|
|
709
|
+
* combined on the same sink. If given a multiplexed stream socket, then stdout
|
|
710
|
+
* and stderr will be forwarded to different sinks. If given multiple raw stream
|
|
711
|
+
* sockets, then you can provide different individual sockets for stdin, stdout,
|
|
712
|
+
* and stderr.
|
|
713
|
+
*
|
|
714
|
+
* If you are looking for a way to demux to stdin, stdout, and stderr instead of
|
|
715
|
+
* the console then see {@link demuxSocketFromStdinToStdoutAndStderr}.
|
|
716
|
+
*
|
|
717
|
+
* @since 1.0.0
|
|
718
|
+
* @category DemuxStdio
|
|
719
|
+
*/
|
|
720
|
+
export const demuxWithInputToConsole: <E, R1, IE = never, OE = Socket.SocketError, R2 = never>(
|
|
721
|
+
sockets: EitherMultiplexedInput<E | IE, OE, R2>,
|
|
722
|
+
input: Stream.Stream<string | Uint8Array, E, R1>,
|
|
723
|
+
options?:
|
|
724
|
+
| {
|
|
725
|
+
bufferSize?: number | undefined;
|
|
726
|
+
encoding?: string | undefined;
|
|
727
|
+
}
|
|
728
|
+
| undefined
|
|
729
|
+
) => Effect.Effect<void, E | IE | OE | ParseResult.ParseError, Exclude<R1, Scope.Scope> | Exclude<R2, Scope.Scope>> =
|
|
730
|
+
internalStdio.demuxWithInputToConsole;
|
|
731
|
+
|
|
732
|
+
/**
|
|
733
|
+
* Demux either a raw stream socket or a multiplexed stream socket from stdin to
|
|
734
|
+
* stdout and stderr. If given a raw stream socket, then stdout and stderr will
|
|
735
|
+
* be combined on the same sink. If given a multiplexed stream socket, then
|
|
736
|
+
* stdout and stderr will be forwarded to different sinks. If given multiple raw
|
|
737
|
+
* stream sockets, then you can provide different individual sockets for stdin,
|
|
738
|
+
* stdout, and stderr.
|
|
739
|
+
*
|
|
740
|
+
* If you are looking for a way to demux to the console instead of stdin,
|
|
741
|
+
* stdout, and stderr then see {@link demuxSocketWithInputToConsole}. Since we
|
|
742
|
+
* are interacting with stdin, stdout, and stderr this function dynamically
|
|
743
|
+
* imports the `@effect/platform-node` package.
|
|
744
|
+
*
|
|
745
|
+
* @since 1.0.0
|
|
746
|
+
* @category DemuxStdio
|
|
747
|
+
*/
|
|
748
|
+
export const demuxFromStdinToStdoutAndStderr: <IE = never, OE = Socket.SocketError, R = never>(
|
|
749
|
+
sockets: EitherMultiplexedInput<IE, OE, R>,
|
|
750
|
+
options?:
|
|
751
|
+
| {
|
|
752
|
+
bufferSize?: number | undefined;
|
|
753
|
+
encoding?: string | undefined;
|
|
754
|
+
}
|
|
755
|
+
| undefined
|
|
756
|
+
) => Effect.Effect<
|
|
757
|
+
void,
|
|
758
|
+
IE | OE | internalStdio.StdinError | internalStdio.StdoutError | internalStdio.StderrError | ParseResult.ParseError,
|
|
759
|
+
Exclude<R, Scope.Scope>
|
|
760
|
+
> = internalStdio.demuxFromStdinToStdoutAndStderr;
|