querier-ts 1.0.1 → 2.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 (172) hide show
  1. package/README.md +76 -70
  2. package/lib/core/errors/index.d.ts +1 -0
  3. package/lib/core/errors/index.d.ts.map +1 -0
  4. package/lib/core/errors/index.js +2 -17
  5. package/lib/core/errors/index.js.map +1 -0
  6. package/lib/core/errors/invalid-argument-error.d.ts +1 -0
  7. package/lib/core/errors/invalid-argument-error.d.ts.map +1 -0
  8. package/lib/core/errors/invalid-argument-error.js +2 -5
  9. package/lib/core/errors/invalid-argument-error.js.map +1 -0
  10. package/lib/core/types/attribute-validation-function.d.ts +1 -0
  11. package/lib/core/types/attribute-validation-function.d.ts.map +1 -0
  12. package/lib/core/types/attribute-validation-function.js +2 -2
  13. package/lib/core/types/attribute-validation-function.js.map +1 -0
  14. package/lib/core/types/column-condition.d.ts +3 -2
  15. package/lib/core/types/column-condition.d.ts.map +1 -0
  16. package/lib/core/types/column-condition.js +2 -2
  17. package/lib/core/types/column-condition.js.map +1 -0
  18. package/lib/core/types/index.d.ts +1 -0
  19. package/lib/core/types/index.d.ts.map +1 -0
  20. package/lib/core/types/index.js +5 -20
  21. package/lib/core/types/index.js.map +1 -0
  22. package/lib/core/types/ordering-column.d.ts +3 -0
  23. package/lib/core/types/ordering-column.d.ts.map +1 -0
  24. package/lib/core/types/ordering-column.js +2 -0
  25. package/lib/core/types/ordering-column.js.map +1 -0
  26. package/lib/core/types/query-conditions-group-nullable.d.ts +2 -1
  27. package/lib/core/types/query-conditions-group-nullable.d.ts.map +1 -0
  28. package/lib/core/types/query-conditions-group-nullable.js +2 -2
  29. package/lib/core/types/query-conditions-group-nullable.js.map +1 -0
  30. package/lib/core/types/query-conditions-group.d.ts +2 -1
  31. package/lib/core/types/query-conditions-group.d.ts.map +1 -0
  32. package/lib/core/types/query-conditions-group.js +2 -2
  33. package/lib/core/types/query-conditions-group.js.map +1 -0
  34. package/lib/core/types/query-row-validator-initializer.d.ts +2 -1
  35. package/lib/core/types/query-row-validator-initializer.d.ts.map +1 -0
  36. package/lib/core/types/query-row-validator-initializer.js +2 -2
  37. package/lib/core/types/query-row-validator-initializer.js.map +1 -0
  38. package/lib/core/validation/decorators/index.d.ts +1 -0
  39. package/lib/core/validation/decorators/index.d.ts.map +1 -0
  40. package/lib/core/validation/decorators/index.js +2 -17
  41. package/lib/core/validation/decorators/index.js.map +1 -0
  42. package/lib/core/validation/decorators/number-validaton.d.ts +5 -36
  43. package/lib/core/validation/decorators/number-validaton.d.ts.map +1 -0
  44. package/lib/core/validation/decorators/number-validaton.js +86 -113
  45. package/lib/core/validation/decorators/number-validaton.js.map +1 -0
  46. package/lib/core/validation/index.d.ts +1 -0
  47. package/lib/core/validation/index.d.ts.map +1 -0
  48. package/lib/core/validation/index.js +2 -17
  49. package/lib/core/validation/index.js.map +1 -0
  50. package/lib/core/validation/query-row-validator.d.ts +2 -1
  51. package/lib/core/validation/query-row-validator.d.ts.map +1 -0
  52. package/lib/core/validation/query-row-validator.js +9 -12
  53. package/lib/core/validation/query-row-validator.js.map +1 -0
  54. package/lib/index.d.ts +1 -0
  55. package/lib/index.d.ts.map +1 -0
  56. package/lib/index.js +2 -17
  57. package/lib/index.js.map +1 -0
  58. package/lib/query.d.ts +34 -5
  59. package/lib/query.d.ts.map +1 -0
  60. package/lib/query.js +117 -62
  61. package/lib/query.js.map +1 -0
  62. package/lib/utils/functions/generic/compare-arrays.d.ts +1 -0
  63. package/lib/utils/functions/generic/compare-arrays.d.ts.map +1 -0
  64. package/lib/utils/functions/generic/compare-arrays.js +3 -6
  65. package/lib/utils/functions/generic/compare-arrays.js.map +1 -0
  66. package/lib/utils/functions/generic/deep-equal.d.ts +1 -0
  67. package/lib/utils/functions/generic/deep-equal.d.ts.map +1 -0
  68. package/lib/utils/functions/generic/deep-equal.js +5 -8
  69. package/lib/utils/functions/generic/deep-equal.js.map +1 -0
  70. package/lib/utils/functions/generic/get-entries.d.ts +2 -5
  71. package/lib/utils/functions/generic/get-entries.d.ts.map +1 -0
  72. package/lib/utils/functions/generic/get-entries.js +3 -9
  73. package/lib/utils/functions/generic/get-entries.js.map +1 -0
  74. package/lib/utils/functions/generic/get-object-property-names.d.ts +3 -0
  75. package/lib/utils/functions/generic/get-object-property-names.d.ts.map +1 -0
  76. package/lib/utils/functions/generic/get-object-property-names.js +4 -0
  77. package/lib/utils/functions/generic/get-object-property-names.js.map +1 -0
  78. package/lib/utils/functions/generic/index.d.ts +1 -0
  79. package/lib/utils/functions/generic/index.d.ts.map +1 -0
  80. package/lib/utils/functions/generic/index.js +4 -19
  81. package/lib/utils/functions/generic/index.js.map +1 -0
  82. package/lib/utils/functions/sort/index.d.ts +1 -0
  83. package/lib/utils/functions/sort/index.d.ts.map +1 -0
  84. package/lib/utils/functions/sort/index.js +3 -18
  85. package/lib/utils/functions/sort/index.js.map +1 -0
  86. package/lib/utils/functions/sort/sort-by-properties.d.ts +2 -1
  87. package/lib/utils/functions/sort/sort-by-properties.d.ts.map +1 -0
  88. package/lib/utils/functions/sort/sort-by-properties.js +4 -7
  89. package/lib/utils/functions/sort/sort-by-properties.js.map +1 -0
  90. package/lib/utils/functions/sort/sort-by-property.d.ts +2 -1
  91. package/lib/utils/functions/sort/sort-by-property.d.ts.map +1 -0
  92. package/lib/utils/functions/sort/sort-by-property.js +2 -4
  93. package/lib/utils/functions/sort/sort-by-property.js.map +1 -0
  94. package/lib/utils/functions/type-guards/index.d.ts +1 -0
  95. package/lib/utils/functions/type-guards/index.d.ts.map +1 -0
  96. package/lib/utils/functions/type-guards/index.js +4 -19
  97. package/lib/utils/functions/type-guards/index.js.map +1 -0
  98. package/lib/utils/functions/type-guards/is-function.d.ts +1 -0
  99. package/lib/utils/functions/type-guards/is-function.d.ts.map +1 -0
  100. package/lib/utils/functions/type-guards/is-function.js +2 -5
  101. package/lib/utils/functions/type-guards/is-function.js.map +1 -0
  102. package/lib/utils/functions/type-guards/is-number.d.ts +1 -0
  103. package/lib/utils/functions/type-guards/is-number.d.ts.map +1 -0
  104. package/lib/utils/functions/type-guards/is-number.js +2 -5
  105. package/lib/utils/functions/type-guards/is-number.js.map +1 -0
  106. package/lib/utils/functions/type-guards/is-object.d.ts +1 -0
  107. package/lib/utils/functions/type-guards/is-object.d.ts.map +1 -0
  108. package/lib/utils/functions/type-guards/is-object.js +2 -5
  109. package/lib/utils/functions/type-guards/is-object.js.map +1 -0
  110. package/lib/utils/types/add-prefix-to-object.d.ts +1 -0
  111. package/lib/utils/types/add-prefix-to-object.d.ts.map +1 -0
  112. package/lib/utils/types/add-prefix-to-object.js +2 -2
  113. package/lib/utils/types/add-prefix-to-object.js.map +1 -0
  114. package/lib/utils/types/allowed-names.d.ts +2 -1
  115. package/lib/utils/types/allowed-names.d.ts.map +1 -0
  116. package/lib/utils/types/allowed-names.js +2 -2
  117. package/lib/utils/types/allowed-names.js.map +1 -0
  118. package/lib/utils/types/flag-excluded-type.d.ts +1 -0
  119. package/lib/utils/types/flag-excluded-type.d.ts.map +1 -0
  120. package/lib/utils/types/flag-excluded-type.js +2 -2
  121. package/lib/utils/types/flag-excluded-type.js.map +1 -0
  122. package/lib/utils/types/generic-object.d.ts +1 -0
  123. package/lib/utils/types/generic-object.d.ts.map +1 -0
  124. package/lib/utils/types/generic-object.js +2 -2
  125. package/lib/utils/types/generic-object.js.map +1 -0
  126. package/lib/utils/types/index.d.ts +1 -0
  127. package/lib/utils/types/index.d.ts.map +1 -0
  128. package/lib/utils/types/index.js +11 -26
  129. package/lib/utils/types/index.js.map +1 -0
  130. package/lib/utils/types/omit-type.d.ts +2 -1
  131. package/lib/utils/types/omit-type.d.ts.map +1 -0
  132. package/lib/utils/types/omit-type.js +2 -2
  133. package/lib/utils/types/omit-type.js.map +1 -0
  134. package/lib/utils/types/partial-of-properties.d.ts +2 -1
  135. package/lib/utils/types/partial-of-properties.d.ts.map +1 -0
  136. package/lib/utils/types/partial-of-properties.js +2 -2
  137. package/lib/utils/types/partial-of-properties.js.map +1 -0
  138. package/lib/utils/types/prop-of.d.ts +2 -1
  139. package/lib/utils/types/prop-of.d.ts.map +1 -0
  140. package/lib/utils/types/prop-of.js +2 -2
  141. package/lib/utils/types/prop-of.js.map +1 -0
  142. package/lib/utils/types/property-only.d.ts +2 -1
  143. package/lib/utils/types/property-only.d.ts.map +1 -0
  144. package/lib/utils/types/property-only.js +2 -2
  145. package/lib/utils/types/property-only.js.map +1 -0
  146. package/lib/utils/types/recursive-partial.d.ts +1 -0
  147. package/lib/utils/types/recursive-partial.d.ts.map +1 -0
  148. package/lib/utils/types/recursive-partial.js +2 -2
  149. package/lib/utils/types/recursive-partial.js.map +1 -0
  150. package/lib/utils/types/sort-function.d.ts +1 -0
  151. package/lib/utils/types/sort-function.d.ts.map +1 -0
  152. package/lib/utils/types/sort-function.js +2 -2
  153. package/lib/utils/types/sort-function.js.map +1 -0
  154. package/lib/utils/types/type.d.ts +1 -0
  155. package/lib/utils/types/type.d.ts.map +1 -0
  156. package/lib/utils/types/type.js +2 -2
  157. package/lib/utils/types/type.js.map +1 -0
  158. package/package.json +23 -10
  159. package/lib/base-object.d.ts +0 -6
  160. package/lib/base-object.js +0 -15
  161. package/lib/errors/index.d.ts +0 -2
  162. package/lib/errors/index.js +0 -5
  163. package/lib/errors/invalid-argument-error.d.ts +0 -10
  164. package/lib/errors/invalid-argument-error.js +0 -11
  165. package/lib/query-conditions-group-nullable.d.ts +0 -4
  166. package/lib/query-conditions-group-nullable.js +0 -2
  167. package/lib/query-conditions-group.d.ts +0 -4
  168. package/lib/query-conditions-group.js +0 -2
  169. package/lib/query-row-validator.d.ts +0 -72
  170. package/lib/query-row-validator.js +0 -85
  171. package/lib/utils/decorators/number-validaton.d.ts +0 -36
  172. package/lib/utils/decorators/number-validaton.js +0 -124
