Skip to content

Drivers

A driver is the knowledge of one backend’s query dialect, in two halves:

  • a request strategy that turns builder state into a query string
  • a response strategy that turns that backend’s envelope into a PaginatedCollection

Plus a response options object naming where pagination metadata lives in the body.

import { STRAPI_DRIVER } from '@qubeejs/core';
STRAPI_DRIVER.createRequestStrategy('query');
STRAPI_DRIVER.createResponseStrategy();
STRAPI_DRIVER.createResponseOptions({});

Each request strategy declares eight booleans describing what its backend can express. The builder consults them on every call, so unsupported features throw at the call site.

STRAPI_DRIVER.createRequestStrategy('query').capabilities;
// { filters: true, operatorFilters: true, sort: true, select: true,
// fields: false, includes: true, search: false, embedded: false }

The capability matrix lists all eighteen side by side.

If you know your backend, import its constant and let the rest tree-shake:

import { POSTGREST_DRIVER } from '@qubeejs/core';

If you do not, the registry maps every id to its definition:

import { DRIVERS, DriverEnum } from '@qubeejs/core';
const driver = DRIVERS[DriverEnum.POSTGREST];
const fromString = DRIVERS['postgrest']; // also fine

The registry is a closed Record, so adding a DriverEnum member without registering it is a compile error rather than a runtime surprise.