import HasAttributes from './HasAttributes'; import type { MaybeArray, StaticToThis as BaseStaticToThis } from '../../Support/type'; type StaticToThis = BaseStaticToThis & { newQuery: typeof BuildsQuery['newQuery']; }; type BooleanOperator = 'and' | 'or'; type Direction = 'asc' | 'desc'; type Operator = '!=' | '<' | '<=' | '=' | '>' | '>=' | 'between' | 'in' | 'like' | 'notBetween' | 'notIn'; type Order = { column: string; direction: Direction; }; type WhereDescription = { column: string; operator: Operator; value: any; boolean: BooleanOperator; }; export type QueryParams = Partial<{ wheres: WhereDescription[]; columns: string[]; with: string[]; scopes: string[]; relationsExists: string[]; orders: Order[]; distinct: string[]; offset: number; limit: number; page: number; }>; export default class BuildsQuery extends HasAttributes { protected queryParameters: Required & { without: string[]; }; /** * The relations that should be included on every request. * * @protected * * @type {string} */ protected withRelations: string[]; /** * Return the instantiated class. * * @return {BuildsQuery} */ static newQuery(this: T): T['prototype']; /** * Compiles the query parameters into a single object. * * @protected * * @return {object} */ protected compileQueryParameters(): QueryParams; /** * Reset the request parameters. * * @protected * * @return {this} */ resetQueryParameters(): this; /** * Add a where constraint to the wheres. * * @param {string} column * @param {string} operator * @param {any} value * @param {'and'|'or'} boolean * * @protected * * @return {this} */ protected addWhereConstraint(column: string, operator: Operator, value: any, boolean: BooleanOperator): this; /** * Add a where constraint to the query. * * @param {string} column * @param {any} operator * @param {any=} value * @param {'and'|'or'} boolean * * @return {this} */ where(column: string, value?: unknown): this; where(column: string, operator: Operator, value: unknown, boolean?: BooleanOperator): this; /** * The static version of the where method. * * @param {string} column * @param {any} operator * @param {any=} value * @param {'and'|'or'} boolean * * @return {BuildsQuery} * * @see BuildsQuery.prototype.where */ static where(this: T, column: string, value: unknown): T['prototype']; static where(this: T, column: string, operator: Operator, value: unknown, boolean?: BooleanOperator): T['prototype']; /** * Add an or where closure to the query. * * @param {string} column * @param {any} operator * @param {any} value * * @return {this} */ orWhere(column: string, value: any): this; orWhere(column: string, operator: Operator, value: any): this; /** * Add a where key closure to the query. * * @param {string|number|(string|number)[]} value * @param {'and'|'or'} boolean * * @return {this} */ whereKey(value: MaybeArray, boolean?: BooleanOperator): this; /** * The static version of the whereKey method. * * @param {string|number|(string|number)[]} value * @param {'and'|'or'} boolean * * @see BuildsQuery.prototype.whereKey */ static whereKey(this: T, value: MaybeArray, boolean?: BooleanOperator): T['prototype']; /** * Add an or where key closure to the query. * * @param {string|number|(string|number)[]} value * * @return {this} */ orWhereKey(value: MaybeArray): this; /** * Add a where key not closure to the query. * * @param {string|number|(string|number)[]} value * @param {'and'|'or'} boolean * * @return {this} */ whereKeyNot(value: MaybeArray, boolean?: BooleanOperator): this; /** * The static version of the whereKeyNot method. * * @param {string|number|(string|number)[]} value * @param {'and'|'or'} boolean * * @see BuildsQuery.prototype.whereNotIn */ static whereKeyNot(this: T, value: MaybeArray, boolean?: BooleanOperator): T['prototype']; /** * Add a where key not closure to the query. * * @param {string|number|(string|number)[]} value * * @return {this} */ orWhereKeyNot(value: MaybeArray): this; /** * Add a where null closure to the query. * * @param {string|string[]} columns * @param {'and'|'or'} boolean * * @return {this} */ whereNull(columns: MaybeArray, boolean?: BooleanOperator): this; /** * The static version of the whereNull method. * * @param {string} columns * * @return {BuildsQuery} * * @see BuildsQuery.prototype.whereNull */ static whereNull(this: T, columns: MaybeArray): T['prototype']; /** * Add an or where null closure to the query. * * @param {string} columns * * @return {this} */ orWhereNull(columns: MaybeArray): this; /** * Add a where not null closure to the query. * * @param {string} columns * @param {'and'|'or'} boolean * * @return {this} */ whereNotNull(columns: MaybeArray, boolean?: BooleanOperator): this; /** * The static version of the whereNotNull method. * * @param {string} columns * * @return {BuildsQuery} * * @see BuildsQuery.prototype.whereNotNull */ static whereNotNull(this: T, columns: MaybeArray): T['prototype']; /** * Add an or where not null closure to the query. * * @param {string} columns * * @return {this} */ orWhereNotNull(columns: MaybeArray): this; /** * Add a where in closure to the query. * * @param {string} column * @param {any[]} values * @param {'and'|'or} boolean * * @return {this} */ whereIn(column: string, values: any[], boolean?: BooleanOperator): this; /** * The static version of the whereIn method. * * @param {string} column * @param {any[]} values * @param {'and'|'or} boolean * * @see BuildsQuery.prototype.whereIn */ static whereIn(this: T, column: string, values: any[], boolean?: BooleanOperator): T['prototype']; /** * Add an or where in closure to the query. * * @param {string} column * @param {any[]} values * * @return {this} */ orWhereIn(column: string, values: any[]): this; /** * Add a where not in closure to the query. * * @param {string} column * @param {any[]} values * @param {'and'|'or} boolean * * @return {this} */ whereNotIn(column: string, values: any[], boolean?: BooleanOperator): this; /** * The static version of the whereNotIn method. * * @param {string} column * @param {any[]} values * @param {'and'|'or} boolean * * @see BuildsQuery.prototype.whereNotIn */ static whereNotIn(this: T, column: string, values: any[], boolean?: BooleanOperator): T['prototype']; /** * Add an or where not in closure to the query. * * @param {string} column * @param {any[]} values * * @return {this} */ orWhereNotIn(column: string, values: any[]): this; /** * Add a where between closure to the query. * * @param {string} column * @param {any[]} values * @param {'and'|'or} boolean * * @return {this} */ whereBetween(column: string, values: any[], boolean?: BooleanOperator): this; /** * The static version of the whereBetween method. * * @param {string} column * @param {any[]} values * @param {'and'|'or} boolean * * @see BuildsQuery.prototype.whereBetween */ static whereBetween(this: T, column: string, values: any[], boolean?: BooleanOperator): T['prototype']; /** * Add an or where between closure to the query. * * @param {string} column * @param {any[]} values * * @return {this} */ orWhereBetween(column: string, values: any[]): this; /** * Add a where not between closure to the query. * * @param {string} column * @param {any[]} values * @param {'and'|'or} boolean * * @return {this} */ whereNotBetween(column: string, values: any[], boolean?: BooleanOperator): this; /** * The static version of the whereNotBetween method. * * @param {string} column * @param {any[]} values * @param {'and'|'or} boolean * * @see BuildsQuery.prototype.whereNotBetween */ static whereNotBetween(this: T, column: string, values: any[], boolean?: BooleanOperator): T['prototype']; /** * Add an or where not between closure to the query. * * @param {string} column * @param {any[]} values * * @return {this} */ orWhereNotBetween(column: string, values: any[]): this; /** * Set the limit for the returned models on the next request. * * @param {number} count */ limit(count: number): this; /** * The static version of the limit method. * * @param {number} count * * @see BuildsQuery.prototype.limit */ static limit(this: T, count: number): T['prototype']; /** * Set the page of the returned models for the next request. * * @param {number} pageNumber */ page(pageNumber: number): this; /** * The static version of the page method. * * @param {number} pageNumber * * @see BuildsQuery.prototype.page */ static page(this: T, pageNumber: number): T['prototype']; /** * Request only distinct values on the query based on the given columns. * * @return {this} */ distinct(columns: MaybeArray): this; /** * The static version of the distinct method. * * @return {BuildsQuery} * * @see BuildsQuery.prototype.distinct */ static distinct(this: T, columns: MaybeArray): T['prototype']; /** * Tell the api which columns are required. * * @param {string[]} columns * * @return {this} */ select(columns: MaybeArray): this; /** * The static version of the select method. * * @param {string[]} columns * * @return {BuildsQuery} * * @see BuildsQuery.prototype.select */ static select(this: T, columns: MaybeArray): T['prototype']; /** * Add a has check of the related records * * @param {string[]} relations * * @return {this} */ has(relations: MaybeArray): this; /** * The static version of the has method. * * @param {string[]} relations * * @return {BuildsQuery} * * @see BuildsQuery.prototype.has */ static has(this: T, relations: MaybeArray): T['prototype']; /** * Add eager loaded relations to the query. * * @param {string[]} relations * * @return {this} */ with(relations: MaybeArray): this; /** * The static version of the with method. * * @param {string[]} relations * * @return {BuildsQuery} * * @see BuildsQuery.prototype.with */ static with(this: T, relations: MaybeArray): T['prototype']; /** * Remove eager loaded relations from the query. * * @param relations */ without(relations: MaybeArray): this; /** * The static version of the with method. * * @param {string[]} relations * * @return {BuildsQuery} * * @see BuildsQuery.prototype.without */ static without(this: T, relations: MaybeArray): T['prototype']; /** * Add eager loaded relations to the query. * * @param {string[]} scopes * * @return {this} */ scope(scopes: MaybeArray): this; /** * The static version of the scope method. * * @param {string[]} scopes * * @return {BuildsQuery} * * @see BuildsQuery.prototype.scope */ static scope(this: T, scopes: MaybeArray): T['prototype']; /** * Add an ordering of the records for the query. * * @param {string} column * @param {'asc'|'desc'} direction * * @return {this} */ orderBy(column: string, direction?: Direction): this; /** * The static version of the orderBy method. * * @param {string} column * @param {'asc'|'desc'}direction * * @return {BuildsQuery} * * @see BuildsQuery.prototype.orderBy */ static orderBy(this: T, column: string, direction?: Direction): T['prototype']; /** * Add an ordering by descending of the records for the query. * * @param {string} column * * @return {this} */ orderByDesc(column: string): this; /** * The static version of the orderByDesc method. * * @param {string} column * * @return {BuildsQuery} * * @see BuildsQuery.prototype.orderByDesc */ static orderByDesc(this: T, column: string): T['prototype']; /** * An alias for the orderByDesc method. * * @param {string=} column * * @return {this} */ latest(column?: string): this; /** * The static version of the latest method. * * @param {string=} column * * @return {BuildsQuery} * * @see BuildsQuery.prototype.latest */ static latest(this: T, column?: string): T['prototype']; /** * Add an ordering by ascending of the records for the query. * * @param {string} column * * @return {this} */ oldest(column?: string): this; /** * The static version of the oldest method. * * @param {string} column * * @return {BuildsQuery} * * @see BuildsQuery.prototype.oldest */ static oldest(this: T, column?: string): T['prototype']; /** * The offset of the records sent back. * * @param {number} count * * @return {this} */ offset(count: number): this; /** * The static version of the offset method. * * @param {number} count * * @return {BuildsQuery} * * @see BuildsQuery.prototype.offset */ static offset(this: T, count: number): T['prototype']; /** * An alias for the offset method. * * @param {number} count * * @return {this} * * @see BuildsQuery.prototype.offset */ skip(count: number): this; /** * The static version of the skip method. * * @param {number} count * * @return {BuildsQuery} * * @see BuildsQuery.prototype.skip */ static skip(this: T, count: number): T['prototype']; } export {}; //# sourceMappingURL=BuildsQuery.d.ts.map