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,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const sort_by_property_1 = require("../sort-by-property");
4
+ describe('sortByProperty (improved)', () => {
5
+ describe('ascending order', () => {
6
+ it('sorts by numeric property', () => {
7
+ const data = [{ id: 3 }, { id: 1 }, { id: 2 }];
8
+ data.sort((0, sort_by_property_1.sortByProperty)('id'));
9
+ expect(data).toEqual([{ id: 1 }, { id: 2 }, { id: 3 }]);
10
+ });
11
+ it('sorts by string property', () => {
12
+ const data = [{ name: 'Charlie' }, { name: 'Alice' }, { name: 'Bob' }];
13
+ data.sort((0, sort_by_property_1.sortByProperty)('name'));
14
+ expect(data).toEqual([
15
+ { name: 'Alice' },
16
+ { name: 'Bob' },
17
+ { name: 'Charlie' },
18
+ ]);
19
+ });
20
+ });
21
+ describe('descending order', () => {
22
+ it('sorts by numeric property descending', () => {
23
+ const data = [{ score: 10 }, { score: 30 }, { score: 20 }];
24
+ data.sort((0, sort_by_property_1.sortByProperty)('-score'));
25
+ expect(data).toEqual([{ score: 30 }, { score: 20 }, { score: 10 }]);
26
+ });
27
+ it('sorts by string property descending', () => {
28
+ const data = [{ name: 'Alice' }, { name: 'Charlie' }, { name: 'Bob' }];
29
+ data.sort((0, sort_by_property_1.sortByProperty)('-name'));
30
+ expect(data).toEqual([
31
+ { name: 'Charlie' },
32
+ { name: 'Bob' },
33
+ { name: 'Alice' },
34
+ ]);
35
+ });
36
+ });
37
+ describe('null and undefined handling', () => {
38
+ it('places undefined values last', () => {
39
+ const data = [{ value: 2 }, { value: undefined }, { value: 1 }];
40
+ data.sort((0, sort_by_property_1.sortByProperty)('value'));
41
+ expect(data).toEqual([{ value: 1 }, { value: 2 }, { value: undefined }]);
42
+ });
43
+ it('places null values last', () => {
44
+ const data = [{ value: 2 }, { value: null }, { value: 1 }];
45
+ data.sort((0, sort_by_property_1.sortByProperty)('value'));
46
+ expect(data).toEqual([{ value: 1 }, { value: 2 }, { value: null }]);
47
+ });
48
+ });
49
+ describe('equal values', () => {
50
+ it('returns 0 for equal property values', () => {
51
+ const comparator = (0, sort_by_property_1.sortByProperty)('id');
52
+ expect(comparator({ id: 1 }, { id: 1 })).toBe(0);
53
+ });
54
+ });
55
+ describe('type safety (compile-time)', () => {
56
+ it('does not allow invalid properties', () => {
57
+ // @ts-expect-error
58
+ (0, sort_by_property_1.sortByProperty)('invalid');
59
+ // @ts-expect-error
60
+ (0, sort_by_property_1.sortByProperty)('-invalid');
61
+ });
62
+ });
63
+ });
@@ -1,3 +1,2 @@
1
- import { sortByProperties } from './sort-by-properties';
2
- import { sortByProperty } from './sort-by-property';
3
- export { sortByProperties, sortByProperty, };
1
+ export * from './sort-by-properties';
2
+ export * from './sort-by-property';
@@ -1,7 +1,18 @@
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.sortByProperty = exports.sortByProperties = void 0;
4
- const sort_by_properties_1 = require("./sort-by-properties");
5
- Object.defineProperty(exports, "sortByProperties", { enumerable: true, get: function () { return sort_by_properties_1.sortByProperties; } });
6
- const sort_by_property_1 = require("./sort-by-property");
7
- Object.defineProperty(exports, "sortByProperty", { enumerable: true, get: function () { return sort_by_property_1.sortByProperty; } });
17
+ __exportStar(require("./sort-by-properties"), exports);
18
+ __exportStar(require("./sort-by-property"), exports);
@@ -1,2 +1,2 @@
1
- import { GenericObject } from '../../types';
2
- export declare function sortByProperties(...props: string[]): (obj1: GenericObject, obj2: GenericObject) => number;
1
+ import { addPrefixToObject, PropertyOnly, PropOf } from '../../types';
2
+ export declare function sortByProperties<T extends object>(...props: (PropOf<T> | keyof addPrefixToObject<PropertyOnly<T>, '-'>)[]): (a: T, b: T) => number;
@@ -1,17 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sortByProperties = void 0;
3
+ exports.sortByProperties = sortByProperties;
4
4
  const _1 = require(".");
