querier-ts 0.0.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/lib/__tests__/query.spec.d.ts +1 -0
  2. package/lib/__tests__/query.spec.js +149 -0
  3. package/lib/core/errors/__tests__/invalid-argument-error.spec.d.ts +1 -0
  4. package/lib/core/errors/__tests__/invalid-argument-error.spec.js +54 -0
  5. package/lib/core/errors/index.d.ts +1 -0
  6. package/lib/core/errors/index.js +17 -0
  7. package/lib/core/errors/invalid-argument-error.d.ts +14 -0
  8. package/lib/core/errors/invalid-argument-error.js +16 -0
  9. package/lib/core/types/attribute-validation-function.d.ts +1 -0
  10. package/lib/core/types/attribute-validation-function.js +2 -0
  11. package/lib/core/types/column-condition.d.ts +6 -0
  12. package/lib/core/types/column-condition.js +2 -0
  13. package/lib/core/types/index.d.ts +4 -0
  14. package/lib/core/types/index.js +20 -0
  15. package/lib/core/types/query-conditions-group-nullable.d.ts +4 -0
  16. package/lib/core/types/query-conditions-group-nullable.js +2 -0
  17. package/lib/core/types/query-conditions-group.d.ts +4 -0
  18. package/lib/core/types/query-conditions-group.js +2 -0
  19. package/lib/core/types/query-row-validator-initializer.d.ts +8 -0
  20. package/lib/core/types/query-row-validator-initializer.js +2 -0
  21. package/lib/core/validation/__tests__/query-row-validator.spec.d.ts +1 -0
  22. package/lib/core/validation/__tests__/query-row-validator.spec.js +195 -0
  23. package/lib/core/validation/decorators/__tests__/number-validation.spec.d.ts +1 -0
  24. package/lib/core/validation/decorators/__tests__/number-validation.spec.js +114 -0
  25. package/lib/core/validation/decorators/index.d.ts +1 -0
  26. package/lib/core/validation/decorators/index.js +17 -0
  27. package/lib/core/validation/decorators/number-validaton.d.ts +36 -0
  28. package/lib/core/validation/decorators/number-validaton.js +123 -0
  29. package/lib/core/validation/index.d.ts +1 -0
  30. package/lib/core/validation/index.js +17 -0
  31. package/lib/core/validation/query-row-validator.d.ts +57 -0
  32. package/lib/core/validation/query-row-validator.js +84 -0
  33. package/lib/index.d.ts +1 -2
  34. package/lib/index.js +15 -3
  35. package/lib/query.d.ts +33 -38
  36. package/lib/query.js +51 -50
  37. package/lib/utils/functions/generic/__tests__/compare-arrays.spec.d.ts +1 -0
  38. package/lib/utils/functions/generic/__tests__/compare-arrays.spec.js +21 -0
  39. package/lib/utils/functions/generic/__tests__/deep-equal.spec.d.ts +1 -0
  40. package/lib/utils/functions/generic/__tests__/deep-equal.spec.js +82 -0
  41. package/lib/utils/functions/generic/__tests__/get-entries.spec.d.ts +1 -0
  42. package/lib/utils/functions/generic/__tests__/get-entries.spec.js +55 -0
  43. package/lib/utils/functions/generic/compare-arrays.d.ts +1 -9
  44. package/lib/utils/functions/generic/compare-arrays.js +2 -9
  45. package/lib/utils/functions/generic/deep-equal.d.ts +1 -0
  46. package/lib/utils/functions/generic/deep-equal.js +23 -0
  47. package/lib/utils/functions/generic/get-entries.d.ts +5 -8
  48. package/lib/utils/functions/generic/get-entries.js +7 -9
  49. package/lib/utils/functions/generic/index.d.ts +3 -3
  50. package/lib/utils/functions/generic/index.js +17 -5
  51. package/lib/utils/functions/sort/__tests__/sort-by-properties.spec.d.ts +1 -0
  52. package/lib/utils/functions/sort/__tests__/sort-by-properties.spec.js +69 -0
  53. package/lib/utils/functions/sort/__tests__/sort-by-property.spec.d.ts +1 -0
  54. package/lib/utils/functions/sort/__tests__/sort-by-property.spec.js +63 -0
  55. package/lib/utils/functions/sort/index.d.ts +2 -3
  56. package/lib/utils/functions/sort/index.js +16 -5
  57. package/lib/utils/functions/sort/sort-by-properties.d.ts +2 -2
  58. package/lib/utils/functions/sort/sort-by-properties.js +11 -9
  59. package/lib/utils/functions/sort/sort-by-property.d.ts +2 -2
  60. package/lib/utils/functions/sort/sort-by-property.js +18 -6
  61. package/lib/utils/functions/type-guards/__tests__/is-function.spec.d.ts +1 -0
  62. package/lib/utils/functions/type-guards/__tests__/is-function.spec.js +38 -0
  63. package/lib/utils/functions/type-guards/__tests__/is-number.spec.d.ts +1 -0
  64. package/lib/utils/functions/type-guards/__tests__/is-number.spec.js +35 -0
  65. package/lib/utils/functions/type-guards/__tests__/is-object.spec.d.ts +1 -0
  66. package/lib/utils/functions/type-guards/__tests__/is-object.spec.js +38 -0
  67. package/lib/utils/functions/type-guards/index.d.ts +3 -4
  68. package/lib/utils/functions/type-guards/index.js +17 -7
  69. package/lib/utils/functions/type-guards/is-function.d.ts +3 -3
  70. package/lib/utils/functions/type-guards/is-function.js +2 -2
  71. package/lib/utils/functions/type-guards/is-number.d.ts +3 -3
  72. package/lib/utils/functions/type-guards/is-number.js +2 -2
  73. package/lib/utils/functions/type-guards/is-object.d.ts +3 -3
  74. package/lib/utils/functions/type-guards/is-object.js +2 -2
  75. package/lib/utils/types/add-prefix-to-object.d.ts +1 -1
  76. package/lib/utils/types/allowed-names.d.ts +1 -1
  77. package/lib/utils/types/flag-excluded-type.d.ts +1 -1
  78. package/lib/utils/types/generic-object.d.ts +1 -1
  79. package/lib/utils/types/generic-object.js +0 -1
  80. package/lib/utils/types/index.d.ts +9 -10
  81. package/lib/utils/types/index.js +23 -0
  82. package/lib/utils/types/omit-type.d.ts +1 -1
  83. package/lib/utils/types/partial-of-properties.d.ts +1 -1
  84. package/lib/utils/types/prop-of.d.ts +1 -1
  85. package/lib/utils/types/property-only.d.ts +1 -1
  86. package/lib/utils/types/recursive-partial.d.ts +1 -1
  87. package/lib/utils/types/type.d.ts +1 -1
  88. package/package.json +23 -24
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./number-validaton"), exports);
@@ -0,0 +1,36 @@
1
+ import 'reflect-metadata';
2
+ /**
3
+ * Sets a minimal value to be used as argument to the given parameter.
4
+ *
5
+ * @param value Minimal value to set.
6
+ *
7
+ * @returns Decorator function.
8
+ */
9
+ export declare function min(value: number): (target: object, propertyKey: string | symbol, parameterIndex: number) => void;
10
+ /**
11
+ * Sets a maximum value to be used as argument to the given parameter.
12
+ *
13
+ * @param value Maximal value to set.
14
+ *
15
+ * @returns Decorator function.
16
+ */
17
+ export declare function max(value: number): (target: object, propertyKey: string | symbol, parameterIndex: number) => void;
18
+ /**
19
+ * Marks the given parameter as an integer.
20
+ *
21
+ * @param target Class to which the parameter belongs.
22
+ * @param propertyKey Method name.
23
+ * @param parameterIndex Parameter index.
24
+ */
25
+ export declare function integer(target: object, propertyKey: string | symbol, parameterIndex: number): void;
26
+ /**
27
+ * Validates the property decorators `integer`, `min`, and `max`, throwing and error
28
+ * when the arguments passed to the parameters decorated by them are invalid.
29
+ *
30
+ * @param target Class to which the method belongs.
31
+ * @param propertyName Method name.
32
+ * @param descriptor Descriptor object.
33
+ *
34
+ * @throws {InvalidArgumentError} If an argument is invalid.
35
+ */
36
+ export declare function validateNumbers(target: any, propertyName: string, descriptor: TypedPropertyDescriptor<any>): void;
@@ -0,0 +1,123 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.min = min;
4
+ exports.max = max;
5
+ exports.integer = integer;
6
+ exports.validateNumbers = validateNumbers;
7
+ require("reflect-metadata");
8
+ const type_guards_1 = require("../../../utils/functions/type-guards");
9
+ const errors_1 = require("../../errors");
10
+ const minMetadataKey = Symbol('min');
11
+ const maxMetadataKey = Symbol('max');
12
+ const integerMetadataKey = Symbol('integer');
13
+ /**
14
+ * Sets a minimal value to be used as argument to the given parameter.
15
+ *
16
+ * @param value Minimal value to set.
17
+ *
18
+ * @returns Decorator function.
19
+ */
20
+ function min(value) {
21
+ return (target, propertyKey, parameterIndex) => {
22
+ const minParameters = Reflect.getOwnMetadata(minMetadataKey, target, propertyKey) || [];
23
+ minParameters.push({
24
+ value,
25
+ index: parameterIndex,
26
+ });
27
+ Reflect.defineMetadata(minMetadataKey, minParameters, target, propertyKey);
28
+ };
29
+ }
30
+ /**
31
+ * Sets a maximum value to be used as argument to the given parameter.
32
+ *
33
+ * @param value Maximal value to set.
34
+ *
35
+ * @returns Decorator function.
36
+ */
37
+ function max(value) {
38
+ return (target, propertyKey, parameterIndex) => {
39
+ const maxParameters = Reflect.getOwnMetadata(maxMetadataKey, target, propertyKey) || [];
40
+ maxParameters.push({
41
+ value,
42
+ index: parameterIndex,
43
+ });
44
+ Reflect.defineMetadata(maxMetadataKey, maxParameters, target, propertyKey);
45
+ };
46
+ }
47
+ /**
48
+ * Marks the given parameter as an integer.
49
+ *
50
+ * @param target Class to which the parameter belongs.
51
+ * @param propertyKey Method name.
52
+ * @param parameterIndex Parameter index.
53
+ */
54
+ function integer(target, propertyKey, parameterIndex) {
55
+ const integerParameters = Reflect.getOwnMetadata(integerMetadataKey, target, propertyKey) || [];
56
+ integerParameters.push({
57
+ index: parameterIndex,
58
+ });
59
+ Reflect.defineMetadata(integerMetadataKey, integerParameters, target, propertyKey);
60
+ }
61
+ /**
62
+ * Validates the property decorators `integer`, `min`, and `max`, throwing and error
63
+ * when the arguments passed to the parameters decorated by them are invalid.
64
+ *
65
+ * @param target Class to which the method belongs.
66
+ * @param propertyName Method name.
67
+ * @param descriptor Descriptor object.
68
+ *
69
+ * @throws {InvalidArgumentError} If an argument is invalid.
70
+ */
71
+ function validateNumbers(target, propertyName, descriptor) {
72
+ const method = descriptor.value;
73
+ descriptor.value = function () {
74
+ const minParams = Reflect.getOwnMetadata(minMetadataKey, target, propertyName) || [];
75
+ const maxParams = Reflect.getOwnMetadata(maxMetadataKey, target, propertyName) || [];
76
+ const integerParams = Reflect.getOwnMetadata(integerMetadataKey, target, propertyName) || [];
77
+ checkMinParams(propertyName, minParams, arguments);
78
+ checkMaxParams(propertyName, maxParams, arguments);
79
+ checkIntegerParams(propertyName, integerParams, arguments);
80
+ return method.apply(this, arguments);
81
+ };
82
+ }
83
+ function checkMinParams(methodName, params, actualArguments) {
84
+ for (const parameter of params) {
85
+ const actualValue = actualArguments[parameter.index];
86
+ const minValue = parameter.value;
87
+ if (!(0, type_guards_1.isNumber)(actualValue) || actualValue < minValue) {
88
+ throw new errors_1.InvalidArgumentError({
89
+ method: methodName,
90
+ param: parameter.index,
91
+ argument: actualValue,
92
+ expected: `equal or greater than ${minValue}`,
93
+ });
94
+ }
95
+ }
96
+ }
97
+ function checkMaxParams(methodName, params, actualArguments) {
98
+ for (const parameter of params) {
99
+ const actualValue = actualArguments[parameter.index];
100
+ const maxValue = parameter.value;
101
+ if (!(0, type_guards_1.isNumber)(actualValue) || actualValue > maxValue) {
102
+ throw new errors_1.InvalidArgumentError({
103
+ method: methodName,
104
+ param: parameter.index,
105
+ argument: actualValue,
106
+ expected: `equal or less than ${maxValue}`,
107
+ });
108
+ }
109
+ }
110
+ }
111
+ function checkIntegerParams(methodName, params, actualArguments) {
112
+ for (const { index } of params) {
113
+ const actualValue = actualArguments[index];
114
+ if (!Number.isSafeInteger(actualValue)) {
115
+ throw new errors_1.InvalidArgumentError({
116
+ method: methodName,
117
+ param: index,
118
+ argument: actualValue,
119
+ expected: 'an integer',
120
+ });
121
+ }
122
+ }
123
+ }
@@ -0,0 +1 @@
1
+ export * from './query-row-validator';
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./query-row-validator"), exports);
@@ -0,0 +1,57 @@
1
+ import { QueryRowValidatorInitializer } from '../types';
2
+ /**
3
+ * Validates a row in the query.
4
+ */
5
+ export declare class QueryRowValidator<T extends object> {
6
+ /**
7
+ * Row to be validated.
8
+ */
9
+ private row;
10
+ /**
11
+ * Conditions to be applied to the row.
12
+ */
13
+ private conditionsObject;
14
+ /**
15
+ * Indicates whether conditions with `null` and `undefined` values should be
16
+ * skipped.
17
+ */
18
+ private ignoreNullValues;
19
+ /**
20
+ * Initializes the validator.
21
+ *
22
+ * @param row Row to validated.
23
+ * @param config Validator configuration.
24
+ */
25
+ private constructor();
26
+ /**
27
+ * Validates a row.
28
+ *
29
+ * @param row Row to validated.
30
+ * @param config Validator configuration.
31
+ */
32
+ static validate<T extends object>(row: T, config: QueryRowValidatorInitializer<T>): boolean;
33
+ /**
34
+ * Validates all conditions of the row.
35
+ *
36
+ * @returns Validation result.
37
+ */
38
+ private validate;
39
+ /**
40
+ * Validate a condition to a specific column.
41
+ *
42
+ * @param columnName Column name.
43
+ * @param condition Condition to be validated.
44
+ *
45
+ * @returns Validation result.
46
+ */
47
+ private validateColumnCondition;
48
+ /**
49
+ * Validates an object inside the row.
50
+ *
51
+ * @param obj Object to validated.
52
+ * @param conditionsObject Conditions to be applied to the object.
53
+ *
54
+ * @returns Validation result.
55
+ */
56
+ private validateInnerObject;
57
+ }
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.QueryRowValidator = void 0;
4
+ const generic_1 = require("../../utils/functions/generic");
5
+ const type_guards_1 = require("../../utils/functions/type-guards");
6
+ /**
7
+ * Validates a row in the query.
8
+ */
9
+ class QueryRowValidator {
10
+ /**
11
+ * Initializes the validator.
12
+ *
13
+ * @param row Row to validated.
14
+ * @param config Validator configuration.
15
+ */
16
+ constructor(row, config) {
17
+ this.row = row;
18
+ this.conditionsObject = config.conditionsObject;
19
+ this.ignoreNullValues = config.ignoreNullValues;
20
+ }
21
+ /**
22
+ * Validates a row.
23
+ *
24
+ * @param row Row to validated.
25
+ * @param config Validator configuration.
26
+ */
27
+ static validate(row, config) {
28
+ const validator = new QueryRowValidator(row, config);
29
+ return validator.validate();
30
+ }
31
+ /**
32
+ * Validates all conditions of the row.
33
+ *
34
+ * @returns Validation result.
35
+ */
36
+ validate() {
37
+ const conditionsEntries = (0, generic_1.getEntries)(this.conditionsObject);
38
+ return conditionsEntries.every(([columnName, condition]) => this.validateColumnCondition(columnName, condition));
39
+ }
40
+ /**
41
+ * Validate a condition to a specific column.
42
+ *
43
+ * @param columnName Column name.
44
+ * @param condition Condition to be validated.
45
+ *
46
+ * @returns Validation result.
47
+ */
48
+ validateColumnCondition(columnName, condition) {
49
+ if (this.ignoreNullValues &&
50
+ (condition === null || condition === undefined)) {
51
+ return true;
52
+ }
53
+ const cellValue = this.row[columnName];
54
+ if ((0, type_guards_1.isFunction)(condition)) {
55
+ return condition(cellValue);
56
+ }
57
+ if (Array.isArray(condition)) {
58
+ return Array.isArray(cellValue)
59
+ ? (0, generic_1.compareArrays)(cellValue, condition)
60
+ : false;
61
+ }
62
+ if ((0, type_guards_1.isObject)(condition)) {
63
+ return (0, type_guards_1.isObject)(cellValue)
64
+ ? this.validateInnerObject(cellValue, condition)
65
+ : false;
66
+ }
67
+ return cellValue === condition;
68
+ }
69
+ /**
70
+ * Validates an object inside the row.
71
+ *
72
+ * @param obj Object to validated.
73
+ * @param conditionsObject Conditions to be applied to the object.
74
+ *
75
+ * @returns Validation result.
76
+ */
77
+ validateInnerObject(obj, conditionsObject) {
78
+ return QueryRowValidator.validate(obj, {
79
+ conditionsObject,
80
+ ignoreNullValues: this.ignoreNullValues,
81
+ });
82
+ }
83
+ }
84
+ exports.QueryRowValidator = QueryRowValidator;
package/lib/index.d.ts CHANGED
@@ -1,2 +1 @@
1
- import { Query } from './query';
2
- export { Query };
1
+ export * from './query';
package/lib/index.js CHANGED
@@ -1,5 +1,17 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
2
16
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Query = void 0;
4
- const query_1 = require("./query");
5
- Object.defineProperty(exports, "Query", { enumerable: true, get: function () { return query_1.Query; } });
17
+ __exportStar(require("./query"), exports);
package/lib/query.d.ts CHANGED
@@ -1,6 +1,5 @@
1
+ import { QueryConditionsGroup, QueryConditionsGroupNullable } from './core/types';
1
2
  import { addPrefixToObject, PropertyOnly, PropOf } from './utils/types';