package/README.md CHANGED
@@ -1,49 +1,29 @@
1
- # query-ts
2
-
3
- A package that allows you to query data from an array of objects.
4
-
5
- ## Introduction
6
-
7
- The following data will be used in the samples of this documentation:
8
-
9
- ```ts
10
- interface UserPermissions {
11
- useCookies: boolean;
12
- sendNotifications: boolean;
13
- }
14
-
15
- class User {
16
- id: number;
17
- name: string;
18
- permissions: UserPermissions;
19
- isActive: boolean;
20
- createdAt: Date;
21
- updatedAt: Date;
22
-
23
- isAdmin(): boolean {
24
- ...
25
- }
26
- }
27
-
28
- const users: User[] = [
29
- ...
30
- ];
31
- ```
1
+ <h1 align="center">
2
+ querier-ts
3
+ </h1>
4
+ <p align="center">
5
+ A lightweight, type-safe in-memory query engine for JavaScript and TypeScript.
6
+ <p>
7
+ <p align="center">
8
+ <a href="https://npmx.dev/package/querier-ts"><img src="https://img.shields.io/npm/v/querier-ts?color=729B1B&label=" alt="current querier-ts version badge"></a>
9
+ <p>
32
10
 
33
11
  ## `Query`
34
12
 
35
- A `Query` can be created this way:
13
+ You can create a `Query` instance like this:
36
14
 
