Interface IMaterializedView<S, E>

Materialized view interface is using/delegating a IView to handle events of type E and to maintain a state of projection(s) via ViewStateRepository as a result. Essentially, it represents the query/view side of the CQRS pattern.

Author

Иван Дугалић / Ivan Dugalic /

Idugalic

interface IMaterializedView {
    evolve: ((s, e) => S);
    fetchState: ((e) => Promise<null | S>);
    handle: ((event) => Promise<S>);
    initialState: S;
    save: ((s) => Promise<S>);
}

Type Parameters

  • S

    Materialized IView state of type S

  • E

    Events of type E that are handled by this Materialized View

Hierarchy

Implemented by

Properties

evolve: ((s, e) => S)

Type declaration

    • (s, e): S
    • Parameters

      • s: S
      • e: E

      Returns S

fetchState: ((e) => Promise<null | S>)

Type declaration

    • (e): Promise<null | S>
    • Fetch state

      Parameters

      • e: E

        Event of type E

      Returns Promise<null | S>

      current state of type S

handle: ((event) => Promise<S>)

Type declaration

    • (event): Promise<S>
    • Handles the event of type E, and returns new persisted state of type S

      Parameters

      • event: E

        Event of type E to be handled

      Returns Promise<S>

      State of type S

initialState: S
save: ((s) => Promise<S>)

Type declaration

    • (s): Promise<S>
    • Save state

      Parameters

      • s: S

        State of type S

      Returns Promise<S>

      newly saved State of type S

Generated using TypeDoc