querier-ts 2.3.0 → 2.4.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.
- package/CHANGELOG.md +159 -0
- package/README.md +78 -0
- package/dist/cjs/index.cjs +1 -0
- package/{lib/query.d.ts → dist/esm/index.d.ts} +122 -33
- package/dist/esm/index.js +1 -0
- package/package.json +39 -27
- package/lib/core/errors/index.d.ts +0 -2
- package/lib/core/errors/index.d.ts.map +0 -1
- package/lib/core/errors/index.js +0 -2
- package/lib/core/errors/index.js.map +0 -1
- package/lib/core/errors/invalid-argument-error.d.ts +0 -4
- package/lib/core/errors/invalid-argument-error.d.ts.map +0 -1
- package/lib/core/errors/invalid-argument-error.js +0 -7
- package/lib/core/errors/invalid-argument-error.js.map +0 -1
- package/lib/core/types/attribute-validation-function.d.ts +0 -2
- package/lib/core/types/attribute-validation-function.d.ts.map +0 -1
- package/lib/core/types/attribute-validation-function.js +0 -2
- package/lib/core/types/attribute-validation-function.js.map +0 -1
- package/lib/core/types/column-condition.d.ts +0 -7
- package/lib/core/types/column-condition.d.ts.map +0 -1
- package/lib/core/types/column-condition.js +0 -2
- package/lib/core/types/column-condition.js.map +0 -1
- package/lib/core/types/index.d.ts +0 -5
- package/lib/core/types/index.d.ts.map +0 -1
- package/lib/core/types/index.js +0 -5
- package/lib/core/types/index.js.map +0 -1
- package/lib/core/types/nullable-condition.d.ts +0 -2
- package/lib/core/types/nullable-condition.d.ts.map +0 -1
- package/lib/core/types/nullable-condition.js +0 -2
- package/lib/core/types/nullable-condition.js.map +0 -1
- package/lib/core/types/ordering-column.d.ts +0 -3
- package/lib/core/types/ordering-column.d.ts.map +0 -1
- package/lib/core/types/ordering-column.js +0 -2
- package/lib/core/types/ordering-column.js.map +0 -1
- package/lib/core/types/query-conditions-group-nullable.d.ts +0 -6
- package/lib/core/types/query-conditions-group-nullable.d.ts.map +0 -1
- package/lib/core/types/query-conditions-group-nullable.js +0 -2
- package/lib/core/types/query-conditions-group-nullable.js.map +0 -1
- package/lib/core/types/query-conditions-group.d.ts +0 -5
- package/lib/core/types/query-conditions-group.d.ts.map +0 -1
- package/lib/core/types/query-conditions-group.js +0 -2
- package/lib/core/types/query-conditions-group.js.map +0 -1
- package/lib/core/types/query-row-validator-initializer.d.ts +0 -9
- package/lib/core/types/query-row-validator-initializer.d.ts.map +0 -1
- package/lib/core/types/query-row-validator-initializer.js +0 -2
- package/lib/core/types/query-row-validator-initializer.js.map +0 -1
- package/lib/core/types/validation-options.d.ts +0 -4
- package/lib/core/types/validation-options.d.ts.map +0 -1
- package/lib/core/types/validation-options.js +0 -2
- package/lib/core/types/validation-options.js.map +0 -1
- package/lib/core/validation/decorators/index.d.ts +0 -2
- package/lib/core/validation/decorators/index.d.ts.map +0 -1
- package/lib/core/validation/decorators/index.js +0 -2
- package/lib/core/validation/decorators/index.js.map +0 -1
- package/lib/core/validation/decorators/number-validaton.d.ts +0 -5
- package/lib/core/validation/decorators/number-validaton.d.ts.map +0 -1
- package/lib/core/validation/decorators/number-validaton.js +0 -84
- package/lib/core/validation/decorators/number-validaton.js.map +0 -1
- package/lib/core/validation/index.d.ts +0 -2
- package/lib/core/validation/index.d.ts.map +0 -1
- package/lib/core/validation/index.js +0 -2
- package/lib/core/validation/index.js.map +0 -1
- package/lib/core/validation/query-row-validator.d.ts +0 -24
- package/lib/core/validation/query-row-validator.d.ts.map +0 -1
- package/lib/core/validation/query-row-validator.js +0 -59
- package/lib/core/validation/query-row-validator.js.map +0 -1
- package/lib/index.d.ts +0 -2
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js +0 -2
- package/lib/index.js.map +0 -1
- package/lib/query.d.ts.map +0 -1
- package/lib/query.js +0 -393
- package/lib/query.js.map +0 -1
- package/lib/utils/functions/generic/compare-arrays.d.ts +0 -2
- package/lib/utils/functions/generic/compare-arrays.d.ts.map +0 -1
- package/lib/utils/functions/generic/compare-arrays.js +0 -3
- package/lib/utils/functions/generic/compare-arrays.js.map +0 -1
- package/lib/utils/functions/generic/deep-equal.d.ts +0 -2
- package/lib/utils/functions/generic/deep-equal.d.ts.map +0 -1
- package/lib/utils/functions/generic/deep-equal.js +0 -20
- package/lib/utils/functions/generic/deep-equal.js.map +0 -1
- package/lib/utils/functions/generic/get-entries.d.ts +0 -2
- package/lib/utils/functions/generic/get-entries.d.ts.map +0 -1
- package/lib/utils/functions/generic/get-entries.js +0 -4
- package/lib/utils/functions/generic/get-entries.js.map +0 -1
- package/lib/utils/functions/generic/get-object-property-names.d.ts +0 -3
- package/lib/utils/functions/generic/get-object-property-names.d.ts.map +0 -1
- package/lib/utils/functions/generic/get-object-property-names.js +0 -4
- package/lib/utils/functions/generic/get-object-property-names.js.map +0 -1
- package/lib/utils/functions/generic/index.d.ts +0 -4
- package/lib/utils/functions/generic/index.d.ts.map +0 -1
- package/lib/utils/functions/generic/index.js +0 -4
- package/lib/utils/functions/generic/index.js.map +0 -1
- package/lib/utils/functions/sort/index.d.ts +0 -3
- package/lib/utils/functions/sort/index.d.ts.map +0 -1
- package/lib/utils/functions/sort/index.js +0 -3
- package/lib/utils/functions/sort/index.js.map +0 -1
- package/lib/utils/functions/sort/sort-by-properties.d.ts +0 -3
- package/lib/utils/functions/sort/sort-by-properties.d.ts.map +0 -1
- package/lib/utils/functions/sort/sort-by-properties.js +0 -16
- package/lib/utils/functions/sort/sort-by-properties.js.map +0 -1
- package/lib/utils/functions/sort/sort-by-property.d.ts +0 -3
- package/lib/utils/functions/sort/sort-by-property.d.ts.map +0 -1
- package/lib/utils/functions/sort/sort-by-property.js +0 -25
- package/lib/utils/functions/sort/sort-by-property.js.map +0 -1
- package/lib/utils/functions/type-guards/index.d.ts +0 -4
- package/lib/utils/functions/type-guards/index.d.ts.map +0 -1
- package/lib/utils/functions/type-guards/index.js +0 -4
- package/lib/utils/functions/type-guards/index.js.map +0 -1
- package/lib/utils/functions/type-guards/is-function.d.ts +0 -10
- package/lib/utils/functions/type-guards/is-function.d.ts.map +0 -1
- package/lib/utils/functions/type-guards/is-function.js +0 -11
- package/lib/utils/functions/type-guards/is-function.js.map +0 -1
- package/lib/utils/functions/type-guards/is-number.d.ts +0 -9
- package/lib/utils/functions/type-guards/is-number.d.ts.map +0 -1
- package/lib/utils/functions/type-guards/is-number.js +0 -9
- package/lib/utils/functions/type-guards/is-number.js.map +0 -1
- package/lib/utils/functions/type-guards/is-object.d.ts +0 -9
- package/lib/utils/functions/type-guards/is-object.d.ts.map +0 -1
- package/lib/utils/functions/type-guards/is-object.js +0 -9
- package/lib/utils/functions/type-guards/is-object.js.map +0 -1
- package/lib/utils/types/add-prefix-to-object.d.ts +0 -4
- package/lib/utils/types/add-prefix-to-object.d.ts.map +0 -1
- package/lib/utils/types/add-prefix-to-object.js +0 -2
- package/lib/utils/types/add-prefix-to-object.js.map +0 -1
- package/lib/utils/types/allowed-names.d.ts +0 -6
- package/lib/utils/types/allowed-names.d.ts.map +0 -1
- package/lib/utils/types/allowed-names.js +0 -2
- package/lib/utils/types/allowed-names.js.map +0 -1
- package/lib/utils/types/flag-excluded-type.d.ts +0 -7
- package/lib/utils/types/flag-excluded-type.d.ts.map +0 -1
- package/lib/utils/types/flag-excluded-type.js +0 -2
- package/lib/utils/types/flag-excluded-type.js.map +0 -1
- package/lib/utils/types/generic-object.d.ts +0 -4
- package/lib/utils/types/generic-object.d.ts.map +0 -1
- package/lib/utils/types/generic-object.js +0 -2
- package/lib/utils/types/generic-object.js.map +0 -1
- package/lib/utils/types/index.d.ts +0 -11
- package/lib/utils/types/index.d.ts.map +0 -1
- package/lib/utils/types/index.js +0 -11
- package/lib/utils/types/index.js.map +0 -1
- package/lib/utils/types/omit-type.d.ts +0 -6
- package/lib/utils/types/omit-type.d.ts.map +0 -1
- package/lib/utils/types/omit-type.js +0 -2
- package/lib/utils/types/omit-type.js.map +0 -1
- package/lib/utils/types/partial-of-properties.d.ts +0 -3
- package/lib/utils/types/partial-of-properties.d.ts.map +0 -1
- package/lib/utils/types/partial-of-properties.js +0 -2
- package/lib/utils/types/partial-of-properties.js.map +0 -1
- package/lib/utils/types/prop-of.d.ts +0 -6
- package/lib/utils/types/prop-of.d.ts.map +0 -1
- package/lib/utils/types/prop-of.js +0 -2
- package/lib/utils/types/prop-of.js.map +0 -1
- package/lib/utils/types/property-only.d.ts +0 -5
- package/lib/utils/types/property-only.d.ts.map +0 -1
- package/lib/utils/types/property-only.js +0 -2
- package/lib/utils/types/property-only.js.map +0 -1
- package/lib/utils/types/recursive-partial.d.ts +0 -4
- package/lib/utils/types/recursive-partial.d.ts.map +0 -1
- package/lib/utils/types/recursive-partial.js +0 -2
- package/lib/utils/types/recursive-partial.js.map +0 -1
- package/lib/utils/types/sort-function.d.ts +0 -2
- package/lib/utils/types/sort-function.d.ts.map +0 -1
- package/lib/utils/types/sort-function.js +0 -2
- package/lib/utils/types/sort-function.js.map +0 -1
- package/lib/utils/types/type.d.ts +0 -5
- package/lib/utils/types/type.d.ts.map +0 -1
- package/lib/utils/types/type.js +0 -2
- package/lib/utils/types/type.js.map +0 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## v2.4.0
|
|
4
|
+
|
|
5
|
+
### Changes
|
|
6
|
+
|
|
7
|
+
- [ ] Bug fixes
|
|
8
|
+
- [ ] Code refactoring
|
|
9
|
+
- [x] New features
|
|
10
|
+
- [x] Build improvements
|
|
11
|
+
- [ ] Breaking changes
|
|
12
|
+
|
|
13
|
+
### New Features
|
|
14
|
+
|
|
15
|
+
- Added `min()`, `max()`, `sum()`, and `average()` methods to `Query`.
|
|
16
|
+
|
|
17
|
+
### Build Improvements
|
|
18
|
+
- Improved build output by introducing separate ESM and CJS bundles.
|
|
19
|
+
- ESM files are now emitted to `dist/esm` and CJS files to `dist/cjs`.
|
|
20
|
+
- Updated package exports to provide better compatibility with modern bundlers and Node.js.
|
|
21
|
+
- Reduced bundle size through improved minification and build configuration.
|
|
22
|
+
- Refactored build pipeline using multiple `tsup` configurations.
|
|
23
|
+
- Ensured type declarations are emitted only once to avoid duplication.
|
|
24
|
+
|
|
25
|
+
## v2.3.1
|
|
26
|
+
|
|
27
|
+
- Optimized build process with [tsup](https://tsup.egoist.dev/), tree-shaking and minification.
|
|
28
|
+
- Removed `utility-types` from dependencies list.
|
|
29
|
+
|
|
30
|
+
## v2.3.0
|
|
31
|
+
|
|
32
|
+
### Features
|
|
33
|
+
|
|
34
|
+
- Added optional `mapFn` to `groupBy()` method to transform grouped values.
|
|
35
|
+
|
|
36
|
+
## v2.2.0
|
|
37
|
+
|
|
38
|
+
### Features
|
|
39
|
+
|
|
40
|
+
- Added an overload to `groupBy()` supporting both property keys and custom grouping functions.
|
|
41
|
+
|
|
42
|
+
### Improvements
|
|
43
|
+
|
|
44
|
+
- Internal code refactoring with no functional changes.
|
|
45
|
+
- Updated the build process to ignore test files.
|
|
46
|
+
- Updated `.npmignore` file contents.
|
|
47
|
+
|
|
48
|
+
## v2.1.1
|
|
49
|
+
|
|
50
|
+
- Rebuild v2.1.0, for `lib` was outdated.
|
|
51
|
+
|
|
52
|
+
## v2.1.0
|
|
53
|
+
|
|
54
|
+
- Added method `map()` to `Query`, intended for data projection, but more flexible and better suited for complex transformations.
|
|
55
|
+
|
|
56
|
+
## v2.0.2
|
|
57
|
+
|
|
58
|
+
This release includes minor internal refactoring. There are no new features or breaking changes.
|
|
59
|
+
|
|
60
|
+
## Improvementskv
|
|
61
|
+
|
|
62
|
+
- Performed micro-optimizations on array operations.
|
|
63
|
+
|
|
64
|
+
## v2.0.1
|
|
65
|
+
|
|
66
|
+
This release includes minor internal refactoring. There are no new features or breaking changes.
|
|
67
|
+
|
|
68
|
+
## Improvements
|
|
69
|
+
|
|
70
|
+
- Avoid repeated instantiation of `QueryRowValidator` during row validation by leveraging static members.
|
|
71
|
+
- Replace `Array.prototype.every()` with a `for...of` loop for improved performance.
|
|
72
|
+
|
|
73
|
+
## v2.0.0
|
|
74
|
+
|
|
75
|
+
### Changes
|
|
76
|
+
|
|
77
|
+
* Updated the `select()` method to return a new `Query` instance containing only the selected columns.
|
|
78
|
+
* Added a new `groupBy()` method, which returns a `Map` with results grouped by the specified column.
|
|
79
|
+
* Added an optional `column` parameter to the `column()` method, allowing you to specify which column's values should be returned.
|
|
80
|
+
* Updated the `orderBy()` method to sort query results immediately, restoring the behavior from previous versions.
|
|
81
|
+
|
|
82
|
+
### Other Improvements
|
|
83
|
+
|
|
84
|
+
* Replaced Jest with Vitest, improving test performance.
|
|
85
|
+
* Added test coverage reporting.
|
|
86
|
+
* Expanded the test suite to cover more execution paths.
|
|
87
|
+
|
|
88
|
+
## v1.0.2
|
|
89
|
+
|
|
90
|
+
Impacts:
|
|
91
|
+
|
|
92
|
+
### Production
|
|
93
|
+
|
|
94
|
+
- Code refactory: replaced legacy code with modern alternatives without modifying behavior.
|
|
95
|
+
- Removed `reflect-metadata` from dependencies list.
|
|
96
|
+
|
|
97
|
+
### Development
|
|
98
|
+
|
|
99
|
+
- Replaced `tslint` by `eslint`.
|
|
100
|
+
- Updated `tsconfig.json` with stricter options.
|
|
101
|
+
|
|
102
|
+
## v1.0.1
|
|
103
|
+
|
|
104
|
+
### Ensure rows immutability in `orderBy()`
|
|
105
|
+
|
|
106
|
+
`orderBy()` behavior was updated to register the ordering option and apply it only to the results instead of sorting the actual rows immediately.
|
|
107
|
+
|
|
108
|
+
Before:
|
|
109
|
+
|
|
110
|
+
```ts
|
|
111
|
+
const results = Query.from(users)
|
|
112
|
+
.orderBy('-name') // rows would be sorted immediately
|
|
113
|
+
// ...
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
One problem with the former approach is that it was not possible to override the sorting by calling `orderBy` a second time; instead, the rows would only be sorted again.
|
|
117
|
+
|
|
118
|
+
Now:
|
|
119
|
+
|
|
120
|
+
```ts
|
|
121
|
+
const results = Query.from(users)
|
|
122
|
+
.orderBy('-name')
|
|
123
|
+
.orderBy('name') // the overriden orderBy option is the only one applied,
|
|
124
|
+
// affecting only the final results
|
|
125
|
+
// ...
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
The new approach ensures that the inner rows always remain the same, maintaining their original order.
|
|
129
|
+
|
|
130
|
+
It is also possible to clear the ordering now:
|
|
131
|
+
|
|
132
|
+
```ts
|
|
133
|
+
const results = Query.from(users)
|
|
134
|
+
.orderBy('name')
|
|
135
|
+
.orderBy() // no sorting logic will be applied to the rows
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Fix Jest configuration
|
|
139
|
+
|
|
140
|
+
Update match to include `__tests__/*.spec.ts` files only. The previous configuration enabled testing JS and TS type files too, causing errors.
|
|
141
|
+
|
|
142
|
+
### Other improvements
|
|
143
|
+
|
|
144
|
+
- Create a `.prettierignore` file.
|
|
145
|
+
- Update `.npmignore` file contents.
|
|
146
|
+
|
|
147
|
+
## v1.0.0
|
|
148
|
+
|
|
149
|
+
Updates:
|
|
150
|
+
|
|
151
|
+
- Dependencies updated.
|
|
152
|
+
- Code refactored keeping previous behavior.
|
|
153
|
+
- Unit tests created or reviewed to cover the whole codebase.
|
|
154
|
+
- Migrated from npm to pnpm.
|
|
155
|
+
- Prettier configuration updated and integrated with Visual Studio Code.
|
|
156
|
+
|
|
157
|
+
## v0.0.0
|
|
158
|
+
|
|
159
|
+
Create initial project.
|
package/README.md
CHANGED
|
@@ -315,3 +315,81 @@ const idsByNotificationPreference = Query.from(users).groupBy(
|
|
|
315
315
|
);
|
|
316
316
|
// Map<boolean, number[]>
|
|
317
317
|
```
|
|
318
|
+
|
|
319
|
+
### Aggregating data
|
|
320
|
+
|
|
321
|
+
#### `min(key | callback)`
|
|
322
|
+
|
|
323
|
+
Returns the minimum numeric value from the results.
|
|
324
|
+
|
|
325
|
+
- `key`: The numeric column to evaluate.
|
|
326
|
+
- `callback`: A function that maps each row to a number.
|
|
327
|
+
|
|
328
|
+
Returns `null` if no rows exist.
|
|
329
|
+
|
|
330
|
+
```ts
|
|
331
|
+
// Using a column
|
|
332
|
+
const minAge = Query.from(users).min('age');
|
|
333
|
+
|
|
334
|
+
// Using a callback
|
|
335
|
+
const minNameLength = Query.from(users).min(
|
|
336
|
+
(user) => user.name.length
|
|
337
|
+
);
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
#### `max(key | callback)`
|
|
341
|
+
|
|
342
|
+
Returns the maximum numeric value from the results.
|
|
343
|
+
|
|
344
|
+
- `key`: The numeric column to evaluate.
|
|
345
|
+
- `callback`: A function that maps each row to a number.
|
|
346
|
+
|
|
347
|
+
Returns `null` if no rows exist.
|
|
348
|
+
|
|
349
|
+
```ts
|
|
350
|
+
// Using a column
|
|
351
|
+
const maxAge = Query.from(users).max('age');
|
|
352
|
+
|
|
353
|
+
// Using a callback
|
|
354
|
+
const maxNameLength = Query.from(users).max(
|
|
355
|
+
(user) => user.name.length
|
|
356
|
+
);
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
#### `sum(key | callback)`
|
|
360
|
+
|
|
361
|
+
Returns the sum of numeric values from the results.
|
|
362
|
+
|
|
363
|
+
- `key`: The numeric column to evaluate.
|
|
364
|
+
- `callback`: A function that maps each row to a number.
|
|
365
|
+
|
|
366
|
+
Returns `0` if no rows exist.
|
|
367
|
+
|
|
368
|
+
```ts
|
|
369
|
+
// Using a column
|
|
370
|
+
const totalAge = Query.from(users).sum('age');
|
|
371
|
+
|
|
372
|
+
// Using a callback
|
|
373
|
+
const totalNameLength = Query.from(users).sum(
|
|
374
|
+
(user) => user.name.length
|
|
375
|
+
);
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
#### `average(key | callback)`
|
|
379
|
+
|
|
380
|
+
Returns the average of numeric values from the results.
|
|
381
|
+
|
|
382
|
+
- `key`: The numeric column to evaluate.
|
|
383
|
+
- `callback`: A function that maps each row to a number.
|
|
384
|
+
|
|
385
|
+
Returns `null` if no rows exist.
|
|
386
|
+
|
|
387
|
+
```ts
|
|
388
|
+
// Using a column
|
|
389
|
+
const averageAge = Query.from(users).average('age');
|
|
390
|
+
|
|
391
|
+
// Using a callback
|
|
392
|
+
const averageNameLength = Query.from(users).average(
|
|
393
|
+
(user) => user.name.length
|
|
394
|
+
);
|
|
395
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var S=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var F=n=>{throw TypeError(n)};var x=(n,e,t,r)=>{for(var o=$(e,t),i=n.length-1,s;i>=0;i--)(s=n[i])&&(o=(s(e,t,o))||o);return o&&S(e,t,o),o},h=(n,e)=>(t,r)=>e(t,r,n);var N=(n,e,t)=>e.has(n)||F("Cannot "+t);var l=(n,e,t)=>(N(n,e,"read from private field"),t?t.call(n):e.get(n)),y=(n,e,t)=>e.has(n)?F("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),p=(n,e,t,r)=>(N(n,e,"write to private field"),e.set(n,t),t);var O=n=>typeof n=="number";var b=class extends Error{constructor(e){super(e),this.name="InvalidArgumentError";}};var v=new WeakMap;function V(n,e){let t=v.get(n);t||(t=new Map,v.set(n,t));let r=t.get(e);return r||(r=[],t.set(e,r)),r}function k(n){return function(e,t,r){let o=V(e,t),i=o.find(s=>s.index===r);i?i.min=n:o.push({index:r,min:n});}}function P(n,e,t){let r=V(n,e),o=r.find(i=>i.index===t);o?o.integer=true:r.push({index:t,integer:true});}function C(n,e,t){let r=t.value;t.value=function(...o){let i=v.get(n)?.get(e)??[];for(let s of i){let u=o[s.index];if(s.min!==void 0&&(!O(u)||u<s.min))throw new b(`${String(u)} is not a valid argument to param ${s.index} on ${e}(). Expected value to be equal or greater than ${s.min}.`);if(s.max!==void 0&&(!O(u)||u>s.max))throw new b(`${String(u)} is not a valid argument to param ${s.index} on ${e}(). Expected value to be equal or less than ${s.max}.`);if(s.integer&&!Number.isSafeInteger(u))throw new b(`${String(u)} is not a valid argument to param ${s.index} on ${e}(). Expected value to be an integer.`)}return r.apply(this,o)};}var d=n=>typeof n=="object"&&n!==null;var j=(n,e)=>{if(n===e)return true;if(!d(n)||!d(e)||Array.isArray(n)!==Array.isArray(e))return false;let t=Object.keys(n),r=Object.keys(e);return t.length!==r.length?false:t.every(o=>Object.prototype.hasOwnProperty.call(e,o)&&j(n[o],e[o]))};var A=(n,e)=>n.length===e.length&&n.every((t,r)=>j(t,e[r]));function G(n){return Object.entries(n)}var m=n=>typeof n=="function";var w,g=class{static validate(e,t,r){for(let[o,i]of G(t))if(!this.validateColumnCondition(e,o,i,r??l(this,w)))return false;return true}static validateColumnCondition(e,t,r,o){if(o.ignoreNullValues&&r==null)return true;let i=e[t];return m(r)?r(i):Array.isArray(r)?Array.isArray(i)?A(i,r):false:d(r)?d(i)?this.validate(i,r):false:i===r}};w=new WeakMap,y(g,w,{ignoreNullValues:false});function B(n){return Object.keys(n).filter(e=>typeof n[e]!="function")}function L(n){let e=1,t=n;t.startsWith("-")&&(e=-1,t=t.slice(1));let r=t;return (o,i)=>{let s=o[r],u=i[r];return s==null&&u==null?0:s==null?1*e:u==null||s<u?-1*e:s>u?1*e:0}}function M(...n){return (e,t)=>{if(n.length===0)return 0;for(let r of n){let o=L(r)(e,t);if(o!==0)return o}return 0}}var a,f,T,c=class c{constructor(e){y(this,a,[]);y(this,f,0);y(this,T,null);p(this,a,[...e]);}static from(e){return new c(e)}select(...e){let t=[];for(let o of l(this,a)){let i={};for(let s of e)i[s]=o[s];t.push(i);}let r=new c(t);return this.cloneStateInto(r),r}map(e){let t=[];for(let o of l(this,a))t.push(e(o));let r=new c(t);return this.cloneStateInto(r),r}where(e){return this.filterRows(e),this}filterWhere(e){return this.filterRows(e,{ignoreNullValues:true}),this}orderBy(...e){return p(this,a,l(this,a).sort(M(...e))),this}skip(e){return p(this,f,e),this}limit(e){return p(this,T,e),this}all(){return this.getLimitedRows()}first(){let e=this.getLimitedRows();return e.length>0?e[0]:null}last(){let e=this.getLimitedRows();return e[e.length-1]??null}count(){return this.getLimitedRows().length}exists(){return this.count()>0}scalar(){let e=this.first(),t=this.getFirstColumn();return e&&t?e[t]:false}column(e){if(e===void 0){let t=this.getFirstColumn();if(!t)return [];e=t;}return this.getLimitedRows().map(t=>t[e])}values(){let e=[];for(let t of this.getLimitedRows())e.push(Object.values(t));return e}groupBy(e,t){let r=this.getLimitedRows(),o=new Map,i=m(e);for(let s of r){let u=i?e(s):s[e],K=t?t(s):s;o.has(u)?o.get(u).push(K):o.set(u,[K]);}return o}min(e){let t=this.getLimitedRows();if(t.length===0)return null;let r=m(e)?t.map(o=>e(o)):t.map(o=>o[e]);return r.length===0?null:Math.min(...r)}max(e){let t=this.getLimitedRows();if(t.length===0)return null;let r=m(e)?t.map(o=>e(o)):t.map(o=>o[e]);return r.length===0?null:Math.max(...r)}sum(e){let t=this.getLimitedRows();return t.length===0?0:(m(e)?t.map(o=>e(o)):t.map(o=>o[e])).reduce((o,i)=>o+i,0)}average(e){let t=this.count();return t===0?null:(m(e)?this.sum(e):this.sum(e))/t}filterRows(e,t){let r=l(this,a),o=[];if(m(e))for(let i=0;i<r.length;i++){let s=r[i];e(s)&&o.push(s);}else for(let i=0;i<r.length;i++){let s=r[i];g.validate(s,e,t)&&o.push(s);}p(this,a,o);}getFirstColumn(){let e=this.first();if(!e)return null;let t=B(e);return t.length>0?t[0]:null}getLimitedRows(){let e=[...l(this,a)];return e.slice(l(this,f),l(this,f)+(l(this,T)??e.length))}cloneStateInto(e){p(e,f,l(this,f)),p(e,T,l(this,T));}};a=new WeakMap,f=new WeakMap,T=new WeakMap,x([C,h(0,P),h(0,k(0))],c.prototype,"skip"),x([C,h(0,P),h(0,k(0))],c.prototype,"limit");var R=c;exports.Query=R;
|
|
@@ -1,6 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
type addPrefixToObject<T, P extends string> = {
|
|
2
|
+
[K in keyof T as K extends string ? `${P}${K}` : never]: T[K];
|
|
3
|
+
};
|
|
4
|
+
|
|
5
|
+
type IsFunction<T> = T extends (...args: any[]) => any ? true : false;
|
|
6
|
+
|
|
7
|
+
type NonFunctionKeys<T extends object> = {
|
|
8
|
+
[K in keyof T]: IsFunction<T[K]> extends true ? never : K;
|
|
9
|
+
}[keyof T];
|
|
10
|
+
|
|
11
|
+
type PropertyOnly<T extends object> = {
|
|
12
|
+
[P in NonFunctionKeys<T>]: T[P];
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Represents a property of a class or interface.
|
|
17
|
+
*/
|
|
18
|
+
type PropOf<T extends object> = keyof PropertyOnly<T>;
|
|
19
|
+
|
|
20
|
+
type OrderingColumn<T extends object> = PropOf<T> | keyof addPrefixToObject<PropertyOnly<T>, '-'>;
|
|
21
|
+
|
|
22
|
+
type QueryConditionsGroup<T extends object> = {
|
|
23
|
+
[P in keyof PropertyOnly<T>]?: T[P] extends object ? QueryConditionsGroup<T[P]> : T[P] | ((value: T[P]) => boolean);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
type NullableCondition<T> = T | ((value: T) => boolean) | null | undefined;
|
|
27
|
+
|
|
28
|
+
type QueryConditionsGroupNullable<T extends object> = {
|
|
29
|
+
[P in keyof PropertyOnly<T>]?: T[P] extends object ? QueryConditionsGroupNullable<T[P]> : NullableCondition<T[P]>;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
type KeysOfType<T, TValue> = {
|
|
33
|
+
[K in keyof T]: T[K] extends TValue ? K : never;
|
|
34
|
+
}[keyof T];
|
|
35
|
+
|
|
4
36
|
/**
|
|
5
37
|
* Allows filtering data from an array of objects.
|
|
6
38
|
*
|
|
@@ -47,7 +79,7 @@ import type { PropOf } from './utils/types';
|
|
|
47
79
|
* const numberOfUsers = Query.from(users).count();
|
|
48
80
|
* ```
|
|
49
81
|
*/
|
|
50
|
-
|
|
82
|
+
declare class Query<T extends object> {
|
|
51
83
|
#private;
|
|
52
84
|
/**
|
|
53
85
|
* Initializes the query.
|
|
@@ -152,6 +184,58 @@ export declare class Query<T extends object> {
|
|
|
152
184
|
* @throws {InvalidArgumentError} If the given limit is less than 0.
|
|
153
185
|
*/
|
|
154
186
|
limit(limit: number): this;
|
|
187
|
+
/**
|
|
188
|
+
* Returns all results.
|
|
189
|
+
*
|
|
190
|
+
* @returns All filtered rows.
|
|
191
|
+
*/
|
|
192
|
+
all(): T[];
|
|
193
|
+
/**
|
|
194
|
+
* Returns the first result.
|
|
195
|
+
*
|
|
196
|
+
* @returns The first result.
|
|
197
|
+
*/
|
|
198
|
+
first(): T | null;
|
|
199
|
+
/**
|
|
200
|
+
* Returns the last result.
|
|
201
|
+
*
|
|
202
|
+
* @returns The last result.
|
|
203
|
+
*/
|
|
204
|
+
last(): T | null;
|
|
205
|
+
/**
|
|
206
|
+
* Returns the current number of rows.
|
|
207
|
+
*
|
|
208
|
+
* @return Filtered rows count.
|
|
209
|
+
*/
|
|
210
|
+
count(): number;
|
|
211
|
+
/**
|
|
212
|
+
* Checks if there is at least one row compatible with the query.
|
|
213
|
+
*
|
|
214
|
+
* @returns Whether any row exists after filtering.
|
|
215
|
+
*/
|
|
216
|
+
exists(): boolean;
|
|
217
|
+
/**
|
|
218
|
+
* Returns the value of the first (selected) column of the first row.
|
|
219
|
+
*
|
|
220
|
+
* @returns First value or `false`, if none row exists.
|
|
221
|
+
*/
|
|
222
|
+
scalar(): T[PropOf<T>] | false;
|
|
223
|
+
/**
|
|
224
|
+
* Returns the values of the first (selected) column of all rows.
|
|
225
|
+
*
|
|
226
|
+
* @param column (Optional) The column to get the values from.
|
|
227
|
+
*
|
|
228
|
+
* @returns Values from the first (selected) column.
|
|
229
|
+
*/
|
|
230
|
+
column(): T[PropOf<T>][];
|
|
231
|
+
column<TColumn extends PropOf<T>>(column: TColumn): T[TColumn][];
|
|
232
|
+
/**
|
|
233
|
+
* Returns the values of the rows. If there are selected columns, only their
|
|
234
|
+
* values will be returned.
|
|
235
|
+
*
|
|
236
|
+
* @returns Array with the values of all rows.
|
|
237
|
+
*/
|
|
238
|
+
values(): T[PropOf<T>][][];
|
|
155
239
|
/**
|
|
156
240
|
* Groups the results by a specific key.
|
|
157
241
|
*
|
|
@@ -186,57 +270,61 @@ export declare class Query<T extends object> {
|
|
|
186
270
|
*/
|
|
187
271
|
groupBy<TGrouper, TReturn>(groupFn: (row: T) => TGrouper, mapFn: (row: T) => TReturn): Map<TGrouper, TReturn[]>;
|
|
188
272
|
/**
|
|
189
|
-
* Returns
|
|
273
|
+
* Returns the minimum value of a column.
|
|
190
274
|
*
|
|
191
|
-
* @
|
|
275
|
+
* @param key Column to get the minimum value from.
|
|
276
|
+
* @returns Minimum value or `null`, if no rows exist.
|
|
192
277
|
*/
|
|
193
|
-
|
|
278
|
+
min<K extends KeysOfType<T, number>>(key: K): number | null;
|
|
194
279
|
/**
|
|
195
|
-
* Returns the
|
|
280
|
+
* Returns the minimum value of the mapped rows by a callback.
|
|
196
281
|
*
|
|
197
|
-
* @
|
|
282
|
+
* @param callback Callback to map the rows.
|
|
283
|
+
* @returns Minimum value or `null`, if no rows exist.
|
|
198
284
|
*/
|
|
199
|
-
|
|
285
|
+
min(callback: (row: T) => number): number | null;
|
|
200
286
|
/**
|
|
201
|
-
* Returns the
|
|
287
|
+
* Returns the maximum value of a column.
|
|
202
288
|
*
|
|
203
|
-
* @
|
|
289
|
+
* @param key Column to get the maximum value from.
|
|
290
|
+
* @returns Maximum value or `null`, if no rows exist.
|
|
204
291
|
*/
|
|
205
|
-
|
|
292
|
+
max<K extends KeysOfType<T, number>>(key: K): number | null;
|
|
206
293
|
/**
|
|
207
|
-
* Returns the value of the
|
|
294
|
+
* Returns the maximum value of the mapped rows by a callback.
|
|
208
295
|
*
|
|
209
|
-
* @
|
|
296
|
+
* @param callback Callback to map the rows.
|
|
297
|
+
* @returns Maximum value or `null`, if no rows exist.
|
|
210
298
|
*/
|
|
211
|
-
|
|
299
|
+
max(callback: (row: T) => number): number | null;
|
|
212
300
|
/**
|
|
213
|
-
* Returns the
|
|
301
|
+
* Returns the sum of the values of a column.
|
|
214
302
|
*
|
|
215
|
-
* @param
|
|
216
|
-
*
|
|
217
|
-
* @returns Values from the first (selected) column.
|
|
303
|
+
* @param key Column to get the sum from.
|
|
304
|
+
* @returns Sum.
|
|
218
305
|
*/
|
|
219
|
-
|
|
220
|
-
column<TColumn extends PropOf<T>>(column: TColumn): T[TColumn][];
|
|
306
|
+
sum<K extends KeysOfType<T, number>>(key: K): number;
|
|
221
307
|
/**
|
|
222
|
-
* Returns the
|
|
223
|
-
* values will be returned.
|
|
308
|
+
* Returns the sum of the mapped rows by a callback.
|
|
224
309
|
*
|
|
225
|
-
* @
|
|
310
|
+
* @param callback Callback to map the rows.
|
|
311
|
+
* @returns Sum.
|
|
226
312
|
*/
|
|
227
|
-
|
|
313
|
+
sum(callback: (row: T) => number): number;
|
|
228
314
|
/**
|
|
229
|
-
* Returns the
|
|
315
|
+
* Returns the average of the values of a column.
|
|
230
316
|
*
|
|
231
|
-
* @
|
|
317
|
+
* @param key Column to get the average from.
|
|
318
|
+
* @returns Average or `null`, if no rows exist.
|
|
232
319
|
*/
|
|
233
|
-
|
|
320
|
+
average<K extends KeysOfType<T, number>>(key: K): number | null;
|
|
234
321
|
/**
|
|
235
|
-
*
|
|
322
|
+
* Returns the average of the mapped rows by a callback.
|
|
236
323
|
*
|
|
237
|
-
* @
|
|
324
|
+
* @param callback Callback to map the rows.
|
|
325
|
+
* @returns Average or `null`, if no rows exist.
|
|
238
326
|
*/
|
|
239
|
-
|
|
327
|
+
average(callback: (row: T) => number): number | null;
|
|
240
328
|
/**
|
|
241
329
|
* Filters the rows according to the given conditions.
|
|
242
330
|
*
|
|
@@ -262,4 +350,5 @@ export declare class Query<T extends object> {
|
|
|
262
350
|
*/
|
|
263
351
|
private cloneStateInto;
|
|
264
352
|
}
|
|
265
|
-
|
|
353
|
+
|
|
354
|
+
export { Query };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var S=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var F=n=>{throw TypeError(n)};var x=(n,e,t,r)=>{for(var o=$(e,t),i=n.length-1,s;i>=0;i--)(s=n[i])&&(o=(s(e,t,o))||o);return o&&S(e,t,o),o},h=(n,e)=>(t,r)=>e(t,r,n);var N=(n,e,t)=>e.has(n)||F("Cannot "+t);var l=(n,e,t)=>(N(n,e,"read from private field"),t?t.call(n):e.get(n)),y=(n,e,t)=>e.has(n)?F("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),p=(n,e,t,r)=>(N(n,e,"write to private field"),e.set(n,t),t);var O=n=>typeof n=="number";var b=class extends Error{constructor(e){super(e),this.name="InvalidArgumentError";}};var v=new WeakMap;function V(n,e){let t=v.get(n);t||(t=new Map,v.set(n,t));let r=t.get(e);return r||(r=[],t.set(e,r)),r}function k(n){return function(e,t,r){let o=V(e,t),i=o.find(s=>s.index===r);i?i.min=n:o.push({index:r,min:n});}}function P(n,e,t){let r=V(n,e),o=r.find(i=>i.index===t);o?o.integer=true:r.push({index:t,integer:true});}function C(n,e,t){let r=t.value;t.value=function(...o){let i=v.get(n)?.get(e)??[];for(let s of i){let u=o[s.index];if(s.min!==void 0&&(!O(u)||u<s.min))throw new b(`${String(u)} is not a valid argument to param ${s.index} on ${e}(). Expected value to be equal or greater than ${s.min}.`);if(s.max!==void 0&&(!O(u)||u>s.max))throw new b(`${String(u)} is not a valid argument to param ${s.index} on ${e}(). Expected value to be equal or less than ${s.max}.`);if(s.integer&&!Number.isSafeInteger(u))throw new b(`${String(u)} is not a valid argument to param ${s.index} on ${e}(). Expected value to be an integer.`)}return r.apply(this,o)};}var d=n=>typeof n=="object"&&n!==null;var j=(n,e)=>{if(n===e)return true;if(!d(n)||!d(e)||Array.isArray(n)!==Array.isArray(e))return false;let t=Object.keys(n),r=Object.keys(e);return t.length!==r.length?false:t.every(o=>Object.prototype.hasOwnProperty.call(e,o)&&j(n[o],e[o]))};var A=(n,e)=>n.length===e.length&&n.every((t,r)=>j(t,e[r]));function G(n){return Object.entries(n)}var m=n=>typeof n=="function";var w,g=class{static validate(e,t,r){for(let[o,i]of G(t))if(!this.validateColumnCondition(e,o,i,r??l(this,w)))return false;return true}static validateColumnCondition(e,t,r,o){if(o.ignoreNullValues&&r==null)return true;let i=e[t];return m(r)?r(i):Array.isArray(r)?Array.isArray(i)?A(i,r):false:d(r)?d(i)?this.validate(i,r):false:i===r}};w=new WeakMap,y(g,w,{ignoreNullValues:false});function B(n){return Object.keys(n).filter(e=>typeof n[e]!="function")}function L(n){let e=1,t=n;t.startsWith("-")&&(e=-1,t=t.slice(1));let r=t;return (o,i)=>{let s=o[r],u=i[r];return s==null&&u==null?0:s==null?1*e:u==null||s<u?-1*e:s>u?1*e:0}}function M(...n){return (e,t)=>{if(n.length===0)return 0;for(let r of n){let o=L(r)(e,t);if(o!==0)return o}return 0}}var a,f,T,c=class c{constructor(e){y(this,a,[]);y(this,f,0);y(this,T,null);p(this,a,[...e]);}static from(e){return new c(e)}select(...e){let t=[];for(let o of l(this,a)){let i={};for(let s of e)i[s]=o[s];t.push(i);}let r=new c(t);return this.cloneStateInto(r),r}map(e){let t=[];for(let o of l(this,a))t.push(e(o));let r=new c(t);return this.cloneStateInto(r),r}where(e){return this.filterRows(e),this}filterWhere(e){return this.filterRows(e,{ignoreNullValues:true}),this}orderBy(...e){return p(this,a,l(this,a).sort(M(...e))),this}skip(e){return p(this,f,e),this}limit(e){return p(this,T,e),this}all(){return this.getLimitedRows()}first(){let e=this.getLimitedRows();return e.length>0?e[0]:null}last(){let e=this.getLimitedRows();return e[e.length-1]??null}count(){return this.getLimitedRows().length}exists(){return this.count()>0}scalar(){let e=this.first(),t=this.getFirstColumn();return e&&t?e[t]:false}column(e){if(e===void 0){let t=this.getFirstColumn();if(!t)return [];e=t;}return this.getLimitedRows().map(t=>t[e])}values(){let e=[];for(let t of this.getLimitedRows())e.push(Object.values(t));return e}groupBy(e,t){let r=this.getLimitedRows(),o=new Map,i=m(e);for(let s of r){let u=i?e(s):s[e],K=t?t(s):s;o.has(u)?o.get(u).push(K):o.set(u,[K]);}return o}min(e){let t=this.getLimitedRows();if(t.length===0)return null;let r=m(e)?t.map(o=>e(o)):t.map(o=>o[e]);return r.length===0?null:Math.min(...r)}max(e){let t=this.getLimitedRows();if(t.length===0)return null;let r=m(e)?t.map(o=>e(o)):t.map(o=>o[e]);return r.length===0?null:Math.max(...r)}sum(e){let t=this.getLimitedRows();return t.length===0?0:(m(e)?t.map(o=>e(o)):t.map(o=>o[e])).reduce((o,i)=>o+i,0)}average(e){let t=this.count();return t===0?null:(m(e)?this.sum(e):this.sum(e))/t}filterRows(e,t){let r=l(this,a),o=[];if(m(e))for(let i=0;i<r.length;i++){let s=r[i];e(s)&&o.push(s);}else for(let i=0;i<r.length;i++){let s=r[i];g.validate(s,e,t)&&o.push(s);}p(this,a,o);}getFirstColumn(){let e=this.first();if(!e)return null;let t=B(e);return t.length>0?t[0]:null}getLimitedRows(){let e=[...l(this,a)];return e.slice(l(this,f),l(this,f)+(l(this,T)??e.length))}cloneStateInto(e){p(e,f,l(this,f)),p(e,T,l(this,T));}};a=new WeakMap,f=new WeakMap,T=new WeakMap,x([C,h(0,P),h(0,k(0))],c.prototype,"skip"),x([C,h(0,P),h(0,k(0))],c.prototype,"limit");var R=c;export{R as Query};
|
package/package.json
CHANGED
|
@@ -1,16 +1,48 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "querier-ts",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "2.4.0",
|
|
5
|
+
"description": "A lightweight, type-safe in-memory query engine for JavaScript and TypeScript",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/luizfilipezs/query-ts.git"
|
|
9
|
+
},
|
|
10
|
+
"keywords": [
|
|
11
|
+
"query",
|
|
12
|
+
"data filtering",
|
|
13
|
+
"in-memory"
|
|
14
|
+
],
|
|
15
|
+
"author": {
|
|
16
|
+
"name": "Luiz Filipe da Silva",
|
|
17
|
+
"email": "luizfilipezs@proton.me",
|
|
18
|
+
"url": "https://github.com/luizfilipezs"
|
|
19
|
+
},
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"bugs": {
|
|
22
|
+
"url": "https://github.com/luizfilipezs/query-ts/issues"
|
|
23
|
+
},
|
|
24
|
+
"homepage": "https://github.com/luizfilipezs/query-ts#readme",
|
|
7
25
|
"files": [
|
|
8
|
-
"
|
|
26
|
+
"dist",
|
|
27
|
+
"README.md",
|
|
28
|
+
"LICENSE",
|
|
29
|
+
"CHANGELOG.md"
|
|
9
30
|
],
|
|
31
|
+
"main": "./dist/cjs/index.js",
|
|
32
|
+
"module": "./dist/esm/index.js",
|
|
33
|
+
"types": "./dist/esm/index.d.ts",
|
|
34
|
+
"exports": {
|
|
35
|
+
".": {
|
|
36
|
+
"types": "./dist/esm/index.d.ts",
|
|
37
|
+
"import": "./dist/esm/index.js",
|
|
38
|
+
"require": "./dist/cjs/index.js"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"sideEffects": false,
|
|
10
42
|
"scripts": {
|
|
11
43
|
"test": "vitest",
|
|
12
44
|
"test:cov": "vitest --coverage",
|
|
13
|
-
"build": "
|
|
45
|
+
"build": "tsup",
|
|
14
46
|
"type-check": "tsc --noEmit",
|
|
15
47
|
"format": "prettier --write \"src/**/*.ts\"",
|
|
16
48
|
"lint": "eslint \"src/**/*.ts\" --fix",
|
|
@@ -26,27 +58,6 @@
|
|
|
26
58
|
"eslint --fix"
|
|
27
59
|
]
|
|
28
60
|
},
|
|
29
|
-
"repository": {
|
|
30
|
-
"type": "git",
|
|
31
|
-
"url": "git+https://github.com/luizfilipezs/query-ts.git"
|
|
32
|
-
},
|
|
33
|
-
"keywords": [
|
|
34
|
-
"query",
|
|
35
|
-
"data filtering"
|
|
36
|
-
],
|
|
37
|
-
"author": {
|
|
38
|
-
"name": "Luiz Filipe da Silva",
|
|
39
|
-
"email": "filipeluiz.bs@gmail.com",
|
|
40
|
-
"url": "https://blogdolipe.com.br"
|
|
41
|
-
},
|
|
42
|
-
"license": "MIT",
|
|
43
|
-
"bugs": {
|
|
44
|
-
"url": "https://github.com/luizfilipezs/query-ts/issues"
|
|
45
|
-
},
|
|
46
|
-
"homepage": "https://github.com/luizfilipezs/query-ts#readme",
|
|
47
|
-
"dependencies": {
|
|
48
|
-
"utility-types": "^3.11.0"
|
|
49
|
-
},
|
|
50
61
|
"devDependencies": {
|
|
51
62
|
"@eslint/js": "^10.0.1",
|
|
52
63
|
"@vitest/coverage-v8": "^4.1.2",
|
|
@@ -59,6 +70,7 @@
|
|
|
59
70
|
"lint-staged": "^16.4.0",
|
|
60
71
|
"prettier": "^3.8.1",
|
|
61
72
|
"prettier-plugin-organize-imports": "^4.3.0",
|
|
73
|
+
"tsup": "^8.5.1",
|
|
62
74
|
"typescript": "~5.9.3",
|
|
63
75
|
"typescript-eslint": "^8.57.1",
|
|
64
76
|
"vitest": "^4.1.2"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/errors/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC"}
|
package/lib/core/errors/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/errors/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"invalid-argument-error.d.ts","sourceRoot":"","sources":["../../../src/core/errors/invalid-argument-error.ts"],"names":[],"mappings":"AAAA,qBAAa,oBAAqB,SAAQ,KAAK;gBACjC,OAAO,EAAE,MAAM;CAI5B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"invalid-argument-error.js","sourceRoot":"","sources":["../../../src/core/errors/invalid-argument-error.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IAC7C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;IACrC,CAAC;CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"attribute-validation-function.js","sourceRoot":"","sources":["../../../src/core/types/attribute-validation-function.ts"],"names":[],"mappings":""}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { AttributeValidationFunction } from './attribute-validation-function';
|
|
2
|
-
import type { QueryConditionsGroupNullable } from './query-conditions-group-nullable';
|
|
3
|
-
/**
|
|
4
|
-
* Condition to apply to a row column.
|
|
5
|
-
*/
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"column-condition.js","sourceRoot":"","sources":["../../../src/core/types/column-condition.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/lib/core/types/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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"}
|