transferum
    Preparing search index...

    Class CompositeTransferBuilder<TCurrent, TStartTransfer>

    Unified builder for constructing composite transfers of any direction (input, output, duplex) with both sync and async transfer support.

    Purpose: Creates a composite transfer (CompositeTransfer) whose capability flags are computed from the start and finish transfers:

    • Input flags (Pushable, PollingProxy, AsyncPushable, AsyncPollingProxy) — from the start transfer.
    • Output flags (Pullable, Subscribable, AsyncPullable) — from the finish transfer.
    • Triggerable, AsyncTriggerable, Gate — from explicit options or auto-extracted.

    Pipeline structure: OutputTransfer [→ DuplexTransfer → …] → InputTransfer │ │ │ └─ start() └─ to() └─ finish()

    Where:

    • start() accepts an OutputTransfer (must produce data to continue the chain).
    • to() accepts a DuplexTransfer (must relay data to the next link).
    • finish() accepts an InputTransfer (must consume data to terminate the chain).

    If the start transfer is also an InputTransfer (i.e. duplex), the composite exposes input capabilities. If the finish transfer is also an OutputTransfer (i.e. duplex), the composite exposes output capabilities. This naturally covers all three cases (input-only, output-only, full-duplex) without separate builder classes.

    Sync and async are unified: onLinkError in finish() options enables async error handling when the chain contains async transfers.

    Linking is performed via a LinkStrategyInterface (defaults to DefaultLinkStrategy when no link strategy is provided). Pass a custom link strategy to start() to override linking behavior for the entire chain.

    const composite = CompositeTransferBuilder
    .start(new PushStoredChannelTransfer<number>())
    .to(new ConditionTransfer<number>({ shouldAccept: x => x > 0 }))
    .to(new BufferTransfer<number>())
    .finish(new SinkTransfer<number>({ callback: console.log }), { owned: true });

    composite.push(42);
    composite.destroy();
    const linkStrategy = new DefaultLinkStrategy();
    const composite = CompositeTransferBuilder
    .start(new PushStoredChannelTransfer<number>(), { linkStrategy })
    .to(new ConditionTransfer<number>({ shouldAccept: x => x > 0 }))
    .finish(new SinkTransfer<number>({ callback: console.log }));

    Type Parameters

    • TCurrent

      — data type flowing through the current chain link

    • TStartTransfer extends OutputTransfer<unknown>

      — type of the initial transfer (must be OutputTransfer)

    Implements

    Index