2
- import { QueryConditionsGroup } from './query-conditions-group';
3
- import { QueryConditionsGroupNullable } from './query-conditions-group-nullable';
4
3
  /**
5
4
  * Allows filtering data from an array of objects.
6
5
  *
@@ -57,30 +56,29 @@ export declare class Query<T extends object> {
57
56
  /**
58
57
  * Initializes the query.
59
58
  *
60
- * @param {T[]} rows Rows to be queried.
59
+ * @param rows Rows to be queried.
61
60
  */
62
61
  private constructor();
63
62
  /**
64
63
  * Creates a new query based on the given data.
65
64
  *
66
- * @param {T[]} rows Rows to be queried.
65
+ * @param rows Rows to be queried.
67
66
  *
68
- * @returns {Query<T>} Query to the given rows.
67
+ * @returns Query to the given rows.
69
68
  */
70
69
  static from<T extends object>(rows: T[]): Query<T>;
71
70
  /**
72
71
  * Defines specific columns to be returned on the final results.
73
72
  *
74
- * @param {PropOf<T> | PropOf<T>[]} columns Selected columns.
73
+ * @param columns Selected columns.
75
74
  *
76
- * @returns {this} Current query.
75
+ * @returns Current query.
77
76
  */
78
77
  select(columns: PropOf<T> | PropOf<T>[]): this;