37
15
  ```ts
38
16
  const usersQuery = Query.from(users);
39
17
  ```
40
18
 
41
- TypeScript will automatically assume that the query data type is `User`. You can make it explicit:
19
+ TypeScript will automatically infer the query data type. You can also make it explicit:
42
20
 
43
21
  ```ts
44
22
  const usersQuery = Query.from<User>(users);
45
23
  ```
46
24
 
25
+ ---
26
+
47
27
  ### Getting results
48
28
 
49
29
  #### `all()`
@@ -66,16 +46,18 @@ Returns the number of results.
66
46
 
67
47
  Returns a boolean indicating whether any results exist.
68
48
 
49
+ ---
50
+
69
51
  ### Filtering data
70
52
 
71
53
  #### `where(condition)`
72
54
 
73
- There are two types of parameters:
55
+ This method accepts two types of parameters:
74
56
 
75
- 1. An object where each property represents an attribute to be validated.
76
- 2. A callback function that returns a boolean validating the object.
57
+ 1. An object, where each property represents a field to be validated.
58
+ 2. A callback function that returns a boolean.
77
59
 
78
- When the condition is an object, you can pass literal values or callback functions to each attribute that needs to be validated.
60
+ When passing an object, each property can be either a literal value or a callback function used for validation.
79
61
 
