NgQubeeService
ArchivedThese are the docs for ng-qubee 3.8. Read the 4.0 docs for @qubeejs/angular.
Defined in: src/lib/services/ng-qubee.service.ts:36
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new NgQubeeService(
_nestService,requestStrategy,driver,options?):NgQubeeService
Defined in: src/lib/services/ng-qubee.service.ts:65
Parameters
Section titled “Parameters”_nestService
Section titled “_nestService”NestService
requestStrategy
Section titled “requestStrategy”driver
Section titled “driver”options?
Section titled “options?”QueryBuilderOptions = ...
Returns
Section titled “Returns”NgQubeeService
Properties
Section titled “Properties”uri$:
Observable<string>
Defined in: src/lib/services/ng-qubee.service.ts:61
Observable that emits non-empty generated URIs
Methods
Section titled “Methods”addEmbedded()
Section titled “addEmbedded()”addEmbedded(
relation, …columns):this
Defined in: src/lib/services/ng-qubee.service.ts:115
Add an embedded resource to the select statement (PostgREST only)
Splices relation(col1,col2) into the single select= query
parameter alongside flat columns from addSelect. Omit the columns
to project all of them (relation(*)):
qb.addEmbedded('author', 'id', 'name') .addEmbedded('comments') .addSelect('title');// → select=title,author(id,name),comments(*)Calling repeatedly with the same relation merge-dedups the columns. Does not reset the page (column shape change, not record-set change).
Parameters
Section titled “Parameters”relation
Section titled “relation”string
The related table / foreign-key name as PostgREST sees it
columns
Section titled “columns”…string[]
Optional column projection; omit for relation(*)
Returns
Section titled “Returns”this
Throws
Section titled “Throws”If the active driver does not support embedded resources
addFields()
Section titled “addFields()”addFields(
model,fields):this
Defined in: src/lib/services/ng-qubee.service.ts:131
Add fields to the select statement for the given model (JSON:API and Spatie only)
Parameters
Section titled “Parameters”string
Model that holds the fields
fields
Section titled “fields”string[]
Fields to select
Returns
Section titled “Returns”this
Throws
Section titled “Throws”If the active driver does not support per-model field selection
addFilter()
Section titled “addFilter()”addFilter(
field, …values):this
Defined in: src/lib/services/ng-qubee.service.ts:153
Add a filter with the given value(s) (JSON:API, NestJS, PostgREST, and Spatie)
Produces: filter[field]=value (JSON:API / Spatie) or filter.field=value (NestJS)
Parameters
Section titled “Parameters”string
Name of the field to filter
values
Section titled “values”…(string | number | boolean)[]
The needle(s)
Returns
Section titled “Returns”this
Throws
Section titled “Throws”If the active driver does not support filters
addFilterOperator()
Section titled “addFilterOperator()”addFilterOperator(
field,operator, …values):this
Defined in: src/lib/services/ng-qubee.service.ts:179
Add a filter with an explicit operator (NestJS and PostgREST)
Produces: filter.field=$operator:value
Parameters
Section titled “Parameters”string
Name of the field to filter
operator
Section titled “operator”The filter operator to apply
values
Section titled “values”…(string | number | boolean)[]
The value(s) for the filter
Returns
Section titled “Returns”this
Throws
Section titled “Throws”If the active driver does not support filter operators
addIncludes()
Section titled “addIncludes()”addIncludes(…
models):this
Defined in: src/lib/services/ng-qubee.service.ts:199
Add related entities to include in the request (JSON:API and Spatie only)
Parameters
Section titled “Parameters”models
Section titled “models”…string[]
Models to include
Returns
Section titled “Returns”this
Throws
Section titled “Throws”If the active driver does not support includes
addSelect()
Section titled “addSelect()”addSelect(…
fields):this
Defined in: src/lib/services/ng-qubee.service.ts:220
Add flat field selection (NestJS and PostgREST)
Produces: select=col1,col2
Parameters
Section titled “Parameters”fields
Section titled “fields”…string[]
Fields to select
Returns
Section titled “Returns”this
Throws
Section titled “Throws”If the active driver does not support flat field selection
addSort()
Section titled “addSort()”addSort(
field,order):this
Defined in: src/lib/services/ng-qubee.service.ts:240
Add a field with a sort criteria (JSON:API, NestJS, PostgREST, and Spatie)
Parameters
Section titled “Parameters”string
Field to use for sorting
A value from the SortEnum enumeration
Returns
Section titled “Returns”this
Throws
Section titled “Throws”If the active driver does not support sorts
currentPage()
Section titled “currentPage()”currentPage():
number
Defined in: src/lib/services/ng-qubee.service.ts:258
Get the current page number
Returns
Section titled “Returns”number
The current page number
Remarks
Section titled “Remarks”Always safe to call. Thin accessor over the internal state’s page field.
deleteEmbedded()
Section titled “deleteEmbedded()”deleteEmbedded(…
relations):this
Defined in: src/lib/services/ng-qubee.service.ts:271
Remove embedded resources from the current query builder state (PostgREST only)
Removes the whole relation entry, columns included.
Parameters
Section titled “Parameters”relations
Section titled “relations”…string[]
Relation names to remove
Returns
Section titled “Returns”this
Throws
Section titled “Throws”If the active driver does not support embedded resources
deleteFields()
Section titled “deleteFields()”deleteFields(
fields):this
Defined in: src/lib/services/ng-qubee.service.ts:297
Delete selected fields for the given models in the current query builder state (JSON:API and Spatie only)
ngQubeeService.deleteFields({ users: ['email', 'password'], address: ['zipcode']});Parameters
Section titled “Parameters”fields
Section titled “fields”Object mapping model names to field arrays to remove
Returns
Section titled “Returns”this
Throws
Section titled “Throws”If the active driver does not support per-model field selection
deleteFieldsByModel()
Section titled “deleteFieldsByModel()”deleteFieldsByModel(
model, …fields):this
Defined in: src/lib/services/ng-qubee.service.ts:316
Delete selected fields for the given model in the current query builder state (JSON:API and Spatie only)
ngQubeeService.deleteFieldsByModel('users', 'email', 'password');Parameters
Section titled “Parameters”string
Model that holds the fields
fields
Section titled “fields”…string[]
Fields to delete from the state
Returns
Section titled “Returns”this
Throws
Section titled “Throws”If the active driver does not support per-model field selection
deleteFilters()
Section titled “deleteFilters()”deleteFilters(…
filters):this
Defined in: src/lib/services/ng-qubee.service.ts:337
Remove given filters from the query builder state (JSON:API, NestJS, PostgREST, and Spatie)
Parameters
Section titled “Parameters”filters
Section titled “filters”…string[]
Filters to remove
Returns
Section titled “Returns”this
Throws
Section titled “Throws”If the active driver does not support filters
deleteIncludes()
Section titled “deleteIncludes()”deleteIncludes(…
includes):this
Defined in: src/lib/services/ng-qubee.service.ts:357
Remove selected related models from the query builder state (JSON:API and Spatie only)
Parameters
Section titled “Parameters”includes
Section titled “includes”…string[]
Models to remove
Returns
Section titled “Returns”this
Throws
Section titled “Throws”If the active driver does not support includes
deleteOperatorFilters()
Section titled “deleteOperatorFilters()”deleteOperatorFilters(…
fields):this
Defined in: src/lib/services/ng-qubee.service.ts:376
Remove operator filters by field name (NestJS and PostgREST)
Parameters
Section titled “Parameters”fields
Section titled “fields”…string[]
Field names of operator filters to remove
Returns
Section titled “Returns”this
Throws
Section titled “Throws”If the active driver does not support filter operators
deleteSearch()
Section titled “deleteSearch()”deleteSearch():
this
Defined in: src/lib/services/ng-qubee.service.ts:395
Remove search term from the query builder state (NestJS only)
Returns
Section titled “Returns”this
Throws
Section titled “Throws”If the active driver does not support search
deleteSelect()
Section titled “deleteSelect()”deleteSelect(…
fields):this
Defined in: src/lib/services/ng-qubee.service.ts:410
Remove flat field selections from the query builder state (NestJS and PostgREST)
Parameters
Section titled “Parameters”fields
Section titled “fields”…string[]
Fields to remove from selection
Returns
Section titled “Returns”this
Throws
Section titled “Throws”If the active driver does not support flat field selection
deleteSorts()
Section titled “deleteSorts()”deleteSorts(…
sorts):this
Defined in: src/lib/services/ng-qubee.service.ts:429
Remove sort rules from the query builder state (JSON:API, NestJS, PostgREST, and Spatie)
Parameters
Section titled “Parameters”…string[]
Fields used for sorting to remove
Returns
Section titled “Returns”this
Throws
Section titled “Throws”If the active driver does not support sorts
firstPage()
Section titled “firstPage()”firstPage():
this
Defined in: src/lib/services/ng-qubee.service.ts:443
Navigate to the first page (page 1)
Returns
Section titled “Returns”this
Remarks
Section titled “Remarks”Never throws. Idempotent when already on page 1.
generateUri()
Section titled “generateUri()”generateUri():
Observable<string>
Defined in: src/lib/services/ng-qubee.service.ts:454
Generate a URI accordingly to the given data and active driver
Returns
Section titled “Returns”Observable<string>
An observable that emits the generated URI
goToPage()
Section titled “goToPage()”goToPage(
n):this
Defined in: src/lib/services/ng-qubee.service.ts:474
Navigate directly to the specified page
Validates integer/positive via the existing setPage path, and
additionally rejects values that exceed state.lastPage when
pagination bounds are known.
Parameters
Section titled “Parameters”number
Target page number
Returns
Section titled “Returns”this
Throws
Section titled “Throws”If n is not a positive integer, or if n > state.lastPage when state.isLastPageKnown is true
hasNextPage()
Section titled “hasNextPage()”hasNextPage():
boolean
Defined in: src/lib/services/ng-qubee.service.ts:492
Check whether a next page exists
Returns
Section titled “Returns”boolean
true if state.page < state.lastPage when bounds are known, or true when bounds are unknown
Remarks
Section titled “Remarks”Template-safe. Returns true when pagination bounds are unknown (conservative default — keeps a “Next” button enabled before the first paginate() call).
hasPreviousPage()
Section titled “hasPreviousPage()”hasPreviousPage():
boolean
Defined in: src/lib/services/ng-qubee.service.ts:504
Check whether a previous page exists
Returns
Section titled “Returns”boolean
true if state.page > 1
Remarks
Section titled “Remarks”Always safe. Does not require a synced paginated response.
isFirstPage()
Section titled “isFirstPage()”isFirstPage():
boolean
Defined in: src/lib/services/ng-qubee.service.ts:514
Check whether the current page is the first page
Returns
Section titled “Returns”boolean
true if state.page === 1
Remarks
Section titled “Remarks”Always safe. Does not require a synced paginated response.
isLastPage()
Section titled “isLastPage()”isLastPage():
boolean
Defined in: src/lib/services/ng-qubee.service.ts:524
Check whether the current page is the last page
Returns
Section titled “Returns”boolean
true only when state.isLastPageKnown and state.page === state.lastPage
Remarks
Section titled “Remarks”Template-safe. Returns false when pagination bounds are unknown (no paginated response has been synced yet) — keeps “Next” navigation unblocked until the first paginate() call syncs.
lastPage()
Section titled “lastPage()”lastPage():
this
Defined in: src/lib/services/ng-qubee.service.ts:537
Navigate to the last page known from the most recent paginated response
Returns
Section titled “Returns”this
Remarks
Section titled “Remarks”Requires at least one PaginationService.paginate() call to have synced state.lastPage. Before that, the bound is unknown and this method throws.
Throws
Section titled “Throws”If state.isLastPageKnown is false (no paginated response has been synced yet)
nextPage()
Section titled “nextPage()”nextPage():
this
Defined in: src/lib/services/ng-qubee.service.ts:555
Navigate to the next page
Returns
Section titled “Returns”this
Remarks
Section titled “Remarks”Never throws. Idempotent at the known last page (no-op). Pair with hasNextPage() for a disable-state binding.
paginationHeaders()
Section titled “paginationHeaders()”paginationHeaders():
Record<string,string> |null
Defined in: src/lib/services/ng-qubee.service.ts:579
HTTP request headers the active driver wants the consumer to apply
Returns null for drivers that pass all pagination metadata on the
URL (Laravel, Spatie, JSON:API, NestJS, and PostgREST in its default
QUERY mode). Returns a map of header name → value when the active
driver uses HTTP headers instead — today, only the PostgREST driver
configured with PaginationModeEnum.RANGE, which yields
{ 'Range-Unit': 'items', 'Range': 'from-to' }.
Returns
Section titled “Returns”Record<string, string> | null
Map of headers to apply to the HTTP request, or null when not needed
previousPage()
Section titled “previousPage()”previousPage():
this
Defined in: src/lib/services/ng-qubee.service.ts:593
Navigate to the previous page
Returns
Section titled “Returns”this
Remarks
Section titled “Remarks”Never throws. Idempotent at page 1 (floored). Pair with hasPreviousPage() for a disable-state binding.
reset()
Section titled “reset()”reset():
this
Defined in: src/lib/services/ng-qubee.service.ts:610
Clear the current state and reset the Query Builder to a fresh, clean condition
Returns
Section titled “Returns”this
setBaseUrl()
Section titled “setBaseUrl()”setBaseUrl(
baseUrl):this
Defined in: src/lib/services/ng-qubee.service.ts:622
Set the base URL to use for composing the address
Parameters
Section titled “Parameters”baseUrl
Section titled “baseUrl”string
The base URL
Returns
Section titled “Returns”this
setLimit()
Section titled “setLimit()”setLimit(
limit):this
Defined in: src/lib/services/ng-qubee.service.ts:640
Set the items per page number
Validation is delegated to the active request strategy because the
accepted range is driver-specific: nestjs-paginate additionally accepts
-1 as a “fetch all” sentinel, while Laravel, Spatie, and JSON:API
require a positive integer.
Parameters
Section titled “Parameters”number
Number of items per page (or -1 to fetch all, NestJS only)
Returns
Section titled “Returns”this
Throws
Section titled “Throws”If the value is not accepted by the active driver
setPage()
Section titled “setPage()”setPage(
page):this
Defined in: src/lib/services/ng-qubee.service.ts:654
Set the page that the backend will use to paginate the result set
Parameters
Section titled “Parameters”number
Page number
Returns
Section titled “Returns”this
setResource()
Section titled “setResource()”setResource(
resource):this
Defined in: src/lib/services/ng-qubee.service.ts:666
Set the API resource to run the query against
Parameters
Section titled “Parameters”resource
Section titled “resource”string
Resource name (e.g. ‘users’ produces /users)
Returns
Section titled “Returns”this
setSearch()
Section titled “setSearch()”setSearch(
search):this
Defined in: src/lib/services/ng-qubee.service.ts:682
Set the search term for full-text search (NestJS only)
Produces: search=term
Parameters
Section titled “Parameters”search
Section titled “search”string
The search term
Returns
Section titled “Returns”this
Throws
Section titled “Throws”If the active driver does not support search
totalPages()
Section titled “totalPages()”totalPages():
number
Defined in: src/lib/services/ng-qubee.service.ts:697
Get the total number of pages reported by the most recent paginated response
Returns
Section titled “Returns”number
The last page number
Remarks
Section titled “Remarks”Throws when called before any paginate() has synced a value. For a non-throwing read in a template, read nest().isLastPageKnown first as a guard.
Throws
Section titled “Throws”If state.isLastPageKnown is false (no paginated response has been synced yet)