79
78
  /**
80
79
  * Applies conditions to the query.
81
80
  *
82
- * @param {QueryConditionsGroup<T> | ((obj: T) => boolean)} condition Filter to
83
- * be applied to the query.
81
+ * @param condition Filter to be applied to the query.
84
82
  *
85
83
  * If a callback function is provided, it must return a boolean value.
86
84
  *
@@ -88,87 +86,86 @@ export declare class Query<T extends object> {
88
86
  * corresponding values must be the expected values for the attributes or a
89
87
  * callback functions that return boolean values.
90
88
  *
91
- * @returns {this} Current query.
89
+ * @returns Current query.
92
90
  */
93
91
  where(condition: QueryConditionsGroup<T> | ((obj: T) => boolean)): this;
94
92
  /**
95
93
  * Applies a set of conditions to the query ignoring `null` and `undefined`
96
94
  * values as conditions.
97
95
  *
98
- * @param {QueryConditionsGroupNullable<T>} condition An object where each
99
- * property represents an attribute to be validated. The values can be
100
- * literal or callback functions that return a boolean. If `null` or `undefined`
101
- * is passed, that condition will be skipped.
96
+ * @param condition An object where each property represents an attribute
97
+ * to be validated. The values can be literal or callback functions that
98
+ * return a boolean. If `null` or `undefined` is passed, that condition
99
+ * will be skipped.
102
100
  *
103
- * @returns {this} Current query.
101
+ * @returns Current query.
104
102
  */
