Interface EventLockingRepository<C, E, V>

Event Locking repository interface

Author

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

Idugalic

interface EventLockingRepository {
    fetchEvents: ((c) => Promise<readonly (readonly [E, V])[]>);
    latestVersionProvider: LatestVersionProvider<E, V>;
    save: ((e, latestVersion) => Promise<readonly [E, V]>);
    saveAll: ((eList, latestVersion) => Promise<readonly (readonly [E, V])[]>);
    saveAllByLatestVersionProvided: ((eList, latestVersionProvider) => Promise<readonly (readonly [E, V])[]>);
    saveByLatestVersionProvided: ((e, latestVersionProvider) => Promise<readonly [E, V]>);
}

Type Parameters

  • C

    Command

  • E

    Event

  • V

    Version

Hierarchy

Properties

fetchEvents: ((c) => Promise<readonly (readonly [E, V])[]>)

Type declaration

    • (c): Promise<readonly (readonly [E, V])[]>
    • Fetch events

      Parameters

      • c: C

        Command of type C

      Returns Promise<readonly (readonly [E, V])[]>

      list of pairs of Event and Version

latestVersionProvider: LatestVersionProvider<E, V>

The latest event stream version provider

save: ((e, latestVersion) => Promise<readonly [E, V]>)

Type declaration

    • (e, latestVersion): Promise<readonly [E, V]>
    • Save event

      Parameters

      • e: E

        Event of type E

      • latestVersion: null | V

        Latest Event in this stream and its Version

      Returns Promise<readonly [E, V]>

      a pair of newly saved Event of type E and its Version of type V

saveAll: ((eList, latestVersion) => Promise<readonly (readonly [E, V])[]>)

Type declaration

    • (eList, latestVersion): Promise<readonly (readonly [E, V])[]>
    • Save events

      Parameters

      • eList: readonly E[]

        list of Events of type E

      • latestVersion: null | V

        Latest Event in this stream and its Version

      Returns Promise<readonly (readonly [E, V])[]>

      a list of pairs of newly saved Event of type E and its Version of type V

saveAllByLatestVersionProvided: ((eList, latestVersionProvider) => Promise<readonly (readonly [E, V])[]>)

Type declaration

    • (eList, latestVersionProvider): Promise<readonly (readonly [E, V])[]>
    • Save events

      Parameters

      • eList: readonly E[]

        list of Events of type E

      • latestVersionProvider: LatestVersionProvider<E, V>

        A provider for the Latest Event in this stream and its Version

      Returns Promise<readonly (readonly [E, V])[]>

      a list of pairs of newly saved Event of type E and its Version of type V

saveByLatestVersionProvided: ((e, latestVersionProvider) => Promise<readonly [E, V]>)

Type declaration

    • (e, latestVersionProvider): Promise<readonly [E, V]>
    • Save event

      Parameters

      • e: E

        Event of type E

      • latestVersionProvider: LatestVersionProvider<E, V>

        A provider for the Latest Event in this stream and its Version

      Returns Promise<readonly [E, V]>

      a pair of newly saved Event of type E and its Version of type V

Generated using TypeDoc