RQL Store is a RestStore which uses the RQL language as query language. RQL stands for REST Query Language and is a simple filter expression language used by backend services of map.apps. E.g. AppService, AppTemplateService, ReportingService and JSRegistryBundlesServices is using this filter language. The RQLStore transforms the ComplexQueryExpressions into RQL filter expressions.

Type Parameters

  • ItemType extends {}
  • IDType extends string | number

Hierarchy (View Summary)

Constructors

Properties

accepts: string = "application/javascript, application/json"

Defines the Accept header to use on HTTP requests

filterParam: string = "filter"

The filter param transporting the query.

headers: {} = {}

Additional headers to pass in all requests to the server. These can be overridden by passing additional headers to calls to the store.

id: string = ""

The id of this store.

idProperty: string = "id"

Indicates the property to use as the identity property. The values of this property should be unique.

itemProperty: string = "items"

Identifies the item array in query responses

metadata: undefined | Partial<Metadata> = undefined

Configuration option for getMetadata method.

rangeParam: string = "range"

Range parameter transporting item range definitions.

sortParam: string = "sort"

The query parameter to used for holding sort information. If this is omitted, than the sort information is included in a functional query token to avoid colliding with the set of name/value pairs.

supportsPostSwitching: boolean = true

Flag which indicates that an switching to POST is allowed when GET requests are to long. This is true by default for backwards compatibility.

target: string = ""

The target base URL to use for all requests to the server. This string will be prepended to the id to generate the URL (relative or absolute) for requests sent to the server

totalProperty: string = "total"

Identifies the total property in query responses

_metadata: undefined | Partial<Metadata> = undefined

Property for sub classes which provide static pre-configured metadata template.

Methods

  • Adds an object. This will trigger a POST request to the server if the object has no id. If it has an id a PUT request is executed. It is much the same as the put method. You can suppress the switching to put by marking the id as undefined in the options.

    Parameters

    Returns Promise<ItemType>

    const item = { id: 1, name : "hello"};
    // this will still execute a POST request
    store.add(item, {id: undefined});
  • Gets identity of given item.

    Parameters

    • item: Partial<ItemType>

      an item of this store.

    Returns undefined | IDType

    id or undefined if no id is found.

  • Hook for subclasses to convert ComplexQueryExpression into request parameters.

    Parameters

    Returns void

  • Converts the options.start and options.count values to request parameters. By default the headers "Range" and "X-Range" are calculated and the request parameter 'range' is added. A range is an string like '5..20' == ${start}-${start+count-1}.

    Parameters

    • requestParameters: InternalRequestOptions

      request parameters will be changed

    • options: QueryOptions

      the query options, with start + count.

    Returns void

  • Converts the options.sort to request parameters. By default the sort options are converted into 'sort' request parameter, like '-id,+name,+title'.

    Parameters

    • requestParameters: InternalRequestOptions

      request parameters to change.

    • options: QueryOptions

      the query options.

    Returns void

  • Helper method which checks the query options and delegates to fetch.

    Type Parameters

    • T

    Parameters

    • method: string

      http method to execute.

    • options: InternalRequestOptions

      the request options.

    Returns Promise<T>

    result of the request.

  • Hook for sub classes to add/change request parameters.

    Parameters

    Returns InternalRequestOptions

  • Overwrite this method to provide your own metadata! The method can return Promises! Here you can implement http requests to dynamically resolve metadata.

    Returns Partial<Metadata> | Promise<Partial<Metadata>>

  • Transforms server responses into ResultItems<T>. The default implementation expects a server response of this format:

     {
    total : <count>,
    items: [...]
    }

    Parameters

    • result: Record<string, any>

      json server response

    Returns ResultItems<ItemType>

    ResultItems.