transferum
    Preparing search index...

    Class UniversalCompositeTransfer<TInput, TOutput>

    Universal composite transfer — combines input and output transfers into a single duplex interface with automatic extraction of additional capabilities.

    Capabilities: depend on the provided input/output (determined dynamically via flags)

    Mechanics:

    1. The constructor accepts config with required input/output and optional:
      • triggerable?: TriggerableInterface — explicit object for trigger()
      • gate?: GateInterface — explicit object for active control
      • owned?: DisposableInterface[] — resources to clean up on destroy()
    2. Automatically extracts triggerable and gate by priority:
      • Priority 1: config.triggerable / config.gate (explicit)
      • Priority 2: config.input (if it has the corresponding flag)
      • Priority 3: config.output (if it has the corresponding flag)
    3. Delegates input/output methods:
      • push(data) → _input.push(data)
      • pull() → _output.pull()
      • subscribe(handler) → _output.subscribe(handler)
      • trigger() → _triggerable.trigger()
      • setFetcher/clearFetcher() → _input.setFetcher/clearFetcher()
      • activate/deactivate/toggle/active → _gate.*
    4. All methods check capabilities via flags before calling
    5. destroy() — cleans up all owned resources

    Triggerable/gate extraction priorities:

    • If config.triggerable is specified — it is used
    • Otherwise if config.input.isTriggerable — input is used
    • Otherwise if config.output.isTriggerable — output is used
    • Otherwise undefined (trigger() will throw an error)

    Configuration (CompositeTransferConfig):

    • input: InputTransfer — input transfer
    • output: OutputTransfer — output transfer
    • triggerable?: TriggerableInterface — explicit triggerable (optional)
    • gate?: GateInterface — explicit gate (optional)
    • owned?: DisposableInterface[] — managed resources (optional)

    Use cases:

    • Composing separate input and output transfers into a single interface
    • Adapting legacy transfers to the new flag-based architecture
    • Building complex pipelines with automatic capability management
    • Encapsulating multiple resources into a single managed object
    // Basic usage with automatic extraction
    const transfer = new PushStoredChannelTransfer<number>();
    const composite = new UniversalCompositeTransfer({
    input: transfer,
    output: transfer,
    owned: [transfer],
    });

    composite.push(42);
    // Delegates input.push()

    composite.subscribe(console.log);
    // Delegates output.subscribe()

    composite.trigger();
    // Delegates triggerable.trigger()

    composite.destroy();
    // Cleans up owned resources
    // Explicit triggerable and gate
    const input = new PushChannelTransfer<number>();
    const output = new PushChannelTransfer<number>();
    const gate = new GateTransfer<number>({ activated: true, initialValue: 0 });
    const composite = new UniversalCompositeTransfer({
    input,
    output,
    gate, // Explicitly specify gate
    owned: [gate],
    });

    Type Parameters

    • TInput
    • TOutput

    Implements

    Index
    • get active(): boolean

      Checks the gate state (active/inactive).

      Returns boolean

      true if the gate is active

      Error if _gate === undefined (isGate === false)