@sosd/qs-constructor
v1.0.2
Published
A convenient way to generate query strings for JSON:API.
Downloads
2
Readme
@sosd/qs-constructor
A convenient way to generate query strings for JSON:API.
Install
yarn add @sosd/qs-constructor
Usage
import createQueryString from '@sosd/qs-constructor'
const queryString: string = createQueryString({ orderBy, language, id, where }: ResolverArgs, include: string | undefined)
Interfaces
ResolverArgs
interface ResolverArgs { language: string; id?: string | undefined; orderBy?: OrderBy | undefined; where?: Where[] | undefined; }
OrderBy
interface OrderBy { path: string; direction: OrderByDirection; }
Where
interface Where { path: string; operator: WhereOperators; value: string; group?: string; }
Type & Enum
WhereOperators
type WhereOperators = | '=' | '<>' | '>' | '>=' | '<' | '<=' | 'STARTS_WITH' | 'CONTAINS' | 'ENDS_WITH' | 'IN' | 'NOT IN' | 'BETWEEN' | 'NOT BETWEEN' | 'IS NULL' | 'IS NOT NULL';
OrderByDirection
enum OrderByDirection { ASC = 'ASC', DSC = 'DSC', }