A resource is extended component that represent the access to an external/internal resource, besides the error handling and identity, it has a start, stop and close methods to manage the resource lifecycle. It also has a checks property to define the checks that will be performed over the resource to achieve the resulted status. The most typical example of a resource are the Provider that allow to access to external databases, message brokers, etc.

Hierarchy

  • EventEmitter
    • Watcher

Implements

Constructors

Accessors

Methods

Events

Constructors

Accessors

  • get componentId(): string
  • Get the component identifier

    Returns string

  • get errors(): string[]
  • Get the error stack

    Returns string[]

  • get name(): string
  • Get the name of the watcher

    Returns string

  • get status(): "pass" | "fail" | "warn"
  • Get the status of the watcher

    Returns "pass" | "fail" | "warn"

Methods

  • Close the watcher

    Returns Promise<void>

  • Start the watcher

    Returns Promise<void>

  • Stop the watcher

    Returns Promise<void>

Events

  • Add a listener for the error event, emitted when the component detects an error.

    Parameters

    • event: "error"

      error event

    • listener: (error: Crash | Multi | Error) => void

      Error event listener

    Returns this

  • Add a listener for the status event, emitted when the component status changes.

    Parameters

    • event: "status"

      status event

    • listener: (status: "pass" | "fail" | "warn") => void

      Status event listener

    Returns this

  • Add a listener for the add event, emitted when a file is added.

    Parameters

    • event: "add"

      add event

    • listener: (path: string) => void

      Add event listener

    Returns this