Skip to main content
Version: 3.7.0

@nestjsx/crud Driver

Targets @nestjsx/crud — the popular CRUD framework for NestJS with a pipe-delimited query convention.

Configure

import { DriverEnum, provideNgQubee } from 'ng-qubee';

bootstrapApplication(AppComponent, {
providers: [provideNgQubee({ driver: DriverEnum.NESTJSX_CRUD })]
});

Wire format

ConcernOutput
Filters (single value)filter=field||$eq||value
Filters (multi-value)filter=field||$in||v1,v2
Operator filtersfull FilterOperatorEnum mapping — see below
Sortsort=field,ASC&sort=other,DESC (repeatable)
Flat field selectionfields=col1,col2
Joinsjoin=relation&join=other (repeatable)
Paginationpage=N&limit=N

Operator filters

FilterOperatorEnum translates to @nestjsx/crud's $-prefixed condition operators:

import { FilterOperatorEnum } from 'ng-qubee';

qb.addFilterOperator('rating', FilterOperatorEnum.GTE, 4); // filter=rating||$gte||4
qb.addFilterOperator('title', FilterOperatorEnum.CONTAINS, 'world'); // filter=title||$cont||world
qb.addFilterOperator('title', FilterOperatorEnum.ILIKE, 'World'); // filter=title||$contL||World
qb.addFilterOperator('title', FilterOperatorEnum.SW, 'Intro'); // filter=title||$starts||Intro
qb.addFilterOperator('id', FilterOperatorEnum.IN, 1, 2, 3); // filter=id||$in||1,2,3
qb.addFilterOperator('status', FilterOperatorEnum.NOT, 'draft'); // filter=status||$ne||draft
qb.addFilterOperator('status', FilterOperatorEnum.NOT, 'a', 'b'); // filter=status||$notin||a,b
qb.addFilterOperator('deletedAt', FilterOperatorEnum.NULL, true); // filter=deletedAt||$isnull
qb.addFilterOperator('deletedAt', FilterOperatorEnum.NULL, false); // filter=deletedAt||$notnull
qb.addFilterOperator('price', FilterOperatorEnum.BTW, 10, 50); // filter=price||$between||10,50

Translation table

FilterOperatorEnum@nestjsx/crud operator
EQ$eq
GT / GTE / LT / LTE$gt / $gte / $lt / $lte
CONTAINS$cont
ILIKE$contL (case-insensitive contains)
IN$in
SW$starts
BTW$between (arity-checked, emits min,max)
NOT (single)$ne
NOT (multi)$notin
NULL (true)$isnull (no value segment)
NULL (false)$notnull (no value segment)
FTS / PHFTS / PLFTS / WFTSunsupported — throws UnsupportedFilterOperatorError

Value shape rules

Enforced at call time — both throw InvalidFilterOperatorValueError:

  • BTW requires exactly 2 values (min,max).
  • NULL requires exactly 1 boolean value (true$isnull, false$notnull).

Other operators leave shape validation to the server.

Feature matrix

MethodSupported?Notes
addFilter / deleteFiltersFolds to $eq (single) or $in (multi)
addFilterOperator / deleteOperatorFiltersSee translation table above
addSort / deleteSortsRepeatable sort=field,ASC params, uppercase direction
addSelect / deleteSelectEmitted as fields=col1,col2 (flat column projection)
addIncludes / deleteIncludesEmitted as repeatable join=relation params
addEmbedded / deleteEmbeddedPostgREST-only — throws UnsupportedEmbeddedError
setLimit / setPagepage + limit, page-based mode
addFields / deleteFields / deleteFieldsByModel@nestjsx/crud has no per-model field selection (per-relation projection via join=rel||f1,f2 is out of scope)
setSearch / deleteSearchThe s={...} parameter is JSON-shaped, not a plain term — use operator filters instead

Response shape

{
"data": [
{ "id": 1, "name": "John" }
],
"count": 10,
"total": 48,
"page": 2,
"pageCount": 5
}

NestjsxCrudResponseStrategy reads the flat { data, count, total, page, pageCount } envelope and computes from/to from (page - 1) * count + 1 and min(page * count, total). The envelope carries no navigation links, so firstPageUrl / prevPageUrl / nextPageUrl / lastPageUrl resolve to undefined unless you override their paths via IConfig.response.

note

count is the number of entities on the current page, not the requested page size — on a partial last page the derived from/to underestimate. Compute exact indices from your requested limit if you need them on the last page.

Customising response paths

provideNgQubee({
driver: DriverEnum.NESTJSX_CRUD,
response: {
data: 'items',
total: 'totalCount'
}
});

Defaults are encoded in NestjsxCrudResponseOptions.