105
103
  filterWhere(condition: QueryConditionsGroupNullable<T>): this;
106
104
  /**
107
105
  * Adds ordering to the results.
108
106
  *
109
- * @param {(PropOf<T> | keyof addPrefixToObject<PropertyOnly<T>, '-'>)[]} columns
110
- * Ascending or descending columns. To mark a field as descending, use `-` before
111
- * its name.
107
+ * @param columns Ascending or descending columns. To mark a field as
108
+ * descending, use `-` before its name.
112
109
  *
113
- * @returns {this} Current query.
110
+ * @returns Current query.
114
111
  */
115
112
  orderBy(...columns: (PropOf<T> | keyof addPrefixToObject<PropertyOnly<T>, '-'>)[]): this;
116
113
  /**
117
114
  * Returns the current number of rows.
118
115
  *
119
- * @return {number}
116
+ * @return Filtered rows count.
120
117
  */
121
118
  count(): number;
122
119
  /**
123
120
  * Checks if there is at least one row compatible with the query.
124
121
  *
125
- * @returns {boolean} Boolean indicating whether any row exists.
122
+ * @returns Whether any row exists after filtering.
126
123
  */
127
124
  exists(): boolean;
128
125
  /**
129
126
  * Returns the first result.
130
127
  *
131
- * @returns {T}
128
+ * @returns The first result.
132
129
  */