80
62
  ```ts
81
63
  const activeGmailUsers = Query.from(users)
@@ -83,60 +65,68 @@ const activeGmailUsers = Query.from(users)
83
65
  isActive: true,
84
66
  email: (email) => email.endsWith('@gmail.com'),
85
67
  })
86
- .where((user) => (
87
- !user.isAdmin()
88
- ))
68
+ .where((user) => !user.isAdmin())
89
69
  .all();
90
70
  ```
91
71
 
92
- It also works on inner objects:
72
+ It also supports nested objects:
93
73
 
94
74
  ```ts
95
- .where({
96
- permissions: {
97
- sendNotifications: true,
98
- },
99
- })
75
+ .where({
76
+ permissions: {
77
+ sendNotifications: true,
78
+ },
79
+ })
100
80
  ```
101
81
 
82
+ ---
83
+
102
84
  #### `filterWhere(condition)`
103
85
 
104
- The difference of `filterWhere` is that it only accepts an object and it ignores conditions whose values are `null` or `undefined`.
86
+ Unlike `where()`, `filterWhere()`:
87
+
88
+ * Accepts only an object
89
+ * Ignores properties whose values are `null` or `undefined`
105
90
 
106
91
  ```ts
107
- let isActive: bool;
92
+ let isActive: boolean; // undefined
108
93
 
109
94
  const filteredUsers = Query.from(users)
110
95
  .filterWhere({
111
96
  id: 1,
112
- isActive: isActive, // this condition will be skipped
97
+ isActive: isActive, // ignored
113
98
  })
114
99
  .all();
115
100
  ```
116
101
 
