UNPKG

the-moby-effect

Version:
307 lines (305 loc) 12.5 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.responseToStreamingSocketOrFailUnsafe = exports.responseIsRawResponse = exports.responseIsMultiplexedResponse = exports.rawToStream = exports.rawToSink = exports.rawFromStreamWith = exports.rawFromStream = exports.rawFromSink = exports.pack = exports.multiplexedToStream = exports.multiplexedToSink = exports.multiplexedFromStreamWith = exports.multiplexedFromStream = exports.multiplexedFromSink = exports.mergeRawToTaggedStream = exports.makeRawSocket = exports.makeRawChannel = exports.makeMultiplexedSocket = exports.makeMultiplexedChannel = exports.isRawSocket = exports.isRawChannel = exports.isMultiplexedSocket = exports.isMultiplexedChannel = exports.interleaveRaw = exports.hijackResponseUnsafe = exports.fan = exports.demuxWithInputToConsole = exports.demuxToSingleSink = exports.demuxStdioRawTupled = exports.demuxStdioRawToSingleSink = exports.demuxStdioRawToSeparateSinks = exports.demuxRawToSingleSink = exports.demuxMultiplexedToSingleSink = exports.demuxMultiplexedToSeparateSinks = exports.demuxFromStdinToStdoutAndStderr = exports.asRawChannel = exports.asMultiplexedChannel = exports.RawSocketTypeId = exports.RawContentType = exports.RawChannelTypeId = exports.MultiplexedSocketTypeId = exports.MultiplexedContentType = exports.MultiplexedChannelTypeId = void 0; var internal = _interopRequireWildcard(require("./internal/demux/demux.js")); var internalFan = _interopRequireWildcard(require("./internal/demux/fan.js")); var internalHijack = _interopRequireWildcard(require("./internal/demux/hijack.js")); var internalMultiplexed = _interopRequireWildcard(require("./internal/demux/multiplexed.js")); var internalPack = _interopRequireWildcard(require("./internal/demux/pack.js")); var internalRaw = _interopRequireWildcard(require("./internal/demux/raw.js")); var internalStdio = _interopRequireWildcard(require("./internal/demux/stdio.js")); function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); } function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } /** * Demux utilities for different types of docker streams. * * @since 1.0.0 */ /** * @since 1.0.0 * @category Types */ const RawContentType = exports.RawContentType = internalRaw.RawContentType; /** * @since 1.0.0 * @category Types */ const MultiplexedContentType = exports.MultiplexedContentType = internalMultiplexed.MultiplexedContentType; /** * @since 1.0.0 * @category Type ids */ const RawSocketTypeId = exports.RawSocketTypeId = internalRaw.RawSocketTypeId; /** * @since 1.0.0 * @category Type ids */ const RawChannelTypeId = exports.RawChannelTypeId = internalRaw.RawChannelTypeId; /** * @since 1.0.0 * @category Type ids */ const MultiplexedSocketTypeId = exports.MultiplexedSocketTypeId = internalMultiplexed.MultiplexedSocketTypeId; /** * @since 1.0.0 * @category Type ids */ const MultiplexedChannelTypeId = exports.MultiplexedChannelTypeId = internalMultiplexed.MultiplexedChannelTypeId; /** * @since 1.0.0 * @category Constructors */ const makeRawSocket = exports.makeRawSocket = internalRaw.makeRawSocket; /** * @since 1.0.0 * @category Constructors */ const makeRawChannel = exports.makeRawChannel = internalRaw.makeRawChannel; /** * @since 1.0.0 * @category Constructors */ const makeMultiplexedSocket = exports.makeMultiplexedSocket = internalMultiplexed.makeMultiplexedSocket; /** * @since 1.0.0 * @category Constructors */ const makeMultiplexedChannel = exports.makeMultiplexedChannel = internalMultiplexed.makeMultiplexedChannel; /** * @since 1.0.0 * @category Predicates */ const isRawSocket = exports.isRawSocket = internalRaw.isRawSocket; /** * @since 1.0.0 * @category Predicates */ const isRawChannel = exports.isRawChannel = internalRaw.isRawChannel; /** * @since 1.0.0 * @category Predicates */ const isMultiplexedSocket = exports.isMultiplexedSocket = internalMultiplexed.isMultiplexedSocket; /** * @since 1.0.0 * @category Predicates */ const isMultiplexedChannel = exports.isMultiplexedChannel = internalMultiplexed.isMultiplexedChannel; /** * @since 1.0.0 * @category Predicates */ const responseIsRawResponse = exports.responseIsRawResponse = internalRaw.responseIsRawResponse; /** * @since 1.0.0 * @category Predicates */ const responseIsMultiplexedResponse = exports.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 */ const hijackResponseUnsafe = exports.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 */ const responseToStreamingSocketOrFailUnsafe = exports.responseToStreamingSocketOrFailUnsafe = internalHijack.responseToStreamingSocketOrFailUnsafe; /** * @since 1.0.0 * @category Conversions */ const asRawChannel = exports.asRawChannel = internalRaw.asRawChannel; /** * @since 1.0.0 * @category Conversions */ const asMultiplexedChannel = exports.asMultiplexedChannel = internalMultiplexed.asMultiplexedChannel; /** * @since 1.0.0 * @category Conversions */ const rawToStream = exports.rawToStream = internalRaw.rawToStream; /** * @since 1.0.0 * @category Conversions */ const multiplexedToStream = exports.multiplexedToStream = internalMultiplexed.multiplexedToStream; /** * @since 1.0.0 * @category Conversions */ const rawToSink = exports.rawToSink = internalRaw.rawToSink; /** * @since 1.0.0 * @category Conversions */ const multiplexedToSink = exports.multiplexedToSink = internalMultiplexed.multiplexedToSink; /** * @since 1.0.0 * @category Conversions */ const rawFromStreamWith = exports.rawFromStreamWith = internalRaw.rawFromStreamWith; /** * @since 1.0.0 * @category Conversions */ const multiplexedFromStreamWith = exports.multiplexedFromStreamWith = internalMultiplexed.multiplexedFromStreamWith; /** * @since 1.0.0 * @category Conversions */ const rawFromStream = exports.rawFromStream = internalRaw.rawFromStream; /** * @since 1.0.0 * @category Conversions */ const multiplexedFromStream = exports.multiplexedFromStream = internalMultiplexed.multiplexedFromStream; /** * @since 1.0.0 * @category Conversions */ const rawFromSink = exports.rawFromSink = internalRaw.rawFromSink; /** * @since 1.0.0 * @category Conversions */ const multiplexedFromSink = exports.multiplexedFromSink = internalMultiplexed.multiplexedFromSink; /** * @since 1.0.0 * @category Conversions */ const interleaveRaw = exports.interleaveRaw = internalRaw.interleaveRaw; /** * @since 1.0.0 * @category Conversions */ const mergeRawToTaggedStream = exports.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 */ const demuxRawToSingleSink = exports.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 */ const demuxStdioRawTupled = exports.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 */ const demuxStdioRawToSingleSink = exports.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 */ const demuxStdioRawToSeparateSinks = exports.demuxStdioRawToSeparateSinks = internalRaw.demuxStdioRawToSeparateSinks; /** * Demux a multiplexed socket, all output goes to a single sink. * * @since 1.0.0 * @category Demux */ const demuxMultiplexedToSingleSink = exports.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 */ const demuxMultiplexedToSeparateSinks = exports.demuxMultiplexedToSeparateSinks = internalMultiplexed.demuxMultiplexedToSeparateSinks; /** * Demux either a raw socket or a multiplexed socket to a single sink. * * @since 1.0.0 * @category Demux */ const demuxToSingleSink = exports.demuxToSingleSink = internal.demuxToSingleSink; /** * @since 1.0.0 * @category Packing */ const pack = exports.pack = internalPack.pack; /** * @since 1.0.0 * @category Fanning */ const fan = exports.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 */ const demuxWithInputToConsole = exports.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 */ const demuxFromStdinToStdoutAndStderr = exports.demuxFromStdinToStdoutAndStderr = internalStdio.demuxFromStdinToStdoutAndStderr; //# sourceMappingURL=MobyDemux.js.map