Class ActorDereferenceBase<I, T, O>Abstract

A base actor for dereferencing URLs to (generic) streams.

Actor types:

  • Input: IActionDereference: A URL.
  • Test:
  • Output: IActorDereferenceOutput: A Readable stream

See

  • IActionDereference
  • IActorDereferenceOutput

Type Parameters

Hierarchy (view full)

Constructors

Properties

beforeActors: Actor<I, T, O>[] = []

Actor that must be registered in the bus before this actor.

bus: Bus<Actor<I, T, O>, I, T, O>

The bus this actor subscribes to.

name: string

The name for this actor.

Default

{<rdf:subject>}

Methods

  • Deinitialize this actor. This should be used for cleaning up things when the application is shut down, such as closing files and removing temporary files.

    Returns Promise<any>

    A promise that resolves when the actor has been deinitialized.

  • Handle the given error as a rejection or delegate it to the logger, depending on whether or not hard errors are enabled.

    Type Parameters

    • N
    • M extends Readable

    Parameters

    • action: I

      An action.

    • error: unknown

      An error that has occurred.

    • output: N

      Data to add to the output

    Returns Promise<N & {
        data: M;
    }>

  • Initialize this actor. This should be used for doing things that take a while, such as opening files.

    Returns Promise<any>

    A promise that resolves when the actor has been initialized.

  • Run the given action on this actor.

    In most cases, this method should not be called directly. Instead, #runObservable should be called.

    Parameters

    • action: I

      The action to run.

    Returns Promise<O>

    A promise that resolves to the run result.

  • Run the given action on this actor AND invokes the Bus#onRun method.

    Parameters

    • action: I

      The action to run.

    Returns Promise<O>

    A promise that resolves to the run result.

  • Check if this actor can run the given action, without actually running it.

    Parameters

    • action: I

      The action to test.

    Returns Promise<T>

    A promise that resolves to the test result.