117
- >**Remember**: if you want to check if a value is really `null` or `undefined`, use `where()`.
102
+ > **Note:** If you need to explicitly check for `null` or `undefined`, use `where()` instead.
103
+
104
+ ---
118
105
 
119
106
  ### Selecting specific data
120
107
 
121
108
  #### `select(columns)`
122
109
 
123
- This method can be combined with `scalar()`, `column()`, or `values()`. It determines which columns should be selected.
110
+ Defines which columns should be selected.
111
+ It can be combined with `scalar()`, `column()`, or `values()`.
124
112
 
125
- It accepts a string containing a single column name or an array of column names.
113
+ Accepts either a string (single column) or an array of column names.
126
114
 
127
115
  ```ts
128
- .select('id')
116
+ .select('id')
129
117
  ```
130
118
 
119
+ ---
120
+
131
121
  #### `scalar()`
132
122
 
133
- It returns the value of the first property of the first object.
123
+ Returns the value of the first property of the first result.
134
124
 
135
125
  ```ts
136
126
  const firstId = Query.from(users).scalar();
137
127
  ```
138
128
 
139
- As mentioned above, it is possible to combine it with `select()` in order to get the value of another property.
129
+ You can combine it with `select()` to retrieve a specific property:
140
130
 
141
131
  ```ts
142
132
  const firstEmail = Query.from(users)
@@ -144,17 +134,25 @@ const firstEmail = Query.from(users)
144
134
  .scalar();
145
135
  ```
146
136
 
147
- `false` is returned where there is no value.
137
+ Returns `false` if no value is found.
138
+
139
+ ---
148
140
 
149
141
  #### `column()`
150
142
 
151
- It returns the values of the first properties of all objects.
143
+ Returns the values of the first property from all results by default.
152
144
 
153
145
  ```ts
154
146
  const ids = Query.from(users).column();
155
147
  ```
156
148
 
157
- You can also use it with `select()`:
149
+ You can specify a column:
150
+
151
+ ```ts
152
+ const emails = Query.from(users).column('email');
153
+ ```
154
+
155
+ Or combine it with `select()`:
158
156
 
159
157
  ```ts
160
158
  const emails = Query.from(users)
@@ -162,9 +160,11 @@ const emails = Query.from(users)
162
160
  .column();
163
161
  ```
164
162
 
163
+ ---
164
+
165
165
  #### `values()`
166
166
 
167
- It returns the values of all objects as arrays.
167
+ Returns all results as arrays of values.
168
168
 
169
169
  ```ts
170
170
  const data = Query.from(users)
@@ -172,7 +172,7 @@ const data = Query.from(users)
172
172
  .values();
173
173
  ```
174
174
 
175
- `data` would be something like this:
175
+ Example output:
176
176
 
177
177
  ```ts
178
178
  [
@@ -181,19 +181,21 @@ const data = Query.from(users)
181
181
  ]
182
182
  ```
183
183
 
184
+ ---
185
+
184
186
  ### Ordering results
185
187
 
186
188
  #### `orderBy(...columns)`
187
189
 
188
- Sorts the results. You can pass multiple arguments to it.
190
+ Sorts the results. You can pass multiple columns.
189
191
 
190
192
  ```ts
191
- .orderBy('name', 'id')
193
+ .orderBy('name', 'id')
192
194
  ```
193
195
 
194
- In the example above, `name` will have more priority than `id`.
196
+ In this example, `name` has higher priority than `id`.
195
197
 
196
- It is also possible to apply descending order:
198
+ You can also sort in descending order by prefixing the column with `-`:
197
199
 
198
200
  ```ts
199
201
  const lastId = Query.from(users)
@@ -202,24 +204,28 @@ const lastId = Query.from(users)
202
204
  .scalar();
203
205
  ```
204
206
 
207
+ ---
208
+
205
209
  ### Limiting results
206
210
 
207
211
  #### `limit(limit)`
208
212
 
209
- This method can be used to set a limit of results.
213
+ Limits the number of results returned.
210
214
 
211
215
  ```ts
212
- .limit(100)
216
+ .limit(100)
213
217
  ```
214
218
 