5
5
  function sortByProperties(...props) {
6
- return (obj1, obj2) => {
7
- const numberOfProperties = props.length;
6
+ return (a, b) => {
7
+ if (props.length === 0) {
8
+ return 0;
9
+ }
8
10
  let result = 0;
9
- let i = 0;
10
- while (result === 0 && i < numberOfProperties) {
11
- result = (0, _1.sortByProperty)(props[i])(obj1, obj2);
12
- i++;
11
+ for (const prop of props) {
12
+ result = (0, _1.sortByProperty)(prop)(a, b);
13
+ if (result !== 0) {
14
+ return result;
15
+ }
13
16
  }
14
- return result;
17
+ return 0;
15
18
  };
16
19
  }
17
- exports.sortByProperties = sortByProperties;
@@ -1,2 +1,2 @@
1
- import { GenericObject } from '../../types';
2
- export declare function sortByProperty(property: string): (a: GenericObject, b: GenericObject) => number;
1
+ import { addPrefixToObject, PropertyOnly, PropOf } from '../../types';
2
+ export declare function sortByProperty<T extends object>(property: PropOf<T> | keyof addPrefixToObject<PropertyOnly<T>, '-'>): (a: T, b: T) => number;
@@ -1,15 +1,27 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sortByProperty = void 0;
3
+ exports.sortByProperty = sortByProperty;
4
4
  function sortByProperty(property) {
5
5
  let sortOrder = 1;
6
- if (property.startsWith('-')) {
6
+ let prop = property;
7
+ if (prop.startsWith('-')) {
7
8
  sortOrder = -1;
8
- property = property.substring(1);
9
+ prop = prop.slice(1);
9
10
  }
11
+ const key = prop;
10
12
  return (a, b) => {
11
- const result = (a[property] < b[property]) ? -1 : (a[property] > b[property]) ? 1 : 0;
12
- return result * sortOrder;
13
+ const valueA = a[key];
14
+ const valueB = b[key];
15
+ if (valueA == null && valueB == null)
16
+ return 0;
17
+ if (valueA == null)
18
+ return 1 * sortOrder;
19
+ if (valueB == null)
20
+ return -1 * sortOrder;
21
+ if (valueA < valueB)
22
+ return -1 * sortOrder;
23
+ if (valueA > valueB)
24
+ return 1 * sortOrder;
25
+ return 0;
13
26
  };
14
27
  }
15
- exports.sortByProperty = sortByProperty;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const is_function_1 = require("../is-function");
4
+ describe('isFunction', () => {
5
+ it('should return true for regular functions', () => {
6
+ const fn = () => { };
7
+ expect((0, is_function_1.isFunction)(fn)).toBe(true);
8
+ });
9
+ it('should return true for async functions', () => {
10
+ const fn = async () => { };
11
+ expect((0, is_function_1.isFunction)(fn)).toBe(true);
12
+ });
13
+ it('should return true for class constructors', () => {
14
+ class Test {
15
+ }
16
+ expect((0, is_function_1.isFunction)(Test)).toBe(true);
17
+ });
18
+ it('should return false for non-function values', () => {
19
+ expect((0, is_function_1.isFunction)(123)).toBe(false);
20
+ expect((0, is_function_1.isFunction)('string')).toBe(false);
21
+ expect((0, is_function_1.isFunction)(null)).toBe(false);
22
+ expect((0, is_function_1.isFunction)(undefined)).toBe(false);
23
+ expect((0, is_function_1.isFunction)({})).toBe(false);
24
+ expect((0, is_function_1.isFunction)([])).toBe(false);
25
+ expect((0, is_function_1.isFunction)(true)).toBe(false);
26
+ });
27
+ it('should narrow the type when returning true (type guard)', () => {
28
+ const value = () => 'hello';
29
+ if ((0, is_function_1.isFunction)(value)) {
30
+ // If this compiles, the type guard works
31
+ const result = value();
32
+ expect(result).toBe('hello');
33
+ }
34
+ else {
35
+ fail('Expected value to be a function');
36
+ }
37
+ });
38
+ });
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const is_number_1 = require("../is-number");
4
+ describe('isNumber', () => {
5
+ it('should return true for valid numbers', () => {
6
+ expect((0, is_number_1.isNumber)(0)).toBe(true);
7
+ expect((0, is_number_1.isNumber)(42)).toBe(true);
8
+ expect((0, is_number_1.isNumber)(-10)).toBe(true);
9
+ expect((0, is_number_1.isNumber)(3.14)).toBe(true);
10
+ expect((0, is_number_1.isNumber)(NaN)).toBe(true); // typeof NaN === 'number'
11
+ expect((0, is_number_1.isNumber)(Infinity)).toBe(true);
12
+ expect((0, is_number_1.isNumber)(-Infinity)).toBe(true);
13
+ });
14
+ it('should return false for non-number values', () => {
15
+ expect((0, is_number_1.isNumber)('123')).toBe(false);
16
+ expect((0, is_number_1.isNumber)(null)).toBe(false);
17
+ expect((0, is_number_1.isNumber)(undefined)).toBe(false);
18
+ expect((0, is_number_1.isNumber)({})).toBe(false);
19
+ expect((0, is_number_1.isNumber)([])).toBe(false);
20
+ expect((0, is_number_1.isNumber)(true)).toBe(false);
21
+ expect((0, is_number_1.isNumber)(false)).toBe(false);
22
+ expect((0, is_number_1.isNumber)(() => 1)).toBe(false);
23
+ });
24
+ it('should narrow the type when returning true (type guard)', () => {
25
+ const value = 123;
26
+ if ((0, is_number_1.isNumber)(value)) {
27
+ // If this compiles, the type guard works
28
+ const result = value + 1;
29
+ expect(result).toBe(124);
30
+ }
31
+ else {
32
+ fail('Expected value to be a number');
33
+ }
34
+ });
35
+ });
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const is_object_1 = require("../is-object");
4
+ describe('isObject', () => {
5
+ it('should return true for plain objects', () => {
6
+ expect((0, is_object_1.isObject)({})).toBe(true);
7
+ expect((0, is_object_1.isObject)({ a: 1 })).toBe(true);
8
+ expect((0, is_object_1.isObject)(Object.create(null))).toBe(true);
9
+ });
10
+ it('should return true for non-plain objects (by design)', () => {
11
+ expect((0, is_object_1.isObject)([])).toBe(true); // arrays are objects
12
+ expect((0, is_object_1.isObject)(new Date())).toBe(true); // Date is an object
13
+ expect((0, is_object_1.isObject)(/regex/)).toBe(true); // RegExp is an object
14
+ expect((0, is_object_1.isObject)(new Map())).toBe(true);
15
+ expect((0, is_object_1.isObject)(new Set())).toBe(true);
16
+ });
17
+ it('should return false for null', () => {
18
+ expect((0, is_object_1.isObject)(null)).toBe(false);
19
+ });
20
+ it('should return false for non-object types', () => {
21
+ expect((0, is_object_1.isObject)(undefined)).toBe(false);
22
+ expect((0, is_object_1.isObject)(123)).toBe(false);
23
+ expect((0, is_object_1.isObject)('string')).toBe(false);
24
+ expect((0, is_object_1.isObject)(true)).toBe(false);
25
+ expect((0, is_object_1.isObject)(false)).toBe(false);
26
+ expect((0, is_object_1.isObject)(() => { })).toBe(false); // functions are not objects
27
+ });
28
+ it('should narrow the type when returning true (type guard)', () => {
29
+ const value = { a: 1 };
30
+ if ((0, is_object_1.isObject)(value)) {
31
+ // TypeScript now knows value is object
32
+ expect(typeof value).toBe('object');
33
+ }
34
+ else {
35
+ fail('Expected value to be an object');
36
+ }
37
+ });
38
+ });
@@ -1,4 +1,3 @@
1
- import { isFunction } from './is-function';
2
- import { isNumber } from './is-number';
3
- import { isObject } from './is-object';
4
- export { isFunction, isNumber, isObject, };
1
+ export * from './is-function';
2
+ export * from './is-number';
3
+ export * from './is-object';
@@ -1,9 +1,19 @@
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.isObject = exports.isNumber = exports.isFunction = void 0;
4
- const is_function_1 = require("./is-function");
5
- Object.defineProperty(exports, "isFunction", { enumerable: true, get: function () { return is_function_1.isFunction; } });
6
- const is_number_1 = require("./is-number");
7
- Object.defineProperty(exports, "isNumber", { enumerable: true, get: function () { return is_number_1.isNumber; } });
8
- const is_object_1 = require("./is-object");
9
- Object.defineProperty(exports, "isObject", { enumerable: true, get: function () { return is_object_1.isObject; } });
17
+ __exportStar(require("./is-function"), exports);
18
+ __exportStar(require("./is-number"), exports);
19
+ __exportStar(require("./is-object"), exports);
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * Determines if the given value is a function.
3
3
  *
4
- * @param {any} value The value to check.
4
+ * @param value The value to check.
5
5
  *
6
- * @returns {boolean} Validation result.
6
+ * @returns Validation result.
7
7
  */
8
- export declare const isFunction: (value: any) => value is (...args: any[]) => any;
8
+ export declare const isFunction: <T>(value: unknown) => value is T;
@@ -4,9 +4,9 @@ exports.isFunction = void 0;
4
4
  /**
5
5
  * Determines if the given value is a function.
6
6
  *
7
- * @param {any} value The value to check.
7
+ * @param value The value to check.
8
8
  *
9
- * @returns {boolean} Validation result.
9
+ * @returns Validation result.
10
10
  */
11
11
  const isFunction = (value) => typeof value === 'function';
12
12
  exports.isFunction = isFunction;
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * Determines if the given value is a number.
3
3
  *
4
- * @param {any} value The value to check.
4
+ * @param value The value to check.
5
5
  *
6
- * @returns {boolean} Validation result.
6
+ * @returns Validation result.
7
7
  */
8
- export declare const isNumber: (value: any) => value is number;
8
+ export declare const isNumber: (value: unknown) => value is number;
@@ -4,9 +4,9 @@ exports.isNumber = void 0;
4
4
  /**
5
5
  * Determines if the given value is a number.
6
6
  *
7
- * @param {any} value The value to check.
7
+ * @param value The value to check.
8
8
  *
9
- * @returns {boolean} Validation result.
9
+ * @returns Validation result.
10
10
  */
11
11
  const isNumber = (value) => typeof value === 'number';
12
12
  exports.isNumber = isNumber;
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * Determines if the given value is an object.
3
3
  *
4
- * @param {any} value The value to check.
4
+ * @param value The value to check.
5
5
  *
6
- * @returns {boolean} Validation result.
6
+ * @returns Validation result.
7
7
  */
8
- export declare const isObject: (value: any) => value is object;
8
+ export declare const isObject: (value: unknown) => value is object;
@@ -4,9 +4,9 @@ exports.isObject = void 0;
4
4
  /**
5
5
  * Determines if the given value is an object.
6
6
  *
7
- * @param {any} value The value to check.
7
+ * @param value The value to check.
8
8
  *
9
- * @returns {boolean} Validation result.
9
+ * @returns Validation result.
10
10
  */
11
11
  const isObject = (value) => typeof value === 'object' && value !== null;
12
12
  exports.isObject = isObject;
@@ -1,3 +1,3 @@
1
- export declare type addPrefixToObject<T, P extends string> = {
1
+ export type addPrefixToObject<T, P extends string> = {
2
2
  [K in keyof T as K extends string ? `${P}${K}` : never]: T[K];
3
3
  };
@@ -2,4 +2,4 @@ import { FlagExcludedType } from '.';
2
2
  /**
3
3
  * Gets the keys that are not flagged as 'never'.
4
4
  */
5
- export declare type AllowedNames<Base, Type> = FlagExcludedType<Base, Type>[keyof Base];
5
+ export type AllowedNames<Base, Type> = FlagExcludedType<Base, Type>[keyof Base];
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Transforms the type to flag all the undesired keys as 'never'.
3
3
  */
4
- export declare type FlagExcludedType<Base, Type> = {
4
+ export type FlagExcludedType<Base, Type> = {
5
5
  [Key in keyof Base]: Base[Key] extends Type ? never : Key;
6
6
  };
@@ -1,3 +1,3 @@
1
1
  export interface GenericObject {
2
- [key: string]: any;
2
+ [key: string]: unknown;
3
3
  }
@@ -1,3 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- ;
@@ -1,10 +1,9 @@
1
- import { addPrefixToObject } from './add-prefix-to-object';
2
- import { AllowedNames } from './allowed-names';
3
- import { FlagExcludedType } from './flag-excluded-type';
4
- import { GenericObject } from './generic-object';
5
- import { OmitType } from './omit-type';
6
- import { PartialOfProperties } from './partial-of-properties';
7
- import { PropertyOnly } from './property-only';
8
- import { PropOf } from './prop-of';
9
- import { RecursivePartial } from './recursive-partial';
10
- export { addPrefixToObject, AllowedNames, FlagExcludedType, GenericObject, OmitType, PartialOfProperties, PropertyOnly, PropOf, RecursivePartial, };
1
+ export * from './add-prefix-to-object';
2
+ export * from './allowed-names';
3
+ export * from './flag-excluded-type';
4
+ export * from './generic-object';
5
+ export * from './omit-type';
6
+ export * from './partial-of-properties';
7
+ export * from './prop-of';
8
+ export * from './property-only';
9
+ export * from './recursive-partial';
@@ -1,2 +1,25 @@
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 });
17
+ __exportStar(require("./add-prefix-to-object"), exports);
18
+ __exportStar(require("./allowed-names"), exports);
19
+ __exportStar(require("./flag-excluded-type"), exports);
20
+ __exportStar(require("./generic-object"), exports);
21
+ __exportStar(require("./omit-type"), exports);
22
+ __exportStar(require("./partial-of-properties"), exports);
23
+ __exportStar(require("./prop-of"), exports);
24
+ __exportStar(require("./property-only"), exports);
25
+ __exportStar(require("./recursive-partial"), exports);
@@ -2,4 +2,4 @@ import { AllowedNames } from '.';
2
2
  /**
3
3
  * Use this with a simple Pick to get the right interface, excluding the undesired type.
4
4
  */
5
- export declare type OmitType<Base, Type> = Pick<Base, AllowedNames<Base, Type>>;
5
+ export type OmitType<Base, Type> = Pick<Base, AllowedNames<Base, Type>>;
@@ -1,2 +1,2 @@
1
1
  import { PropertyOnly } from '.';
2
- export declare type PartialOfProperties<T extends object> = Partial<PropertyOnly<T>>;
2
+ export type PartialOfProperties<T extends object> = Partial<PropertyOnly<T>>;
@@ -2,4 +2,4 @@ import { PropertyOnly } from '.';
2
2
  /**
3
3
  * Represents a property of a class or interface.
4
4
  */
5
- export declare type PropOf<T extends object> = keyof PropertyOnly<T>;
5
+ export type PropOf<T extends object> = keyof PropertyOnly<T>;
@@ -1,4 +1,4 @@
1
1
  import { NonFunctionKeys } from 'utility-types';
2
- export declare type PropertyOnly<T extends object> = {
2
+ export type PropertyOnly<T extends object> = {
3
3
  [P in NonFunctionKeys<T>]: T[P];
4
4
  };
@@ -1,3 +1,3 @@
1
- export declare type RecursivePartial<T> = {
1
+ export type RecursivePartial<T> = {
2
2
  [P in keyof T]?: T[P] extends (infer U)[] ? RecursivePartial<U>[] : T[P] extends object ? RecursivePartial<T[P]> : T[P];
3
3
  };
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * Represents a class.
3
3
  */
4
- export declare type Type<T = any> = new (...args: any[]) => T;
4
+ export type Type<T = unknown> = new (...args: unknown[]) => T;
package/package.json CHANGED
@@ -1,20 +1,12 @@
1
1
  {
2
2
  "name": "querier-ts",
3
- "version": "0.0.0",
3
+ "version": "1.0.0",
4
4
  "description": "Query tool for analysing arrays of objects",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
7
- "scripts": {
8
- "test": "jest --config jestconfig.json",
9
- "build": "tsc",
10
- "format": "prettier --write \"src/*.ts\"",
11
- "lint": "tslint -p tsconfig.json",
12
- "prepare": "npm run build",
13
- "prepublishOnly": "npm test && npm run lint",
14
- "preversion": "npm run lint",
15
- "version": "npm run format && git add -A src",
16
- "postversion": "git push && git push --tags"
17
- },
7
+ "files": [
8
+ "lib/**/*"
9
+ ],
18
10
  "repository": {
19
11
  "type": "git",
20
12
  "url": "git+https://github.com/luizfilipezs/query-ts.git"
@@ -33,20 +25,27 @@
33
25
  "url": "https://github.com/luizfilipezs/query-ts/issues"
34
26
  },
35
27
  "homepage": "https://github.com/luizfilipezs/query-ts#readme",
28
+ "dependencies": {
29
+ "reflect-metadata": "^0.2.2",
30
+ "utility-types": "^3.11.0"
31
+ },
36
32
  "devDependencies": {
37
- "@types/jest": "^27.4.0",
38
- "jest": "^27.5.0",
39
- "prettier": "^2.5.1",
40
- "ts-jest": "^27.1.3",
33
+ "@types/jest": "^30.0.0",
34
+ "jest": "^30.2.0",
35
+ "prettier": "^3.8.1",
36
+ "prettier-plugin-organize-imports": "^4.3.0",
37
+ "ts-jest": "^29.4.6",
41
38
  "tslint": "^6.1.3",
42
39
  "tslint-config-prettier": "^1.18.0",
43
- "typescript": "~4.5.2"
40
+ "typescript": "~5.9.3"
44
41
  },
45
- "files": [
46
- "lib/**/*"
47
- ],
48
- "dependencies": {
49
- "reflect-metadata": "^0.1.13",
50
- "utility-types": "^3.10.0"
42
+ "scripts": {
43
+ "test": "jest --config jestconfig.json",
44
+ "build": "tsc",
45
+ "format": "prettier --write \"src/**/*.ts\"",
46
+ "lint": "tslint -p tsconfig.json",
47
+ "preversion": "pnpm lint",
48
+ "version": "pnpm format && git add -A src",
49
+ "postversion": "git push && git push --tags"
51
50
  }
52
- }
51
+ }