Skip to content
API/IRequestStrategy

IRequestStrategy

src/interfaces/request-strategy.interface.ts3 public methodsinterface

Strategy interface for building request URIs

Each driver implements this interface to produce URIs in the format expected by the corresponding backend.

Property Type Description
capabilities StrategyCapabilities Capability flags declared by this driver Read by NgQubeeService to gate feature methods (e.g. addFilter) without hardcoding DriverEnum checks. Each strategy returns a static, immutable capability map.
buildPaginationHeaders(state: QueryBuilderState): Record<string, string> | null

Compute HTTP request headers carrying pagination metadata

Honoured only by drivers that support header-based pagination (the PostgREST driver configured with PaginationModeEnum.RANGE). All other drivers should return null — which is also the default when a driver does not override this method.

When the method returns a non-null object, NgQubeeService.buildUri is expected to have already omitted URL-level pagination params for that request; the consumer then merges these headers into the HTTP call so the server knows the requested range.

Parameter Type Description
state QueryBuilderState The current query builder state

Returns — A map of header name → value, or null when not applicable

buildUri(state: QueryBuilderState, options: QueryBuilderOptions): string

Build a URI string from the given query builder state

Parameter Type Description
state QueryBuilderState The current query builder state
options QueryBuilderOptions The query parameter key name configuration

Returns — The composed URI string

validateLimit(limit: number): void

Assert that the given limit value is valid for this driver

Validation is driver-scoped because the accepted range differs by backend: nestjs-paginate treats -1 as a “fetch all” sentinel, while other backends (Laravel, Spatie, JSON:API) require a positive integer.

Parameter Type Description
limit number The limit value to validate