215
- >Passing a float or a negative number will throw an `InvalidArgumentError`.
219
+ > Passing a non-integer or a negative number will throw an `InvalidArgumentError`.
220
+
221
+ ---
216
222
 
217
223
  #### `skip(numberOfRows)`
218
224
 
219
225
  Skips the first results.
220
226
 
221
227
  ```ts
222
- .skip(5)
228
+ .skip(5)
223
229
  ```
224
230
 
225
231
  Example:
@@ -227,8 +233,8 @@ Example:
227
233
  ```ts
228
234
  const secondId = Query.from(users)
229
235
  .select('id')
230
- .skip(1) // skips the first user
236
+ .skip(1)
231
237
  .scalar();
232
238
  ```
233
239
 
234
- >Passing a float or a negative number will throw an `InvalidArgumentError`.
240
+ > Passing a non-integer or a negative number will throw an `InvalidArgumentError`.
@@ -1 +1,2 @@
1
1
  export * from './invalid-argument-error';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/errors/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC"}
@@ -1,17 +1,2 @@
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("./invalid-argument-error"), exports);
1
+ export * from './invalid-argument-error';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/errors/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC"}
@@ -12,3 +12,4 @@ export declare class InvalidArgumentError extends Error {
12
12
  constructor({ method, param, argument, expected, }: InvalidArgumentErrorConfig);
13
13
  }
14
14
  export {};
