UNPKG

the-moby-effect

Version:
298 lines 9.2 kB
/** * Demux utilities for different types of docker streams. * * @since 1.0.0 */ import * as internal from "./internal/demux/demux.js"; import * as internalFan from "./internal/demux/fan.js"; import * as internalHijack from "./internal/demux/hijack.js"; import * as internalMultiplexed from "./internal/demux/multiplexed.js"; import * as internalPack from "./internal/demux/pack.js"; import * as internalRaw from "./internal/demux/raw.js"; import * as internalStdio from "./internal/demux/stdio.js"; /** * @since 1.0.0 * @category Types */ export const RawContentType = internalRaw.RawContentType; /** * @since 1.0.0 * @category Types */ export const MultiplexedContentType = internalMultiplexed.MultiplexedContentType; /** * @since 1.0.0 * @category Type ids */ export const RawSocketTypeId = internalRaw.RawSocketTypeId; /** * @since 1.0.0 * @category Type ids */ export const RawChannelTypeId = internalRaw.RawChannelTypeId; /** * @since 1.0.0 * @category Type ids */ export const MultiplexedSocketTypeId = internalMultiplexed.MultiplexedSocketTypeId; /** * @since 1.0.0 * @category Type ids */ export const MultiplexedChannelTypeId = internalMultiplexed.MultiplexedChannelTypeId; /** * @since 1.0.0 * @category Constructors */ export const makeRawSocket = internalRaw.makeRawSocket; /** * @since 1.0.0 * @category Constructors */ export const makeRawChannel = internalRaw.makeRawChannel; /** * @since 1.0.0 * @category Constructors */ export const makeMultiplexedSocket = internalMultiplexed.makeMultiplexedSocket; /** * @since 1.0.0 * @category Constructors */ export const makeMultiplexedChannel = internalMultiplexed.makeMultiplexedChannel; /** * @since 1.0.0 * @category Predicates */ export const isRawSocket = internalRaw.isRawSocket; /** * @since 1.0.0 * @category Predicates */ export const isRawChannel = internalRaw.isRawChannel; /** * @since 1.0.0 * @category Predicates */ export const isMultiplexedSocket = internalMultiplexed.isMultiplexedSocket; /** * @since 1.0.0 * @category Predicates */ export const isMultiplexedChannel = internalMultiplexed.isMultiplexedChannel; /** * @since 1.0.0 * @category Predicates */ export const responseIsRawResponse = internalRaw.responseIsRawResponse; /** * @since 1.0.0 * @category Predicates */ export const responseIsMultiplexedResponse = internalMultiplexed.responseIsMultiplexedResponse; /** * Hijacks an http response into a socket. * * FIXME: this function relies on a hack to expose the underlying tcp socket * from the http client response. This will only work in NodeJs, not tested in * Bun/Deno yet, and will never work in the browser. * * @since 1.0.0 * @category Transformations */ export const hijackResponseUnsafe = internalHijack.hijackResponseUnsafe; /** * Transforms an http response into a multiplexed stream socket or a raw stream * socket. If the response is neither a multiplexed stream socket nor a raw or * can not be transformed, then an error will be returned. * * FIXME: this function relies on a hack to expose the underlying tcp socket * from the http client response. This will only work in NodeJs, not tested in * Bun/Deno yet, and will never work in the browser. * * @since 1.0.0 * @category Predicates */ export const responseToStreamingSocketOrFailUnsafe = internalHijack.responseToStreamingSocketOrFailUnsafe; /** * @since 1.0.0 * @category Conversions */ export const asRawChannel = internalRaw.asRawChannel; /** * @since 1.0.0 * @category Conversions */ export const asMultiplexedChannel = internalMultiplexed.asMultiplexedChannel; /** * @since 1.0.0 * @category Conversions */ export const rawToStream = internalRaw.rawToStream; /** * @since 1.0.0 * @category Conversions */ export const multiplexedToStream = internalMultiplexed.multiplexedToStream; /** * @since 1.0.0 * @category Conversions */ export const rawToSink = internalRaw.rawToSink; /** * @since 1.0.0 * @category Conversions */ export const multiplexedToSink = internalMultiplexed.multiplexedToSink; /** * @since 1.0.0 * @category Conversions */ export const rawFromStreamWith = internalRaw.rawFromStreamWith; /** * @since 1.0.0 * @category Conversions */ export const multiplexedFromStreamWith = internalMultiplexed.multiplexedFromStreamWith; /** * @since 1.0.0 * @category Conversions */ export const rawFromStream = internalRaw.rawFromStream; /** * @since 1.0.0 * @category Conversions */ export const multiplexedFromStream = internalMultiplexed.multiplexedFromStream; /** * @since 1.0.0 * @category Conversions */ export const rawFromSink = internalRaw.rawFromSink; /** * @since 1.0.0 * @category Conversions */ export const multiplexedFromSink = internalMultiplexed.multiplexedFromSink; /** * @since 1.0.0 * @category Conversions */ export const interleaveRaw = internalRaw.interleaveRaw; /** * @since 1.0.0 * @category Conversions */ export const mergeRawToTaggedStream = internalRaw.mergeRawToTaggedStream; /** * Demux a raw socket. When given a raw socket of the remote process's pty, * there is no way to differentiate between stdout and stderr so they are * combined on the same sink. * * @since 1.0.0 * @category Demux */ export const demuxRawToSingleSink = internalRaw.demuxRawToSingleSink; /** * Demux multiple raw sockets, created from multiple container attach requests. * If no options are provided for a given stream, it will be ignored. This is * really just an Effect.all wrapper around {@link demuxRawSingleSink}. * * To demux a single raw socket, you should use {@link demuxRawSingleSink} * * @since 1.0.0 * @category Demux */ export const demuxStdioRawTupled = internalRaw.demuxStdioRawTupled; /** * Demux multiple raw sockets, created from multiple container attach requests. * If no options are provided for a given stream, it will be ignored. This is * really just an Effect.all wrapper around {@link demuxRawSingleSink}. * * To demux a single raw socket, you should use {@link demuxRawSingleSink} * * @since 1.0.0 * @category Demux */ export const demuxStdioRawToSingleSink = internalRaw.demuxStdioRawToSingleSink; /** * Demux multiple raw sockets, created from multiple container attach requests. * If no options are provided for a given stream, it will be ignored. This is * really just an Effect.all wrapper around {@link demuxRawSingleSink}. * * To demux a single raw socket, you should use {@link demuxRawSingleSink} * * @since 1.0.0 * @category Demux */ export const demuxStdioRawToSeparateSinks = internalRaw.demuxStdioRawToSeparateSinks; /** * Demux a multiplexed socket, all output goes to a single sink. * * @since 1.0.0 * @category Demux */ export const demuxMultiplexedToSingleSink = internalMultiplexed.demuxMultiplexedToSingleSink; /** * Demux a multiplexed socket. When given a multiplexed socket, we must parse * the chunks by headers and then forward each chunk based on its datatype to * the correct sink. * * When partitioning the stream into stdout and stderr, the first sink may * advance by up to bufferSize elements further than the slower one. The default * bufferSize is 16. * * @since 1.0.0 * @category Demux */ export const demuxMultiplexedToSeparateSinks = internalMultiplexed.demuxMultiplexedToSeparateSinks; /** * Demux either a raw socket or a multiplexed socket to a single sink. * * @since 1.0.0 * @category Demux */ export const demuxToSingleSink = internal.demuxToSingleSink; /** * @since 1.0.0 * @category Packing */ export const pack = internalPack.pack; /** * @since 1.0.0 * @category Fanning */ export const fan = internalFan.fan; /** * Demux either a raw stream socket or a multiplexed stream socket to the * console. If given a raw stream socket, then stdout and stderr will be * combined on the same sink. If given a multiplexed stream socket, then stdout * and stderr will be forwarded to different sinks. If given multiple raw stream * sockets, then you can provide different individual sockets for stdin, stdout, * and stderr. * * If you are looking for a way to demux to stdin, stdout, and stderr instead of * the console then see {@link demuxSocketFromStdinToStdoutAndStderr}. * * @since 1.0.0 * @category DemuxStdio */ export const demuxWithInputToConsole = internalStdio.demuxWithInputToConsole; /** * Demux either a raw stream socket or a multiplexed stream socket from stdin to * stdout and stderr. If given a raw stream socket, then stdout and stderr will * be combined on the same sink. If given a multiplexed stream socket, then * stdout and stderr will be forwarded to different sinks. If given multiple raw * stream sockets, then you can provide different individual sockets for stdin, * stdout, and stderr. * * If you are looking for a way to demux to the console instead of stdin, * stdout, and stderr then see {@link demuxSocketWithInputToConsole}. Since we * are interacting with stdin, stdout, and stderr this function dynamically * imports the `@effect/platform-node` package. * * @since 1.0.0 * @category DemuxStdio */ export const demuxFromStdinToStdoutAndStderr = internalStdio.demuxFromStdinToStdoutAndStderr; //# sourceMappingURL=MobyDemux.js.map