133
130
  first(): T | null;
134
131
  /**
135
132
  * Returns the last result.
136
133
  *
137
- * @returns {T}
134
+ * @returns The last result.
138
135
  */
139
136
  last(): T | null;
140
137
  /**
141
138
  * Returns all results.
142
139
  *
143
- * @returns {T[]}
140
+ * @returns All filtered rows.
144
141
  */
145
142
  all(): T[];
146
143
  /**
147
144
  * Returns the value of the first (selected) column of the first row.
148
145
  *
149
- * @returns {T[Promise<T>]|false} First value or `false`, if none row exists.
146
+ * @returns First value or `false`, if none row exists.
150
147
  */
151
148
  scalar(): T[PropOf<T>] | false;
152
149
  /**
153
150
  * Returns the values of the first (selected) column of all rows.
154
151
  *
155
- * @returns {T[Promise<T>][]} Values from the first (selected) column.
152
+ * @returns Values from the first (selected) column.
156
153
  */
157
154
  column(): T[PropOf<T>][];
158
155
  /**
159
156
  * Returns the values of the rows. If there are selected columns, only their
160
157
  * values will be returned.
161
158
  *
162
- * @returns {T[PropOf<T>][][]} Array with the values of all rows.
159
+ * @returns Array with the values of all rows.
163
160
  */
