Options
All
  • Public
  • Public/Protected
  • All
Menu

Class StoreFetchableData<REQ, RES, CHAIN, STATE>

Reusable fetchable data implementation for the Redux store

export
template

REQ

template

RES

Type parameters

  • REQ

  • RES

  • CHAIN

  • STATE

Hierarchy

Index

Constructors

constructor

Properties

actions

actions: {}

The actions for the fetchable data

memberof

StoreFetchableData

Type declaration

  • [key: string]: any

Protected dispatchCount

dispatchCount: number = 0

The dispatch count. Used for the dispatchId

memberof

StoreFetchableData

Protected Optional fetchOptions

fetchOptions: any

name

name: string

The store section name Used to name the rootState member and postfixed to all actions

memberof

StoreFetchableData

reducer

reducer: Reducer<STATE>

The reducers for the fetchable data

memberof

StoreFetchableData

Protected Optional requestOptions

Protected url

url: string

The url to fetch the data from

Accessors

initialState

Methods

createFetchAction

  • createFetchAction(request?: Partial<REQ>, chainStarter?: string, timeout?: undefined | number, omitSessionIdDeprecated?: boolean, elevationToken?: undefined | string, serviceContext?: undefined | string, chainContext?: undefined | string): [AnyAction, Promise<RES>, Promise<CHAIN>]
  • Create a fetch action using the class request type This helper will setup and add promises for the fetch call and any chain that is triggered

    TODO: If typings provide optional-ness correctly we can remove the Partial

    NOTE: omitSessionId is deprecated but remains to not mess up parameter ordering

    memberof

    StoreFetchableData

    Parameters

    • Optional request: Partial<REQ>
    • Default value chainStarter: string = this.name
    • Optional timeout: undefined | number
    • Default value omitSessionIdDeprecated: boolean = false
    • Optional elevationToken: undefined | string
    • Optional serviceContext: undefined | string
    • Optional chainContext: undefined | string

    Returns [AnyAction, Promise<RES>, Promise<CHAIN>]

createResponseAction

  • createResponseAction(response?: RES): any
  • Create a response action using the class response type

    memberof

    StoreFetchableData

    Parameters

    • Optional response: RES

    Returns any

fetchData

  • fetchData(action: any, timeout?: undefined | number, authorisationToken?: undefined | string, endPointURL?: undefined | string): Promise<RES>
  • Retrieves the requested data from the EVA backend

    memberof

    StoreFetchableData

    Parameters

    • action: any

      The redux action

    • Optional timeout: undefined | number
    • Optional authorisationToken: undefined | string
    • Optional endPointURL: undefined | string

    Returns Promise<RES>

getError$

  • getError$(): Observable<Error | null>

getPropertyState$

  • getPropertyState$(propertyPath: string | string[]): Observable<any>
  • Retrieves a specific property path from this reducers state from the root state as an observable stream

    memberof

    StoreFetchableData

    Parameters

    • propertyPath: string | string[]

    Returns Observable<any>

Protected getReducerFunctions

  • getReducerFunctions(): {}
  • The collection of reducer functions

    memberof

    StoreFetchableData

    Returns {}

    • [reducerName: string]: (state: any, action: AnyAction) => any
        • (state: any, action: AnyAction): any
        • Parameters

          • state: any
          • action: AnyAction

          Returns any

getRequest$

  • getRequest$(): Observable<REQ>

getResponse$

  • getResponse$(): Observable<RES>

getState

  • getState(): STATE

getState$

  • getState$(): Observable<STATE>
  • Retrieves section specific state from the root state as an observable stream

    memberof

    StoreFetchableData

    Returns Observable<STATE>

    The observable stream

getUrl

  • getUrl(): string

isFetching$

  • isFetching$(): Observable<boolean>
  • Returns the isFetching property as an observable stream

    memberof

    StoreFetchableData

    Returns Observable<boolean>

saga

  • saga(): Iterable<ForkEffect>

timeout

  • timeout(ms: number): Promise<any>
  • Helper method for an async-awaitable timeout

    memberof

    StoreFetchableData

    Parameters

    • ms: number

    Returns Promise<any>