Skip to content
API/QubeeStore

QubeeStore

src/services/qubee-store.ts20 public methodsclass
new QubeeStore()
Property Type Description
baseUrl unknown
limit unknown
page unknown
resource unknown
addEmbedded(embedded: Embedded): void

Add embedded-resource selections to the request (PostgREST only) Automatically prevents duplicate columns for each relation

An empty column array means “all columns” (relation(*)); merging an empty array into a relation that already has explicit columns keeps the explicit columns.

Parameter Type Description
embedded Embedded Object mapping relation names to arrays of columns to project
addFields(fields: Fields): void

Add selectable fields for the given model to the request Automatically prevents duplicate fields for each model

Parameter Type Description
fields Fields Object mapping model names to arrays of field names
addFilters(filters: Filters): void

Add filters to the request Automatically prevents duplicate filter values for each filter key

Parameter Type Description
filters Filters Object mapping filter keys to arrays of values
addIncludes(includes: string[]): void

Add resources to include with the request Automatically prevents duplicate includes

Parameter Type Description
includes string[] Array of resource names to include in the response
addOperatorFilters(filters: OperatorFilter[]): void

Add filters with explicit operators (NestJS only) Automatically prevents duplicate operator filters for the same field + operator combination

Parameter Type Description
filters OperatorFilter[] Array of operator filter configurations
addSelect(fields: string[]): void

Add flat field selection columns (NestJS only) Automatically prevents duplicate select fields

Parameter Type Description
fields string[] Array of column names to select
addSort(sort: Sort): void

Add a field that should be used for sorting data

Parameter Type Description
sort Sort Sort configuration with field name and order (ASC/DESC)
deleteEmbedded(relations: string[]): void

Remove embedded-resource relations from the state (PostgREST only)

Removes the whole relation entry, columns included.

Parameter Type Description
relations string[] Relation names to remove
deleteFields(fields: Fields): void

Remove fields for the given model Uses deep cloning to prevent mutations to the original state

Parameter Type Description
fields Fields Object mapping model names to arrays of field names to remove
deleteFilters(filters: string[]): void

Remove filters from the request Uses deep cloning to prevent mutations to the original state

Parameter Type Description
filters string[] Filter keys to remove
deleteIncludes(includes: string[]): void

Remove includes from the request

Parameter Type Description
includes string[] Include names to remove
deleteOperatorFilters(fields: string[]): void

Remove operator filters by field name (NestJS only)

Parameter Type Description
fields string[] Field names of operator filters to remove
deleteSearch(): void

Remove the search term from the state (NestJS only)

deleteSelect(fields: string[]): void

Remove flat field selections from the state (NestJS only)

Parameter Type Description
fields string[] Field names to remove from selection
deleteSorts(sorts: string[]): void

Remove sorts from the request by field name

Parameter Type Description
sorts string[] Field names of sorts to remove
getSnapshot(): QueryBuilderState

Read the current state.

The returned object is a defensive copy whose identity is stable until the next write, which is exactly the contract useSyncExternalStore expects.

Returns — The current query builder state

reset(): void

Reset the query builder state to initial values Clears all fields, filters, includes, sorts, and resets pagination

setSearch(search: string): void

Set the full-text search term (NestJS only)

Parameter Type Description
search string The search term
subscribe(listener: function): function

Register a listener invoked after every state change.

Parameter Type Description
listener function Called after each write; receives no arguments and should read the new state via getSnapshot

Returns — A function that removes the listener

syncLastPage(lastPage: number): void

Atomically record the lastPage value from a paginated response and flip isLastPageKnown to true

Called exclusively by PaginationService.paginate() as part of the auto-sync contract; not intended to be invoked by consumers directly. Keeping the two fields under a single write guarantees they cannot drift out of sync.

Parameter Type Description
lastPage number The last page number parsed from the most recent paginated response