164
161
  values(): T[PropOf<T>][][];
165
162
  /**
166
163
  * Defines the number of rows to skip.
167
164
  *
168
- * @param {number} numberOfRows Numbers of rows to skip. Only non negative integer numbers
165
+ * @param numberOfRows Numbers of rows to skip. Only non negative integer numbers
169
166
  * are allowed.
170
167
  *
171
- * @returns {this} Current query.
168
+ * @returns Current query.
172
169
  *
173
170
  * @throws {InvalidArgumentError} If the given number is less than 0.
174
171
  */
@@ -176,9 +173,9 @@ export declare class Query<T extends object> {
176
173
  /**
177
174
  * Defines a limit for the number of results.
178
175
  *
179
- * @param {number} limit Limit of results. Only non negative integer numbers are allowed.
176
+ * @param limit Limit of results. Only non negative integer numbers are allowed.
180
177
  *
181
- * @returns {this} Current query.
178
+ * @returns Current query.
182
179
  *
183
180
  * @throws {InvalidArgumentError} If the given limit is less than 0.
184
181
  */
@@ -186,28 +183,26 @@ export declare class Query<T extends object> {
186
183
  /**
187
184
  * Returns the rows that should be used in the final results.
188
185
  *
189
- * @returns {T[]} Rows within the specified limit.
186
+ * @returns Rows within the specified limit.
190
187
  */
191
188
  private getLimitedRows;
192
189
  /**
193
190
  * Returns the first selected column or the first key of some row.
194
191
  *
195
- * @returns {Promise<T>|null} The first column or `null`, if none is selected
196
- * or there is no row.
192
+ * @returns The first column or `null`, if none is selected or there is no row.
197
193
  */
198
194
  private getFirstColumn;
199
195
  /**
200
196
  * Filters the rows according to the given conditions.
201
197
  *
202
- * @param {QueryConditionsGroupNullable<T> | ((obj: T) => boolean)} condition
203
- * Object or callback function.
198
+ * @param condition Object or callback function.
204
199
  */
205
200
  private filterRows;
206
201
  /**
207
202
  * Validates a row based on the given conditions object.
208
203
  *
209
- * @param {T} row Row to validate.
210
- * @param {QueryConditionsGroupNullable<T>} condition Conditions object.
204
+ * @param row Row to validate.
205
+ * @param condition Conditions object.
211
206
  *
212
207
  * @returns {boolean} Validation result.
213
208
  */