15
+ //# sourceMappingURL=invalid-argument-error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invalid-argument-error.d.ts","sourceRoot":"","sources":["../../../src/core/errors/invalid-argument-error.ts"],"names":[],"mappings":"AAAA,UAAU,0BAA0B;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,qBAAa,oBAAqB,SAAQ,KAAK;IAC7C,SAAgB,MAAM,EAAE,MAAM,CAAC;IAC/B,SAAgB,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvC,SAAgB,QAAQ,EAAE,OAAO,CAAC;IAClC,SAAgB,QAAQ,EAAE,MAAM,CAAC;gBAErB,EACV,MAAM,EACN,KAAK,EACL,QAAQ,EACR,QAAQ,GACT,EAAE,0BAA0B;CAc9B"}
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.InvalidArgumentError = void 0;
4
- class InvalidArgumentError extends Error {
1
+ export class InvalidArgumentError extends Error {
5
2
  constructor({ method, param, argument, expected, }) {
6
3
  super(`${String(argument)} is not a valid argument to param ${param} on ${method}(). ` +
7
4
  `It should be ${expected}.`);
@@ -13,4 +10,4 @@ class InvalidArgumentError extends Error {
13
10
  Object.setPrototypeOf(this, new.target.prototype);
14
11
  }
15
12
  }
16
- exports.InvalidArgumentError = InvalidArgumentError;
13
+ //# sourceMappingURL=invalid-argument-error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invalid-argument-error.js","sourceRoot":"","sources":["../../../src/core/errors/invalid-argument-error.ts"],"names":[],"mappings":"AAOA,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IAM7C,YAAY,EACV,MAAM,EACN,KAAK,EACL,QAAQ,EACR,QAAQ,GACmB;QAC3B,KAAK,CACH,GAAG,MAAM,CAAC,QAAQ,CAAC,qCAAqC,KAAK,OAAO,MAAM,MAAM;YAC9E,gBAAgB,QAAQ,GAAG,CAC9B,CAAC;QAEF,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;QACnC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAEzB,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACpD,CAAC;CACF"}
@@ -1 +1,2 @@
1
1
  export type AttributeValidationFunction<T extends object, P extends keyof T = keyof T> = (value: T[P]) => boolean;
2
+ //# sourceMappingURL=attribute-validation-function.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attribute-validation-function.d.ts","sourceRoot":"","sources":["../../../src/core/types/attribute-validation-function.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,2BAA2B,CACrC,CAAC,SAAS,MAAM,EAChB,CAAC,SAAS,MAAM,CAAC,GAAG,MAAM,CAAC,IACzB,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC"}
@@ -1,2 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
2
+ //# sourceMappingURL=attribute-validation-function.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attribute-validation-function.js","sourceRoot":"","sources":["../../../src/core/types/attribute-validation-function.ts"],"names":[],"mappings":""}
@@ -1,6 +1,7 @@
1
- import { AttributeValidationFunction } from './attribute-validation-function';
2
- import { QueryConditionsGroupNullable } from './query-conditions-group-nullable';
1
+ import type { AttributeValidationFunction } from './attribute-validation-function';
2
+ import type { QueryConditionsGroupNullable } from './query-conditions-group-nullable';
3
3
  /**
4
4
  * Condition to apply to a row column.
5
5
  */
6
6
  export type ColumnCondition<T extends object, P extends keyof T> = T[P] extends object ? QueryConditionsGroupNullable<T[P]> | undefined : T[P] | AttributeValidationFunction<T, P> | null | undefined;
7
+ //# sourceMappingURL=column-condition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"column-condition.d.ts","sourceRoot":"","sources":["../../../src/core/types/column-condition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AACnF,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AAEtF;;GAEG;AACH,MAAM,MAAM,eAAe,CACzB,CAAC,SAAS,MAAM,EAChB,CAAC,SAAS,MAAM,CAAC,IACf,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GACnB,4BAA4B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,GAC9C,CAAC,CAAC,CAAC,CAAC,GAAG,2BAA2B,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC"}
@@ -1,2 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
2
+ //# sourceMappingURL=column-condition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"column-condition.js","sourceRoot":"","sources":["../../../src/core/types/column-condition.ts"],"names":[],"mappings":""}
@@ -2,3 +2,4 @@ export * from './attribute-validation-function';
2
2
  export * from './query-conditions-group';
3
3
  export * from './query-conditions-group-nullable';
4
4
  export * from './query-row-validator-initializer';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC;AAChD,cAAc,0BAA0B,CAAC;AACzC,cAAc,mCAAmC,CAAC;AAClD,cAAc,mCAAmC,CAAC"}
@@ -1,20 +1,5 @@
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("./attribute-validation-function"), exports);
18
- __exportStar(require("./query-conditions-group"), exports);
19
- __exportStar(require("./query-conditions-group-nullable"), exports);
20
- __exportStar(require("./query-row-validator-initializer"), exports);
1
+ export * from './attribute-validation-function';
2
+ export * from './query-conditions-group';
3
+ export * from './query-conditions-group-nullable';
4
+ export * from './query-row-validator-initializer';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC;AAChD,cAAc,0BAA0B,CAAC;AACzC,cAAc,mCAAmC,CAAC;AAClD,cAAc,mCAAmC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { addPrefixToObject, PropertyOnly, PropOf } from '../../utils/types';
2
+ export type OrderingColumn<T extends object> = PropOf<T> | keyof addPrefixToObject<PropertyOnly<T>, '-'>;
3
+ //# sourceMappingURL=ordering-column.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ordering-column.d.ts","sourceRoot":"","sources":["../../../src/core/types/ordering-column.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,YAAY,EACZ,MAAM,EACP,MAAM,mBAAmB,CAAC;AAE3B,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,MAAM,IACvC,MAAM,CAAC,CAAC,CAAC,GACT,MAAM,iBAAiB,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ordering-column.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ordering-column.js","sourceRoot":"","sources":["../../../src/core/types/ordering-column.ts"],"names":[],"mappings":""}
@@ -1,4 +1,5 @@
1
- import { PropertyOnly } from '../../utils/types';
1
+ import type { PropertyOnly } from '../../utils/types';
2
2
  export type QueryConditionsGroupNullable<T extends object> = {
3
3
  [P in keyof PropertyOnly<T>]?: T[P] extends object ? QueryConditionsGroupNullable<T[P]> : T[P] | ((value: T[P]) => boolean) | null;
4
4
  };
5
+ //# sourceMappingURL=query-conditions-group-nullable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-conditions-group-nullable.d.ts","sourceRoot":"","sources":["../../../src/core/types/query-conditions-group-nullable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,MAAM,4BAA4B,CAAC,CAAC,SAAS,MAAM,IAAI;KAC1D,CAAC,IAAI,MAAM,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GAC9C,4BAA4B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAClC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,GAAG,IAAI;CAC7C,CAAC"}
@@ -1,2 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
2
+ //# sourceMappingURL=query-conditions-group-nullable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-conditions-group-nullable.js","sourceRoot":"","sources":["../../../src/core/types/query-conditions-group-nullable.ts"],"names":[],"mappings":""}
@@ -1,4 +1,5 @@
1
- import { PropertyOnly } from '../../utils/types';
1
+ import type { PropertyOnly } from '../../utils/types';
2
2
  export type QueryConditionsGroup<T extends object> = {
3
3
  [P in keyof PropertyOnly<T>]?: T[P] extends object ? QueryConditionsGroup<T[P]> : T[P] | ((value: T[P]) => boolean);
4
4
  };
5
+ //# sourceMappingURL=query-conditions-group.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-conditions-group.d.ts","sourceRoot":"","sources":["../../../src/core/types/query-conditions-group.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,MAAM,oBAAoB,CAAC,CAAC,SAAS,MAAM,IAAI;KAClD,CAAC,IAAI,MAAM,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GAC9C,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAC1B,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC;CACtC,CAAC"}
@@ -1,2 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
2
+ //# sourceMappingURL=query-conditions-group.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-conditions-group.js","sourceRoot":"","sources":["../../../src/core/types/query-conditions-group.ts"],"names":[],"mappings":""}
@@ -1,4 +1,4 @@
1
- import { QueryConditionsGroupNullable } from './query-conditions-group-nullable';
1
+ import type { QueryConditionsGroupNullable } from './query-conditions-group-nullable';
2
2
  /**
3
3
  * Validator configuration.
4
4
  */
@@ -6,3 +6,4 @@ export interface QueryRowValidatorInitializer<T extends object> {
6
6
  conditionsObject: QueryConditionsGroupNullable<T>;
7
7
  ignoreNullValues: boolean;
8
8
  }
9
+ //# sourceMappingURL=query-row-validator-initializer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-row-validator-initializer.d.ts","sourceRoot":"","sources":["../../../src/core/types/query-row-validator-initializer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AAEtF;;GAEG;AACH,MAAM,WAAW,4BAA4B,CAAC,CAAC,SAAS,MAAM;IAC5D,gBAAgB,EAAE,4BAA4B,CAAC,CAAC,CAAC,CAAC;IAClD,gBAAgB,EAAE,OAAO,CAAC;CAC3B"}
@@ -1,2 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
2
+ //# sourceMappingURL=query-row-validator-initializer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-row-validator-initializer.js","sourceRoot":"","sources":["../../../src/core/types/query-row-validator-initializer.ts"],"names":[],"mappings":""}
@@ -1 +1,2 @@
1
1
  export * from './number-validaton';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/validation/decorators/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
@@ -1,17 +1,2 @@
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);
1
+ export * from './number-validaton';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/validation/decorators/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
@@ -1,36 +1,5 @@
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;
1
+ export declare function min(value: number): (target: object, propertyKey: string | symbol, index: number) => void;
2
+ export declare function max(value: number): (target: object, propertyKey: string | symbol, index: number) => void;
3
+ export declare function integer(target: object, propertyKey: string | symbol, index: number): void;
4
+ export declare function validateNumbers(target: object, propertyKey: string, descriptor: TypedPropertyDescriptor<any>): void;
5
+ //# sourceMappingURL=number-validaton.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"number-validaton.d.ts","sourceRoot":"","sources":["../../../../src/core/validation/decorators/number-validaton.ts"],"names":[],"mappings":"AAiCA,wBAAgB,GAAG,CAAC,KAAK,EAAE,MAAM,IAE7B,QAAQ,MAAM,EACd,aAAa,MAAM,GAAG,MAAM,EAC5B,OAAO,MAAM,KACZ,IAAI,CAWR;AAED,wBAAgB,GAAG,CAAC,KAAK,EAAE,MAAM,IAE7B,QAAQ,MAAM,EACd,aAAa,MAAM,GAAG,MAAM,EAC5B,OAAO,MAAM,KACZ,IAAI,CAWR;AAED,wBAAgB,OAAO,CACrB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,GAAG,MAAM,EAC5B,KAAK,EAAE,MAAM,GACZ,IAAI,CAUN;AAED,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EAEnB,UAAU,EAAE,uBAAuB,CAAC,GAAG,CAAC,GACvC,IAAI,CAgDN"}